adminizer 4.1.0-build.26 → 4.1.0-build.28
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/assets/{VanillaJSONEditor-D-Lx670g.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-gNJW11-q.js → add-group-form-D1P6v9Fm.js} +1 -1
- package/assets/add-user-C31g3pXW.js +1 -0
- package/assets/{add-user-form-BJ0FsZYJ.js → add-user-form-DyczuE4l.js} +1 -1
- package/assets/{app-C3OdwOHy.css → app-ClS67l37.css} +1 -1
- package/assets/app-layout-CQTlWDgg.js +1 -0
- package/assets/{app-shell-Dd9Eknik.js → app-shell-B4pzTbiN.js} +1 -1
- package/assets/{app-sidebar-BOmu6-Sl.js → app-sidebar-DX9Shcd3.js} +1 -1
- package/assets/{app-sidebar-header-CoXSzWxk.js → app-sidebar-header-BcZ0JSSJ.js} +1 -1
- package/assets/app.js +9 -9
- package/assets/{breadcrumbs-BmAq4fHT.js → breadcrumbs-DIhfOCvh.js} +1 -1
- package/assets/{button-C9B_5Jf_.js → button-DleSKY4-.js} +1 -1
- package/assets/catalog-BHbLV-zr.js +12 -0
- package/assets/catalog-CZUI8zho.css +1 -0
- package/assets/{checkbox-Fg27sL_1.js → checkbox-DgmLwxEt.js} +1 -1
- package/assets/{compiler-runtime-hB6dAw2d.js → compiler-runtime-CMDe02AS.js} +1 -1
- package/assets/dashboard-BiycZ-vC.js +3 -0
- package/assets/{date-picker-DI1cCO7K.js → date-picker-Cb6A4Zx_.js} +1 -1
- package/assets/dialog-stack-DU4Ow4Oa.js +1 -0
- package/assets/{dropdown-menu-Bhj17ENm.js → dropdown-menu-D3vlxbLx.js} +1 -1
- package/assets/{field-renderer-DVHZF6HS.js → field-renderer-CW8TLtlI.js} +3 -3
- package/assets/form-CLP53RtV.js +1 -0
- package/assets/{form-DgtErfln.js → form-CwSId-Cu.js} +1 -1
- package/assets/{geo-json-BjiyTtMu.js → geo-json-BNgLxoVs.js} +1 -1
- package/assets/group-add-Brshb-tH.js +1 -0
- package/assets/{handsontable-4mjU_b0n.js → handsontable-BI4C0OBe.js} +1 -1
- package/assets/home-BRJ6eKVn.js +2 -0
- package/assets/{icon-Dt0vBgDO.js → icon-DLHMhF_-.js} +1 -1
- package/assets/{index-Cgp8OfuI.js → index-BRQOFOzQ.js} +1 -1
- package/assets/{index-BykbU6Ee.js → index-BZZx7KCI.js} +1 -1
- package/assets/{index-Cw5o84pO.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-CaJgc5EZ.js → index-C8anOJBB.js} +1 -1
- package/assets/{index-BKCgnGj_.js → index-CS5ssiKu.js} +1 -1
- package/assets/{index-B8BS9wMC.js → index-CsMwA9pu.js} +1 -1
- package/assets/{index-DrWfGwtf.js → index-HZzILD42.js} +1 -1
- package/assets/{index-BC0yfOHo.js → index-kzaPFHKt.js} +1 -1
- package/assets/{init-user-JfCKJ5Ce.js → init-user-VMPNdivw.js} +1 -1
- package/assets/{input-CvRbIbk4.js → input-CZTX-THl.js} +1 -1
- package/assets/{input-error-DMK7cAt7.js → input-error-DpUrcJaR.js} +1 -1
- package/assets/item-add-1duKvWXz.js +1 -0
- package/assets/{label-CSLFe9Bz.js → label-B1wVTLjK.js} +1 -1
- package/assets/list-C07llS61.js +1 -0
- package/assets/{list-table-DA9MhywL.js → list-table-Bh8E-zkN.js} +11 -16
- package/assets/{login-DQwGtdis.js → login-Dl59_ycU.js} +1 -1
- package/assets/manifest.json +716 -566
- package/assets/{material-icon-BJg8o_fs.js → material-icon-C9IuCi5R.js} +1 -1
- package/assets/module-DwX7rlQ2.js +1 -0
- package/assets/{monaco-editor-CJs0_GlD.js → monaco-editor-DjLNSn-O.js} +1 -1
- package/assets/{multi-select-BvRpAW8r.js → multi-select-CvcWwfki.js} +2 -2
- package/assets/{nav-footer-Bs4dmN1d.js → nav-footer-C7_pEHmX.js} +1 -1
- package/assets/{nav-main-Bq3IMk4C.js → nav-main-CwwCPIYf.js} +1 -1
- package/assets/{nav-user-CbB22J5O.js → nav-user-K0xXPEmb.js} +1 -1
- package/assets/{pagination-render-DuXDDbC_.js → pagination-render-BYBw11L4.js} +1 -1
- package/assets/pencil-CewBKDRo.js +6 -0
- package/assets/{popover-DtoGI2b1.js → popover-vHKm7zkm.js} +1 -1
- package/assets/{register-BSogVF0h.js → register-CRsK6KgL.js} +1 -1
- package/assets/{select-BWepUw-9.js → select-Bs9mijkr.js} +2 -2
- package/assets/{sidebar-CAHsHdjM.js → sidebar-DflSp1X1.js} +1 -1
- package/assets/{skeleton-COOcAA8f.js → skeleton-C6UluiCK.js} +1 -1
- package/assets/{sonner-BI0IFOQN.js → sonner-Cn7ueXZc.js} +1 -1
- package/assets/{toast-editor-CMK7QtF1.js → toast-editor-FNxkBiFw.js} +1 -1
- package/assets/{tooltip-DHwpLKOI.js → tooltip-BlR1mf2V.js} +1 -1
- package/assets/{use-appearance-DRfIqTgw.js → use-appearance-CL1-5ZfQ.js} +1 -1
- package/assets/{use-window-size-h0Sh_NvX.js → use-window-size-ciZdUHrJ.js} +1 -1
- package/assets/{user-info-DFrmpJ4y.js → user-info-qduQAMOl.js} +2 -2
- package/assets/{user-menu-content-DPXQdERj.js → user-menu-content-Cjq658jE.js} +2 -2
- package/assets/welcome-CbHEVD33.js +1 -0
- package/controllers/add.js +6 -7
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +40 -32
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +43 -21
- package/controllers/catalog/FrontentCatalogAdapter.js +49 -29
- package/controllers/edit.js +1 -1
- package/controllers/list.js +1 -1
- package/helpers/accessRightsHelper.js +4 -0
- package/helpers/inertiaAddHelper.d.ts +1 -1
- package/helpers/inertiaFromHelper.js +1 -1
- package/helpers/menuHelper.js +3 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/interfaces/global.d.ts +2 -2
- package/lib/Adminizer.d.ts +2 -2
- package/lib/Adminizer.js +4 -4
- package/lib/requestProcessor.js +10 -3
- package/lib/v4/DataAccessor.js +4 -4
- package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +87 -31
- package/lib/{catalog → v4/catalog}/AbstractCatalog.js +38 -33
- 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/v4/model/adapter/sequelize.js +4 -4
- package/lib/{widgets → v4/widgets}/abstractLink.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +3 -3
- package/models/NavigationAP.d.ts +2 -3
- package/models/NavigationAP.js +5 -6
- package/models/UserAP.d.ts +1 -1
- package/package.json +3 -1
- package/system/Router.js +2 -2
- package/system/bindControls.js +6 -6
- package/system/bindInertia.js +2 -2
- package/system/bindNavigation.d.ts +2 -0
- package/system/bindNavigation.js +42 -41
- package/assets/add-BP_u3Tjl.js +0 -1
- package/assets/add-form-nffmiYTh.js +0 -1
- package/assets/add-group-D4vcHlm-.js +0 -1
- package/assets/add-user-DWh3Nas0.js +0 -1
- package/assets/app-layout-DYsRFUuP.js +0 -1
- package/assets/dashboard-Ddh74NBQ.js +0 -3
- package/assets/form-BgWdwvz1.js +0 -1
- package/assets/home-CHntBHJa.js +0 -2
- package/assets/list-B2Oa5O_Q.js +0 -1
- package/assets/module-DWXp59Vg.js +0 -1
- package/assets/welcome-B4WCIXKf.js +0 -1
- package/lib/catalog/Navigation.d.ts +0 -0
- package/lib/catalog/Navigation.js +0 -531
- /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/{datatable → v4/datatable}/NodeTable.js +0 -0
- /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
- /package/lib/{inertia → v4/inertia}/flash.js +0 -0
- /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
- /package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractAction.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractCustom.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractCustom.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractInfo.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
- /package/lib/{widgets → v4/widgets}/widgetHandler.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CatalogHandler } from "../../lib/catalog/CatalogHandler";
|
|
1
|
+
import { CatalogHandler } from "../../lib/v4/catalog/CatalogHandler";
|
|
2
2
|
import { VueCatalog } from "./FrontentCatalogAdapter";
|
|
3
3
|
import { Adminizer } from "../../lib/Adminizer";
|
|
4
4
|
export async function catalogController(req, res) {
|
|
@@ -28,64 +28,72 @@ export async function catalogController(req, res) {
|
|
|
28
28
|
}
|
|
29
29
|
const method = req.method.toUpperCase();
|
|
30
30
|
if (method === 'GET') {
|
|
31
|
-
return
|
|
31
|
+
return req.Inertia.render({
|
|
32
|
+
component: 'catalog',
|
|
33
|
+
props: null
|
|
34
|
+
});
|
|
32
35
|
}
|
|
33
36
|
if (method === 'POST' || method === 'PUT' || method === 'DELETE') {
|
|
34
37
|
const data = req.body;
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
38
|
+
const frontendCatalog = new VueCatalog(_catalog);
|
|
39
|
+
if (!frontendCatalog)
|
|
37
40
|
return res.status(404);
|
|
38
|
-
|
|
39
|
-
const item =
|
|
41
|
+
frontendCatalog.setId(id);
|
|
42
|
+
const item = frontendCatalog.getItemType(data.type);
|
|
40
43
|
switch (method) {
|
|
41
44
|
case 'POST':
|
|
42
45
|
switch (data._method) {
|
|
46
|
+
// TODO: deprecated, passing react module instead html
|
|
43
47
|
case 'getAddHTML':
|
|
44
|
-
return res.json(await
|
|
48
|
+
return res.json(await frontendCatalog.getAddHTML(item, req));
|
|
49
|
+
// TODO: deprecated, passing react module instead html
|
|
45
50
|
case 'getEditHTML':
|
|
46
|
-
return res.json(await
|
|
51
|
+
return res.json(await frontendCatalog.getEditHTML(item, data.id, req, data.modelId));
|
|
47
52
|
case 'getCatalog':
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
{
|
|
54
|
+
const __catalog = await frontendCatalog.getCatalog();
|
|
55
|
+
return res.json({
|
|
56
|
+
items: frontendCatalog.getitemTypes(),
|
|
57
|
+
catalog: {
|
|
58
|
+
nodes: __catalog,
|
|
59
|
+
movingGroupsRootOnly: _catalog.movingGroupsRootOnly ?? false,
|
|
60
|
+
catalogName: _catalog.name,
|
|
61
|
+
catalogId: _catalog.id,
|
|
62
|
+
catalogSlug: _catalog.slug,
|
|
63
|
+
idList: idList
|
|
64
|
+
},
|
|
65
|
+
toolsActions: await frontendCatalog.getActions([], 'tools')
|
|
66
|
+
});
|
|
67
|
+
}
|
|
61
68
|
case 'createItem':
|
|
62
|
-
return res.json({ 'data': await
|
|
69
|
+
return res.json({ 'data': await frontendCatalog.createItem(data.data, req) });
|
|
63
70
|
case 'getChilds':
|
|
64
|
-
return res.json({ data: await
|
|
71
|
+
return res.json({ data: await frontendCatalog.getChilds(data.data, req) });
|
|
65
72
|
case 'getActions':
|
|
66
|
-
return res.json({ data: await
|
|
73
|
+
return res.json({ data: await frontendCatalog.getActions(data.items, data.type) });
|
|
67
74
|
case 'search':
|
|
68
|
-
return res.json({ data: await
|
|
75
|
+
return res.json({ data: await frontendCatalog.search(data.s, req) });
|
|
69
76
|
case "getLocales":
|
|
70
|
-
return res.json({ data:
|
|
77
|
+
return res.json({ data: frontendCatalog.getLocales(req) });
|
|
71
78
|
}
|
|
72
79
|
break;
|
|
73
80
|
case 'PUT':
|
|
74
81
|
switch (data._method) {
|
|
75
82
|
case 'updateTree':
|
|
76
|
-
return res.json({ data: await
|
|
83
|
+
return res.json({ data: await frontendCatalog.updateTree(data.data, req) });
|
|
77
84
|
case 'getLink':
|
|
78
|
-
return res.json({ data: await
|
|
85
|
+
return res.json({ data: await frontendCatalog.getLink(data.actionId) });
|
|
79
86
|
case 'handleAction':
|
|
80
|
-
return res.json({ data: await
|
|
87
|
+
return res.json({ data: await frontendCatalog.handleAction(data.data.actionID, data.data.items, data.data.config, req) });
|
|
81
88
|
case 'getPopUpHTML':
|
|
82
|
-
|
|
89
|
+
// TODO: deprecated, passing react module instead html
|
|
90
|
+
return res.json({ data: await frontendCatalog.getPopUpHTML(data.actionId) });
|
|
83
91
|
case 'updateItem':
|
|
84
|
-
return res.json({ data: await
|
|
92
|
+
return res.json({ data: await frontendCatalog.updateItem(item, data.modelId, data.data, req) });
|
|
85
93
|
}
|
|
86
94
|
break;
|
|
87
95
|
case 'DELETE':
|
|
88
|
-
return res.json({ data: await
|
|
96
|
+
return res.json({ data: await frontendCatalog.deleteItem(data.data, req) });
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
99
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AbstractCatalog, Item } from "../../lib/catalog/AbstractCatalog";
|
|
1
|
+
import { AbstractCatalog, Item } from "../../lib/v4/catalog/AbstractCatalog";
|
|
2
2
|
interface NodeModel<TDataType> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
text: string;
|
|
4
|
+
droppable: boolean;
|
|
5
|
+
id: number;
|
|
6
|
+
parent: number;
|
|
7
7
|
data?: TDataType;
|
|
8
8
|
children?: NodeModel<TDataType>[];
|
|
9
9
|
isSelected?: boolean;
|
|
@@ -18,40 +18,62 @@ interface NodeModel<TDataType> {
|
|
|
18
18
|
}
|
|
19
19
|
interface NodeData extends Item {
|
|
20
20
|
}
|
|
21
|
-
interface obj {
|
|
22
|
-
[key: string]: string;
|
|
23
|
-
}
|
|
24
21
|
interface RequestData {
|
|
25
22
|
reqNode: NodeModel<NodeData>[];
|
|
26
23
|
reqParent: NodeModel<NodeData>;
|
|
27
24
|
_method: string;
|
|
28
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Now is React
|
|
28
|
+
* // TODO: refactor for react name
|
|
29
|
+
*/
|
|
29
30
|
export declare class VueCatalog {
|
|
30
31
|
catalog: AbstractCatalog;
|
|
31
32
|
constructor(_catalog: AbstractCatalog);
|
|
32
33
|
setId(id: string): void;
|
|
33
|
-
getItemType(type: string): import("../../lib/catalog/AbstractCatalog").BaseItem<Item>;
|
|
34
|
+
getItemType(type: string): import("../../lib/v4/catalog/AbstractCatalog").BaseItem<Item>;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated reason: migration for intertia
|
|
37
|
+
* // TODO: need passing custom React module
|
|
38
|
+
*/
|
|
34
39
|
getAddHTML(item: any, req: ReqType): Promise<{
|
|
35
|
-
type: "
|
|
36
|
-
data:
|
|
40
|
+
type: "component" | "model" | string;
|
|
41
|
+
data: any;
|
|
37
42
|
}>;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated reason: migration for intertia
|
|
45
|
+
* TODO need passing custom React module
|
|
46
|
+
*/
|
|
38
47
|
getEditHTML(item: any, id: string | number, req: ReqType, modelId: string | number): Promise<{
|
|
39
48
|
type: "link" | "html" | "jsonForm";
|
|
40
49
|
data: string;
|
|
41
50
|
}>;
|
|
42
|
-
getitemTypes():
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
getitemTypes(): {
|
|
52
|
+
type: string;
|
|
53
|
+
name: string;
|
|
54
|
+
isGroup: boolean;
|
|
55
|
+
allowedRoot: boolean;
|
|
56
|
+
icon: string;
|
|
57
|
+
actionHandlers: import("../../lib/v4/catalog/AbstractCatalog").ActionHandler[];
|
|
58
|
+
}[];
|
|
59
|
+
getLocales(req: ReqType): {
|
|
60
|
+
[key: string]: string;
|
|
61
|
+
};
|
|
62
|
+
getActions(items: NodeModel<any>[], type: string): Promise<import("../../lib/v4/catalog/AbstractCatalog").ActionHandler[]>;
|
|
63
|
+
handleAction(actionId: string, items: any[], config: any, req: ReqType): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated reason: migration for intertia
|
|
66
|
+
* // TODO: need passing custom React module
|
|
67
|
+
*/
|
|
46
68
|
getPopUpHTML(actionId: string): Promise<string>;
|
|
47
69
|
getLink(actionId: string): Promise<string>;
|
|
48
70
|
getCatalog(): Promise<NodeModel<Item>[]>;
|
|
49
|
-
createItem(data: any): Promise<any>;
|
|
50
|
-
getChilds(data: any): Promise<NodeModel<Item>[]>;
|
|
51
|
-
search(s: string): Promise<NodeModel<Item>[]>;
|
|
52
|
-
updateTree(data: RequestData): Promise<any>;
|
|
53
|
-
updateItem(item: any, modelId: string, data: any): Promise<any>;
|
|
54
|
-
deleteItem(items: NodeModel<any>[]): Promise<{
|
|
71
|
+
createItem(data: any, req: ReqType): Promise<any>;
|
|
72
|
+
getChilds(data: any, req: ReqType): Promise<NodeModel<Item>[]>;
|
|
73
|
+
search(s: string, req: ReqType): Promise<NodeModel<Item>[]>;
|
|
74
|
+
updateTree(data: RequestData, req: ReqType): Promise<any>;
|
|
75
|
+
updateItem(item: any, modelId: string, data: any, req: ReqType): Promise<any>;
|
|
76
|
+
deleteItem(items: NodeModel<any>[], req: ReqType): Promise<{
|
|
55
77
|
ok: boolean;
|
|
56
78
|
}>;
|
|
57
79
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { AbstractCatalog } from "../../lib/catalog/AbstractCatalog";
|
|
1
|
+
import { AbstractCatalog } from "../../lib/v4/catalog/AbstractCatalog";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Now is React
|
|
4
|
+
* // TODO: refactor for react name
|
|
5
|
+
*/
|
|
2
6
|
export class VueCatalog {
|
|
3
7
|
catalog;
|
|
4
8
|
constructor(_catalog) {
|
|
@@ -10,9 +14,17 @@ export class VueCatalog {
|
|
|
10
14
|
getItemType(type) {
|
|
11
15
|
return this.catalog.getItemType(type);
|
|
12
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated reason: migration for intertia
|
|
19
|
+
* // TODO: need passing custom React module
|
|
20
|
+
*/
|
|
13
21
|
getAddHTML(item, req) {
|
|
14
22
|
return this.catalog.getAddHTML(item, req);
|
|
15
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated reason: migration for intertia
|
|
26
|
+
* TODO need passing custom React module
|
|
27
|
+
*/
|
|
16
28
|
getEditHTML(item, id, req, modelId) {
|
|
17
29
|
return this.catalog.getEditHTML(item, id, req, modelId);
|
|
18
30
|
}
|
|
@@ -31,19 +43,21 @@ export class VueCatalog {
|
|
|
31
43
|
"No, cancel": "",
|
|
32
44
|
"Are you sure?": "",
|
|
33
45
|
"Yes, I'm sure": "",
|
|
34
|
-
"Select Ids": ""
|
|
46
|
+
"Select Ids": "",
|
|
47
|
+
"OR": "",
|
|
35
48
|
};
|
|
36
49
|
obj[this.catalog.name] = "";
|
|
37
50
|
for (const actionHandler of this.catalog.actionHandlers) {
|
|
38
51
|
obj[actionHandler.name] = "";
|
|
39
52
|
}
|
|
40
53
|
let messages = obj;
|
|
41
|
-
req.i18n.setLocale(req.user.locale);
|
|
42
54
|
let outMessages = {};
|
|
43
55
|
for (const mess of Object.keys(messages)) {
|
|
44
56
|
outMessages[mess] = req.i18n.__(mess);
|
|
45
57
|
}
|
|
46
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
...outMessages,
|
|
60
|
+
};
|
|
47
61
|
}
|
|
48
62
|
async getActions(items, type) {
|
|
49
63
|
let arrItems = [];
|
|
@@ -57,13 +71,17 @@ export class VueCatalog {
|
|
|
57
71
|
return (await this.catalog.getActions(arrItems))?.filter(e => e.displayContext);
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
|
-
async handleAction(actionId, items, config) {
|
|
74
|
+
async handleAction(actionId, items, config, req) {
|
|
61
75
|
let arrItems = [];
|
|
62
76
|
for (const item of items) {
|
|
63
77
|
arrItems.push(await this.catalog.find(item.data));
|
|
64
78
|
}
|
|
65
|
-
return this.catalog.handleAction(actionId, arrItems, config);
|
|
79
|
+
return this.catalog.handleAction(actionId, arrItems, config, req);
|
|
66
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated reason: migration for intertia
|
|
83
|
+
* // TODO: need passing custom React module
|
|
84
|
+
*/
|
|
67
85
|
async getPopUpHTML(actionId) {
|
|
68
86
|
return this.catalog.getPopUpHTML(actionId);
|
|
69
87
|
}
|
|
@@ -72,35 +90,35 @@ export class VueCatalog {
|
|
|
72
90
|
}
|
|
73
91
|
//Below are the methods that require action
|
|
74
92
|
async getCatalog() {
|
|
75
|
-
let rootItems = await this.catalog.getChilds(
|
|
93
|
+
let rootItems = await this.catalog.getChilds(0);
|
|
76
94
|
return VueCatalogUtils.arrayToNode(rootItems, this.catalog.getGroupType().type);
|
|
77
95
|
}
|
|
78
|
-
createItem(data) {
|
|
96
|
+
async createItem(data, req) {
|
|
79
97
|
//data = VueCatalogUtils.refinement(data);
|
|
80
98
|
if (this.catalog.slug !== "navigation") {
|
|
81
99
|
let item = data.record;
|
|
82
100
|
item.parenId = data.parenId;
|
|
83
|
-
return this.catalog.createItem(item);
|
|
101
|
+
return await this.catalog.createItem(item, req);
|
|
84
102
|
}
|
|
85
103
|
else {
|
|
86
|
-
return this.catalog.createItem(data);
|
|
104
|
+
return await this.catalog.createItem(data, req);
|
|
87
105
|
}
|
|
88
106
|
}
|
|
89
|
-
async getChilds(data) {
|
|
107
|
+
async getChilds(data, req) {
|
|
90
108
|
data = VueCatalogUtils.refinement(data);
|
|
91
|
-
return VueCatalogUtils.arrayToNode(await this.catalog.getChilds(data.id), this.catalog.getGroupType().type);
|
|
109
|
+
return VueCatalogUtils.arrayToNode(await this.catalog.getChilds(data.id, undefined, req), this.catalog.getGroupType().type);
|
|
92
110
|
}
|
|
93
111
|
// Moved into actions
|
|
94
112
|
// getCreatedItems(data: any) {
|
|
95
113
|
// data = VueCatalogUtils.refinement(data);
|
|
96
114
|
// return this.catalog.getChilds(data.id);
|
|
97
115
|
// }
|
|
98
|
-
async search(s) {
|
|
99
|
-
let searchResult = await this.catalog.search(s);
|
|
116
|
+
async search(s, req) {
|
|
117
|
+
let searchResult = await this.catalog.search(s, undefined, req);
|
|
100
118
|
let itemsTree = AbstractCatalog.buildTree(searchResult);
|
|
101
119
|
return VueCatalogUtils.treeToNode(itemsTree, this.catalog.getGroupType().type);
|
|
102
120
|
}
|
|
103
|
-
async updateTree(data) {
|
|
121
|
+
async updateTree(data, req) {
|
|
104
122
|
let reqNodes = data.reqNode;
|
|
105
123
|
if (!Array.isArray(data.reqNode)) {
|
|
106
124
|
reqNodes = [data.reqNode];
|
|
@@ -114,7 +132,7 @@ export class VueCatalog {
|
|
|
114
132
|
}
|
|
115
133
|
// It’s unclear why he’s coming reqNodes
|
|
116
134
|
for (const reqNode of reqNodes) {
|
|
117
|
-
const item = await this.catalog.find(reqNode.data);
|
|
135
|
+
const item = await this.catalog.find(reqNode.data, req);
|
|
118
136
|
if (!item) {
|
|
119
137
|
throw `reqNode Item not found`;
|
|
120
138
|
}
|
|
@@ -124,26 +142,26 @@ export class VueCatalog {
|
|
|
124
142
|
for (const childNode of reqParent.children) {
|
|
125
143
|
childNode.data.sortOrder = sortCount;
|
|
126
144
|
childNode.data.parentId = reqParent.data.id;
|
|
127
|
-
await this.catalog.updateItem(childNode.data.id, childNode.data.type, childNode.data);
|
|
145
|
+
await this.catalog.updateItem(childNode.data.id, childNode.data.type, childNode.data, req);
|
|
128
146
|
sortCount++;
|
|
129
147
|
}
|
|
130
148
|
return Promise.resolve('ok');
|
|
131
149
|
}
|
|
132
|
-
async updateItem(item, modelId, data) {
|
|
150
|
+
async updateItem(item, modelId, data, req) {
|
|
133
151
|
//data = VueCatalogUtils.refinement(data);
|
|
134
152
|
if (this.catalog.slug !== "navigation") {
|
|
135
|
-
return await this.catalog.updateModelItems(data.modelId, data.type, data.record);
|
|
153
|
+
return await this.catalog.updateModelItems(data.modelId, data.type, data.record, req);
|
|
136
154
|
}
|
|
137
155
|
else {
|
|
138
|
-
return await this.catalog.updateModelItems(modelId, item.type, data);
|
|
156
|
+
return await this.catalog.updateModelItems(modelId, item.type, data, req);
|
|
139
157
|
}
|
|
140
158
|
}
|
|
141
|
-
async deleteItem(items) {
|
|
159
|
+
async deleteItem(items, req) {
|
|
142
160
|
for (const item1 of items) {
|
|
143
161
|
if (item1.children?.length) {
|
|
144
|
-
await this.deleteItem(item1.children);
|
|
162
|
+
await this.deleteItem(item1.children, req);
|
|
145
163
|
}
|
|
146
|
-
this.catalog.deleteItem(item1.data.type, item1.data.id);
|
|
164
|
+
await this.catalog.deleteItem(item1.data.type, item1.data.id, req);
|
|
147
165
|
}
|
|
148
166
|
return { ok: true };
|
|
149
167
|
}
|
|
@@ -161,16 +179,18 @@ export class VueCatalogUtils {
|
|
|
161
179
|
static toNode(data, groupTypeName) {
|
|
162
180
|
return {
|
|
163
181
|
data: data,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
182
|
+
// droppable: data.type !== groupTypeName,
|
|
183
|
+
droppable: true,
|
|
184
|
+
// isExpanded: false,
|
|
185
|
+
id: data.sortOrder + 1,
|
|
186
|
+
text: data.name,
|
|
187
|
+
parent: 0
|
|
168
188
|
};
|
|
169
189
|
}
|
|
170
190
|
static expandTo(vueCatalogData, theseItemIdsNeedToBeOpened) {
|
|
171
191
|
function expand(node) {
|
|
172
192
|
if (theseItemIdsNeedToBeOpened.includes(node.data.id)) {
|
|
173
|
-
node.isExpanded = true;
|
|
193
|
+
// node.isExpanded = true;
|
|
174
194
|
}
|
|
175
195
|
if (node.children) {
|
|
176
196
|
for (const child of node.children) {
|
|
@@ -191,7 +211,7 @@ export class VueCatalogUtils {
|
|
|
191
211
|
// Sort the children before building their nodes
|
|
192
212
|
item.childs.sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
|
|
193
213
|
node.children = buildNodes(item.childs);
|
|
194
|
-
node.isExpanded = !node.
|
|
214
|
+
// node.isExpanded = !node.droppable;
|
|
195
215
|
}
|
|
196
216
|
return node;
|
|
197
217
|
});
|
package/controllers/edit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ControllerHelper } from "../helpers/controllerHelper";
|
|
2
2
|
import { RequestProcessor } from "../lib/requestProcessor";
|
|
3
3
|
import { FieldsHelper } from "../helpers/fieldsHelper";
|
|
4
|
-
import { CatalogHandler } from "../lib/catalog/CatalogHandler";
|
|
4
|
+
import { CatalogHandler } from "../lib/v4/catalog/CatalogHandler";
|
|
5
5
|
import { getRelationsMediaManager, saveRelationsMediaManager } from "../lib/media-manager/helpers/MediaManagerHelper";
|
|
6
6
|
import { DataAccessor } from "../lib/v4/DataAccessor";
|
|
7
7
|
import { Adminizer } from "../lib/Adminizer";
|
package/controllers/list.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControllerHelper } from "../helpers/controllerHelper";
|
|
2
2
|
import { DataAccessor } from "../lib/v4/DataAccessor";
|
|
3
|
-
import { NodeTable } from "../lib/datatable/NodeTable";
|
|
3
|
+
import { NodeTable } from "../lib/v4/datatable/NodeTable";
|
|
4
4
|
import { Adminizer } from "../lib/Adminizer";
|
|
5
5
|
import { inertiaListHelper } from "../helpers/inertiaListHelper";
|
|
6
6
|
export default async function list(req, res) {
|
|
@@ -59,6 +59,10 @@ export class AccessRightsHelper {
|
|
|
59
59
|
Adminizer.log.error("Adminpanel > Token is not valid", tokenId, user.login);
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
|
+
if (!user.groups) {
|
|
63
|
+
Adminizer.log.error('User has no groups');
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
62
66
|
return user.groups.some((group) => group.tokens?.includes(tokenId));
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Entity, PropsField } from "../interfaces/types";
|
|
2
2
|
import { Actions } from "./inertiaActionsHelper";
|
|
3
3
|
import { Fields, Field } from "./fieldsHelper";
|
|
4
|
-
import { AbstractControls, ControlType } from "../lib/controls/AbstractControls";
|
|
4
|
+
import { AbstractControls, ControlType } from "../lib/v4/controls/AbstractControls";
|
|
5
5
|
export type PropsFieldType = 'text' | 'number' | 'range' | 'week' | 'month' | 'email' | 'color' | 'time' | 'date' | 'datetime-local' | 'password' | 'select' | 'select-many' | 'association-many' | 'association' | 'textarea' | 'checkbox' | ControlType;
|
|
6
6
|
interface FieldProps extends Record<string | number | symbol, unknown> {
|
|
7
7
|
edit: boolean;
|
|
@@ -9,7 +9,7 @@ export default function inertiaFormHelper(req, postLink, formData) {
|
|
|
9
9
|
};
|
|
10
10
|
for (const key of Object.keys(formData)) {
|
|
11
11
|
let field = formData[key];
|
|
12
|
-
if (field.visible === false)
|
|
12
|
+
if (!!field.visible === false)
|
|
13
13
|
continue;
|
|
14
14
|
const type = (field.type || field.type).toLowerCase();
|
|
15
15
|
const isIn = field.isIn ?? [];
|
package/helpers/menuHelper.js
CHANGED
|
@@ -118,6 +118,7 @@ export class MenuHelper {
|
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
if (this.config.models) {
|
|
121
|
+
const _this = this;
|
|
121
122
|
Object.entries(this.config.models).forEach(function ([key, val]) {
|
|
122
123
|
const hide = typeof val.navbar?.visible === 'boolean'
|
|
123
124
|
? !val.navbar.visible
|
|
@@ -128,7 +129,7 @@ export class MenuHelper {
|
|
|
128
129
|
if (val.tools && val.tools.length > 0 && val.tools[0].id !== "overview") {
|
|
129
130
|
val.tools.unshift({
|
|
130
131
|
id: "overview",
|
|
131
|
-
link:
|
|
132
|
+
link: _this.config.routePrefix + '/model/' + key,
|
|
132
133
|
title: 'Overview',
|
|
133
134
|
type: 'self',
|
|
134
135
|
icon: "list",
|
|
@@ -136,7 +137,7 @@ export class MenuHelper {
|
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
139
|
menus.push({
|
|
139
|
-
link:
|
|
140
|
+
link: _this.config.routePrefix + '/model/' + key,
|
|
140
141
|
title: val.title || key,
|
|
141
142
|
icon: val.icon || null,
|
|
142
143
|
actions: val.tools || null,
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./helpers/configHelper";
|
|
2
2
|
export * from "./helpers/accessRightsHelper";
|
|
3
|
-
export * from "./lib/widgets/widgetHandler";
|
|
4
|
-
export * from "./lib/catalog/CatalogHandler";
|
|
3
|
+
export * from "./lib/v4/widgets/widgetHandler";
|
|
4
|
+
export * from "./lib/v4/catalog/CatalogHandler";
|
|
5
5
|
export * from "./lib/media-manager/MediaManagerHandler";
|
|
6
6
|
export * from "./interfaces/adminpanelConfig";
|
|
7
7
|
export * from "./lib/v4/model/AbstractModel";
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./helpers/configHelper";
|
|
2
2
|
export * from "./helpers/accessRightsHelper";
|
|
3
|
-
export * from "./lib/widgets/widgetHandler";
|
|
4
|
-
export * from "./lib/catalog/CatalogHandler";
|
|
3
|
+
export * from "./lib/v4/widgets/widgetHandler";
|
|
4
|
+
export * from "./lib/v4/catalog/CatalogHandler";
|
|
5
5
|
export * from "./lib/media-manager/MediaManagerHandler";
|
|
6
6
|
export * from "./interfaces/adminpanelConfig";
|
|
7
7
|
export * from "./lib/v4/model/AbstractModel";
|
package/interfaces/global.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Adminizer } from "../lib/Adminizer";
|
|
|
2
2
|
import { NextFunction, Request, Response } from "express";
|
|
3
3
|
import multer from "multer";
|
|
4
4
|
import { I18n } from "../lib/v4/I18n";
|
|
5
|
-
import { Inertia } from "../lib/inertia/inertiaAdapter";
|
|
6
|
-
import { Flash } from "../lib/inertia/flash";
|
|
5
|
+
import { Inertia } from "../lib/v4/inertia/inertiaAdapter";
|
|
6
|
+
import { Flash } from "../lib/v4/inertia/flash";
|
|
7
7
|
import { UserAP } from "models/UserAP";
|
|
8
8
|
declare global {
|
|
9
9
|
/** @deprecated use import from TS model decalration */
|
package/lib/Adminizer.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import EventEmitter from 'events';
|
|
|
4
4
|
import { AdminpanelConfig } from "../interfaces/adminpanelConfig";
|
|
5
5
|
import PolicyManager from "./v4/PolicyManager";
|
|
6
6
|
import { ModelHandler } from "./v4/model/ModelHandler";
|
|
7
|
-
import { WidgetHandler } from "./widgets/widgetHandler";
|
|
7
|
+
import { WidgetHandler } from "./v4/widgets/widgetHandler";
|
|
8
8
|
import { AccessRightsHelper } from "../helpers/accessRightsHelper";
|
|
9
9
|
import { ConfigHelper } from "../helpers/configHelper";
|
|
10
10
|
import { AbstractAdapter } from "./v4/model/AbstractModel";
|
|
11
11
|
import { ViteDevServer } from 'vite';
|
|
12
12
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
13
|
-
import { ControlsHandler } from "./controls/ControlsHandler";
|
|
13
|
+
import { ControlsHandler } from "./v4/controls/ControlsHandler";
|
|
14
14
|
export declare class Adminizer {
|
|
15
15
|
app: Express;
|
|
16
16
|
config: AdminpanelConfig;
|
package/lib/Adminizer.js
CHANGED
|
@@ -9,7 +9,7 @@ import Router from "./../system/Router";
|
|
|
9
9
|
import bindAssets from "../system/bindAssets";
|
|
10
10
|
import bindDev from "../system/bindDev";
|
|
11
11
|
import bindDashboardWidgets from "../system/bindDashboardWidgets";
|
|
12
|
-
|
|
12
|
+
import bindNavigation from "../system/bindNavigation";
|
|
13
13
|
// import bindMediaManager from "../system/bindMediaManager";
|
|
14
14
|
import bindAccessRights from "../system/bindAccessRights";
|
|
15
15
|
import bindAuthorization from "../system/bindAuthorization";
|
|
@@ -17,7 +17,7 @@ import bindModels from "../system/bindModels";
|
|
|
17
17
|
import bindForms from "../system/bindForms";
|
|
18
18
|
import bindTranslations from "../system/bindTranslations";
|
|
19
19
|
import { ModelHandler } from "./v4/model/ModelHandler";
|
|
20
|
-
import { WidgetHandler } from "./widgets/widgetHandler";
|
|
20
|
+
import { WidgetHandler } from "./v4/widgets/widgetHandler";
|
|
21
21
|
import { AccessRightsHelper } from "../helpers/accessRightsHelper";
|
|
22
22
|
import bindReqFunctions from "../system/bindReqFunctions";
|
|
23
23
|
import { ConfigHelper } from "../helpers/configHelper";
|
|
@@ -28,7 +28,7 @@ import { createServer as createViteServer } from 'vite';
|
|
|
28
28
|
import { bindInertia } from "../system/bindInertia";
|
|
29
29
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
30
30
|
import { bindControls } from "../system/bindControls";
|
|
31
|
-
import { ControlsHandler } from "./controls/ControlsHandler";
|
|
31
|
+
import { ControlsHandler } from "./v4/controls/ControlsHandler";
|
|
32
32
|
import { v4 as uuid } from "uuid";
|
|
33
33
|
export class Adminizer {
|
|
34
34
|
app;
|
|
@@ -148,7 +148,7 @@ export class Adminizer {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
await bindDashboardWidgets(this);
|
|
151
|
-
|
|
151
|
+
bindNavigation(this);
|
|
152
152
|
// bindMediaManager(this);
|
|
153
153
|
await bindAccessRights(this);
|
|
154
154
|
if (I18n.appendLocale) {
|
package/lib/requestProcessor.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isObject } from "../helpers/JsUtils";
|
|
1
2
|
import { Adminizer } from "./Adminizer";
|
|
2
3
|
/**
|
|
3
4
|
* Default helper that will contain all methods
|
|
@@ -29,11 +30,17 @@ export class RequestProcessor {
|
|
|
29
30
|
}
|
|
30
31
|
for (let key in postParams) {
|
|
31
32
|
let field = fields[key];
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
continue;
|
|
33
|
+
if (key === 'sort') {
|
|
34
|
+
console.log(fields[key], key, postParams[key]);
|
|
35
35
|
}
|
|
36
|
+
// if (field.model.type === 'boolean') {
|
|
37
|
+
// postParams[key] = ['true', '1', 'yes', "TRUE", "on"].includes(postParams[key].toString().toLowerCase());
|
|
38
|
+
// continue;
|
|
39
|
+
// }
|
|
36
40
|
if (field.model.type === 'number') {
|
|
41
|
+
if (isObject(field.config) && field.config.type === "boolean" && typeof postParams[key] === "boolean") {
|
|
42
|
+
postParams[key] = postParams[key] ? 1 : 0;
|
|
43
|
+
}
|
|
37
44
|
postParams[key] = parseFloat(postParams[key]);
|
|
38
45
|
}
|
|
39
46
|
if (field.model.type === 'json') {
|
package/lib/v4/DataAccessor.js
CHANGED
|
@@ -88,9 +88,9 @@ export class DataAccessor {
|
|
|
88
88
|
const model = this.adminizer.modelHandler.model.get(modelName);
|
|
89
89
|
if (model) {
|
|
90
90
|
populatedModelFieldsConfig = this.getAssociatedFieldsConfig(modelName);
|
|
91
|
-
let _modelConfig = this.adminizer.config.models[
|
|
91
|
+
let _modelConfig = this.adminizer.config.models[modelName];
|
|
92
92
|
if (!isObject(_modelConfig))
|
|
93
|
-
throw `type error: model config of ${
|
|
93
|
+
throw `type error: model config of ${modelName} is ${typeof (this.adminizer.config.models[modelName])} expected object`;
|
|
94
94
|
associatedModelConfig = _modelConfig;
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
@@ -112,7 +112,7 @@ export class DataAccessor {
|
|
|
112
112
|
}
|
|
113
113
|
getAssociatedFieldsConfig(modelName) {
|
|
114
114
|
const model = this.adminizer.modelHandler.model.get(modelName);
|
|
115
|
-
if (!model || !this.adminizer.config.models[
|
|
115
|
+
if (!model || !this.adminizer.config.models[modelName] || typeof this.adminizer.config.models[modelName] === "boolean") {
|
|
116
116
|
return undefined;
|
|
117
117
|
}
|
|
118
118
|
// Check if user has access to the associated model
|
|
@@ -122,7 +122,7 @@ export class DataAccessor {
|
|
|
122
122
|
return undefined;
|
|
123
123
|
}
|
|
124
124
|
const associatedFields = {};
|
|
125
|
-
const modelConfig = this.adminizer.config.models[
|
|
125
|
+
const modelConfig = this.adminizer.config.models[modelName];
|
|
126
126
|
if (!isObject(modelConfig))
|
|
127
127
|
throw `Type error ModelConfig should is object`;
|
|
128
128
|
// Get the main fields configuration
|