adminizer 4.1.0-build.3 → 4.1.0-build.31
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-DTWads1Y.js} +104 -104
- package/assets/add-NjsCZZct.js +1 -0
- package/assets/add-form-DJnEBqvy.js +1 -0
- package/assets/add-group-CU2zD7To.js +1 -0
- package/assets/add-group-form-CQN_syZq.js +1 -0
- package/assets/add-user-BkTa9shp.js +1 -0
- package/assets/add-user-form-C7T14FsG.js +1 -0
- package/assets/{app-DMmad2-f.css → app-DVaaqBB5.css} +1 -1
- package/assets/app-layout-NY6MXzc5.js +1 -0
- package/assets/{app-shell-BWMRMkHM.js → app-shell-BjaxjNs9.js} +1 -1
- package/assets/app-sidebar-CLu13Pcu.js +1 -0
- package/assets/{app-sidebar-header-DLAFi13E.js → app-sidebar-header-5IaQpngt.js} +1 -1
- 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-CeUUKxG9.js +17 -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-BTmXuc5F.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-BAuaxCy1.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-CN2xVSMK.js +1 -0
- package/assets/form-DOt5Fa6e.js +1 -0
- package/assets/{geo-json-CwteYDGB.js → geo-json-VtXcqPd9.js} +1 -1
- package/assets/group-link-add-CCNISxeF.js +1 -0
- package/assets/{handsontable-BCnjOpBr.js → handsontable-DrEU6lOi.js} +1 -1
- package/assets/home-3FBATYFh.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-BBfP40-3.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/item-add-CX7EOX0H.js +1 -0
- package/assets/{label-Z506NKsW.js → label-GEoZpZr4.js} +1 -1
- package/assets/list-DqIUjXSX.js +1 -0
- package/assets/list-table-1aXDvDPl.js +57 -0
- package/assets/{login-DrGaTWhY.js → login-Bv4hqwaM.js} +2 -2
- package/assets/manifest.json +788 -604
- package/assets/{material-icon-CItZiB53.js → material-icon-BAd3Wrgn.js} +1 -1
- package/assets/module-DziT22BH.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-Vm24wf5X.js} +1 -1
- package/assets/{nav-main-Q3xofGRT.js → nav-main-JVt9gzn8.js} +1 -1
- package/assets/{nav-user-Ds8i0Pa2.js → nav-user-DgYX0wO7.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-D8SyTFBZ.js} +1 -1
- package/assets/{select-D1N8zRPY.js → select-MzwxLt1D.js} +2 -2
- package/assets/{sidebar-4D-sX2l4.js → sidebar-DGp3i7GG.js} +2 -2
- package/assets/skeleton-C3gmNc1Z.js +1 -0
- package/assets/{sonner-Dzckw3U3.js → sonner-MAL0i2dq.js} +1 -1
- 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-C9BMKsoY.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 +42 -36
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +39 -25
- package/controllers/catalog/FrontentCatalogAdapter.js +55 -55
- 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 +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 +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 +4 -3
- package/helpers/menuHelper.js +22 -15
- package/index.d.ts +5 -3
- package/index.js +8 -3
- package/interfaces/adminpanelConfig.d.ts +29 -32
- 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 +33 -11
- 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 +79 -41
- package/lib/{catalog → v4/catalog}/AbstractCatalog.js +49 -41
- 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 -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 +27 -11
- 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 +8 -5
- package/system/bindNavigation.d.ts +2 -0
- package/system/bindNavigation.js +42 -42
- package/system/bindReqFunctions.js +15 -0
- package/system/defaults.js +2 -2
- 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-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/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,46 +52,62 @@ 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
|
|
75
|
+
* @param req
|
|
70
76
|
*/
|
|
71
|
-
abstract updateModelItems(modelId: string | number, data: any, catalogId: string): Promise<T>;
|
|
77
|
+
abstract updateModelItems(modelId: string | number, data: any, catalogId: string, req?: ReqType): Promise<T>;
|
|
72
78
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @param itemId
|
|
79
|
+
* Create catalog
|
|
75
80
|
* @param data
|
|
81
|
+
* @param catalogId
|
|
82
|
+
* @param req
|
|
76
83
|
*/
|
|
77
|
-
abstract create(data: T, catalogId: string): Promise<T>;
|
|
84
|
+
abstract create(data: T, catalogId: string, req?: ReqType): Promise<T>;
|
|
78
85
|
/**
|
|
79
86
|
* delete element
|
|
80
87
|
*/
|
|
81
|
-
abstract deleteItem(itemId: string | number, catalogId: string): Promise<void>;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
abstract deleteItem(itemId: string | number, catalogId: string, req?: ReqType): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* get add template
|
|
91
|
+
* @param req
|
|
92
|
+
*/
|
|
93
|
+
abstract getAddTemplate(req: ReqType): Promise<{
|
|
94
|
+
type: 'component' | 'navigation.item' | 'navigation.group' | 'navigation.link' | 'model';
|
|
95
|
+
data: any;
|
|
85
96
|
}>;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
/**
|
|
98
|
+
* get edit template
|
|
99
|
+
* @param id
|
|
100
|
+
* @param catalogId
|
|
101
|
+
* @param req
|
|
102
|
+
* @param modelId
|
|
103
|
+
*/
|
|
104
|
+
abstract getEditTemplate(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
|
|
105
|
+
type: 'component' | 'navigation.item' | 'navigation.group' | 'navigation.link' | 'model';
|
|
106
|
+
data: any;
|
|
89
107
|
}>;
|
|
90
|
-
_getChilds(parentId: string | number
|
|
91
|
-
abstract getChilds(parentId: string | number
|
|
92
|
-
abstract search(s: string, catalogId: string): Promise<T[]>;
|
|
108
|
+
_getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
|
|
109
|
+
abstract getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
|
|
110
|
+
abstract search(s: string, catalogId: string, req?: ReqType): Promise<T[]>;
|
|
93
111
|
}
|
|
94
112
|
export declare abstract class AbstractGroup<T extends Item> extends BaseItem<T> {
|
|
95
113
|
readonly type: string;
|
|
@@ -121,6 +139,8 @@ export declare abstract class ActionHandler {
|
|
|
121
139
|
abstract readonly jsonSchema: JSONSchema4;
|
|
122
140
|
/**
|
|
123
141
|
* For "json-forms" | "external"
|
|
142
|
+
* @deprecated reason: migration for intertia
|
|
143
|
+
* // TODO: need passing custom React module
|
|
124
144
|
*/
|
|
125
145
|
abstract getPopUpHTML(data?: any): Promise<string>;
|
|
126
146
|
/**
|
|
@@ -143,7 +163,7 @@ export declare abstract class ActionHandler {
|
|
|
143
163
|
* @param items
|
|
144
164
|
* @param config
|
|
145
165
|
*/
|
|
146
|
-
abstract handler(items: Item[], data?: any): Promise<void>;
|
|
166
|
+
abstract handler(items: Item[], data?: any, req?: ReqType): Promise<void>;
|
|
147
167
|
}
|
|
148
168
|
/**
|
|
149
169
|
*
|
|
@@ -190,12 +210,13 @@ export declare abstract class AbstractCatalog {
|
|
|
190
210
|
* Method for getting childs elements
|
|
191
211
|
* if pass null as parentId this root
|
|
192
212
|
*/
|
|
193
|
-
getChilds(parentId: string | number
|
|
213
|
+
getChilds(parentId: string | number, byItemType?: string, req?: ReqType): Promise<Item[]>;
|
|
194
214
|
private _bindAccessRight;
|
|
195
215
|
protected constructor(adminizer: Adminizer, items: BaseItem<any>[]);
|
|
196
216
|
setId(id: string): void;
|
|
197
217
|
/**
|
|
198
218
|
* Gettind id list method
|
|
219
|
+
* @info This is a dummy method, please make realization in sub class
|
|
199
220
|
*/
|
|
200
221
|
getIdList(): Promise<string[]>;
|
|
201
222
|
getItemType(type: string): BaseItem<Item>;
|
|
@@ -204,24 +225,30 @@ export declare abstract class AbstractCatalog {
|
|
|
204
225
|
/**
|
|
205
226
|
* Get an element
|
|
206
227
|
*/
|
|
207
|
-
find(item: Item): Promise<Item>;
|
|
228
|
+
find(item: Item, req?: ReqType): Promise<Item>;
|
|
208
229
|
/**
|
|
209
230
|
* Removing an element
|
|
210
231
|
*/
|
|
211
|
-
deleteItem(type: string, id: string | number): void
|
|
232
|
+
deleteItem(type: string, id: string | number, req?: ReqType): Promise<void>;
|
|
212
233
|
/**
|
|
213
|
-
*
|
|
234
|
+
* Get edit template from an item type
|
|
235
|
+
* @param item
|
|
236
|
+
* @param id
|
|
237
|
+
* @param req
|
|
238
|
+
* @param modelId
|
|
214
239
|
*/
|
|
215
|
-
|
|
216
|
-
type: "
|
|
217
|
-
data:
|
|
240
|
+
getEditTemplate(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
|
|
241
|
+
type: "component" | "navigation.item" | "navigation.group" | "navigation.link" | "model";
|
|
242
|
+
data: any;
|
|
218
243
|
}>;
|
|
219
244
|
/**
|
|
220
|
-
*
|
|
245
|
+
* Get add template from an item type
|
|
246
|
+
* @param item
|
|
247
|
+
* @param req
|
|
221
248
|
*/
|
|
222
|
-
|
|
223
|
-
type: "
|
|
224
|
-
data:
|
|
249
|
+
getAddTemplate(item: Item, req: ReqType): Promise<{
|
|
250
|
+
type: "component" | "navigation.item" | "navigation.group" | "navigation.link" | "model";
|
|
251
|
+
data: any;
|
|
225
252
|
}>;
|
|
226
253
|
addActionHandler(actionHandler: ActionHandler): void;
|
|
227
254
|
/**
|
|
@@ -232,7 +259,7 @@ export declare abstract class AbstractCatalog {
|
|
|
232
259
|
/**
|
|
233
260
|
* Implements search and execution of a specific action.handler
|
|
234
261
|
*/
|
|
235
|
-
handleAction(actionId: string, items?: Item[], config?: any): Promise<void>;
|
|
262
|
+
handleAction(actionId: string, items?: Item[], config?: any, req?: ReqType): Promise<void>;
|
|
236
263
|
/**
|
|
237
264
|
* Only For a Link action
|
|
238
265
|
* @param actionId
|
|
@@ -241,25 +268,36 @@ export declare abstract class AbstractCatalog {
|
|
|
241
268
|
/**
|
|
242
269
|
* For Extermal and JsonForms actions
|
|
243
270
|
* @param actionId
|
|
271
|
+
* @deprecated reason: migration for intertia
|
|
272
|
+
* // TODO: need passing custom React module
|
|
244
273
|
*/
|
|
245
274
|
getPopUpHTML(actionId: string): Promise<string>;
|
|
246
275
|
/**
|
|
247
276
|
*
|
|
248
277
|
* @param data
|
|
278
|
+
* @param req
|
|
249
279
|
*/
|
|
250
|
-
createItem<T extends Item>(data: T): Promise<T>;
|
|
251
|
-
updateItem<T extends Item>(id: string | number, type: string, data: T): Promise<T>;
|
|
280
|
+
createItem<T extends Item>(data: T, req?: ReqType): Promise<T>;
|
|
281
|
+
updateItem<T extends Item>(id: string | number, type: string, data: T, req?: ReqType): Promise<T>;
|
|
252
282
|
/**
|
|
253
283
|
* To update all items in the tree after updating the model
|
|
254
|
-
* @param
|
|
284
|
+
* @param modelId
|
|
255
285
|
* @param type
|
|
256
286
|
* @param data
|
|
287
|
+
* @param req
|
|
257
288
|
*/
|
|
258
|
-
updateModelItems<T extends Item>(modelId: string | number, type: string, data: T): Promise<T>;
|
|
289
|
+
updateModelItems<T extends Item>(modelId: string | number, type: string, data: T, req?: ReqType): Promise<T>;
|
|
259
290
|
/**
|
|
260
291
|
* Method for getting group elements
|
|
261
292
|
*/
|
|
262
|
-
getitemTypes():
|
|
263
|
-
|
|
293
|
+
getitemTypes(): {
|
|
294
|
+
type: string;
|
|
295
|
+
name: string;
|
|
296
|
+
isGroup: boolean;
|
|
297
|
+
allowedRoot: boolean;
|
|
298
|
+
icon: string;
|
|
299
|
+
actionHandlers: ActionHandler[];
|
|
300
|
+
}[];
|
|
301
|
+
search<T extends Item>(s: string, hasExtras?: boolean, req?: ReqType): Promise<T[]>;
|
|
264
302
|
static buildTree(items: Item[]): Item[];
|
|
265
303
|
}
|
|
@@ -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, config) {
|
|
197
|
+
async handleAction(actionId, items, config, 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, config);
|
|
214
|
+
return await action.handler(items, config, req);
|
|
214
215
|
}
|
|
215
216
|
/**
|
|
216
217
|
* Only For a Link action
|
|
@@ -222,6 +223,8 @@ export class AbstractCatalog {
|
|
|
222
223
|
/**
|
|
223
224
|
* For Extermal and JsonForms actions
|
|
224
225
|
* @param actionId
|
|
226
|
+
* @deprecated reason: migration for intertia
|
|
227
|
+
* // TODO: need passing custom React module
|
|
225
228
|
*/
|
|
226
229
|
async getPopUpHTML(actionId) {
|
|
227
230
|
return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpHTML();
|
|
@@ -229,30 +232,35 @@ export class AbstractCatalog {
|
|
|
229
232
|
/**
|
|
230
233
|
*
|
|
231
234
|
* @param data
|
|
235
|
+
* @param req
|
|
232
236
|
*/
|
|
233
|
-
createItem(data) {
|
|
234
|
-
|
|
237
|
+
async createItem(data, req) {
|
|
238
|
+
const promise = this.getItemType(data.type)?.create(data, this.id, req);
|
|
239
|
+
return await promise;
|
|
235
240
|
}
|
|
236
|
-
updateItem(id, type, data) {
|
|
237
|
-
|
|
241
|
+
async updateItem(id, type, data, req) {
|
|
242
|
+
const promise = this.getItemType(type)?.update(id, data, this.id, req);
|
|
243
|
+
return await promise;
|
|
238
244
|
}
|
|
239
245
|
/**
|
|
240
246
|
* To update all items in the tree after updating the model
|
|
241
|
-
* @param
|
|
247
|
+
* @param modelId
|
|
242
248
|
* @param type
|
|
243
249
|
* @param data
|
|
250
|
+
* @param req
|
|
244
251
|
*/
|
|
245
|
-
updateModelItems(modelId, type, data) {
|
|
246
|
-
|
|
252
|
+
async updateModelItems(modelId, type, data, req) {
|
|
253
|
+
const promise = this.getItemType(type)?.updateModelItems(modelId, data, this.id, req);
|
|
254
|
+
return await promise;
|
|
247
255
|
}
|
|
248
256
|
/**
|
|
249
257
|
* Method for getting group elements
|
|
250
258
|
*/
|
|
251
259
|
getitemTypes() {
|
|
252
|
-
return this.itemTypes;
|
|
260
|
+
return this.itemTypes.map(({ adminizer, ...rest }) => rest);
|
|
253
261
|
}
|
|
254
262
|
;
|
|
255
|
-
async search(s, hasExtras = true) {
|
|
263
|
+
async search(s, hasExtras = true, req) {
|
|
256
264
|
// Build the trees for all found items
|
|
257
265
|
const accumulator = [];
|
|
258
266
|
// Find group type
|
|
@@ -261,10 +269,10 @@ export class AbstractCatalog {
|
|
|
261
269
|
const buildTreeUpwards = async (item, hasExtras) => {
|
|
262
270
|
// Add extras
|
|
263
271
|
if (hasExtras) {
|
|
264
|
-
const extras = await this.getChilds(item.id);
|
|
272
|
+
const extras = await this.getChilds(item.id, undefined, req);
|
|
265
273
|
accumulator.push(...extras);
|
|
266
274
|
}
|
|
267
|
-
if (item.parentId ===
|
|
275
|
+
if (item.parentId === 0)
|
|
268
276
|
return item;
|
|
269
277
|
const parentItem = await groupType._find(item.parentId, this.id);
|
|
270
278
|
if (parentItem) {
|
|
@@ -280,7 +288,7 @@ export class AbstractCatalog {
|
|
|
280
288
|
foundItems = foundItems.concat(items);
|
|
281
289
|
}
|
|
282
290
|
for (const item of foundItems) {
|
|
283
|
-
if (item.parentId !==
|
|
291
|
+
if (item.parentId !== 0) { // changed from null to 0
|
|
284
292
|
await buildTreeUpwards(item, hasExtras);
|
|
285
293
|
}
|
|
286
294
|
}
|
|
@@ -306,7 +314,7 @@ export class AbstractCatalog {
|
|
|
306
314
|
itemMap[item.id] = item;
|
|
307
315
|
});
|
|
308
316
|
items.forEach(item => {
|
|
309
|
-
if (item.parentId ===
|
|
317
|
+
if (item.parentId === 0) { // changed from null to 0
|
|
310
318
|
tree.push(item);
|
|
311
319
|
}
|
|
312
320
|
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 {};
|