adminizer 4.1.0-build.34 → 4.1.0-build.35

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.
Files changed (31) hide show
  1. package/assets/{add-NjsCZZct.js → add-VGaP5zEb.js} +1 -1
  2. package/assets/{add-form-DJnEBqvy.js → add-form-DAMJbss4.js} +1 -1
  3. package/assets/{app-DVaaqBB5.css → app-DVDnphrb.css} +1 -1
  4. package/assets/app.js +2 -2
  5. package/assets/catalog-C88wv-rq.js +16 -0
  6. package/assets/{dashboard-BTmXuc5F.js → dashboard-DKUwxgt4.js} +1 -1
  7. package/assets/{dialog-stack-BAuaxCy1.js → dialog-stack-V6c1TlnC.js} +1 -1
  8. package/assets/field-renderer-zGC76llY.js +1 -1
  9. package/assets/{form-DOt5Fa6e.js → form-BMth9K43.js} +1 -1
  10. package/assets/{form-CN2xVSMK.js → form-DkRGBp5e.js} +1 -1
  11. package/assets/{home-3FBATYFh.js → home-lYdYhEcS.js} +2 -2
  12. package/assets/{init-user-BBfP40-3.js → init-user-GyTJdhrh.js} +1 -1
  13. package/assets/{list-DqIUjXSX.js → list-B-EsqncQ.js} +1 -1
  14. package/assets/{list-table-1aXDvDPl.js → list-table-DqU7Spnz.js} +1 -1
  15. package/assets/{login-Bv4hqwaM.js → login-BMJ97XcF.js} +1 -1
  16. package/assets/manifest.json +90 -152
  17. package/assets/module-CsWq478Z.js +1 -0
  18. package/assets/{register-D8SyTFBZ.js → register-CcA8kQ56.js} +1 -1
  19. package/assets/sonner-Dp8PyHu_.js +1 -0
  20. package/controllers/catalog/Catalog.js +2 -3
  21. package/controllers/catalog/FrontentCatalogAdapter.d.ts +4 -8
  22. package/controllers/catalog/FrontentCatalogAdapter.js +20 -22
  23. package/lib/v4/catalog/AbstractCatalog.d.ts +12 -23
  24. package/lib/v4/catalog/AbstractCatalog.js +5 -7
  25. package/package.json +1 -1
  26. package/system/bindModels.js +1 -1
  27. package/assets/catalog-CeUUKxG9.js +0 -17
  28. package/assets/group-link-add-CCNISxeF.js +0 -1
  29. package/assets/item-add-CX7EOX0H.js +0 -1
  30. package/assets/module-DziT22BH.js +0 -1
  31. package/assets/sonner-MAL0i2dq.js +0 -1
@@ -39,6 +39,8 @@ export class VueCatalog {
39
39
  "OR": "",
40
40
  "Open in a new window": "",
41
41
  "Clean": "",
42
+ "Performing an action...": "",
43
+ "Action completed": "",
42
44
  };
43
45
  obj[this.catalog.name] = "";
44
46
  for (const actionHandler of this.catalog.actionHandlers) {
@@ -65,19 +67,15 @@ export class VueCatalog {
65
67
  return (await this.catalog.getActions(arrItems))?.filter(e => e.displayContext);
66
68
  }
67
69
  }
