@vuu-ui/vuu-shell 0.8.10-debug → 0.8.11-debug
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/cjs/index.js +215 -305
- package/cjs/index.js.map +4 -4
- package/esm/index.js +165 -252
- package/esm/index.js.map +4 -4
- package/index.css +6 -5
- package/index.css.map +2 -2
- package/package.json +8 -8
- package/types/index.d.ts +0 -1
- package/types/layout-management/layoutTypes.d.ts +7 -6
- package/types/layout-management/useLayoutManager.d.ts +14 -5
- package/types/shell.d.ts +1 -3
- package/types/theme-provider/ThemeProvider.d.ts +7 -2
- package/types/layout-config/index.d.ts +0 -1
- package/types/layout-config/local-config.d.ts +0 -4
- package/types/layout-config/remote-config.d.ts +0 -4
- package/types/layout-config/use-layout-config.d.ts +0 -15
package/esm/index.js
CHANGED
|
@@ -154,107 +154,8 @@ var Feature = React3.memo(RawFeature);
|
|
|
154
154
|
Feature.displayName = "Feature";
|
|
155
155
|
registerComponent("Feature", Feature, "view");
|
|
156
156
|
|
|
157
|
-
// src/layout-config/use-layout-config.ts
|
|
158
|
-
import { useCallback as useCallback2, useEffect as useEffect3, useState as useState2 } from "react";
|
|
159
|
-
|
|
160
|
-
// src/layout-config/local-config.ts
|
|
161
|
-
import { resolveJSONPath } from "@vuu-ui/vuu-layout";
|
|
162
|
-
var loadLocalConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
|
|
163
|
-
console.log(
|
|
164
|
-
`load local config at ${saveUrl} for user ${user == null ? void 0 : user.username}, id ${id}`
|
|
165
|
-
);
|
|
166
|
-
const data = localStorage.getItem(saveUrl);
|
|
167
|
-
if (data) {
|
|
168
|
-
const layout = JSON.parse(data);
|
|
169
|
-
resolve(layout);
|
|
170
|
-
} else {
|
|
171
|
-
reject();
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
var saveLocalConfig = (saveUrl, user, data) => new Promise((resolve, reject) => {
|
|
175
|
-
try {
|
|
176
|
-
const layoutJson = resolveJSONPath(data, "#main-tabs.ACTIVE_CHILD");
|
|
177
|
-
console.log(layoutJson);
|
|
178
|
-
localStorage.setItem(saveUrl, JSON.stringify(data));
|
|
179
|
-
resolve(void 0);
|
|
180
|
-
} catch {
|
|
181
|
-
reject();
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// src/layout-config/remote-config.ts
|
|
186
|
-
var loadRemoteConfig = (saveUrl, user, id = "latest") => new Promise((resolve, reject) => {
|
|
187
|
-
if (user === void 0) {
|
|
188
|
-
throw Error("user mustb be provided to load remote config");
|
|
189
|
-
}
|
|
190
|
-
fetch(`${saveUrl}/${user.username}/${id}`, {}).then((response) => {
|
|
191
|
-
if (response.ok) {
|
|
192
|
-
resolve(response.json());
|
|
193
|
-
} else {
|
|
194
|
-
reject(void 0);
|
|
195
|
-
}
|
|
196
|
-
}).catch(() => {
|
|
197
|
-
reject(void 0);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
var saveRemoteConfig = (saveUrl, user, data) => new Promise((resolve, reject) => {
|
|
201
|
-
if (user === void 0) {
|
|
202
|
-
throw Error("user mustb be provided to load remote config");
|
|
203
|
-
}
|
|
204
|
-
fetch(`${saveUrl}/${user.username}`, {
|
|
205
|
-
method: "POST",
|
|
206
|
-
headers: {
|
|
207
|
-
"Content-Type": "application/json"
|
|
208
|
-
},
|
|
209
|
-
body: JSON.stringify(data)
|
|
210
|
-
}).then((response) => {
|
|
211
|
-
if (response.ok) {
|
|
212
|
-
resolve(void 0);
|
|
213
|
-
} else {
|
|
214
|
-
reject();
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// src/layout-config/use-layout-config.ts
|
|
220
|
-
var FALLBACK_LAYOUT = { type: "Placeholder" };
|
|
221
|
-
var useLayoutConfig = ({
|
|
222
|
-
saveLocation,
|
|
223
|
-
saveUrl = "api/vui",
|
|
224
|
-
user,
|
|
225
|
-
// TODO this should be an error panel
|
|
226
|
-
defaultLayout = FALLBACK_LAYOUT
|
|
227
|
-
}) => {
|
|
228
|
-
const [layout, _setLayout] = useState2(defaultLayout);
|
|
229
|
-
const usingRemote = saveLocation === "remote";
|
|
230
|
-
const loadConfig = usingRemote ? loadRemoteConfig : loadLocalConfig;
|
|
231
|
-
const saveConfig = usingRemote ? saveRemoteConfig : saveLocalConfig;
|
|
232
|
-
const load = useCallback2(
|
|
233
|
-
async (id = "latest") => {
|
|
234
|
-
try {
|
|
235
|
-
const layout2 = await loadConfig(saveUrl, user, id);
|
|
236
|
-
_setLayout(layout2);
|
|
237
|
-
} catch {
|
|
238
|
-
_setLayout(defaultLayout);
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
[defaultLayout, loadConfig, saveUrl, user]
|
|
242
|
-
);
|
|
243
|
-
useEffect3(() => {
|
|
244
|
-
load();
|
|
245
|
-
}, [load]);
|
|
246
|
-
const saveData = useCallback2(
|
|
247
|
-
(data) => {
|
|
248
|
-
saveConfig(saveUrl, user, data);
|
|
249
|
-
},
|
|
250
|
-
[saveConfig, saveUrl, user]
|
|
251
|
-
);
|
|
252
|
-
const loadLayoutById = useCallback2((id) => load(id), [load]);
|
|
253
|
-
return [layout, saveData, loadLayoutById];
|
|
254
|
-
};
|
|
255
|
-
|
|
256
157
|
// src/layout-management/SaveLayoutPanel.tsx
|
|
257
|
-
import { useEffect as
|
|
158
|
+
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
258
159
|
import { Input, Button, FormField, FormFieldLabel, Text } from "@salt-ds/core";
|
|
259
160
|
import { ComboBox, Checkbox, RadioButton } from "@vuu-ui/vuu-ui-controls";
|
|
260
161
|
import { formatDate, takeScreenshot } from "@vuu-ui/vuu-utils";
|
|
@@ -266,18 +167,18 @@ var checkboxValues = ["Value 1", "Value 2", "Value 3"];
|
|
|
266
167
|
var radioValues = ["Value 1", "Value 2", "Value 3"];
|
|
267
168
|
var SaveLayoutPanel = (props) => {
|
|
268
169
|
const { onCancel, onSave, componentId } = props;
|
|
269
|
-
const [layoutName, setLayoutName] =
|
|
270
|
-
const [group, setGroup] =
|
|
271
|
-
const [checkValues, setCheckValues] =
|
|
272
|
-
const [radioValue, setRadioValue] =
|
|
273
|
-
const [screenshot, setScreenshot] =
|
|
274
|
-
|
|
170
|
+
const [layoutName, setLayoutName] = useState2("");
|
|
171
|
+
const [group, setGroup] = useState2("");
|
|
172
|
+
const [checkValues, setCheckValues] = useState2([]);
|
|
173
|
+
const [radioValue, setRadioValue] = useState2(radioValues[0]);
|
|
174
|
+
const [screenshot, setScreenshot] = useState2();
|
|
175
|
+
useEffect3(() => {
|
|
275
176
|
if (componentId) {
|
|
276
177
|
takeScreenshot(document.getElementById(componentId)).then(
|
|
277
178
|
(screenshot2) => setScreenshot(screenshot2)
|
|
278
179
|
);
|
|
279
180
|
}
|
|
280
|
-
}, []);
|
|
181
|
+
}, [componentId]);
|
|
281
182
|
const handleSubmit = () => {
|
|
282
183
|
onSave({
|
|
283
184
|
name: layoutName,
|
|
@@ -295,14 +196,6 @@ var SaveLayoutPanel = (props) => {
|
|
|
295
196
|
/* @__PURE__ */ jsx6(
|
|
296
197
|
ComboBox,
|
|
297
198
|
{
|
|
298
|
-
ListProps: {
|
|
299
|
-
style: {
|
|
300
|
-
zIndex: 1e4,
|
|
301
|
-
border: "1px solid #777C94",
|
|
302
|
-
borderRadius: 10,
|
|
303
|
-
boxSizing: "border-box"
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
199
|
source: groups,
|
|
307
200
|
allowFreeText: true,
|
|
308
201
|
InputProps: {
|
|
@@ -387,37 +280,77 @@ var SaveLayoutPanel = (props) => {
|
|
|
387
280
|
import { List } from "@vuu-ui/vuu-ui-controls";
|
|
388
281
|
|
|
389
282
|
// src/layout-management/useLayoutManager.tsx
|
|
390
|
-
import React4, { useState as
|
|
391
|
-
import {
|
|
392
|
-
|
|
283
|
+
import React4, { useState as useState3, useCallback as useCallback2, useContext, useEffect as useEffect4 } from "react";
|
|
284
|
+
import {
|
|
285
|
+
LocalLayoutPersistenceManager,
|
|
286
|
+
resolveJSONPath
|
|
287
|
+
} from "@vuu-ui/vuu-layout";
|
|
288
|
+
import { defaultLayout } from "@vuu-ui/vuu-layout/";
|
|
393
289
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
394
|
-
var
|
|
395
|
-
|
|
290
|
+
var persistenceManager = new LocalLayoutPersistenceManager();
|
|
291
|
+
var LayoutManagementContext = React4.createContext({
|
|
292
|
+
layoutMetadata: [],
|
|
293
|
+
saveLayout: () => {
|
|
294
|
+
},
|
|
295
|
+
applicationLayout: defaultLayout,
|
|
296
|
+
saveApplicationLayout: () => {
|
|
297
|
+
},
|
|
298
|
+
loadLayoutById: () => defaultLayout
|
|
299
|
+
});
|
|
396
300
|
var LayoutManagementProvider = (props) => {
|
|
397
|
-
const [
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
301
|
+
const [layoutMetadata, setLayoutMetadata] = useState3([]);
|
|
302
|
+
const [applicationLayout, setApplicationLayout] = useState3(defaultLayout);
|
|
303
|
+
useEffect4(() => {
|
|
304
|
+
persistenceManager.loadMetadata().then((metadata) => {
|
|
305
|
+
setLayoutMetadata(metadata);
|
|
306
|
+
});
|
|
307
|
+
persistenceManager.loadApplicationLayout().then((layout) => {
|
|
308
|
+
setApplicationLayout(layout);
|
|
309
|
+
});
|
|
401
310
|
}, []);
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
311
|
+
const saveApplicationLayout = useCallback2((layout) => {
|
|
312
|
+
setApplicationLayout(layout);
|
|
313
|
+
persistenceManager.saveApplicationLayout(layout);
|
|
314
|
+
}, []);
|
|
315
|
+
const saveLayout = useCallback2(
|
|
316
|
+
(metadata) => {
|
|
317
|
+
const layoutToSave = resolveJSONPath(
|
|
318
|
+
applicationLayout,
|
|
319
|
+
"#main-tabs.ACTIVE_CHILD"
|
|
320
|
+
);
|
|
321
|
+
if (layoutToSave) {
|
|
322
|
+
persistenceManager.createLayout(metadata, layoutToSave).then((generatedId) => {
|
|
323
|
+
const newMetadata = {
|
|
412
324
|
...metadata,
|
|
413
|
-
id:
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
}
|
|
325
|
+
id: generatedId
|
|
326
|
+
};
|
|
327
|
+
setLayoutMetadata((prev) => [...prev, newMetadata]);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
[applicationLayout]
|
|
332
|
+
);
|
|
333
|
+
const loadLayoutById = useCallback2((id) => {
|
|
334
|
+
persistenceManager.loadLayout(id).then((layoutJson) => {
|
|
335
|
+
setApplicationLayout((prev) => ({
|
|
336
|
+
...prev,
|
|
337
|
+
children: [...prev.children || [], layoutJson]
|
|
338
|
+
}));
|
|
339
|
+
});
|
|
419
340
|
}, []);
|
|
420
|
-
return /* @__PURE__ */ jsx7(
|
|
341
|
+
return /* @__PURE__ */ jsx7(
|
|
342
|
+
LayoutManagementContext.Provider,
|
|
343
|
+
{
|
|
344
|
+
value: {
|
|
345
|
+
layoutMetadata,
|
|
346
|
+
saveLayout,
|
|
347
|
+
applicationLayout,
|
|
348
|
+
saveApplicationLayout,
|
|
349
|
+
loadLayoutById
|
|
350
|
+
},
|
|
351
|
+
children: props.children
|
|
352
|
+
}
|
|
353
|
+
);
|
|
421
354
|
};
|
|
422
355
|
var useLayoutManager = () => useContext(LayoutManagementContext);
|
|
423
356
|
|
|
@@ -425,14 +358,11 @@ var useLayoutManager = () => useContext(LayoutManagementContext);
|
|
|
425
358
|
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
426
359
|
var classBase3 = "vuuLayoutList";
|
|
427
360
|
var LayoutsList = (props) => {
|
|
428
|
-
const {
|
|
429
|
-
const layoutMetadata = layouts.map((layout) => layout.metadata);
|
|
361
|
+
const { layoutMetadata, loadLayoutById } = useLayoutManager();
|
|
430
362
|
const handleLoadLayout = (layoutId) => {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
layouts.find((layout) => layout.metadata.id === layoutId)
|
|
435
|
-
);
|
|
363
|
+
if (layoutId) {
|
|
364
|
+
loadLayoutById(layoutId);
|
|
365
|
+
}
|
|
436
366
|
};
|
|
437
367
|
const layoutsByGroup = layoutMetadata.reduce((acc, cur) => {
|
|
438
368
|
if (acc[cur.group]) {
|
|
@@ -453,37 +383,35 @@ var LayoutsList = (props) => {
|
|
|
453
383
|
{
|
|
454
384
|
height: "fit-content",
|
|
455
385
|
source: Object.entries(layoutsByGroup),
|
|
456
|
-
ListItem: ({ item }) =>
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
{
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
{
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
)
|
|
486
|
-
] })
|
|
386
|
+
ListItem: ({ item }) => {
|
|
387
|
+
if (!item)
|
|
388
|
+
return /* @__PURE__ */ jsx8(Fragment3, {});
|
|
389
|
+
const [groupName, layouts] = item;
|
|
390
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
391
|
+
/* @__PURE__ */ jsx8("div", { className: `${classBase3}-groupName`, children: groupName }),
|
|
392
|
+
layouts.map((layout) => /* @__PURE__ */ jsxs4(
|
|
393
|
+
"div",
|
|
394
|
+
{
|
|
395
|
+
className: `${classBase3}-layoutContainer`,
|
|
396
|
+
onClick: () => handleLoadLayout(layout == null ? void 0 : layout.id),
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ jsx8(
|
|
399
|
+
"img",
|
|
400
|
+
{
|
|
401
|
+
className: `${classBase3}-screenshot`,
|
|
402
|
+
src: layout == null ? void 0 : layout.screenshot
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
406
|
+
/* @__PURE__ */ jsx8("div", { className: `${classBase3}-layoutName`, children: layout == null ? void 0 : layout.name }),
|
|
407
|
+
/* @__PURE__ */ jsx8("div", { className: `${classBase3}-layoutDetails`, children: /* @__PURE__ */ jsx8("div", { children: `${layout == null ? void 0 : layout.user}, ${layout == null ? void 0 : layout.date}` }) })
|
|
408
|
+
] })
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
layout == null ? void 0 : layout.id
|
|
412
|
+
))
|
|
413
|
+
] });
|
|
414
|
+
}
|
|
487
415
|
}
|
|
488
416
|
)
|
|
489
417
|
] });
|
|
@@ -591,7 +519,7 @@ VuuLogo.displayName = "VuuLogo";
|
|
|
591
519
|
import { Action, Stack, useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
|
|
592
520
|
import { Tab, Tabstrip } from "@vuu-ui/vuu-ui-controls";
|
|
593
521
|
import cx4 from "classnames";
|
|
594
|
-
import { useCallback as
|
|
522
|
+
import { useCallback as useCallback3, useState as useState4 } from "react";
|
|
595
523
|
|
|
596
524
|
// src/feature-list/FeatureList.tsx
|
|
597
525
|
import { Palette, PaletteItem } from "@vuu-ui/vuu-layout";
|
|
@@ -643,9 +571,15 @@ var DEFAULT_THEME_ATTRIBUTES = [
|
|
|
643
571
|
"vuu-density-high",
|
|
644
572
|
"light"
|
|
645
573
|
];
|
|
646
|
-
var useThemeAttributes = () => {
|
|
574
|
+
var useThemeAttributes = (themeAttributes) => {
|
|
647
575
|
const context = useContext2(ThemeContext);
|
|
648
|
-
if (
|
|
576
|
+
if (themeAttributes) {
|
|
577
|
+
return [
|
|
578
|
+
themeAttributes.themeClass,
|
|
579
|
+
themeAttributes.densityClass,
|
|
580
|
+
themeAttributes.dataMode
|
|
581
|
+
];
|
|
582
|
+
} else if (context) {
|
|
649
583
|
return [
|
|
650
584
|
`${context.theme}-theme`,
|
|
651
585
|
`${context.theme}-density-${context.density}`,
|
|
@@ -713,12 +647,12 @@ var LeftNav = ({
|
|
|
713
647
|
...htmlAttributes
|
|
714
648
|
}) => {
|
|
715
649
|
const dispatch = useLayoutProviderDispatch();
|
|
716
|
-
const [navState, setNavState] =
|
|
650
|
+
const [navState, setNavState] = useState4({
|
|
717
651
|
activeTabIndex: 0,
|
|
718
652
|
navStatus: "menu-full"
|
|
719
653
|
});
|
|
720
654
|
const [themeClass] = useThemeAttributes();
|
|
721
|
-
const toggleNavWidth =
|
|
655
|
+
const toggleNavWidth = useCallback3(
|
|
722
656
|
(navStatus) => {
|
|
723
657
|
switch (navStatus) {
|
|
724
658
|
case "menu-icons":
|
|
@@ -745,7 +679,7 @@ var LeftNav = ({
|
|
|
745
679
|
return "menu-full-content";
|
|
746
680
|
}
|
|
747
681
|
};
|
|
748
|
-
const getWidthAndStatus =
|
|
682
|
+
const getWidthAndStatus = useCallback3(
|
|
749
683
|
(navState2, tabIndex) => {
|
|
750
684
|
if (tabIndex === 0) {
|
|
751
685
|
const newNavState = navState2 === "menu-full-content" ? "menu-full" : navState2 === "menu-icons-content" ? "menu-icons" : navState2;
|
|
@@ -757,7 +691,7 @@ var LeftNav = ({
|
|
|
757
691
|
},
|
|
758
692
|
[sizeCollapsed, sizeContent, sizeExpanded]
|
|
759
693
|
);
|
|
760
|
-
const handleTabSelection =
|
|
694
|
+
const handleTabSelection = useCallback3(
|
|
761
695
|
(value) => {
|
|
762
696
|
const [width, navStatus] = getWidthAndStatus(navState.navStatus, value);
|
|
763
697
|
setNavState({
|
|
@@ -772,7 +706,7 @@ var LeftNav = ({
|
|
|
772
706
|
},
|
|
773
707
|
[dispatch, getWidthAndStatus, navState, path]
|
|
774
708
|
);
|
|
775
|
-
const toggleSize =
|
|
709
|
+
const toggleSize = useCallback3(() => {
|
|
776
710
|
const { activeTabIndex, navStatus: currentNavStatus } = navState;
|
|
777
711
|
setNavState({
|
|
778
712
|
activeTabIndex,
|
|
@@ -854,7 +788,7 @@ var LeftNav = ({
|
|
|
854
788
|
};
|
|
855
789
|
|
|
856
790
|
// src/login/LoginPanel.tsx
|
|
857
|
-
import { useState as
|
|
791
|
+
import { useState as useState5 } from "react";
|
|
858
792
|
import { Button as Button2, FormField as FormField2, FormFieldLabel as FormFieldLabel2, Input as Input2 } from "@salt-ds/core";
|
|
859
793
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
860
794
|
var classBase6 = "vuuLoginPanel";
|
|
@@ -862,8 +796,8 @@ var LoginPanel = ({
|
|
|
862
796
|
requirePassword = true,
|
|
863
797
|
onSubmit
|
|
864
798
|
}) => {
|
|
865
|
-
const [username, setUserName] =
|
|
866
|
-
const [password, setPassword] =
|
|
799
|
+
const [username, setUserName] = useState5("");
|
|
800
|
+
const [password, setPassword] = useState5("");
|
|
867
801
|
const login = () => {
|
|
868
802
|
onSubmit(username, password);
|
|
869
803
|
};
|
|
@@ -932,11 +866,11 @@ var logout = (loginUrl) => {
|
|
|
932
866
|
|
|
933
867
|
// src/session-editing-form/SessionEditingForm.tsx
|
|
934
868
|
import {
|
|
935
|
-
useCallback as
|
|
936
|
-
useEffect as
|
|
869
|
+
useCallback as useCallback4,
|
|
870
|
+
useEffect as useEffect5,
|
|
937
871
|
useMemo,
|
|
938
872
|
useRef,
|
|
939
|
-
useState as
|
|
873
|
+
useState as useState6
|
|
940
874
|
} from "react";
|
|
941
875
|
import cx5 from "classnames";
|
|
942
876
|
import { useIdMemo } from "@salt-ds/core";
|
|
@@ -1027,8 +961,8 @@ var SessionEditingForm = ({
|
|
|
1027
961
|
schema,
|
|
1028
962
|
...htmlAttributes
|
|
1029
963
|
}) => {
|
|
1030
|
-
const [values, setValues] =
|
|
1031
|
-
const [errorMessage, setErrorMessage] =
|
|
964
|
+
const [values, setValues] = useState6();
|
|
965
|
+
const [errorMessage, setErrorMessage] = useState6("");
|
|
1032
966
|
const formContentRef = useRef(null);
|
|
1033
967
|
const initialDataRef = useRef();
|
|
1034
968
|
const dataStatusRef = useRef(Status.uninitialised);
|
|
@@ -1060,7 +994,7 @@ var SessionEditingForm = ({
|
|
|
1060
994
|
return ds;
|
|
1061
995
|
}, [dataSourceProp, schema]);
|
|
1062
996
|
const id = useIdMemo(idProp);
|
|
1063
|
-
const handleChange =
|
|
997
|
+
const handleChange = useCallback4(
|
|
1064
998
|
(evt) => {
|
|
1065
999
|
const [field, value] = getFieldNameAndValue(evt);
|
|
1066
1000
|
const { type } = getField(fields, field);
|
|
@@ -1077,7 +1011,7 @@ var SessionEditingForm = ({
|
|
|
1077
1011
|
},
|
|
1078
1012
|
[fields]
|
|
1079
1013
|
);
|
|
1080
|
-
const handleBlur =
|
|
1014
|
+
const handleBlur = useCallback4(
|
|
1081
1015
|
(evt) => {
|
|
1082
1016
|
const [field, value] = getFieldNameAndValue(evt);
|
|
1083
1017
|
const { type } = getField(fields, field);
|
|
@@ -1094,7 +1028,7 @@ var SessionEditingForm = ({
|
|
|
1094
1028
|
},
|
|
1095
1029
|
[dataSource, fields, keyField, values]
|
|
1096
1030
|
);
|
|
1097
|
-
const applyAction =
|
|
1031
|
+
const applyAction = useCallback4(
|
|
1098
1032
|
(action) => {
|
|
1099
1033
|
if (typeof action === "object" && action !== null) {
|
|
1100
1034
|
if ("type" in action && action.type === "CLOSE_DIALOG_ACTION") {
|
|
@@ -1104,7 +1038,7 @@ var SessionEditingForm = ({
|
|
|
1104
1038
|
},
|
|
1105
1039
|
[onClose]
|
|
1106
1040
|
);
|
|
1107
|
-
const handleSubmit =
|
|
1041
|
+
const handleSubmit = useCallback4(async () => {
|
|
1108
1042
|
const response = await dataSource.menuRpcCall({
|
|
1109
1043
|
type: "VP_EDIT_SUBMIT_FORM_RPC"
|
|
1110
1044
|
});
|
|
@@ -1114,7 +1048,7 @@ var SessionEditingForm = ({
|
|
|
1114
1048
|
applyAction(response.action);
|
|
1115
1049
|
}
|
|
1116
1050
|
}, [applyAction, dataSource]);
|
|
1117
|
-
const handleKeyDown =
|
|
1051
|
+
const handleKeyDown = useCallback4(
|
|
1118
1052
|
(evt) => {
|
|
1119
1053
|
if (evt.key === "Enter" && dataStatusRef.current === Status.changed) {
|
|
1120
1054
|
handleSubmit();
|
|
@@ -1122,7 +1056,7 @@ var SessionEditingForm = ({
|
|
|
1122
1056
|
},
|
|
1123
1057
|
[handleSubmit]
|
|
1124
1058
|
);
|
|
1125
|
-
const handleCancel =
|
|
1059
|
+
const handleCancel = useCallback4(() => {
|
|
1126
1060
|
onClose();
|
|
1127
1061
|
}, [onClose]);
|
|
1128
1062
|
const getFormControl = (field) => {
|
|
@@ -1145,7 +1079,7 @@ var SessionEditingForm = ({
|
|
|
1145
1079
|
);
|
|
1146
1080
|
}
|
|
1147
1081
|
};
|
|
1148
|
-
|
|
1082
|
+
useEffect5(() => {
|
|
1149
1083
|
if (formContentRef.current) {
|
|
1150
1084
|
const firstInput = formContentRef.current.querySelector(
|
|
1151
1085
|
"input"
|
|
@@ -1158,7 +1092,7 @@ var SessionEditingForm = ({
|
|
|
1158
1092
|
}
|
|
1159
1093
|
}
|
|
1160
1094
|
}, []);
|
|
1161
|
-
|
|
1095
|
+
useEffect5(() => {
|
|
1162
1096
|
return () => {
|
|
1163
1097
|
if (dataSource) {
|
|
1164
1098
|
dataSource.unsubscribe();
|
|
@@ -1220,8 +1154,8 @@ var SessionEditingForm = ({
|
|
|
1220
1154
|
import { connectToServer } from "@vuu-ui/vuu-data";
|
|
1221
1155
|
import cx9 from "classnames";
|
|
1222
1156
|
import {
|
|
1223
|
-
useCallback as
|
|
1224
|
-
useEffect as
|
|
1157
|
+
useCallback as useCallback10,
|
|
1158
|
+
useEffect as useEffect7,
|
|
1225
1159
|
useRef as useRef3
|
|
1226
1160
|
} from "react";
|
|
1227
1161
|
import {
|
|
@@ -1230,7 +1164,7 @@ import {
|
|
|
1230
1164
|
} from "@vuu-ui/vuu-layout";
|
|
1231
1165
|
|
|
1232
1166
|
// src/app-header/AppHeader.tsx
|
|
1233
|
-
import { useCallback as
|
|
1167
|
+
import { useCallback as useCallback7 } from "react";
|
|
1234
1168
|
|
|
1235
1169
|
// src/user-profile/UserProfile.tsx
|
|
1236
1170
|
import { Button as Button5 } from "@salt-ds/core";
|
|
@@ -1244,9 +1178,9 @@ import { Button as Button4 } from "@salt-ds/core";
|
|
|
1244
1178
|
import { ExportIcon } from "@salt-ds/icons";
|
|
1245
1179
|
import {
|
|
1246
1180
|
forwardRef,
|
|
1247
|
-
useCallback as
|
|
1248
|
-
useEffect as
|
|
1249
|
-
useState as
|
|
1181
|
+
useCallback as useCallback5,
|
|
1182
|
+
useEffect as useEffect6,
|
|
1183
|
+
useState as useState7
|
|
1250
1184
|
} from "react";
|
|
1251
1185
|
|
|
1252
1186
|
// src/get-layout-history.ts
|
|
@@ -1268,8 +1202,8 @@ var HistoryListItem = (props) => {
|
|
|
1268
1202
|
return /* @__PURE__ */ jsx15(ListItem, { ...props });
|
|
1269
1203
|
};
|
|
1270
1204
|
var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
|
|
1271
|
-
const [history, setHistory] =
|
|
1272
|
-
|
|
1205
|
+
const [history, setHistory] = useState7([]);
|
|
1206
|
+
useEffect6(() => {
|
|
1273
1207
|
async function getHistory() {
|
|
1274
1208
|
const history2 = await getLayoutHistory(user);
|
|
1275
1209
|
const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
|
|
@@ -1282,7 +1216,7 @@ var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, lay
|
|
|
1282
1216
|
}
|
|
1283
1217
|
getHistory();
|
|
1284
1218
|
}, [user]);
|
|
1285
|
-
const handleHisorySelected =
|
|
1219
|
+
const handleHisorySelected = useCallback5(
|
|
1286
1220
|
(evt, selected2) => {
|
|
1287
1221
|
if (selected2) {
|
|
1288
1222
|
onNavigate(selected2.id);
|
|
@@ -1290,7 +1224,7 @@ var UserPanel = forwardRef(function UserPanel2({ loginUrl, onNavigate, user, lay
|
|
|
1290
1224
|
},
|
|
1291
1225
|
[onNavigate]
|
|
1292
1226
|
);
|
|
1293
|
-
const handleLogout =
|
|
1227
|
+
const handleLogout = useCallback5(() => {
|
|
1294
1228
|
logout(loginUrl);
|
|
1295
1229
|
}, [loginUrl]);
|
|
1296
1230
|
const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
|
|
@@ -1340,7 +1274,7 @@ var UserProfile = ({
|
|
|
1340
1274
|
// src/theme-switch/ThemeSwitch.tsx
|
|
1341
1275
|
import cx6 from "classnames";
|
|
1342
1276
|
import { ToggleButton, ToggleButtonGroup, useControlled } from "@salt-ds/core";
|
|
1343
|
-
import { useCallback as
|
|
1277
|
+
import { useCallback as useCallback6 } from "react";
|
|
1344
1278
|
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1345
1279
|
var classBase8 = "vuuThemeSwitch";
|
|
1346
1280
|
var ThemeSwitch = ({
|
|
@@ -1356,7 +1290,7 @@ var ThemeSwitch = ({
|
|
|
1356
1290
|
name: "ThemeSwitch",
|
|
1357
1291
|
state: "mode"
|
|
1358
1292
|
});
|
|
1359
|
-
const handleChangeSecondary =
|
|
1293
|
+
const handleChangeSecondary = useCallback6(
|
|
1360
1294
|
(evt) => {
|
|
1361
1295
|
const { value } = evt.target;
|
|
1362
1296
|
setMode(value);
|
|
@@ -1395,7 +1329,7 @@ var AppHeader = ({
|
|
|
1395
1329
|
...htmlAttributes
|
|
1396
1330
|
}) => {
|
|
1397
1331
|
const className = cx7(classBase9, classNameProp);
|
|
1398
|
-
const handleSwitchTheme =
|
|
1332
|
+
const handleSwitchTheme = useCallback7(
|
|
1399
1333
|
(mode) => onSwitchTheme == null ? void 0 : onSwitchTheme(mode),
|
|
1400
1334
|
[onSwitchTheme]
|
|
1401
1335
|
);
|
|
@@ -1419,7 +1353,7 @@ import { logger } from "@vuu-ui/vuu-utils";
|
|
|
1419
1353
|
// src/shell-layouts/context-panel/ContextPanel.tsx
|
|
1420
1354
|
import { Button as Button6 } from "@salt-ds/core";
|
|
1421
1355
|
import cx8 from "classnames";
|
|
1422
|
-
import { useCallback as
|
|
1356
|
+
import { useCallback as useCallback8, useMemo as useMemo2 } from "react";
|
|
1423
1357
|
import {
|
|
1424
1358
|
layoutFromJson,
|
|
1425
1359
|
useLayoutProviderDispatch as useLayoutProviderDispatch2
|
|
@@ -1434,7 +1368,7 @@ var ContextPanel = ({
|
|
|
1434
1368
|
title
|
|
1435
1369
|
}) => {
|
|
1436
1370
|
const dispatchLayoutAction = useLayoutProviderDispatch2();
|
|
1437
|
-
const handleClose =
|
|
1371
|
+
const handleClose = useCallback8(() => {
|
|
1438
1372
|
dispatchLayoutAction({
|
|
1439
1373
|
path: "#context-panel",
|
|
1440
1374
|
propName: "expanded",
|
|
@@ -1518,15 +1452,15 @@ import {
|
|
|
1518
1452
|
Flexbox as Flexbox2,
|
|
1519
1453
|
View
|
|
1520
1454
|
} from "@vuu-ui/vuu-layout";
|
|
1521
|
-
import { useCallback as
|
|
1455
|
+
import { useCallback as useCallback9, useRef as useRef2, useState as useState8 } from "react";
|
|
1522
1456
|
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1523
1457
|
var useInlayLeftPanel = ({
|
|
1524
1458
|
appHeader,
|
|
1525
1459
|
leftSidePanel
|
|
1526
1460
|
}) => {
|
|
1527
1461
|
const paletteView = useRef2(null);
|
|
1528
|
-
const [open, setOpen] =
|
|
1529
|
-
const handleDrawerClick =
|
|
1462
|
+
const [open, setOpen] = useState8(true);
|
|
1463
|
+
const handleDrawerClick = useCallback9(
|
|
1530
1464
|
(e) => {
|
|
1531
1465
|
var _a;
|
|
1532
1466
|
const target = e.target;
|
|
@@ -1536,7 +1470,7 @@ var useInlayLeftPanel = ({
|
|
|
1536
1470
|
},
|
|
1537
1471
|
[open]
|
|
1538
1472
|
);
|
|
1539
|
-
const getDrawers =
|
|
1473
|
+
const getDrawers = useCallback9(
|
|
1540
1474
|
(leftSidePanel2) => {
|
|
1541
1475
|
const drawers = [];
|
|
1542
1476
|
drawers.push(
|
|
@@ -1603,25 +1537,10 @@ var useShellLayout = ({
|
|
|
1603
1537
|
// src/shell.tsx
|
|
1604
1538
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1605
1539
|
var { error } = logger("Shell");
|
|
1606
|
-
var warningLayout = {
|
|
1607
|
-
type: "View",
|
|
1608
|
-
props: {
|
|
1609
|
-
style: { height: "calc(100% - 6px)" }
|
|
1610
|
-
},
|
|
1611
|
-
children: [
|
|
1612
|
-
{
|
|
1613
|
-
props: {
|
|
1614
|
-
className: "vuuShell-warningPlaceholder"
|
|
1615
|
-
},
|
|
1616
|
-
type: "Placeholder"
|
|
1617
|
-
}
|
|
1618
|
-
]
|
|
1619
|
-
};
|
|
1620
1540
|
var Shell = ({
|
|
1621
1541
|
LayoutProps,
|
|
1622
1542
|
children,
|
|
1623
1543
|
className: classNameProp,
|
|
1624
|
-
defaultLayout = warningLayout,
|
|
1625
1544
|
leftSidePanel,
|
|
1626
1545
|
leftSidePanelLayout,
|
|
1627
1546
|
loginUrl,
|
|
@@ -1633,36 +1552,31 @@ var Shell = ({
|
|
|
1633
1552
|
}) => {
|
|
1634
1553
|
const rootRef = useRef3(null);
|
|
1635
1554
|
const layoutId = useRef3("latest");
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
saveUrl,
|
|
1640
|
-
user
|
|
1641
|
-
});
|
|
1642
|
-
const handleLayoutChange = useCallback11(
|
|
1643
|
-
(layout2, layoutChangeReason) => {
|
|
1555
|
+
const { applicationLayout, saveApplicationLayout, loadLayoutById } = useLayoutManager();
|
|
1556
|
+
const handleLayoutChange = useCallback10(
|
|
1557
|
+
(layout, layoutChangeReason) => {
|
|
1644
1558
|
try {
|
|
1559
|
+
saveApplicationLayout(layout);
|
|
1645
1560
|
console.log(`handle layout changed ${layoutChangeReason}`);
|
|
1646
|
-
saveLayoutConfig(layout2);
|
|
1647
1561
|
} catch {
|
|
1648
1562
|
error == null ? void 0 : error("Failed to save layout");
|
|
1649
1563
|
}
|
|
1650
1564
|
},
|
|
1651
|
-
[
|
|
1565
|
+
[saveApplicationLayout]
|
|
1652
1566
|
);
|
|
1653
|
-
const handleSwitchTheme =
|
|
1567
|
+
const handleSwitchTheme = useCallback10((mode) => {
|
|
1654
1568
|
if (rootRef.current) {
|
|
1655
1569
|
rootRef.current.dataset.mode = mode;
|
|
1656
1570
|
}
|
|
1657
1571
|
}, []);
|
|
1658
|
-
const handleNavigate =
|
|
1572
|
+
const handleNavigate = useCallback10(
|
|
1659
1573
|
(id) => {
|
|
1660
1574
|
layoutId.current = id;
|
|
1661
1575
|
loadLayoutById(id);
|
|
1662
1576
|
},
|
|
1663
1577
|
[loadLayoutById]
|
|
1664
1578
|
);
|
|
1665
|
-
|
|
1579
|
+
useEffect7(() => {
|
|
1666
1580
|
if (serverUrl && user.token) {
|
|
1667
1581
|
connectToServer({
|
|
1668
1582
|
authToken: user.token,
|
|
@@ -1692,7 +1606,7 @@ var Shell = ({
|
|
|
1692
1606
|
LayoutProvider,
|
|
1693
1607
|
{
|
|
1694
1608
|
...LayoutProps,
|
|
1695
|
-
layout,
|
|
1609
|
+
layout: applicationLayout,
|
|
1696
1610
|
onLayoutChange: handleLayoutChange,
|
|
1697
1611
|
children: /* @__PURE__ */ jsx22(
|
|
1698
1612
|
DraggableLayout3,
|
|
@@ -1760,7 +1674,6 @@ export {
|
|
|
1760
1674
|
getAuthModeFromCookies,
|
|
1761
1675
|
logout,
|
|
1762
1676
|
redirectToLogin,
|
|
1763
|
-
useLayoutConfig,
|
|
1764
1677
|
useLayoutManager,
|
|
1765
1678
|
useShellContext,
|
|
1766
1679
|
useShellLayout,
|