adminizer 4.1.0-build.3 → 4.1.0-build.30
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 +11 -1
- package/assets/{VanillaJSONEditor-FUe77pIA.js → VanillaJSONEditor-DKF_Ft1S.js} +96 -96
- package/assets/add-BA0ZgbVP.js +1 -0
- package/assets/add-form-D5PNdz6X.js +1 -0
- package/assets/add-group-BqvmQRDY.js +1 -0
- package/assets/{add-group-form-dzadPSfL.js → add-group-form-D1P6v9Fm.js} +1 -1
- package/assets/add-user-C31g3pXW.js +1 -0
- package/assets/add-user-form-DyczuE4l.js +1 -0
- package/assets/{app-DMmad2-f.css → app-ClS67l37.css} +1 -1
- package/assets/app-layout-CQTlWDgg.js +1 -0
- package/assets/{app-shell-BWMRMkHM.js → app-shell-B4pzTbiN.js} +1 -1
- package/assets/app-sidebar-DX9Shcd3.js +1 -0
- package/assets/{app-sidebar-header-DLAFi13E.js → app-sidebar-header-BcZ0JSSJ.js} +1 -1
- package/assets/app.js +9 -9
- package/assets/{breadcrumbs-CQNon4Vl.js → breadcrumbs-DIhfOCvh.js} +1 -1
- package/assets/{button-CQ9t1kLz.js → button-DleSKY4-.js} +1 -1
- package/assets/catalog-BHbLV-zr.js +12 -0
- package/assets/catalog-CZUI8zho.css +1 -0
- package/assets/{checkbox-W0nGAXIj.js → checkbox-DgmLwxEt.js} +1 -1
- package/assets/{compiler-runtime-tM4jBQ-T.js → compiler-runtime-CMDe02AS.js} +1 -1
- package/assets/dashboard-BOltB2Hq.css +1 -0
- package/assets/dashboard-BiycZ-vC.js +3 -0
- package/assets/{date-picker-B__dVVqj.js → date-picker-Cb6A4Zx_.js} +1 -1
- package/assets/dialog-stack-DU4Ow4Oa.js +1 -0
- package/assets/{dropdown-menu-SEBnEIiL.js → dropdown-menu-D3vlxbLx.js} +1 -1
- package/assets/{field-renderer-CapylJU9.js → field-renderer-CW8TLtlI.js} +3 -3
- package/assets/form-CLP53RtV.js +1 -0
- package/assets/form-CwSId-Cu.js +1 -0
- package/assets/{geo-json-CwteYDGB.js → geo-json-BNgLxoVs.js} +1 -1
- package/assets/group-add-Brshb-tH.js +1 -0
- package/assets/{handsontable-BCnjOpBr.js → handsontable-BI4C0OBe.js} +1 -1
- package/assets/home-BRJ6eKVn.js +2 -0
- package/assets/{icon-Bz9BMaD0.js → icon-DLHMhF_-.js} +1 -1
- package/assets/{index-BcE9FUM6.js → index-BRQOFOzQ.js} +1 -1
- package/assets/{index-C0SL3SHw.js → index-BZZx7KCI.js} +1 -1
- package/assets/{index-DTRTjOmh.js → index-BpVWRzP4.js} +2 -2
- package/assets/{index-BbXEMx9n.js → index-Bz0y23v2.js} +1 -1
- package/assets/index-C148XJoK.js +1 -0
- package/assets/index-C8anOJBB.js +1 -0
- package/assets/{index-DEk3sC8d.js → index-CS5ssiKu.js} +1 -1
- package/assets/index-CsMwA9pu.js +1 -0
- package/assets/{index-DrWfGwtf.js → index-HZzILD42.js} +1 -1
- package/assets/{index-BC0yfOHo.js → index-kzaPFHKt.js} +1 -1
- package/assets/{init-user-D9mW-g14.js → init-user-VMPNdivw.js} +1 -1
- package/assets/{input-DF7Ue23C.js → input-CZTX-THl.js} +1 -1
- package/assets/{input-error-BBygona6.js → input-error-DpUrcJaR.js} +1 -1
- package/assets/item-add-1duKvWXz.js +1 -0
- package/assets/{label-Z506NKsW.js → label-B1wVTLjK.js} +1 -1
- package/assets/list-C07llS61.js +1 -0
- package/assets/{list-table-DB1sEQLF.js → list-table-Bh8E-zkN.js} +11 -16
- package/assets/{login-DrGaTWhY.js → login-Dl59_ycU.js} +1 -1
- package/assets/manifest.json +735 -564
- package/assets/{material-icon-CItZiB53.js → material-icon-C9IuCi5R.js} +1 -1
- package/assets/module-DwX7rlQ2.js +1 -0
- package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-DjLNSn-O.js} +1 -1
- package/assets/{multi-select-oabtVhUP.js → multi-select-CvcWwfki.js} +2 -2
- package/assets/{nav-footer-CM-yHiRs.js → nav-footer-C7_pEHmX.js} +1 -1
- package/assets/{nav-main-Q3xofGRT.js → nav-main-CwwCPIYf.js} +1 -1
- package/assets/{nav-user-Ds8i0Pa2.js → nav-user-K0xXPEmb.js} +1 -1
- package/assets/{pagination-render-B57pOpFy.js → pagination-render-BYBw11L4.js} +1 -1
- package/assets/pencil-CewBKDRo.js +6 -0
- package/assets/{popover-I249Gg2O.js → popover-vHKm7zkm.js} +1 -1
- package/assets/{register-C9FQIDtS.js → register-CRsK6KgL.js} +1 -1
- package/assets/{select-D1N8zRPY.js → select-Bs9mijkr.js} +2 -2
- package/assets/{sidebar-4D-sX2l4.js → sidebar-DflSp1X1.js} +2 -2
- package/assets/skeleton-C6UluiCK.js +1 -0
- package/assets/{sonner-Dzckw3U3.js → sonner-Cn7ueXZc.js} +1 -1
- package/assets/{toast-editor-FbrFd1ft.js → toast-editor-FNxkBiFw.js} +1 -1
- package/assets/{tooltip-D2ehgLlB.js → tooltip-BlR1mf2V.js} +1 -1
- package/assets/{use-appearance-Co6mO0dV.js → use-appearance-CL1-5ZfQ.js} +1 -1
- package/assets/{use-window-size-B8l6Bpkf.js → use-window-size-ciZdUHrJ.js} +1 -1
- package/assets/{user-info-DBYoAJYJ.js → user-info-qduQAMOl.js} +2 -2
- package/assets/{user-menu-content-qkvdkUVd.js → user-menu-content-Cjq658jE.js} +2 -2
- package/assets/welcome-CbHEVD33.js +1 -0
- package/controllers/add.js +9 -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 +42 -34
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +43 -21
- package/controllers/catalog/FrontentCatalogAdapter.js +49 -30
- package/controllers/ckeditorUpload.js +2 -3
- package/controllers/dashboard.js +16 -2
- package/controllers/edit.js +4 -5
- 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 +31 -15
- 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 +26 -3
- package/helpers/configHelper.js +2 -1
- package/helpers/controllerHelper.js +1 -1
- 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 +4 -3
- package/helpers/menuHelper.js +22 -15
- package/index.d.ts +5 -3
- package/index.js +8 -3
- package/interfaces/adminpanelConfig.d.ts +28 -31
- package/interfaces/global.d.ts +10 -28
- package/interfaces/types.d.ts +1 -1
- package/lib/Adminizer.d.ts +4 -2
- package/lib/Adminizer.js +32 -10
- 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 +87 -31
- package/lib/{catalog → v4/catalog}/AbstractCatalog.js +38 -34
- package/lib/v4/catalog/Navigation.d.ts +43 -0
- package/lib/v4/catalog/Navigation.js +462 -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 -1
- 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 -3
- 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 +25 -13
- package/policies/checkAuth.js +4 -3
- package/policies/setLocale.js +2 -2
- package/system/Router.js +8 -16
- 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 +12 -11
- package/system/bindMediaManager.js +0 -1
- package/system/bindModels.js +7 -2
- package/system/bindNavigation.d.ts +2 -0
- package/system/bindNavigation.js +42 -42
- package/system/bindReqFunctions.js +15 -0
- package/translations/ru.json +17 -8
- 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-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/dashboard-BR602KhL.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/index-K81GbF6O.js +0 -1
- package/assets/list-Qyd7ecQH.js +0 -1
- package/assets/module-DBaykv8l.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,5 @@
|
|
|
1
1
|
import { JSONSchema4 } from "json-schema";
|
|
2
|
-
import { Adminizer } from "
|
|
2
|
+
import { Adminizer } from "../../Adminizer";
|
|
3
3
|
/**
|
|
4
4
|
* Interface `Item` describes the data that the UI will operate on
|
|
5
5
|
* This is a common interface for all data that is linked to the catalog
|
|
@@ -8,7 +8,10 @@ import { Adminizer } from "../Adminizer";
|
|
|
8
8
|
export interface Item {
|
|
9
9
|
id: string | number;
|
|
10
10
|
name: string;
|
|
11
|
-
parentId: string | number
|
|
11
|
+
parentId: string | number;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
12
15
|
childs?: Item[];
|
|
13
16
|
sortOrder: number;
|
|
14
17
|
icon: string;
|
|
@@ -20,8 +23,6 @@ export type _Item_ = {
|
|
|
20
23
|
};
|
|
21
24
|
/**
|
|
22
25
|
* General Item structure that will be available for all elements, including groups
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
26
|
*/
|
|
26
27
|
export declare abstract class BaseItem<T extends Item> {
|
|
27
28
|
abstract readonly type: string;
|
|
@@ -30,6 +31,7 @@ export declare abstract class BaseItem<T extends Item> {
|
|
|
30
31
|
* I haven't found an easier way to extract this type that goes into generic
|
|
31
32
|
* If you know how to open PR
|
|
32
33
|
* */
|
|
34
|
+
abstract adminizer: Adminizer;
|
|
33
35
|
/**
|
|
34
36
|
* Catalog name
|
|
35
37
|
*/
|
|
@@ -50,54 +52,92 @@ export declare abstract class BaseItem<T extends Item> {
|
|
|
50
52
|
* Array of all global contexts, which will appear for all elements
|
|
51
53
|
*/
|
|
52
54
|
readonly actionHandlers: ActionHandler[];
|
|
55
|
+
/**
|
|
56
|
+
* Adds the context menu processor
|
|
57
|
+
*/
|
|
53
58
|
addActionHandler(contextHandler: ActionHandler): void;
|
|
54
59
|
/**
|
|
55
60
|
* Adds the required fields
|
|
56
61
|
* @param item
|
|
57
62
|
*/
|
|
58
63
|
_enrich(item: T): void;
|
|
59
|
-
_find(itemId: string | number, catalogId: string): Promise<T>;
|
|
60
|
-
abstract find(itemId: string | number, catalogId: string): Promise<T>;
|
|
64
|
+
_find(itemId: string | number, catalogId: string, req?: ReqType): Promise<T>;
|
|
65
|
+
abstract find(itemId: string | number, catalogId: string, req?: ReqType): Promise<T>;
|
|
61
66
|
/**
|
|
62
67
|
* Is false because default value Group is added
|
|
63
68
|
*/
|
|
64
|
-
abstract update(itemId: string | number, data: T, catalogId: string): Promise<T>;
|
|
69
|
+
abstract update(itemId: string | number, data: T, catalogId: string, req?: ReqType): Promise<T>;
|
|
65
70
|
/**
|
|
66
71
|
*
|
|
67
|
-
* @param
|
|
72
|
+
* @param modelId
|
|
68
73
|
* @param data
|
|
69
74
|
* @param catalogId
|
|
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
|
|
76
81
|
*/
|
|
77
|
-
abstract create(data: T, catalogId: string): Promise<T>;
|
|
82
|
+
abstract create(data: T, catalogId: string, req?: ReqType): Promise<T>;
|
|
78
83
|
/**
|
|
79
84
|
* delete element
|
|
80
85
|
*/
|
|
81
|
-
abstract deleteItem(itemId: string | number, catalogId: string): Promise<void>;
|
|
86
|
+
abstract deleteItem(itemId: string | number, catalogId: string, req?: ReqType): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated
|
|
89
|
+
* TODO: pass react module
|
|
90
|
+
*/
|
|
82
91
|
abstract getAddHTML(req: ReqType): Promise<{
|
|
83
|
-
type: '
|
|
84
|
-
data:
|
|
92
|
+
type: 'component' | 'model' | string;
|
|
93
|
+
data: any;
|
|
85
94
|
}>;
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated
|
|
97
|
+
* TODO: pass react module
|
|
98
|
+
*/
|
|
86
99
|
abstract getEditHTML(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
|
|
87
100
|
type: 'link' | 'html' | 'jsonForm';
|
|
88
101
|
data: string;
|
|
89
102
|
}>;
|
|
90
|
-
_getChilds(parentId: string | number
|
|
91
|
-
abstract getChilds(parentId: string | number
|
|
92
|
-
abstract search(s: string, catalogId: string): Promise<T[]>;
|
|
103
|
+
_getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
|
|
104
|
+
abstract getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
|
|
105
|
+
abstract search(s: string, catalogId: string, req?: ReqType): Promise<T[]>;
|
|
93
106
|
}
|
|
94
107
|
export declare abstract class AbstractGroup<T extends Item> extends BaseItem<T> {
|
|
95
108
|
readonly type: string;
|
|
96
109
|
readonly isGroup: boolean;
|
|
97
110
|
icon: string;
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated reason: migration for intertia
|
|
113
|
+
* // TODO: need passing custom React module
|
|
114
|
+
*/
|
|
115
|
+
abstract getAddHTML(req: ReqType): Promise<{
|
|
116
|
+
type: 'component' | 'model' | string;
|
|
117
|
+
data: {
|
|
118
|
+
items?: {
|
|
119
|
+
name: string;
|
|
120
|
+
required: boolean;
|
|
121
|
+
}[] | Record<string, any>[];
|
|
122
|
+
model?: string;
|
|
123
|
+
labels?: Record<string, string>;
|
|
124
|
+
};
|
|
125
|
+
}>;
|
|
98
126
|
}
|
|
99
127
|
export declare abstract class AbstractItem<T extends Item> extends BaseItem<T> {
|
|
100
128
|
readonly isGroup: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated reason: migration for intertia
|
|
131
|
+
* // TODO: need passing custom React module
|
|
132
|
+
*/
|
|
133
|
+
abstract getAddHTML(req: ReqType): Promise<{
|
|
134
|
+
type: 'component' | 'model' | string;
|
|
135
|
+
data: {
|
|
136
|
+
items?: Record<string, any>[];
|
|
137
|
+
model?: string;
|
|
138
|
+
labels?: Record<string, string>;
|
|
139
|
+
};
|
|
140
|
+
}>;
|
|
101
141
|
}
|
|
102
142
|
export declare abstract class ActionHandler {
|
|
103
143
|
/**
|
|
@@ -121,6 +161,8 @@ export declare abstract class ActionHandler {
|
|
|
121
161
|
abstract readonly jsonSchema: JSONSchema4;
|
|
122
162
|
/**
|
|
123
163
|
* For "json-forms" | "external"
|
|
164
|
+
* @deprecated reason: migration for intertia
|
|
165
|
+
* // TODO: need passing custom React module
|
|
124
166
|
*/
|
|
125
167
|
abstract getPopUpHTML(data?: any): Promise<string>;
|
|
126
168
|
/**
|
|
@@ -143,7 +185,7 @@ export declare abstract class ActionHandler {
|
|
|
143
185
|
* @param items
|
|
144
186
|
* @param config
|
|
145
187
|
*/
|
|
146
|
-
abstract handler(items: Item[], data?: any): Promise<void>;
|
|
188
|
+
abstract handler(items: Item[], data?: any, req?: ReqType): Promise<void>;
|
|
147
189
|
}
|
|
148
190
|
/**
|
|
149
191
|
*
|
|
@@ -190,12 +232,13 @@ export declare abstract class AbstractCatalog {
|
|
|
190
232
|
* Method for getting childs elements
|
|
191
233
|
* if pass null as parentId this root
|
|
192
234
|
*/
|
|
193
|
-
getChilds(parentId: string | number
|
|
235
|
+
getChilds(parentId: string | number, byItemType?: string, req?: ReqType): Promise<Item[]>;
|
|
194
236
|
private _bindAccessRight;
|
|
195
237
|
protected constructor(adminizer: Adminizer, items: BaseItem<any>[]);
|
|
196
238
|
setId(id: string): void;
|
|
197
239
|
/**
|
|
198
240
|
* Gettind id list method
|
|
241
|
+
* @info This is a dummy method, please make realization in sub class
|
|
199
242
|
*/
|
|
200
243
|
getIdList(): Promise<string[]>;
|
|
201
244
|
getItemType(type: string): BaseItem<Item>;
|
|
@@ -204,13 +247,15 @@ export declare abstract class AbstractCatalog {
|
|
|
204
247
|
/**
|
|
205
248
|
* Get an element
|
|
206
249
|
*/
|
|
207
|
-
find(item: Item): Promise<Item>;
|
|
250
|
+
find(item: Item, req?: ReqType): Promise<Item>;
|
|
208
251
|
/**
|
|
209
252
|
* Removing an element
|
|
210
253
|
*/
|
|
211
|
-
deleteItem(type: string, id: string | number): void
|
|
254
|
+
deleteItem(type: string, id: string | number, req?: ReqType): Promise<void>;
|
|
212
255
|
/**
|
|
213
256
|
* Receives HTML to update an element for projection into a popup
|
|
257
|
+
* @deprecated reason: migration for intertia
|
|
258
|
+
* todo need passing custom React module
|
|
214
259
|
*/
|
|
215
260
|
getEditHTML(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
|
|
216
261
|
type: "link" | "html" | "jsonForm";
|
|
@@ -218,10 +263,12 @@ export declare abstract class AbstractCatalog {
|
|
|
218
263
|
}>;
|
|
219
264
|
/**
|
|
220
265
|
* Receives HTML to create an element for projection into a popup
|
|
221
|
-
|
|
266
|
+
* @deprecated reason: migration for intertia
|
|
267
|
+
* // TODO: need passing custom React module
|
|
268
|
+
*/
|
|
222
269
|
getAddHTML(item: Item, req: ReqType): Promise<{
|
|
223
|
-
type: "
|
|
224
|
-
data:
|
|
270
|
+
type: "component" | "model" | string;
|
|
271
|
+
data: any;
|
|
225
272
|
}>;
|
|
226
273
|
addActionHandler(actionHandler: ActionHandler): void;
|
|
227
274
|
/**
|
|
@@ -232,7 +279,7 @@ export declare abstract class AbstractCatalog {
|
|
|
232
279
|
/**
|
|
233
280
|
* Implements search and execution of a specific action.handler
|
|
234
281
|
*/
|
|
235
|
-
handleAction(actionId: string, items?: Item[], config?: any): Promise<void>;
|
|
282
|
+
handleAction(actionId: string, items?: Item[], config?: any, req?: ReqType): Promise<void>;
|
|
236
283
|
/**
|
|
237
284
|
* Only For a Link action
|
|
238
285
|
* @param actionId
|
|
@@ -241,25 +288,34 @@ export declare abstract class AbstractCatalog {
|
|
|
241
288
|
/**
|
|
242
289
|
* For Extermal and JsonForms actions
|
|
243
290
|
* @param actionId
|
|
291
|
+
* @deprecated reason: migration for intertia
|
|
292
|
+
* // TODO: need passing custom React module
|
|
244
293
|
*/
|
|
245
294
|
getPopUpHTML(actionId: string): Promise<string>;
|
|
246
295
|
/**
|
|
247
296
|
*
|
|
248
297
|
* @param data
|
|
249
298
|
*/
|
|
250
|
-
createItem<T extends Item>(data: T): Promise<T>;
|
|
251
|
-
updateItem<T extends Item>(id: string | number, type: string, data: T): Promise<T>;
|
|
299
|
+
createItem<T extends Item>(data: T, req?: ReqType): Promise<T>;
|
|
300
|
+
updateItem<T extends Item>(id: string | number, type: string, data: T, req?: ReqType): Promise<T>;
|
|
252
301
|
/**
|
|
253
302
|
* To update all items in the tree after updating the model
|
|
254
303
|
* @param id
|
|
255
304
|
* @param type
|
|
256
305
|
* @param data
|
|
257
306
|
*/
|
|
258
|
-
updateModelItems<T extends Item>(modelId: string | number, type: string, data: T): Promise<T>;
|
|
307
|
+
updateModelItems<T extends Item>(modelId: string | number, type: string, data: T, req?: ReqType): Promise<T>;
|
|
259
308
|
/**
|
|
260
309
|
* Method for getting group elements
|
|
261
310
|
*/
|
|
262
|
-
getitemTypes():
|
|
263
|
-
|
|
311
|
+
getitemTypes(): {
|
|
312
|
+
type: string;
|
|
313
|
+
name: string;
|
|
314
|
+
isGroup: boolean;
|
|
315
|
+
allowedRoot: boolean;
|
|
316
|
+
icon: string;
|
|
317
|
+
actionHandlers: ActionHandler[];
|
|
318
|
+
}[];
|
|
319
|
+
search<T extends Item>(s: string, hasExtras?: boolean, req?: ReqType): Promise<T[]>;
|
|
264
320
|
static buildTree(items: Item[]): Item[];
|
|
265
321
|
}
|
|
@@ -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,29 +140,28 @@ 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
|
* Receives HTML to update an element for projection into a popup
|
|
154
|
+
* @deprecated reason: migration for intertia
|
|
155
|
+
* todo need passing custom React module
|
|
158
156
|
*/
|
|
159
157
|
getEditHTML(item, id, req, modelId) {
|
|
160
158
|
return this.getItemType(item.type)?.getEditHTML(id, this.id, req, modelId);
|
|
161
159
|
}
|
|
162
160
|
/**
|
|
163
161
|
* Receives HTML to create an element for projection into a popup
|
|
164
|
-
|
|
162
|
+
* @deprecated reason: migration for intertia
|
|
163
|
+
* // TODO: need passing custom React module
|
|
164
|
+
*/
|
|
165
165
|
getAddHTML(item, req) {
|
|
166
166
|
return this.getItemType(item.type)?.getAddHTML(req);
|
|
167
167
|
}
|
|
@@ -192,7 +192,7 @@ export class AbstractCatalog {
|
|
|
192
192
|
/**
|
|
193
193
|
* Implements search and execution of a specific action.handler
|
|
194
194
|
*/
|
|
195
|
-
async handleAction(actionId, items, config) {
|
|
195
|
+
async handleAction(actionId, items, config, req) {
|
|
196
196
|
let action = null;
|
|
197
197
|
if (items.length === 1) {
|
|
198
198
|
const item = items[0];
|
|
@@ -207,10 +207,9 @@ export class AbstractCatalog {
|
|
|
207
207
|
else {
|
|
208
208
|
action = this.actionHandlers.find((it) => it.id === actionId);
|
|
209
209
|
}
|
|
210
|
-
// console.log(this.actionHandlers)
|
|
211
210
|
if (!action)
|
|
212
211
|
throw `Action with id \`${actionId}\` not found`;
|
|
213
|
-
return await action.handler(items, config);
|
|
212
|
+
return await action.handler(items, config, req);
|
|
214
213
|
}
|
|
215
214
|
/**
|
|
216
215
|
* Only For a Link action
|
|
@@ -222,6 +221,8 @@ export class AbstractCatalog {
|
|
|
222
221
|
/**
|
|
223
222
|
* For Extermal and JsonForms actions
|
|
224
223
|
* @param actionId
|
|
224
|
+
* @deprecated reason: migration for intertia
|
|
225
|
+
* // TODO: need passing custom React module
|
|
225
226
|
*/
|
|
226
227
|
async getPopUpHTML(actionId) {
|
|
227
228
|
return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpHTML();
|
|
@@ -230,11 +231,13 @@ export class AbstractCatalog {
|
|
|
230
231
|
*
|
|
231
232
|
* @param data
|
|
232
233
|
*/
|
|
233
|
-
createItem(data) {
|
|
234
|
-
|
|
234
|
+
async createItem(data, req) {
|
|
235
|
+
const promise = this.getItemType(data.type)?.create(data, this.id, req);
|
|
236
|
+
return await promise;
|
|
235
237
|
}
|
|
236
|
-
updateItem(id, type, data) {
|
|
237
|
-
|
|
238
|
+
async updateItem(id, type, data, req) {
|
|
239
|
+
const promise = this.getItemType(type)?.update(id, data, this.id, req);
|
|
240
|
+
return await promise;
|
|
238
241
|
}
|
|
239
242
|
/**
|
|
240
243
|
* To update all items in the tree after updating the model
|
|
@@ -242,17 +245,18 @@ export class AbstractCatalog {
|
|
|
242
245
|
* @param type
|
|
243
246
|
* @param data
|
|
244
247
|
*/
|
|
245
|
-
updateModelItems(modelId, type, data) {
|
|
246
|
-
|
|
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,7 +265,7 @@ 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
271
|
if (item.parentId === null)
|
|
@@ -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 !==
|
|
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 ===
|
|
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): 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 {};
|