@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.
Files changed (90) hide show
  1. package/.vscode/launch.json +5 -4
  2. package/HotSite.json +2 -2
  3. package/build/{src/AppAPI.d.ts → AppAPI.d.ts} +0 -0
  4. package/build/AppAPI.d.ts.map +1 -0
  5. package/build/{src/AppAPI.js → AppAPI.js} +0 -0
  6. package/build/AppAPI.js.map +1 -0
  7. package/build/WebExport.d.ts +3 -0
  8. package/build/WebExport.d.ts.map +1 -0
  9. package/build/{src/WebExport.js → WebExport.js} +8 -22
  10. package/build/WebExport.js.map +1 -0
  11. package/build/{src/cli.d.ts → cli.d.ts} +0 -0
  12. package/build/cli.d.ts.map +1 -0
  13. package/build/{src/cli.js → cli.js} +0 -0
  14. package/build/cli.js.map +1 -0
  15. package/build/{src/components → components}/admin-button.d.ts +0 -0
  16. package/build/components/admin-button.d.ts.map +1 -0
  17. package/build/{src/components → components}/admin-button.js +0 -0
  18. package/build/components/admin-button.js.map +1 -0
  19. package/build/components/admin-checkbox.d.ts +1 -0
  20. package/build/components/admin-checkbox.d.ts.map +1 -0
  21. package/build/components/admin-checkbox.js +43 -0
  22. package/build/components/admin-checkbox.js.map +1 -0
  23. package/build/{src/components → components}/admin-dashboard.d.ts +0 -0
  24. package/build/components/admin-dashboard.d.ts.map +1 -0
  25. package/build/{src/components → components}/admin-dashboard.js +0 -0
  26. package/build/components/admin-dashboard.js.map +1 -0
  27. package/build/components/admin-edit.d.ts +87 -0
  28. package/build/components/admin-edit.d.ts.map +1 -0
  29. package/build/components/admin-edit.js +297 -0
  30. package/build/components/admin-edit.js.map +1 -0
  31. package/build/{src/components → components}/admin-table-field.d.ts +0 -0
  32. package/build/components/admin-table-field.d.ts.map +1 -0
  33. package/build/{src/components → components}/admin-table-field.js +2 -2
  34. package/build/components/admin-table-field.js.map +1 -0
  35. package/build/{src/components → components}/admin-table-row.d.ts +0 -0
  36. package/build/components/admin-table-row.d.ts.map +1 -0
  37. package/build/{src/components → components}/admin-table-row.js +2 -0
  38. package/build/components/admin-table-row.js.map +1 -0
  39. package/build/{src/components → components}/admin-table.d.ts +33 -1
  40. package/build/components/admin-table.d.ts.map +1 -0
  41. package/build/{src/components → components}/admin-table.js +106 -4
  42. package/build/components/admin-table.js.map +1 -0
  43. package/build/{src/components → components}/admin-text.d.ts +12 -0
  44. package/build/components/admin-text.d.ts.map +1 -0
  45. package/build/{src/components → components}/admin-text.js +6 -0
  46. package/build/components/admin-text.js.map +1 -0
  47. package/build/{src/WebExport.d.ts → index.d.ts} +2 -3
  48. package/build/index.d.ts.map +1 -0
  49. package/build/index.js +18 -0
  50. package/build/index.js.map +1 -0
  51. package/build-web/AdminPanelComponents.js +2 -2
  52. package/build-web/AdminPanelWeb_AppAPI.js +87 -0
  53. package/package.json +7 -6
  54. package/src/WebExport.ts +9 -24
  55. package/src/components/admin-checkbox.ts +52 -0
  56. package/src/components/admin-edit.ts +229 -12
  57. package/src/components/admin-table-field.ts +2 -2
  58. package/src/components/admin-table-row.ts +3 -0
  59. package/src/components/admin-table.ts +163 -5
  60. package/src/components/admin-text.ts +19 -0
  61. package/src/index.ts +17 -0
  62. package/tsconfig.json +1 -0
  63. package/webpack.config.cjs +2 -1
  64. package/build/scripts/watch.d.ts +0 -2
  65. package/build/scripts/watch.d.ts.map +0 -1
  66. package/build/scripts/watch.js +0 -127
  67. package/build/scripts/watch.js.map +0 -1
  68. package/build/src/AppAPI.d.ts.map +0 -1
  69. package/build/src/AppAPI.js.map +0 -1
  70. package/build/src/WebExport.d.ts.map +0 -1
  71. package/build/src/WebExport.js.map +0 -1
  72. package/build/src/cli.d.ts.map +0 -1
  73. package/build/src/cli.js.map +0 -1
  74. package/build/src/components/admin-button.d.ts.map +0 -1
  75. package/build/src/components/admin-button.js.map +0 -1
  76. package/build/src/components/admin-dashboard.d.ts.map +0 -1
  77. package/build/src/components/admin-dashboard.js.map +0 -1
  78. package/build/src/components/admin-edit.d.ts +0 -36
  79. package/build/src/components/admin-edit.d.ts.map +0 -1
  80. package/build/src/components/admin-edit.js +0 -120
  81. package/build/src/components/admin-edit.js.map +0 -1
  82. package/build/src/components/admin-table-field.d.ts.map +0 -1
  83. package/build/src/components/admin-table-field.js.map +0 -1
  84. package/build/src/components/admin-table-row.d.ts.map +0 -1
  85. package/build/src/components/admin-table-row.js.map +0 -1
  86. package/build/src/components/admin-table.d.ts.map +0 -1
  87. package/build/src/components/admin-table.js.map +0 -1
  88. package/build/src/components/admin-text.d.ts.map +0 -1
  89. package/build/src/components/admin-text.js.map +0 -1
  90. package/scripts/watch.ts +0 -59
