adminizer 4.1.0-commit.d8a06d3 → 4.1.1

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 (253) hide show
  1. package/Readme.md +46 -0
  2. package/assets/{VanillaJSONEditor-D-Lx670g.js → VanillaJSONEditor-DfRefswH.js} +104 -104
  3. package/assets/add-CJ1-zeA1.js +1 -0
  4. package/assets/add-form-CbNl0wdS.js +1 -0
  5. package/assets/add-group-form-Bt_Dx9wm.js +1 -0
  6. package/assets/add-group-pIFJV5qL.js +1 -0
  7. package/assets/add-user-D2US8hL_.js +1 -0
  8. package/assets/add-user-form-Bt8Jy6S2.js +1 -0
  9. package/assets/{app-WTooYWC3.css → app-B6cCPfWk.css} +1 -1
  10. package/assets/app-layout-B86jl9bH.js +1 -0
  11. package/assets/app-shell-CiGyzQ0C.js +1 -0
  12. package/assets/app-sidebar-Bz-SRwBg.js +1 -0
  13. package/assets/app-sidebar-header-7CNCx7Rs.js +11 -0
  14. package/assets/app.js +45 -37
  15. package/assets/breadcrumbs-_jhtTcOi.js +1 -0
  16. package/assets/catalog-CON6moaA.js +16 -0
  17. package/assets/catalog-Cc6Mk9sX.css +1 -0
  18. package/assets/checkbox-CQdZw5mb.js +1 -0
  19. package/assets/dashboard-es9ZT8qk.js +3 -0
  20. package/assets/{date-picker-DI1cCO7K.js → date-picker-Dz-d-YWX.js} +2 -2
  21. package/assets/debounce-qdyXyOeG.js +1 -0
  22. package/assets/del-modal-D0mrZvki.js +11 -0
  23. package/assets/dialog-stack-BiMbfm58.js +1 -0
  24. package/assets/dropdown-menu-BSBcRiXx.js +1 -0
  25. package/assets/{field-renderer-DVHZF6HS.js → field-renderer-B6hFAeiU.js} +3 -3
  26. package/assets/form-Buslty7y.js +1 -0
  27. package/assets/form-aqiRmPix.js +1 -0
  28. package/assets/{geo-json-BjiyTtMu.js → geo-json-BKmYmu3d.js} +2 -2
  29. package/assets/{handsontable-4mjU_b0n.js → handsontable-B8xVeMAQ.js} +5 -5
  30. package/assets/home-Dr72Jk-w.js +2 -0
  31. package/assets/icon-B-a7xg54.js +1 -0
  32. package/assets/index-B68_akQe.js +1 -0
  33. package/assets/index-B7-xTDyy.js +1 -0
  34. package/assets/index-BJFFlCSo.js +1 -0
  35. package/assets/{index-Cw5o84pO.js → index-BOuMo_nl.js} +3 -3
  36. package/assets/index-BzOcGsBq.js +1 -0
  37. package/assets/index-CFbQ2Rv0.js +1 -0
  38. package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
  39. package/assets/{index-Cgp8OfuI.js → index-D5UDXTFs.js} +1 -1
  40. package/assets/index-oxIQWAdI.js +41 -0
  41. package/assets/init-user-5H689LP0.js +1 -0
  42. package/assets/input-CSJjrf2i.js +1 -0
  43. package/assets/input-error-CK92Shhm.js +1 -0
  44. package/assets/label-Muj0-Efy.js +1 -0
  45. package/assets/list-Cvh7zbyG.js +1 -0
  46. package/assets/list-table-Bs_vbQiV.js +52 -0
  47. package/assets/login-DliJrjMQ.js +6 -0
  48. package/assets/manifest.json +575 -673
  49. package/assets/material-icon-BRS58Qpk.js +1 -0
  50. package/assets/module-CjG21VCT.js +1 -0
  51. package/assets/{monaco-editor-CJs0_GlD.js → monaco-editor-9fDiyfuW.js} +2 -2
  52. package/assets/{multi-select-BvRpAW8r.js → multi-select-CMQIJ0JT.js} +2 -2
  53. package/assets/nav-footer-IGMn9NiE.js +1 -0
  54. package/assets/nav-main-DBE4rMiZ.js +1 -0
  55. package/assets/nav-user-CjyLRyq-.js +1 -0
  56. package/assets/pagination-render-DUAq2klc.js +1 -0
  57. package/assets/popover-C_cww-4_.js +1 -0
  58. package/assets/register-UzQn3J0g.js +1 -0
  59. package/assets/{select-BWepUw-9.js → select-DzBno-dc.js} +2 -2
  60. package/assets/{sidebar-CAHsHdjM.js → sidebar-Dc4iqfu-.js} +2 -2
  61. package/assets/skeleton-Dkmj2o2Z.js +1 -0
  62. package/assets/sonner-De1t71Gj.js +1 -0
  63. package/assets/{toast-editor-CMK7QtF1.js → toast-editor-1Pul3oMs.js} +2 -2
  64. package/assets/tooltip-CwPrC-HD.js +1 -0
  65. package/assets/use-appearance-J8J2w43p.js +1 -0
  66. package/assets/use-window-size-DLSEoR6e.js +1 -0
  67. package/assets/{user-info-DFrmpJ4y.js → user-info-8RyDk7qh.js} +2 -2
  68. package/assets/user-menu-content-CpxTLH56.js +6 -0
  69. package/assets/welcome-BYKI6yO-.js +1 -0
  70. package/controllers/add.js +8 -8
  71. package/controllers/catalog/Catalog.d.ts +1 -1
  72. package/controllers/catalog/Catalog.js +40 -35
  73. package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
  74. package/controllers/catalog/FrontentCatalogAdapter.js +71 -72
  75. package/controllers/edit.js +8 -11
  76. package/controllers/list.js +2 -2
  77. package/controllers/login.js +16 -7
  78. package/controllers/navigation/edit.js +1 -1
  79. package/controllers/remove.js +1 -1
  80. package/controllers/view.js +1 -1
  81. package/helpers/JsUtils.d.ts +1 -0
  82. package/helpers/JsUtils.js +3 -0
  83. package/helpers/accessRightsHelper.d.ts +3 -0
  84. package/helpers/accessRightsHelper.js +27 -4
  85. package/helpers/controllerHelper.js +39 -18
  86. package/helpers/fieldsHelper.d.ts +3 -2
  87. package/helpers/fieldsHelper.js +5 -1
  88. package/helpers/inertiaAddHelper.d.ts +4 -5
  89. package/helpers/inertiaAddHelper.js +25 -7
  90. package/helpers/inertiaFromHelper.js +1 -1
  91. package/helpers/inertiaMenuHelper.d.ts +1 -1
  92. package/helpers/inertiaMenuHelper.js +1 -1
  93. package/helpers/menuHelper.d.ts +8 -3
  94. package/helpers/menuHelper.js +26 -17
  95. package/index.d.ts +2 -6
  96. package/index.js +5 -6
  97. package/interfaces/adminpanelConfig.d.ts +35 -30
  98. package/interfaces/global.d.ts +5 -2
  99. package/interfaces/types.d.ts +1 -1
  100. package/lib/Adminizer.d.ts +9 -3
  101. package/lib/Adminizer.js +32 -16
  102. package/lib/media-manager/Items.js +0 -3
  103. package/lib/requestProcessor.js +10 -3
  104. package/lib/v4/DataAccessor.d.ts +3 -1
  105. package/lib/v4/DataAccessor.js +43 -18
  106. package/lib/v4/I18n.js +2 -0
  107. package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +89 -60
  108. package/lib/{catalog → v4/catalog}/AbstractCatalog.js +59 -54
  109. package/lib/v4/catalog/Navigation.d.ts +43 -0
  110. package/lib/v4/catalog/Navigation.js +457 -0
  111. package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
  112. package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
  113. package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  114. package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
  115. package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
  116. package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
  117. package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
  118. package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
  119. package/lib/{datatable → v4/datatable}/NodeTable.js +8 -5
  120. package/lib/v4/model/AbstractModel.d.ts +5 -1
  121. package/lib/v4/model/AbstractModel.js +2 -1
  122. package/lib/v4/model/ModelHandler.js +1 -3
  123. package/lib/v4/model/adapter/sequelize.d.ts +8 -0
  124. package/lib/v4/model/adapter/sequelize.js +274 -133
  125. package/lib/v4/model/adapter/waterline.js +5 -2
  126. package/lib/{widgets → v4/widgets}/abstractLink.d.ts +1 -1
  127. package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +1 -1
  128. package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +11 -4
  129. package/lib/{widgets → v4/widgets}/widgetHandler.js +1 -1
  130. package/models/NavigationAP.d.ts +2 -3
  131. package/models/NavigationAP.js +5 -6
  132. package/models/UserAP.d.ts +2 -3
  133. package/package.json +17 -6
  134. package/system/Router.js +8 -11
  135. package/system/bindAccessRights.js +0 -4
  136. package/system/bindControls.js +6 -6
  137. package/system/bindDev.js +1 -0
  138. package/system/bindInertia.js +9 -4
  139. package/system/bindMediaManager.js +0 -1
  140. package/system/bindModels.js +9 -6
  141. package/system/bindNavigation.d.ts +2 -0
  142. package/system/bindNavigation.js +42 -42
  143. package/system/bindReqFunctions.js +0 -1
  144. package/system/defaults.js +13 -6
  145. package/translations/ar.json +70 -1
  146. package/translations/cn.json +70 -1
  147. package/translations/de.json +71 -3
  148. package/translations/en.json +70 -102
  149. package/translations/es.json +70 -1
  150. package/translations/fr.json +70 -1
  151. package/translations/hi.json +70 -1
  152. package/translations/jp.json +70 -1
  153. package/translations/ko.json +70 -1
  154. package/translations/pt.json +70 -1
  155. package/translations/ru.json +71 -103
  156. package/translations/ua.json +70 -1
  157. package/translations/uz.json +72 -0
  158. package/translations/vi.json +70 -1
  159. package/assets/add-BP_u3Tjl.js +0 -1
  160. package/assets/add-form-nffmiYTh.js +0 -1
  161. package/assets/add-group-D4vcHlm-.js +0 -1
  162. package/assets/add-group-form-gNJW11-q.js +0 -1
  163. package/assets/add-user-DWh3Nas0.js +0 -1
  164. package/assets/add-user-form-BJ0FsZYJ.js +0 -1
  165. package/assets/app-layout-DYsRFUuP.js +0 -1
  166. package/assets/app-shell-Dd9Eknik.js +0 -1
  167. package/assets/app-sidebar-BOmu6-Sl.js +0 -1
  168. package/assets/app-sidebar-header-CoXSzWxk.js +0 -11
  169. package/assets/breadcrumbs-BmAq4fHT.js +0 -1
  170. package/assets/button-C9B_5Jf_.js +0 -1
  171. package/assets/checkbox-Fg27sL_1.js +0 -1
  172. package/assets/compiler-runtime-hB6dAw2d.js +0 -9
  173. package/assets/dashboard-BACj996r.js +0 -3
  174. package/assets/dropdown-menu-Bhj17ENm.js +0 -1
  175. package/assets/form-BgWdwvz1.js +0 -1
  176. package/assets/form-DgtErfln.js +0 -1
  177. package/assets/home-CHntBHJa.js +0 -2
  178. package/assets/icon-Dt0vBgDO.js +0 -1
  179. package/assets/index-B8BS9wMC.js +0 -1
  180. package/assets/index-BC0yfOHo.js +0 -1
  181. package/assets/index-BKCgnGj_.js +0 -1
  182. package/assets/index-BbXEMx9n.js +0 -1
  183. package/assets/index-BykbU6Ee.js +0 -41
  184. package/assets/index-CaJgc5EZ.js +0 -1
  185. package/assets/index-DrWfGwtf.js +0 -1
  186. package/assets/init-user-JfCKJ5Ce.js +0 -1
  187. package/assets/input-CvRbIbk4.js +0 -1
  188. package/assets/input-error-DMK7cAt7.js +0 -1
  189. package/assets/label-CSLFe9Bz.js +0 -1
  190. package/assets/list-B2Oa5O_Q.js +0 -1
  191. package/assets/list-table-DA9MhywL.js +0 -62
  192. package/assets/login-DQwGtdis.js +0 -6
  193. package/assets/material-icon-BJg8o_fs.js +0 -1
  194. package/assets/module-DWXp59Vg.js +0 -1
  195. package/assets/nav-footer-Bs4dmN1d.js +0 -1
  196. package/assets/nav-main-Bq3IMk4C.js +0 -1
  197. package/assets/nav-user-CbB22J5O.js +0 -1
  198. package/assets/pagination-render-DuXDDbC_.js +0 -1
  199. package/assets/popover-DtoGI2b1.js +0 -1
  200. package/assets/register-BSogVF0h.js +0 -1
  201. package/assets/skeleton-COOcAA8f.js +0 -1
  202. package/assets/sonner-BI0IFOQN.js +0 -1
  203. package/assets/tooltip-DHwpLKOI.js +0 -1
  204. package/assets/use-appearance-DRfIqTgw.js +0 -1
  205. package/assets/use-window-size-h0Sh_NvX.js +0 -1
  206. package/assets/user-menu-content-DPXQdERj.js +0 -6
  207. package/assets/utils-DjqsqOe8.js +0 -1
  208. package/assets/welcome-B4WCIXKf.js +0 -1
  209. package/controllers/processInstallFinalize.d.ts +0 -1
  210. package/controllers/processInstallFinalize.js +0 -16
  211. package/controllers/processInstallStep.d.ts +0 -0
  212. package/controllers/processInstallStep.js +0 -122
  213. package/lib/catalog/Navigation.d.ts +0 -0
  214. package/lib/catalog/Navigation.js +0 -532
  215. package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
  216. package/lib/installStepper/InstallStepAbstract.js +0 -69
  217. package/lib/installStepper/finalizeStep.d.ts +0 -21
  218. package/lib/installStepper/finalizeStep.js +0 -48
  219. package/lib/installStepper/installStepper.d.ts +0 -40
  220. package/lib/installStepper/installStepper.js +0 -195
  221. package/models/MediaManagerAP.d.ts +0 -62
  222. package/models/MediaManagerAP.js +0 -45
  223. package/models/MediaManagerAssociationsAP.d.ts +0 -38
  224. package/models/MediaManagerAssociationsAP.js +0 -27
  225. package/models/MediaManagerMetaAP.d.ts +0 -30
  226. package/models/MediaManagerMetaAP.js +0 -21
  227. package/system/bindInstallStepper.d.ts +0 -2
  228. package/system/bindInstallStepper.js +0 -23
  229. /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
  230. /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
  231. /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
  232. /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
  233. /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
  234. /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
  235. /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
  236. /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
  237. /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
  238. /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
  239. /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
  240. /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
  241. /package/lib/{inertia → v4/inertia}/flash.js +0 -0
  242. /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
  243. /package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -0
  244. /package/lib/{widgets → v4/widgets}/abstractAction.d.ts +0 -0
  245. /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
  246. /package/lib/{widgets → v4/widgets}/abstractCustom.d.ts +0 -0
  247. /package/lib/{widgets → v4/widgets}/abstractCustom.js +0 -0
  248. /package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +0 -0
  249. /package/lib/{widgets → v4/widgets}/abstractInfo.js +0 -0
  250. /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
  251. /package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +0 -0
  252. /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
  253. /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * General Item structure that will be available for all elements, including groups
