@xh/hoist 78.0.0-SNAPSHOT.1762310926429 → 78.0.0-SNAPSHOT.1762557528853
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/CHANGELOG.md +0 -5
- package/admin/tabs/cluster/instances/services/ServiceModel.ts +1 -7
- package/admin/tabs/general/config/ConfigPanelModel.ts +27 -31
- package/admin/tabs/userData/prefs/UserPreferenceModel.ts +6 -10
- package/admin/tabs/userData/prefs/editor/PrefEditorModel.ts +19 -26
- package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +18 -1
- package/build/types/desktop/cmp/rest/RestGridModel.d.ts +4 -5
- package/build/types/desktop/cmp/rest/impl/RestFormModel.d.ts +3 -3
- package/desktop/cmp/dash/canvas/DashCanvas.ts +1 -1
- package/desktop/cmp/dash/canvas/DashCanvasModel.ts +53 -16
- package/desktop/cmp/rest/RestGridModel.ts +9 -6
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -33,11 +33,6 @@
|
|
|
33
33
|
* Fixed `AgGridModel.getExpandState()` not returning a full representation of expanded groups -
|
|
34
34
|
an issue that primarily affected linked tree map visualizations.
|
|
35
35
|
|
|
36
|
-
### ⚙️ Technical
|
|
37
|
-
|
|
38
|
-
* Support Grails 7 service name conventions in admin client (backward compatible)
|
|
39
|
-
|
|
40
|
-
|
|
41
36
|
## 76.2.0 - 2025-10-22
|
|
42
37
|
|
|
43
38
|
### ⚙️ Technical
|
|
@@ -152,13 +152,7 @@ export class ServiceModel extends BaseInstanceModel {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
private processRawData(r: PlainObject) {
|
|
155
|
-
|
|
156
|
-
// For Grails >7, we provide class to determine provider
|
|
157
|
-
// TODO: simplify when Hoist v34+ required.
|
|
158
|
-
const provider =
|
|
159
|
-
r.name.startsWith('hoistCore') || r.className?.startsWith('io.xh.hoist')
|
|
160
|
-
? 'Hoist'
|
|
161
|
-
: 'App';
|
|
155
|
+
const provider = r.name && r.name.startsWith('hoistCore') ? 'Hoist' : 'App';
|
|
162
156
|
const displayName = lowerFirst(r.name.replace('hoistCore', ''));
|
|
163
157
|
return {provider, displayName, ...r};
|
|
164
158
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {exportFilenameWithDate} from '@xh/hoist/admin/AdminUtils';
|
|
8
8
|
import {AppModel} from '@xh/hoist/admin/AppModel';
|
|
9
9
|
import * as Col from '@xh/hoist/admin/columns';
|
|
10
|
-
import {
|
|
10
|
+
import {hbox, hspacer} from '@xh/hoist/cmp/layout';
|
|
11
11
|
import {HoistModel, LoadSpec, managed, XH} from '@xh/hoist/core';
|
|
12
12
|
import {FieldSpec} from '@xh/hoist/data';
|
|
13
13
|
import {defaultReadonlyRenderer} from '@xh/hoist/desktop/cmp/form';
|
|
@@ -17,14 +17,14 @@ import {
|
|
|
17
17
|
cloneAction,
|
|
18
18
|
deleteAction,
|
|
19
19
|
editAction,
|
|
20
|
-
RestGridModel
|
|
20
|
+
RestGridModel,
|
|
21
|
+
RestStore
|
|
21
22
|
} from '@xh/hoist/desktop/cmp/rest';
|
|
22
|
-
import {Icon} from '@xh/hoist/icon';
|
|
23
23
|
import {action, makeObservable, observable} from '@xh/hoist/mobx';
|
|
24
|
-
import {pluralize} from '@xh/hoist/utils/js';
|
|
25
24
|
import {isNil, truncate} from 'lodash';
|
|
26
25
|
import {DifferModel} from '../../../differ/DifferModel';
|
|
27
26
|
import {RegroupDialogModel} from '../../../regroup/RegroupDialogModel';
|
|
27
|
+
import {Icon} from '@xh/hoist/icon';
|
|
28
28
|
|
|
29
29
|
export class ConfigPanelModel extends HoistModel {
|
|
30
30
|
override persistWith = {localStorageKey: 'xhAdminConfigState'};
|
|
@@ -43,27 +43,18 @@ export class ConfigPanelModel extends HoistModel {
|
|
|
43
43
|
super();
|
|
44
44
|
makeObservable(this);
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
required = true,
|
|
46
|
+
const required = true,
|
|
48
47
|
enableCreate = true,
|
|
49
48
|
hidden = true;
|
|
50
49
|
|
|
51
50
|
this.gridModel = new RestGridModel({
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
readonly: AppModel.readonly,
|
|
52
|
+
persistWith: this.persistWith,
|
|
54
53
|
colChooserModel: true,
|
|
55
54
|
enableExport: true,
|
|
56
55
|
exportOptions: {filename: exportFilenameWithDate('configs')},
|
|
57
|
-
filterFields: ['name', 'value', 'groupName', 'note'],
|
|
58
|
-
groupBy: 'groupName',
|
|
59
|
-
persistWith: this.persistWith,
|
|
60
|
-
prepareCloneFn: ({clone}) => (clone.name = `${clone.name}_CLONE`),
|
|
61
|
-
readonly: AppModel.readonly,
|
|
62
56
|
selModel: 'multiple',
|
|
63
|
-
|
|
64
|
-
unit: 'config',
|
|
65
|
-
// Store + fields
|
|
66
|
-
store: {
|
|
57
|
+
store: new RestStore({
|
|
67
58
|
url: 'rest/configAdmin',
|
|
68
59
|
reloadLookupsOnLoad: true,
|
|
69
60
|
fieldDefaults: {enableXssProtection: false},
|
|
@@ -92,8 +83,25 @@ export class ConfigPanelModel extends HoistModel {
|
|
|
92
83
|
editable: false
|
|
93
84
|
}
|
|
94
85
|
]
|
|
86
|
+
}),
|
|
87
|
+
actionWarning: {
|
|
88
|
+
del: records =>
|
|
89
|
+
`Are you sure you want to delete ${records.length} config(s)? Deleting configs can break running apps.`
|
|
95
90
|
},
|
|
96
|
-
|
|
91
|
+
toolbarActions: [addAction, editAction, cloneAction, deleteAction],
|
|
92
|
+
menuActions: [
|
|
93
|
+
addAction,
|
|
94
|
+
editAction,
|
|
95
|
+
cloneAction,
|
|
96
|
+
deleteAction,
|
|
97
|
+
'-',
|
|
98
|
+
this.regroupDialogModel.regroupAction
|
|
99
|
+
],
|
|
100
|
+
prepareCloneFn: ({clone}) => (clone.name = `${clone.name}_CLONE`),
|
|
101
|
+
unit: 'config',
|
|
102
|
+
filterFields: ['name', 'value', 'groupName', 'note'],
|
|
103
|
+
sortBy: 'name',
|
|
104
|
+
groupBy: 'groupName',
|
|
97
105
|
columns: [
|
|
98
106
|
{...Col.groupName, hidden},
|
|
99
107
|
{...Col.name},
|
|
@@ -130,19 +138,7 @@ export class ConfigPanelModel extends HoistModel {
|
|
|
130
138
|
{field: 'clientVisible'},
|
|
131
139
|
{field: 'lastUpdated'},
|
|
132
140
|
{field: 'lastUpdatedBy'}
|
|
133
|
-
]
|
|
134
|
-
// Actions
|
|
135
|
-
actionWarning: {
|
|
136
|
-
del: records =>
|
|
137
|
-
fragment(
|
|
138
|
-
`Are you sure you want to delete ${pluralize('selected config', records.length, true)}?`,
|
|
139
|
-
br(),
|
|
140
|
-
br(),
|
|
141
|
-
`Deleting configs can break running apps.`
|
|
142
|
-
)
|
|
143
|
-
},
|
|
144
|
-
menuActions: [addAction, editAction, cloneAction, deleteAction, '-', regroupAction],
|
|
145
|
-
toolbarActions: [addAction, editAction, cloneAction, deleteAction]
|
|
141
|
+
]
|
|
146
142
|
});
|
|
147
143
|
}
|
|
148
144
|
|
|
@@ -25,19 +25,12 @@ export class UserPreferenceModel extends HoistModel {
|
|
|
25
25
|
hidden = true;
|
|
26
26
|
|
|
27
27
|
this.gridModel = new RestGridModel({
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
readonly: AppModel.readonly,
|
|
29
|
+
persistWith: {localStorageKey: 'xhAdminUserPreferenceState'},
|
|
30
30
|
colChooserModel: true,
|
|
31
31
|
enableExport: true,
|
|
32
32
|
exportOptions: {filename: exportFilenameWithDate('user-prefs')},
|
|
33
|
-
filterFields: ['name', 'username'],
|
|
34
|
-
groupBy: 'groupName',
|
|
35
|
-
persistWith: {localStorageKey: 'xhAdminUserPreferenceState'},
|
|
36
|
-
readonly: AppModel.readonly,
|
|
37
33
|
selModel: 'multiple',
|
|
38
|
-
sortBy: 'name',
|
|
39
|
-
unit: 'user preference',
|
|
40
|
-
// Store + fields
|
|
41
34
|
store: {
|
|
42
35
|
url: 'rest/userPreferenceAdmin',
|
|
43
36
|
reloadLookupsOnLoad: true,
|
|
@@ -62,7 +55,10 @@ export class UserPreferenceModel extends HoistModel {
|
|
|
62
55
|
{...(Col.lastUpdatedBy.field as FieldSpec), editable: false}
|
|
63
56
|
]
|
|
64
57
|
},
|
|
65
|
-
|
|
58
|
+
sortBy: 'name',
|
|
59
|
+
groupBy: 'groupName',
|
|
60
|
+
unit: 'user preference',
|
|
61
|
+
filterFields: ['name', 'username'],
|
|
66
62
|
columns: [
|
|
67
63
|
{...Col.name},
|
|
68
64
|
{...Col.type},
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
import {exportFilenameWithDate} from '@xh/hoist/admin/AdminUtils';
|
|
8
8
|
import {AppModel} from '@xh/hoist/admin/AppModel';
|
|
9
9
|
import * as Col from '@xh/hoist/admin/columns';
|
|
10
|
-
import {br, fragment} from '@xh/hoist/cmp/layout';
|
|
11
10
|
import {HoistModel, LoadSpec, managed, XH} from '@xh/hoist/core';
|
|
12
11
|
import {FieldSpec} from '@xh/hoist/data';
|
|
13
12
|
import {textArea} from '@xh/hoist/desktop/cmp/input';
|
|
14
13
|
import {addAction, deleteAction, editAction, RestGridModel} from '@xh/hoist/desktop/cmp/rest';
|
|
15
14
|
import {action, makeObservable, observable} from '@xh/hoist/mobx';
|
|
16
|
-
import {pluralize} from '@xh/hoist/utils/js';
|
|
17
15
|
import {DifferModel} from '../../../../differ/DifferModel';
|
|
18
16
|
import {RegroupDialogModel} from '../../../../regroup/RegroupDialogModel';
|
|
19
17
|
|
|
@@ -34,26 +32,18 @@ export class PrefEditorModel extends HoistModel {
|
|
|
34
32
|
super();
|
|
35
33
|
makeObservable(this);
|
|
36
34
|
|
|
37
|
-
const
|
|
38
|
-
required = true,
|
|
35
|
+
const required = true,
|
|
39
36
|
enableCreate = true,
|
|
40
37
|
hidden = true;
|
|
41
38
|
|
|
42
39
|
this.gridModel = new RestGridModel({
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
readonly: AppModel.readonly,
|
|
41
|
+
persistWith: this.persistWith,
|
|
45
42
|
colChooserModel: true,
|
|
46
43
|
enableExport: true,
|
|
47
44
|
exportOptions: {filename: exportFilenameWithDate('prefs')},
|
|
48
|
-
filterFields: ['name', 'groupName'],
|
|
49
|
-
groupBy: 'groupName',
|
|
50
|
-
persistWith: this.persistWith,
|
|
51
|
-
readonly: AppModel.readonly,
|
|
52
45
|
selModel: 'multiple',
|
|
53
46
|
showRefreshButton: true,
|
|
54
|
-
sortBy: 'name',
|
|
55
|
-
unit: 'preference',
|
|
56
|
-
// Store + fields
|
|
57
47
|
store: {
|
|
58
48
|
url: 'rest/preferenceAdmin',
|
|
59
49
|
reloadLookupsOnLoad: true,
|
|
@@ -78,7 +68,21 @@ export class PrefEditorModel extends HoistModel {
|
|
|
78
68
|
{...(Col.lastUpdatedBy.field as FieldSpec), editable: false}
|
|
79
69
|
]
|
|
80
70
|
},
|
|
81
|
-
|
|
71
|
+
sortBy: 'name',
|
|
72
|
+
groupBy: 'groupName',
|
|
73
|
+
unit: 'preference',
|
|
74
|
+
filterFields: ['name', 'groupName'],
|
|
75
|
+
actionWarning: {
|
|
76
|
+
del: records =>
|
|
77
|
+
`Are you sure you want to delete ${records.length} preference(s)? Deleting preferences can break running apps.`
|
|
78
|
+
},
|
|
79
|
+
menuActions: [
|
|
80
|
+
addAction,
|
|
81
|
+
editAction,
|
|
82
|
+
deleteAction,
|
|
83
|
+
'-',
|
|
84
|
+
this.regroupDialogModel.regroupAction
|
|
85
|
+
],
|
|
82
86
|
columns: [
|
|
83
87
|
{...Col.name},
|
|
84
88
|
{...Col.type},
|
|
@@ -96,18 +100,7 @@ export class PrefEditorModel extends HoistModel {
|
|
|
96
100
|
{field: 'notes', formField: {item: textArea({height: 100})}},
|
|
97
101
|
{field: 'lastUpdated'},
|
|
98
102
|
{field: 'lastUpdatedBy'}
|
|
99
|
-
]
|
|
100
|
-
// Actions
|
|
101
|
-
actionWarning: {
|
|
102
|
-
del: records =>
|
|
103
|
-
fragment(
|
|
104
|
-
`Are you sure you want to delete ${pluralize('selected preference', records.length, true)}?`,
|
|
105
|
-
br(),
|
|
106
|
-
br(),
|
|
107
|
-
`Deleting preference definitions can break running apps.`
|
|
108
|
-
)
|
|
109
|
-
},
|
|
110
|
-
menuActions: [addAction, editAction, deleteAction, '-', regroupAction]
|
|
103
|
+
]
|
|
111
104
|
});
|
|
112
105
|
}
|
|
113
106
|
|
|
@@ -20,6 +20,11 @@ export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCan
|
|
|
20
20
|
maxRows?: number;
|
|
21
21
|
/** Padding inside the container [x, y] in pixels. Defaults to same as `margin`. */
|
|
22
22
|
containerPadding?: [number, number];
|
|
23
|
+
/**
|
|
24
|
+
* Whether an overlay with an Add View button should be rendered
|
|
25
|
+
* when the canvas is empty. Default true.
|
|
26
|
+
*/
|
|
27
|
+
showAddViewButtonWhenEmpty?: boolean;
|
|
23
28
|
}
|
|
24
29
|
export interface DashCanvasItemState {
|
|
25
30
|
layout: DashCanvasItemLayout;
|
|
@@ -45,7 +50,9 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
|
|
|
45
50
|
compact: boolean;
|
|
46
51
|
margin: [number, number];
|
|
47
52
|
containerPadding: [number, number];
|
|
53
|
+
DROPPING_ELEM_ID: string;
|
|
48
54
|
maxRows: number;
|
|
55
|
+
showAddViewButtonWhenEmpty: boolean;
|
|
49
56
|
/** Current number of rows in canvas */
|
|
50
57
|
get rows(): number;
|
|
51
58
|
get isEmpty(): boolean;
|
|
@@ -54,7 +61,7 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
|
|
|
54
61
|
isResizing: boolean;
|
|
55
62
|
private isLoadingState;
|
|
56
63
|
get rglLayout(): any[];
|
|
57
|
-
constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems }: DashCanvasConfig);
|
|
64
|
+
constructor({ viewSpecs, viewSpecDefaults, initialState, layoutLocked, contentLocked, renameLocked, persistWith, emptyText, addViewButtonText, columns, rowHeight, compact, margin, maxRows, containerPadding, extraMenuItems, showAddViewButtonWhenEmpty }: DashCanvasConfig);
|
|
58
65
|
/** Removes all views from the canvas */
|
|
59
66
|
clear(): void;
|
|
60
67
|
/**
|
|
@@ -77,6 +84,16 @@ export declare class DashCanvasModel extends DashModel<DashCanvasViewSpec, DashC
|
|
|
77
84
|
width?: number;
|
|
78
85
|
height?: number;
|
|
79
86
|
}): DashCanvasViewModel;
|
|
87
|
+
dropViewIntoCanvas(specId: string, opts: {
|
|
88
|
+
title: string;
|
|
89
|
+
state: any;
|
|
90
|
+
layout: {
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
w: number;
|
|
94
|
+
h: number;
|
|
95
|
+
};
|
|
96
|
+
}, rglLayout: any[]): DashCanvasViewModel;
|
|
80
97
|
/**
|
|
81
98
|
* Remove a view from the DashCanvas
|
|
82
99
|
* @param id - DashCanvasViewModel id to remove from the container
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { RowDoubleClickedEvent } from '@xh/hoist/kit/ag-grid';
|
|
1
2
|
import { BaseFieldConfig } from '@xh/hoist/cmp/form';
|
|
2
3
|
import { GridConfig, GridModel } from '@xh/hoist/cmp/grid';
|
|
3
4
|
import { ElementSpec, HoistModel, PlainObject } from '@xh/hoist/core';
|
|
4
5
|
import '@xh/hoist/desktop/register';
|
|
5
6
|
import { RecordAction, RecordActionSpec, StoreRecord } from '@xh/hoist/data';
|
|
6
|
-
import { RowDoubleClickedEvent } from '@xh/hoist/kit/ag-grid';
|
|
7
7
|
import { ExportOptions } from '@xh/hoist/svc';
|
|
8
|
-
import { ReactNode } from 'react';
|
|
9
8
|
import { FormFieldProps } from '../form';
|
|
10
9
|
import { RestStore, RestStoreConfig } from './data/RestStore';
|
|
11
10
|
import { RestFormModel } from './impl/RestFormModel';
|
|
@@ -23,9 +22,9 @@ export interface RestGridConfig extends GridConfig {
|
|
|
23
22
|
showRefreshButton?: boolean;
|
|
24
23
|
/** Warning to display before actions on a selection of records. */
|
|
25
24
|
actionWarning?: {
|
|
26
|
-
add?:
|
|
27
|
-
del?:
|
|
28
|
-
edit?:
|
|
25
|
+
add?: string | ((recs: StoreRecord[]) => string);
|
|
26
|
+
del?: string | ((recs: StoreRecord[]) => string);
|
|
27
|
+
edit?: string | ((recs: StoreRecord[]) => string);
|
|
29
28
|
};
|
|
30
29
|
/** Name that describes records in this grid. */
|
|
31
30
|
unit?: string;
|
|
@@ -16,9 +16,9 @@ export declare class RestFormModel extends HoistModel {
|
|
|
16
16
|
dialogRef: import("react").RefObject<HTMLElement>;
|
|
17
17
|
get unit(): string;
|
|
18
18
|
get actionWarning(): {
|
|
19
|
-
add?:
|
|
20
|
-
del?:
|
|
21
|
-
edit?:
|
|
19
|
+
add?: string | ((recs: import("@xh/hoist/data").StoreRecord[]) => string);
|
|
20
|
+
del?: string | ((recs: import("@xh/hoist/data").StoreRecord[]) => string);
|
|
21
|
+
edit?: string | ((recs: import("@xh/hoist/data").StoreRecord[]) => string);
|
|
22
22
|
};
|
|
23
23
|
get actions(): (import("@xh/hoist/data").RecordActionSpec | import("@xh/hoist/data").RecordAction)[];
|
|
24
24
|
get editors(): RestGridEditor[];
|
|
@@ -50,6 +50,12 @@ export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCan
|
|
|
50
50
|
|
|
51
51
|
/** Padding inside the container [x, y] in pixels. Defaults to same as `margin`. */
|
|
52
52
|
containerPadding?: [number, number];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Whether an overlay with an Add View button should be rendered
|
|
56
|
+
* when the canvas is empty. Default true.
|
|
57
|
+
*/
|
|
58
|
+
showAddViewButtonWhenEmpty?: boolean;
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
export interface DashCanvasItemState {
|
|
@@ -86,7 +92,9 @@ export class DashCanvasModel
|
|
|
86
92
|
//-----------------------------
|
|
87
93
|
// Public properties
|
|
88
94
|
//-----------------------------
|
|
95
|
+
DROPPING_ELEM_ID = '__dropping-elem__';
|
|
89
96
|
maxRows: number;
|
|
97
|
+
showAddViewButtonWhenEmpty: boolean;
|
|
90
98
|
|
|
91
99
|
/** Current number of rows in canvas */
|
|
92
100
|
get rows(): number {
|
|
@@ -106,21 +114,25 @@ export class DashCanvasModel
|
|
|
106
114
|
private isLoadingState: boolean;
|
|
107
115
|
|
|
108
116
|
get rglLayout() {
|
|
109
|
-
return this.layout
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
return this.layout
|
|
118
|
+
.map(it => {
|
|
119
|
+
const dashCanvasView = this.getView(it.i);
|
|
120
|
+
if (!dashCanvasView) return null;
|
|
121
|
+
|
|
122
|
+
const {autoHeight, viewSpec} = dashCanvasView;
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
...it,
|
|
126
|
+
resizeHandles: autoHeight
|
|
127
|
+
? ['w', 'e']
|
|
128
|
+
: ['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'],
|
|
129
|
+
maxH: viewSpec.maxHeight,
|
|
130
|
+
minH: viewSpec.minHeight,
|
|
131
|
+
maxW: viewSpec.maxWidth,
|
|
132
|
+
minW: viewSpec.minWidth
|
|
133
|
+
};
|
|
134
|
+
})
|
|
135
|
+
.filter(Boolean);
|
|
124
136
|
}
|
|
125
137
|
|
|
126
138
|
constructor({
|
|
@@ -139,7 +151,8 @@ export class DashCanvasModel
|
|
|
139
151
|
margin = [10, 10],
|
|
140
152
|
maxRows = Infinity,
|
|
141
153
|
containerPadding = margin,
|
|
142
|
-
extraMenuItems
|
|
154
|
+
extraMenuItems,
|
|
155
|
+
showAddViewButtonWhenEmpty = true
|
|
143
156
|
}: DashCanvasConfig) {
|
|
144
157
|
super();
|
|
145
158
|
makeObservable(this);
|
|
@@ -187,6 +200,7 @@ export class DashCanvasModel
|
|
|
187
200
|
this.emptyText = emptyText;
|
|
188
201
|
this.addViewButtonText = addViewButtonText;
|
|
189
202
|
this.extraMenuItems = extraMenuItems;
|
|
203
|
+
this.showAddViewButtonWhenEmpty = showAddViewButtonWhenEmpty;
|
|
190
204
|
|
|
191
205
|
this.loadState(initialState);
|
|
192
206
|
this.state = this.buildState();
|
|
@@ -261,6 +275,27 @@ export class DashCanvasModel
|
|
|
261
275
|
return this.addViewInternal(specId, {title, layout, state});
|
|
262
276
|
}
|
|
263
277
|
|
|
278
|
+
@action dropViewIntoCanvas(
|
|
279
|
+
specId: string,
|
|
280
|
+
opts: {
|
|
281
|
+
title: string;
|
|
282
|
+
state: any;
|
|
283
|
+
layout: {
|
|
284
|
+
x: number;
|
|
285
|
+
y: number;
|
|
286
|
+
w: number;
|
|
287
|
+
h: number;
|
|
288
|
+
};
|
|
289
|
+
},
|
|
290
|
+
rglLayout: any[]
|
|
291
|
+
): DashCanvasViewModel {
|
|
292
|
+
const newViewModel: DashCanvasViewModel = this.addViewInternal(specId, opts),
|
|
293
|
+
droppingItem: any = rglLayout.find(it => it.i === this.DROPPING_ELEM_ID);
|
|
294
|
+
droppingItem.i = newViewModel.id;
|
|
295
|
+
this.onRglLayoutChange(rglLayout);
|
|
296
|
+
return newViewModel;
|
|
297
|
+
}
|
|
298
|
+
|
|
264
299
|
/**
|
|
265
300
|
* Remove a view from the DashCanvas
|
|
266
301
|
* @param id - DashCanvasViewModel id to remove from the container
|
|
@@ -386,6 +421,8 @@ export class DashCanvasModel
|
|
|
386
421
|
|
|
387
422
|
onRglLayoutChange(rglLayout) {
|
|
388
423
|
rglLayout = rglLayout.map(it => pick(it, ['i', 'x', 'y', 'w', 'h']));
|
|
424
|
+
if (rglLayout.some(it => it.i === this.DROPPING_ELEM_ID)) return;
|
|
425
|
+
|
|
389
426
|
this.setLayout(rglLayout);
|
|
390
427
|
}
|
|
391
428
|
|
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import {RowDoubleClickedEvent} from '@xh/hoist/kit/ag-grid';
|
|
8
9
|
import {BaseFieldConfig} from '@xh/hoist/cmp/form';
|
|
9
10
|
import {GridConfig, GridModel} from '@xh/hoist/cmp/grid';
|
|
10
11
|
import {ElementSpec, HoistModel, managed, PlainObject, XH} from '@xh/hoist/core';
|
|
11
12
|
import '@xh/hoist/desktop/register';
|
|
12
13
|
import {RecordAction, RecordActionSpec, StoreRecord} from '@xh/hoist/data';
|
|
13
|
-
import {RowDoubleClickedEvent} from '@xh/hoist/kit/ag-grid';
|
|
14
14
|
import {ExportOptions} from '@xh/hoist/svc';
|
|
15
15
|
import {pluralize, throwIf, withDefault} from '@xh/hoist/utils/js';
|
|
16
16
|
import {isFunction} from 'lodash';
|
|
17
|
-
import {ReactNode} from 'react';
|
|
18
17
|
import {FormFieldProps} from '../form';
|
|
19
18
|
import {addAction, deleteAction, editAction, viewAction} from './Actions';
|
|
20
19
|
import {RestStore, RestStoreConfig} from './data/RestStore';
|
|
@@ -40,9 +39,9 @@ export interface RestGridConfig extends GridConfig {
|
|
|
40
39
|
|
|
41
40
|
/** Warning to display before actions on a selection of records. */
|
|
42
41
|
actionWarning?: {
|
|
43
|
-
add?:
|
|
44
|
-
del?:
|
|
45
|
-
edit?:
|
|
42
|
+
add?: string | ((recs: StoreRecord[]) => string);
|
|
43
|
+
del?: string | ((recs: StoreRecord[]) => string);
|
|
44
|
+
edit?: string | ((recs: StoreRecord[]) => string);
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
/** Name that describes records in this grid. */
|
|
@@ -110,7 +109,11 @@ export class RestGridModel extends HoistModel {
|
|
|
110
109
|
add: null,
|
|
111
110
|
edit: null,
|
|
112
111
|
del: recs =>
|
|
113
|
-
|
|
112
|
+
recs.length > 1
|
|
113
|
+
? `Are you sure you want to delete the selected ${recs.length} ${pluralize(
|
|
114
|
+
this.unit
|
|
115
|
+
)}?`
|
|
116
|
+
: `Are you sure you want to delete the selected ${this.unit}?`
|
|
114
117
|
};
|
|
115
118
|
|
|
116
119
|
@managed gridModel: GridModel = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "78.0.0-SNAPSHOT.
|
|
3
|
+
"version": "78.0.0-SNAPSHOT.1762557528853",
|
|
4
4
|
"description": "Hoist add-on for building and deploying React Applications.",
|
|
5
5
|
"repository": "github:xh/hoist-react",
|
|
6
6
|
"homepage": "https://xh.io",
|