@@ -176,11 +176,98 @@ class data
176
176
  return (promise);
177
177
  }
178
178
 
179
+ /**
180
+ * The JSON object to send to the server.
181
+ *
182
+ * @typedef {Object} DATA_EDIT_JSON_OBJECT_TYPE
183
+ * @property {string} schema The schema to edit data in.
184
+ * @property {string} whereFields The where fields and their values to select from the database. A key/value object must be passed. Example: { "name": "Test_User" }
185
+ * @property {string} fields The fields and their values to update in the database. A key/value object must be passed. Example: { "name": "Test_User" }
186
+ */
187
+
188
+ /**
189
+ * The edit method.
190
+ *
191
+ * @param {DATA_EDIT_JSON_OBJECT_TYPE} jsonObj
192
+ *
193
+ * @returns {string} Returns true if successful.
194
+ */
195
+ edit (jsonObj)
196
+ {
197
+ var promise = new Promise ((resolve, reject) =>
198
+ {
199
+ const url = `${this.baseUrl}/v1/data/edit`;
200
+ const auth = null;
201
+
202
+ if (this.authorization != null)
203
+ {
204
+ if (this.authorization.toAuthorizationHeaderString != null)
205
+ auth = this.authorization.toAuthorizationHeaderString ();
206
+ }
207
+
208
+
209
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
210
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
211
+ function (response)
212
+ {
213
+ var result = response.json ();
214
+
215
+ resolve (result);
216
+ });
217
+ });
218
+
219
+ return (promise);
220
+ }
221
+
222
+ /**
223
+ * The JSON object to send to the server.
224
+ *
225
+ * @typedef {Object} DATA_REMOVE_JSON_OBJECT_TYPE
226
+ * @property {string} schema The schema to remove data from.
227
+ * @property {string} whereFields The where fields and their values to select from the database. A key/value object must be passed. Example: { "name": "Test_User" }
228
+ * @property {int} limit The max number of results to delete.
229
+ */
230
+
231
+ /**
232
+ * The remove method.
233
+ *
234
+ * @param {DATA_REMOVE_JSON_OBJECT_TYPE} jsonObj
235
+ *
236
+ * @returns {string} Returns true if successful.
237
+ */
238
+ remove (jsonObj)
239
+ {
240
+ var promise = new Promise ((resolve, reject) =>
241
+ {
242
+ const url = `${this.baseUrl}/v1/data/remove`;
243
+ const auth = null;
244
+
245
+ if (this.authorization != null)
246
+ {
247
+ if (this.authorization.toAuthorizationHeaderString != null)
248
+ auth = this.authorization.toAuthorizationHeaderString ();
249
+ }
250
+
251
+
252
+ jsonObj = HotStaqProcessJSONObject (jsonObj);
253
+ HotStaqPostJSONObject ("POST", url, jsonObj, auth).then (
254
+ function (response)
255
+ {
256
+ var result = response.json ();
257
+
258
+ resolve (result);
259
+ });
260
+ });
261
+
262
+ return (promise);
263
+ }
264
+
179
265
  /**
180
266
  * The JSON object to send to the server.
181
267
  *
182
268
  * @typedef {Object} DATA_LIST_JSON_OBJECT_TYPE
183
269
  * @property {string} schema The schema to access.
270
+ * @property {array} whereFields The where fields and their values to select from the database. A key/value object must be passed. Example: { "name": "Test_User" }
184
271
  * @property {array} fields The list of fields in the schema to access.
185
272
  * @property {int} offset The offset.
186
273
  * @property {int} limit The max number of results to return. Default is 20.
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@hotstaq/admin-panel",
3
3
  "description": "",
4
- "version": "0.2.6",
5
- "main": "build/src/AppAPI.js",
4
+ "version": "0.2.7",
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": "hotstaq create --copy-libraries-to-location ./public/js/ app && hotstaq module build && webpack --mode=production && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq generate --copy-to ./public/js/",
12
- "build-web-debug": "hotstaq create --copy-libraries-to-location ./public/js/ app && hotstaq module build && webpack --mode=development && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq generate --copy-to ./public/js/",
11
+ "build-web": "npm run build && hotstaq create --copy-libraries-to-location ./public/js/ app && webpack --mode=production && cp -f ./build-web/AdminPanelComponents.js ./public/js/AdminPanelComponents.js && hotstaq module build && 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/",
13
13
  "build-doc": "hotstaq generate --generate-type openapi-3.0.0-yaml",
14
14
  "prepublishOnly": "npm run build && npm run build-web"
15
15
  },
@@ -17,16 +17,17 @@
17
17
  "author": "FreeLight, Inc",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@hotstaq/dataroute": "^0.2.1",
20
+ "@hotstaq/dataroute": "^0.2.2",
21
21
  "@popperjs/core": "^2.11.6",
22
22
  "bootstrap": "^5.2.3",
23
23
  "chart.js": "^2.9.4",
24
24
  "dotenv": "^10.0.0",
25
25
  "feather-icons": "^4.29.0",
26
- "hotstaq": "^0.8.11",
26
+ "hotstaq": "^0.8.12",
27
27
  "jquery": "^3.6.3"
28
28
  },
29
29
  "devDependencies": {
30
+ "@types/bootstrap": "^5.2.6",
30
31
  "@types/express": "^4.17.13",
31
32
  "@types/formidable": "^1.2.4",
32
33
  "@types/fs-extra": "^9.0.12",
package/src/WebExport.ts CHANGED
@@ -1,11 +1,3 @@
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
1
  async function buildAssets (): Promise<any>
10
2
  {
11
3
  return ({
@@ -19,23 +11,16 @@ async function buildAssets (): Promise<any>
19
11
  js: ["./assets/js/*.*", "./build-web/AdminPanelComponents.js"],
20
12
  componentLibrary: "AdminPanelComponentsWeb",
21
13
  components: [
22
- AdminButton,
23
- AdminDashboard,
24
- AdminEdit,
25
- AdminTable,
26
- AdminTableField,
27
- AdminTableRow,
28
- AdminText]
14
+ "AdminButton",
15
+ "AdminDashboard",
16
+ "AdminEdit",
17
+ "AdminTable",
18
+ "AdminTableField",
19
+ "AdminTableRow",
20
+ "AdminText"]
29
21
  });
30
22
  }
31
23
 
32
24
  export {
33
- buildAssets,
34
- AdminButton,
35
- AdminDashboard,
36
- AdminEdit,
37
- AdminTable,
38
- AdminTableField,
39
- AdminTableRow,
40
- AdminText
41
- };
25
+ buildAssets
26
+ };
@@ -0,0 +1,52 @@
1
+ // import { HotStaq, Hot, HotAPI, HotComponent, HotComponentOutput } from "hotstaq";
2
+
3
+ // export class AdminCheckbox extends HotComponent
4
+ // {
5
+ // /**
6
+ // * The associated database field.
7
+ // */
8
+ // field: string;
9
+
10
+ // constructor (copy: HotComponent | HotStaq, api: HotAPI)
11
+ // {
12
+ // super (copy, api);
13
+
14
+ // this.tag = "admin-checkbox";
15
+ // this.field = "";
16
+ // }
17
+
18
+ // /**
19
+ // * Corrects the placement of the text elements for modals.
20
+ // */
21
+ // onPostPlace (parentHtmlElement: HTMLElement, htmlElement: HTMLElement): HTMLElement
22
+ // {
23
+ // let placeHereArray = parentHtmlElement.querySelectorAll (`hot-place-here[type="modal"]`);
24
+
25
+ // if (placeHereArray.length > 0)
26
+ // {
27
+ // let placeHere = placeHereArray[0];
28
+ // parentHtmlElement.removeChild (htmlElement);
29
+ // placeHere.appendChild (htmlElement);
30
+
31
+ // // @ts-ignore
32
+ // parentHtmlElement.hotComponent.fieldElements[this.field] = htmlElement.querySelector ("input");
33
+ // }
34
+
35
+ // return (null);
36
+ // }
37
+
38
+ // output (): string | HotComponentOutput[]
39
+ // {
40
+ // let value: string = "";
41
+
42
+ // if (this.value != null)
43
+ // {
44
+ // if ((this.value === true) || (this.value === 1))
45
+ // value = "checked";
46
+ // }
47
+
48
+ // return (`<div>
49
+ // <label class="form-label">${this.inner}</label><input class="form-control" type = "checkbox" ${value} />
50
+ // </div>`);
51
+ // }
52
+ // }
@@ -1,5 +1,9 @@
1
1
  import { HotStaq, Hot, HotAPI, HotComponent, HotComponentOutput } from "hotstaq";
