@xh/hoist 71.0.0-SNAPSHOT.1733791818708 → 71.0.0-SNAPSHOT.1734118787755
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/build/types/cmp/viewmanager/View.d.ts +5 -0
- package/build/types/cmp/viewmanager/ViewInfo.d.ts +32 -7
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +34 -31
- package/build/types/cmp/viewmanager/ViewToBlobApi.d.ts +28 -6
- package/build/types/cmp/viewmanager/index.d.ts +1 -1
- package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +0 -4
- package/build/types/desktop/cmp/viewmanager/ViewManagerLocalModel.d.ts +10 -0
- package/build/types/desktop/cmp/viewmanager/ViewMenu.d.ts +2 -2
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialog.d.ts +4 -3
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialogModel.d.ts +19 -10
- package/build/types/desktop/cmp/viewmanager/dialog/SaveAsDialog.d.ts +1 -1
- package/build/types/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.d.ts +3 -9
- package/build/types/desktop/cmp/viewmanager/dialog/Utils.d.ts +3 -0
- package/build/types/desktop/cmp/viewmanager/dialog/ViewMultiPanel.d.ts +1 -0
- package/build/types/desktop/cmp/viewmanager/dialog/ViewPanel.d.ts +5 -0
- package/build/types/desktop/cmp/viewmanager/dialog/{EditFormModel.d.ts → ViewPanelModel.d.ts} +2 -4
- package/build/types/svc/JsonBlobService.d.ts +1 -1
- package/cmp/viewmanager/View.ts +21 -1
- package/cmp/viewmanager/ViewInfo.ts +58 -11
- package/cmp/viewmanager/ViewManagerModel.ts +86 -81
- package/cmp/viewmanager/ViewToBlobApi.ts +91 -35
- package/cmp/viewmanager/index.ts +1 -1
- package/desktop/cmp/dash/container/DashContainerModel.ts +17 -5
- package/desktop/cmp/viewmanager/ViewManager.scss +25 -28
- package/desktop/cmp/viewmanager/ViewManager.ts +28 -26
- package/desktop/cmp/viewmanager/ViewManagerLocalModel.ts +28 -0
- package/desktop/cmp/viewmanager/ViewMenu.ts +162 -169
- package/desktop/cmp/viewmanager/dialog/ManageDialog.ts +67 -40
- package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +238 -127
- package/desktop/cmp/viewmanager/dialog/SaveAsDialog.ts +30 -9
- package/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.ts +35 -40
- package/desktop/cmp/viewmanager/dialog/Utils.ts +18 -0
- package/desktop/cmp/viewmanager/dialog/ViewMultiPanel.ts +70 -0
- package/desktop/cmp/viewmanager/dialog/ViewPanel.ts +161 -0
- package/desktop/cmp/viewmanager/dialog/ViewPanelModel.ts +116 -0
- package/package.json +1 -1
- package/svc/JsonBlobService.ts +3 -3
- package/svc/storage/BaseStorageService.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/types/desktop/cmp/viewmanager/dialog/EditForm.d.ts +0 -5
- package/desktop/cmp/viewmanager/dialog/EditForm.ts +0 -126
- package/desktop/cmp/viewmanager/dialog/EditFormModel.ts +0 -125
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2024 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {form} from '@xh/hoist/cmp/form';
|
|
9
|
-
import {div, filler, hbox, hspacer, span, vframe} from '@xh/hoist/cmp/layout';
|
|
10
|
-
|
|
11
|
-
import {hoistCmp, uses, XH} from '@xh/hoist/core';
|
|
12
|
-
import {EditFormModel} from '@xh/hoist/desktop/cmp/viewmanager/dialog/EditFormModel';
|
|
13
|
-
import {button} from '@xh/hoist/desktop/cmp/button';
|
|
14
|
-
import {formField} from '@xh/hoist/desktop/cmp/form';
|
|
15
|
-
import {select, textArea, textInput} from '@xh/hoist/desktop/cmp/input';
|
|
16
|
-
import {panel} from '@xh/hoist/desktop/cmp/panel';
|
|
17
|
-
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
|
|
18
|
-
import {fmtDateTime} from '@xh/hoist/format';
|
|
19
|
-
import {Icon} from '@xh/hoist/icon';
|
|
20
|
-
import {startCase} from 'lodash';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Default Edit Form for ViewManager
|
|
24
|
-
*/
|
|
25
|
-
export const editForm = hoistCmp.factory({
|
|
26
|
-
model: uses(EditFormModel),
|
|
27
|
-
render({model}) {
|
|
28
|
-
const {formModel, view, parent} = model;
|
|
29
|
-
if (!view) return null;
|
|
30
|
-
|
|
31
|
-
const {manageGlobal, globalDisplayName} = parent,
|
|
32
|
-
{lastUpdated, lastUpdatedBy, owner} = view,
|
|
33
|
-
isOwnView = owner === XH.getUsername();
|
|
34
|
-
|
|
35
|
-
return panel({
|
|
36
|
-
item: form({
|
|
37
|
-
fieldDefaults: {
|
|
38
|
-
commitOnChange: true
|
|
39
|
-
},
|
|
40
|
-
item: vframe({
|
|
41
|
-
className: 'xh-view-manager__manage-dialog__form',
|
|
42
|
-
items: [
|
|
43
|
-
formField({
|
|
44
|
-
field: 'name',
|
|
45
|
-
item: textInput()
|
|
46
|
-
}),
|
|
47
|
-
formField({
|
|
48
|
-
field: 'description',
|
|
49
|
-
item: textArea({
|
|
50
|
-
selectOnFocus: true,
|
|
51
|
-
height: 70
|
|
52
|
-
}),
|
|
53
|
-
readonlyRenderer: v =>
|
|
54
|
-
v
|
|
55
|
-
? v
|
|
56
|
-
: span({
|
|
57
|
-
item: 'None provided',
|
|
58
|
-
className: 'xh-text-color-muted'
|
|
59
|
-
})
|
|
60
|
-
}),
|
|
61
|
-
formField({
|
|
62
|
-
field: 'isGlobal',
|
|
63
|
-
label: 'Visibility',
|
|
64
|
-
item: select({
|
|
65
|
-
options: [
|
|
66
|
-
{value: true, label: startCase(globalDisplayName)},
|
|
67
|
-
{
|
|
68
|
-
value: false,
|
|
69
|
-
label: `Private to ${isOwnView ? 'me' : owner}`
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
enableFilter: false
|
|
73
|
-
}),
|
|
74
|
-
omit: !manageGlobal
|
|
75
|
-
}),
|
|
76
|
-
hbox({
|
|
77
|
-
omit: !model.showSaveButton,
|
|
78
|
-
style: {margin: '10px 20px'},
|
|
79
|
-
items: [
|
|
80
|
-
button({
|
|
81
|
-
text: 'Save Changes',
|
|
82
|
-
icon: Icon.check(),
|
|
83
|
-
intent: 'success',
|
|
84
|
-
minimal: false,
|
|
85
|
-
disabled: !formModel.isValid,
|
|
86
|
-
flex: 1,
|
|
87
|
-
onClick: () => model.saveAsync()
|
|
88
|
-
}),
|
|
89
|
-
hspacer(),
|
|
90
|
-
button({
|
|
91
|
-
icon: Icon.reset(),
|
|
92
|
-
tooltip: 'Revert changes',
|
|
93
|
-
minimal: false,
|
|
94
|
-
onClick: () => formModel.reset()
|
|
95
|
-
})
|
|
96
|
-
]
|
|
97
|
-
}),
|
|
98
|
-
filler(),
|
|
99
|
-
div({
|
|
100
|
-
className: 'xh-view-manager__manage-dialog__metadata',
|
|
101
|
-
item: `Last Updated: ${fmtDateTime(lastUpdated)} by ${lastUpdatedBy === XH.getUsername() ? 'you' : lastUpdatedBy}`
|
|
102
|
-
})
|
|
103
|
-
]
|
|
104
|
-
})
|
|
105
|
-
}),
|
|
106
|
-
bbar: bbar()
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const bbar = hoistCmp.factory<EditFormModel>({
|
|
112
|
-
render({model}) {
|
|
113
|
-
const {parent} = model;
|
|
114
|
-
return toolbar(
|
|
115
|
-
button({
|
|
116
|
-
text: 'Delete',
|
|
117
|
-
icon: Icon.delete(),
|
|
118
|
-
intent: 'danger',
|
|
119
|
-
disabled: !parent.canDelete,
|
|
120
|
-
onClick: () => parent.deleteAsync([model.view])
|
|
121
|
-
}),
|
|
122
|
-
filler(),
|
|
123
|
-
button({text: 'Close', onClick: () => parent.close()})
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file belongs to Hoist, an application development toolkit
|
|
3
|
-
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
|
|
4
|
-
*
|
|
5
|
-
* Copyright © 2024 Extremely Heavy Industries Inc.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {FormModel} from '@xh/hoist/cmp/form';
|
|
9
|
-
import {fragment, p, span, strong} from '@xh/hoist/cmp/layout';
|
|
10
|
-
import {HoistModel, managed, TaskObserver, XH} from '@xh/hoist/core';
|
|
11
|
-
import {ManageDialogModel} from './ManageDialogModel';
|
|
12
|
-
import {makeObservable} from '@xh/hoist/mobx';
|
|
13
|
-
import {throwIf} from '@xh/hoist/utils/js';
|
|
14
|
-
import {ViewInfo} from '@xh/hoist/cmp/viewmanager';
|
|
15
|
-
import {action, observable} from 'mobx';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Backing model for EditForm
|
|
19
|
-
*/
|
|
20
|
-
export class EditFormModel extends HoistModel {
|
|
21
|
-
parent: ManageDialogModel;
|
|
22
|
-
|
|
23
|
-
@managed formModel: FormModel;
|
|
24
|
-
@observable.ref view: ViewInfo;
|
|
25
|
-
|
|
26
|
-
@action
|
|
27
|
-
setView(view: ViewInfo) {
|
|
28
|
-
const {formModel, parent} = this;
|
|
29
|
-
this.view = view;
|
|
30
|
-
if (!view) return null;
|
|
31
|
-
formModel.init(view);
|
|
32
|
-
formModel.readonly = view.isGlobal && !parent.manageGlobal;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get loadTask(): TaskObserver {
|
|
36
|
-
return this.parent.loadModel;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get showSaveButton(): boolean {
|
|
40
|
-
const {formModel, parent} = this;
|
|
41
|
-
return formModel.isDirty && !formModel.readonly && !parent.loadModel.isPending;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
constructor(parent: ManageDialogModel) {
|
|
45
|
-
super();
|
|
46
|
-
makeObservable(this);
|
|
47
|
-
this.formModel = this.createFormModel();
|
|
48
|
-
this.parent = parent;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async saveAsync() {
|
|
52
|
-
const {parent, view, formModel} = this,
|
|
53
|
-
{manageGlobal, typeDisplayName, globalDisplayName} = parent,
|
|
54
|
-
{name, description, isGlobal} = formModel.getData(),
|
|
55
|
-
isValid = await formModel.validateAsync(),
|
|
56
|
-
isDirty = formModel.isDirty;
|
|
57
|
-
|
|
58
|
-
if (!isValid || !isDirty) return;
|
|
59
|
-
|
|
60
|
-
throwIf(
|
|
61
|
-
(view.isGlobal || isGlobal) && !manageGlobal,
|
|
62
|
-
`Cannot save changes to ${globalDisplayName} ${typeDisplayName} - missing required permission.`
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
if (isGlobal != view.isGlobal) {
|
|
66
|
-
const msgs = [];
|
|
67
|
-
if (isGlobal) {
|
|
68
|
-
msgs.push(
|
|
69
|
-
`This ${typeDisplayName} will become visible to all other ${XH.appName} users.`
|
|
70
|
-
);
|
|
71
|
-
} else {
|
|
72
|
-
msgs.push(
|
|
73
|
-
span(
|
|
74
|
-
`The selected ${typeDisplayName} will revert to being private `,
|
|
75
|
-
strong('It will no longer be available to ALL users.')
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
if (view.owner != XH.getUsername()) {
|
|
79
|
-
msgs.push(
|
|
80
|
-
`The selected ${typeDisplayName} will revert to being private to its owner (${view.owner}).`,
|
|
81
|
-
`Note that you will no longer have access to this ${typeDisplayName} and will not be able to undo this change.`
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
msgs.push('Are you sure you want to proceed?');
|
|
87
|
-
|
|
88
|
-
const confirmed = await XH.confirm({
|
|
89
|
-
message: fragment(msgs.map(m => p(m))),
|
|
90
|
-
confirmProps: {
|
|
91
|
-
text: 'Yes, update visibility',
|
|
92
|
-
outlined: true,
|
|
93
|
-
autoFocus: false,
|
|
94
|
-
intent: 'primary'
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
if (!confirmed) return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
await parent.updateAsync(view, name, description, isGlobal);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//------------------------
|
|
104
|
-
// Implementation
|
|
105
|
-
//------------------------
|
|
106
|
-
private createFormModel(): FormModel {
|
|
107
|
-
return new FormModel({
|
|
108
|
-
fields: [
|
|
109
|
-
{
|
|
110
|
-
name: 'name',
|
|
111
|
-
rules: [
|
|
112
|
-
async ({value}) => {
|
|
113
|
-
return this.parent.viewManagerModel.validateViewNameAsync(
|
|
114
|
-
value,
|
|
115
|
-
this.view
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
},
|
|
120
|
-
{name: 'description'},
|
|
121
|
-
{name: 'isGlobal', displayName: 'Global'}
|
|
122
|
-
]
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|