adminizer 4.1.0-commit.ad1476a → 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 (292) hide show
  1. package/Readme.md +46 -0
  2. package/assets/{VanillaJSONEditor-FUe77pIA.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-DMmad2-f.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-BOltB2Hq.css +1 -0
  20. package/assets/dashboard-es9ZT8qk.js +3 -0
  21. package/assets/{date-picker-B__dVVqj.js → date-picker-Dz-d-YWX.js} +2 -2
  22. package/assets/debounce-qdyXyOeG.js +1 -0
  23. package/assets/del-modal-D0mrZvki.js +11 -0
  24. package/assets/dialog-stack-BiMbfm58.js +1 -0
  25. package/assets/dropdown-menu-BSBcRiXx.js +1 -0
  26. package/assets/{field-renderer-CapylJU9.js → field-renderer-B6hFAeiU.js} +3 -3
  27. package/assets/form-Buslty7y.js +1 -0
  28. package/assets/form-aqiRmPix.js +1 -0
  29. package/assets/{geo-json-CwteYDGB.js → geo-json-BKmYmu3d.js} +2 -2
  30. package/assets/{handsontable-BCnjOpBr.js → handsontable-B8xVeMAQ.js} +5 -5
  31. package/assets/home-Dr72Jk-w.js +2 -0
  32. package/assets/icon-B-a7xg54.js +1 -0
  33. package/assets/index-B68_akQe.js +1 -0
  34. package/assets/index-B7-xTDyy.js +1 -0
  35. package/assets/index-BJFFlCSo.js +1 -0
  36. package/assets/{index-DTRTjOmh.js → index-BOuMo_nl.js} +3 -3
  37. package/assets/index-BzOcGsBq.js +1 -0
  38. package/assets/index-CFbQ2Rv0.js +1 -0
  39. package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
  40. package/assets/{index-BcE9FUM6.js → index-D5UDXTFs.js} +1 -1
  41. package/assets/index-oxIQWAdI.js +41 -0
  42. package/assets/init-user-5H689LP0.js +1 -0
  43. package/assets/input-CSJjrf2i.js +1 -0
  44. package/assets/input-error-CK92Shhm.js +1 -0
  45. package/assets/label-Muj0-Efy.js +1 -0
  46. package/assets/list-Cvh7zbyG.js +1 -0
  47. package/assets/list-table-Bs_vbQiV.js +52 -0
  48. package/assets/login-DliJrjMQ.js +6 -0
  49. package/assets/manifest.json +589 -666
  50. package/assets/material-icon-BRS58Qpk.js +1 -0
  51. package/assets/module-CjG21VCT.js +1 -0
  52. package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-9fDiyfuW.js} +2 -2
  53. package/assets/{multi-select-oabtVhUP.js → multi-select-CMQIJ0JT.js} +2 -2
  54. package/assets/nav-footer-IGMn9NiE.js +1 -0
  55. package/assets/nav-main-DBE4rMiZ.js +1 -0
  56. package/assets/nav-user-CjyLRyq-.js +1 -0
  57. package/assets/pagination-render-DUAq2klc.js +1 -0
  58. package/assets/popover-C_cww-4_.js +1 -0
  59. package/assets/register-UzQn3J0g.js +1 -0
  60. package/assets/{select-D1N8zRPY.js → select-DzBno-dc.js} +2 -2
  61. package/assets/{sidebar-4D-sX2l4.js → sidebar-Dc4iqfu-.js} +2 -2
  62. package/assets/skeleton-Dkmj2o2Z.js +1 -0
  63. package/assets/sonner-De1t71Gj.js +1 -0
  64. package/assets/{toast-editor-FbrFd1ft.js → toast-editor-1Pul3oMs.js} +2 -2
  65. package/assets/tooltip-CwPrC-HD.js +1 -0
  66. package/assets/use-appearance-J8J2w43p.js +1 -0
  67. package/assets/use-window-size-DLSEoR6e.js +1 -0
  68. package/assets/{user-info-DBYoAJYJ.js → user-info-8RyDk7qh.js} +2 -2
  69. package/assets/user-menu-content-CpxTLH56.js +6 -0
  70. package/assets/welcome-BYKI6yO-.js +1 -0
  71. package/controllers/add.js +10 -10
  72. package/controllers/addGroup.js +2 -4
  73. package/controllers/addUser.js +4 -6
  74. package/controllers/catalog/Catalog.d.ts +1 -1
  75. package/controllers/catalog/Catalog.js +42 -37
  76. package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
  77. package/controllers/catalog/FrontentCatalogAdapter.js +71 -73
  78. package/controllers/ckeditorUpload.js +2 -3
  79. package/controllers/dashboard.js +16 -2
  80. package/controllers/edit.js +10 -14
  81. package/controllers/editGroup.js +2 -4
  82. package/controllers/editUser.js +3 -5
  83. package/controllers/form.js +2 -3
  84. package/controllers/getAllWidgets.js +3 -3
  85. package/controllers/initUser.js +1 -2
  86. package/controllers/list.js +6 -6
  87. package/controllers/login.js +43 -18
  88. package/controllers/media-manager/mediaManagerAdapter.js +1 -2
  89. package/controllers/media-manager/mediaManagerApi.js +2 -2
  90. package/controllers/navigation/edit.js +2 -2
  91. package/controllers/register.js +1 -4
  92. package/controllers/remove.js +3 -3
  93. package/controllers/timezones.js +1 -1
  94. package/controllers/view.js +3 -3
  95. package/controllers/welcome.js +1 -1
  96. package/controllers/widgets/Action.js +2 -2
  97. package/controllers/widgets/Custom.js +2 -2
  98. package/controllers/widgets/Info.js +2 -2
  99. package/controllers/widgets/switch.js +2 -2
  100. package/controllers/widgetsDB.js +5 -5
  101. package/helpers/JsUtils.d.ts +1 -0
  102. package/helpers/JsUtils.js +3 -0
  103. package/helpers/accessRightsHelper.d.ts +6 -2
  104. package/helpers/accessRightsHelper.js +28 -5
  105. package/helpers/configHelper.js +2 -1
  106. package/helpers/controllerHelper.js +39 -18
  107. package/helpers/fieldsHelper.d.ts +4 -3
  108. package/helpers/fieldsHelper.js +5 -1
  109. package/helpers/inertiaActionsHelper.js +1 -1
  110. package/helpers/inertiaAddHelper.d.ts +3 -4
  111. package/helpers/inertiaAddHelper.js +27 -7
  112. package/helpers/inertiaFromHelper.js +2 -0
  113. package/helpers/inertiaGroupHelper.d.ts +4 -2
  114. package/helpers/inertiaGroupHelper.js +1 -1
  115. package/helpers/inertiaListHelper.js +5 -5
  116. package/helpers/inertiaMenuHelper.d.ts +1 -1
  117. package/helpers/inertiaMenuHelper.js +2 -2
  118. package/helpers/inertiaUserHelper.d.ts +7 -1
  119. package/helpers/inertiaUserHelper.js +5 -1
  120. package/helpers/menuHelper.d.ts +8 -3
  121. package/helpers/menuHelper.js +26 -17
  122. package/index.d.ts +6 -3
  123. package/index.js +9 -3
  124. package/interfaces/adminpanelConfig.d.ts +41 -32
  125. package/interfaces/global.d.ts +10 -28
  126. package/interfaces/types.d.ts +1 -1
  127. package/lib/Adminizer.d.ts +11 -3
  128. package/lib/Adminizer.js +49 -17
  129. package/lib/media-manager/AbstractMediaManager.d.ts +2 -2
  130. package/lib/media-manager/AbstractMediaManager.js +1 -1
  131. package/lib/media-manager/Items.js +0 -3
  132. package/lib/requestProcessor.js +10 -3
  133. package/lib/v4/DataAccessor.d.ts +5 -2
  134. package/lib/v4/DataAccessor.js +44 -19
  135. package/lib/v4/I18n.js +2 -0
  136. package/lib/v4/POWCaptcha.js +0 -1
  137. package/lib/v4/PolicyManager.js +0 -1
  138. package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +89 -60
  139. package/lib/{catalog → v4/catalog}/AbstractCatalog.js +59 -55
  140. package/lib/v4/catalog/Navigation.d.ts +43 -0
  141. package/lib/v4/catalog/Navigation.js +457 -0
  142. package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
  143. package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
  144. package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  145. package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
  146. package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
  147. package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
  148. package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
  149. package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
  150. package/lib/{datatable → v4/datatable}/NodeTable.js +8 -8
  151. package/lib/v4/helper/jwt.d.ts +10 -0
  152. package/lib/v4/helper/jwt.js +18 -0
  153. package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -1
  154. package/lib/v4/model/AbstractModel.d.ts +5 -1
  155. package/lib/v4/model/AbstractModel.js +2 -3
  156. package/lib/v4/model/ModelHandler.js +1 -4
  157. package/lib/v4/model/adapter/sequelize.d.ts +11 -2
  158. package/lib/v4/model/adapter/sequelize.js +451 -118
  159. package/lib/v4/model/adapter/waterline.js +5 -3
  160. package/lib/{widgets → v4/widgets}/abstractAction.d.ts +1 -1
  161. package/lib/v4/widgets/abstractCustom.d.ts +28 -0
  162. package/lib/v4/widgets/abstractCustom.js +9 -0
  163. package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +1 -1
  164. package/lib/{widgets → v4/widgets}/abstractInfo.js +1 -1
  165. package/lib/{widgets → v4/widgets}/abstractLink.d.ts +2 -1
  166. package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +1 -1
  167. package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +2 -2
  168. package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +29 -5
  169. package/lib/{widgets → v4/widgets}/widgetHandler.js +25 -25
  170. package/models/GroupAP.d.ts +8 -0
  171. package/models/NavigationAP.d.ts +7 -3
  172. package/models/NavigationAP.js +5 -6
  173. package/models/UserAP.d.ts +24 -2
  174. package/models/UserAP.js +2 -2
  175. package/package.json +29 -11
  176. package/policies/checkAuth.js +4 -3
  177. package/policies/setLocale.js +2 -2
  178. package/system/Router.js +14 -17
  179. package/system/bindAccessRights.js +0 -4
  180. package/system/bindAuthorization.js +4 -5
  181. package/system/bindControls.js +6 -6
  182. package/system/bindDev.js +1 -0
  183. package/system/bindInertia.js +17 -12
  184. package/system/bindMediaManager.js +0 -1
  185. package/system/bindModels.js +9 -6
  186. package/system/bindNavigation.d.ts +2 -0
  187. package/system/bindNavigation.js +42 -42
  188. package/system/bindReqFunctions.js +15 -0
  189. package/system/defaults.js +13 -6
  190. package/translations/ar.json +70 -1
  191. package/translations/cn.json +70 -1
  192. package/translations/de.json +71 -3
  193. package/translations/en.json +70 -102
  194. package/translations/es.json +70 -1
  195. package/translations/fr.json +70 -1
  196. package/translations/hi.json +70 -1
  197. package/translations/jp.json +70 -1
  198. package/translations/ko.json +70 -1
  199. package/translations/pt.json +70 -1
  200. package/translations/ru.json +71 -94
  201. package/translations/ua.json +70 -1
  202. package/translations/uz.json +72 -0
  203. package/translations/vi.json +70 -1
  204. package/assets/add-ZITr43GJ.js +0 -1
  205. package/assets/add-form-CYOfr0Ef.js +0 -1
  206. package/assets/add-group-B332wN8K.js +0 -1
  207. package/assets/add-group-form-dzadPSfL.js +0 -1
  208. package/assets/add-user-TC-mYdsB.js +0 -1
  209. package/assets/add-user-form-y2f_1_lM.js +0 -1
  210. package/assets/app-layout-D1m9Kvxq.js +0 -1
  211. package/assets/app-shell-BWMRMkHM.js +0 -1
  212. package/assets/app-sidebar-BCtaEFGb.js +0 -1
  213. package/assets/app-sidebar-header-DLAFi13E.js +0 -11
  214. package/assets/breadcrumbs-CQNon4Vl.js +0 -1
  215. package/assets/button-CQ9t1kLz.js +0 -1
  216. package/assets/checkbox-W0nGAXIj.js +0 -1
  217. package/assets/compiler-runtime-tM4jBQ-T.js +0 -9
  218. package/assets/dashboard-BR602KhL.js +0 -1
  219. package/assets/dropdown-menu-SEBnEIiL.js +0 -1
  220. package/assets/form-DOUNk3o2.js +0 -1
  221. package/assets/form-lOKv4Qbw.js +0 -1
  222. package/assets/home-Ch6QfTIt.js +0 -2
  223. package/assets/icon-Bz9BMaD0.js +0 -1
  224. package/assets/index-BC0yfOHo.js +0 -1
  225. package/assets/index-BbXEMx9n.js +0 -1
  226. package/assets/index-C0SL3SHw.js +0 -41
  227. package/assets/index-Cdb9ACvz.js +0 -1
  228. package/assets/index-DEk3sC8d.js +0 -1
  229. package/assets/index-DrWfGwtf.js +0 -1
  230. package/assets/index-K81GbF6O.js +0 -1
  231. package/assets/init-user-D9mW-g14.js +0 -1
  232. package/assets/input-DF7Ue23C.js +0 -1
  233. package/assets/input-error-BBygona6.js +0 -1
  234. package/assets/label-Z506NKsW.js +0 -1
  235. package/assets/list-Qyd7ecQH.js +0 -1
  236. package/assets/list-table-DB1sEQLF.js +0 -62
  237. package/assets/login-DrGaTWhY.js +0 -6
  238. package/assets/material-icon-CItZiB53.js +0 -1
  239. package/assets/module-DBaykv8l.js +0 -1
  240. package/assets/nav-footer-CM-yHiRs.js +0 -1
  241. package/assets/nav-main-Q3xofGRT.js +0 -1
  242. package/assets/nav-user-Ds8i0Pa2.js +0 -1
  243. package/assets/pagination-render-B57pOpFy.js +0 -1
  244. package/assets/popover-I249Gg2O.js +0 -1
  245. package/assets/register-C9FQIDtS.js +0 -1
  246. package/assets/sonner-Dzckw3U3.js +0 -1
  247. package/assets/tooltip-D2ehgLlB.js +0 -1
  248. package/assets/use-appearance-Co6mO0dV.js +0 -1
  249. package/assets/use-window-size-B8l6Bpkf.js +0 -1
  250. package/assets/user-menu-content-qkvdkUVd.js +0 -6
  251. package/assets/utils-DjqsqOe8.js +0 -1
  252. package/assets/welcome-D2adQ8EU.js +0 -1
  253. package/controllers/processInstallFinalize.d.ts +0 -1
  254. package/controllers/processInstallFinalize.js +0 -16
  255. package/controllers/processInstallStep.d.ts +0 -1
  256. package/controllers/processInstallStep.js +0 -132
  257. package/lib/catalog/Navigation.d.ts +0 -0
  258. package/lib/catalog/Navigation.js +0 -532
  259. package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
  260. package/lib/installStepper/InstallStepAbstract.js +0 -69
  261. package/lib/installStepper/finalizeStep.d.ts +0 -21
  262. package/lib/installStepper/finalizeStep.js +0 -48
  263. package/lib/installStepper/installStepper.d.ts +0 -40
  264. package/lib/installStepper/installStepper.js +0 -195
  265. package/lib/widgets/abstractCustom.d.ts +0 -13
  266. package/lib/widgets/abstractCustom.js +0 -3
  267. package/models/MediaManagerAP.d.ts +0 -46
  268. package/models/MediaManagerAP.js +0 -45
  269. package/models/MediaManagerAssociationsAP.d.ts +0 -28
  270. package/models/MediaManagerAssociationsAP.js +0 -27
  271. package/models/MediaManagerMetaAP.d.ts +0 -22
  272. package/models/MediaManagerMetaAP.js +0 -21
  273. package/system/bindInstallStepper.d.ts +0 -2
  274. package/system/bindInstallStepper.js +0 -23
  275. /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
  276. /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
  277. /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
  278. /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
  279. /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
  280. /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
  281. /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
  282. /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
  283. /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
  284. /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
  285. /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
  286. /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
  287. /package/lib/{inertia → v4/inertia}/flash.js +0 -0
  288. /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
  289. /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
  290. /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
  291. /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
  292. /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