2
2
 
3
+ import bootstrap from "bootstrap";
4
+
5
+ import { AdminTable } from "./admin-table";
6
+
3
7
  export class AdminEdit extends HotComponent
4
8
  {
5
9
  /**
@@ -26,6 +30,25 @@ export class AdminEdit extends HotComponent
26
30
  * The modal id.
27
31
  */
28
32
  modalId: string;
33
+ /**
34
+ * The bootstrap modal instance.
35
+ */
36
+ modal: bootstrap.Modal;
37
+ /**
38
+ * If set to true, this will close the modal when save is clicked.
39
+ */
40
+ closeOnSave: boolean;
41
+ /**
42
+ * The type of modal to open. Can be:
43
+ * * add
44
+ * * edit
45
+ * * remove
46
+ */
47
+ protected modalType: string;
48
+ /**
49
+ * The selected fields.
50
+ */
51
+ protected selectedFields: any[];
29
52
 
30
53
  constructor (copy: HotComponent | HotStaq, api: HotAPI)
31
54
  {
@@ -40,6 +63,130 @@ export class AdminEdit extends HotComponent
40
63
  this.fieldElements = {};
41
64
 
42
65
  this.modalId = "";
66
+ this.modal = null;
67
+ this.modalType = "add";
68
+ this.closeOnSave = true;
69
+ this.selectedFields = [];
70
+ }
71
+
72
+ /**
73
+ * The event that can be called when the add button is clicked.
74
+ * This is called before the add modal opens.
75
+ */
76
+ onAddClicked: () => Promise<boolean> = null;
77
+
78
+ /**
79
+ * Executes when the add button is clicked.
80
+ */
81
+ async addClicked (): Promise<void>
82
+ {
83
+ if (this.onAddClicked != null)
84
+ {
85
+ let result = await this.onAddClicked ();
86
+
87
+ if (result === false)
88
+ return;
89
+ }
90
+
91
+ this.modalType = "add";
92
+
93
+ // Clear the values in each field.
94
+ for (let key in this.fieldElements)
95
+ {
96
+ let fieldElement = this.fieldElements[key];
97
+
98
+ fieldElement.value = "";
99
+ }
100
+
101
+ this.selectedFields = [];
102
+
103
+ bootstrap.Modal.getInstance (`#${this.modalId}`).show ();
104
+ }
105
+
106
+ /**
107
+ * The event that can be called when the edit button is clicked.
108
+ * This is called before the edit modal opens.
109
+ */
110
+ onEditClicked: () => Promise<boolean> = null;
111
+
112
+ /**
113
+ * Executes when the edit button is clicked.
114
+ */
115
+ async editClicked (): Promise<void>
116
+ {
117
+ if (this.onEditClicked != null)
118
+ {
119
+ let result = await this.onEditClicked ();
120
+
121
+ if (result === false)
122
+ return;
123
+ }
124
+
125
+ this.modalType = "edit";
126
+ let attachedList = document.getElementById (this.attached_list);
127
+
128
+ // @ts-ignore
129
+ let hotComponent: AdminTable = attachedList.hotComponent;
130
+ let selectedField = hotComponent.getSelected ();
131
+
132
+ if (selectedField != null)
133
+ {
134
+ for (let key in this.fieldElements)
135
+ {
136
+ let fieldElement = this.fieldElements[key];
137
+
138
+ if (fieldElement != null)
139
+ {
140
+ // @ts-ignore
141
+ let value = selectedField[key];
142
+
143
+ fieldElement.value = value;
144
+ }
145
+ }
146
+
147
+ this.selectedFields = [selectedField];
148
+
149
+ bootstrap.Modal.getInstance (`#${this.modalId}`).show ();
150
+ }
151
+ }
152
+
153
+ /**
154
+ * The event that can be called when the remove button is clicked.
155
+ * This is called before the remove modal opens.
156
+ */
157
+ onRemoveClicked: () => Promise<boolean> = null;
158
+
159
+ /**
160
+ * Executes when the remove button is clicked.
161
+ */
162
+ async removeClicked (): Promise<void>
163
+ {
164
+ if (this.onRemoveClicked != null)
165
+ {
166
+ let result = await this.onRemoveClicked ();
167
+
168
+ if (result === false)
169
+ return;
170
+ }
171
+
172
+ this.modalType = "remove";
173
+
174
+ // @ts-ignore
175
+ let hotComponent: AdminTable = attachedList.hotComponent;
176
+ let checkedRows = hotComponent.getCheckedRows ();
177
+
178
+ if (checkedRows != null)
179
+ {
180
+ const confirmed: boolean = confirm ("Are you sure you want to remove this item?");
181
+
182
+ if (confirmed === true)
183
+ {
184
+ await Hot.jsonRequest (`${Hot.Data.baseUrl}/v1/data/remove`, {
185
+ schema: this.schema,
186
+ whereFields: checkedRows
187
+ });
188
+ }
189
+ }
43
190
  }
44
191
 
45
192
  /**
@@ -52,23 +199,86 @@ export class AdminEdit extends HotComponent
52
199
  for (let key in this.fieldElements)
53
200
  {
54
201
  let fieldElement = this.fieldElements[key];
55
- let value = fieldElement.value;
56
202
 
57
- values[key] = value;
203
+ if (fieldElement != null)
204
+ {
205
+ let value = fieldElement.value;
206
+ let fieldType: string = fieldElement.parentNode.hotComponent.field_type;
207
+
208
+ if (fieldType === "remove")
209
+ continue;
210
+
211
+ values[key] = value;
212
+ }
58
213
  }
59
214
 
60
- await Hot.jsonRequest (`${Hot.Data.baseUrl}/v1/data/add`, {
61
- schema: this.schema,
62
- fields: values
63
- });
215
+ if (this.modalType === "add")
216
+ {
217
+ await Hot.jsonRequest (`${Hot.Data.baseUrl}/v1/data/add`, {
218
+ schema: this.schema,
219
+ fields: values
220
+ });
221
+ }
64
222
 
65
- let attachedList = document.getElementById (this.attached_list);
223
+ if (this.modalType === "edit")
224
+ {
225
+ if (this.selectedFields.length === 0)
226
+ {
227
+ alert ("No item(s) selected!");
66
228
 
67
- // @ts-ignore
68
- await attachedList.hotComponent.refreshList ();
229
+ return;
230
+ }
69
231
 
232
+ let selectedField = this.selectedFields[0];
233
+ let whereFields: any = {};
234
+
235
+ for (let key in selectedField)
236
+ {
237
+ let fieldElement = this.fieldElements[key];
238
+ let value = selectedField[key];
239
+
240
+ if (fieldElement != null)
241
+ {
242
+ let fieldType: string = fieldElement.parentNode.hotComponent.field_type;
243
+
244
+ if (fieldType === "remove")
245
+ continue;
246
+ }
247
+
248
+ whereFields[key] = value;
249
+ }
250
+
251
+ await Hot.jsonRequest (`${Hot.Data.baseUrl}/v1/data/edit`, {
252
+ schema: this.schema,
253
+ whereFields: whereFields,
254
+ fields: values
255
+ });
256
+ }
257
+
258
+ let attachedList = document.getElementById (this.attached_list);
70
259
  // @ts-ignore
71
- $(`#${this.modalId}`).modal ("hide");
260
+ let table: AdminTable = attachedList.hotComponent;
261
+
262
+ await table.refreshList ();
263
+
264
+ if (this.closeOnSave === true)
265
+ {
266
+ bootstrap.Modal.getInstance (`#${this.modalId}`).hide ();
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Get the list of data from the server.
272
+ */
273
+ onPostPlace (parentHtmlElement: HTMLElement, htmlElement: HTMLElement): HTMLElement
274
+ {
275
+ this.modal = new bootstrap.Modal ($(`#${this.modalId}`)[0], {
276
+ "backdrop": true,
277
+ "keyboard": true,
278
+ "focus": true
279
+ });
280
+
281
+ return (null);
72
282
  }
73
283
 
74
284
  output (): string | HotComponentOutput[]
@@ -102,8 +312,15 @@ export class AdminEdit extends HotComponent
102
312
  documentSelector: "body"
103
313
  },
