@hotstaq/admin-panel 0.2.6 → 0.2.7
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 +297 -0
- package/build/components/admin-edit.js.map +1 -0
- package/build/{src/components → components}/admin-table-field.d.ts +0 -0
- package/build/components/admin-table-field.d.ts.map +1 -0
- package/build/{src/components → components}/admin-table-field.js +2 -2
- 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 +33 -1
- package/build/components/admin-table.d.ts.map +1 -0
- package/build/{src/components → components}/admin-table.js +106 -4
- 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 +87 -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 +229 -12
- package/src/components/admin-table-field.ts +2 -2
- package/src/components/admin-table-row.ts +3 -0
- package/src/components/admin-table.ts +163 -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
|
@@ -37,7 +37,17 @@ export class AdminTable extends HotComponent
|
|
|
37
37
|
* "html": "<tr><td>John Smith</td><td>john.smith@test.com</td></tr>"
|
|
38
38
|
* }
|
|
39
39
|
*/
|
|
40
|
-
rowElements: { fields: any[];
|
|
40
|
+
rowElements: { fields: any[]; element: HTMLElement; }[] = [];
|
|
41
|
+
/**
|
|
42
|
+
* The selected row indicies. Each index maps to the rowElements array.
|
|
43
|
+
*
|
|
44
|
+
* @fixme Add support for this in the future.
|
|
45
|
+
*/
|
|
46
|
+
//protected selectedRows: number[];
|
|
47
|
+
/**
|
|
48
|
+
* The most recently selected row index. The index maps to the rowElements array.
|
|
49
|
+
*/
|
|
50
|
+
protected selected: number;
|
|
41
51
|
|
|
42
52
|
constructor (copy: HotComponent | HotStaq, api: HotAPI)
|
|
43
53
|
{
|
|
@@ -49,6 +59,8 @@ export class AdminTable extends HotComponent
|
|
|
49
59
|
this.headerElements = {};
|
|
50
60
|
this.headerIndicies = [];
|
|
51
61
|
this.rowElements = [];
|
|
62
|
+
//this.selectedRows = [];
|
|
63
|
+
this.selected = -1;
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
/**
|
|
@@ -58,6 +70,9 @@ export class AdminTable extends HotComponent
|
|
|
58
70
|
{
|
|
59
71
|
let header = this.htmlElements[0].getElementsByTagName ("thead")[0];
|
|
60
72
|
|
|
73
|
+
if (this.headerIndicies.length < 1)
|
|
74
|
+
this.headerIndicies.push (null);
|
|
75
|
+
|
|
61
76
|
// @ts-ignore
|
|
62
77
|
this.headerIndicies.push (tableFieldElement.hotComponent.field);
|
|
63
78
|
header.appendChild (tableFieldElement);
|
|
@@ -68,10 +83,142 @@ export class AdminTable extends HotComponent
|
|
|
68
83
|
*/
|
|
69
84
|
addHeaderDataOnly (tableField: AdminTableField, htmlElement: HTMLElement)
|
|
70
85
|
{
|
|
86
|
+
if (this.headerIndicies.length < 1)
|
|
87
|
+
this.headerIndicies.push (null);
|
|
88
|
+
|
|
71
89
|
this.headerIndicies.push (tableField.field);
|
|
72
90
|
this.headerElements[tableField.field] = htmlElement;
|
|
73
91
|
}
|
|
74
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Executes this event when a row is selected. If this returns false, the row will not be selected.
|
|
95
|
+
*/
|
|
96
|
+
onSelectedRow: (rowIndex: number) => Promise<boolean> = null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Executes when a row is selected.
|
|
100
|
+
*/
|
|
101
|
+
async selectRow (htmlElement: HTMLElement, rowIndex: number): Promise<void>
|
|
102
|
+
{
|
|
103
|
+
if (this.onSelectedRow != null)
|
|
104
|
+
{
|
|
105
|
+
let result = await this.onSelectedRow (rowIndex);
|
|
106
|
+
|
|
107
|
+
if (result === false)
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// In the future, we will support multiple rows being selected. For now
|
|
112
|
+
// this will ensure that only one row is selected at a time.
|
|
113
|
+
{
|
|
114
|
+
let tbody = this.htmlElements[1].getElementsByTagName ("tbody")[0];
|
|
115
|
+
let rows = tbody.getElementsByTagName ("tr");
|
|
116
|
+
|
|
117
|
+
for (let iIdx = 0; iIdx < rows.length; iIdx++)
|
|
118
|
+
{
|
|
119
|
+
let row: HTMLTableRowElement = rows[iIdx];
|
|
120
|
+
|
|
121
|
+
if (row.classList.contains ("table-primary") === true)
|
|
122
|
+
row.classList.remove ("table-primary");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
htmlElement.classList.add ("table-primary");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this.selected = rowIndex;
|
|
129
|
+
|
|
130
|
+
/*this.selectedRows = [];
|
|
131
|
+
let tbody = this.htmlElements[1].getElementsByTagName ("tbody")[0];
|
|
132
|
+
|
|
133
|
+
// Find all the checkboxes in tbody.
|
|
134
|
+
let checkboxes = tbody.getElementsByTagName ("input");
|
|
135
|
+
|
|
136
|
+
for (let iIdx = 0; iIdx < checkboxes.length; iIdx++)
|
|
137
|
+
{
|
|
138
|
+
let checkbox: HTMLInputElement = checkboxes[iIdx];
|
|
139
|
+
|
|
140
|
+
if (checkbox.checked != null)
|
|
141
|
+
{
|
|
142
|
+
if (checkbox.checked === true)
|
|
143
|
+
{
|
|
144
|
+
// Get the data-index attribute.
|
|
145
|
+
let dataIndexStr: string = checkbox.parentElement.parentElement.getAttribute ("data-index");
|
|
146
|
+
let dataIndex: number = parseInt (dataIndexStr);
|
|
147
|
+
|
|
148
|
+
this.selectedRows.push (dataIndex);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}*/
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Get the selected data.
|
|
156
|
+
*/
|
|
157
|
+
getSelected (): any[]
|
|
158
|
+
{
|
|
159
|
+
let index: number = this.selected;
|
|
160
|
+
|
|
161
|
+
if (index < 0)
|
|
162
|
+
return (null);
|
|
163
|
+
|
|
164
|
+
return (this.rowElements[index].fields);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get the selected data.
|
|
169
|
+
*/
|
|
170
|
+
/*getSelectedRows (): any[]
|
|
171
|
+
{
|
|
172
|
+
let rows: any[] = [];
|
|
173
|
+
|
|
174
|
+
for (let iIdx = 0; iIdx < this.selectedRows.length; iIdx++)
|
|
175
|
+
{
|
|
176
|
+
let index: number = this.selectedRows[iIdx];
|
|
177
|
+
rows.push (this.rowElements[index].fields);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return (rows);
|
|
181
|
+
}*/
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get the data for each row that has been checked.
|
|
185
|
+
*/
|
|
186
|
+
getCheckedRows (): any[]
|
|
187
|
+
{
|
|
188
|
+
let rows: any[] = [];
|
|
189
|
+
let tbody = this.htmlElements[1].getElementsByTagName ("tbody")[0];
|
|
190
|
+
|
|
191
|
+
// Find all the checkboxes in tbody.
|
|
192
|
+
let checkboxes = tbody.getElementsByTagName ("input");
|
|
193
|
+
|
|
194
|
+
for (let iIdx = 0; iIdx < checkboxes.length; iIdx++)
|
|
195
|
+
{
|
|
196
|
+
let checkbox: HTMLInputElement = checkboxes[iIdx];
|
|
197
|
+
|
|
198
|
+
if (checkbox.checked != null)
|
|
199
|
+
{
|
|
200
|
+
if (checkbox.checked === true)
|
|
201
|
+
{
|
|
202
|
+
// Get the data-index attribute.
|
|
203
|
+
let dataIndexStr: string = checkbox.parentElement.parentElement.getAttribute ("data-index");
|
|
204
|
+
let dataIndex: number = parseInt (dataIndexStr);
|
|
205
|
+
|
|
206
|
+
rows.push (this.rowElements[dataIndex].fields);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return (rows);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Get a row's data.
|
|
216
|
+
*/
|
|
217
|
+
getRow (index: number): any[]
|
|
218
|
+
{
|
|
219
|
+
return (this.rowElements[index].fields);
|
|
220
|
+
}
|
|
221
|
+
|
|
75
222
|
/**
|
|
76
223
|
* Add a row to the table.
|
|
77
224
|
*
|
|
@@ -80,7 +227,10 @@ export class AdminTable extends HotComponent
|
|
|
80
227
|
addRow (fields: { [name: string]: any }[])
|
|
81
228
|
{
|
|
82
229
|
let tbody = this.htmlElements[1].getElementsByTagName ("tbody")[0];
|
|
83
|
-
let
|
|
230
|
+
let index: number = this.rowElements.length;
|
|
231
|
+
let rowStr = `<tr onclick = "this.parentNode.parentNode.parentNode.parentNode.hotComponent.selectRow (this, ${index});">`;
|
|
232
|
+
|
|
233
|
+
rowStr += `<td><input type = "checkbox" /></td>`;
|
|
84
234
|
|
|
85
235
|
for (let iIdx = 0; iIdx < this.headerIndicies.length; iIdx++)
|
|
86
236
|
{
|
|
@@ -88,12 +238,17 @@ export class AdminTable extends HotComponent
|
|
|
88
238
|
let value = fields[key];
|
|
89
239
|
|
|
90
240
|
if (this.headerElements[key] != null)
|
|
91
|
-
rowStr += `<td>${value}</td>`;
|
|
241
|
+
rowStr += `<td data-index = "${index}">${value}</td>`;
|
|
92
242
|
}
|
|
93
243
|
|
|
94
244
|
rowStr += "</tr>";
|
|
95
245
|
|
|
96
|
-
HotStaq.addHtml (tbody, rowStr);
|
|
246
|
+
let newObj = HotStaq.addHtml (tbody, rowStr);
|
|
247
|
+
|
|
248
|
+
this.rowElements.push ({
|
|
249
|
+
fields: fields,
|
|
250
|
+
element: (<HTMLElement>newObj)
|
|
251
|
+
});
|
|
97
252
|
}
|
|
98
253
|
|
|
99
254
|
/**
|
|
@@ -145,7 +300,10 @@ export class AdminTable extends HotComponent
|
|
|
145
300
|
<h2>${this.title}</h2>
|
|
146
301
|
<div class="table-responsive">
|
|
147
302
|
<table id = "${this.htmlElements[0].id}Table" class="table table-striped table-sm">
|
|
148
|
-
<thead
|
|
303
|
+
<thead>
|
|
304
|
+
<tr hot-place-here = "header">
|
|
305
|
+
<th></th>
|
|
306
|
+
</tr>
|
|
149
307
|
</thead>
|
|
150
308
|
<tbody hot-place-here = "results">
|
|
151
309
|
</tbody>
|
|
@@ -6,6 +6,18 @@ export class AdminText extends HotComponent
|
|
|
6
6
|
* The associated database field.
|
|
7
7
|
*/
|
|
8
8
|
field: string;
|
|
9
|
+
/**
|
|
10
|
+
* The type of field. Can be:
|
|
11
|
+
* * text
|
|
12
|
+
* * date
|
|
13
|
+
*
|
|
14
|
+
* Default: text
|
|
15
|
+
*/
|
|
16
|
+
field_type: string;
|
|
17
|
+
/**
|
|
18
|
+
* If set to 1, this will not output the field.
|
|
19
|
+
*/
|
|
20
|
+
no_output: string;
|
|
9
21
|
|
|
10
22
|
constructor (copy: HotComponent | HotStaq, api: HotAPI)
|
|
11
23
|
{
|
|
@@ -13,6 +25,8 @@ export class AdminText extends HotComponent
|
|
|
13
25
|
|
|
14
26
|
this.tag = "admin-text";
|
|
15
27
|
this.field = "";
|
|
28
|
+
this.field_type = "text";
|
|
29
|
+
this.no_output = "0";
|
|
16
30
|
}
|
|
17
31
|
|
|
18
32
|
/**
|
|
@@ -22,6 +36,8 @@ export class AdminText extends HotComponent
|
|
|
22
36
|
{
|
|
23
37
|
let placeHereArray = parentHtmlElement.querySelectorAll (`hot-place-here[type="modal"]`);
|
|
24
38
|
|
|
39
|
+
// Search for the input box in the modal we attached to, then store the
|
|
40
|
+
// found input box into the fieldElements array.
|
|
25
41
|
if (placeHereArray.length > 0)
|
|
26
42
|
{
|
|
27
43
|
let placeHere = placeHereArray[0];
|
|
@@ -42,6 +58,9 @@ export class AdminText extends HotComponent
|
|
|
42
58
|
if (this.value != null)
|
|
43
59
|
value = this.value;
|
|
44
60
|
|
|
61
|
+
if (this.no_output === "1")
|
|
62
|
+
return (`<div><input class="form-control" type = "hidden" value = "${value}" /></div>`);
|
|
63
|
+
|
|
45
64
|
return (`<div>
|
|
46
65
|
<label class="form-label">${this.inner}</label><input class="form-control" type = "text" value = "${value}" />
|
|
47
66
|
</div>`);
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AdminButton } from "./components/admin-button";
|
|
2
|
+
import { AdminDashboard } from "./components/admin-dashboard";
|
|
3
|
+
import { AdminEdit } from "./components/admin-edit";
|
|
4
|
+
import { AdminTable } from "./components/admin-table";
|
|
5
|
+
import { AdminTableField } from "./components/admin-table-field";
|
|
6
|
+
import { AdminTableRow } from "./components/admin-table-row";
|
|
7
|
+
import { AdminText } from "./components/admin-text";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
AdminButton,
|
|
11
|
+
AdminDashboard,
|
|
12
|
+
AdminEdit,
|
|
13
|
+
AdminTable,
|
|
14
|
+
AdminTableField,
|
|
15
|
+
AdminTableRow,
|
|
16
|
+
AdminText
|
|
17
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/* Basic Options */
|
|
4
4
|
// "incremental": true, /* Enable incremental compilation */
|
|
5
5
|
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
|
6
|
+
"skipLibCheck": false, /* Skip type checking of declaration files. */
|
|
6
7
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
7
8
|
"lib": [
|
|
8
9
|
"ES6",
|
package/webpack.config.cjs
CHANGED
|
@@ -8,7 +8,7 @@ const packageJSON = JSON.parse (packageStr);
|
|
|
8
8
|
let packageVersion = packageJSON.version.toString ();
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
entry: "./src/
|
|
11
|
+
entry: "./src/index.ts",
|
|
12
12
|
devtool: "inline-source-map",
|
|
13
13
|
target: "web",
|
|
14
14
|
module: {
|
|
@@ -59,6 +59,7 @@ module.exports = {
|
|
|
59
59
|
"dotenv": "{}",
|
|
60
60
|
"fs-extra": "{}",
|
|
61
61
|
"HotIO": "{}",
|
|
62
|
+
"bootstrap": "bootstrap",
|
|
62
63
|
"hotstaq": "HotStaqWeb",
|
|
63
64
|
"graceful-fs": "{}",
|
|
64
65
|
"node:path": "{}",
|
package/build/scripts/watch.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../scripts/watch.ts"],"names":[],"mappings":""}
|
package/build/scripts/watch.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
-
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;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
var hotstaq_1 = require("hotstaq");
|
|
63
|
-
var ppath = __importStar(require("path"));
|
|
64
|
-
var chokidar = __importStar(require("chokidar"));
|
|
65
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
function watchAndCopy(src, dest) {
|
|
67
|
-
var _this = this;
|
|
68
|
-
chokidar.watch(src, { ignoreInitial: true })
|
|
69
|
-
.on("all", function (event, filePath) { return __awaiter(_this, void 0, void 0, function () {
|
|
70
|
-
var fileName, fileExt, destPath;
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
switch (_a.label) {
|
|
73
|
-
case 0:
|
|
74
|
-
if (!(event === 'change')) return [3 /*break*/, 2];
|
|
75
|
-
fileName = ppath.basename(filePath);
|
|
76
|
-
fileExt = ppath.extname(filePath).toLowerCase();
|
|
77
|
-
destPath = dest + '/' + fileName;
|
|
78
|
-
if (!(fileExt === ".js")) return [3 /*break*/, 2];
|
|
79
|
-
return [4 /*yield*/, hotstaq_1.HotIO.copyFile(filePath, destPath)];
|
|
80
|
-
case 1:
|
|
81
|
-
_a.sent();
|
|
82
|
-
console.log("".concat(fileName, " was copied to ").concat(destPath));
|
|
83
|
-
_a.label = 2;
|
|
84
|
-
case 2: return [2 /*return*/];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}); })
|
|
88
|
-
.on("error", function (error) {
|
|
89
|
-
console.error("Error: ".concat(error));
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
var src, dest;
|
|
93
|
-
return __generator(this, function (_a) {
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0: return [4 /*yield*/, hotstaq_1.HotIO.exists("".concat(process.cwd(), "/assets/components/"))];
|
|
96
|
-
case 1:
|
|
97
|
-
if (!((_a.sent()) === false)) return [3 /*break*/, 3];
|
|
98
|
-
return [4 /*yield*/, hotstaq_1.HotIO.mkdir("".concat(process.cwd(), "/assets/components/"))];
|
|
99
|
-
case 2:
|
|
100
|
-
_a.sent();
|
|
101
|
-
_a.label = 3;
|
|
102
|
-
case 3:
|
|
103
|
-
src = "".concat(process.cwd(), "/build/src/components/");
|
|
104
|
-
dest = "".concat(process.cwd(), "/assets/components/");
|
|
105
|
-
//watchAndCopy (src, dest);
|
|
106
|
-
return [4 /*yield*/, hotstaq_1.HotIO.copyFiles(src, dest, {
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
"filter": function (src, dest) {
|
|
109
|
-
var fileExt = ppath.extname(src).toLowerCase();
|
|
110
|
-
if (fileExt === "")
|
|
111
|
-
return (true);
|
|
112
|
-
if (fileExt === ".js") {
|
|
113
|
-
console.log("Copying ".concat(src));
|
|
114
|
-
return (true);
|
|
115
|
-
}
|
|
116
|
-
return (false);
|
|
117
|
-
}
|
|
118
|
-
})];
|
|
119
|
-
case 4:
|
|
120
|
-
//watchAndCopy (src, dest);
|
|
121
|
-
_a.sent();
|
|
122
|
-
console.log("".concat(src, " was copied to ").concat(dest));
|
|
123
|
-
return [2 /*return*/];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}); })();
|
|
127
|
-
//# sourceMappingURL=watch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../scripts/watch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAgC;AAChC,0CAA8B;AAC9B,iDAAqC;AAErC,CAAC;IAEA,SAAS,YAAY,CAAE,GAAW,EAAE,IAAY;QAAhD,iBAuBC;QArBA,QAAQ,CAAC,KAAK,CAAE,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aAC3C,EAAE,CAAE,KAAK,EAAE,UAAO,KAAK,EAAE,QAAQ;;;;;6BAE5B,CAAA,KAAK,KAAK,QAAQ,CAAA,EAAlB,wBAAkB;wBAEf,QAAQ,GAAW,KAAK,CAAC,QAAQ,CAAE,QAAQ,CAAC,CAAC;wBAC7C,OAAO,GAAW,KAAK,CAAC,OAAO,CAAE,QAAQ,CAAC,CAAC,WAAW,EAAG,CAAC;wBAC1D,QAAQ,GAAW,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;6BAE3C,CAAA,OAAO,KAAK,KAAK,CAAA,EAAjB,wBAAiB;wBAEpB,qBAAM,eAAK,CAAC,QAAQ,CAAE,QAAQ,EAAE,QAAQ,CAAC,EAAA;;wBAAzC,SAAyC,CAAC;wBAE1C,OAAO,CAAC,GAAG,CAAE,UAAG,QAAQ,4BAAkB,QAAQ,CAAE,CAAC,CAAC;;;;;aAGxD,CAAC;aACF,EAAE,CAAE,OAAO,EAAE,UAAC,KAAK;YAElB,OAAO,CAAC,KAAK,CAAE,iBAAU,KAAK,CAAE,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACN,CAAC;;;;oBAEG,qBAAM,eAAK,CAAC,MAAM,CAAE,UAAG,OAAO,CAAC,GAAG,EAAG,wBAAqB,CAAC,EAAA;;qBAA3D,CAAA,CAAA,SAA2D,MAAK,KAAK,CAAA,EAArE,wBAAqE;gBACxE,qBAAM,eAAK,CAAC,KAAK,CAAE,UAAG,OAAO,CAAC,GAAG,EAAG,wBAAqB,CAAC,EAAA;;gBAA1D,SAA0D,CAAC;;;gBAEtD,GAAG,GAAW,UAAG,OAAO,CAAC,GAAG,EAAG,2BAAwB,CAAC;gBACxD,IAAI,GAAW,UAAG,OAAO,CAAC,GAAG,EAAG,wBAAqB,CAAC;gBAE5D,2BAA2B;gBAE3B,qBAAM,eAAK,CAAC,SAAS,CAAE,GAAG,EAAE,IAAI,EAAE;wBACjC,aAAa;wBACb,QAAQ,EAAE,UAAC,GAAW,EAAE,IAAY;4BAEnC,IAAM,OAAO,GAAW,KAAK,CAAC,OAAO,CAAE,GAAG,CAAC,CAAC,WAAW,EAAG,CAAC;4BAE3D,IAAI,OAAO,KAAK,EAAE;gCACjB,OAAO,CAAC,IAAI,CAAC,CAAC;4BAEf,IAAI,OAAO,KAAK,KAAK,EACrB;gCACC,OAAO,CAAC,GAAG,CAAE,kBAAW,GAAG,CAAE,CAAC,CAAC;gCAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;6BACd;4BAED,OAAO,CAAC,KAAK,CAAC,CAAC;wBAChB,CAAC;qBACD,CAAC,EAAA;;gBAnBF,2BAA2B;gBAE3B,SAiBE,CAAC;gBACH,OAAO,CAAC,GAAG,CAAE,UAAG,GAAG,4BAAkB,IAAI,CAAE,CAAC,CAAC;;;;KAC7C,CAAC,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/build/src/AppAPI.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebExport.d.ts","sourceRoot":"","sources":["../../src/WebExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,iBAAe,WAAW,IAAK,OAAO,CAAC,GAAG,CAAC,CAqB1C;AAED,OAAO,EACL,WAAW,EACX,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,eAAe,EACf,aAAa,EACb,SAAS,EACT,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebExport.js","sourceRoot":"","sources":["../../src/WebExport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAwD;AAiCtD,4FAjCO,0BAAW,OAiCP;AAhCb,gEAA8D;AAiC5D,+FAjCO,gCAAc,OAiCP;AAhChB,sDAAoD;AAiClD,0FAjCO,sBAAS,OAiCP;AAhCX,wDAAsD;AAiCpD,2FAjCO,wBAAU,OAiCP;AAhCZ,oEAAiE;AAiC/D,gGAjCO,mCAAe,OAiCP;AAhCjB,gEAA6D;AAiC3D,8FAjCO,+BAAa,OAiCP;AAhCf,sDAAoD;AAiClD,0FAjCO,sBAAS,OAiCP;AA/BX,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,0BAAW;wBACX,gCAAc;wBACd,sBAAS;wBACT,wBAAU;wBACV,mCAAe;wBACf,+BAAa;wBACb,sBAAS;qBAAC;iBACX,CAAC,EAAC;;;CACJ;AAGC,kCAAW"}
|
package/build/src/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|
package/build/src/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { HotStaq, HotAPI, HotComponent, HotComponentOutput } from "hotstaq";
|
|
2
|
-
export declare class AdminEdit extends HotComponent {
|
|
3
|
-
/**
|
|
4
|
-
* The title of this edit modal.
|
|
5
|
-
*/
|
|
6
|
-
title: string;
|
|
7
|
-
/**
|
|
8
|
-
* The button title.
|
|
9
|
-
*/
|
|
10
|
-
button_title: string;
|
|
11
|
-
/**
|
|
12
|
-
* The attached list.
|
|
13
|
-
*/
|
|
14
|
-
attached_list: string;
|
|
15
|
-
/**
|
|
16
|
-
* The attached schema.
|
|
17
|
-
*/
|
|
18
|
-
schema: string;
|
|
19
|
-
/**
|
|
20
|
-
* The field elements in the edit modal.
|
|
21
|
-
*/
|
|
22
|
-
fieldElements: {
|
|
23
|
-
[name: string]: any;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* The modal id.
|
|
27
|
-
*/
|
|
28
|
-
modalId: string;
|
|
29
|
-
constructor(copy: HotComponent | HotStaq, api: HotAPI);
|
|
30
|
-
/**
|
|
31
|
-
* Save this form.
|
|
32
|
-
*/
|
|
33
|
-
onSave(): Promise<void>;
|
|
34
|
-
output(): string | HotComponentOutput[];
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=admin-edit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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;gBAEH,IAAI,EAAE,YAAY,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM;IAetD;;OAEG;IACG,MAAM;IA0BZ,MAAM,IAAK,MAAM,GAAG,kBAAkB,EAAE;CAoCxC"}
|
|
@@ -1,120 +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
|
-
if (this.name === "")
|
|
105
|
-
throw new Error("You must specify a name for each admin-edit element!");
|
|
106
|
-
this.modalId = "".concat(this.name, "Modal");
|
|
107
|
-
return ([{
|
|
108
|
-
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 -->"),
|
|
109
|
-
documentSelector: "body"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
html: "<button id = \"".concat(this.modalId, "-add-btn\" type=\"button\" class=\"btn btn-sm btn-outline-secondary\" data-bs-toggle=\"modal\" data-bs-target=\"#").concat(this.modalId, "\">Add</button>"),
|
|
113
|
-
//`<button id = "${this.modalId}-add-btn" type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal" onclick = "$('#${this.modalId}').modal ('show');">Add</button>`,
|
|
114
|
-
documentSelector: "hot-place-here[name=\"buttons\"]"
|
|
115
|
-
}]);
|
|
116
|
-
};
|
|
117
|
-
return AdminEdit;
|
|
118
|
-
}(hotstaq_1.HotComponent));
|
|
119
|
-
exports.AdminEdit = AdminEdit;
|
|
120
|
-
//# sourceMappingURL=admin-edit.js.map
|