@hotstaq/admin-panel 0.2.6 → 0.2.8
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/.vscode/launch.json +5 -4
- package/HotSite.json +2 -2
- package/build/{src/AppAPI.d.ts → AppAPI.d.ts} +0 -0
- package/build/AppAPI.d.ts.map +1 -0
- package/build/{src/AppAPI.js → AppAPI.js} +0 -0
- package/build/AppAPI.js.map +1 -0
- package/build/WebExport.d.ts +3 -0
- package/build/WebExport.d.ts.map +1 -0
- package/build/{src/WebExport.js → WebExport.js} +8 -22
- package/build/WebExport.js.map +1 -0
- package/build/{src/cli.d.ts → cli.d.ts} +0 -0
- package/build/cli.d.ts.map +1 -0
- package/build/{src/cli.js → cli.js} +0 -0
- package/build/cli.js.map +1 -0
- package/build/{src/components → components}/admin-button.d.ts +0 -0
- package/build/components/admin-button.d.ts.map +1 -0
- package/build/{src/components → components}/admin-button.js +0 -0
- package/build/components/admin-button.js.map +1 -0
- package/build/components/admin-checkbox.d.ts +1 -0
- package/build/components/admin-checkbox.d.ts.map +1 -0
- package/build/components/admin-checkbox.js +43 -0
- package/build/components/admin-checkbox.js.map +1 -0
- package/build/{src/components → components}/admin-dashboard.d.ts +0 -0
- package/build/components/admin-dashboard.d.ts.map +1 -0
- package/build/{src/components → components}/admin-dashboard.js +0 -0
- package/build/components/admin-dashboard.js.map +1 -0
- package/build/components/admin-edit.d.ts +87 -0
- package/build/components/admin-edit.d.ts.map +1 -0
- package/build/components/admin-edit.js +328 -0
- package/build/components/admin-edit.js.map +1 -0
- package/build/{src/components → components}/admin-table-field.d.ts +12 -0
- package/build/components/admin-table-field.d.ts.map +1 -0
- package/build/{src/components → components}/admin-table-field.js +17 -1
- package/build/components/admin-table-field.js.map +1 -0
- package/build/{src/components → components}/admin-table-row.d.ts +0 -0
- package/build/components/admin-table-row.d.ts.map +1 -0
- package/build/{src/components → components}/admin-table-row.js +2 -0
- package/build/components/admin-table-row.js.map +1 -0
- package/build/{src/components → components}/admin-table.d.ts +37 -1
- package/build/components/admin-table.d.ts.map +1 -0
- package/build/{src/components → components}/admin-table.js +125 -5
- package/build/components/admin-table.js.map +1 -0
- package/build/{src/components → components}/admin-text.d.ts +12 -0
- package/build/components/admin-text.d.ts.map +1 -0
- package/build/{src/components → components}/admin-text.js +6 -0
- package/build/components/admin-text.js.map +1 -0
- package/build/{src/WebExport.d.ts → index.d.ts} +2 -3
- package/build/index.d.ts.map +1 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -0
- package/build-web/AdminPanelComponents.js +2 -2
- package/build-web/AdminPanelWeb_AppAPI.js +86 -0
- package/package.json +7 -6
- package/src/WebExport.ts +9 -24
- package/src/components/admin-checkbox.ts +52 -0
- package/src/components/admin-edit.ts +264 -12
- package/src/components/admin-table-field.ts +35 -1
- package/src/components/admin-table-row.ts +3 -0
- package/src/components/admin-table.ts +190 -5
- package/src/components/admin-text.ts +19 -0
- package/src/index.ts +17 -0
- package/tsconfig.json +1 -0
- package/webpack.config.cjs +2 -1
- package/build/scripts/watch.d.ts +0 -2
- package/build/scripts/watch.d.ts.map +0 -1
- package/build/scripts/watch.js +0 -127
- package/build/scripts/watch.js.map +0 -1
- package/build/src/AppAPI.d.ts.map +0 -1
- package/build/src/AppAPI.js.map +0 -1
- package/build/src/WebExport.d.ts.map +0 -1
- package/build/src/WebExport.js.map +0 -1
- package/build/src/cli.d.ts.map +0 -1
- package/build/src/cli.js.map +0 -1
- package/build/src/components/admin-button.d.ts.map +0 -1
- package/build/src/components/admin-button.js.map +0 -1
- package/build/src/components/admin-dashboard.d.ts.map +0 -1
- package/build/src/components/admin-dashboard.js.map +0 -1
- package/build/src/components/admin-edit.d.ts +0 -36
- package/build/src/components/admin-edit.d.ts.map +0 -1
- package/build/src/components/admin-edit.js +0 -120
- package/build/src/components/admin-edit.js.map +0 -1
- package/build/src/components/admin-table-field.d.ts.map +0 -1
- package/build/src/components/admin-table-field.js.map +0 -1
- package/build/src/components/admin-table-row.d.ts.map +0 -1
- package/build/src/components/admin-table-row.js.map +0 -1
- package/build/src/components/admin-table.d.ts.map +0 -1
- package/build/src/components/admin-table.js.map +0 -1
- package/build/src/components/admin-text.d.ts.map +0 -1
- package/build/src/components/admin-text.js.map +0 -1
- package/scripts/watch.ts +0 -59
package/.vscode/launch.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "node",
|
|
6
6
|
"request": "launch",
|
|
7
7
|
"name": "Debug Web Server",
|
|
8
|
-
"program": "${workspaceFolder}/build/
|
|
8
|
+
"program": "${workspaceFolder}/build/cli.js",
|
|
9
9
|
"skipFiles": [
|
|
10
10
|
"<node_internals>/**"
|
|
11
11
|
],
|
|
@@ -22,13 +22,14 @@
|
|
|
22
22
|
"type": "node",
|
|
23
23
|
"request": "launch",
|
|
24
24
|
"name": "Debug Web/API Server",
|
|
25
|
-
"program": "${workspaceFolder}/build/
|
|
25
|
+
"program": "${workspaceFolder}/build/cli.js",
|
|
26
26
|
"skipFiles": [
|
|
27
27
|
"<node_internals>/**"
|
|
28
28
|
],
|
|
29
29
|
"outputCapture": "std",
|
|
30
30
|
"args": [
|
|
31
31
|
"--development-mode",
|
|
32
|
+
"--verbose",
|
|
32
33
|
"run",
|
|
33
34
|
"--server-type", "web-api"
|
|
34
35
|
],
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
"type": "node",
|
|
39
40
|
"request": "launch",
|
|
40
41
|
"name": "Debug API Server",
|
|
41
|
-
"program": "${workspaceFolder}/build/
|
|
42
|
+
"program": "${workspaceFolder}/build/cli.js",
|
|
42
43
|
"skipFiles": [
|
|
43
44
|
"<node_internals>/**"
|
|
44
45
|
],
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"skipFiles": [
|
|
61
62
|
"<node_internals>/**"
|
|
62
63
|
],
|
|
63
|
-
"program": "${workspaceFolder}/build/
|
|
64
|
+
"program": "${workspaceFolder}/build/cli.js",
|
|
64
65
|
"args": [
|
|
65
66
|
"--development-mode",
|
|
66
67
|
"--hotsite",
|
package/HotSite.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"jsapi": "./js/AdminPanelWeb_AppAPI.js",
|
|
34
34
|
"libraryName": "AdminPanelWeb",
|
|
35
35
|
"apiName": "AppAPI",
|
|
36
|
-
"filepath": "./build/
|
|
36
|
+
"filepath": "./build/AppAPI.js"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"chart.js": "^2.9.4",
|
|
45
45
|
"feather-icons": "^4.29.0"
|
|
46
46
|
},
|
|
47
|
-
"webExport": "./build/
|
|
47
|
+
"webExport": "./build/WebExport.js"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppAPI.d.ts","sourceRoot":"","sources":["../src/AppAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAE4C,MAAM,SAAS,CAAC;AAGjG;;GAEG;AACH,qBAAa,MAAO,SAAQ,MAAM;gBAEpB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,GAAG,SAAS,EAAE,EAAE,GAAE,GAAU;CA2E/E"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppAPI.js","sourceRoot":"","sources":["../src/AppAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAEiG;AACjG,gDAA+C;AAE/C;;GAEG;AACH;IAA4B,0BAAM;IAEjC,gBAAa,OAAe,EAAE,UAAiC,EAAE,EAAc;QAAd,mBAAA,EAAA,SAAc;QAA/E,YAEC,kBAAM,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,SAwE9B;QAtEA,KAAI,CAAC,aAAa,GAAG;;gBAEnB,IAAI,UAAU,CAAC,IAAI,KAAK,uBAAa,CAAC,QAAQ,EAC9C;oBACC,IAAI,CAAC,WAAW,CAAE,IAAI,qBAAW,CAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;iBACpE;gBAED,sBAAO,CAAC,IAAI,CAAC,EAAC;;aACd,CAAC;QACH,KAAI,CAAC,cAAc,GAAG;;gBAEpB,6BAA6B;gBAE7B,sBAAO,CAAC,IAAI,CAAC,EAAC;;aACd,CAAC;QAEH,KAAI,CAAC,QAAQ,CAAE,IAAI,qBAAS,CAAE,KAAI,EAAE,UAAO,EAAc;;;;;6BAEnD,CAAA,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,uBAAa,CAAC,WAAW,CAAA,EAA5D,wBAA4D;wBAE/D,qBAAM,EAAE,CAAC,KAAK,CACb,ofASE,CAAC,EAAA;;wBAVJ,SAUI,CAAC;wBAEc,qBAAM,EAAE,CAAC,QAAQ,CAAE,6BAA6B,CAAC,EAAA;;wBAAhE,OAAO,GAAQ,SAAiD;6BAEhE,CAAA,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA,EAA/B,wBAA+B;wBAE9B,SAAS,GAAG,CAAC;gCACd,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,qBAAqB;gCAC5B,QAAQ,EAAE,aAAa;gCACvB,QAAQ,EAAE,IAAI;6BACd;4BACD;gCACC,IAAI,EAAE,MAAM;gCACZ,KAAK,EAAE,qBAAqB;gCAC5B,QAAQ,EAAE,gBAAgB;gCAC1B,QAAQ,EAAE,IAAI;6BACd;yBACD,CAAC;wBAEM,IAAI,GAAG,CAAC;;;6BAAE,CAAA,IAAI,GAAG,SAAS,CAAC,MAAM,CAAA;wBAErC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;wBAC3B,QAAQ,GAAW,CAAC,CAAC;wBAEzB,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI;4BAC7B,QAAQ,GAAG,CAAC,CAAC;wBAEI,qBAAM,EAAE,CAAC,KAAK,CAC/B,0EAA0E,EAC1E,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAA;;wBAF1D,MAAM,GAAQ,SAE4C;wBAE9D,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI;4BACvB,MAAM,IAAI,KAAK,CAAE,MAAM,CAAC,KAAK,CAAC,CAAC;wBAE5B,EAAE,GAAW,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;;;wBAfD,IAAI,EAAE,CAAA;;;;;aAmBpD,CAAC,CAAC,CAAC;;IACN,CAAC;IACF,aAAC;AAAD,CAAC,AA7ED,CAA4B,gBAAM,GA6EjC;AA7EY,wBAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebExport.d.ts","sourceRoot":"","sources":["../src/WebExport.ts"],"names":[],"mappings":"AAAA,iBAAe,WAAW,IAAK,OAAO,CAAC,GAAG,CAAC,CAqB1C;AAED,OAAO,EACN,WAAW,EACX,CAAC"}
|
|
@@ -36,21 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
var admin_button_1 = require("./components/admin-button");
|
|
41
|
-
Object.defineProperty(exports, "AdminButton", { enumerable: true, get: function () { return admin_button_1.AdminButton; } });
|
|
42
|
-
var admin_dashboard_1 = require("./components/admin-dashboard");
|
|
43
|
-
Object.defineProperty(exports, "AdminDashboard", { enumerable: true, get: function () { return admin_dashboard_1.AdminDashboard; } });
|
|
44
|
-
var admin_edit_1 = require("./components/admin-edit");
|
|
45
|
-
Object.defineProperty(exports, "AdminEdit", { enumerable: true, get: function () { return admin_edit_1.AdminEdit; } });
|
|
46
|
-
var admin_table_1 = require("./components/admin-table");
|
|
47
|
-
Object.defineProperty(exports, "AdminTable", { enumerable: true, get: function () { return admin_table_1.AdminTable; } });
|
|
48
|
-
var admin_table_field_1 = require("./components/admin-table-field");
|
|
49
|
-
Object.defineProperty(exports, "AdminTableField", { enumerable: true, get: function () { return admin_table_field_1.AdminTableField; } });
|
|
50
|
-
var admin_table_row_1 = require("./components/admin-table-row");
|
|
51
|
-
Object.defineProperty(exports, "AdminTableRow", { enumerable: true, get: function () { return admin_table_row_1.AdminTableRow; } });
|
|
52
|
-
var admin_text_1 = require("./components/admin-text");
|
|
53
|
-
Object.defineProperty(exports, "AdminText", { enumerable: true, get: function () { return admin_text_1.AdminText; } });
|
|
39
|
+
exports.buildAssets = void 0;
|
|
54
40
|
function buildAssets() {
|
|
55
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
56
42
|
return __generator(this, function (_a) {
|
|
@@ -65,13 +51,13 @@ function buildAssets() {
|
|
|
65
51
|
js: ["./assets/js/*.*", "./build-web/AdminPanelComponents.js"],
|
|
66
52
|
componentLibrary: "AdminPanelComponentsWeb",
|
|
67
53
|
components: [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
"AdminButton",
|
|
55
|
+
"AdminDashboard",
|
|
56
|
+
"AdminEdit",
|
|
57
|
+
"AdminTable",
|
|
58
|
+
"AdminTableField",
|
|
59
|
+
"AdminTableRow",
|
|
60
|
+
"AdminText"
|
|
75
61
|
]
|
|
76
62
|
})];
|
|
77
63
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebExport.js","sourceRoot":"","sources":["../src/WebExport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAe,WAAW;;;YAEzB,sBAAO,CAAC;oBACN,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,EAAE;wBAC/E,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,eAAe,CAAC,EAAE;wBAC5C,UAAU;wBACV,eAAe;wBACf,gBAAgB,CAAC;oBAClB,IAAI,EAAE,CAAC,mBAAmB,CAAC;oBAC3B,GAAG,EAAE,CAAC,kBAAkB,CAAC;oBACzB,EAAE,EAAE,CAAC,iBAAiB,EAAE,qCAAqC,CAAC;oBAC9D,gBAAgB,EAAE,yBAAyB;oBAC3C,UAAU,EAAE;wBACX,aAAa;wBACb,gBAAgB;wBAChB,WAAW;wBACX,YAAY;wBACZ,iBAAiB;wBACjB,eAAe;wBACf,WAAW;qBAAC;iBACb,CAAC,EAAC;;;CACJ;AAGA,kCAAW"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
|
File without changes
|
package/build/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiC;AAEjC,IAAI,GAAG,GAAW,IAAI,gBAAM,EAAG,CAAC;AAChC,GAAG,CAAC,KAAK,EAAG,CAAC,IAAI,CAAE;;;oBAEX,qBAAM,GAAG,CAAC,KAAK,CAAE,OAAO,CAAC,IAAI,CAAC,EAAA;;gBAA9B,SAA8B,CAAC;;;;KAClC,CAAC,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-button.d.ts","sourceRoot":"","sources":["../../src/components/admin-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAO,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7D,qBAAa,WAAY,SAAQ,YAAY;gBAE/B,IAAI,EAAE,YAAY,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM;IAOhD,aAAa,IAAK,OAAO,CAAC,IAAI,CAAC;IAIrC,MAAM,IAAK,MAAM;CAIjB"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-button.js","sourceRoot":"","sources":["../../src/components/admin-button.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA6D;AAE7D;IAAiC,+BAAY;IAE5C,qBAAa,IAA4B,EAAE,GAAW;QAAtD,YAEC,kBAAO,IAAI,EAAE,GAAG,CAAC,SAGjB;QADA,KAAI,CAAC,GAAG,GAAG,cAAc,CAAC;;IAC3B,CAAC;IAEK,mCAAa,GAAnB;;;;;;KAEC;IAED,4BAAM,GAAN;QAEC,OAAO,CAAC,yBAAiB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,sDAAgD,CAAC,CAAC;IACnG,CAAC;IACF,kBAAC;AAAD,CAAC,AAjBD,CAAiC,sBAAY,GAiB5C;AAjBY,kCAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=admin-checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-checkbox.d.ts","sourceRoot":"","sources":["../../src/components/admin-checkbox.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// import { HotStaq, Hot, HotAPI, HotComponent, HotComponentOutput } from "hotstaq";
|
|
2
|
+
// export class AdminCheckbox extends HotComponent
|
|
3
|
+
// {
|
|
4
|
+
// /**
|
|
5
|
+
// * The associated database field.
|
|
6
|
+
// */
|
|
7
|
+
// field: string;
|
|
8
|
+
// constructor (copy: HotComponent | HotStaq, api: HotAPI)
|
|
9
|
+
// {
|
|
10
|
+
// super (copy, api);
|
|
11
|
+
// this.tag = "admin-checkbox";
|
|
12
|
+
// this.field = "";
|
|
13
|
+
// }
|
|
14
|
+
// /**
|
|
15
|
+
// * Corrects the placement of the text elements for modals.
|
|
16
|
+
// */
|
|
17
|
+
// onPostPlace (parentHtmlElement: HTMLElement, htmlElement: HTMLElement): HTMLElement
|
|
18
|
+
// {
|
|
19
|
+
// let placeHereArray = parentHtmlElement.querySelectorAll (`hot-place-here[type="modal"]`);
|
|
20
|
+
// if (placeHereArray.length > 0)
|
|
21
|
+
// {
|
|
22
|
+
// let placeHere = placeHereArray[0];
|
|
23
|
+
// parentHtmlElement.removeChild (htmlElement);
|
|
24
|
+
// placeHere.appendChild (htmlElement);
|
|
25
|
+
// // @ts-ignore
|
|
26
|
+
// parentHtmlElement.hotComponent.fieldElements[this.field] = htmlElement.querySelector ("input");
|
|
27
|
+
// }
|
|
28
|
+
// return (null);
|
|
29
|
+
// }
|
|
30
|
+
// output (): string | HotComponentOutput[]
|
|
31
|
+
// {
|
|
32
|
+
// let value: string = "";
|
|
33
|
+
// if (this.value != null)
|
|
34
|
+
// {
|
|
35
|
+
// if ((this.value === true) || (this.value === 1))
|
|
36
|
+
// value = "checked";
|
|
37
|
+
// }
|
|
38
|
+
// return (`<div>
|
|
39
|
+
// <label class="form-label">${this.inner}</label><input class="form-control" type = "checkbox" ${value} />
|
|
40
|
+
// </div>`);
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
//# sourceMappingURL=admin-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-checkbox.js","sourceRoot":"","sources":["../../src/components/admin-checkbox.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,kDAAkD;AAClD,IAAI;AACJ,OAAO;AACP,qCAAqC;AACrC,OAAO;AACP,kBAAkB;AAElB,2DAA2D;AAC3D,KAAK;AACL,uBAAuB;AAEvB,iCAAiC;AACjC,qBAAqB;AACrB,KAAK;AAEL,OAAO;AACP,8DAA8D;AAC9D,OAAO;AACP,uFAAuF;AACvF,KAAK;AACL,8FAA8F;AAE9F,mCAAmC;AACnC,MAAM;AACN,wCAAwC;AACxC,kDAAkD;AAClD,0CAA0C;AAE1C,mBAAmB;AACnB,qGAAqG;AACrG,MAAM;AAEN,mBAAmB;AACnB,KAAK;AAEL,4CAA4C;AAC5C,KAAK;AACL,4BAA4B;AAE5B,4BAA4B;AAC5B,MAAM;AACN,sDAAsD;AACtD,yBAAyB;AACzB,MAAM;AAEN,mBAAmB;AACnB,8GAA8G;AAC9G,cAAc;AACd,KAAK;AACL,IAAI"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-dashboard.d.ts","sourceRoot":"","sources":["../../src/components/admin-dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAO,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7D,qBAAa,cAAe,SAAQ,YAAY;IAE/C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;gBAEA,IAAI,EAAE,YAAY,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM;IAStD;;OAEG;IACH,WAAW,CAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,WAAW;IASnF,MAAM,IAAK,MAAM;CAejB"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-dashboard.js","sourceRoot":"","sources":["../../src/components/admin-dashboard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,mCAA6D;AAE7D;IAAoC,kCAAY;IAW/C,wBAAa,IAA4B,EAAE,GAAW;QAAtD,YAEC,kBAAO,IAAI,EAAE,GAAG,CAAC,SAKjB;QAHA,KAAI,CAAC,GAAG,GAAG,iBAAiB,CAAC;QAC7B,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,KAAI,CAAC,IAAI,GAAG,EAAE,CAAC;;IAChB,CAAC;IAED;;OAEG;IACH,oCAAW,GAAX,UAAa,iBAA8B,EAAE,WAAwB;QAEpE,kDAAkD;QAClD,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE;YAClB,aAAG,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;QAE9B,OAAO,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED,+BAAM,GAAN;QAEC,OAAO,CAAC,gOAGW,IAAI,CAAC,KAAK,8RAQrB,CAAC,CAAC;IACX,CAAC;IACF,qBAAC;AAAD,CAAC,AA/CD,CAAoC,sBAAY,GA+C/C;AA/CY,wCAAc"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { HotStaq, HotAPI, HotComponent, HotComponentOutput } from "hotstaq";
|
|
2
|
+
import bootstrap from "bootstrap";
|
|
3
|
+
export declare class AdminEdit extends HotComponent {
|
|
4
|
+
/**
|
|
5
|
+
* The title of this edit modal.
|
|
6
|
+
*/
|
|
7
|
+
title: string;
|
|
8
|
+
/**
|
|
9
|
+
* The button title.
|
|
10
|
+
*/
|
|
11
|
+
button_title: string;
|
|
12
|
+
/**
|
|
13
|
+
* The attached list.
|
|
14
|
+
*/
|
|
15
|
+
attached_list: string;
|
|
16
|
+
/**
|
|
17
|
+
* The attached schema.
|
|
18
|
+
*/
|
|
19
|
+
schema: string;
|
|
20
|
+
/**
|
|
21
|
+
* The field elements in the edit modal.
|
|
22
|
+
*/
|
|
23
|
+
fieldElements: {
|
|
24
|
+
[name: string]: any;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The modal id.
|
|
28
|
+
*/
|
|
29
|
+
modalId: string;
|
|
30
|
+
/**
|
|
31
|
+
* The bootstrap modal instance.
|
|
32
|
+
*/
|
|
33
|
+
modal: bootstrap.Modal;
|
|
34
|
+
/**
|
|
35
|
+
* If set to true, this will close the modal when save is clicked.
|
|
36
|
+
*/
|
|
37
|
+
closeOnSave: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The type of modal to open. Can be:
|
|
40
|
+
* * add
|
|
41
|
+
* * edit
|
|
42
|
+
* * remove
|
|
43
|
+
*/
|
|
44
|
+
protected modalType: string;
|
|
45
|
+
/**
|
|
46
|
+
* The selected fields.
|
|
47
|
+
*/
|
|
48
|
+
protected selectedFields: any[];
|
|
49
|
+
constructor(copy: HotComponent | HotStaq, api: HotAPI);
|
|
50
|
+
/**
|
|
51
|
+
* The event that can be called when the add button is clicked.
|
|
52
|
+
* This is called before the add modal opens.
|
|
53
|
+
*/
|
|
54
|
+
onAddClicked: () => Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Executes when the add button is clicked.
|
|
57
|
+
*/
|
|
58
|
+
addClicked(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* The event that can be called when the edit button is clicked.
|
|
61
|
+
* This is called before the edit modal opens.
|
|
62
|
+
*/
|
|
63
|
+
onEditClicked: () => Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Executes when the edit button is clicked.
|
|
66
|
+
*/
|
|
67
|
+
editClicked(): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* The event that can be called when the remove button is clicked.
|
|
70
|
+
* This is called before the remove modal opens.
|
|
71
|
+
*/
|
|
72
|
+
onRemoveClicked: () => Promise<boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Executes when the remove button is clicked.
|
|
75
|
+
*/
|
|
76
|
+
removeClicked(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Save this form.
|
|
79
|
+
*/
|
|
80
|
+
onSave(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Get the list of data from the server.
|
|
83
|
+
*/
|
|
84
|
+
onPostPlace(parentHtmlElement: HTMLElement, htmlElement: HTMLElement): HTMLElement;
|
|
85
|
+
output(): string | HotComponentOutput[];
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=admin-edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-edit.d.ts","sourceRoot":"","sources":["../../src/components/admin-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAO,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,SAAS,MAAM,WAAW,CAAC;AAIlC,qBAAa,SAAU,SAAQ,YAAY;IAE1C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;KAAE,CAAC;IACxC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC;gBAEnB,IAAI,EAAE,YAAY,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM;IAmBtD;;;OAGG;IACH,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAQ;IAE5C;;OAEG;IACG,UAAU,IAAK,OAAO,CAAC,IAAI,CAAC;IAyBlC;;;OAGG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAQ;IAE7C;;OAEG;IACG,WAAW,IAAK,OAAO,CAAC,IAAI,CAAC;IAsCnC;;;OAGG;IACH,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAQ;IAE/C;;OAEG;IACG,aAAa,IAAK,OAAO,CAAC,IAAI,CAAC;IAiErC;;OAEG;IACG,MAAM;IA2EZ;;OAEG;IACH,WAAW,CAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,WAAW;IAWnF,MAAM,IAAK,MAAM,GAAG,kBAAkB,EAAE;CA2CxC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.AdminEdit = void 0;
|
|
58
|
+
var hotstaq_1 = require("hotstaq");
|
|
59
|
+
var bootstrap_1 = __importDefault(require("bootstrap"));
|
|
60
|
+
var AdminEdit = /** @class */ (function (_super) {
|
|
61
|
+
__extends(AdminEdit, _super);
|
|
62
|
+
function AdminEdit(copy, api) {
|
|
63
|
+
var _this = _super.call(this, copy, api) || this;
|
|
64
|
+
/**
|
|
65
|
+
* The event that can be called when the add button is clicked.
|
|
66
|
+
* This is called before the add modal opens.
|
|
67
|
+
*/
|
|
68
|
+
_this.onAddClicked = null;
|
|
69
|
+
/**
|
|
70
|
+
* The event that can be called when the edit button is clicked.
|
|
71
|
+
* This is called before the edit modal opens.
|
|
72
|
+
*/
|
|
73
|
+
_this.onEditClicked = null;
|
|
74
|
+
/**
|
|
75
|
+
* The event that can be called when the remove button is clicked.
|
|
76
|
+
* This is called before the remove modal opens.
|
|
77
|
+
*/
|
|
78
|
+
_this.onRemoveClicked = null;
|
|
79
|
+
_this.tag = "admin-edit";
|
|
80
|
+
_this.title = "";
|
|
81
|
+
_this.button_title = "";
|
|
82
|
+
_this.attached_list = "";
|
|
83
|
+
_this.schema = "";
|
|
84
|
+
_this.fieldElements = {};
|
|
85
|
+
_this.modalId = "";
|
|
86
|
+
_this.modal = null;
|
|
87
|
+
_this.modalType = "add";
|
|
88
|
+
_this.closeOnSave = true;
|
|
89
|
+
_this.selectedFields = [];
|
|
90
|
+
return _this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Executes when the add button is clicked.
|
|
94
|
+
*/
|
|
95
|
+
AdminEdit.prototype.addClicked = function () {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
+
var result, key, fieldElement;
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0:
|
|
101
|
+
if (!(this.onAddClicked != null)) return [3 /*break*/, 2];
|
|
102
|
+
return [4 /*yield*/, this.onAddClicked()];
|
|
103
|
+
case 1:
|
|
104
|
+
result = _a.sent();
|
|
105
|
+
if (result === false)
|
|
106
|
+
return [2 /*return*/];
|
|
107
|
+
_a.label = 2;
|
|
108
|
+
case 2:
|
|
109
|
+
this.modalType = "add";
|
|
110
|
+
// Clear the values in each field.
|
|
111
|
+
for (key in this.fieldElements) {
|
|
112
|
+
fieldElement = this.fieldElements[key];
|
|
113
|
+
fieldElement.value = "";
|
|
114
|
+
}
|
|
115
|
+
this.selectedFields = [];
|
|
116
|
+
bootstrap_1.default.Modal.getInstance("#".concat(this.modalId)).show();
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Executes when the edit button is clicked.
|
|
124
|
+
*/
|
|
125
|
+
AdminEdit.prototype.editClicked = function () {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
+
var result, attachedList, hotComponent, selectedField, key, fieldElement, value;
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
switch (_a.label) {
|
|
130
|
+
case 0:
|
|
131
|
+
if (!(this.onEditClicked != null)) return [3 /*break*/, 2];
|
|
132
|
+
return [4 /*yield*/, this.onEditClicked()];
|
|
133
|
+
case 1:
|
|
134
|
+
result = _a.sent();
|
|
135
|
+
if (result === false)
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
_a.label = 2;
|
|
138
|
+
case 2:
|
|
139
|
+
this.modalType = "edit";
|
|
140
|
+
attachedList = document.getElementById(this.attached_list);
|
|
141
|
+
hotComponent = attachedList.hotComponent;
|
|
142
|
+
selectedField = hotComponent.getSelected();
|
|
143
|
+
if (selectedField != null) {
|
|
144
|
+
for (key in this.fieldElements) {
|
|
145
|
+
fieldElement = this.fieldElements[key];
|
|
146
|
+
if (fieldElement != null) {
|
|
147
|
+
value = selectedField[key];
|
|
148
|
+
fieldElement.value = value;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
this.selectedFields = [selectedField];
|
|
152
|
+
bootstrap_1.default.Modal.getInstance("#".concat(this.modalId)).show();
|
|
153
|
+
}
|
|
154
|
+
return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Executes when the remove button is clicked.
|
|
161
|
+
*/
|
|
162
|
+
AdminEdit.prototype.removeClicked = function () {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
+
var result, attachedList, hotComponent, checkedRows, whereFields, i, checkedRow, selectedField, confirmed, i, whereField, key, fieldType;
|
|
165
|
+
return __generator(this, function (_a) {
|
|
166
|
+
switch (_a.label) {
|
|
167
|
+
case 0:
|
|
168
|
+
if (!(this.onRemoveClicked != null)) return [3 /*break*/, 2];
|
|
169
|
+
return [4 /*yield*/, this.onRemoveClicked()];
|
|
170
|
+
case 1:
|
|
171
|
+
result = _a.sent();
|
|
172
|
+
if (result === false)
|
|
173
|
+
return [2 /*return*/];
|
|
174
|
+
_a.label = 2;
|
|
175
|
+
case 2:
|
|
176
|
+
this.modalType = "remove";
|
|
177
|
+
attachedList = document.getElementById(this.attached_list);
|
|
178
|
+
hotComponent = attachedList.hotComponent;
|
|
179
|
+
checkedRows = hotComponent.getCheckedRows();
|
|
180
|
+
whereFields = [];
|
|
181
|
+
if (checkedRows.length > 0) {
|
|
182
|
+
for (i = 0; i < checkedRows.length; i++) {
|
|
183
|
+
checkedRow = checkedRows[i];
|
|
184
|
+
whereFields.push(checkedRow);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
selectedField = hotComponent.getSelected();
|
|
188
|
+
if (selectedField != null)
|
|
189
|
+
whereFields = [selectedField];
|
|
190
|
+
if (!(whereFields.length > 0)) return [3 /*break*/, 8];
|
|
191
|
+
confirmed = confirm("Are you sure you want to remove this item?");
|
|
192
|
+
if (!(confirmed === true)) return [3 /*break*/, 8];
|
|
193
|
+
i = 0;
|
|
194
|
+
_a.label = 3;
|
|
195
|
+
case 3:
|
|
196
|
+
if (!(i < whereFields.length)) return [3 /*break*/, 6];
|
|
197
|
+
whereField = whereFields[i];
|
|
198
|
+
// Remove any fields that are marked as remove.
|
|
199
|
+
for (key in whereField) {
|
|
200
|
+
fieldType = hotComponent.getFieldType(key);
|
|
201
|
+
if (fieldType != null) {
|
|
202
|
+
if (fieldType === "remove")
|
|
203
|
+
delete whereField[key];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return [4 /*yield*/, hotstaq_1.Hot.jsonRequest("".concat(hotstaq_1.Hot.Data.baseUrl, "/v1/data/remove"), {
|
|
207
|
+
schema: this.schema,
|
|
208
|
+
whereFields: whereField
|
|
209
|
+
})];
|
|
210
|
+
case 4:
|
|
211
|
+
_a.sent();
|
|
212
|
+
_a.label = 5;
|
|
213
|
+
case 5:
|
|
214
|
+
i++;
|
|
215
|
+
return [3 /*break*/, 3];
|
|
216
|
+
case 6: return [4 /*yield*/, hotComponent.refreshList()];
|
|
217
|
+
case 7:
|
|
218
|
+
_a.sent();
|
|
219
|
+
_a.label = 8;
|
|
220
|
+
case 8: return [2 /*return*/];
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Save this form.
|
|
227
|
+
*/
|
|
228
|
+
AdminEdit.prototype.onSave = function () {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
var values, key, fieldElement, value, fieldType, selectedField, whereFields, key, fieldElement, value, fieldType, attachedList, table;
|
|
231
|
+
return __generator(this, function (_a) {
|
|
232
|
+
switch (_a.label) {
|
|
233
|
+
case 0:
|
|
234
|
+
values = {};
|
|
235
|
+
for (key in this.fieldElements) {
|
|
236
|
+
fieldElement = this.fieldElements[key];
|
|
237
|
+
if (fieldElement != null) {
|
|
238
|
+
value = fieldElement.value;
|
|
239
|
+
fieldType = fieldElement.parentNode.hotComponent.field_type;
|
|
240
|
+
if (fieldType === "remove")
|
|
241
|
+
continue;
|
|
242
|
+
values[key] = value;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (!(this.modalType === "add")) return [3 /*break*/, 2];
|
|
246
|
+
return [4 /*yield*/, hotstaq_1.Hot.jsonRequest("".concat(hotstaq_1.Hot.Data.baseUrl, "/v1/data/add"), {
|
|
247
|
+
schema: this.schema,
|
|
248
|
+
fields: values
|
|
249
|
+
})];
|
|
250
|
+
case 1:
|
|
251
|
+
_a.sent();
|
|
252
|
+
_a.label = 2;
|
|
253
|
+
case 2:
|
|
254
|
+
if (!(this.modalType === "edit")) return [3 /*break*/, 4];
|
|
255
|
+
if (this.selectedFields.length === 0) {
|
|
256
|
+
alert("No item(s) selected!");
|
|
257
|
+
return [2 /*return*/];
|
|
258
|
+
}
|
|
259
|
+
selectedField = this.selectedFields[0];
|
|
260
|
+
whereFields = {};
|
|
261
|
+
for (key in selectedField) {
|
|
262
|
+
fieldElement = this.fieldElements[key];
|
|
263
|
+
value = selectedField[key];
|
|
264
|
+
if (fieldElement != null) {
|
|
265
|
+
fieldType = fieldElement.parentNode.hotComponent.field_type;
|
|
266
|
+
if (fieldType === "remove")
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
whereFields[key] = value;
|
|
270
|
+
}
|
|
271
|
+
return [4 /*yield*/, hotstaq_1.Hot.jsonRequest("".concat(hotstaq_1.Hot.Data.baseUrl, "/v1/data/edit"), {
|
|
272
|
+
schema: this.schema,
|
|
273
|
+
whereFields: whereFields,
|
|
274
|
+
fields: values
|
|
275
|
+
})];
|
|
276
|
+
case 3:
|
|
277
|
+
_a.sent();
|
|
278
|
+
_a.label = 4;
|
|
279
|
+
case 4:
|
|
280
|
+
attachedList = document.getElementById(this.attached_list);
|
|
281
|
+
table = attachedList.hotComponent;
|
|
282
|
+
return [4 /*yield*/, table.refreshList()];
|
|
283
|
+
case 5:
|
|
284
|
+
_a.sent();
|
|
285
|
+
if (this.closeOnSave === true) {
|
|
286
|
+
bootstrap_1.default.Modal.getInstance("#".concat(this.modalId)).hide();
|
|
287
|
+
}
|
|
288
|
+
return [2 /*return*/];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Get the list of data from the server.
|
|
295
|
+
*/
|
|
296
|
+
AdminEdit.prototype.onPostPlace = function (parentHtmlElement, htmlElement) {
|
|
297
|
+
this.modal = new bootstrap_1.default.Modal($("#".concat(this.modalId))[0], {
|
|
298
|
+
"backdrop": true,
|
|
299
|
+
"keyboard": true,
|
|
300
|
+
"focus": true
|
|
301
|
+
});
|
|
302
|
+
return (null);
|
|
303
|
+
};
|
|
304
|
+
AdminEdit.prototype.output = function () {
|
|
305
|
+
if (this.name === "")
|
|
306
|
+
throw new Error("You must specify a name for each admin-edit element!");
|
|
307
|
+
this.modalId = "".concat(this.name, "Modal");
|
|
308
|
+
return ([{
|
|
309
|
+
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 -->"),
|
|
310
|
+
documentSelector: "body"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
html: "<button id = \"".concat(this.modalId, "-add-btn\" type=\"button\" class=\"btn btn-sm btn-outline-secondary\" onclick = \"this.addClicked ();\">Add</button>"),
|
|
314
|
+
documentSelector: "hot-place-here[name=\"buttons\"]"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
html: "<button id = \"".concat(this.modalId, "-edit-btn\" type=\"button\" class=\"btn btn-sm btn-outline-secondary\" onclick = \"this.editClicked ();\">Edit</button>"),
|
|
318
|
+
documentSelector: "hot-place-here[name=\"buttons\"]"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
html: "<button id = \"".concat(this.modalId, "-edit-btn\" type=\"button\" class=\"btn btn-sm btn-outline-secondary\" onclick = \"this.removeClicked ();\">Remove</button>"),
|
|
322
|
+
documentSelector: "hot-place-here[name=\"buttons\"]"
|
|
323
|
+
}]);
|
|
324
|
+
};
|
|
325
|
+
return AdminEdit;
|
|
326
|
+
}(hotstaq_1.HotComponent));
|
|
327
|
+
exports.AdminEdit = AdminEdit;
|
|
328
|
+
//# sourceMappingURL=admin-edit.js.map
|