@hotstaq/admin-panel 0.3.9 → 0.3.12
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/build/components/admin-edit.d.ts +6 -3
- package/build/components/admin-edit.d.ts.map +1 -1
- package/build/components/admin-edit.js +40 -24
- package/build/components/admin-edit.js.map +1 -1
- package/build/components/admin-table.d.ts.map +1 -1
- package/build/components/admin-table.js +27 -20
- package/build/components/admin-table.js.map +1 -1
- package/build-web/AdminPanelComponents.js +2 -2
- package/build-web/AdminPanelWeb_AppAPI.js +12 -12
- package/package.json +6 -6
- package/src/components/admin-edit.ts +51 -25
- package/src/components/admin-table.ts +39 -29
|
@@ -220,8 +220,8 @@ class users
|
|
|
220
220
|
* @property {string} registeredDate The registered date.
|
|
221
221
|
* @property {string} loginDate The login date.
|
|
222
222
|
* @property {boolean} verified Indicates if the account has been verified.
|
|
223
|
-
* @property {string} ip The
|
|
224
|
-
* @property {string} jwtToken The
|
|
223
|
+
* @property {string} ip The user's ip.
|
|
224
|
+
* @property {string} jwtToken The user's JWT token.
|
|
225
225
|
*/
|
|
226
226
|
|
|
227
227
|
/**
|
|
@@ -563,8 +563,8 @@ class admins
|
|
|
563
563
|
* @property {string} registeredDate The registered date.
|
|
564
564
|
* @property {string} loginDate The login date.
|
|
565
565
|
* @property {boolean} verified Indicates if the account has been verified.
|
|
566
|
-
* @property {string} ip The
|
|
567
|
-
* @property {string} jwtToken The
|
|
566
|
+
* @property {string} ip The user's ip.
|
|
567
|
+
* @property {string} jwtToken The user's JWT token.
|
|
568
568
|
*/
|
|
569
569
|
|
|
570
570
|
/**
|
|
@@ -743,8 +743,8 @@ class admins
|
|
|
743
743
|
* @property {string} registeredDate The registered date.
|
|
744
744
|
* @property {string} loginDate The login date.
|
|
745
745
|
* @property {boolean} verified Indicates if the account has been verified.
|
|
746
|
-
* @property {string} ip The
|
|
747
|
-
* @property {string} jwtToken The
|
|
746
|
+
* @property {string} ip The user's ip.
|
|
747
|
+
* @property {string} jwtToken The user's JWT token.
|
|
748
748
|
*/
|
|
749
749
|
|
|
750
750
|
/**
|
|
@@ -798,8 +798,8 @@ class admins
|
|
|
798
798
|
* @property {string} registeredDate The registered date.
|
|
799
799
|
* @property {string} loginDate The login date.
|
|
800
800
|
* @property {boolean} verified Indicates if the account has been verified.
|
|
801
|
-
* @property {string} ip The
|
|
802
|
-
* @property {string} jwtToken The
|
|
801
|
+
* @property {string} ip The user's ip.
|
|
802
|
+
* @property {string} jwtToken The user's JWT token.
|
|
803
803
|
*/
|
|
804
804
|
|
|
805
805
|
/**
|
|
@@ -853,8 +853,8 @@ class admins
|
|
|
853
853
|
* @property {string} registeredDate The registered date.
|
|
854
854
|
* @property {string} loginDate The login date.
|
|
855
855
|
* @property {boolean} verified Indicates if the account has been verified.
|
|
856
|
-
* @property {string} ip The
|
|
857
|
-
* @property {string} jwtToken The
|
|
856
|
+
* @property {string} ip The user's ip.
|
|
857
|
+
* @property {string} jwtToken The user's JWT token.
|
|
858
858
|
* @property {string} newPassword The new password to set.
|
|
859
859
|
*/
|
|
860
860
|
|
|
@@ -916,8 +916,8 @@ class admins
|
|
|
916
916
|
* @property {string} registeredDate The registered date.
|
|
917
917
|
* @property {string} loginDate The login date.
|
|
918
918
|
* @property {boolean} verified Indicates if the account has been verified.
|
|
919
|
-
* @property {string} ip The
|
|
920
|
-
* @property {string} jwtToken The
|
|
919
|
+
* @property {string} ip The user's ip.
|
|
920
|
+
* @property {string} jwtToken The user's JWT token.
|
|
921
921
|
*/
|
|
922
922
|
|
|
923
923
|
/**
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotstaq/admin-panel",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.12",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "hotstaq --hotsite ./HotSite.json --env-file ./.env run --server-type web-api",
|
|
8
8
|
"dev": "hotstaq --hotsite ./HotSite.json --development-mode run --server-type web-api --web-http-port 8080",
|
|
9
9
|
"test": "hotstaq --dev --env-file .env run --server-type web-api --web-test",
|
|
10
10
|
"build": "tsc --build ./tsconfig.json",
|
|
11
|
-
"build-web": "npm run build && hotstaq create --copy-libraries-to-location ./public/js/ app && webpack --mode=production && hotstaq module build && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq generate --copy-to ./public/js/",
|
|
12
|
-
"build-web-debug": "npm run build && hotstaq create --copy-libraries-to-location ./public/js/ app && cp -f ./public/js/HotStaq.js ./public/js/HotStaq.min.js && webpack --mode=development && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq module build && hotstaq generate --copy-to ./public/js/",
|
|
11
|
+
"build-web": "npm run build && hotstaq create --copy-libraries-to-location ./public/js/ app && webpack --mode=production && hotstaq module build && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq generate --api --generate-type javascript --copy-to ./public/js/",
|
|
12
|
+
"build-web-debug": "npm run build && hotstaq create --copy-libraries-to-location ./public/js/ app && cp -f ./public/js/HotStaq.js ./public/js/HotStaq.min.js && webpack --mode=development && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq module build && hotstaq generate --api --generate-type javascript --copy-to ./public/js/",
|
|
13
13
|
"build-doc": "hotstaq generate --generate-type openapi-3.0.0-yaml",
|
|
14
|
-
"prepublishOnly": "npm run build
|
|
14
|
+
"prepublishOnly": "npm run build-web"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"author": "FreeLight, Inc",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@hotstaq/dataroute": "^0.2.10",
|
|
21
|
-
"@hotstaq/userroute": "^0.6.
|
|
21
|
+
"@hotstaq/userroute": "^0.6.14",
|
|
22
22
|
"@popperjs/core": "^2.11.8",
|
|
23
23
|
"bootstrap": "^5.3.3",
|
|
24
24
|
"datatables.net": "^2.2.2",
|
|
@@ -52,6 +52,6 @@
|
|
|
52
52
|
"webpack-cli": "^5.0.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"hotstaq": "^0.8.
|
|
55
|
+
"hotstaq": "^0.8.120"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -198,7 +198,7 @@ export class AdminEdit extends HotComponent
|
|
|
198
198
|
/**
|
|
199
199
|
* Get the attached lists.
|
|
200
200
|
*/
|
|
201
|
-
|
|
201
|
+
getAttachedHTMLLists (): HTMLElement[]
|
|
202
202
|
{
|
|
203
203
|
const strs = this.attached_list.split (",");
|
|
204
204
|
const attachedLists: HTMLElement[] = [];
|
|
@@ -213,10 +213,30 @@ export class AdminEdit extends HotComponent
|
|
|
213
213
|
return (attachedLists);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Get the attached lists.
|
|
218
|
+
*/
|
|
219
|
+
getAttachedLists (): HotComponent[]
|
|
220
|
+
{
|
|
221
|
+
const attachedLists = this.getAttachedHTMLLists ();
|
|
222
|
+
let attachedListObjs = [];
|
|
223
|
+
|
|
224
|
+
for (let iIdx = 0; iIdx < attachedLists.length; iIdx++)
|
|
225
|
+
{
|
|
226
|
+
let attachedList = attachedLists[iIdx];
|
|
227
|
+
// @ts-ignore
|
|
228
|
+
const hotComponent = attachedList.hotComponent;
|
|
229
|
+
|
|
230
|
+
attachedListObjs.push (hotComponent);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return (attachedListObjs);
|
|
234
|
+
}
|
|
235
|
+
|
|
216
236
|
/**
|
|
217
237
|
* Executes when the edit button is clicked.
|
|
218
238
|
*/
|
|
219
|
-
async editClicked (
|
|
239
|
+
async editClicked (selectedFields: any[] = []): Promise<void>
|
|
220
240
|
{
|
|
221
241
|
if (this.onEditClicked != null)
|
|
222
242
|
{
|
|
@@ -232,31 +252,39 @@ export class AdminEdit extends HotComponent
|
|
|
232
252
|
|
|
233
253
|
if (this.attached_list !== "")
|
|
234
254
|
{
|
|
235
|
-
|
|
236
|
-
let selectedField = attachedList.getSelected ();
|
|
255
|
+
const attachedLists = this.getAttachedLists ();
|
|
237
256
|
|
|
238
|
-
|
|
257
|
+
for (let iIdx = 0; iIdx < attachedLists.length; iIdx++)
|
|
239
258
|
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
{
|
|
243
|
-
// @ts-ignore
|
|
244
|
-
let value = selectedField[field.name];
|
|
259
|
+
let attachedList = attachedLists[iIdx];
|
|
260
|
+
let table: AdminTable = (<AdminTable>attachedList);
|
|
245
261
|
|
|
246
|
-
|
|
262
|
+
table.attachedEdit = this;
|
|
263
|
+
let selectedField = table.getSelected ();
|
|
264
|
+
|
|
265
|
+
if (selectedField != null)
|
|
266
|
+
{
|
|
267
|
+
await this.processHotFields (
|
|
268
|
+
async (htmlElement: Element, field: { name: string; type: string; input: string; }) =>
|
|
247
269
|
{
|
|
248
|
-
|
|
270
|
+
// @ts-ignore
|
|
271
|
+
let value = selectedField[field.name];
|
|
272
|
+
|
|
273
|
+
if (field.input != null)
|
|
249
274
|
{
|
|
250
|
-
|
|
251
|
-
|
|
275
|
+
if (field.input !== "")
|
|
276
|
+
{
|
|
277
|
+
let func = new Function (field.input);
|
|
278
|
+
value = await func.call (this, this, htmlElement, value);
|
|
279
|
+
}
|
|
252
280
|
}
|
|
253
|
-
}
|
|
254
281
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
282
|
+
if (value != null)
|
|
283
|
+
$(htmlElement).val (value);
|
|
284
|
+
});
|
|
258
285
|
|
|
259
|
-
|
|
286
|
+
this.selectedFields = [selectedField];
|
|
287
|
+
}
|
|
260
288
|
}
|
|
261
289
|
}
|
|
262
290
|
|
|
@@ -308,8 +336,8 @@ export class AdminEdit extends HotComponent
|
|
|
308
336
|
for (let iIdx = 0; iIdx < attachedLists.length; iIdx++)
|
|
309
337
|
{
|
|
310
338
|
let attachedList = attachedLists[iIdx];
|
|
311
|
-
|
|
312
|
-
|
|
339
|
+
hotComponent = (<AdminTable>attachedList);
|
|
340
|
+
|
|
313
341
|
hotComponent.attachedEdit = this;
|
|
314
342
|
let checkedRows = hotComponent.getCheckedRows ();
|
|
315
343
|
|
|
@@ -512,8 +540,7 @@ export class AdminEdit extends HotComponent
|
|
|
512
540
|
for (let iIdx = 0; iIdx < attachedLists.length; iIdx++)
|
|
513
541
|
{
|
|
514
542
|
let attachedList = attachedLists[iIdx];
|
|
515
|
-
|
|
516
|
-
let table: AdminTable = attachedList.hotComponent;
|
|
543
|
+
let table: AdminTable = (<AdminTable>attachedList);
|
|
517
544
|
|
|
518
545
|
table.attachedEdit = this;
|
|
519
546
|
|
|
@@ -548,8 +575,7 @@ export class AdminEdit extends HotComponent
|
|
|
548
575
|
for (let iIdx = 0; iIdx < attachedLists.length; iIdx++)
|
|
549
576
|
{
|
|
550
577
|
let attachedList = attachedLists[iIdx];
|
|
551
|
-
|
|
552
|
-
let table: AdminTable = attachedList.hotComponent;
|
|
578
|
+
let table: AdminTable = (<AdminTable>attachedList);
|
|
553
579
|
|
|
554
580
|
if (table != null)
|
|
555
581
|
table.attachedEdit = this;
|
|
@@ -2,7 +2,7 @@ import { HotStaq, Hot, HotAPI, HotComponent, HotComponentOutput } from "hotstaq"
|
|
|
2
2
|
import { AdminTableField } from "./admin-table-field";
|
|
3
3
|
import { AdminEdit } from "./admin-edit";
|
|
4
4
|
|
|
5
|
-
import DataTable, { Api, ConfigColumns } from "datatables.net";
|
|
5
|
+
import DataTable, { Api, ConfigColumns, InternalSettings } from "datatables.net";
|
|
6
6
|
import dt5 from 'datatables.net-bs5';
|
|
7
7
|
import dtc from 'datatables.net-colreorder-bs5';
|
|
8
8
|
import dts from 'datatables.net-scroller-bs5';
|
|
@@ -209,22 +209,6 @@ export class AdminTable extends HotComponent
|
|
|
209
209
|
*/
|
|
210
210
|
async selectRow (htmlElement: HTMLElement, rowIndex: number): Promise<void>
|
|
211
211
|
{
|
|
212
|
-
if (this.onselectedrow != null)
|
|
213
|
-
{
|
|
214
|
-
if (typeof (this.onselectedrow) === "string")
|
|
215
|
-
this.onselectedrow = (<(rowIndex: number, item: any[]) => Promise<boolean>>new Function (this.onselectedrow));
|
|
216
|
-
|
|
217
|
-
let item: any[] = null;
|
|
218
|
-
|
|
219
|
-
if (this.rowElements[rowIndex] != null)
|
|
220
|
-
item = this.rowElements[rowIndex].fields;
|
|
221
|
-
|
|
222
|
-
let result = await this.onselectedrow (rowIndex, item);
|
|
223
|
-
|
|
224
|
-
if (result === false)
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
212
|
// In the future, we will support multiple rows being selected. For now
|
|
229
213
|
// this will ensure that only one row is selected at a time.
|
|
230
214
|
{
|
|
@@ -250,7 +234,19 @@ export class AdminTable extends HotComponent
|
|
|
250
234
|
if (this.singleclickedit === true)
|
|
251
235
|
{
|
|
252
236
|
if (this.attachedEdit != null)
|
|
253
|
-
await this.attachedEdit.editClicked (
|
|
237
|
+
await this.attachedEdit.editClicked ();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (this.onselectedrow != null)
|
|
241
|
+
{
|
|
242
|
+
if (typeof (this.onselectedrow) === "string")
|
|
243
|
+
this.onselectedrow = (<(rowIndex: number, item: any[]) => Promise<boolean>>new Function (this.onselectedrow));
|
|
244
|
+
|
|
245
|
+
let item: any[] = this.getSelected ();
|
|
246
|
+
let result = await this.onselectedrow (rowIndex, item);
|
|
247
|
+
|
|
248
|
+
if (result === false)
|
|
249
|
+
return;
|
|
254
250
|
}
|
|
255
251
|
|
|
256
252
|
/*this.selectedRows = [];
|
|
@@ -478,8 +474,12 @@ export class AdminTable extends HotComponent
|
|
|
478
474
|
/*let tbody = this.htmlElements[1].getElementsByTagName ("tbody")[0];
|
|
479
475
|
|
|
480
476
|
tbody.innerHTML = "";*/
|
|
481
|
-
|
|
482
|
-
this.dataTable
|
|
477
|
+
|
|
478
|
+
if (this.dataTable != null)
|
|
479
|
+
{
|
|
480
|
+
// @ts-ignore
|
|
481
|
+
this.dataTable.clear ();
|
|
482
|
+
}
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
/**
|
|
@@ -616,31 +616,41 @@ export class AdminTable extends HotComponent
|
|
|
616
616
|
dom: 'Qlfrtip',
|
|
617
617
|
columns: columns,
|
|
618
618
|
data: [],
|
|
619
|
-
ajax: async (data, callback, settings) =>
|
|
619
|
+
ajax: async (data: object, callback: ((data: any) => void), settings: InternalSettings) =>
|
|
620
620
|
{
|
|
621
621
|
if (this.isListRefreshing === true)
|
|
622
622
|
return;
|
|
623
623
|
|
|
624
|
-
|
|
624
|
+
let currentData = await this.refreshList ();
|
|
625
|
+
|
|
625
626
|
const callbackObj: any = {
|
|
627
|
+
// @ts-ignore
|
|
628
|
+
draw: data.draw,
|
|
626
629
|
data: [],
|
|
627
630
|
recordsTotal: 0,
|
|
628
631
|
recordsFiltered: 0
|
|
629
632
|
};
|
|
630
633
|
|
|
631
|
-
if (
|
|
634
|
+
if (currentData != null)
|
|
632
635
|
{
|
|
633
|
-
if (currentData
|
|
636
|
+
if (! (currentData instanceof Array))
|
|
637
|
+
{
|
|
638
|
+
if (currentData.length != null)
|
|
639
|
+
{
|
|
640
|
+
callbackObj.recordsTotal = currentData.length;
|
|
641
|
+
callbackObj.recordsFiltered = currentData.length;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
if (currentData.data != null)
|
|
645
|
+
callbackObj.data = currentData.data;
|
|
646
|
+
}
|
|
647
|
+
else
|
|
634
648
|
{
|
|
649
|
+
callbackObj.data = currentData;
|
|
635
650
|
callbackObj.recordsTotal = currentData.length;
|
|
636
651
|
callbackObj.recordsFiltered = currentData.length;
|
|
637
652
|
}
|
|
638
|
-
|
|
639
|
-
if (currentData.data != null)
|
|
640
|
-
callbackObj.data = currentData.data;
|
|
641
653
|
}
|
|
642
|
-
else
|
|
643
|
-
callbackObj.data = currentData;
|
|
644
654
|
|
|
645
655
|
callback (callbackObj);
|
|
646
656
|
}
|