adminizer 4.1.0-build.4 → 4.1.0-build.40
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 +12 -2
- package/assets/{VanillaJSONEditor-FUe77pIA.js → VanillaJSONEditor-DTWads1Y.js} +104 -104
- package/assets/add-BOMae0jC.js +1 -0
- package/assets/add-form-DAMJbss4.js +1 -0
- package/assets/add-group-BHyaFPsj.js +1 -0
- package/assets/add-group-form-CQN_syZq.js +1 -0
- package/assets/add-user-DjT6o3z9.js +1 -0
- package/assets/add-user-form-C7T14FsG.js +1 -0
- package/assets/{app-DMmad2-f.css → app-BrkasjFX.css} +1 -1
- package/assets/app-layout-BC2Dk0GE.js +1 -0
- package/assets/{app-shell-BWMRMkHM.js → app-shell-jCQ5EbpR.js} +1 -1
- package/assets/{app-sidebar-header-DLAFi13E.js → app-sidebar-header-BcGzUtnn.js} +1 -1
- package/assets/app-sidebar-wFqi5-7E.js +1 -0
- package/assets/app.js +9 -9
- package/assets/{breadcrumbs-CQNon4Vl.js → breadcrumbs-CDxSbsTe.js} +1 -1
- package/assets/button-BV-GbIpN.js +1 -0
- package/assets/catalog-Cc6Mk9sX.css +1 -0
- package/assets/catalog-DGH9s-S8.js +16 -0
- package/assets/{checkbox-W0nGAXIj.js → checkbox-DrkQu16U.js} +1 -1
- package/assets/{compiler-runtime-tM4jBQ-T.js → compiler-runtime-Cj7rbuyn.js} +2 -2
- package/assets/dashboard-BOltB2Hq.css +1 -0
- package/assets/dashboard-DFn55U5H.js +3 -0
- package/assets/{date-picker-B__dVVqj.js → date-picker-hoDPF9Am.js} +1 -1
- package/assets/debounce-qdyXyOeG.js +1 -0
- package/assets/del-modal-BUVjhY0k.js +6 -0
- package/assets/dialog-stack-V6c1TlnC.js +1 -0
- package/assets/dropdown-menu-CeMIoM8d.js +1 -0
- package/assets/{field-renderer-CapylJU9.js → field-renderer-zGC76llY.js} +3 -3
- package/assets/form-B9sI77wk.js +1 -0
- package/assets/form-DkRGBp5e.js +1 -0
- package/assets/{geo-json-CwteYDGB.js → geo-json-VtXcqPd9.js} +1 -1
- package/assets/{handsontable-BCnjOpBr.js → handsontable-DrEU6lOi.js} +1 -1
- package/assets/home-BmydIqzz.js +2 -0
- package/assets/{icon-Bz9BMaD0.js → icon-CqJOMij7.js} +1 -1
- package/assets/index-BCpOvf4m.js +1 -0
- package/assets/{index-BbXEMx9n.js → index-B__NksD2.js} +1 -1
- package/assets/{index-DTRTjOmh.js → index-C0o7vG6r.js} +3 -3
- package/assets/{index-C0SL3SHw.js → index-CcxvoJO6.js} +1 -1
- package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
- package/assets/{index-K81GbF6O.js → index-DN1K56yz.js} +1 -1
- package/assets/{index-DrWfGwtf.js → index-DU8vYhyh.js} +1 -1
- package/assets/{index-BcE9FUM6.js → index-DoVAC0HX.js} +1 -1
- package/assets/{index-BC0yfOHo.js → index-lqMxC6QB.js} +1 -1
- package/assets/{index-DEk3sC8d.js → index-oMAR28Sy.js} +1 -1
- package/assets/{init-user-D9mW-g14.js → init-user-GyTJdhrh.js} +1 -1
- package/assets/{input-DF7Ue23C.js → input-B7wUhbil.js} +1 -1
- package/assets/{input-error-BBygona6.js → input-error-DFk1EyT_.js} +1 -1
- package/assets/{label-Z506NKsW.js → label-GEoZpZr4.js} +1 -1
- package/assets/list-Dy_nWfcN.js +1 -0
- package/assets/list-table-DqU7Spnz.js +57 -0
- package/assets/login-BWs195kG.js +6 -0
- package/assets/manifest.json +726 -604
- package/assets/{material-icon-CItZiB53.js → material-icon-BAd3Wrgn.js} +1 -1
- package/assets/module-UO5sAKpW.js +1 -0
- package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-B5kndNv5.js} +1 -1
- package/assets/{multi-select-oabtVhUP.js → multi-select-CSxVlxon.js} +2 -2
- package/assets/{nav-footer-CM-yHiRs.js → nav-footer-_TcxXo9x.js} +1 -1
- package/assets/nav-main-DPeRWb5e.js +1 -0
- package/assets/{nav-user-Ds8i0Pa2.js → nav-user-G2BeH6Uu.js} +1 -1
- package/assets/{pagination-render-B57pOpFy.js → pagination-render-B12W01AJ.js} +1 -1
- package/assets/{popover-I249Gg2O.js → popover-B3ZOyoLQ.js} +1 -1
- package/assets/{register-C9FQIDtS.js → register-CcA8kQ56.js} +1 -1
- package/assets/{select-D1N8zRPY.js → select-MzwxLt1D.js} +2 -2
- package/assets/{sidebar-4D-sX2l4.js → sidebar-CkxHTDia.js} +2 -2
- package/assets/skeleton-C3gmNc1Z.js +1 -0
- package/assets/sonner-Dp8PyHu_.js +1 -0
- package/assets/{toast-editor-FbrFd1ft.js → toast-editor-DRP2u8-X.js} +1 -1
- package/assets/{tooltip-D2ehgLlB.js → tooltip-Du62rBCn.js} +1 -1
- package/assets/{use-appearance-Co6mO0dV.js → use-appearance-DeUiDZ72.js} +1 -1
- package/assets/{use-window-size-B8l6Bpkf.js → use-window-size-ChEjEujj.js} +1 -1
- package/assets/{user-info-DBYoAJYJ.js → user-info-C_11jYGE.js} +1 -1
- package/assets/{user-menu-content-qkvdkUVd.js → user-menu-content-BNRzhEo_.js} +2 -2
- package/assets/welcome-Dh8vAafD.js +1 -0
- package/controllers/add.js +10 -10
- package/controllers/addGroup.js +2 -4
- package/controllers/addUser.js +4 -6
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +41 -36
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
- package/controllers/catalog/FrontentCatalogAdapter.js +68 -70
- package/controllers/ckeditorUpload.js +2 -3
- package/controllers/dashboard.js +16 -2
- package/controllers/edit.js +10 -14
- package/controllers/editGroup.js +2 -4
- package/controllers/editUser.js +3 -5
- package/controllers/form.js +2 -3
- package/controllers/getAllWidgets.js +3 -3
- package/controllers/initUser.js +1 -2
- package/controllers/list.js +6 -6
- package/controllers/login.js +43 -18
- package/controllers/media-manager/mediaManagerAdapter.js +1 -2
- package/controllers/media-manager/mediaManagerApi.js +2 -2
- package/controllers/navigation/edit.js +2 -2
- package/controllers/register.js +1 -4
- package/controllers/remove.js +3 -3
- package/controllers/timezones.js +1 -1
- package/controllers/view.js +3 -3
- package/controllers/welcome.js +1 -1
- package/controllers/widgets/Action.js +2 -2
- package/controllers/widgets/Custom.js +2 -2
- package/controllers/widgets/Info.js +2 -2
- package/controllers/widgets/switch.js +2 -2
- package/controllers/widgetsDB.js +5 -5
- package/helpers/JsUtils.d.ts +1 -0
- package/helpers/JsUtils.js +3 -0
- package/helpers/accessRightsHelper.d.ts +6 -2
- package/helpers/accessRightsHelper.js +28 -5
- package/helpers/configHelper.js +2 -1
- package/helpers/controllerHelper.js +39 -18
- package/helpers/fieldsHelper.d.ts +4 -3
- package/helpers/fieldsHelper.js +5 -1
- package/helpers/inertiaActionsHelper.js +1 -1
- package/helpers/inertiaAddHelper.d.ts +3 -4
- package/helpers/inertiaAddHelper.js +27 -7
- package/helpers/inertiaFromHelper.js +2 -0
- package/helpers/inertiaGroupHelper.d.ts +4 -2
- package/helpers/inertiaGroupHelper.js +1 -1
- package/helpers/inertiaListHelper.js +5 -5
- package/helpers/inertiaMenuHelper.d.ts +1 -1
- package/helpers/inertiaMenuHelper.js +2 -2
- package/helpers/inertiaUserHelper.d.ts +7 -1
- package/helpers/inertiaUserHelper.js +5 -1
- package/helpers/menuHelper.d.ts +8 -3
- package/helpers/menuHelper.js +26 -17
- package/index.d.ts +5 -3
- package/index.js +8 -3
- package/interfaces/adminpanelConfig.d.ts +41 -32
- package/interfaces/global.d.ts +10 -28
- package/interfaces/types.d.ts +1 -1
- package/lib/Adminizer.d.ts +10 -3
- package/lib/Adminizer.js +35 -18
- package/lib/media-manager/AbstractMediaManager.d.ts +2 -2
- package/lib/media-manager/AbstractMediaManager.js +1 -1
- package/lib/media-manager/Items.js +0 -3
- package/lib/requestProcessor.js +10 -3
- package/lib/v4/DataAccessor.d.ts +5 -2
- package/lib/v4/DataAccessor.js +44 -19
- package/lib/v4/I18n.js +2 -0
- package/lib/v4/POWCaptcha.js +0 -1
- package/lib/v4/PolicyManager.js +0 -1
- package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +81 -54
- package/lib/{catalog → v4/catalog}/AbstractCatalog.js +50 -44
- 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 -8
- package/lib/v4/helper/jwt.d.ts +10 -0
- package/lib/v4/helper/jwt.js +18 -0
- package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -1
- package/lib/v4/model/AbstractModel.d.ts +5 -1
- package/lib/v4/model/AbstractModel.js +2 -3
- package/lib/v4/model/ModelHandler.js +1 -4
- package/lib/v4/model/adapter/sequelize.d.ts +11 -2
- package/lib/v4/model/adapter/sequelize.js +451 -118
- package/lib/v4/model/adapter/waterline.js +5 -2
- package/lib/{widgets → v4/widgets}/abstractAction.d.ts +1 -1
- package/lib/v4/widgets/abstractCustom.d.ts +28 -0
- package/lib/v4/widgets/abstractCustom.js +9 -0
- package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/abstractInfo.js +1 -1
- package/lib/{widgets → v4/widgets}/abstractLink.d.ts +2 -1
- package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +2 -2
- package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +29 -5
- package/lib/{widgets → v4/widgets}/widgetHandler.js +25 -25
- package/models/GroupAP.d.ts +8 -0
- package/models/NavigationAP.d.ts +7 -3
- package/models/NavigationAP.js +5 -6
- package/models/UserAP.d.ts +24 -2
- package/models/UserAP.js +2 -2
- package/package.json +28 -11
- package/policies/checkAuth.js +4 -3
- package/policies/setLocale.js +2 -2
- package/system/Router.js +14 -17
- package/system/bindAccessRights.js +0 -4
- package/system/bindAuthorization.js +4 -5
- package/system/bindControls.js +6 -6
- package/system/bindDev.js +1 -0
- package/system/bindInertia.js +17 -12
- 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 +15 -0
- 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 -94
- package/translations/ua.json +70 -1
- package/translations/uz.json +72 -0
- package/translations/vi.json +70 -1
- package/assets/add-ZITr43GJ.js +0 -1
- package/assets/add-form-CYOfr0Ef.js +0 -1
- package/assets/add-group-B332wN8K.js +0 -1
- package/assets/add-group-form-dzadPSfL.js +0 -1
- package/assets/add-user-TC-mYdsB.js +0 -1
- package/assets/add-user-form-y2f_1_lM.js +0 -1
- package/assets/app-layout-D1m9Kvxq.js +0 -1
- package/assets/app-sidebar-BCtaEFGb.js +0 -1
- package/assets/button-CQ9t1kLz.js +0 -1
- package/assets/dashboard-BR602KhL.js +0 -1
- package/assets/dropdown-menu-SEBnEIiL.js +0 -1
- package/assets/form-DOUNk3o2.js +0 -1
- package/assets/form-lOKv4Qbw.js +0 -1
- package/assets/home-Ch6QfTIt.js +0 -2
- package/assets/index-Cdb9ACvz.js +0 -1
- package/assets/list-Qyd7ecQH.js +0 -1
- package/assets/list-table-DB1sEQLF.js +0 -62
- package/assets/login-DrGaTWhY.js +0 -6
- package/assets/module-DBaykv8l.js +0 -1
- package/assets/nav-main-Q3xofGRT.js +0 -1
- package/assets/sonner-Dzckw3U3.js +0 -1
- package/assets/welcome-D2adQ8EU.js +0 -1
- package/controllers/processInstallFinalize.d.ts +0 -1
- package/controllers/processInstallFinalize.js +0 -16
- package/controllers/processInstallStep.d.ts +0 -1
- package/controllers/processInstallStep.js +0 -132
- 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/lib/widgets/abstractCustom.d.ts +0 -13
- package/lib/widgets/abstractCustom.js +0 -3
- package/models/MediaManagerAP.d.ts +0 -46
- package/models/MediaManagerAP.js +0 -45
- package/models/MediaManagerAssociationsAP.d.ts +0 -28
- package/models/MediaManagerAssociationsAP.js +0 -27
- package/models/MediaManagerMetaAP.d.ts +0 -22
- 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/{widgets → v4/widgets}/abstractAction.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
|
91
|
-
abstract getChilds(parentId: string | number
|
|
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" | "
|
|
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 "
|
|
134
|
+
* For "external"
|
|
124
135
|
*/
|
|
125
|
-
abstract
|
|
136
|
+
abstract getPopUpTemplate(data?: any): Promise<string>;
|
|
126
137
|
/**
|
|
127
138
|
* Only for link type
|
|
128
139
|
*/
|
|
@@ -141,9 +152,9 @@ 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
|
|
155
|
+
* @param req
|
|
145
156
|
*/
|
|
146
|
-
abstract handler(items: Item[],
|
|
157
|
+
abstract handler(items: Item[], req?: ReqType): Promise<void>;
|
|
147
158
|
}
|
|
148
159
|
/**
|
|
149
160
|
*
|
|
@@ -190,12 +201,13 @@ export declare abstract class AbstractCatalog {
|
|
|
190
201
|
* Method for getting childs elements
|
|
191
202
|
* if pass null as parentId this root
|
|
192
203
|
*/
|
|
193
|
-
getChilds(parentId: string | number
|
|
204
|
+
getChilds(parentId: string | number, byItemType?: string, req?: ReqType): Promise<Item[]>;
|
|
194
205
|
private _bindAccessRight;
|
|
195
206
|
protected constructor(adminizer: Adminizer, items: BaseItem<any>[]);
|
|
196
207
|
setId(id: string): void;
|
|
197
208
|
/**
|
|
198
209
|
* Gettind id list method
|
|
210
|
+
* @info This is a dummy method, please make realization in sub class
|
|
199
211
|
*/
|
|
200
212
|
getIdList(): Promise<string[]>;
|
|
201
213
|
getItemType(type: string): BaseItem<Item>;
|
|
@@ -204,24 +216,30 @@ export declare abstract class AbstractCatalog {
|
|
|
204
216
|
/**
|
|
205
217
|
* Get an element
|
|
206
218
|
*/
|
|
207
|
-
find(item: Item): Promise<Item>;
|
|
219
|
+
find(item: Item, req?: ReqType): Promise<Item>;
|
|
208
220
|
/**
|
|
209
221
|
* Removing an element
|
|
210
222
|
*/
|
|
211
|
-
deleteItem(type: string, id: string | number): void
|
|
223
|
+
deleteItem(type: string, id: string | number, req?: ReqType): Promise<void>;
|
|
212
224
|
/**
|
|
213
|
-
*
|
|
225
|
+
* Get edit template from an item type
|
|
226
|
+
* @param item
|
|
227
|
+
* @param id
|
|
228
|
+
* @param req
|
|
229
|
+
* @param modelId
|
|
214
230
|
*/
|
|
215
|
-
|
|
216
|
-
type: "
|
|
217
|
-
data:
|
|
231
|
+
getEditTemplate(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
|
|
232
|
+
type: "component" | "navigation.group" | "navigation.link" | "model";
|
|
233
|
+
data: any;
|
|
218
234
|
}>;
|
|
219
235
|
/**
|
|
220
|
-
*
|
|
236
|
+
* Get add template from an item type
|
|
237
|
+
* @param item
|
|
238
|
+
* @param req
|
|
221
239
|
*/
|
|
222
|
-
|
|
223
|
-
type: "
|
|
224
|
-
data:
|
|
240
|
+
getAddTemplate(item: Item, req: ReqType): Promise<{
|
|
241
|
+
type: "component" | "navigation.group" | "navigation.link" | "model";
|
|
242
|
+
data: any;
|
|
225
243
|
}>;
|
|
226
244
|
addActionHandler(actionHandler: ActionHandler): void;
|
|
227
245
|
/**
|
|
@@ -232,34 +250,43 @@ export declare abstract class AbstractCatalog {
|
|
|
232
250
|
/**
|
|
233
251
|
* Implements search and execution of a specific action.handler
|
|
234
252
|
*/
|
|
235
|
-
handleAction(actionId: string, items?: Item[],
|
|
253
|
+
handleAction(actionId: string, items?: Item[], req?: ReqType): Promise<void>;
|
|
236
254
|
/**
|
|
237
255
|
* Only For a Link action
|
|
238
256
|
* @param actionId
|
|
239
257
|
*/
|
|
240
258
|
getLink(actionId: string): Promise<string>;
|
|
241
259
|
/**
|
|
242
|
-
* For Extermal and
|
|
260
|
+
* For Extermal and actions
|
|
243
261
|
* @param actionId
|
|
244
262
|
*/
|
|
245
|
-
|
|
263
|
+
getPopUpTemplate(actionId: string): Promise<string>;
|
|
246
264
|
/**
|
|
247
265
|
*
|
|
248
266
|
* @param data
|
|
267
|
+
* @param req
|
|
249
268
|
*/
|
|
250
|
-
createItem<T extends Item>(data: T): Promise<T>;
|
|
251
|
-
updateItem<T extends Item>(id: string | number, type: string, data: T): Promise<T>;
|
|
269
|
+
createItem<T extends Item>(data: T, req?: ReqType): Promise<T>;
|
|
270
|
+
updateItem<T extends Item>(id: string | number, type: string, data: T, req?: ReqType): Promise<T>;
|
|
252
271
|
/**
|
|
253
272
|
* To update all items in the tree after updating the model
|
|
254
|
-
* @param
|
|
273
|
+
* @param modelId
|
|
255
274
|
* @param type
|
|
256
275
|
* @param data
|
|
276
|
+
* @param req
|
|
257
277
|
*/
|
|
258
|
-
updateModelItems<T extends Item>(modelId: string | number, type: string, data: T): Promise<T>;
|
|
278
|
+
updateModelItems<T extends Item>(modelId: string | number, type: string, data: T, req?: ReqType): Promise<T>;
|
|
259
279
|
/**
|
|
260
280
|
* Method for getting group elements
|
|
261
281
|
*/
|
|
262
|
-
getitemTypes():
|
|
263
|
-
|
|
282
|
+
getitemTypes(): {
|
|
283
|
+
type: string;
|
|
284
|
+
name: string;
|
|
285
|
+
isGroup: boolean;
|
|
286
|
+
allowedRoot: boolean;
|
|
287
|
+
icon: string;
|
|
288
|
+
actionHandlers: ActionHandler[];
|
|
289
|
+
}[];
|
|
290
|
+
search<T extends Item>(s: string, hasExtras?: boolean, req?: ReqType): Promise<T[]>;
|
|
264
291
|
static buildTree(items: Item[]): Item[];
|
|
265
292
|
}
|
|
@@ -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";
|
|
@@ -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) {
|
|
@@ -192,7 +194,7 @@ export class AbstractCatalog {
|
|
|
192
194
|
/**
|
|
193
195
|
* Implements search and execution of a specific action.handler
|
|
194
196
|
*/
|
|
195
|
-
async handleAction(actionId, items,
|
|
197
|
+
async handleAction(actionId, items, req) {
|
|
196
198
|
let action = null;
|
|
197
199
|
if (items.length === 1) {
|
|
198
200
|
const item = items[0];
|
|
@@ -207,10 +209,9 @@ export class AbstractCatalog {
|
|
|
207
209
|
else {
|
|
208
210
|
action = this.actionHandlers.find((it) => it.id === actionId);
|
|
209
211
|
}
|
|
210
|
-
// console.log(this.actionHandlers)
|
|
211
212
|
if (!action)
|
|
212
213
|
throw `Action with id \`${actionId}\` not found`;
|
|
213
|
-
return await action.handler(items,
|
|
214
|
+
return await action.handler(items, req);
|
|
214
215
|
}
|
|
215
216
|
/**
|
|
216
217
|
* Only For a Link action
|
|
@@ -220,39 +221,44 @@ export class AbstractCatalog {
|
|
|
220
221
|
return this.actionHandlers.find((it) => it.id === actionId)?.getLink();
|
|
221
222
|
}
|
|
222
223
|
/**
|
|
223
|
-
* For Extermal and
|
|
224
|
+
* For Extermal and actions
|
|
224
225
|
* @param actionId
|
|
225
226
|
*/
|
|
226
|
-
async
|
|
227
|
-
return this.actionHandlers.find((it) => it.id === actionId)?.
|
|
227
|
+
async getPopUpTemplate(actionId) {
|
|
228
|
+
return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpTemplate();
|
|
228
229
|
}
|
|
229
230
|
/**
|
|
230
231
|
*
|
|
231
232
|
* @param data
|
|
233
|
+
* @param req
|
|
232
234
|
*/
|
|
233
|
-
createItem(data) {
|
|
234
|
-
|
|
235
|
+
async createItem(data, req) {
|
|
236
|
+
const promise = this.getItemType(data.type)?.create(data, this.id, req);
|
|
237
|
+
return await promise;
|
|
235
238
|
}
|
|
236
|
-
updateItem(id, type, data) {
|
|
237
|
-
|
|
239
|
+
async updateItem(id, type, data, req) {
|
|
240
|
+
const promise = this.getItemType(type)?.update(id, data, this.id, req);
|
|
241
|
+
return await promise;
|
|
238
242
|
}
|
|
239
243
|
/**
|
|
240
244
|
* To update all items in the tree after updating the model
|
|
241
|
-
* @param
|
|
245
|
+
* @param modelId
|
|
242
246
|
* @param type
|
|
243
247
|
* @param data
|
|
248
|
+
* @param req
|
|
244
249
|
*/
|
|
245
|
-
updateModelItems(modelId, type, data) {
|
|
246
|
-
|
|
250
|
+
async updateModelItems(modelId, type, data, req) {
|
|
251
|
+
const promise = this.getItemType(type)?.updateModelItems(modelId, data, this.id, req);
|
|
252
|
+
return await promise;
|
|
247
253
|
}
|
|
248
254
|
/**
|
|
249
255
|
* Method for getting group elements
|
|
250
256
|
*/
|
|
251
257
|
getitemTypes() {
|
|
252
|
-
return this.itemTypes;
|
|
258
|
+
return this.itemTypes.map(({ adminizer, ...rest }) => rest);
|
|
253
259
|
}
|
|
254
260
|
;
|
|
255
|
-
async search(s, hasExtras = true) {
|
|
261
|
+
async search(s, hasExtras = true, req) {
|
|
256
262
|
// Build the trees for all found items
|
|
257
263
|
const accumulator = [];
|
|
258
264
|
// Find group type
|
|
@@ -261,10 +267,10 @@ export class AbstractCatalog {
|
|
|
261
267
|
const buildTreeUpwards = async (item, hasExtras) => {
|
|
262
268
|
// Add extras
|
|
263
269
|
if (hasExtras) {
|
|
264
|
-
const extras = await this.getChilds(item.id);
|
|
270
|
+
const extras = await this.getChilds(item.id, undefined, req);
|
|
265
271
|
accumulator.push(...extras);
|
|
266
272
|
}
|
|
267
|
-
if (item.parentId ===
|
|
273
|
+
if (item.parentId === 0)
|
|
268
274
|
return item;
|
|
269
275
|
const parentItem = await groupType._find(item.parentId, this.id);
|
|
270
276
|
if (parentItem) {
|
|
@@ -280,7 +286,7 @@ export class AbstractCatalog {
|
|
|
280
286
|
foundItems = foundItems.concat(items);
|
|
281
287
|
}
|
|
282
288
|
for (const item of foundItems) {
|
|
283
|
-
if (item.parentId !==
|
|
289
|
+
if (item.parentId !== 0) { // changed from null to 0
|
|
284
290
|
await buildTreeUpwards(item, hasExtras);
|
|
285
291
|
}
|
|
286
292
|
}
|
|
@@ -306,7 +312,7 @@ export class AbstractCatalog {
|
|
|
306
312
|
itemMap[item.id] = item;
|
|
307
313
|
});
|
|
308
314
|
items.forEach(item => {
|
|
309
|
-
if (item.parentId ===
|
|
315
|
+
if (item.parentId === 0) { // changed from null to 0
|
|
310
316
|
tree.push(item);
|
|
311
317
|
}
|
|
312
318
|
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 {};
|