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.
- package/Readme.md +46 -0
- package/assets/{VanillaJSONEditor-D-Lx670g.js → VanillaJSONEditor-DfRefswH.js} +104 -104
- package/assets/add-CJ1-zeA1.js +1 -0
- package/assets/add-form-CbNl0wdS.js +1 -0
- package/assets/add-group-form-Bt_Dx9wm.js +1 -0
- package/assets/add-group-pIFJV5qL.js +1 -0
- package/assets/add-user-D2US8hL_.js +1 -0
- package/assets/add-user-form-Bt8Jy6S2.js +1 -0
- package/assets/{app-WTooYWC3.css → app-B6cCPfWk.css} +1 -1
- package/assets/app-layout-B86jl9bH.js +1 -0
- package/assets/app-shell-CiGyzQ0C.js +1 -0
- package/assets/app-sidebar-Bz-SRwBg.js +1 -0
- package/assets/app-sidebar-header-7CNCx7Rs.js +11 -0
- package/assets/app.js +45 -37
- package/assets/breadcrumbs-_jhtTcOi.js +1 -0
- package/assets/catalog-CON6moaA.js +16 -0
- package/assets/catalog-Cc6Mk9sX.css +1 -0
- package/assets/checkbox-CQdZw5mb.js +1 -0
- package/assets/dashboard-es9ZT8qk.js +3 -0
- package/assets/{date-picker-DI1cCO7K.js → date-picker-Dz-d-YWX.js} +2 -2
- package/assets/debounce-qdyXyOeG.js +1 -0
- package/assets/del-modal-D0mrZvki.js +11 -0
- package/assets/dialog-stack-BiMbfm58.js +1 -0
- package/assets/dropdown-menu-BSBcRiXx.js +1 -0
- package/assets/{field-renderer-DVHZF6HS.js → field-renderer-B6hFAeiU.js} +3 -3
- package/assets/form-Buslty7y.js +1 -0
- package/assets/form-aqiRmPix.js +1 -0
- package/assets/{geo-json-BjiyTtMu.js → geo-json-BKmYmu3d.js} +2 -2
- package/assets/{handsontable-4mjU_b0n.js → handsontable-B8xVeMAQ.js} +5 -5
- package/assets/home-Dr72Jk-w.js +2 -0
- package/assets/icon-B-a7xg54.js +1 -0
- package/assets/index-B68_akQe.js +1 -0
- package/assets/index-B7-xTDyy.js +1 -0
- package/assets/index-BJFFlCSo.js +1 -0
- package/assets/{index-Cw5o84pO.js → index-BOuMo_nl.js} +3 -3
- package/assets/index-BzOcGsBq.js +1 -0
- package/assets/index-CFbQ2Rv0.js +1 -0
- package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
- package/assets/{index-Cgp8OfuI.js → index-D5UDXTFs.js} +1 -1
- package/assets/index-oxIQWAdI.js +41 -0
- package/assets/init-user-5H689LP0.js +1 -0
- package/assets/input-CSJjrf2i.js +1 -0
- package/assets/input-error-CK92Shhm.js +1 -0
- package/assets/label-Muj0-Efy.js +1 -0
- package/assets/list-Cvh7zbyG.js +1 -0
- package/assets/list-table-Bs_vbQiV.js +52 -0
- package/assets/login-DliJrjMQ.js +6 -0
- package/assets/manifest.json +575 -673
- package/assets/material-icon-BRS58Qpk.js +1 -0
- package/assets/module-CjG21VCT.js +1 -0
- package/assets/{monaco-editor-CJs0_GlD.js → monaco-editor-9fDiyfuW.js} +2 -2
- package/assets/{multi-select-BvRpAW8r.js → multi-select-CMQIJ0JT.js} +2 -2
- package/assets/nav-footer-IGMn9NiE.js +1 -0
- package/assets/nav-main-DBE4rMiZ.js +1 -0
- package/assets/nav-user-CjyLRyq-.js +1 -0
- package/assets/pagination-render-DUAq2klc.js +1 -0
- package/assets/popover-C_cww-4_.js +1 -0
- package/assets/register-UzQn3J0g.js +1 -0
- package/assets/{select-BWepUw-9.js → select-DzBno-dc.js} +2 -2
- package/assets/{sidebar-CAHsHdjM.js → sidebar-Dc4iqfu-.js} +2 -2
- package/assets/skeleton-Dkmj2o2Z.js +1 -0
- package/assets/sonner-De1t71Gj.js +1 -0
- package/assets/{toast-editor-CMK7QtF1.js → toast-editor-1Pul3oMs.js} +2 -2
- package/assets/tooltip-CwPrC-HD.js +1 -0
- package/assets/use-appearance-J8J2w43p.js +1 -0
- package/assets/use-window-size-DLSEoR6e.js +1 -0
- package/assets/{user-info-DFrmpJ4y.js → user-info-8RyDk7qh.js} +2 -2
- package/assets/user-menu-content-CpxTLH56.js +6 -0
- package/assets/welcome-BYKI6yO-.js +1 -0
- package/controllers/add.js +8 -8
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +40 -35
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
- package/controllers/catalog/FrontentCatalogAdapter.js +71 -72
- package/controllers/edit.js +8 -11
- package/controllers/list.js +2 -2
- package/controllers/login.js +16 -7
- package/controllers/navigation/edit.js +1 -1
- package/controllers/remove.js +1 -1
- package/controllers/view.js +1 -1
- package/helpers/JsUtils.d.ts +1 -0
- package/helpers/JsUtils.js +3 -0
- package/helpers/accessRightsHelper.d.ts +3 -0
- package/helpers/accessRightsHelper.js +27 -4
- package/helpers/controllerHelper.js +39 -18
- package/helpers/fieldsHelper.d.ts +3 -2
- package/helpers/fieldsHelper.js +5 -1
- package/helpers/inertiaAddHelper.d.ts +4 -5
- package/helpers/inertiaAddHelper.js +25 -7
- package/helpers/inertiaFromHelper.js +1 -1
- package/helpers/inertiaMenuHelper.d.ts +1 -1
- package/helpers/inertiaMenuHelper.js +1 -1
- package/helpers/menuHelper.d.ts +8 -3
- package/helpers/menuHelper.js +26 -17
- package/index.d.ts +2 -6
- package/index.js +5 -6
- package/interfaces/adminpanelConfig.d.ts +35 -30
- package/interfaces/global.d.ts +5 -2
- package/interfaces/types.d.ts +1 -1
- package/lib/Adminizer.d.ts +9 -3
- package/lib/Adminizer.js +32 -16
- package/lib/media-manager/Items.js +0 -3
- package/lib/requestProcessor.js +10 -3
- package/lib/v4/DataAccessor.d.ts +3 -1
- package/lib/v4/DataAccessor.js +43 -18
- package/lib/v4/I18n.js +2 -0
- package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +89 -60
- package/lib/{catalog → v4/catalog}/AbstractCatalog.js +59 -54
- package/lib/v4/catalog/Navigation.d.ts +43 -0
- package/lib/v4/catalog/Navigation.js +457 -0
- package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
- package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
- package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
- package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
- package/lib/{datatable → v4/datatable}/NodeTable.js +8 -5
- package/lib/v4/model/AbstractModel.d.ts +5 -1
- package/lib/v4/model/AbstractModel.js +2 -1
- package/lib/v4/model/ModelHandler.js +1 -3
- package/lib/v4/model/adapter/sequelize.d.ts +8 -0
- package/lib/v4/model/adapter/sequelize.js +274 -133
- package/lib/v4/model/adapter/waterline.js +5 -2
- package/lib/{widgets → v4/widgets}/abstractLink.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +11 -4
- package/lib/{widgets → v4/widgets}/widgetHandler.js +1 -1
- package/models/NavigationAP.d.ts +2 -3
- package/models/NavigationAP.js +5 -6
- package/models/UserAP.d.ts +2 -3
- package/package.json +17 -6
- package/system/Router.js +8 -11
- package/system/bindAccessRights.js +0 -4
- package/system/bindControls.js +6 -6
- package/system/bindDev.js +1 -0
- package/system/bindInertia.js +9 -4
- package/system/bindMediaManager.js +0 -1
- package/system/bindModels.js +9 -6
- package/system/bindNavigation.d.ts +2 -0
- package/system/bindNavigation.js +42 -42
- package/system/bindReqFunctions.js +0 -1
- package/system/defaults.js +13 -6
- package/translations/ar.json +70 -1
- package/translations/cn.json +70 -1
- package/translations/de.json +71 -3
- package/translations/en.json +70 -102
- package/translations/es.json +70 -1
- package/translations/fr.json +70 -1
- package/translations/hi.json +70 -1
- package/translations/jp.json +70 -1
- package/translations/ko.json +70 -1
- package/translations/pt.json +70 -1
- package/translations/ru.json +71 -103
- package/translations/ua.json +70 -1
- package/translations/uz.json +72 -0
- package/translations/vi.json +70 -1
- package/assets/add-BP_u3Tjl.js +0 -1
- package/assets/add-form-nffmiYTh.js +0 -1
- package/assets/add-group-D4vcHlm-.js +0 -1
- package/assets/add-group-form-gNJW11-q.js +0 -1
- package/assets/add-user-DWh3Nas0.js +0 -1
- package/assets/add-user-form-BJ0FsZYJ.js +0 -1
- package/assets/app-layout-DYsRFUuP.js +0 -1
- package/assets/app-shell-Dd9Eknik.js +0 -1
- package/assets/app-sidebar-BOmu6-Sl.js +0 -1
- package/assets/app-sidebar-header-CoXSzWxk.js +0 -11
- package/assets/breadcrumbs-BmAq4fHT.js +0 -1
- package/assets/button-C9B_5Jf_.js +0 -1
- package/assets/checkbox-Fg27sL_1.js +0 -1
- package/assets/compiler-runtime-hB6dAw2d.js +0 -9
- package/assets/dashboard-BACj996r.js +0 -3
- package/assets/dropdown-menu-Bhj17ENm.js +0 -1
- package/assets/form-BgWdwvz1.js +0 -1
- package/assets/form-DgtErfln.js +0 -1
- package/assets/home-CHntBHJa.js +0 -2
- package/assets/icon-Dt0vBgDO.js +0 -1
- package/assets/index-B8BS9wMC.js +0 -1
- package/assets/index-BC0yfOHo.js +0 -1
- package/assets/index-BKCgnGj_.js +0 -1
- package/assets/index-BbXEMx9n.js +0 -1
- package/assets/index-BykbU6Ee.js +0 -41
- package/assets/index-CaJgc5EZ.js +0 -1
- package/assets/index-DrWfGwtf.js +0 -1
- package/assets/init-user-JfCKJ5Ce.js +0 -1
- package/assets/input-CvRbIbk4.js +0 -1
- package/assets/input-error-DMK7cAt7.js +0 -1
- package/assets/label-CSLFe9Bz.js +0 -1
- package/assets/list-B2Oa5O_Q.js +0 -1
- package/assets/list-table-DA9MhywL.js +0 -62
- package/assets/login-DQwGtdis.js +0 -6
- package/assets/material-icon-BJg8o_fs.js +0 -1
- package/assets/module-DWXp59Vg.js +0 -1
- package/assets/nav-footer-Bs4dmN1d.js +0 -1
- package/assets/nav-main-Bq3IMk4C.js +0 -1
- package/assets/nav-user-CbB22J5O.js +0 -1
- package/assets/pagination-render-DuXDDbC_.js +0 -1
- package/assets/popover-DtoGI2b1.js +0 -1
- package/assets/register-BSogVF0h.js +0 -1
- package/assets/skeleton-COOcAA8f.js +0 -1
- package/assets/sonner-BI0IFOQN.js +0 -1
- package/assets/tooltip-DHwpLKOI.js +0 -1
- package/assets/use-appearance-DRfIqTgw.js +0 -1
- package/assets/use-window-size-h0Sh_NvX.js +0 -1
- package/assets/user-menu-content-DPXQdERj.js +0 -6
- package/assets/utils-DjqsqOe8.js +0 -1
- package/assets/welcome-B4WCIXKf.js +0 -1
- package/controllers/processInstallFinalize.d.ts +0 -1
- package/controllers/processInstallFinalize.js +0 -16
- package/controllers/processInstallStep.d.ts +0 -0
- package/controllers/processInstallStep.js +0 -122
- package/lib/catalog/Navigation.d.ts +0 -0
- package/lib/catalog/Navigation.js +0 -532
- package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
- package/lib/installStepper/InstallStepAbstract.js +0 -69
- package/lib/installStepper/finalizeStep.d.ts +0 -21
- package/lib/installStepper/finalizeStep.js +0 -48
- package/lib/installStepper/installStepper.d.ts +0 -40
- package/lib/installStepper/installStepper.js +0 -195
- package/models/MediaManagerAP.d.ts +0 -62
- package/models/MediaManagerAP.js +0 -45
- package/models/MediaManagerAssociationsAP.d.ts +0 -38
- package/models/MediaManagerAssociationsAP.js +0 -27
- package/models/MediaManagerMetaAP.d.ts +0 -30
- package/models/MediaManagerMetaAP.js +0 -21
- package/system/bindInstallStepper.d.ts +0 -2
- package/system/bindInstallStepper.js +0 -23
- /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
- /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
- /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
- /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
- /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
- /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
- /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
- /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
- /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
- /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
- /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
- /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
- /package/lib/{inertia → v4/inertia}/flash.js +0 -0
- /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
- /package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractAction.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractCustom.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractCustom.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractInfo.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
- /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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
153
|
+
* Get edit template from an item type
|
|
154
|
+
* @param item
|
|
155
|
+
* @param id
|
|
156
|
+
* @param req
|
|
157
|
+
* @param modelId
|
|
158
158
|
*/
|
|
159
|
-
|
|
160
|
-
return this.getItemType(item.type)?.
|
|
159
|
+
getEditTemplate(item, id, req, modelId) {
|
|
160
|
+
return this.getItemType(item.type)?.getEditTemplate(id, this.id, req, modelId);
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
* Get add template from an item type
|
|
164
|
+
* @param item
|
|
165
|
+
* @param req
|
|
164
166
|
*/
|
|
165
|
-
|
|
166
|
-
return this.getItemType(item.type)?.
|
|
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
|
-
|
|
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
|
|
195
|
+
* Implements search and execution of a specific action handler
|
|
194
196
|
*/
|
|
195
|
-
async handleAction(actionId, items,
|
|
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
|
|
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
|
-
|
|
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,
|
|
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
|
|
221
|
+
* For Extermal and actions
|
|
223
222
|
* @param actionId
|
|
223
|
+
* @param req
|
|
224
224
|
*/
|
|
225
|
-
async
|
|
226
|
-
return this.actionHandlers.find((it) => it.id === actionId)?.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
243
|
+
* @param modelId
|
|
241
244
|
* @param type
|
|
242
245
|
* @param data
|
|
246
|
+
* @param req
|
|
243
247
|
*/
|
|
244
|
-
updateModelItems(modelId, type, data) {
|
|
245
|
-
|
|
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 ===
|
|
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 !==
|
|
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 ===
|
|
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 {};
|