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,531 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import {AbstractCatalog, AbstractGroup, AbstractItem, ActionHandler, Item} from "./AbstractCatalog";
|
|
3
|
-
// import {ModelConfig, NavigationConfig} from "../../interfaces/adminpanelConfig";
|
|
4
|
-
// import * as fs from "node:fs";
|
|
5
|
-
//
|
|
6
|
-
// import ejs from 'ejs';
|
|
7
|
-
// import {v4 as uuid} from "uuid";
|
|
8
|
-
// import {ViewsHelper} from "../../helpers/viewsHelper";
|
|
9
|
-
// import {Adminizer} from "../Adminizer";
|
|
10
|
-
//
|
|
11
|
-
// export interface NavItem extends Item {
|
|
12
|
-
// urlPath?: any;
|
|
13
|
-
// modelId?: string | number;
|
|
14
|
-
// targetBlank?: boolean
|
|
15
|
-
// }
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// class StorageService {
|
|
19
|
-
// protected storageMap: Map<string | number, NavItem> = new Map();
|
|
20
|
-
// protected id: string
|
|
21
|
-
// protected model: string
|
|
22
|
-
// protected readonly adminizer: Adminizer
|
|
23
|
-
//
|
|
24
|
-
// constructor(adminizer: Adminizer, id: string, model: string) {
|
|
25
|
-
// this.adminizer = adminizer;
|
|
26
|
-
// this.id = id
|
|
27
|
-
// this.model = model.toLowerCase()
|
|
28
|
-
// this.initModel()
|
|
29
|
-
// }
|
|
30
|
-
//
|
|
31
|
-
// protected async initModel() {
|
|
32
|
-
// try {
|
|
33
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
34
|
-
// const navigation = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ label: this.id });
|
|
35
|
-
//
|
|
36
|
-
// if (navigation) {
|
|
37
|
-
// Adminizer.log.info(`Found existing navigation: ${this.id}`);
|
|
38
|
-
// await this.populateFromTree(navigation.tree);
|
|
39
|
-
// } else {
|
|
40
|
-
// const newNavigation = { label: this.id, tree: [] as any };
|
|
41
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
42
|
-
// await this.adminizer.modelHandler.model.get(this.model)["_create"](newNavigation);
|
|
43
|
-
// Adminizer.log.info(`Created a new navigation: ${this.id}`);
|
|
44
|
-
// }
|
|
45
|
-
// } catch (error) {
|
|
46
|
-
// throw error;
|
|
47
|
-
// }
|
|
48
|
-
// }
|
|
49
|
-
//
|
|
50
|
-
// public getId() {
|
|
51
|
-
// return this.id
|
|
52
|
-
// }
|
|
53
|
-
//
|
|
54
|
-
// public async buildTree(): Promise<any> {
|
|
55
|
-
// const rootElements: NavItem[] = await this.findElementsByParentId(null, null);
|
|
56
|
-
// const buildSubTree = async (elements: NavItem[]): Promise<any[]> => {
|
|
57
|
-
// const tree = [];
|
|
58
|
-
// for (const element of elements) {
|
|
59
|
-
// const children = await this.findElementsByParentId(element.id, null);
|
|
60
|
-
// tree.push({
|
|
61
|
-
// ...element,
|
|
62
|
-
// children: await buildSubTree(children)
|
|
63
|
-
// });
|
|
64
|
-
// }
|
|
65
|
-
// return tree;
|
|
66
|
-
// };
|
|
67
|
-
//
|
|
68
|
-
// let tree = await buildSubTree(rootElements);
|
|
69
|
-
//
|
|
70
|
-
// function sortTree(items: any[]) {
|
|
71
|
-
// items.sort((a, b) => a.sortOrder - b.sortOrder);
|
|
72
|
-
//
|
|
73
|
-
// for (let i = 0; i < items.length; i++) {
|
|
74
|
-
// const item = items[i];
|
|
75
|
-
// if (item.children) {
|
|
76
|
-
// sortTree(item.children);
|
|
77
|
-
// }
|
|
78
|
-
// }
|
|
79
|
-
// }
|
|
80
|
-
//
|
|
81
|
-
// sortTree(tree)
|
|
82
|
-
// return tree
|
|
83
|
-
// }
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
// public async populateFromTree(tree: any[]): Promise<void> {
|
|
87
|
-
// const traverseTree = async (node: any, parentId: string | number | null = null): Promise<void> => {
|
|
88
|
-
// const {children, ...itemData} = node;
|
|
89
|
-
// const item = {...itemData, parentId} as NavItem;
|
|
90
|
-
// await this.setElement(item.id, item);
|
|
91
|
-
//
|
|
92
|
-
// if (children && children.length > 0) {
|
|
93
|
-
// for (const child of children) {
|
|
94
|
-
// await traverseTree(child, item.id);
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
|
-
// };
|
|
98
|
-
//
|
|
99
|
-
// for (const node of tree) {
|
|
100
|
-
// await traverseTree(node);
|
|
101
|
-
// }
|
|
102
|
-
// }
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
// public async setElement(id: string | number, item: NavItem): Promise<NavItem> {
|
|
106
|
-
// this.storageMap.set(item.id, item);
|
|
107
|
-
// await this.saveToDB()
|
|
108
|
-
// // This like fetch in DB
|
|
109
|
-
// return this.findElementById(item.id);
|
|
110
|
-
// }
|
|
111
|
-
//
|
|
112
|
-
// public async removeElementById(id: string | number): Promise<void> {
|
|
113
|
-
// this.storageMap.delete(id);
|
|
114
|
-
// setTimeout(async () => {
|
|
115
|
-
// await this.saveToDB()
|
|
116
|
-
// }, 500)
|
|
117
|
-
//
|
|
118
|
-
// }
|
|
119
|
-
//
|
|
120
|
-
// public async findElementById(id: string | number): Promise<NavItem | undefined> {
|
|
121
|
-
// return this.storageMap.get(id);
|
|
122
|
-
// }
|
|
123
|
-
//
|
|
124
|
-
// public async findElementByModelId(modelId: string | number): Promise<NavItem[] | undefined> {
|
|
125
|
-
// const elements: NavItem[] = [];
|
|
126
|
-
// for (const item of this.storageMap.values()) {
|
|
127
|
-
// if (item.modelId === modelId) {
|
|
128
|
-
// elements.push(item)
|
|
129
|
-
// }
|
|
130
|
-
// }
|
|
131
|
-
// return elements;
|
|
132
|
-
// }
|
|
133
|
-
//
|
|
134
|
-
// public async saveToDB() {
|
|
135
|
-
// let tree = await this.buildTree()
|
|
136
|
-
// try {
|
|
137
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
138
|
-
// await this.adminizer.modelHandler.model.get(this.model)["_update"](
|
|
139
|
-
// {label: this.id},
|
|
140
|
-
// {tree: tree}
|
|
141
|
-
// )
|
|
142
|
-
// } catch (e) {
|
|
143
|
-
// throw 'navigation model update error'
|
|
144
|
-
// }
|
|
145
|
-
// }
|
|
146
|
-
//
|
|
147
|
-
// public async findElementsByParentId(parentId: string | number, type: string | null): Promise<NavItem[]> {
|
|
148
|
-
// const elements: NavItem[] = [];
|
|
149
|
-
// for (const item of this.storageMap.values()) {
|
|
150
|
-
// // Assuming each item has a parentId property
|
|
151
|
-
// if (type === null && item.parentId === parentId) {
|
|
152
|
-
// elements.push(item)
|
|
153
|
-
// continue
|
|
154
|
-
// }
|
|
155
|
-
// if (item.parentId === parentId && item.type === type) {
|
|
156
|
-
// elements.push(item);
|
|
157
|
-
// }
|
|
158
|
-
// }
|
|
159
|
-
//
|
|
160
|
-
// return elements;
|
|
161
|
-
// }
|
|
162
|
-
//
|
|
163
|
-
// public async getAllElements(): Promise<NavItem[]> {
|
|
164
|
-
// return Array.from(this.storageMap.values());
|
|
165
|
-
// }
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
// public async search(s: string, type: string): Promise<NavItem[]> {
|
|
169
|
-
// const lowerCaseQuery = s.toLowerCase(); // Convert query to lowercase for case-insensitive search
|
|
170
|
-
// const matchedElements: NavItem[] = [];
|
|
171
|
-
//
|
|
172
|
-
// for (const item of this.storageMap.values()) {
|
|
173
|
-
// // Check if item type matches the specified type
|
|
174
|
-
// if (item.type === type) {
|
|
175
|
-
// // Search by name
|
|
176
|
-
// if (item.name.toLowerCase().includes(lowerCaseQuery)) {
|
|
177
|
-
// matchedElements.push(item);
|
|
178
|
-
// }
|
|
179
|
-
// }
|
|
180
|
-
// }
|
|
181
|
-
//
|
|
182
|
-
// return matchedElements;
|
|
183
|
-
// }
|
|
184
|
-
// }
|
|
185
|
-
//
|
|
186
|
-
// export class StorageServices {
|
|
187
|
-
// protected static storages: StorageService[] = []
|
|
188
|
-
//
|
|
189
|
-
// public static add(storage: StorageService) {
|
|
190
|
-
// this.storages.push(storage)
|
|
191
|
-
// }
|
|
192
|
-
//
|
|
193
|
-
// public static get(id: string) {
|
|
194
|
-
// return this.storages.find(storage => storage.getId() === id)
|
|
195
|
-
// }
|
|
196
|
-
//
|
|
197
|
-
// public static getAll() {
|
|
198
|
-
// return this.storages
|
|
199
|
-
// }
|
|
200
|
-
// }
|
|
201
|
-
//
|
|
202
|
-
// export class Navigation extends AbstractCatalog {
|
|
203
|
-
// readonly name: string = 'Navigation';
|
|
204
|
-
// readonly slug: string = 'navigation';
|
|
205
|
-
// public readonly icon: string = "box";
|
|
206
|
-
// public readonly actionHandlers: ActionHandler[] = []
|
|
207
|
-
// public idList: string[] = []
|
|
208
|
-
//
|
|
209
|
-
// constructor(adminizer: Adminizer, config: NavigationConfig) {
|
|
210
|
-
// let items = []
|
|
211
|
-
// for (const configElement of config.items) {
|
|
212
|
-
// items.push(new NavigationItem(
|
|
213
|
-
// adminizer,
|
|
214
|
-
// configElement.title,
|
|
215
|
-
// configElement.model,
|
|
216
|
-
// config.model,
|
|
217
|
-
// configElement.urlPath
|
|
218
|
-
// ))
|
|
219
|
-
// }
|
|
220
|
-
// items.push(new NavigationGroup(adminizer, config.groupField))
|
|
221
|
-
// items.push(new LinkItem(adminizer))
|
|
222
|
-
// for (const section of config.sections) {
|
|
223
|
-
// StorageServices.add(new StorageService(adminizer, section, config.model))
|
|
224
|
-
// }
|
|
225
|
-
// super(adminizer, items);
|
|
226
|
-
// this.movingGroupsRootOnly = config.movingGroupsRootOnly
|
|
227
|
-
// this.idList = config.sections ?? []
|
|
228
|
-
// }
|
|
229
|
-
//
|
|
230
|
-
// async getIdList(){
|
|
231
|
-
// return this.idList
|
|
232
|
-
// }
|
|
233
|
-
// }
|
|
234
|
-
//
|
|
235
|
-
// class NavigationItem extends AbstractItem<NavItem> {
|
|
236
|
-
// readonly allowedRoot: boolean = true;
|
|
237
|
-
// readonly icon: string;
|
|
238
|
-
// readonly name: string;
|
|
239
|
-
// readonly type: string;
|
|
240
|
-
// protected model: string;
|
|
241
|
-
// protected navigationModel: string;
|
|
242
|
-
// public readonly actionHandlers: ActionHandler[] = []
|
|
243
|
-
// public readonly urlPath: any;
|
|
244
|
-
// protected readonly adminizer: Adminizer
|
|
245
|
-
//
|
|
246
|
-
// constructor(adminizer: Adminizer, name: string, model: string, navigationModel: string, urlPath: any) {
|
|
247
|
-
// super();
|
|
248
|
-
// this.name = name
|
|
249
|
-
// this.navigationModel = navigationModel
|
|
250
|
-
// this.model = model.toLowerCase()
|
|
251
|
-
// this.type = model.toLowerCase()
|
|
252
|
-
// this.urlPath = urlPath
|
|
253
|
-
// let configModel = adminizer.config.models[this.model] as ModelConfig
|
|
254
|
-
// this.icon = configModel.icon ?? 'file'
|
|
255
|
-
// this.adminizer = adminizer;
|
|
256
|
-
// }
|
|
257
|
-
//
|
|
258
|
-
// async create(data: any, catalogId: string): Promise<NavItem> {
|
|
259
|
-
// let storage = StorageServices.get(catalogId)
|
|
260
|
-
// let storageData = null
|
|
261
|
-
// if (data._method === 'select') {
|
|
262
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
263
|
-
// let record = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({id: data.record})
|
|
264
|
-
// storageData = await this.dataPreparation({
|
|
265
|
-
// record: record,
|
|
266
|
-
// parentId: data.parentId,
|
|
267
|
-
// targetBlank: data.targetBlank
|
|
268
|
-
// }, catalogId)
|
|
269
|
-
// } else {
|
|
270
|
-
// storageData = await this.dataPreparation(data, catalogId)
|
|
271
|
-
// }
|
|
272
|
-
// return await storage.setElement(data.id, storageData) as NavItem;
|
|
273
|
-
// }
|
|
274
|
-
//
|
|
275
|
-
// protected async dataPreparation(data: any, catalogId: string, sortOrder?: number) {
|
|
276
|
-
// let storage = StorageServices.get(catalogId)
|
|
277
|
-
// let urlPath = eval('`' + this.urlPath + '`')
|
|
278
|
-
// let parentId = data.parentId ? data.parentId : null
|
|
279
|
-
// return {
|
|
280
|
-
// id: uuid(),
|
|
281
|
-
// modelId: data.record.id,
|
|
282
|
-
// targetBlank: data.targetBlank ?? data.record.targetBlank,
|
|
283
|
-
// name: data.record.name ?? data.record.title ?? data.record.id,
|
|
284
|
-
// parentId: parentId,
|
|
285
|
-
// sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
|
|
286
|
-
// icon: this.icon,
|
|
287
|
-
// type: this.type,
|
|
288
|
-
// urlPath: urlPath
|
|
289
|
-
// }
|
|
290
|
-
// }
|
|
291
|
-
//
|
|
292
|
-
// async updateModelItems(modelId: string | number, data: any, catalogId: string): Promise<NavItem> {
|
|
293
|
-
// let storage = StorageServices.get(catalogId)
|
|
294
|
-
// let items = await storage.findElementByModelId(modelId)
|
|
295
|
-
// let urlPath = eval('`' + this.urlPath + '`')
|
|
296
|
-
// for (const item of items) {
|
|
297
|
-
// item.name = data.record.name
|
|
298
|
-
// item.urlPath = urlPath
|
|
299
|
-
// if (item.id === data.record.treeId) {
|
|
300
|
-
// item.targetBlank = data.record.targetBlank
|
|
301
|
-
// }
|
|
302
|
-
// await storage.setElement(item.id, item);
|
|
303
|
-
// }
|
|
304
|
-
// return Promise.resolve(undefined)
|
|
305
|
-
// }
|
|
306
|
-
//
|
|
307
|
-
// async update(itemId: string | number, data: any, catalogId: string): Promise<NavItem> {
|
|
308
|
-
// let storage = StorageServices.get(catalogId)
|
|
309
|
-
// return await storage.setElement(itemId, data);
|
|
310
|
-
// }
|
|
311
|
-
//
|
|
312
|
-
// async deleteItem(itemId: string | number, catalogId: string): Promise<void> {
|
|
313
|
-
// let storage = StorageServices.get(catalogId)
|
|
314
|
-
// return await storage.removeElementById(itemId);
|
|
315
|
-
// }
|
|
316
|
-
//
|
|
317
|
-
// async find(itemId: string | number, catalogId: string): Promise<NavItem> {
|
|
318
|
-
// let storage = StorageServices.get(catalogId)
|
|
319
|
-
// return await storage.findElementById(itemId);
|
|
320
|
-
// }
|
|
321
|
-
//
|
|
322
|
-
// async getAddHTML(req: ReqType): Promise<{ type: "link" | "html" | "jsonForm"; data: string }> {
|
|
323
|
-
// let type: 'html' = 'html'
|
|
324
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
325
|
-
// let items = await this.adminizer.modelHandler.model.get(this.model)["_find"]({})
|
|
326
|
-
//
|
|
327
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
328
|
-
// req.i18n.setLocale(req.user.locale);
|
|
329
|
-
// const __ = (s: string) => {
|
|
330
|
-
// return req.i18n.__(s)
|
|
331
|
-
// }
|
|
332
|
-
//
|
|
333
|
-
// return {
|
|
334
|
-
// type: type,
|
|
335
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/itemHTMLAdd.ejs'), 'utf8'), {
|
|
336
|
-
// items: items,
|
|
337
|
-
// item: {name: this.name, type: this.type, model: this.model},
|
|
338
|
-
// __: __
|
|
339
|
-
// }),
|
|
340
|
-
// }
|
|
341
|
-
// }
|
|
342
|
-
//
|
|
343
|
-
// async getChilds(parentId: string | number | null, catalogId: string): Promise<NavItem[]> {
|
|
344
|
-
// let storage = StorageServices.get(catalogId)
|
|
345
|
-
// return await storage.findElementsByParentId(parentId, this.type);
|
|
346
|
-
// }
|
|
347
|
-
//
|
|
348
|
-
// async getEditHTML(id: string | number, catalogId: string, req: ReqType, modelId: string | number): Promise<{
|
|
349
|
-
// type: "link" | "html" | "jsonForm";
|
|
350
|
-
// data: string
|
|
351
|
-
// }> {
|
|
352
|
-
// let item = await this.find(id, catalogId)
|
|
353
|
-
// let type: 'html' = 'html'
|
|
354
|
-
//
|
|
355
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
356
|
-
// req.i18n.setLocale(req.user.locale);
|
|
357
|
-
// const __ = (s: string) => {
|
|
358
|
-
// return req.i18n.__(s)
|
|
359
|
-
// }
|
|
360
|
-
//
|
|
361
|
-
// return Promise.resolve({
|
|
362
|
-
// type: type,
|
|
363
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/itemHTMLEdit.ejs'), 'utf8'), {item: item, __: __})
|
|
364
|
-
// })
|
|
365
|
-
// }
|
|
366
|
-
//
|
|
367
|
-
// async search(s: string, catalogId: string): Promise<NavItem[]> {
|
|
368
|
-
// let storage = StorageServices.get(catalogId)
|
|
369
|
-
// return await storage.search(s, this.type);
|
|
370
|
-
// }
|
|
371
|
-
//
|
|
372
|
-
// }
|
|
373
|
-
//
|
|
374
|
-
// class NavigationGroup extends AbstractGroup<NavItem> {
|
|
375
|
-
// readonly allowedRoot: boolean = true;
|
|
376
|
-
// readonly name: string = "Group";
|
|
377
|
-
// readonly groupField: object[]
|
|
378
|
-
// protected readonly adminizer: Adminizer
|
|
379
|
-
//
|
|
380
|
-
// constructor(adminizer: Adminizer, groupField: object[]) {
|
|
381
|
-
// super();
|
|
382
|
-
// this.groupField = groupField
|
|
383
|
-
// this.adminizer = adminizer;
|
|
384
|
-
// }
|
|
385
|
-
//
|
|
386
|
-
// async create(data: any, catalogId: string): Promise<NavItem> {
|
|
387
|
-
// let storage = StorageServices.get(catalogId)
|
|
388
|
-
//
|
|
389
|
-
// let storageData = await this.dataPreparation(data, catalogId)
|
|
390
|
-
// delete data.name
|
|
391
|
-
// delete data.parentId
|
|
392
|
-
// storageData = {...storageData, ...data}
|
|
393
|
-
//
|
|
394
|
-
// return await storage.setElement(storageData.id, storageData) as NavItem;
|
|
395
|
-
// }
|
|
396
|
-
//
|
|
397
|
-
// protected async dataPreparation(data: any, catalogId: string, sortOrder?: number) {
|
|
398
|
-
// let storage = StorageServices.get(catalogId)
|
|
399
|
-
// let parentId = data.parentId ? data.parentId : null
|
|
400
|
-
// return {
|
|
401
|
-
// id: uuid(),
|
|
402
|
-
// name: data.name,
|
|
403
|
-
// targetBlank: data.targetBlank,
|
|
404
|
-
// parentId: parentId,
|
|
405
|
-
// sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
|
|
406
|
-
// icon: this.icon,
|
|
407
|
-
// type: this.type
|
|
408
|
-
// }
|
|
409
|
-
// }
|
|
410
|
-
//
|
|
411
|
-
// async deleteItem(itemId: string | number, catalogId: string): Promise<void> {
|
|
412
|
-
// let storage = StorageServices.get(catalogId)
|
|
413
|
-
// return await storage.removeElementById(itemId);
|
|
414
|
-
// }
|
|
415
|
-
//
|
|
416
|
-
// async find(itemId: string | number, catalogId: string): Promise<NavItem> {
|
|
417
|
-
// let storage = StorageServices.get(catalogId)
|
|
418
|
-
// return await storage.findElementById(itemId);
|
|
419
|
-
// }
|
|
420
|
-
//
|
|
421
|
-
// async update(itemId: string | number, data: any, catalogId: string): Promise<NavItem> {
|
|
422
|
-
// let storage = StorageServices.get(catalogId)
|
|
423
|
-
// return await storage.setElement(itemId, data);
|
|
424
|
-
// }
|
|
425
|
-
//
|
|
426
|
-
// async updateModelItems(modelId: string | number, data: NavItem, catalogId: string): Promise<NavItem> {
|
|
427
|
-
// let storage = StorageServices.get(catalogId)
|
|
428
|
-
// return await storage.setElement(modelId, data);
|
|
429
|
-
// }
|
|
430
|
-
//
|
|
431
|
-
// getAddHTML(req: ReqType): Promise<{ type: "link" | "html" | "jsonForm"; data: string }> {
|
|
432
|
-
// let type: 'html' = 'html'
|
|
433
|
-
//
|
|
434
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
435
|
-
// req.i18n.setLocale(req.user.locale);
|
|
436
|
-
// const __ = (s: string) => {
|
|
437
|
-
// return req.i18n.__(s)
|
|
438
|
-
// }
|
|
439
|
-
//
|
|
440
|
-
// return Promise.resolve({
|
|
441
|
-
// type: type,
|
|
442
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/GroupHTMLAdd.ejs'), 'utf8'), {
|
|
443
|
-
// fields: this.groupField,
|
|
444
|
-
// __: __
|
|
445
|
-
// }),
|
|
446
|
-
// })
|
|
447
|
-
// }
|
|
448
|
-
//
|
|
449
|
-
// async getChilds(parentId: string | number | null, catalogId: string): Promise<NavItem[]> {
|
|
450
|
-
// let storage = StorageServices.get(catalogId)
|
|
451
|
-
// return await storage.findElementsByParentId(parentId, this.type);
|
|
452
|
-
// }
|
|
453
|
-
//
|
|
454
|
-
// async getEditHTML(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
|
|
455
|
-
// type: "link" | "html" | "jsonForm";
|
|
456
|
-
// data: string
|
|
457
|
-
// }> {
|
|
458
|
-
// let type: 'html' = 'html'
|
|
459
|
-
// let item = await this.find(id, catalogId)
|
|
460
|
-
//
|
|
461
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
462
|
-
// req.i18n.setLocale(req.user.locale);
|
|
463
|
-
// const __ = (s: string) => {
|
|
464
|
-
// return req.i18n.__(s)
|
|
465
|
-
// }
|
|
466
|
-
//
|
|
467
|
-
// return Promise.resolve({
|
|
468
|
-
// type: type,
|
|
469
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/GroupHTMLEdit.ejs'), 'utf8'), {
|
|
470
|
-
// fields: this.groupField,
|
|
471
|
-
// item: item,
|
|
472
|
-
// __: __
|
|
473
|
-
// }),
|
|
474
|
-
// })
|
|
475
|
-
// }
|
|
476
|
-
//
|
|
477
|
-
// async search(s: string, catalogId: string): Promise<NavItem[]> {
|
|
478
|
-
// let storage = StorageServices.get(catalogId)
|
|
479
|
-
// return await storage.search(s, this.type);
|
|
480
|
-
// }
|
|
481
|
-
//
|
|
482
|
-
//
|
|
483
|
-
// }
|
|
484
|
-
//
|
|
485
|
-
// class LinkItem extends NavigationGroup {
|
|
486
|
-
// readonly allowedRoot: boolean = true;
|
|
487
|
-
// readonly icon: string = 'external-link-alt';
|
|
488
|
-
// readonly name: string = 'Link';
|
|
489
|
-
// readonly type: string = 'link';
|
|
490
|
-
// readonly isGroup: boolean = false;
|
|
491
|
-
//
|
|
492
|
-
// constructor(adminizer: Adminizer) {
|
|
493
|
-
// super(adminizer, []);
|
|
494
|
-
// }
|
|
495
|
-
//
|
|
496
|
-
// getAddHTML(req: ReqType): Promise<{ type: "link" | "html" | "jsonForm"; data: string }> {
|
|
497
|
-
// let type: 'html' = 'html'
|
|
498
|
-
// req.i18n.setLocale(req.user.locale);
|
|
499
|
-
//
|
|
500
|
-
// const __ = (s: string) => {
|
|
501
|
-
// return req.i18n.__(s)
|
|
502
|
-
// }
|
|
503
|
-
// return Promise.resolve({
|
|
504
|
-
// type: type,
|
|
505
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/LinkItemAdd.ejs'), 'utf8'), {__: __}),
|
|
506
|
-
// })
|
|
507
|
-
// }
|
|
508
|
-
//
|
|
509
|
-
// async getEditHTML(id: string | number, catalogId: string, req: ReqType): Promise<{
|
|
510
|
-
// type: "link" | "html" | "jsonForm";
|
|
511
|
-
// data: string
|
|
512
|
-
// }> {
|
|
513
|
-
// let type: 'html' = 'html'
|
|
514
|
-
// let item = await this.find(id, catalogId)
|
|
515
|
-
//
|
|
516
|
-
// req.i18n.setLocale(req.user.locale);
|
|
517
|
-
// const __ = (s: string) => {
|
|
518
|
-
// return req.i18n.__(s)
|
|
519
|
-
// }
|
|
520
|
-
//
|
|
521
|
-
// return Promise.resolve({
|
|
522
|
-
// type: type,
|
|
523
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/LinkItemEdit.ejs'), 'utf8'), {
|
|
524
|
-
// fields: this.groupField,
|
|
525
|
-
// item: item,
|
|
526
|
-
// __: __
|
|
527
|
-
// }),
|
|
528
|
-
// })
|
|
529
|
-
// }
|
|
530
|
-
//
|
|
531
|
-
// }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|