3
- *
4
- *
5
3
  */
6
4
  export class BaseItem {
7
5
  /**
8
6
  * Array of all global contexts, which will appear for all elements
9
7
  */
10
8
  actionHandlers;
9
+ /**
10
+ * Adds the context menu processor
11
+ */
11
12
  addActionHandler(contextHandler) {
12
13
  this.actionHandlers.push(contextHandler);
13
14
  }
@@ -19,13 +20,13 @@ export class BaseItem {
19
20
  item.icon = this.icon;
20
21
  item.type = this.type;
21
22
  }
22
- async _find(itemId, catalogId) {
23
- let item = await this.find(itemId, catalogId);
23
+ async _find(itemId, catalogId, req) {
24
+ let item = await this.find(itemId, catalogId, req);
24
25
  this._enrich(item);
25
26
  return item;
26
27
  }
27
- async _getChilds(parentId, catalogId) {
28
- let items = await this.getChilds(parentId, catalogId);
28
+ async _getChilds(parentId, catalogId, req) {
29
+ let items = await this.getChilds(parentId, catalogId, req);
29
30
  items.forEach((item) => {
30
31
  this._enrich(item);
31
32
  });
@@ -33,7 +34,6 @@ export class BaseItem {
33
34
  }
34
35
  }
35
36
  export class AbstractGroup extends BaseItem {
36
- // public abstract create(itemId: string, data: T): Promise<T>;
37
37
  type = "group";
38
38
  isGroup = true;
39
39
  icon = "folder";
@@ -50,12 +50,12 @@ export class ActionHandler {
50
50
  }
51
51
  /**
52
52
  *
53
- Abstract
54
- ____ _ _____ _ _ ___ ____
55
- / ___| / \|_ _|/ \ | | / _ \ / ___|
53
+ Abstract
54
+ ____ _ _____ _ _ ___ ____
55
+ / ___| / \|_ _|/ \ | | / _ \ / ___|
56
56
  | | / _ \ | | / _ \ | | | | | | | _
57
57
  | |___ / ___ \| |/ ___ \| |__| |_| | |_| |
58
- \____/_/ \_|_/_/ \_|_____\___/ \____|
58
+ \____/_/ \_|_/_/ \_|_____\___/ \____|
59
59
 
60
60
 
61
61
  */
@@ -81,15 +81,15 @@ export class AbstractCatalog {
81
81
  * Method for getting childs elements
82
82
  * if pass null as parentId this root
83
83
  */
84
- async getChilds(parentId, byItemType) {
84
+ async getChilds(parentId, byItemType, req) {
85
85
  if (byItemType) {
86
- const items = await this.getItemType(byItemType)?._getChilds(parentId, this.id);
86
+ const items = await this.getItemType(byItemType)?._getChilds(parentId, this.id, req);
87
87
  return items ? items.sort((a, b) => a.sortOrder - b.sortOrder) : [];
88
88
  }
89
89
  else {
90
90
  let result = [];
91
91
  for (const itemType of this.itemTypes) {
92
- const items = await itemType?._getChilds(parentId, this.id);
92
+ const items = await itemType?._getChilds(parentId, this.id, req);
93
93
  if (items) {
94
94
  result = result.concat(items);
95
95
  }
@@ -119,6 +119,7 @@ export class AbstractCatalog {
119
119
  }
120
120
  /**
121
121
  * Gettind id list method
122
+ * @info This is a dummy method, please make realization in sub class
122
123
  */
123
124
  async getIdList() {
124
125
  return [];
@@ -139,31 +140,32 @@ export class AbstractCatalog {
139
140
  /**
140
141
  * Get an element
141
142
  */
142
- find(item) {
143
- return this.getItemType(item.type)?._find(item.id, this.id);
143
+ async find(item, req) {
144
+ return await this.getItemType(item.type)?._find(item.id, this.id, req);
144
145
  }
145
146
  /**
146
147
  * Removing an element
147
148
  */
148
- deleteItem(type, id) {
149
- try {
150
- this.getItemType(type)?.deleteItem(id, this.id);
151
- }
152
- catch (e) {
153
- throw e;
154
- }
149
+ async deleteItem(type, id, req) {
150
+ await this.getItemType(type)?.deleteItem(id, this.id, req);
155
151
  }
156
152
  /**
157
- * Receives HTML to update an element for projection into a popup
153
+ * Get edit template from an item type
154
+ * @param item
155
+ * @param id
156
+ * @param req
157
+ * @param modelId
158
158
  */
159
- getEditHTML(item, id, req, modelId) {
160
- return this.getItemType(item.type)?.getEditHTML(id, this.id, req, modelId);
159
+ getEditTemplate(item, id, req, modelId) {
160
+ return this.getItemType(item.type)?.getEditTemplate(id, this.id, req, modelId);
161
161
  }
162
162
  /**
163
- * Receives HTML to create an element for projection into a popup
163
+ * Get add template from an item type
164
+ * @param item
165
+ * @param req
164
166
  */
165
- getAddHTML(item, req) {
166
- return this.getItemType(item.type)?.getAddHTML(req);
167
+ getAddTemplate(item, req) {
168
+ return this.getItemType(item.type)?.getAddTemplate(req);
167
169
  }
168
170
  addActionHandler(actionHandler) {
169
171
  if (actionHandler.selectedItemTypes.length > 0) {
@@ -179,7 +181,7 @@ export class AbstractCatalog {
179
181
  * Method for getting group elements
180
182
  * If there are several Items, then the global ones will be obtained
181
183
  */
182
- async getActions(items) {
184
+ getActions(items) {
183
185
  if (items.length === 1) {
184
186
  const item = items[0];
185
187
  const itemType = this.itemTypes.find((it) => it.type === item.type);
@@ -190,26 +192,23 @@ export class AbstractCatalog {
190
192
  }
191
193
  }
192
194
  /**
193
- * Implements search and execution of a specific action.handler
195
+ * Implements search and execution of a specific action handler
194
196
  */
195
- async handleAction(actionId, items, config) {
197
+ async handleAction(actionId, items, data, req) {
196
198
  let action = null;
197
199
  if (items.length === 1) {
198
200
  const item = items[0];
199
201
  const itemType = this.itemTypes.find((it) => it.type === item.type);
200
- if (itemType.actionHandlers?.length) {
202
+ if (itemType && itemType.actionHandlers && itemType.actionHandlers.length) {
201
203
  action = itemType.actionHandlers.find((it) => it.id === actionId);
202
204
  }
203
- else {
204
- action = this.actionHandlers.find((it) => it.id === actionId);
205
- }
206
205
  }
207
- else {
206
+ if (!action) {
208
207
  action = this.actionHandlers.find((it) => it.id === actionId);
209
208
  }
210
209
  if (!action)
211
210
  throw `Action with id \`${actionId}\` not found`;
212
- return await action.handler(items, config);
211
+ return await action.handler(items, data, req);
213
212
  }
214
213
  /**
215
214
  * Only For a Link action
@@ -219,39 +218,45 @@ export class AbstractCatalog {
219
218
  return this.actionHandlers.find((it) => it.id === actionId)?.getLink();
220
219
  }
221
220
  /**
222
- * For Extermal and JsonForms actions
221
+ * For Extermal and actions
223
222
  * @param actionId
223
+ * @param req
224
224
  */
225
- async getPopUpHTML(actionId) {
226
- return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpHTML();
225
+ async getPopUpTemplate(actionId, req) {
226
+ return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpTemplate(req);
227
227
  }
228
228
  /**
229
229
  *
230
230
  * @param data
231
+ * @param req
231
232
  */
232
- createItem(data) {
233
- return this.getItemType(data.type)?.create(data, this.id);
233
+ async createItem(data, req) {
234
+ const promise = this.getItemType(data.type)?.create(data, this.id, req);
235
+ return await promise;
234
236
  }
235
- updateItem(id, type, data) {
236
- return this.getItemType(type)?.update(id, data, this.id);
237
+ async updateItem(id, type, data, req) {
238
+ const promise = this.getItemType(type)?.update(id, data, this.id, req);
239
+ return await promise;
237
240
  }
238
241
  /**
239
242
  * To update all items in the tree after updating the model
240
- * @param id
243
+ * @param modelId
241
244
  * @param type
242
245
  * @param data
246
+ * @param req
243
247
  */
244
- updateModelItems(modelId, type, data) {
245
- return this.getItemType(type)?.updateModelItems(modelId, data, this.id);
248
+ async updateModelItems(modelId, type, data, req) {
249
+ const promise = this.getItemType(type)?.updateModelItems(modelId, data, this.id, req);
250
+ return await promise;
246
251
  }
247
252
  /**
248
253
  * Method for getting group elements
249
254
  */
250
255
  getitemTypes() {
251
- return this.itemTypes;
256
+ return this.itemTypes.map(({ adminizer, ...rest }) => rest);
252
257
  }
253
258
  ;
254
- async search(s, hasExtras = true) {
259
+ async search(s, hasExtras = true, req) {
255
260
  // Build the trees for all found items
256
261
  const accumulator = [];
257
262
  // Find group type
@@ -260,10 +265,10 @@ export class AbstractCatalog {
260
265
  const buildTreeUpwards = async (item, hasExtras) => {
261
266
  // Add extras
262
267
  if (hasExtras) {
263
- const extras = await this.getChilds(item.id);
268
+ const extras = await this.getChilds(item.id, undefined, req);
264
269
  accumulator.push(...extras);
265
270
  }
266
- if (item.parentId === null)
271
+ if (item.parentId === 0)
267
272
  return item;
268
273
  const parentItem = await groupType._find(item.parentId, this.id);
269
274
  if (parentItem) {
@@ -279,7 +284,7 @@ export class AbstractCatalog {
279
284
  foundItems = foundItems.concat(items);
280
285
  }
281
286
  for (const item of foundItems) {
282
- if (item.parentId !== null) {
287
+ if (item.parentId !== 0) { // changed from null to 0
283
288
  await buildTreeUpwards(item, hasExtras);
284
289
  }
285
290
  }
@@ -305,7 +310,7 @@ export class AbstractCatalog {
305
310
  itemMap[item.id] = item;
306
311
  });
307
312
  items.forEach(item => {
308
- if (item.parentId === null) {
313
+ if (item.parentId === 0) { // changed from null to 0
309
314
  tree.push(item);
310
315
  }
311
316
  else {
@@ -0,0 +1,43 @@
1
+ import { AbstractCatalog, ActionHandler, Item } from "./AbstractCatalog";
2
+ import { NavigationConfig } from "../../../interfaces/adminpanelConfig";
3
+ import { Adminizer } from "../../Adminizer";
4
+ export interface NavItem extends Item {
5
+ urlPath?: string;
6
+ modelId?: string | number;
7
+ targetBlank?: boolean;
8
+ }
9
+ declare class StorageService {
10
+ protected storageMap: Map<string | number, NavItem>;
11
+ protected id: string;
12
+ protected model: string;
13
+ protected readonly adminizer: Adminizer;
14
+ constructor(adminizer: Adminizer, id: string, model: string);
15
+ protected initModel(): Promise<void>;
16
+ getId(): string;
17
+ buildTree(): Promise<any>;
18
+ populateFromTree(tree: any[]): Promise<void>;
19
+ setElement(id: string | number, item: NavItem, init?: boolean): Promise<NavItem>;
20
+ removeElementById(id: string | number): Promise<void>;
21
+ findElementById(id: string | number): Promise<NavItem | undefined>;
22
+ findElementByModelId(modelId: string | number): Promise<NavItem[] | undefined>;
23
+ saveToDB(): Promise<void>;
24
+ findElementsByParentId(parentId: string | number, type: string | null): Promise<NavItem[]>;
25
+ getAllElements(): Promise<NavItem[]>;
26
+ search(s: string, type: string): Promise<NavItem[]>;
27
+ }
28
+ export declare class StorageServices {
29
+ protected static storages: StorageService[];
30
+ static add(storage: StorageService): void;
31
+ static get(id: string): StorageService;
32
+ static getAll(): StorageService[];
33
+ }
34
+ export declare class Navigation extends AbstractCatalog {
35
+ readonly name: string;
36
+ readonly slug: string;
37
+ readonly icon: string;
38
+ readonly actionHandlers: ActionHandler[];
39
+ idList: string[];
40
+ constructor(adminizer: Adminizer, config: NavigationConfig);
41
+ getIdList(): Promise<string[]>;
42
+ }
43
+ export {};