104
314
  {
105
- html: `<button id = "${this.modalId}-add-btn" type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#${this.modalId}">Add</button>`,
106
- //`<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>`,
315
+ html: `<button id = "${this.modalId}-add-btn" type="button" class="btn btn-sm btn-outline-secondary" onclick = "this.addClicked ();">Add</button>`,
316
+ documentSelector: `hot-place-here[name="buttons"]`
317
+ },
318
+ {
319
+ html: `<button id = "${this.modalId}-edit-btn" type="button" class="btn btn-sm btn-outline-secondary" onclick = "this.editClicked ();">Edit</button>`,
320
+ documentSelector: `hot-place-here[name="buttons"]`
321
+ },
322
+ {
323
+ html: `<button id = "${this.modalId}-edit-btn" type="button" class="btn btn-sm btn-outline-secondary" onclick = "this.removeClicked ();">Remove</button>`,
107
324
  documentSelector: `hot-place-here[name="buttons"]`
108
325
  }]);
109
326
  }
@@ -20,8 +20,8 @@ export class AdminTableField extends HotComponent
20
20
  */
21
21
  onPostPlace (parentHtmlElement: HTMLElement, htmlElement: HTMLElement): HTMLElement
22
22
  {
23
- // @ts-ignore
24
- let hotComponent = parentHtmlElement.parentNode.parentNode.parentNode.hotComponent;
23
+ // @ts-ignore - looool. Add a better way to get the parent HotComponent.
24
+ let hotComponent = parentHtmlElement.parentNode.parentNode.parentNode.parentNode.hotComponent;
25
25
 
26
26
  if (hotComponent != null)
27
27
  hotComponent.addHeaderDataOnly (this, htmlElement);
@@ -32,6 +32,9 @@ export class AdminTableRow extends HotComponent
32
32
  {
33
33
  let rowHtml = "";
34
34
 
35
+ if (this.fields.length > 0)
36
+ rowHtml += `<td><input type = "checkbox" /></td>`;
37
+
35
38
  for (let iIdx = 0; iIdx < this.fields.length; iIdx++)
36
39
  {
37
40
  let fieldObj = this.fields[iIdx];