@vuu-ui/vuu-shell 4.1.0 → 5.0.0-alpha.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 +20 -18
- package/src/app-header/AppHeader.js +36 -26
- package/src/application-provider/ApplicationContext.js +2 -5
- package/src/application-provider/ApplicationProvider.js +8 -59
- package/src/feature/Feature.js +3 -34
- package/src/feature/index.js +1 -0
- package/src/feature-list/FeatureList.css.js +27 -5
- package/src/feature-list/FeatureList.js +117 -96
- package/src/index.js +3 -3
- package/src/left-nav/LeftNav.css.js +2 -4
- package/src/left-nav/LeftNav.js +139 -100
- package/src/module-registry/getRegisteredModules.js +12 -0
- package/src/persistence-manager/PersistenceProvider.js +9 -4
- package/src/persistence-manager/index.js +1 -0
- package/src/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.js +24 -0
- package/src/shell-layout-templates/context-panel/ContextPanel.css.js +8 -8
- package/src/shell-layout-templates/context-panel/ContextPanel.js +17 -35
- package/src/shell-layout-templates/context-panel/index.js +1 -0
- package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +54 -40
- package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +54 -64
- package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +49 -28
- package/src/shell-layout-templates/side-panel/SidePanel.css.js +3 -1
- package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +43 -35
- package/src/shell.css.js +85 -2
- package/src/shell.js +148 -70
- package/src/workspace-management/LayoutList.js +60 -100
- package/src/workspace-management/SaveLayoutPanel.js +3 -3
- package/src/workspace-management/index.js +2 -1
- package/src/workspace-management/shell-workspace-components.js +59 -0
- package/src/workspace-management/useWorkspaceContextMenuItems.js +13 -8
- package/types/app-header/AppHeader.d.ts +1 -1
- package/types/application-provider/ApplicationContext.d.ts +1 -6
- package/types/application-provider/ApplicationProvider.d.ts +5 -14
- package/types/feature/Feature.d.ts +2 -10
- package/types/feature/index.d.ts +2 -1
- package/types/feature-list/FeatureList.d.ts +3 -3
- package/types/index.d.ts +3 -3
- package/types/left-nav/LeftNav.d.ts +1 -0
- package/types/persistence-manager/PersistenceProvider.d.ts +6 -3
- package/types/persistence-manager/index.d.ts +1 -0
- package/types/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.d.ts +1 -1
- package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +9 -11
- package/types/shell-layout-templates/context-panel/index.d.ts +1 -0
- 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/simple-content-pane/useSimpleContentPane.d.ts +1 -1
- package/types/shell-layout-templates/useShellLayout.d.ts +4 -2
- package/types/shell.d.ts +19 -15
- package/types/workspace-management/LayoutList.d.ts +1 -1
- package/types/workspace-management/SaveLayoutPanel.d.ts +1 -1
- package/types/workspace-management/defaultWorkspaceJSON.d.ts +7 -6
- package/types/workspace-management/index.d.ts +6 -1
- package/types/workspace-management/useWorkspaceContextMenuItems.d.ts +1 -1
- package/src/feature/FeatureErrorBoundary.js +0 -33
- package/src/user-settings/SettingsForm.css.js +0 -10
- package/src/user-settings/SettingsForm.js +0 -141
- package/src/user-settings/UserSettingsPanel.css.js +0 -9
- package/src/user-settings/UserSettingsPanel.js +0 -29
- package/src/user-settings/index.js +0 -2
- package/src/workspace-management/WorkspaceProvider.js +0 -209
- package/types/feature/FeatureErrorBoundary.d.ts +0 -13
- 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/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/user-settings/SettingsForm.d.ts +0 -46
- package/types/user-settings/UserSettingsPanel.d.ts +0 -3
- package/types/user-settings/index.d.ts +0 -2
- 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/WorkspaceProvider.d.ts +0 -52
- package/types/workspace-management/WorkspaceRepository.d.ts +0 -13
- package/types/workspace-management/WorkspaceStartPanel.d.ts +0 -1
- package/types/workspace-management/workspace-component-registry.d.ts +0 -12
- package/types/workspace-management/workspace-schemas.d.ts +0 -69
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import react from "react";
|
|
3
|
-
class FeatureErrorBoundary extends react.Component {
|
|
4
|
-
constructor(props){
|
|
5
|
-
super(props);
|
|
6
|
-
this.state = {
|
|
7
|
-
errorMessage: null
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
static getDerivedStateFromError(error) {
|
|
11
|
-
return {
|
|
12
|
-
errorMessage: error.message
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
componentDidCatch(error, errorInfo) {
|
|
16
|
-
console.log(`error creating component at ${this.props.url}`);
|
|
17
|
-
console.log(error, errorInfo);
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
if (this.state.errorMessage) return /*#__PURE__*/ jsxs(Fragment, {
|
|
21
|
-
children: [
|
|
22
|
-
/*#__PURE__*/ jsx("h1", {
|
|
23
|
-
children: "An error occured while creating component."
|
|
24
|
-
}),
|
|
25
|
-
/*#__PURE__*/ jsx("p", {
|
|
26
|
-
children: this.state.errorMessage
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
return this.props.children;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export { FeatureErrorBoundary };
|
|
@@ -1,141 +0,0 @@
|
|
|
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 };
|
|
@@ -1,29 +0,0 @@
|
|
|
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,209 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isLayoutJSON, resolveJSONPath } from "@vuu-ui/vuu-layout";
|
|
3
|
-
import { useNotifications } from "@vuu-ui/vuu-notifications";
|
|
4
|
-
import { VuuShellLocation, WorkspaceContext, logger } from "@vuu-ui/vuu-utils";
|
|
5
|
-
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
6
|
-
import { usePersistenceManager } from "../persistence-manager/index.js";
|
|
7
|
-
import { getWorkspaceWithLayoutJSON, loadingJSON } from "./defaultWorkspaceJSON.js";
|
|
8
|
-
const { info: info } = logger("useLayoutManager");
|
|
9
|
-
const ensureLayoutHasTitle = (layout, layoutMetadata)=>{
|
|
10
|
-
if (layout.props?.title !== void 0) return layout;
|
|
11
|
-
return {
|
|
12
|
-
...layout,
|
|
13
|
-
props: {
|
|
14
|
-
...layout.props,
|
|
15
|
-
title: layoutMetadata.name
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
const loadingApplicationJSON = {
|
|
20
|
-
workspaceJSON: loadingJSON
|
|
21
|
-
};
|
|
22
|
-
const WorkspaceProvider = ({ TabstripProps, children, layoutJSON, activeLayoutIndex, layoutPlaceholderJSON, showTabs, workspaceJSON: customWorkspaceJSON })=>{
|
|
23
|
-
const [layoutMetadata, setLayoutMetadata] = useState([]);
|
|
24
|
-
const [, forceRefresh] = useState({});
|
|
25
|
-
const { showNotification } = useNotifications();
|
|
26
|
-
const persistenceManager = usePersistenceManager();
|
|
27
|
-
const applicationJSONRef = useRef(loadingApplicationJSON);
|
|
28
|
-
const setApplicationJSON = useCallback((applicationJSON, rerender = true)=>{
|
|
29
|
-
applicationJSONRef.current = applicationJSON;
|
|
30
|
-
if (rerender) forceRefresh({});
|
|
31
|
-
}, []);
|
|
32
|
-
const setWorkspaceJSON = useCallback((workspaceJSON, rerender = true)=>{
|
|
33
|
-
setApplicationJSON({
|
|
34
|
-
...applicationJSONRef.current,
|
|
35
|
-
workspaceJSON
|
|
36
|
-
}, rerender);
|
|
37
|
-
}, [
|
|
38
|
-
setApplicationJSON
|
|
39
|
-
]);
|
|
40
|
-
const setApplicationSettings = useCallback((settings)=>{
|
|
41
|
-
setApplicationJSON({
|
|
42
|
-
...applicationJSONRef.current,
|
|
43
|
-
settings: {
|
|
44
|
-
...applicationJSONRef.current.settings,
|
|
45
|
-
...settings
|
|
46
|
-
}
|
|
47
|
-
}, false);
|
|
48
|
-
}, [
|
|
49
|
-
setApplicationJSON
|
|
50
|
-
]);
|
|
51
|
-
useEffect(()=>{
|
|
52
|
-
persistenceManager?.loadMetadata().then((metadata)=>{
|
|
53
|
-
setLayoutMetadata(metadata);
|
|
54
|
-
}).catch((error)=>{
|
|
55
|
-
showNotification({
|
|
56
|
-
content: "Could not load list of available layouts",
|
|
57
|
-
header: "Failed to Load Layouts",
|
|
58
|
-
status: "error",
|
|
59
|
-
type: "toast"
|
|
60
|
-
});
|
|
61
|
-
console.error("Error occurred while retrieving metadata", error);
|
|
62
|
-
});
|
|
63
|
-
persistenceManager?.loadApplicationJSON().then((applicationJSON)=>{
|
|
64
|
-
if (applicationJSON) {
|
|
65
|
-
info?.("applicationJSON loaded successfully");
|
|
66
|
-
setApplicationJSON(applicationJSON);
|
|
67
|
-
} else {
|
|
68
|
-
const workspaceJSON = getWorkspaceWithLayoutJSON(customWorkspaceJSON, layoutJSON, activeLayoutIndex, {
|
|
69
|
-
TabstripProps,
|
|
70
|
-
showTabs
|
|
71
|
-
});
|
|
72
|
-
info?.(`applicationJSON not found, getting defaultWorkspaceJSON,
|
|
73
|
-
${JSON.stringify(workspaceJSON, null, 2)}
|
|
74
|
-
`);
|
|
75
|
-
setApplicationJSON({
|
|
76
|
-
workspaceJSON
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}).catch((error)=>{
|
|
80
|
-
showNotification({
|
|
81
|
-
content: "Could not load your latest view",
|
|
82
|
-
header: "Failed to Load Layout",
|
|
83
|
-
status: "error",
|
|
84
|
-
type: "toast"
|
|
85
|
-
});
|
|
86
|
-
console.error("Error occurred while retrieving application layout", error);
|
|
87
|
-
});
|
|
88
|
-
}, [
|
|
89
|
-
TabstripProps,
|
|
90
|
-
activeLayoutIndex,
|
|
91
|
-
customWorkspaceJSON,
|
|
92
|
-
layoutJSON,
|
|
93
|
-
showNotification,
|
|
94
|
-
persistenceManager,
|
|
95
|
-
setApplicationJSON,
|
|
96
|
-
showTabs
|
|
97
|
-
]);
|
|
98
|
-
const saveApplicationLayout = useCallback((layout)=>{
|
|
99
|
-
if (isLayoutJSON(layout)) {
|
|
100
|
-
setWorkspaceJSON(layout, false);
|
|
101
|
-
persistenceManager?.saveApplicationJSON(applicationJSONRef.current);
|
|
102
|
-
} else console.error("Tried to save invalid application layout", layout);
|
|
103
|
-
}, [
|
|
104
|
-
persistenceManager,
|
|
105
|
-
setWorkspaceJSON
|
|
106
|
-
]);
|
|
107
|
-
const saveLayout = useCallback((metadata)=>{
|
|
108
|
-
let layoutToSave;
|
|
109
|
-
try {
|
|
110
|
-
const { workspaceJSON } = applicationJSONRef.current;
|
|
111
|
-
if (Array.isArray(workspaceJSON)) console.log("how do we identify the right thing to save");
|
|
112
|
-
else layoutToSave = resolveJSONPath(workspaceJSON, `#${VuuShellLocation.Workspace}.ACTIVE_CHILD`);
|
|
113
|
-
} catch (e) {}
|
|
114
|
-
if (layoutToSave && isLayoutJSON(layoutToSave)) persistenceManager?.createLayout(metadata, ensureLayoutHasTitle(layoutToSave, metadata)).then((metadata)=>{
|
|
115
|
-
showNotification({
|
|
116
|
-
content: `${metadata.name} saved successfully`,
|
|
117
|
-
header: "Layout Saved Successfully",
|
|
118
|
-
status: "success",
|
|
119
|
-
type: "toast"
|
|
120
|
-
});
|
|
121
|
-
setLayoutMetadata((prev)=>[
|
|
122
|
-
...prev,
|
|
123
|
-
metadata
|
|
124
|
-
]);
|
|
125
|
-
}).catch((error)=>{
|
|
126
|
-
showNotification({
|
|
127
|
-
content: `Failed to save layout ${metadata.name}`,
|
|
128
|
-
header: "Failed to Save Layout",
|
|
129
|
-
status: "error",
|
|
130
|
-
type: "toast"
|
|
131
|
-
});
|
|
132
|
-
console.error("Error occurred while saving layout", error);
|
|
133
|
-
});
|
|
134
|
-
else {
|
|
135
|
-
console.error("Tried to save invalid layout", layoutToSave);
|
|
136
|
-
showNotification({
|
|
137
|
-
content: "Cannot save invalid layout",
|
|
138
|
-
header: "Failed to Save Layout",
|
|
139
|
-
status: "error",
|
|
140
|
-
type: "toast"
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}, [
|
|
144
|
-
showNotification,
|
|
145
|
-
persistenceManager
|
|
146
|
-
]);
|
|
147
|
-
const saveApplicationSettings = useCallback((settings, key)=>{
|
|
148
|
-
const { settings: applicationSettings } = applicationJSONRef.current;
|
|
149
|
-
key ? setApplicationSettings({
|
|
150
|
-
...applicationSettings,
|
|
151
|
-
[key]: settings
|
|
152
|
-
}) : setApplicationSettings(settings);
|
|
153
|
-
persistenceManager?.saveApplicationJSON(applicationJSONRef.current);
|
|
154
|
-
}, [
|
|
155
|
-
persistenceManager,
|
|
156
|
-
setApplicationSettings
|
|
157
|
-
]);
|
|
158
|
-
const getApplicationSettings = useCallback((key)=>{
|
|
159
|
-
const { settings } = applicationJSONRef.current;
|
|
160
|
-
return key ? settings?.[key] : settings;
|
|
161
|
-
}, []);
|
|
162
|
-
const loadLayoutById = useCallback((id)=>{
|
|
163
|
-
persistenceManager?.loadLayout(id).then((layoutJson)=>{
|
|
164
|
-
const { workspaceJSON: currentLayout } = applicationJSONRef.current;
|
|
165
|
-
if (Array.isArray(currentLayout)) console.log("how do we deal witha amulti layoput");
|
|
166
|
-
else setWorkspaceJSON({
|
|
167
|
-
...currentLayout,
|
|
168
|
-
children: (currentLayout.children || []).concat(layoutJson),
|
|
169
|
-
props: {
|
|
170
|
-
...currentLayout.props,
|
|
171
|
-
active: currentLayout.children?.length ?? 0
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}).catch((error)=>{
|
|
175
|
-
showNotification({
|
|
176
|
-
content: "Failed to load the requested layout",
|
|
177
|
-
header: "Failed to Load Layout",
|
|
178
|
-
status: "error",
|
|
179
|
-
type: "toast"
|
|
180
|
-
});
|
|
181
|
-
console.error("Error occurred while loading layout", error);
|
|
182
|
-
});
|
|
183
|
-
}, [
|
|
184
|
-
showNotification,
|
|
185
|
-
persistenceManager,
|
|
186
|
-
setWorkspaceJSON
|
|
187
|
-
]);
|
|
188
|
-
return /*#__PURE__*/ jsx(WorkspaceContext.Provider, {
|
|
189
|
-
value: {
|
|
190
|
-
getApplicationSettings,
|
|
191
|
-
layoutMetadata,
|
|
192
|
-
layoutPlaceholderJSON,
|
|
193
|
-
saveLayout,
|
|
194
|
-
workspaceJSON: applicationJSONRef.current.workspaceJSON,
|
|
195
|
-
saveApplicationLayout,
|
|
196
|
-
saveApplicationSettings,
|
|
197
|
-
loadLayoutById
|
|
198
|
-
},
|
|
199
|
-
children: children
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
const useWorkspace = ()=>{
|
|
203
|
-
const { workspaceJSON = getWorkspaceWithLayoutJSON(), ...contextProps } = useContext(WorkspaceContext);
|
|
204
|
-
return {
|
|
205
|
-
...contextProps,
|
|
206
|
-
workspaceJSON
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
export { WorkspaceProvider, useWorkspace };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DynamicFeatureProps } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import React, { ErrorInfo, ReactNode } from "react";
|
|
3
|
-
export interface FeatureErrorBoundaryProps extends DynamicFeatureProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export declare class FeatureErrorBoundary extends React.Component<FeatureErrorBoundaryProps, any> {
|
|
7
|
-
constructor(props: FeatureErrorBoundaryProps);
|
|
8
|
-
static getDerivedStateFromError(error: Error): {
|
|
9
|
-
errorMessage: string;
|
|
10
|
-
};
|
|
11
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
12
|
-
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type ApplicationSessionV1, type NamedWorkspaceDefinitionV1, type NamedWorkspaceMetadataV1, type WorkspaceSnapshotRecordV1 } from "../workspace-management/workspace-schemas";
|
|
2
|
-
import type { UserPersistenceScope, WorkspacePersistenceService } from "./WorkspacePersistenceService";
|
|
3
|
-
export declare class LocalWorkspacePersistenceService implements WorkspacePersistenceService {
|
|
4
|
-
#private;
|
|
5
|
-
readonly scope: UserPersistenceScope;
|
|
6
|
-
constructor(scope: UserPersistenceScope, storage?: Storage);
|
|
7
|
-
loadApplicationSession(): Promise<ApplicationSessionV1 | undefined>;
|
|
8
|
-
saveApplicationSession(session: ApplicationSessionV1): Promise<void>;
|
|
9
|
-
deleteApplicationSession(): Promise<void>;
|
|
10
|
-
listWorkspaceSnapshots(): Promise<readonly WorkspaceSnapshotRecordV1[]>;
|
|
11
|
-
loadWorkspaceSnapshot(workspaceInstanceId: string): Promise<WorkspaceSnapshotRecordV1 | undefined>;
|
|
12
|
-
saveWorkspaceSnapshot(snapshot: WorkspaceSnapshotRecordV1): Promise<void>;
|
|
13
|
-
deleteWorkspaceSnapshot(workspaceInstanceId: string): Promise<void>;
|
|
14
|
-
listNamedWorkspaceMetadata(): Promise<readonly NamedWorkspaceMetadataV1[]>;
|
|
15
|
-
loadNamedWorkspaceDefinition(id: string): Promise<NamedWorkspaceDefinitionV1 | undefined>;
|
|
16
|
-
saveNamedWorkspaceDefinition(definition: NamedWorkspaceDefinitionV1): Promise<void>;
|
|
17
|
-
deleteNamedWorkspaceDefinition(id: string): Promise<void>;
|
|
18
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type ApplicationSessionV1, type NamedWorkspaceDefinitionV1, type NamedWorkspaceMetadataV1, type WorkspaceSnapshotRecordV1 } from "../workspace-management/workspace-schemas";
|
|
2
|
-
import type { UserPersistenceScope, WorkspacePersistenceService } from "./WorkspacePersistenceService";
|
|
3
|
-
export type WorkspaceRequestInitProvider = () => RequestInit | Promise<RequestInit>;
|
|
4
|
-
export interface RemoteWorkspacePersistenceOptions {
|
|
5
|
-
readonly baseUrl: string;
|
|
6
|
-
readonly requestInit?: RequestInit;
|
|
7
|
-
readonly requestInitProvider?: WorkspaceRequestInitProvider;
|
|
8
|
-
readonly fetch?: typeof fetch;
|
|
9
|
-
}
|
|
10
|
-
export declare class RemoteWorkspacePersistenceService implements WorkspacePersistenceService {
|
|
11
|
-
#private;
|
|
12
|
-
readonly scope: UserPersistenceScope;
|
|
13
|
-
constructor(scope: UserPersistenceScope, { baseUrl, requestInit, requestInitProvider, fetch: fetchImplementation, }: RemoteWorkspacePersistenceOptions);
|
|
14
|
-
loadApplicationSession(): Promise<ApplicationSessionV1 | undefined>;
|
|
15
|
-
saveApplicationSession(session: ApplicationSessionV1): Promise<void>;
|
|
16
|
-
deleteApplicationSession(): Promise<void>;
|
|
17
|
-
listWorkspaceSnapshots(): Promise<readonly WorkspaceSnapshotRecordV1[]>;
|
|
18
|
-
loadWorkspaceSnapshot(workspaceInstanceId: string): Promise<WorkspaceSnapshotRecordV1 | undefined>;
|
|
19
|
-
saveWorkspaceSnapshot(snapshot: WorkspaceSnapshotRecordV1): Promise<void>;
|
|
20
|
-
deleteWorkspaceSnapshot(workspaceInstanceId: string): Promise<void>;
|
|
21
|
-
listNamedWorkspaceMetadata(): Promise<readonly NamedWorkspaceMetadataV1[]>;
|
|
22
|
-
loadNamedWorkspaceDefinition(id: string): Promise<NamedWorkspaceDefinitionV1 | undefined>;
|
|
23
|
-
saveNamedWorkspaceDefinition(definition: NamedWorkspaceDefinitionV1): Promise<void>;
|
|
24
|
-
deleteNamedWorkspaceDefinition(id: string): Promise<void>;
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ApplicationSessionV1, NamedWorkspaceDefinitionV1, NamedWorkspaceMetadataV1, WorkspaceSnapshotRecordV1 } from "../workspace-management/workspace-schemas";
|
|
2
|
-
export interface PersistenceScope {
|
|
3
|
-
readonly applicationNamespace: string;
|
|
4
|
-
readonly applicationId: string;
|
|
5
|
-
}
|
|
6
|
-
export interface UserPersistenceScope extends PersistenceScope {
|
|
7
|
-
readonly userId: string;
|
|
8
|
-
}
|
|
9
|
-
export interface WorkspacePersistenceService {
|
|
10
|
-
readonly scope: UserPersistenceScope;
|
|
11
|
-
loadApplicationSession(): Promise<ApplicationSessionV1 | undefined>;
|
|
12
|
-
saveApplicationSession(session: ApplicationSessionV1): Promise<void>;
|
|
13
|
-
deleteApplicationSession(): Promise<void>;
|
|
14
|
-
listWorkspaceSnapshots(): Promise<readonly WorkspaceSnapshotRecordV1[]>;
|
|
15
|
-
loadWorkspaceSnapshot(workspaceInstanceId: string): Promise<WorkspaceSnapshotRecordV1 | undefined>;
|
|
16
|
-
saveWorkspaceSnapshot(snapshot: WorkspaceSnapshotRecordV1): Promise<void>;
|
|
17
|
-
deleteWorkspaceSnapshot(workspaceInstanceId: string): Promise<void>;
|
|
18
|
-
listNamedWorkspaceMetadata(): Promise<readonly NamedWorkspaceMetadataV1[]>;
|
|
19
|
-
loadNamedWorkspaceDefinition(id: string): Promise<NamedWorkspaceDefinitionV1 | undefined>;
|
|
20
|
-
saveNamedWorkspaceDefinition(definition: NamedWorkspaceDefinitionV1): Promise<void>;
|
|
21
|
-
deleteNamedWorkspaceDefinition(id: string): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
export declare class WorkspacePersistenceError extends Error {
|
|
24
|
-
readonly operation: string;
|
|
25
|
-
readonly status?: number | undefined;
|
|
26
|
-
constructor(message: string, operation: string, status?: number | undefined);
|
|
27
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ShellContextProps } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
3
|
-
export interface ShellProviderProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
value?: ShellContextProps;
|
|
6
|
-
}
|
|
7
|
-
export declare const ShellContextProvider: ({ children, value, }: ShellProviderProps) => ReactElement;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ThemeMode } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { HTMLAttributes } from "react";
|
|
3
|
-
export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
themeMode?: ThemeMode;
|
|
5
|
-
}
|
|
6
|
-
export declare const AppHeader: ({ className: classNameProp, themeMode: _, ...htmlAttributes }: AppHeaderProps) => import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './AppHeader';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Settings, VuuUser } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
-
import { SettingsSchema } from "../user-settings";
|
|
4
|
-
export interface ApplicationContextProps {
|
|
5
|
-
onUserSettingChanged: (propertyName: string, value: VuuRowDataItemType) => void;
|
|
6
|
-
logout?: () => void;
|
|
7
|
-
userSettings?: Settings;
|
|
8
|
-
userSettingsSchema?: SettingsSchema;
|
|
9
|
-
user: VuuUser;
|
|
10
|
-
}
|
|
11
|
-
export declare const ApplicationContext: import("react").Context<ApplicationContextProps>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
2
|
-
import { Density, ThemeContextProps } from "@salt-ds/core";
|
|
3
|
-
import { ReactElement, ReactNode } from "react";
|
|
4
|
-
import { ApplicationContextProps } from "./ApplicationContext";
|
|
5
|
-
export interface ApplicationProviderProps extends Partial<Pick<ThemeContextProps, "theme" | "mode">>, Partial<Omit<ApplicationContextProps, "userSettings">> {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
density?: Density;
|
|
8
|
-
}
|
|
9
|
-
export declare const ApplicationProvider: ({ children, density: densityProp, logout, mode, theme, userSettingsSchema: userSettingsSchema, user, }: ApplicationProviderProps) => ReactElement | null;
|
|
10
|
-
export declare const useApplicationUser: () => import("@vuu-ui/vuu-utils").VuuUser;
|
|
11
|
-
export declare const useApplicationSettings: () => {
|
|
12
|
-
onUserSettingChanged: (propertyName: string, value: VuuRowDataItemType) => void;
|
|
13
|
-
userSettings: import("@vuu-ui/vuu-utils").Settings | undefined;
|
|
14
|
-
userSettingsSchema: import("..").SettingsSchema | undefined;
|
|
15
|
-
};
|
|
16
|
-
export declare const useUserSetting: () => import("@vuu-ui/vuu-utils").Settings | undefined;
|
|
17
|
-
export declare const useLogout: () => (() => void) | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ApplicationProvider";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DynamicFeatureProps } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import React from "react";
|
|
3
|
-
declare function RawFeature<Params extends object | undefined>({ url, css, ComponentProps: params, ...props }: DynamicFeatureProps<Params>): React.JSX.Element;
|
|
4
|
-
/**
|
|
5
|
-
Feature is a wrapper around React Lazy Loading. It will load a component
|
|
6
|
-
from the given url. That url must resolve to a javascript bundle with a
|
|
7
|
-
single default export. That export must be a React component.
|
|
8
|
-
*/
|
|
9
|
-
export declare const Feature: React.MemoExoticComponent<typeof RawFeature>;
|
|
10
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DynamicFeatureProps } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import React, { ErrorInfo, ReactNode } from "react";
|
|
3
|
-
export interface FeatureErrorBoundaryProps extends DynamicFeatureProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export declare class FeatureErrorBoundary extends React.Component<FeatureErrorBoundaryProps, any> {
|
|
7
|
-
constructor(props: FeatureErrorBoundaryProps);
|
|
8
|
-
static getDerivedStateFromError(error: Error): {
|
|
9
|
-
errorMessage: string;
|
|
10
|
-
};
|
|
11
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
12
|
-
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Loader: () => import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Feature';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DynamicFeatureDescriptor, DynamicFeatureProps, FilterTableFeatureProps, StaticFeatureDescriptor, SystemLayoutMetadata } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
3
|
-
export interface FeatureContextProps {
|
|
4
|
-
dynamicFeatures?: DynamicFeatureProps[];
|
|
5
|
-
tableFeatures?: DynamicFeatureProps<FilterTableFeatureProps>[];
|
|
6
|
-
staticFeatures?: StaticFeatureDescriptor[];
|
|
7
|
-
}
|
|
8
|
-
export interface LayoutContextProps {
|
|
9
|
-
systemLayouts?: SystemLayoutMetadata[];
|
|
10
|
-
}
|
|
11
|
-
export interface FeatureAndLayoutProviderProps extends Partial<FeatureContextProps> {
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
dynamicFeatures?: DynamicFeatureDescriptor[];
|
|
14
|
-
staticFeatures?: StaticFeatureDescriptor[];
|
|
15
|
-
systemLayouts?: SystemLayoutMetadata[];
|
|
16
|
-
}
|
|
17
|
-
export declare const FeatureAndLayoutProvider: ({ children, dynamicFeatures: dynamicFeaturesProp, staticFeatures, systemLayouts, }: FeatureAndLayoutProviderProps) => ReactElement;
|
|
18
|
-
export declare const useFeatures: () => FeatureContextProps;
|
|
19
|
-
export declare const useLayouts: () => LayoutContextProps;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FeatureAndLayoutProvider";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DynamicFeatureProps, StaticFeatureDescriptor } from "@vuu-ui/vuu-utils";
|
|
2
|
-
import { HTMLAttributes } from "react";
|
|
3
|
-
export type GroupedFeatureProps<P extends object | undefined = object> = Record<string, DynamicFeatureProps<P>[]>;
|
|
4
|
-
export interface FeatureListProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
features: DynamicFeatureProps[] | GroupedFeatureProps | StaticFeatureDescriptor[];
|
|
6
|
-
}
|
|
7
|
-
export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FeatureList";
|