@@ -1,5 +1,4 @@
1
- import { JSONSchema4 } from "json-schema";
2
- import { Adminizer } from "../Adminizer";
1
+ import { Adminizer } from "../../Adminizer";
3
2
  /**
4
3
  * Interface `Item` describes the data that the UI will operate on
5
4
  * This is a common interface for all data that is linked to the catalog
@@ -8,7 +7,10 @@ import { Adminizer } from "../Adminizer";
8
7
  export interface Item {
9
8
  id: string | number;
10
9
  name: string;
11
- parentId: string | number | null;
10
+ parentId: string | number;
11
+ /**
12
+ *
13
+ */
12
14
  childs?: Item[];
13
15
  sortOrder: number;
14
16
  icon: string;
@@ -20,8 +22,6 @@ export type _Item_ = {
20
22
  };
21
23
  /**
22
24
  * General Item structure that will be available for all elements, including groups
23
- *
24
- *
25
25
  */
26
26
  export declare abstract class BaseItem<T extends Item> {
27
27
  abstract readonly type: string;
@@ -30,6 +30,7 @@ export declare abstract class BaseItem<T extends Item> {
30
30
  * I haven't found an easier way to extract this type that goes into generic
31
31
  * If you know how to open PR
32
32
  * */
33
+ abstract adminizer: Adminizer;
33
34
  /**
34
35
  * Catalog name
35
36
  */
@@ -50,46 +51,62 @@ export declare abstract class BaseItem<T extends Item> {
50
51
  * Array of all global contexts, which will appear for all elements
51
52
  */
52
53
  readonly actionHandlers: ActionHandler[];
54
+ /**
55
+ * Adds the context menu processor
56
+ */
53
57
  addActionHandler(contextHandler: ActionHandler): void;
54
58
  /**
55
59
  * Adds the required fields
56
60
  * @param item
57
61
  */
58
62
  _enrich(item: T): void;
59
- _find(itemId: string | number, catalogId: string): Promise<T>;
60
- abstract find(itemId: string | number, catalogId: string): Promise<T>;
63
+ _find(itemId: string | number, catalogId: string, req?: ReqType): Promise<T>;
64
+ abstract find(itemId: string | number, catalogId: string, req?: ReqType): Promise<T>;
61
65
  /**
62
66
  * Is false because default value Group is added
63
67
  */
64
- abstract update(itemId: string | number, data: T, catalogId: string): Promise<T>;
68
+ abstract update(itemId: string | number, data: T, catalogId: string, req?: ReqType): Promise<T>;
65
69
  /**
66
70
  *
67
- * @param itemId
71
+ * @param modelId
68
72
  * @param data
69
73
  * @param catalogId
74
+ * @param req
70
75
  */
71
- abstract updateModelItems(modelId: string | number, data: any, catalogId: string): Promise<T>;
76
+ abstract updateModelItems(modelId: string | number, data: any, catalogId: string, req?: ReqType): Promise<T>;
72
77
  /**
73
- * For custom HTML
74
- * @param itemId
78
+ * Create catalog
75
79
  * @param data
80
+ * @param catalogId
81
+ * @param req
76
82
  */
77
- abstract create(data: T, catalogId: string): Promise<T>;
83
+ abstract create(data: T, catalogId: string, req?: ReqType): Promise<T>;
78
84
  /**
79
85
  * delete element
80
86
  */
81
- abstract deleteItem(itemId: string | number, catalogId: string): Promise<void>;
82
- abstract getAddHTML(req: ReqType): Promise<{
83
- type: 'link' | 'html' | 'jsonForm';
84
- data: string;
87
+ abstract deleteItem(itemId: string | number, catalogId: string, req?: ReqType): Promise<void>;
88
+ /**
89
+ * get add template
90
+ * @param req
91
+ */
92
+ abstract getAddTemplate(req: ReqType): Promise<{
93
+ type: 'component' | 'navigation.group' | 'navigation.link' | 'model';
94
+ data: any;
85
95
  }>;
86
- abstract getEditHTML(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
87
- type: 'link' | 'html' | 'jsonForm';
88
- data: string;
96
+ /**
97
+ * get edit template
98
+ * @param id
99
+ * @param catalogId
100
+ * @param req
101
+ * @param modelId
102
+ */
103
+ abstract getEditTemplate(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
104
+ type: 'component' | 'navigation.group' | 'navigation.link' | 'model';
105
+ data: any;
89
106
  }>;
90
- _getChilds(parentId: string | number | null, catalogId: string): Promise<Item[]>;
91
- abstract getChilds(parentId: string | number | null, catalogId: string): Promise<Item[]>;
92
- abstract search(s: string, catalogId: string): Promise<T[]>;
107
+ _getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
108
+ abstract getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
109
+ abstract search(s: string, catalogId: string, req?: ReqType): Promise<T[]>;
93
110
  }
94
111
  export declare abstract class AbstractGroup<T extends Item> extends BaseItem<T> {
95
112
  readonly type: string;
@@ -104,7 +121,7 @@ export declare abstract class ActionHandler {
104
121
  * Three actions are possible, without configuration, configuration via pop-up, and just external action
105
122
  * For the first two, a handler is provided, but the third type of action simply calls the HTML in the popup; the controller will be implemented externally
106
123
  * */
107
- abstract readonly type: "basic" | "json-forms" | "external" | "link" | "partial";
124
+ abstract readonly type: "basic" | "external" | "link";
108
125
  /**
109
126
  * Will be shown in the context menu section
110
127
  */
@@ -113,16 +130,10 @@ export declare abstract class ActionHandler {
113
130
  * Will be shown in the toolbox section
114
131
  */
115
132
  abstract readonly displayTool: boolean;
116
- /** (!*1)
117
- * Only for json-forms
118
- * ref: https://jsonforms.io/docs
119
- */
120
- abstract readonly uiSchema: any;
121
- abstract readonly jsonSchema: JSONSchema4;
122
133
  /**
123
- * For "json-forms" | "external"
134
+ * For "external"
124
135
  */
125
- abstract getPopUpHTML(data?: any): Promise<string>;
136
+ abstract getPopUpTemplate(req?: ReqType): Promise<string>;
126
137
  /**
127
138
  * Only for link type
128
139
  */
@@ -141,18 +152,19 @@ export declare abstract class ActionHandler {
141
152
  * Implementation of a method that will do something with elements.
142
153
  * there's really not much you can do with the context menu
143
154
  * @param items
144
- * @param config
155
+ * @param data
156
+ * @param req
145
157
  */
146
- abstract handler(items: Item[], data?: any): Promise<void>;
158
+ abstract handler(items: Item[], data?: any, req?: ReqType): Promise<void | string>;
147
159
  }
148
160
  /**
149
161
  *
150
- Abstract
151
- ____ _ _____ _ _ ___ ____
152
- / ___| / \|_ _|/ \ | | / _ \ / ___|
162
+ Abstract
163
+ ____ _ _____ _ _ ___ ____
164
+ / ___| / \|_ _|/ \ | | / _ \ / ___|
153
165
  | | / _ \ | | / _ \ | | | | | | | _
154
166
  | |___ / ___ \| |/ ___ \| |__| |_| | |_| |
155
- \____/_/ \_|_/_/ \_|_____\___/ \____|
167
+ \____/_/ \_|_/_/ \_|_____\___/ \____|
156
168
 
157
169
 
158
170
  */
@@ -190,12 +202,13 @@ export declare abstract class AbstractCatalog {
190
202
  * Method for getting childs elements
191
203
  * if pass null as parentId this root
192
204
  */
193
- getChilds(parentId: string | number | null, byItemType?: string): Promise<Item[]>;
205
+ getChilds(parentId: string | number, byItemType?: string, req?: ReqType): Promise<Item[]>;
194
206
  private _bindAccessRight;
195
207
  protected constructor(adminizer: Adminizer, items: BaseItem<any>[]);
196
208
  setId(id: string): void;
197
209
  /**
198
210
  * Gettind id list method
211
+ * @info This is a dummy method, please make realization in sub class
199
212
  */
200
213
  getIdList(): Promise<string[]>;
201
214
  getItemType(type: string): BaseItem<Item>;
@@ -204,62 +217,78 @@ export declare abstract class AbstractCatalog {
204
217
  /**
205
218
  * Get an element
206
219
  */
207
- find(item: Item): Promise<Item>;
220
+ find(item: Item, req?: ReqType): Promise<Item>;
208
221
  /**
209
222
  * Removing an element
210
223
  */
211
- deleteItem(type: string, id: string | number): void;
224
+ deleteItem(type: string, id: string | number, req?: ReqType): Promise<void>;
212
225
  /**
213
- * Receives HTML to update an element for projection into a popup
226
+ * Get edit template from an item type
227
+ * @param item
228
+ * @param id
229
+ * @param req
230
+ * @param modelId
214
231
  */
215
- getEditHTML(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
216
- type: "link" | "html" | "jsonForm";
217
- data: string;
232
+ getEditTemplate(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
233
+ type: "component" | "navigation.group" | "navigation.link" | "model";
234
+ data: any;
218
235
  }>;
219
236
  /**
220
- * Receives HTML to create an element for projection into a popup
237
+ * Get add template from an item type
238
+ * @param item
239
+ * @param req
221
240
  */
222
- getAddHTML(item: Item, req: ReqType): Promise<{
223
- type: "link" | "html" | "jsonForm";
224
- data: string;
241
+ getAddTemplate(item: Item, req: ReqType): Promise<{
242
+ type: "component" | "navigation.group" | "navigation.link" | "model";
243
+ data: any;
225
244
  }>;
226
245
  addActionHandler(actionHandler: ActionHandler): void;
227
246
  /**
228
247
  * Method for getting group elements
229
248
  * If there are several Items, then the global ones will be obtained
230
249
  */
231
- getActions(items?: Item[]): Promise<ActionHandler[]>;
250
+ getActions(items?: Item[]): ActionHandler[];
232
251
  /**
233
- * Implements search and execution of a specific action.handler
252
+ * Implements search and execution of a specific action handler
234
253
  */
235
- handleAction(actionId: string, items?: Item[], config?: any): Promise<void>;
254
+ handleAction(actionId: string, items?: Item[], data?: any, req?: ReqType): Promise<void | string>;
236
255
  /**
237
256
  * Only For a Link action
238
257
  * @param actionId
239
258
  */
240
259
  getLink(actionId: string): Promise<string>;
241
260
  /**
242
- * For Extermal and JsonForms actions
261
+ * For Extermal and actions
243
262
  * @param actionId
263
+ * @param req
244
264
  */
245
- getPopUpHTML(actionId: string): Promise<string>;
265
+ getPopUpTemplate(actionId: string, req?: ReqType): Promise<string>;
246
266
  /**
247
267
  *
248
268
  * @param data
269
+ * @param req
249
270
  */
250
- createItem<T extends Item>(data: T): Promise<T>;
251
- updateItem<T extends Item>(id: string | number, type: string, data: T): Promise<T>;
271
+ createItem<T extends Item>(data: T, req?: ReqType): Promise<T>;
272
+ updateItem<T extends Item>(id: string | number, type: string, data: T, req?: ReqType): Promise<T>;
252
273
  /**
253
274
  * To update all items in the tree after updating the model
254
- * @param id
275
+ * @param modelId
255
276
  * @param type
256
277
  * @param data
278
+ * @param req
257
279
  */
258
- updateModelItems<T extends Item>(modelId: string | number, type: string, data: T): Promise<T>;
280
+ updateModelItems<T extends Item>(modelId: string | number, type: string, data: T, req?: ReqType): Promise<T>;
259
281
  /**
260
282
  * Method for getting group elements
261
283
  */
262
- getitemTypes(): BaseItem<Item>[];
263
- search<T extends Item>(s: string, hasExtras?: boolean): Promise<T[]>;
284
+ getitemTypes(): {
285
+ type: string;
286
+ name: string;
287
+ isGroup: boolean;
288
+ allowedRoot: boolean;
289
+ icon: string;
290
+ actionHandlers: ActionHandler[];
291
+ }[];
292
+ search<T extends Item>(s: string, hasExtras?: boolean, req?: ReqType): Promise<T[]>;
264
293
  static buildTree(items: Item[]): Item[];
265
294
  }
@@ -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,27 +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
- // console.log(this.actionHandlers)
211
209
  if (!action)
212
210
  throw `Action with id \`${actionId}\` not found`;
213
- return await action.handler(items, config);
211
+ return await action.handler(items, data, req);
214
212
  }
215
213
  /**
216
214
  * Only For a Link action
@@ -220,39 +218,45 @@ export class AbstractCatalog {
220
218
  return this.actionHandlers.find((it) => it.id === actionId)?.getLink();
221
219
  }
222
220
  /**
223
- * For Extermal and JsonForms actions
221
+ * For Extermal and actions
224
222
  * @param actionId
223
+ * @param req
225
224
  */
226
- async getPopUpHTML(actionId) {
227
- 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);
228
227
  }
229
228
  /**
230
229
  *
231
230
  * @param data
231
+ * @param req
232
232
  */
233
- createItem(data) {
234
- 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;
235
236
  }
236
- updateItem(id, type, data) {
237
- 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;
238
240
  }
239
241
  /**
240
242
  * To update all items in the tree after updating the model
241
- * @param id
243
+ * @param modelId
242
244
  * @param type
243
245
  * @param data
246
+ * @param req
244
247
  */
245
- updateModelItems(modelId, type, data) {
246
- 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;
247
251
  }
248
252
  /**
249
253
  * Method for getting group elements
250
254
  */
251
255
  getitemTypes() {
252
- return this.itemTypes;
256
+ return this.itemTypes.map(({ adminizer, ...rest }) => rest);
253
257
  }
254
258
  ;
255
- async search(s, hasExtras = true) {
259
+ async search(s, hasExtras = true, req) {
256
260
  // Build the trees for all found items
257
261
  const accumulator = [];
258
262
  // Find group type
@@ -261,10 +265,10 @@ export class AbstractCatalog {
261
265
  const buildTreeUpwards = async (item, hasExtras) => {
262
266
  // Add extras
263
267
  if (hasExtras) {
264
- const extras = await this.getChilds(item.id);
268
+ const extras = await this.getChilds(item.id, undefined, req);
265
269
  accumulator.push(...extras);
266
270
  }
267
- if (item.parentId === null)
271
+ if (item.parentId === 0)
268
272
  return item;
269
273
  const parentItem = await groupType._find(item.parentId, this.id);
270
274
  if (parentItem) {
@@ -280,7 +284,7 @@ export class AbstractCatalog {
280
284
  foundItems = foundItems.concat(items);
281
285
  }
282
286
  for (const item of foundItems) {
283
- if (item.parentId !== null) {
287
+ if (item.parentId !== 0) { // changed from null to 0
284
288
  await buildTreeUpwards(item, hasExtras);
285
289
  }
286
290
  }
@@ -306,7 +310,7 @@ export class AbstractCatalog {
306
310
  itemMap[item.id] = item;
307
311
  });
308
312
  items.forEach(item => {
309
- if (item.parentId === null) {
313
+ if (item.parentId === 0) { // changed from null to 0
310
314
  tree.push(item);
311
315
  }
312
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 {};