@vuu-ui/vuu-shell 4.0.0-alpha.9 → 4.0.0-beta.2
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/package.json +19 -20
- package/src/app-header/AppHeader.css.js +1 -1
- package/src/app-header/AppHeader.js +26 -36
- package/src/application-provider/ApplicationContext.js +5 -2
- package/src/application-provider/ApplicationProvider.js +59 -8
- package/src/feature/Feature.js +34 -3
- package/src/feature/FeatureErrorBoundary.js +33 -0
- package/src/feature/index.js +0 -1
- package/src/feature-list/FeatureList.css.js +5 -27
- package/src/feature-list/FeatureList.js +96 -117
- package/src/index.js +3 -3
- package/src/left-nav/LeftNav.css.js +4 -2
- package/src/left-nav/LeftNav.js +100 -139
- package/src/persistence-manager/PersistenceProvider.js +3 -10
- package/src/persistence-manager/index.js +0 -3
- package/src/shell-layout-templates/context-panel/ContextPanel.css.js +8 -8
- package/src/shell-layout-templates/context-panel/ContextPanel.js +35 -17
- package/src/shell-layout-templates/context-panel/index.js +0 -1
- package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +40 -54
- package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +64 -54
- package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +28 -49
- package/src/shell-layout-templates/side-panel/SidePanel.css.js +1 -3
- package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +35 -43
- package/src/shell.css.js +3 -86
- package/src/shell.js +70 -148
- package/src/user-settings/SettingsForm.css.js +10 -0
- package/src/user-settings/SettingsForm.js +141 -0
- package/src/user-settings/UserSettingsPanel.css.js +9 -0
- package/src/user-settings/UserSettingsPanel.js +29 -0
- package/src/user-settings/index.js +2 -0
- package/src/workspace-management/LayoutList.js +99 -59
- package/src/workspace-management/SaveLayoutPanel.js +3 -3
- package/src/workspace-management/WorkspaceProvider.js +178 -699
- package/src/workspace-management/index.js +0 -8
- package/src/workspace-management/useWorkspaceContextMenuItems.js +6 -12
- package/types/app-header/AppHeader.d.ts +2 -2
- package/types/application-provider/ApplicationContext.d.ts +6 -1
- package/types/application-provider/ApplicationProvider.d.ts +14 -5
- package/types/feature/Feature.d.ts +10 -2
- package/types/feature/FeatureErrorBoundary.d.ts +1 -1
- package/types/feature/Loader.d.ts +1 -1
- package/types/feature/index.d.ts +1 -2
- package/types/feature-list/FeatureList.d.ts +4 -4
- package/types/index.d.ts +3 -3
- package/types/left-nav/LeftNav.d.ts +1 -2
- package/types/login/LoginPanel.d.ts +1 -1
- package/types/login/VuuLogo.d.ts +1 -1
- package/types/persistence-manager/PersistenceProvider.d.ts +3 -7
- package/types/persistence-manager/index.d.ts +0 -3
- package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +11 -9
- package/types/shell-layout-templates/context-panel/index.d.ts +0 -1
- package/types/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +1 -1
- package/types/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +1 -1
- package/types/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +1 -1
- package/types/shell-layout-templates/side-panel/SidePanel.d.ts +1 -1
- package/types/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +1 -1
- package/types/shell-layout-templates/useShellLayout.d.ts +2 -4
- package/types/shell.d.ts +15 -19
- package/types/theme-switch/ThemeSwitch.d.ts +1 -1
- package/types/workspace-management/LayoutList.d.ts +2 -2
- package/types/workspace-management/LayoutTile.d.ts +1 -1
- package/types/workspace-management/SaveLayoutPanel.d.ts +2 -2
- package/types/workspace-management/WorkspaceProvider.d.ts +50 -61
- package/types/workspace-management/defaultWorkspaceJSON.d.ts +6 -7
- package/types/workspace-management/index.d.ts +0 -8
- package/types/workspace-management/useWorkspaceContextMenuItems.d.ts +1 -1
- package/src/module-registry/getRegisteredModules.js +0 -12
- package/src/persistence-manager/LocalWorkspacePersistenceService.js +0 -129
- package/src/persistence-manager/RemoteWorkspacePersistenceService.js +0 -112
- package/src/persistence-manager/WorkspacePersistenceService.js +0 -9
- package/src/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.js +0 -24
- package/src/workspace-management/WorkspaceController.js +0 -73
- package/src/workspace-management/WorkspaceHost.js +0 -194
- package/src/workspace-management/WorkspacePersistentState.js +0 -67
- package/src/workspace-management/WorkspaceRepository.js +0 -127
- package/src/workspace-management/WorkspaceStartPanel.css.js +0 -44
- package/src/workspace-management/WorkspaceStartPanel.js +0 -34
- package/src/workspace-management/shell-workspace-components.js +0 -59
- package/src/workspace-management/workspace-component-registry.js +0 -30
- package/src/workspace-management/workspace-schemas.js +0 -257
- package/types/module-registry/getRegisteredModules.d.ts +0 -5
- package/types/persistence-manager/LocalWorkspacePersistenceService.d.ts +0 -18
- package/types/persistence-manager/RemoteWorkspacePersistenceService.d.ts +0 -25
- package/types/persistence-manager/WorkspacePersistenceService.d.ts +0 -27
- package/types/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.d.ts +0 -1
- package/types/src/ShellContextProvider.d.ts +0 -7
- package/types/src/app-header/AppHeader.d.ts +0 -6
- package/types/src/app-header/index.d.ts +0 -1
- package/types/src/application-provider/ApplicationContext.d.ts +0 -11
- package/types/src/application-provider/ApplicationProvider.d.ts +0 -17
- package/types/src/application-provider/index.d.ts +0 -1
- package/types/src/feature/Feature.d.ts +0 -10
- package/types/src/feature/FeatureErrorBoundary.d.ts +0 -13
- package/types/src/feature/Loader.d.ts +0 -1
- package/types/src/feature/index.d.ts +0 -1
- package/types/src/feature-and-layout-provider/FeatureAndLayoutProvider.d.ts +0 -19
- package/types/src/feature-and-layout-provider/index.d.ts +0 -1
- package/types/src/feature-list/FeatureList.d.ts +0 -7
- package/types/src/feature-list/index.d.ts +0 -1
- package/types/src/get-layout-history.d.ts +0 -8
- package/types/src/index.d.ts +0 -14
- package/types/src/left-nav/LeftNav.d.ts +0 -14
- package/types/src/left-nav/index.d.ts +0 -1
- package/types/src/login/LoginPanel.d.ts +0 -6
- package/types/src/login/VuuLogo.d.ts +0 -1
- package/types/src/persistence-manager/LocalPersistenceManager.d.ts +0 -20
- package/types/src/persistence-manager/PersistenceManager.d.ts +0 -71
- package/types/src/persistence-manager/PersistenceProvider.d.ts +0 -11
- package/types/src/persistence-manager/RemotePersistenceManager.d.ts +0 -25
- package/types/src/persistence-manager/StaticPersistenceManager.d.ts +0 -25
- package/types/src/persistence-manager/index.d.ts +0 -5
- package/types/src/shell-layout-templates/context-panel/ContextPanel.d.ts +0 -13
- package/types/src/shell-layout-templates/context-panel/index.d.ts +0 -1
- package/types/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +0 -2
- package/types/src/shell-layout-templates/index.d.ts +0 -3
- package/types/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +0 -2
- package/types/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +0 -2
- package/types/src/shell-layout-templates/side-panel/SidePanel.d.ts +0 -8
- package/types/src/shell-layout-templates/side-panel/index.d.ts +0 -1
- package/types/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +0 -2
- package/types/src/shell-layout-templates/useShellLayout.d.ts +0 -51
- package/types/src/shell.d.ts +0 -17
- package/types/src/theme-switch/ThemeSwitch.d.ts +0 -8
- package/types/src/theme-switch/index.d.ts +0 -1
- package/types/src/user-settings/SettingsForm.d.ts +0 -46
- package/types/src/user-settings/UserSettingsPanel.d.ts +0 -3
- package/types/src/user-settings/index.d.ts +0 -2
- package/types/src/workspace-management/LayoutList.d.ts +0 -2
- package/types/src/workspace-management/LayoutTile.d.ts +0 -7
- package/types/src/workspace-management/SaveLayoutPanel.d.ts +0 -9
- package/types/src/workspace-management/WorkspaceProvider.d.ts +0 -52
- package/types/src/workspace-management/defaultWorkspaceJSON.d.ts +0 -10
- package/types/src/workspace-management/index.d.ts +0 -5
- package/types/src/workspace-management/screenshot-utils.d.ts +0 -6
- package/types/src/workspace-management/useWorkspaceContextMenuItems.d.ts +0 -5
- package/types/workspace-management/WorkspaceController.d.ts +0 -32
- package/types/workspace-management/WorkspaceHost.d.ts +0 -1
- package/types/workspace-management/WorkspacePersistentState.d.ts +0 -19
- package/types/workspace-management/WorkspaceRepository.d.ts +0 -13
- package/types/workspace-management/WorkspaceStartPanel.d.ts +0 -1
- package/types/workspace-management/shell-workspace-components.d.ts +0 -2
- package/types/workspace-management/workspace-component-registry.d.ts +0 -12
- package/types/workspace-management/workspace-schemas.d.ts +0 -69
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { VuuInput } from "@vuu-ui/vuu-ui-controls";
|
|
3
|
+
import { getFieldName } from "@vuu-ui/vuu-utils";
|
|
4
|
+
import { Dropdown, FormField, FormFieldLabel, Option, Switch, ToggleButton, ToggleButtonGroup } from "@salt-ds/core";
|
|
5
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
6
|
+
import { useWindow } from "@salt-ds/window";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
import { useCallback, useState } from "react";
|
|
9
|
+
import SettingsForm from "./SettingsForm.css";
|
|
10
|
+
const isOption = (value)=>"object" == typeof value && "label" in value && "label" in value;
|
|
11
|
+
const isBooleanProperty = (property)=>"boolean" === property.type;
|
|
12
|
+
const isStringOrNumber = (value)=>"string" == typeof value || "number" == typeof value;
|
|
13
|
+
const getValueAndLabel = (value)=>isOption(value) ? [
|
|
14
|
+
value.value,
|
|
15
|
+
value.label
|
|
16
|
+
] : [
|
|
17
|
+
value,
|
|
18
|
+
value
|
|
19
|
+
];
|
|
20
|
+
const defaultPropertyValue = {
|
|
21
|
+
boolean: false,
|
|
22
|
+
number: 0,
|
|
23
|
+
string: ""
|
|
24
|
+
};
|
|
25
|
+
const classBase = "vuuSettingsForm";
|
|
26
|
+
function FormControl({ property, changeHandler, selectHandler, inputHandler, currentValue = property.defaultValue ?? defaultPropertyValue[property.type] }) {
|
|
27
|
+
const [value, setValue] = useState(currentValue);
|
|
28
|
+
if (isBooleanProperty(property)) {
|
|
29
|
+
const checked = "boolean" == typeof currentValue ? currentValue : property.defaultValue ?? false;
|
|
30
|
+
return /*#__PURE__*/ jsx(Switch, {
|
|
31
|
+
checked: checked,
|
|
32
|
+
onChange: changeHandler
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(property.values)) {
|
|
36
|
+
if (property.values.length <= 2) return /*#__PURE__*/ jsx(ToggleButtonGroup, {
|
|
37
|
+
value: currentValue,
|
|
38
|
+
onChange: changeHandler,
|
|
39
|
+
children: property.values.map((valueOrOption)=>{
|
|
40
|
+
const [value, label] = getValueAndLabel(valueOrOption);
|
|
41
|
+
return /*#__PURE__*/ jsx(ToggleButton, {
|
|
42
|
+
value: value,
|
|
43
|
+
children: label
|
|
44
|
+
}, value);
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
else if (property.values.length > 2) return /*#__PURE__*/ jsx(Dropdown, {
|
|
48
|
+
value: currentValue,
|
|
49
|
+
onSelectionChange: selectHandler,
|
|
50
|
+
children: property.values.map((valueOrOption)=>{
|
|
51
|
+
const [value, label] = getValueAndLabel(valueOrOption);
|
|
52
|
+
return /*#__PURE__*/ jsx(Option, {
|
|
53
|
+
value: label,
|
|
54
|
+
"data-field": property.name
|
|
55
|
+
}, value);
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
const valid = isValidInput(currentValue, property.type);
|
|
60
|
+
const errorMessage = getTooltipContent(property.type, valid);
|
|
61
|
+
return /*#__PURE__*/ jsx(VuuInput, {
|
|
62
|
+
errorMessage: errorMessage,
|
|
63
|
+
onCommit: inputHandler,
|
|
64
|
+
onChange: (e)=>setValue(e.target.value),
|
|
65
|
+
value: value
|
|
66
|
+
}, property.name);
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const isValidInput = (value, type)=>{
|
|
71
|
+
if ("" === value) return;
|
|
72
|
+
if ("string" === type) return "success";
|
|
73
|
+
if ("number" === type) {
|
|
74
|
+
if (Number.isNaN(Number(value))) return "error";
|
|
75
|
+
return "success";
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
function getTooltipContent(type, valid) {
|
|
79
|
+
if ("error" !== valid) return;
|
|
80
|
+
if ("number" === type) return /*#__PURE__*/ jsx("p", {
|
|
81
|
+
children: "Field is expecting a number"
|
|
82
|
+
});
|
|
83
|
+
if ("string" === type) return /*#__PURE__*/ jsx("p", {
|
|
84
|
+
children: "Field is expecting a string"
|
|
85
|
+
});
|
|
86
|
+
return /*#__PURE__*/ jsx("p", {
|
|
87
|
+
children: "Please contact Admin for more information on expected type"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const SettingsForm_SettingsForm = ({ className, settingsSchema, settings, onSettingChanged, ...htmlAttributes })=>{
|
|
91
|
+
const targetWindow = useWindow();
|
|
92
|
+
useComponentCssInjection({
|
|
93
|
+
testId: "vuu-settings-form",
|
|
94
|
+
css: SettingsForm,
|
|
95
|
+
window: targetWindow
|
|
96
|
+
});
|
|
97
|
+
const changeHandler = useCallback((event)=>{
|
|
98
|
+
const fieldName = getFieldName(event.target);
|
|
99
|
+
const { checked, value } = event.target;
|
|
100
|
+
onSettingChanged(fieldName, checked ?? value);
|
|
101
|
+
}, [
|
|
102
|
+
onSettingChanged
|
|
103
|
+
]);
|
|
104
|
+
const selectHandler = useCallback((event, [selected])=>{
|
|
105
|
+
const fieldName = getFieldName(event.target);
|
|
106
|
+
onSettingChanged(fieldName, selected);
|
|
107
|
+
}, [
|
|
108
|
+
onSettingChanged
|
|
109
|
+
]);
|
|
110
|
+
const inputHandler = useCallback((event)=>{
|
|
111
|
+
const fieldName = getFieldName(event.target);
|
|
112
|
+
const { value } = event.target;
|
|
113
|
+
if (Number.isNaN(Number(value)) || "" == value) onSettingChanged(fieldName, value);
|
|
114
|
+
else {
|
|
115
|
+
const numValue = Number(value);
|
|
116
|
+
onSettingChanged(fieldName, numValue);
|
|
117
|
+
}
|
|
118
|
+
}, [
|
|
119
|
+
onSettingChanged
|
|
120
|
+
]);
|
|
121
|
+
return /*#__PURE__*/ jsx("div", {
|
|
122
|
+
...htmlAttributes,
|
|
123
|
+
className: clsx(classBase, className),
|
|
124
|
+
children: settingsSchema.properties.map((property)=>/*#__PURE__*/ jsxs(FormField, {
|
|
125
|
+
"data-field": property.name,
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
128
|
+
children: property.label
|
|
129
|
+
}),
|
|
130
|
+
FormControl({
|
|
131
|
+
property,
|
|
132
|
+
changeHandler,
|
|
133
|
+
selectHandler,
|
|
134
|
+
inputHandler,
|
|
135
|
+
currentValue: settings[property.name]
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}, property.name))
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
export { FormControl, SettingsForm_SettingsForm as SettingsForm, isBooleanProperty, isOption, isStringOrNumber };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
3
|
+
import { useWindow } from "@salt-ds/window";
|
|
4
|
+
import { useApplicationSettings } from "../application-provider/index.js";
|
|
5
|
+
import { SettingsForm } from "./SettingsForm.js";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import UserSettingsPanel from "./UserSettingsPanel.css";
|
|
8
|
+
const classBase = "vuuUserSettingsPanel";
|
|
9
|
+
const UserSettingsPanel_UserSettingsPanel = ({ ...htmlAttributes })=>{
|
|
10
|
+
const targetWindow = useWindow();
|
|
11
|
+
useComponentCssInjection({
|
|
12
|
+
testId: "vuu-user-settings-panel",
|
|
13
|
+
css: UserSettingsPanel,
|
|
14
|
+
window: targetWindow
|
|
15
|
+
});
|
|
16
|
+
const { onUserSettingChanged, userSettings = {}, userSettingsSchema } = useApplicationSettings();
|
|
17
|
+
if (userSettingsSchema) return /*#__PURE__*/ jsx("div", {
|
|
18
|
+
...htmlAttributes,
|
|
19
|
+
className: clsx(classBase, "vuuScrollable"),
|
|
20
|
+
children: /*#__PURE__*/ jsx(SettingsForm, {
|
|
21
|
+
settings: userSettings,
|
|
22
|
+
settingsSchema: userSettingsSchema,
|
|
23
|
+
onSettingChanged: onUserSettingChanged
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
console.log("no settingsSchema provided to UserSettingsPanel");
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
29
|
+
export { UserSettingsPanel_UserSettingsPanel as UserSettingsPanel };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement, useCallback, useMemo } from "react";
|
|
3
|
+
import { IconButton } from "@vuu-ui/vuu-ui-controls";
|
|
2
4
|
import { ListBox, Option } from "@salt-ds/core";
|
|
5
|
+
import { VuuShellLocation } from "@vuu-ui/vuu-utils";
|
|
3
6
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
7
|
import { useWindow } from "@salt-ds/window";
|
|
5
|
-
import { IconButton } from "@vuu-ui/vuu-ui-controls";
|
|
6
8
|
import clsx from "clsx";
|
|
9
|
+
import { LayoutTile } from "./LayoutTile.js";
|
|
7
10
|
import { useWorkspace } from "./WorkspaceProvider.js";
|
|
11
|
+
import { useLayouts } from "../feature-and-layout-provider/index.js";
|
|
12
|
+
import { layoutFromJson, useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
|
|
8
13
|
import LayoutList from "./LayoutList.css";
|
|
9
14
|
const classBase = "vuuLayoutList";
|
|
10
15
|
const NO_SELECTION = [];
|
|
@@ -15,73 +20,108 @@ const LayoutList_LayoutList = ({ className, title, ...htmlAttributes })=>{
|
|
|
15
20
|
css: LayoutList,
|
|
16
21
|
window: targetWindow
|
|
17
22
|
});
|
|
18
|
-
const {
|
|
23
|
+
const { layoutMetadata, loadLayoutById } = useWorkspace();
|
|
24
|
+
const { systemLayouts } = useLayouts();
|
|
25
|
+
const handleLoadLayout = useCallback((layoutId)=>{
|
|
26
|
+
if (layoutId) loadLayoutById(layoutId);
|
|
27
|
+
}, [
|
|
28
|
+
loadLayoutById
|
|
29
|
+
]);
|
|
30
|
+
const dispatch = useLayoutProviderDispatch();
|
|
31
|
+
const handleLoadSysLayout = (layoutId, layoutJSON)=>{
|
|
32
|
+
if (layoutJSON) dispatch({
|
|
33
|
+
type: "add",
|
|
34
|
+
path: `#${VuuShellLocation.Workspace}`,
|
|
35
|
+
component: layoutFromJson(layoutJSON, "0")
|
|
36
|
+
});
|
|
37
|
+
else throw Error("layoutJSON is required for system layouts");
|
|
38
|
+
};
|
|
39
|
+
const layoutsByGroup = layoutMetadata.reduce((acc, cur)=>{
|
|
40
|
+
if (acc[cur.group]) return {
|
|
41
|
+
...acc,
|
|
42
|
+
[cur.group]: [
|
|
43
|
+
...acc[cur.group],
|
|
44
|
+
cur
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
...acc,
|
|
49
|
+
[cur.group]: [
|
|
50
|
+
cur
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
}, {});
|
|
54
|
+
let sysContent = [];
|
|
55
|
+
if (systemLayouts) sysContent = [
|
|
56
|
+
/*#__PURE__*/ jsxs("div", {
|
|
57
|
+
className: `${classBase}-group`,
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ jsx("div", {
|
|
60
|
+
className: `${classBase}-groupHeader`,
|
|
61
|
+
children: "System Layout"
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ jsx(ListBox, {
|
|
64
|
+
selected: NO_SELECTION,
|
|
65
|
+
children: systemLayouts.map((layout)=>/*#__PURE__*/ jsx(Option, {
|
|
66
|
+
value: layout,
|
|
67
|
+
children: /*#__PURE__*/ createElement(LayoutTile, {
|
|
68
|
+
...htmlAttributes,
|
|
69
|
+
key: layout.id,
|
|
70
|
+
metadata: layout,
|
|
71
|
+
onLoadLayout: handleLoadSysLayout
|
|
72
|
+
})
|
|
73
|
+
}, layout.id))
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}, 0)
|
|
77
|
+
];
|
|
78
|
+
const content = useMemo(()=>Object.entries(layoutsByGroup).map(([heading, layoutMetadata], index)=>/*#__PURE__*/ jsxs("div", {
|
|
79
|
+
className: `${classBase}-group`,
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ jsx("div", {
|
|
82
|
+
className: `${classBase}-groupHeader`,
|
|
83
|
+
children: heading
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ jsx(ListBox, {
|
|
86
|
+
selected: NO_SELECTION,
|
|
87
|
+
children: layoutMetadata.map((layout)=>/*#__PURE__*/ jsxs(Option, {
|
|
88
|
+
value: layout,
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ createElement(LayoutTile, {
|
|
91
|
+
...htmlAttributes,
|
|
92
|
+
key: layout.id,
|
|
93
|
+
metadata: layout,
|
|
94
|
+
onLoadLayout: handleLoadLayout
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsx(IconButton, {
|
|
97
|
+
className: `${classBase}-menu`,
|
|
98
|
+
"data-embedded": true,
|
|
99
|
+
icon: "more-vert",
|
|
100
|
+
appearance: "transparent",
|
|
101
|
+
sentiment: "neutral"
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
}, layout.id))
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}, index)), [
|
|
108
|
+
handleLoadLayout,
|
|
109
|
+
htmlAttributes,
|
|
110
|
+
layoutsByGroup
|
|
111
|
+
]);
|
|
19
112
|
return /*#__PURE__*/ jsxs("div", {
|
|
20
113
|
...htmlAttributes,
|
|
21
|
-
className: clsx(classBase,
|
|
114
|
+
className: clsx(classBase, "vuuScrollable"),
|
|
22
115
|
children: [
|
|
23
116
|
/*#__PURE__*/ jsx("div", {
|
|
24
117
|
className: `${classBase}-header`,
|
|
25
118
|
children: title
|
|
26
119
|
}),
|
|
27
|
-
/*#__PURE__*/
|
|
120
|
+
/*#__PURE__*/ jsx("div", {
|
|
28
121
|
className: `${classBase}-content`,
|
|
29
122
|
children: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
children: "Loading layouts…"
|
|
33
|
-
}) : null,
|
|
34
|
-
systemWorkspaces.length > 0 ? /*#__PURE__*/ jsxs("div", {
|
|
35
|
-
className: `${classBase}-group`,
|
|
36
|
-
children: [
|
|
37
|
-
/*#__PURE__*/ jsx("div", {
|
|
38
|
-
className: `${classBase}-groupHeader`,
|
|
39
|
-
children: "System Layouts"
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ jsx(ListBox, {
|
|
42
|
-
selected: NO_SELECTION,
|
|
43
|
-
children: systemWorkspaces.map((definition)=>/*#__PURE__*/ jsx(Option, {
|
|
44
|
-
value: definition.id,
|
|
45
|
-
children: /*#__PURE__*/ jsx("button", {
|
|
46
|
-
onClick: ()=>void openSystemWorkspace(definition),
|
|
47
|
-
type: "button",
|
|
48
|
-
children: definition.name
|
|
49
|
-
})
|
|
50
|
-
}, definition.id))
|
|
51
|
-
})
|
|
52
|
-
]
|
|
53
|
-
}) : null,
|
|
54
|
-
/*#__PURE__*/ jsxs("div", {
|
|
55
|
-
className: `${classBase}-group`,
|
|
56
|
-
children: [
|
|
57
|
-
/*#__PURE__*/ jsx("div", {
|
|
58
|
-
className: `${classBase}-groupHeader`,
|
|
59
|
-
children: "My Layouts"
|
|
60
|
-
}),
|
|
61
|
-
0 === namedWorkspaces.length && "loading" !== status ? /*#__PURE__*/ jsx("div", {
|
|
62
|
-
children: "No saved workspaces"
|
|
63
|
-
}) : /*#__PURE__*/ jsx(ListBox, {
|
|
64
|
-
selected: NO_SELECTION,
|
|
65
|
-
children: namedWorkspaces.map((definition)=>/*#__PURE__*/ jsxs(Option, {
|
|
66
|
-
value: definition.id,
|
|
67
|
-
children: [
|
|
68
|
-
/*#__PURE__*/ jsx("button", {
|
|
69
|
-
onClick: ()=>void openNamedWorkspace(definition.id),
|
|
70
|
-
type: "button",
|
|
71
|
-
children: definition.name
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ jsx(IconButton, {
|
|
74
|
-
"aria-label": `Delete ${definition.name}`,
|
|
75
|
-
appearance: "transparent",
|
|
76
|
-
icon: "delete",
|
|
77
|
-
onClick: ()=>void deleteNamedWorkspace(definition.id),
|
|
78
|
-
sentiment: "neutral"
|
|
79
|
-
})
|
|
80
|
-
]
|
|
81
|
-
}, definition.id))
|
|
82
|
-
})
|
|
83
|
-
]
|
|
84
|
-
})
|
|
123
|
+
sysContent,
|
|
124
|
+
...content
|
|
85
125
|
]
|
|
86
126
|
})
|
|
87
127
|
]
|
|
@@ -2,10 +2,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button, ComboBox, FormField, FormFieldLabel, Input, Option, Text } from "@salt-ds/core";
|
|
3
3
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
4
|
import { useWindow } from "@salt-ds/window";
|
|
5
|
-
import { useAuthenticatedUser } from "@vuu-ui/core";
|
|
6
5
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
7
6
|
import { takeScreenshot } from "./screenshot-utils.js";
|
|
8
7
|
import SaveLayoutPanel from "./SaveLayoutPanel.css";
|
|
8
|
+
import { useApplicationUser } from "../application-provider/index.js";
|
|
9
9
|
const classBase = "vuuSaveLayoutPanel";
|
|
10
10
|
const groups = [
|
|
11
11
|
"Group 1",
|
|
@@ -26,7 +26,7 @@ const SaveLayoutPanel_SaveLayoutPanel = (props)=>{
|
|
|
26
26
|
const [group, setGroup] = useState("");
|
|
27
27
|
const [screenshot, setScreenshot] = useState();
|
|
28
28
|
const [screenshotErrorMessage, setScreenshotErrorMessage] = useState();
|
|
29
|
-
const {
|
|
29
|
+
const { username } = useApplicationUser();
|
|
30
30
|
useEffect(()=>{
|
|
31
31
|
if (componentId) takeScreenshot(document.getElementById(componentId)).then((screenshot)=>{
|
|
32
32
|
setScreenshot(screenshot);
|
|
@@ -41,7 +41,7 @@ const SaveLayoutPanel_SaveLayoutPanel = (props)=>{
|
|
|
41
41
|
name: layoutName,
|
|
42
42
|
group,
|
|
43
43
|
screenshot: screenshot ?? "",
|
|
44
|
-
user:
|
|
44
|
+
user: username
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
const screenshotContent = useMemo(()=>{
|