adminizer 4.2.0-build.58 → 4.2.0-build.60

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.
@@ -105,7 +105,9 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
105
105
  options = getControlsOptions(fieldConfig, req, fieldType, 'leaflet');
106
106
  }
107
107
  if (type === 'mediamanager') {
108
- let mediaManager = MediaManagerHandler.get('default');
108
+ const mConfig = field.config;
109
+ const mOptions = mConfig?.options;
110
+ const mediaManager = MediaManagerHandler.get(mOptions.id || 'default');
109
111
  if (!mediaManager) {
110
112
  options = {};
111
113
  }
@@ -327,7 +327,7 @@ export interface TuiEditorFieldConfig extends BaseFieldConfig {
327
327
  options: TuiEditorOptions;
328
328
  }
329
329
  export interface MediaManagerOptionsField {
330
- id: string;
330
+ id: 'default' | string;
331
331
  group: string;
332
332
  config?: Record<string, any>;
333
333
  }
@@ -13,7 +13,6 @@ export class MediaManagerHandler {
13
13
  instance = this.managers[0];
14
14
  }
15
15
  if (!instance) {
16
- Adminizer.log.debug(`MediaManager list ${JSON.stringify(this.managers, null, 2)}`);
17
16
  Adminizer.log.debug(`MediaManager with id ${id} not found`);
18
17
  }
19
18
  Adminizer.log.debug(`ins`, instance);
@@ -1,8 +1,3 @@
1
- import { SwitchBase } from "./abstractSwitch";
2
- import { InfoBase } from "./abstractInfo";
3
- import { ActionBase } from "./abstractAction";
4
- import { LinkBase } from "./abstractLink";
5
- import { CustomBase } from "./abstractCustom";
6
1
  import * as process from "node:process";
7
2
  export class WidgetHandler {
8
3
  widgets = [];
@@ -40,7 +35,7 @@ export class WidgetHandler {
40
35
  if (this.widgets.length) {
41
36
  let id_key = 0;
42
37
  for (const widget of this.widgets) {
43
- if (widget instanceof SwitchBase) {
38
+ if (widget.widgetType === 'switcher') {
44
39
  if (this.adminizer.accessRightsHelper.hasPermission(`widget-${widget.id}`, user)) {
45
40
  widgets.push({
46
41
  id: `${widget.id}__${id_key}`,
@@ -54,7 +49,7 @@ export class WidgetHandler {
54
49
  });
55
50
  }
56
51
  }
57
- else if (widget instanceof InfoBase) {
52
+ else if (widget.widgetType === 'info') {
58
53
  if (this.adminizer.accessRightsHelper.hasPermission(`widget-${widget.id}`, user)) {
59
54
  widgets.push({
60
55
  id: `${widget.id}__${id_key}`,
@@ -68,7 +63,7 @@ export class WidgetHandler {
68
63
  });
69
64
  }
70
65
  }
71
- else if (widget instanceof ActionBase) {
66
+ else if (widget.widgetType === 'action') {
72
67
  if (this.adminizer.accessRightsHelper.hasPermission(`widget-${widget.id}`, user)) {
73
68
  widgets.push({
74
69
  id: `${widget.id}__${id_key}`,
@@ -82,7 +77,7 @@ export class WidgetHandler {
82
77
  });
83
78
  }
84
79
  }
85
- else if (widget instanceof LinkBase) {
80
+ else if (widget.widgetType === 'link') {
86
81
  if (this.adminizer.accessRightsHelper.hasPermission(`widget-${widget.id}`, user)) {
87
82
  let links_id_key = 0;
88
83
  for (const link of widget.links) {
@@ -100,7 +95,7 @@ export class WidgetHandler {
100
95
  }
101
96
  }
102
97
  }
103
- else if (widget instanceof CustomBase) {
98
+ else if (widget.widgetType === 'custom') {
104
99
  if (this.adminizer.accessRightsHelper.hasPermission(`widget-${widget.id}`, user)) {
105
100
  widgets.push({
106
101
  id: `${widget.id}_${id_key}`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.2.0-build.58",
4
+ "version": "4.2.0-build.60",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",