@hotstaq/admin-panel 0.2.1 → 0.2.3
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.
- package/.env +3 -2
- package/.vscode/launch.json +16 -23
- package/.vscode/tasks.json +11 -0
- package/HotSite.json +17 -4
- package/assets/html/admin-footer.hott +0 -4
- package/assets/html/admin-header.hott +7 -3
- package/assets/html/admin-sidebar.hott +13 -3
- package/build/src/WebExport.js +2 -2
- package/build/src/WebExport.js.map +1 -1
- package/build/src/cli.d.ts +2 -0
- package/build/src/cli.d.ts.map +1 -0
- package/{assets/components/admin-button.js → build/src/cli.js} +11 -41
- package/build/src/cli.js.map +1 -0
- package/build/src/components/admin-button.d.ts.map +1 -1
- package/build/src/components/admin-button.js.map +1 -1
- package/build/src/components/admin-dashboard.d.ts.map +1 -1
- package/build/src/components/admin-dashboard.js +2 -1
- package/build/src/components/admin-dashboard.js.map +1 -1
- package/build/src/components/admin-edit.d.ts +1 -1
- package/build/src/components/admin-edit.d.ts.map +1 -1
- package/build/src/components/admin-edit.js +2 -1
- package/build/src/components/admin-edit.js.map +1 -1
- package/build/src/components/admin-table-field.d.ts.map +1 -1
- package/build/src/components/admin-table-field.js +4 -2
- package/build/src/components/admin-table-field.js.map +1 -1
- package/build/src/components/admin-table-row.d.ts +3 -1
- package/build/src/components/admin-table-row.d.ts.map +1 -1
- package/build/src/components/admin-table-row.js +2 -6
- package/build/src/components/admin-table-row.js.map +1 -1
- package/build/src/components/admin-table.d.ts.map +1 -1
- package/build/src/components/admin-table.js +2 -1
- package/build/src/components/admin-table.js.map +1 -1
- package/build/src/components/admin-text.d.ts +1 -1
- package/build/src/components/admin-text.d.ts.map +1 -1
- package/build/src/components/admin-text.js +2 -1
- package/build/src/components/admin-text.js.map +1 -1
- package/build-web/AdminPanelComponents.js +2 -0
- package/build-web/AdminPanelWeb_AppAPI.js +238 -0
- package/docker-compose.yaml +39 -0
- package/env-example +1 -0
- package/package.json +5 -5
- package/src/WebExport.ts +2 -2
- package/src/cli.ts +7 -0
- package/src/components/admin-button.ts +3 -3
- package/src/components/admin-dashboard.ts +1 -2
- package/src/components/admin-edit.ts +3 -2
- package/src/components/admin-table-field.ts +3 -3
- package/src/components/admin-table-row.ts +4 -8
- package/src/components/admin-table.ts +1 -2
- package/src/components/admin-text.ts +2 -1
- package/start.sh +9 -0
- package/stop.sh +9 -0
- package/webpack.config.cjs +2 -4
- package/assets/components/admin-dashboard.js +0 -89
- package/assets/components/admin-edit.js +0 -124
- package/assets/components/admin-table-field.js +0 -91
- package/assets/components/admin-table-row.js +0 -104
- package/assets/components/admin-table.js +0 -190
- package/assets/components/admin-text.js +0 -94
- package/build-web/AdminPanel.js +0 -2
- package/build-web/admin-panel.yaml +0 -75
- package/public/index.hott +0 -16
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.AdminDashboard = void 0;
|
|
55
|
-
var hotstaq_1 = require("hotstaq");
|
|
56
|
-
var AdminDashboard = /** @class */ (function (_super) {
|
|
57
|
-
__extends(AdminDashboard, _super);
|
|
58
|
-
function AdminDashboard(copy, api) {
|
|
59
|
-
var _this = _super.call(this, copy, api) || this;
|
|
60
|
-
_this.tag = "admin-dashboard";
|
|
61
|
-
_this.title = "";
|
|
62
|
-
_this.base = "";
|
|
63
|
-
return _this;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Add this table field to the table
|
|
67
|
-
*/
|
|
68
|
-
AdminDashboard.prototype.onPostPlace = function (parentHtmlElement, htmlElement) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
// Set the base API url to use for this dashboard.
|
|
72
|
-
if (this.base != "")
|
|
73
|
-
hotstaq_1.Hot.Data.baseUrl = this.base;
|
|
74
|
-
return [2 /*return*/, (htmlElement)];
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
AdminDashboard.prototype.output = function () {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
return __generator(this, function (_a) {
|
|
81
|
-
return [2 /*return*/, ("\n\t\t<main class=\"col-md-9 ms-sm-auto col-lg-10 px-md-4\">\n\t\t\t<div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\">\n\t\t\t\t<h1 class=\"h2\">".concat(this.title, "</h1>\n\t\t\t\t<div class=\"btn-toolbar mb-2 mb-md-0\">\n\t\t\t\t\t<div class=\"btn-group me-2\">\n\t\t\t\t\t\t<hot-place-here name = \"buttons\"></hot-place-here>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hot-place-here name = \"body\"></hot-place-here>\n\t\t</main>"))];
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
return AdminDashboard;
|
|
86
|
-
}(hotstaq_1.HotComponent));
|
|
87
|
-
exports.AdminDashboard = AdminDashboard;
|
|
88
|
-
hotstaq_1.Hot.CurrentPage.processor.addComponent(AdminDashboard);
|
|
89
|
-
//# sourceMappingURL=admin-dashboard.js.map
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.AdminEdit = void 0;
|
|
55
|
-
var hotstaq_1 = require("hotstaq");
|
|
56
|
-
var AdminEdit = /** @class */ (function (_super) {
|
|
57
|
-
__extends(AdminEdit, _super);
|
|
58
|
-
function AdminEdit(copy, api) {
|
|
59
|
-
var _this = _super.call(this, copy, api) || this;
|
|
60
|
-
_this.tag = "admin-edit";
|
|
61
|
-
_this.title = "";
|
|
62
|
-
_this.button_title = "";
|
|
63
|
-
_this.attached_list = "";
|
|
64
|
-
_this.schema = "";
|
|
65
|
-
_this.fieldElements = {};
|
|
66
|
-
_this.modalId = "";
|
|
67
|
-
return _this;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Save this form.
|
|
71
|
-
*/
|
|
72
|
-
AdminEdit.prototype.onSave = function () {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var values, key, fieldElement, value, attachedList;
|
|
75
|
-
return __generator(this, function (_a) {
|
|
76
|
-
switch (_a.label) {
|
|
77
|
-
case 0:
|
|
78
|
-
values = {};
|
|
79
|
-
for (key in this.fieldElements) {
|
|
80
|
-
fieldElement = this.fieldElements[key];
|
|
81
|
-
value = fieldElement.value;
|
|
82
|
-
values[key] = value;
|
|
83
|
-
}
|
|
84
|
-
return [4 /*yield*/, hotstaq_1.Hot.jsonRequest("".concat(hotstaq_1.Hot.Data.baseUrl, "/v1/data/add"), {
|
|
85
|
-
schema: this.schema,
|
|
86
|
-
fields: values
|
|
87
|
-
})];
|
|
88
|
-
case 1:
|
|
89
|
-
_a.sent();
|
|
90
|
-
attachedList = document.getElementById(this.attached_list);
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
return [4 /*yield*/, attachedList.hotComponent.refreshList()];
|
|
93
|
-
case 2:
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
_a.sent();
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
$("#".concat(this.modalId)).modal("hide");
|
|
98
|
-
return [2 /*return*/];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
AdminEdit.prototype.output = function () {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
return __generator(this, function (_a) {
|
|
106
|
-
if (this.name === "")
|
|
107
|
-
throw new Error("You must specify a name for each admin-edit element!");
|
|
108
|
-
this.modalId = "".concat(this.name, "Modal");
|
|
109
|
-
return [2 /*return*/, ([{
|
|
110
|
-
html: "\n\t\t\t<!-- ".concat(this.title, " Modal Start -->\n\t\t\t<div class=\"modal fade\" id=\"").concat(this.modalId, "\" tabindex=\"-1\" aria-labelledby=\"").concat(this.name, "ModalLabel\" aria-hidden=\"true\">\n\t\t\t\t<div class=\"modal-dialog\">\n\t\t\t\t\t<div class=\"modal-content\">\n\t\t\t\t\t<div class=\"modal-header\">\n\t\t\t\t\t\t<h5 class=\"modal-title\" id=\"").concat(this.name, "ModalLabel\">").concat(this.title, "</h5>\n\t\t\t\t\t\t<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"modal-body\">\n\t\t\t\t\t\t<hot-place-here name = \"modalBody\" type = \"modal\"></hot-place-here>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"modal-footer\">\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button>\n\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary\" onclick = \"document.getElementById('").concat(this.modalId, "').onSave ();\">").concat(this.button_title, "</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<!-- ").concat(this.title, " Modal End -->"),
|
|
111
|
-
parentSelector: "body"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
html: "<button type=\"button\" class=\"btn btn-sm btn-outline-secondary\" data-bs-toggle=\"modal\" onclick = \"$('#".concat(this.modalId, "').modal ('show');\">Add</button>"),
|
|
115
|
-
parentSelector: "hot-place-here[name=\"buttons\"]"
|
|
116
|
-
}])];
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
return AdminEdit;
|
|
121
|
-
}(hotstaq_1.HotComponent));
|
|
122
|
-
exports.AdminEdit = AdminEdit;
|
|
123
|
-
hotstaq_1.Hot.CurrentPage.processor.addComponent(AdminEdit);
|
|
124
|
-
//# sourceMappingURL=admin-edit.js.map
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.AdminTableField = void 0;
|
|
55
|
-
var hotstaq_1 = require("hotstaq");
|
|
56
|
-
var AdminTableField = /** @class */ (function (_super) {
|
|
57
|
-
__extends(AdminTableField, _super);
|
|
58
|
-
function AdminTableField(copy, api) {
|
|
59
|
-
var _this = _super.call(this, copy, api) || this;
|
|
60
|
-
_this.tag = "admin-table-field";
|
|
61
|
-
_this.field = 0;
|
|
62
|
-
return _this;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Add this table field to the table
|
|
66
|
-
*/
|
|
67
|
-
AdminTableField.prototype.onPostPlace = function (parentHtmlElement, htmlElement) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var hotComponent;
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
hotComponent = parentHtmlElement.parentNode.parentNode.parentNode.hotComponent;
|
|
72
|
-
hotComponent.addHeaderDataOnly(this, htmlElement);
|
|
73
|
-
return [2 /*return*/, (htmlElement)];
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
AdminTableField.prototype.output = function () {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
return [2 /*return*/, ([{
|
|
81
|
-
html: "<th>".concat(this.inner, "</th>"),
|
|
82
|
-
placeHereParent: "header"
|
|
83
|
-
}])];
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
return AdminTableField;
|
|
88
|
-
}(hotstaq_1.HotComponent));
|
|
89
|
-
exports.AdminTableField = AdminTableField;
|
|
90
|
-
hotstaq_1.Hot.CurrentPage.processor.addComponent(AdminTableField);
|
|
91
|
-
//# sourceMappingURL=admin-table-field.js.map
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.AdminTableRow = void 0;
|
|
55
|
-
var hotstaq_1 = require("hotstaq");
|
|
56
|
-
var AdminTableRow = /** @class */ (function (_super) {
|
|
57
|
-
__extends(AdminTableRow, _super);
|
|
58
|
-
function AdminTableRow(copy, api) {
|
|
59
|
-
var _this = _super.call(this, copy, api) || this;
|
|
60
|
-
_this.tag = "admin-table-row";
|
|
61
|
-
/**
|
|
62
|
-
* The fields are stored in a key/value object.
|
|
63
|
-
*
|
|
64
|
-
* @example { "name": "John Smith", "email": "john.smith@email.com" }
|
|
65
|
-
*/
|
|
66
|
-
_this.fields = [];
|
|
67
|
-
return _this;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Add this table row to the table
|
|
71
|
-
*/
|
|
72
|
-
AdminTableRow.prototype.onPostPlace = function (parentHtmlElement, htmlElement) {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
return __generator(this, function (_a) {
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
parentHtmlElement.parentNode.parentNode.parentNode.hotComponent.rowElements.push({ fields: this.fields, element: htmlElement });
|
|
77
|
-
return [2 /*return*/, (htmlElement)];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
AdminTableRow.prototype.output = function () {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var rowHtml, iIdx, fieldObj, key, value;
|
|
84
|
-
return __generator(this, function (_a) {
|
|
85
|
-
rowHtml = "";
|
|
86
|
-
for (iIdx = 0; iIdx < this.fields.length; iIdx++) {
|
|
87
|
-
fieldObj = this.fields[iIdx];
|
|
88
|
-
for (key in fieldObj) {
|
|
89
|
-
value = fieldObj[key];
|
|
90
|
-
rowHtml += "<td>".concat(value, "</td>");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return [2 /*return*/, ([{
|
|
94
|
-
html: "<tr>".concat(rowHtml, "</tr>"),
|
|
95
|
-
placeHereParent: "results"
|
|
96
|
-
}])];
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
return AdminTableRow;
|
|
101
|
-
}(hotstaq_1.HotComponent));
|
|
102
|
-
exports.AdminTableRow = AdminTableRow;
|
|
103
|
-
hotstaq_1.Hot.CurrentPage.processor.addComponent(AdminTableRow);
|
|
104
|
-
//# sourceMappingURL=admin-table-row.js.map
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.AdminTable = void 0;
|
|
55
|
-
var hotstaq_1 = require("hotstaq");
|
|
56
|
-
var AdminTable = /** @class */ (function (_super) {
|
|
57
|
-
__extends(AdminTable, _super);
|
|
58
|
-
function AdminTable(copy, api) {
|
|
59
|
-
var _this = _super.call(this, copy, api) || this;
|
|
60
|
-
/**
|
|
61
|
-
* The headers are stored in a key/value object.
|
|
62
|
-
*
|
|
63
|
-
* @example { "name": "<th>Name</th>", "email": "<th>Email</th>" }
|
|
64
|
-
*/
|
|
65
|
-
_this.headerElements = {};
|
|
66
|
-
/**
|
|
67
|
-
* The row elements are stored in an array with key/value fields and it's attached html element.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* {
|
|
71
|
-
* "fields": [
|
|
72
|
-
* {
|
|
73
|
-
* "name": "John Smith",
|
|
74
|
-
* "email": "john.smith@test.com"
|
|
75
|
-
* }
|
|
76
|
-
* ],
|
|
77
|
-
* "html": "<tr><td>John Smith</td><td>john.smith@test.com</td></tr>"
|
|
78
|
-
* }
|
|
79
|
-
*/
|
|
80
|
-
_this.rowElements = [];
|
|
81
|
-
_this.tag = "admin-table";
|
|
82
|
-
_this.title = "";
|
|
83
|
-
_this.schema = "";
|
|
84
|
-
_this.headerElements = {};
|
|
85
|
-
_this.headerIndicies = [];
|
|
86
|
-
_this.rowElements = [];
|
|
87
|
-
return _this;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Add a header to the table.
|
|
91
|
-
*/
|
|
92
|
-
AdminTable.prototype.addHeader = function (tableFieldElement) {
|
|
93
|
-
var header = this.htmlElements[0].getElementsByTagName("thead")[0];
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
this.headerIndicies.push(tableFieldElement.hotComponent.field);
|
|
96
|
-
header.appendChild(tableFieldElement);
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Add a header to the table.
|
|
100
|
-
*/
|
|
101
|
-
AdminTable.prototype.addHeaderDataOnly = function (tableField, htmlElement) {
|
|
102
|
-
this.headerIndicies.push(tableField.field);
|
|
103
|
-
this.headerElements[tableField.field] = htmlElement;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Add a row to the table.
|
|
107
|
-
*
|
|
108
|
-
* @param {Array} fields A list of values to append.
|
|
109
|
-
*/
|
|
110
|
-
AdminTable.prototype.addRow = function (fields) {
|
|
111
|
-
var tbody = this.htmlElements[1].getElementsByTagName("tbody")[0];
|
|
112
|
-
var rowStr = "<tr>";
|
|
113
|
-
for (var iIdx = 0; iIdx < this.headerIndicies.length; iIdx++) {
|
|
114
|
-
var key = this.headerIndicies[iIdx];
|
|
115
|
-
var value = fields[key];
|
|
116
|
-
if (this.headerElements[key] != null)
|
|
117
|
-
rowStr += "<td>".concat(value, "</td>");
|
|
118
|
-
}
|
|
119
|
-
rowStr += "</tr>";
|
|
120
|
-
hotstaq_1.HotStaq.addHtml(tbody, rowStr);
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Clear the list of rows.
|
|
124
|
-
*/
|
|
125
|
-
AdminTable.prototype.clearRows = function () {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
-
var tbody;
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
tbody = this.htmlElements[1].getElementsByTagName("tbody")[0];
|
|
130
|
-
tbody.innerHTML = "";
|
|
131
|
-
return [2 /*return*/];
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Refresh the list.
|
|
137
|
-
*/
|
|
138
|
-
AdminTable.prototype.refreshList = function () {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var list, iIdx, fields;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
switch (_a.label) {
|
|
143
|
-
case 0: return [4 /*yield*/, hotstaq_1.Hot.jsonRequest("".concat(hotstaq_1.Hot.Data.baseUrl, "/v1/data/list"), {
|
|
144
|
-
schema: this.schema
|
|
145
|
-
})];
|
|
146
|
-
case 1:
|
|
147
|
-
list = _a.sent();
|
|
148
|
-
this.clearRows();
|
|
149
|
-
for (iIdx = 0; iIdx < list.length; iIdx++) {
|
|
150
|
-
fields = list[iIdx];
|
|
151
|
-
this.addRow(fields);
|
|
152
|
-
}
|
|
153
|
-
return [2 /*return*/];
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Get the list of data from the server.
|
|
160
|
-
*/
|
|
161
|
-
AdminTable.prototype.onPostPlace = function (parentHtmlElement, htmlElement) {
|
|
162
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
-
var _this = this;
|
|
164
|
-
return __generator(this, function (_a) {
|
|
165
|
-
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
-
return __generator(this, function (_a) {
|
|
167
|
-
switch (_a.label) {
|
|
168
|
-
case 0: return [4 /*yield*/, this.refreshList()];
|
|
169
|
-
case 1:
|
|
170
|
-
_a.sent();
|
|
171
|
-
return [2 /*return*/];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}); }, 50);
|
|
175
|
-
return [2 /*return*/, (htmlElement)];
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
AdminTable.prototype.output = function () {
|
|
180
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
181
|
-
return __generator(this, function (_a) {
|
|
182
|
-
return [2 /*return*/, ("\n\t\t<div id = \"".concat(this.htmlElements[0].id, "\">\n\t\t\t<h2>").concat(this.title, "</h2>\n\t\t\t<div class=\"table-responsive\">\n\t\t\t<table class=\"table table-striped table-sm\">\n\t\t\t\t<thead hot-place-here = \"header\">\n\t\t\t\t</thead>\n\t\t\t\t<tbody hot-place-here = \"results\">\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t</div>"))];
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
return AdminTable;
|
|
187
|
-
}(hotstaq_1.HotComponent));
|
|
188
|
-
exports.AdminTable = AdminTable;
|
|
189
|
-
hotstaq_1.Hot.CurrentPage.processor.addComponent(AdminTable);
|
|
190
|
-
//# sourceMappingURL=admin-table.js.map
|