@xh/hoist 76.0.0-SNAPSHOT.1757113228632 → 76.0.0-SNAPSHOT.1757428490497
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 +11 -0
- package/build/types/cmp/grid/Types.d.ts +2 -2
- package/build/types/cmp/viewmanager/DataAccess.d.ts +0 -2
- package/build/types/cmp/viewmanager/ViewInfo.d.ts +4 -8
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +10 -11
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialogModel.d.ts +0 -2
- package/build/types/desktop/cmp/viewmanager/dialog/Utils.d.ts +9 -1
- package/cmp/grid/Types.ts +2 -2
- package/cmp/viewmanager/DataAccess.ts +0 -11
- package/cmp/viewmanager/ViewInfo.ts +5 -11
- package/cmp/viewmanager/ViewManagerModel.ts +15 -15
- package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +3 -40
- package/desktop/cmp/viewmanager/dialog/SaveAsDialog.ts +17 -13
- package/desktop/cmp/viewmanager/dialog/SaveAsDialogModel.ts +42 -11
- package/desktop/cmp/viewmanager/dialog/Utils.ts +35 -3
- package/desktop/cmp/viewmanager/dialog/ViewPanel.ts +20 -37
- package/desktop/cmp/viewmanager/dialog/ViewPanelModel.ts +36 -13
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,13 +10,16 @@ import {div, filler, hbox, hspacer, span, vbox, vframe, vspacer} from '@xh/hoist
|
|
|
10
10
|
import {hoistCmp, uses, XH} from '@xh/hoist/core';
|
|
11
11
|
import {button} from '@xh/hoist/desktop/cmp/button';
|
|
12
12
|
import {formField} from '@xh/hoist/desktop/cmp/form';
|
|
13
|
-
import {select,
|
|
13
|
+
import {select, textArea, textInput} from '@xh/hoist/desktop/cmp/input';
|
|
14
14
|
import {panel} from '@xh/hoist/desktop/cmp/panel';
|
|
15
15
|
import {ViewPanelModel} from '@xh/hoist/desktop/cmp/viewmanager/dialog/ViewPanelModel';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
getGroupOptions,
|
|
18
|
+
getVisibilityInfo,
|
|
19
|
+
getVisibilityOptions
|
|
20
|
+
} from '@xh/hoist/desktop/cmp/viewmanager/dialog/Utils';
|
|
17
21
|
import {fmtDateTime} from '@xh/hoist/format';
|
|
18
22
|
import {Icon} from '@xh/hoist/icon';
|
|
19
|
-
import {capitalize, some} from 'lodash';
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
* Form to edit or view details on a single saved view within the ViewManager manage dialog.
|
|
@@ -24,11 +27,17 @@ import {capitalize, some} from 'lodash';
|
|
|
24
27
|
export const viewPanel = hoistCmp.factory({
|
|
25
28
|
model: uses(ViewPanelModel),
|
|
26
29
|
render({model}) {
|
|
27
|
-
const {view} = model
|
|
30
|
+
const {view, parent, formModel} = model,
|
|
31
|
+
{viewManagerModel} = parent;
|
|
32
|
+
|
|
28
33
|
if (!view) return null;
|
|
29
34
|
|
|
30
|
-
const {
|
|
31
|
-
|
|
35
|
+
const {lastUpdated, lastUpdatedBy, isEditable} = view,
|
|
36
|
+
visibility = formModel.values.visibility,
|
|
37
|
+
isGlobal = visibility === 'global',
|
|
38
|
+
visOptions = getVisibilityOptions(viewManagerModel),
|
|
39
|
+
visInfo = getVisibilityInfo(viewManagerModel, visibility),
|
|
40
|
+
groupOptions = getGroupOptions(viewManagerModel, isGlobal);
|
|
32
41
|
|
|
33
42
|
return panel({
|
|
34
43
|
item: form({
|
|
@@ -52,10 +61,7 @@ export const viewPanel = hoistCmp.factory({
|
|
|
52
61
|
item: select({
|
|
53
62
|
enableCreate: true,
|
|
54
63
|
enableClear: true,
|
|
55
|
-
options:
|
|
56
|
-
model.parent.viewManagerModel,
|
|
57
|
-
view.isOwned ? 'owned' : 'global'
|
|
58
|
-
)
|
|
64
|
+
options: groupOptions
|
|
59
65
|
}),
|
|
60
66
|
readonlyRenderer: v =>
|
|
61
67
|
v || span({item: 'None provided', className: 'xh-text-color-muted'})
|
|
@@ -70,22 +76,10 @@ export const viewPanel = hoistCmp.factory({
|
|
|
70
76
|
v || span({item: 'None provided', className: 'xh-text-color-muted'})
|
|
71
77
|
}),
|
|
72
78
|
formField({
|
|
73
|
-
field: '
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
readonlyRenderer: v => (v ? 'Yes' : 'No'),
|
|
78
|
-
omit: !enableSharing || isGlobal || !isEditable
|
|
79
|
-
}),
|
|
80
|
-
formField({
|
|
81
|
-
field: 'isDefaultPinned',
|
|
82
|
-
label: null,
|
|
83
|
-
inline: true,
|
|
84
|
-
item: switchInput({
|
|
85
|
-
label: `Pin to everyone's menu by default`,
|
|
86
|
-
labelSide: 'left'
|
|
87
|
-
}),
|
|
88
|
-
omit: !isGlobal || !isEditable
|
|
79
|
+
field: 'visibility',
|
|
80
|
+
omit: !isEditable || visOptions.length === 1,
|
|
81
|
+
item: select({options: visOptions, enableFilter: false}),
|
|
82
|
+
info: visInfo
|
|
89
83
|
}),
|
|
90
84
|
vspacer(),
|
|
91
85
|
formButtons(),
|
|
@@ -130,8 +124,6 @@ const formButtons = hoistCmp.factory<ViewPanelModel>({
|
|
|
130
124
|
});
|
|
131
125
|
}
|
|
132
126
|
|
|
133
|
-
const {enableGlobal, globalDisplayName, manageGlobal, globalViews} =
|
|
134
|
-
parent.viewManagerModel;
|
|
135
127
|
return vbox({
|
|
136
128
|
style: {gap: 10, alignItems: 'center'},
|
|
137
129
|
items: [
|
|
@@ -145,15 +137,6 @@ const formButtons = hoistCmp.factory<ViewPanelModel>({
|
|
|
145
137
|
outlined: true,
|
|
146
138
|
onClick: () => parent.togglePinned([view])
|
|
147
139
|
}),
|
|
148
|
-
button({
|
|
149
|
-
text: `Promote to ${capitalize(globalDisplayName)}`,
|
|
150
|
-
icon: Icon.globe(),
|
|
151
|
-
width: 200,
|
|
152
|
-
outlined: true,
|
|
153
|
-
disabled: some(globalViews, {name: view.name}),
|
|
154
|
-
omit: readonly || view.isGlobal || !enableGlobal || !manageGlobal,
|
|
155
|
-
onClick: () => parent.makeGlobalAsync(view)
|
|
156
|
-
}),
|
|
157
140
|
button({
|
|
158
141
|
text: 'Delete',
|
|
159
142
|
icon: Icon.delete(),
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
import {FormModel} from '@xh/hoist/cmp/form';
|
|
9
9
|
import {fragment, p, strong} from '@xh/hoist/cmp/layout';
|
|
10
10
|
import {HoistModel, managed, TaskObserver, XH} from '@xh/hoist/core';
|
|
11
|
-
import {capitalize
|
|
11
|
+
import {capitalize} from 'lodash';
|
|
12
|
+
import {ReactNode} from 'react';
|
|
12
13
|
import {ManageDialogModel} from './ManageDialogModel';
|
|
13
14
|
import {makeObservable} from '@xh/hoist/mobx';
|
|
14
15
|
import {ViewInfo} from '@xh/hoist/cmp/viewmanager';
|
|
15
|
-
import {ReactNode} from 'react';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Backing model for EditForm
|
|
@@ -44,6 +44,7 @@ export class ViewPanelModel extends HoistModel {
|
|
|
44
44
|
const {formModel} = this;
|
|
45
45
|
formModel.init({
|
|
46
46
|
...view,
|
|
47
|
+
visibility: view.isShared ? 'shared' : view.isGlobal ? 'global' : 'private',
|
|
47
48
|
owner: view.owner ?? capitalize(parent.viewManagerModel.globalDisplayName)
|
|
48
49
|
});
|
|
49
50
|
formModel.readonly = !view.isEditable;
|
|
@@ -57,20 +58,42 @@ export class ViewPanelModel extends HoistModel {
|
|
|
57
58
|
const {parent, view, formModel} = this,
|
|
58
59
|
updates = formModel.getData(true),
|
|
59
60
|
isValid = await formModel.validateAsync(),
|
|
60
|
-
isDirty = formModel.isDirty
|
|
61
|
+
isDirty = formModel.isDirty,
|
|
62
|
+
visibilityField = formModel.fields.visibility;
|
|
61
63
|
|
|
62
64
|
if (!isValid || !isDirty) return;
|
|
63
65
|
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (visibilityField.isDirty) {
|
|
67
|
+
const visibility = visibilityField.value;
|
|
68
|
+
updates.isShared = visibility === 'shared';
|
|
69
|
+
updates.isGlobal = visibility === 'global';
|
|
70
|
+
|
|
71
|
+
const msgs: ReactNode[] = [strong('Are you sure you want to proceed?')];
|
|
72
|
+
switch (visibility) {
|
|
73
|
+
case 'private':
|
|
74
|
+
msgs.unshift(
|
|
75
|
+
`Your ${view.typedName} will no longer be available to all other ${XH.appName} users.`
|
|
76
|
+
);
|
|
77
|
+
break;
|
|
78
|
+
case 'global':
|
|
79
|
+
msgs.unshift(
|
|
80
|
+
`Your ${view.typedName} will become globally visible to all other ${XH.appName} users.`
|
|
81
|
+
);
|
|
82
|
+
break;
|
|
83
|
+
case 'shared':
|
|
84
|
+
view.isGlobal
|
|
85
|
+
? msgs.unshift(
|
|
86
|
+
`Your ${view.typedName} will no longer be globally visible to all other ${XH.appName} users.`
|
|
87
|
+
)
|
|
88
|
+
: msgs.unshift(
|
|
89
|
+
`Your ${view.typedName} will become available to all other ${XH.appName} users.`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
69
92
|
|
|
70
93
|
const confirmed = await XH.confirm({
|
|
71
94
|
message: fragment(msgs.map(m => p(m))),
|
|
72
95
|
confirmProps: {
|
|
73
|
-
text: 'Yes, update
|
|
96
|
+
text: 'Yes, update visibility',
|
|
74
97
|
outlined: true,
|
|
75
98
|
autoFocus: false,
|
|
76
99
|
intent: 'primary'
|
|
@@ -91,10 +114,11 @@ export class ViewPanelModel extends HoistModel {
|
|
|
91
114
|
{
|
|
92
115
|
name: 'name',
|
|
93
116
|
rules: [
|
|
94
|
-
async ({value}) => {
|
|
117
|
+
async ({value}, {visibility}) => {
|
|
95
118
|
return this.parent.viewManagerModel.validateViewNameAsync(
|
|
96
119
|
value,
|
|
97
|
-
this.view
|
|
120
|
+
this.view,
|
|
121
|
+
visibility === 'global'
|
|
98
122
|
);
|
|
99
123
|
}
|
|
100
124
|
]
|
|
@@ -102,8 +126,7 @@ export class ViewPanelModel extends HoistModel {
|
|
|
102
126
|
{name: 'owner'},
|
|
103
127
|
{name: 'group'},
|
|
104
128
|
{name: 'description'},
|
|
105
|
-
{name: '
|
|
106
|
-
{name: 'isDefaultPinned'}
|
|
129
|
+
{name: 'visibility'}
|
|
107
130
|
]
|
|
108
131
|
});
|
|
109
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "76.0.0-SNAPSHOT.
|
|
3
|
+
"version": "76.0.0-SNAPSHOT.1757428490497",
|
|
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",
|