68
- async handleAction(actionId, items, config, req) {
70
+ async handleAction(actionId, items, req) {
69
71
  let arrItems = [];
70
72
  for (const item of items) {
71
73
  arrItems.push(await this.catalog.find(item.data));
72
74
  }
73
- return this.catalog.handleAction(actionId, arrItems, config, req);
75
+ return this.catalog.handleAction(actionId, arrItems, req);
74
76
  }
75
- /**
76
- * @deprecated reason: migration for intertia
77
- * // TODO: need passing custom React module
78
- */
79
- async getPopUpHTML(actionId) {
80
- return this.catalog.getPopUpHTML(actionId);
77
+ async getPopUpTemplate(actionId) {
78
+ return this.catalog.getPopUpTemplate(actionId);
81
79
  }
82
80
  async getLink(actionId) {
83
81
  return this.catalog.getLink(actionId);
@@ -88,15 +86,15 @@ export class VueCatalog {
88
86
  return VueCatalogUtils.arrayToNode(rootItems, this.catalog.getGroupType().type);
89
87
  }
90
88
  async createItem(data, req) {
89
+ // TODO It's not clear why it's here.
91
90
  //data = VueCatalogUtils.refinement(data);
92
- if (this.catalog.slug !== "navigation") {
93
- let item = data.record;
94
- item.parenId = data.parenId;
95
- return await this.catalog.createItem(item, req);
96
- }
97
- else {
98
- return await this.catalog.createItem(data, req);
99
- }
91
+ // if (this.catalog.slug !== "navigation") {
92
+ // let item = data.record;
93
+ // item.parenId = data.parenId;
94
+ // return await this.catalog.createItem(item, req);
95
+ // } else {
96
+ return await this.catalog.createItem(data, req);
97
+ // }
100
98
  }
101
99
  async getChilds(data, req) {
102
100
  data = VueCatalogUtils.refinement(data);
@@ -129,13 +127,13 @@ export class VueCatalog {
129
127
  return Promise.resolve('ok');
130
128
  }
131
129
  async updateItem(item, modelId, data, req) {
130
+ //TODO It's not clear why it's here.
132
131
  //data = VueCatalogUtils.refinement(data);
133
- if (this.catalog.slug !== "navigation") {
134
- return await this.catalog.updateModelItems(data.modelId, data.type, data.record, req);
135
- }
136
- else {
137
- return await this.catalog.updateModelItems(modelId, item.type, data, req);
138
- }
132
+ // if (this.catalog.slug !== "navigation") {
133
+ // return await this.catalog.updateModelItems(data.modelId, data.type, data.record, req);
134
+ // } else {
135
+ return await this.catalog.updateModelItems(modelId, item.type, data, req);
136
+ // }
139
137
  }
140
138
  async deleteItem(item, req) {
141
139
  // Получаем всех непосредственных потомков текущего элемента
@@ -1,4 +1,3 @@
1
- import { JSONSchema4 } from "json-schema";
2
1
  import { Adminizer } from "../../Adminizer";
3
2
  /**
4
3
  * Interface `Item` describes the data that the UI will operate on
@@ -91,7 +90,7 @@ export declare abstract class BaseItem<T extends Item> {
91
90
  * @param req
92
91
  */
93
92
  abstract getAddTemplate(req: ReqType): Promise<{
94
- type: 'component' | 'navigation.item' | 'navigation.group' | 'navigation.link' | 'model';
93
+ type: 'component' | 'navigation.group' | 'navigation.link' | 'model';
95
94
  data: any;
96
95
  }>;
97
96
  /**
@@ -102,7 +101,7 @@ export declare abstract class BaseItem<T extends Item> {
102
101
  * @param modelId
103
102
  */
104
103
  abstract getEditTemplate(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
105
- type: 'component' | 'navigation.item' | 'navigation.group' | 'navigation.link' | 'model';
104
+ type: 'component' | 'navigation.group' | 'navigation.link' | 'model';
106
105
  data: any;
107
106
  }>;
108
107
  _getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
@@ -122,7 +121,7 @@ export declare abstract class ActionHandler {
122
121
  * Three actions are possible, without configuration, configuration via pop-up, and just external action
123
122
  * For the first two, a handler is provided, but the third type of action simply calls the HTML in the popup; the controller will be implemented externally
124
123
  * */
125
- abstract readonly type: "basic" | "json-forms" | "external" | "link" | "partial";
124
+ abstract readonly type: "basic" | "external" | "link";
126
125
  /**
127
126
  * Will be shown in the context menu section
128
127
  */
@@ -131,18 +130,10 @@ export declare abstract class ActionHandler {
131
130
  * Will be shown in the toolbox section
132
131
  */
133
132
  abstract readonly displayTool: boolean;
134
- /** (!*1)
135
- * Only for json-forms
136
- * ref: https://jsonforms.io/docs
137
- */
138
- abstract readonly uiSchema: any;
139
- abstract readonly jsonSchema: JSONSchema4;
140
133
  /**
141
- * For "json-forms" | "external"
142
- * @deprecated reason: migration for intertia
143
- * // TODO: need passing custom React module
134
+ * For "external"
144
135
  */
145
- abstract getPopUpHTML(data?: any): Promise<string>;
136
+ abstract getPopUpTemplate(data?: any): Promise<string>;
146
137
  /**
147
138
  * Only for link type
148
139
  */
@@ -161,9 +152,9 @@ export declare abstract class ActionHandler {
161
152
  * Implementation of a method that will do something with elements.
162
153
  * there's really not much you can do with the context menu
163
154
  * @param items
164
- * @param config
155
+ * @param req
165
156
  */
166
- abstract handler(items: Item[], data?: any, req?: ReqType): Promise<void>;
157
+ abstract handler(items: Item[], req?: ReqType): Promise<void>;
167
158
  }
168
159
  /**
169
160
  *
@@ -238,7 +229,7 @@ export declare abstract class AbstractCatalog {
238
229
  * @param modelId
239
230
  */
240
231
  getEditTemplate(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
241
- type: "component" | "navigation.item" | "navigation.group" | "navigation.link" | "model";
232
+ type: "component" | "navigation.group" | "navigation.link" | "model";
242
233
  data: any;
243
234
  }>;
244
235
  /**
@@ -247,7 +238,7 @@ export declare abstract class AbstractCatalog {
247
238
  * @param req
248
239
  */
249
240
  getAddTemplate(item: Item, req: ReqType): Promise<{
250
- type: "component" | "navigation.item" | "navigation.group" | "navigation.link" | "model";
241
+ type: "component" | "navigation.group" | "navigation.link" | "model";
251
242
  data: any;
252
243
  }>;
253
244
  addActionHandler(actionHandler: ActionHandler): void;
@@ -259,19 +250,17 @@ export declare abstract class AbstractCatalog {
259
250
  /**
260
251
  * Implements search and execution of a specific action.handler
261
252
  */
262
- handleAction(actionId: string, items?: Item[], config?: any, req?: ReqType): Promise<void>;
253
+ handleAction(actionId: string, items?: Item[], req?: ReqType): Promise<void>;
263
254
  /**
264
255
  * Only For a Link action
265
256
  * @param actionId
266
257
  */
267
258
  getLink(actionId: string): Promise<string>;
268
259
  /**
269
- * For Extermal and JsonForms actions
260
+ * For Extermal and actions
270
261
  * @param actionId
271
- * @deprecated reason: migration for intertia
272
- * // TODO: need passing custom React module
273
262
  */
274
- getPopUpHTML(actionId: string): Promise<string>;
263
+ getPopUpTemplate(actionId: string): Promise<string>;
275
264
  /**
276
265
  *
277
266
  * @param data
@@ -194,7 +194,7 @@ export class AbstractCatalog {
194
194
  /**
195
195
  * Implements search and execution of a specific action.handler
196
196
  */
197
- async handleAction(actionId, items, config, req) {
197
+ async handleAction(actionId, items, req) {
198
198
  let action = null;
199
199
  if (items.length === 1) {
200
200
  const item = items[0];
@@ -211,7 +211,7 @@ export class AbstractCatalog {
211
211
  }
212
212
  if (!action)
213
213
  throw `Action with id \`${actionId}\` not found`;
214
- return await action.handler(items, config, req);
214
+ return await action.handler(items, req);
215
215
  }
216
216
  /**
217
217
  * Only For a Link action
@@ -221,13 +221,11 @@ export class AbstractCatalog {
221
221
  return this.actionHandlers.find((it) => it.id === actionId)?.getLink();
222
222
  }
223
223
  /**
224
- * For Extermal and JsonForms actions
224
+ * For Extermal and actions
225
225
  * @param actionId
226
- * @deprecated reason: migration for intertia
227
- * // TODO: need passing custom React module
228
226
  */
229
- async getPopUpHTML(actionId) {
230
- return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpHTML();
227
+ async getPopUpTemplate(actionId) {
228
+ return this.actionHandlers.find((it) => it.id === actionId)?.getPopUpTemplate();
231
229
  }
232
230
  /**
233
231
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.1.0-build.34",
4
+ "version": "4.1.0-build.35",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "vitest --reporter verbose",
@@ -30,7 +30,7 @@ export default async function bindModels(adminizer) {
30
30
  const modelConfig = Object.entries(adminizer.config.models)
31
31
  .find(([key, value]) => value && typeof value !== "boolean" && value.model.toLowerCase() === modelName)?.[1];
32
32
  if (!systemModels.includes(modelName)) {
33
- const adapterName = typeof modelConfig !== "boolean" ? modelConfig.adapter || defaultOrmAdapter : defaultOrmAdapter;
33
+ const adapterName = typeof modelConfig !== "boolean" ? modelConfig?.adapter || defaultOrmAdapter : defaultOrmAdapter;
34
34
  const ormAdapter = adminizer.getOrmAdapter(adapterName);
35
35
  if (!ormAdapter) {
36
36
  throw new Error(`Adapter ${adapterName} was not found for model ${modelName}. Please check your configuration`);