@dexteel/mesf-core 5.11.0 → 5.12.0
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/configuration/pages/asset/components/AssetConfiguration/AssetSearchInput.d.ts +10 -0
- package/dist/configuration/pages/asset/hooks/useAssetSearch.d.ts +29 -0
- package/dist/configuration/pages/users/repositories/UsersRepository.d.ts +1 -0
- package/dist/context/userContext.d.ts +20 -0
- package/dist/index.esm.js +281 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/reducers/UserReducer.d.ts +19 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [5.12.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.11.0...@dexteel/mesf-core-v5.12.0) (2025-09-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **asset-configuration:** add search functionality to Assets Tree ([ef22460](https://github.com/dexteel/mesf-core-frontend/commit/ef22460bc96f75b3a5454fc4aee0fbf1cb3b7d80))
|
|
9
|
+
* **asset-configuration:** add search functionality to Assets Tree ([2fefd83](https://github.com/dexteel/mesf-core-frontend/commit/2fefd83a61a05f083882c0898b8b0826f216517e))
|
|
10
|
+
* **userContext:** add useHasProfile hook ([#460](https://github.com/dexteel/mesf-core-frontend/issues/460)) ([8788000](https://github.com/dexteel/mesf-core-frontend/commit/8788000718b33c4af2732f88f8c0f47a9cecb29a))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **real-time-config:** Show the names of SP instead of id's ([c97ad12](https://github.com/dexteel/mesf-core-frontend/commit/c97ad128d1519c7498784fa575c7e6fb7741f0d7))
|
|
16
|
+
* **real-time-config:** Show the names of SP instead of id's ([b994a0b](https://github.com/dexteel/mesf-core-frontend/commit/b994a0bdb46c9d74e8d85bc3d4a0b1cdd2c862cb))
|
|
17
|
+
|
|
18
|
+
## [5.11.0] - 2025-09-08
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
1
22
|
# Changelog
|
|
2
23
|
|
|
3
24
|
## [5.11.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.10.0...@dexteel/mesf-core-v5.11.0) (2025-09-03)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NodeModel } from "@minoru/react-dnd-treeview";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AssetSearchResult } from "../../hooks/useAssetSearch";
|
|
4
|
+
import { FileProperties } from "../../models/FileProperties";
|
|
5
|
+
interface AssetSearchInputProps {
|
|
6
|
+
assetNodes: NodeModel<FileProperties>[];
|
|
7
|
+
onSearchResultClick: (result: AssetSearchResult) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const AssetSearchInput: React.FC<AssetSearchInputProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NodeModel } from "@minoru/react-dnd-treeview";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FileProperties } from "../models/FileProperties";
|
|
4
|
+
export interface AssetSearchResult {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
isDroppable: boolean;
|
|
9
|
+
hasChildren: boolean;
|
|
10
|
+
node: NodeModel<FileProperties>;
|
|
11
|
+
}
|
|
12
|
+
interface UseAssetSearchProps {
|
|
13
|
+
assetNodes: NodeModel<FileProperties>[];
|
|
14
|
+
externalSearchTerm?: string;
|
|
15
|
+
onSearchTermChange?: (term: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const useAssetSearch: ({ assetNodes, externalSearchTerm, onSearchTermChange, }: UseAssetSearchProps) => {
|
|
18
|
+
searchTerm: string;
|
|
19
|
+
searchResults: AssetSearchResult[];
|
|
20
|
+
showSearchResults: boolean;
|
|
21
|
+
focusedSearchIndex: number;
|
|
22
|
+
searchResultsRefs: React.MutableRefObject<(HTMLElement | null)[]>;
|
|
23
|
+
handleSearchChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
24
|
+
handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => AssetSearchResult | undefined;
|
|
25
|
+
scrollFocusedItemIntoView: (index: number) => void;
|
|
26
|
+
clearSearch: () => void;
|
|
27
|
+
triggerSearch: (term: string) => void;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -7,6 +7,7 @@ export declare const useUserContext: () => {
|
|
|
7
7
|
defaultAreaName: string | null;
|
|
8
8
|
userLogged: boolean;
|
|
9
9
|
permissions: string[];
|
|
10
|
+
profiles: string[];
|
|
10
11
|
};
|
|
11
12
|
actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
12
13
|
setUserId(state: import("immer/dist/internal").WritableDraft<{
|
|
@@ -16,6 +17,7 @@ export declare const useUserContext: () => {
|
|
|
16
17
|
defaultAreaName: string | null;
|
|
17
18
|
userLogged: boolean;
|
|
18
19
|
permissions: string[];
|
|
20
|
+
profiles: string[];
|
|
19
21
|
}>, { payload }: {
|
|
20
22
|
payload: any;
|
|
21
23
|
type: string;
|
|
@@ -27,6 +29,7 @@ export declare const useUserContext: () => {
|
|
|
27
29
|
defaultAreaName: string | null;
|
|
28
30
|
userLogged: boolean;
|
|
29
31
|
permissions: string[];
|
|
32
|
+
profiles: string[];
|
|
30
33
|
}>, { payload }: {
|
|
31
34
|
payload: any;
|
|
32
35
|
type: string;
|
|
@@ -38,6 +41,7 @@ export declare const useUserContext: () => {
|
|
|
38
41
|
defaultAreaName: string | null;
|
|
39
42
|
userLogged: boolean;
|
|
40
43
|
permissions: string[];
|
|
44
|
+
profiles: string[];
|
|
41
45
|
}>, { payload }: {
|
|
42
46
|
payload: any;
|
|
43
47
|
type: string;
|
|
@@ -49,6 +53,7 @@ export declare const useUserContext: () => {
|
|
|
49
53
|
defaultAreaName: string | null;
|
|
50
54
|
userLogged: boolean;
|
|
51
55
|
permissions: string[];
|
|
56
|
+
profiles: string[];
|
|
52
57
|
}>, { payload }: {
|
|
53
58
|
payload: any;
|
|
54
59
|
type: string;
|
|
@@ -60,6 +65,7 @@ export declare const useUserContext: () => {
|
|
|
60
65
|
defaultAreaName: string | null;
|
|
61
66
|
userLogged: boolean;
|
|
62
67
|
permissions: string[];
|
|
68
|
+
profiles: string[];
|
|
63
69
|
}>, { payload }: {
|
|
64
70
|
payload: any;
|
|
65
71
|
type: string;
|
|
@@ -71,6 +77,19 @@ export declare const useUserContext: () => {
|
|
|
71
77
|
defaultAreaName: string | null;
|
|
72
78
|
userLogged: boolean;
|
|
73
79
|
permissions: string[];
|
|
80
|
+
profiles: string[];
|
|
81
|
+
}>, { payload }: {
|
|
82
|
+
payload: any;
|
|
83
|
+
type: string;
|
|
84
|
+
}): void;
|
|
85
|
+
setProfiles(state: import("immer/dist/internal").WritableDraft<{
|
|
86
|
+
userLastName: string;
|
|
87
|
+
userId: number | null;
|
|
88
|
+
defaultAreaId: number | string | null;
|
|
89
|
+
defaultAreaName: string | null;
|
|
90
|
+
userLogged: boolean;
|
|
91
|
+
permissions: string[];
|
|
92
|
+
profiles: string[];
|
|
74
93
|
}>, { payload }: {
|
|
75
94
|
payload: any;
|
|
76
95
|
type: string;
|
|
@@ -79,6 +98,7 @@ export declare const useUserContext: () => {
|
|
|
79
98
|
isLoading: boolean;
|
|
80
99
|
};
|
|
81
100
|
export declare const useHasPermission: () => (permission: string) => boolean;
|
|
101
|
+
export declare const useHasProfile: () => (profile: string) => boolean;
|
|
82
102
|
export declare const UserProvider: ({ children }: {
|
|
83
103
|
children: ReactNode;
|
|
84
104
|
}) => React.JSX.Element;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { LicenseManager } from 'ag-grid-enterprise';
|
|
2
|
-
import { withStyles, DialogTitle as DialogTitle$1, DialogContent as DialogContent$1, DialogActions as DialogActions$1, createStyles, Grid, Button, alpha, makeStyles, Dialog as Dialog$1, TextField, Paper, List, ListItem, ListItemIcon, ListItemText, Chip, SvgIcon, Collapse, Typography as Typography$1, Checkbox, InputAdornment, IconButton as IconButton$1, MenuItem, Box, Card, CardContent, CardActions, Tooltip, FormControl, InputLabel, Select, CircularProgress, Snackbar, FormControlLabel, Switch, DialogContentText, Badge, useTheme, Input, Divider, CssBaseline, AppBar, Toolbar, Container, Menu, Hidden, Drawer, useMediaQuery, ListSubheader, debounce, createTheme, ThemeProvider } from '@material-ui/core';
|
|
2
|
+
import { withStyles, DialogTitle as DialogTitle$1, DialogContent as DialogContent$1, DialogActions as DialogActions$1, createStyles, Grid, Button, alpha, makeStyles, Dialog as Dialog$1, TextField, Paper, List, ListItem, ListItemIcon, ListItemText, Chip, SvgIcon, Collapse, Typography as Typography$1, Checkbox, InputAdornment, IconButton as IconButton$1, MenuItem, Box, Card, CardContent, CardActions, Tooltip, FormControl, InputLabel, Select, CircularProgress, Snackbar, FormControlLabel, Switch, DialogContentText, Popover, MenuList, Badge, useTheme, Input, Divider, CssBaseline, AppBar, Toolbar, Container, Menu, Hidden, Drawer, useMediaQuery, ListSubheader, debounce, createTheme, ThemeProvider } from '@material-ui/core';
|
|
3
3
|
import { values, get, isNil, isEmpty, round, isNaN as isNaN$1, isNumber } from 'lodash-es';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { useState, useRef, useEffect, useMemo, Component, createContext, useContext, useCallback, lazy, Suspense } from 'react';
|
|
@@ -42,7 +42,7 @@ import zoomPlugin from 'chartjs-plugin-zoom';
|
|
|
42
42
|
import LockIcon from '@material-ui/icons/Lock';
|
|
43
43
|
import SaveIcon from '@material-ui/icons/Save';
|
|
44
44
|
import Button$1 from '@material-ui/core/Button';
|
|
45
|
-
import Popover from '@material-ui/core/Popover';
|
|
45
|
+
import Popover$1 from '@material-ui/core/Popover';
|
|
46
46
|
import CreateIcon from '@material-ui/icons/Create';
|
|
47
47
|
import { isAncestor, Tree, DndProvider as DndProvider$1 } from '@minoru/react-dnd-treeview';
|
|
48
48
|
import FolderIcon from '@material-ui/icons/Folder';
|
|
@@ -6708,6 +6708,222 @@ var useAssetActions = function (_a) {
|
|
|
6708
6708
|
return { handleDrop: handleDrop, handleCtrlClick: handleCtrlClick, handleDragEnd: handleDragEnd, handleDragStart: handleDragStart };
|
|
6709
6709
|
};
|
|
6710
6710
|
|
|
6711
|
+
var useAssetSearch = function (_a) {
|
|
6712
|
+
var assetNodes = _a.assetNodes, externalSearchTerm = _a.externalSearchTerm, onSearchTermChange = _a.onSearchTermChange;
|
|
6713
|
+
var _b = useState(externalSearchTerm || ""), searchTerm = _b[0], setSearchTerm = _b[1];
|
|
6714
|
+
var _c = useState([]), searchResults = _c[0], setSearchResults = _c[1];
|
|
6715
|
+
var _d = useState(false), showSearchResults = _d[0], setShowSearchResults = _d[1];
|
|
6716
|
+
var _e = useState(-1), focusedSearchIndex = _e[0], setFocusedSearchIndex = _e[1];
|
|
6717
|
+
var searchTimeoutRef = useRef(null);
|
|
6718
|
+
var searchResultsRefs = useRef([]);
|
|
6719
|
+
var searchIndex = useMemo(function () {
|
|
6720
|
+
var index = [];
|
|
6721
|
+
var nodeMap = new Map();
|
|
6722
|
+
assetNodes.forEach(function (node) {
|
|
6723
|
+
if (node.id !== undefined && node.id !== null) {
|
|
6724
|
+
nodeMap.set(node.id, node);
|
|
6725
|
+
}
|
|
6726
|
+
});
|
|
6727
|
+
var buildNodePath = function (nodeId) {
|
|
6728
|
+
var path = [];
|
|
6729
|
+
var currentNode = nodeMap.get(nodeId);
|
|
6730
|
+
while (currentNode && currentNode.parent !== -1) {
|
|
6731
|
+
path.unshift(currentNode.text);
|
|
6732
|
+
currentNode = nodeMap.get(currentNode.parent);
|
|
6733
|
+
}
|
|
6734
|
+
if (currentNode && currentNode.parent === -1) {
|
|
6735
|
+
path.unshift(currentNode.text);
|
|
6736
|
+
}
|
|
6737
|
+
return path;
|
|
6738
|
+
};
|
|
6739
|
+
assetNodes.forEach(function (node) {
|
|
6740
|
+
if (node.id === undefined || node.id === null || !node.text)
|
|
6741
|
+
return;
|
|
6742
|
+
var nodePath = buildNodePath(node.id);
|
|
6743
|
+
var pathStr = nodePath.join(" > ");
|
|
6744
|
+
var hasChildren = assetNodes.some(function (child) { return child.parent === node.id; });
|
|
6745
|
+
index.push({
|
|
6746
|
+
id: node.id,
|
|
6747
|
+
name: node.text,
|
|
6748
|
+
path: pathStr,
|
|
6749
|
+
isDroppable: node.droppable || false,
|
|
6750
|
+
hasChildren: hasChildren,
|
|
6751
|
+
node: node,
|
|
6752
|
+
});
|
|
6753
|
+
});
|
|
6754
|
+
return index;
|
|
6755
|
+
}, [assetNodes]);
|
|
6756
|
+
var searchNodes = function (searchTerm) {
|
|
6757
|
+
var lowerSearchTerm = searchTerm.toLowerCase();
|
|
6758
|
+
return searchIndex.filter(function (item) {
|
|
6759
|
+
return item.name.toLowerCase().includes(lowerSearchTerm);
|
|
6760
|
+
});
|
|
6761
|
+
};
|
|
6762
|
+
React__default.useEffect(function () {
|
|
6763
|
+
if (externalSearchTerm !== undefined && externalSearchTerm !== searchTerm) {
|
|
6764
|
+
setSearchTerm(externalSearchTerm);
|
|
6765
|
+
}
|
|
6766
|
+
}, [externalSearchTerm]);
|
|
6767
|
+
var handleSearchChange = function (event) {
|
|
6768
|
+
var term = event.target.value;
|
|
6769
|
+
setSearchTerm(term);
|
|
6770
|
+
onSearchTermChange === null || onSearchTermChange === void 0 ? void 0 : onSearchTermChange(term);
|
|
6771
|
+
if (searchTimeoutRef.current) {
|
|
6772
|
+
clearTimeout(searchTimeoutRef.current);
|
|
6773
|
+
}
|
|
6774
|
+
if (term.trim() === "" || term.length < 2) {
|
|
6775
|
+
setSearchResults([]);
|
|
6776
|
+
setShowSearchResults(false);
|
|
6777
|
+
setFocusedSearchIndex(-1);
|
|
6778
|
+
return;
|
|
6779
|
+
}
|
|
6780
|
+
searchTimeoutRef.current = setTimeout(function () {
|
|
6781
|
+
var results = searchNodes(term);
|
|
6782
|
+
setSearchResults(results);
|
|
6783
|
+
setShowSearchResults(results.length > 0);
|
|
6784
|
+
var newFocusIndex = results.length > 0 ? 0 : -1;
|
|
6785
|
+
setFocusedSearchIndex(newFocusIndex);
|
|
6786
|
+
searchResultsRefs.current = new Array(results.length).fill(null);
|
|
6787
|
+
}, 250);
|
|
6788
|
+
};
|
|
6789
|
+
var handleKeyDown = function (event) {
|
|
6790
|
+
if (event.key === "Escape") {
|
|
6791
|
+
if (showSearchResults) {
|
|
6792
|
+
setSearchTerm("");
|
|
6793
|
+
setSearchResults([]);
|
|
6794
|
+
setShowSearchResults(false);
|
|
6795
|
+
setFocusedSearchIndex(-1);
|
|
6796
|
+
}
|
|
6797
|
+
return undefined;
|
|
6798
|
+
}
|
|
6799
|
+
if (showSearchResults && searchResults.length > 0) {
|
|
6800
|
+
if (event.key === "ArrowDown") {
|
|
6801
|
+
event.preventDefault();
|
|
6802
|
+
var newIndex_1 = focusedSearchIndex < searchResults.length - 1
|
|
6803
|
+
? focusedSearchIndex + 1
|
|
6804
|
+
: 0;
|
|
6805
|
+
setFocusedSearchIndex(newIndex_1);
|
|
6806
|
+
setTimeout(function () { return scrollFocusedItemIntoView(newIndex_1); }, 0);
|
|
6807
|
+
}
|
|
6808
|
+
else if (event.key === "ArrowUp") {
|
|
6809
|
+
event.preventDefault();
|
|
6810
|
+
var newIndex_2 = focusedSearchIndex > 0
|
|
6811
|
+
? focusedSearchIndex - 1
|
|
6812
|
+
: searchResults.length - 1;
|
|
6813
|
+
setFocusedSearchIndex(newIndex_2);
|
|
6814
|
+
setTimeout(function () { return scrollFocusedItemIntoView(newIndex_2); }, 0);
|
|
6815
|
+
}
|
|
6816
|
+
else if (event.key === "Enter" && focusedSearchIndex >= 0) {
|
|
6817
|
+
event.preventDefault();
|
|
6818
|
+
var selectedResult = searchResults[focusedSearchIndex];
|
|
6819
|
+
return selectedResult;
|
|
6820
|
+
}
|
|
6821
|
+
}
|
|
6822
|
+
return undefined;
|
|
6823
|
+
};
|
|
6824
|
+
var scrollFocusedItemIntoView = function (index) {
|
|
6825
|
+
var _a;
|
|
6826
|
+
if (searchResultsRefs.current[index]) {
|
|
6827
|
+
(_a = searchResultsRefs.current[index]) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
6828
|
+
behavior: "smooth",
|
|
6829
|
+
block: "nearest",
|
|
6830
|
+
});
|
|
6831
|
+
}
|
|
6832
|
+
};
|
|
6833
|
+
var clearSearch = function () {
|
|
6834
|
+
setSearchTerm("");
|
|
6835
|
+
setSearchResults([]);
|
|
6836
|
+
setShowSearchResults(false);
|
|
6837
|
+
setFocusedSearchIndex(-1);
|
|
6838
|
+
onSearchTermChange === null || onSearchTermChange === void 0 ? void 0 : onSearchTermChange("");
|
|
6839
|
+
};
|
|
6840
|
+
var triggerSearch = function (term) {
|
|
6841
|
+
setSearchTerm(term);
|
|
6842
|
+
onSearchTermChange === null || onSearchTermChange === void 0 ? void 0 : onSearchTermChange(term);
|
|
6843
|
+
if (searchTimeoutRef.current) {
|
|
6844
|
+
clearTimeout(searchTimeoutRef.current);
|
|
6845
|
+
}
|
|
6846
|
+
if (term.trim() === "" || term.length < 2) {
|
|
6847
|
+
setSearchResults([]);
|
|
6848
|
+
setShowSearchResults(false);
|
|
6849
|
+
setFocusedSearchIndex(-1);
|
|
6850
|
+
return;
|
|
6851
|
+
}
|
|
6852
|
+
searchTimeoutRef.current = setTimeout(function () {
|
|
6853
|
+
var results = searchNodes(term);
|
|
6854
|
+
setSearchResults(results);
|
|
6855
|
+
setShowSearchResults(results.length > 0);
|
|
6856
|
+
var newFocusIndex = results.length > 0 ? 0 : -1;
|
|
6857
|
+
setFocusedSearchIndex(newFocusIndex);
|
|
6858
|
+
searchResultsRefs.current = new Array(results.length).fill(null);
|
|
6859
|
+
}, 250);
|
|
6860
|
+
};
|
|
6861
|
+
return {
|
|
6862
|
+
searchTerm: searchTerm,
|
|
6863
|
+
searchResults: searchResults,
|
|
6864
|
+
showSearchResults: showSearchResults,
|
|
6865
|
+
focusedSearchIndex: focusedSearchIndex,
|
|
6866
|
+
searchResultsRefs: searchResultsRefs,
|
|
6867
|
+
handleSearchChange: handleSearchChange,
|
|
6868
|
+
handleKeyDown: handleKeyDown,
|
|
6869
|
+
scrollFocusedItemIntoView: scrollFocusedItemIntoView,
|
|
6870
|
+
clearSearch: clearSearch,
|
|
6871
|
+
triggerSearch: triggerSearch,
|
|
6872
|
+
};
|
|
6873
|
+
};
|
|
6874
|
+
|
|
6875
|
+
var AssetSearchInput = function (_a) {
|
|
6876
|
+
var assetNodes = _a.assetNodes, onSearchResultClick = _a.onSearchResultClick;
|
|
6877
|
+
var searchInputRef = useRef(null);
|
|
6878
|
+
var _b = useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
6879
|
+
var _c = useAssetSearch({ assetNodes: assetNodes }), searchTerm = _c.searchTerm, searchResults = _c.searchResults, showSearchResults = _c.showSearchResults, focusedSearchIndex = _c.focusedSearchIndex, searchResultsRefs = _c.searchResultsRefs, handleSearchChange = _c.handleSearchChange, handleKeyDown = _c.handleKeyDown, clearSearch = _c.clearSearch;
|
|
6880
|
+
var handleSearchResultClick = function (result) {
|
|
6881
|
+
onSearchResultClick(result);
|
|
6882
|
+
clearSearch();
|
|
6883
|
+
setAnchorEl(null);
|
|
6884
|
+
};
|
|
6885
|
+
var handleKeyDownWithResultSelection = function (event) {
|
|
6886
|
+
var selectedResult = handleKeyDown(event);
|
|
6887
|
+
if (selectedResult) {
|
|
6888
|
+
handleSearchResultClick(selectedResult);
|
|
6889
|
+
}
|
|
6890
|
+
};
|
|
6891
|
+
var handleSearchInputChange = function (event) {
|
|
6892
|
+
handleSearchChange(event);
|
|
6893
|
+
if (!anchorEl && searchInputRef.current) {
|
|
6894
|
+
setAnchorEl(searchInputRef.current);
|
|
6895
|
+
}
|
|
6896
|
+
};
|
|
6897
|
+
var handlePopoverClose = function () {
|
|
6898
|
+
setAnchorEl(null);
|
|
6899
|
+
};
|
|
6900
|
+
return (React__default.createElement("div", { onKeyDown: handleKeyDownWithResultSelection, style: { marginBottom: 16 } },
|
|
6901
|
+
React__default.createElement(TextField, { placeholder: "Search assets (min. 2 characters)...", variant: "outlined", size: "small", fullWidth: true, value: searchTerm, onChange: handleSearchInputChange, inputRef: searchInputRef, InputProps: {
|
|
6902
|
+
startAdornment: (React__default.createElement(InputAdornment, { position: "start" },
|
|
6903
|
+
React__default.createElement(SearchIcon, { color: "action" }))),
|
|
6904
|
+
} }),
|
|
6905
|
+
React__default.createElement(Popover, { open: showSearchResults && Boolean(anchorEl), anchorEl: anchorEl, onClose: handlePopoverClose, disableAutoFocus: true, disableEnforceFocus: true, anchorOrigin: {
|
|
6906
|
+
vertical: "bottom",
|
|
6907
|
+
horizontal: "left",
|
|
6908
|
+
}, transformOrigin: {
|
|
6909
|
+
vertical: "top",
|
|
6910
|
+
horizontal: "left",
|
|
6911
|
+
}, PaperProps: {
|
|
6912
|
+
style: { width: anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.offsetWidth, maxHeight: 300 },
|
|
6913
|
+
} },
|
|
6914
|
+
React__default.createElement(MenuList, { dense: true }, searchResults.map(function (result, index) { return (React__default.createElement(MenuItem, { key: result.id, ref: function (el) {
|
|
6915
|
+
if (searchResultsRefs.current) {
|
|
6916
|
+
searchResultsRefs.current[index] = el;
|
|
6917
|
+
}
|
|
6918
|
+
}, selected: index === focusedSearchIndex, onClick: function () { return handleSearchResultClick(result); } },
|
|
6919
|
+
React__default.createElement(ListItemIcon, null, result.hasChildren || result.isDroppable ? (React__default.createElement(AccountTreeIcon, { color: "primary", fontSize: "small" })) : (React__default.createElement(Settings$1, { color: "primary", fontSize: "small" }))),
|
|
6920
|
+
React__default.createElement(ListItemText, { primary: result.name, secondary: result.path, secondaryTypographyProps: {
|
|
6921
|
+
variant: "caption",
|
|
6922
|
+
color: "textSecondary",
|
|
6923
|
+
style: { fontStyle: "italic" },
|
|
6924
|
+
} }))); })))));
|
|
6925
|
+
};
|
|
6926
|
+
|
|
6711
6927
|
var TypeIcon = function (props) {
|
|
6712
6928
|
if (props.droppable) {
|
|
6713
6929
|
return React__default.createElement(FolderIcon, null);
|
|
@@ -6953,7 +7169,7 @@ var AssetViewComponent = function () {
|
|
|
6953
7169
|
var _b = useState(false), isDragging = _b[0], setIsDragging = _b[1];
|
|
6954
7170
|
var _c = useState(false), isCtrlPressing = _c[0], setIsCtrlPressing = _c[1];
|
|
6955
7171
|
var _d = useState(false), isDoubleClick = _d[0], setIsDoubleClick = _d[1];
|
|
6956
|
-
var _e = useConfigurationAssetContext(), _f = _e.state, allAssetNodes = _f.allAssetNodes, openAssets = _f.openAssets, showContextMenu = _f.showContextMenu, showCreateNewContextMenu = _f.showCreateNewContextMenu, assetNodeSelectedInTree = _f.assetNodeSelectedInTree, _g = _f.anchorPoint, x = _g.x, y = _g.y, _h = _e.actions, setShowContextMenu = _h.setShowContextMenu, setShowCreateNewContextMenu = _h.setShowCreateNewContextMenu, setMenuContextAssetId = _h.setMenuContextAssetId, setAnchorPointX = _h.setAnchorPointX, setAnchorPointY = _h.setAnchorPointY, setAssetNodeSelectedInTree = _h.setAssetNodeSelectedInTree;
|
|
7172
|
+
var _e = useConfigurationAssetContext(), _f = _e.state, allAssetNodes = _f.allAssetNodes, openAssets = _f.openAssets, showContextMenu = _f.showContextMenu, showCreateNewContextMenu = _f.showCreateNewContextMenu, assetNodeSelectedInTree = _f.assetNodeSelectedInTree, _g = _f.anchorPoint, x = _g.x, y = _g.y, _h = _e.actions, setShowContextMenu = _h.setShowContextMenu, setShowCreateNewContextMenu = _h.setShowCreateNewContextMenu, setMenuContextAssetId = _h.setMenuContextAssetId, setAnchorPointX = _h.setAnchorPointX, setAnchorPointY = _h.setAnchorPointY, setAssetNodeSelectedInTree = _h.setAssetNodeSelectedInTree, setOpenAssets = _h.setOpenAssets;
|
|
6957
7173
|
var allAssets = useAssetContext().state.allAssets;
|
|
6958
7174
|
var _j = useState(false), showCreateNewAssetDialog = _j[0], setShowCreateNewAssetDialog = _j[1];
|
|
6959
7175
|
var _k = useState(false), showViewerAssetDialog = _k[0], setShowViewerAssetDialog = _k[1];
|
|
@@ -7042,6 +7258,39 @@ var AssetViewComponent = function () {
|
|
|
7042
7258
|
setShowCreateNewContextMenu(false);
|
|
7043
7259
|
setShowContextMenu(false);
|
|
7044
7260
|
};
|
|
7261
|
+
var handleSearchResultClick = function (result) {
|
|
7262
|
+
var expandPath = function (nodeId) {
|
|
7263
|
+
var path = [];
|
|
7264
|
+
var findNodeAndPath = function (currentId) {
|
|
7265
|
+
var node = allAssetNodes.find(function (n) { return n.id === currentId; });
|
|
7266
|
+
if (node && node.parent !== -1) {
|
|
7267
|
+
path.unshift(currentId);
|
|
7268
|
+
findNodeAndPath(node.parent);
|
|
7269
|
+
}
|
|
7270
|
+
else if (node) {
|
|
7271
|
+
path.unshift(currentId);
|
|
7272
|
+
}
|
|
7273
|
+
};
|
|
7274
|
+
findNodeAndPath(nodeId);
|
|
7275
|
+
return path;
|
|
7276
|
+
};
|
|
7277
|
+
var pathToExpand = expandPath(result.id);
|
|
7278
|
+
var newOpenAssets = __assign({}, openAssets);
|
|
7279
|
+
pathToExpand.forEach(function (nodeId) {
|
|
7280
|
+
newOpenAssets[nodeId] = nodeId;
|
|
7281
|
+
});
|
|
7282
|
+
setOpenAssets(newOpenAssets);
|
|
7283
|
+
setSelectedNodes([result.node]);
|
|
7284
|
+
setTimeout(function () {
|
|
7285
|
+
var nodeElement = document.querySelector("[data-node-id=\"".concat(result.id, "\"]"));
|
|
7286
|
+
if (nodeElement) {
|
|
7287
|
+
nodeElement.scrollIntoView({
|
|
7288
|
+
behavior: "smooth",
|
|
7289
|
+
block: "center",
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7292
|
+
}, 300);
|
|
7293
|
+
};
|
|
7045
7294
|
useEffect(function () {
|
|
7046
7295
|
searchAssets();
|
|
7047
7296
|
}, []);
|
|
@@ -7052,8 +7301,8 @@ var AssetViewComponent = function () {
|
|
|
7052
7301
|
React__default.createElement("div", { onClick: handleClick },
|
|
7053
7302
|
React__default.createElement("div", { onContextMenu: handleCreateNewContextMenu },
|
|
7054
7303
|
React__default.createElement("div", null,
|
|
7055
|
-
React__default.createElement(Grid, { container: true, justifyContent: "flex-start", alignItems: "
|
|
7056
|
-
React__default.createElement(Typography$1, { variant: "h5", style: { margin: "20px 0 20px", fontWeight: 600 } }, "Assets Tree"),
|
|
7304
|
+
React__default.createElement(Grid, { spacing: 0, container: true, justifyContent: "flex-start", alignItems: "flex-start", className: classes.root },
|
|
7305
|
+
React__default.createElement(Typography$1, { variant: "h5", style: { margin: "20px 0 20px 20px", fontWeight: 600 } }, "Assets Tree"),
|
|
7057
7306
|
isLoading ? (React__default.createElement(Grid, { container: true, style: { width: "100%", height: "100%" } },
|
|
7058
7307
|
React__default.createElement(Grid, { item: true, xs: 12, md: 12, style: {
|
|
7059
7308
|
height: "71vh",
|
|
@@ -7072,6 +7321,7 @@ var AssetViewComponent = function () {
|
|
|
7072
7321
|
padding: "15px 20px 10px",
|
|
7073
7322
|
borderRadius: "0.75rem",
|
|
7074
7323
|
} },
|
|
7324
|
+
React__default.createElement(AssetSearchInput, { assetNodes: allAssetNodes, onSearchResultClick: handleSearchResultClick }),
|
|
7075
7325
|
React__default.createElement(Grid, { container: true, alignItems: "center" },
|
|
7076
7326
|
React__default.createElement(Grid, { container: true, style: {
|
|
7077
7327
|
height: "71vh",
|
|
@@ -7753,6 +8003,7 @@ var UserInitialState = {
|
|
|
7753
8003
|
defaultAreaName: "",
|
|
7754
8004
|
userLogged: false,
|
|
7755
8005
|
permissions: [],
|
|
8006
|
+
profiles: [],
|
|
7756
8007
|
};
|
|
7757
8008
|
var UserReducer = createSlice({
|
|
7758
8009
|
name: "__",
|
|
@@ -7782,6 +8033,10 @@ var UserReducer = createSlice({
|
|
|
7782
8033
|
var payload = _a.payload;
|
|
7783
8034
|
state.permissions = payload;
|
|
7784
8035
|
},
|
|
8036
|
+
setProfiles: function (state, _a) {
|
|
8037
|
+
var payload = _a.payload;
|
|
8038
|
+
state.profiles = payload;
|
|
8039
|
+
},
|
|
7785
8040
|
},
|
|
7786
8041
|
});
|
|
7787
8042
|
|
|
@@ -7797,6 +8052,12 @@ var useHasPermission = function () {
|
|
|
7797
8052
|
return state.permissions.some(function (p) { return p === permission; });
|
|
7798
8053
|
};
|
|
7799
8054
|
};
|
|
8055
|
+
var useHasProfile = function () {
|
|
8056
|
+
var state = useUserContext().state;
|
|
8057
|
+
return function (profile) {
|
|
8058
|
+
return state.profiles.some(function (p) { return p === profile; });
|
|
8059
|
+
};
|
|
8060
|
+
};
|
|
7800
8061
|
var UserProvider = function (_a) {
|
|
7801
8062
|
var children = _a.children;
|
|
7802
8063
|
var _b = useComplexState({
|
|
@@ -7804,13 +8065,14 @@ var UserProvider = function (_a) {
|
|
|
7804
8065
|
reducers: UserReducer.caseReducers,
|
|
7805
8066
|
}), state = _b[0], actions = _b[1];
|
|
7806
8067
|
var _c = useState(false), permissionsLoaded = _c[0], setPermissionsLoaded = _c[1];
|
|
8068
|
+
var _d = useState(false), profilesLoaded = _d[0], setProfilesLoaded = _d[1];
|
|
7807
8069
|
var getUserId = function () {
|
|
7808
8070
|
var sessionData = localStorage.getItem("userMESData") || "{}";
|
|
7809
8071
|
var userData = JSON.parse(sessionData);
|
|
7810
8072
|
return get(userData, "id", null);
|
|
7811
8073
|
};
|
|
7812
8074
|
var getUserPermissions = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7813
|
-
var userId, resp, permissionsArray, error_1;
|
|
8075
|
+
var userId, resp, permissionsArray, profilesArray, error_1;
|
|
7814
8076
|
return __generator(this, function (_a) {
|
|
7815
8077
|
switch (_a.label) {
|
|
7816
8078
|
case 0:
|
|
@@ -7829,6 +8091,11 @@ var UserProvider = function (_a) {
|
|
|
7829
8091
|
actions.setPermissions(permissionsArray);
|
|
7830
8092
|
setPermissionsLoaded(true);
|
|
7831
8093
|
}
|
|
8094
|
+
if (resp && resp.Profiles) {
|
|
8095
|
+
profilesArray = resp.Profiles.split(",");
|
|
8096
|
+
actions.setProfiles(profilesArray);
|
|
8097
|
+
setProfilesLoaded(true);
|
|
8098
|
+
}
|
|
7832
8099
|
return [3 /*break*/, 4];
|
|
7833
8100
|
case 3:
|
|
7834
8101
|
error_1 = _a.sent();
|
|
@@ -7849,7 +8116,11 @@ var UserProvider = function (_a) {
|
|
|
7849
8116
|
}
|
|
7850
8117
|
},
|
|
7851
8118
|
});
|
|
7852
|
-
return (React__default.createElement(UserContext.Provider, { value: {
|
|
8119
|
+
return (React__default.createElement(UserContext.Provider, { value: {
|
|
8120
|
+
state: state,
|
|
8121
|
+
actions: actions,
|
|
8122
|
+
isLoading: !permissionsLoaded || !profilesLoaded,
|
|
8123
|
+
} }, children));
|
|
7853
8124
|
};
|
|
7854
8125
|
|
|
7855
8126
|
var getTokenFromLS = function () {
|
|
@@ -10564,7 +10835,7 @@ var QueryCacheInvalidations = function () {
|
|
|
10564
10835
|
var columnDefs = [
|
|
10565
10836
|
{ field: "SourceId", headerName: "Source ID", flex: 1 },
|
|
10566
10837
|
{ field: "Source", headerName: "Source", flex: 2 },
|
|
10567
|
-
{ field: "
|
|
10838
|
+
{ field: "TargetNamesCSV", headerName: "Targets", flex: 3 },
|
|
10568
10839
|
{
|
|
10569
10840
|
headerName: "Actions",
|
|
10570
10841
|
flex: 1,
|
|
@@ -11776,7 +12047,7 @@ var ColorPicker = function (_a) {
|
|
|
11776
12047
|
padding: 0,
|
|
11777
12048
|
margin: "4px",
|
|
11778
12049
|
} }),
|
|
11779
|
-
React__default.createElement(Popover, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: {
|
|
12050
|
+
React__default.createElement(Popover$1, { id: id, open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: {
|
|
11780
12051
|
vertical: "bottom",
|
|
11781
12052
|
horizontal: "left",
|
|
11782
12053
|
} },
|
|
@@ -14941,5 +15212,5 @@ var areaSelector = /*#__PURE__*/Object.freeze({
|
|
|
14941
15212
|
AreaSelector: AreaSelector
|
|
14942
15213
|
});
|
|
14943
15214
|
|
|
14944
|
-
export { Account, AssetProvider, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, IntegerFormatter, Login, Logout, LongFilterPanel, MESApiService, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getError, getMomentTz, getProfiles, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, renewToken, setPassword, setProfilesToUser, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useHasPermission, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useStyles$C as useStyles, useToken, useUTLSettingsContext, useUserContext };
|
|
15215
|
+
export { Account, AssetProvider, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, IntegerFormatter, Login, Logout, LongFilterPanel, MESApiService, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getError, getMomentTz, getProfiles, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, renewToken, setPassword, setProfilesToUser, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useHasPermission, useHasProfile, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useStyles$C as useStyles, useToken, useUTLSettingsContext, useUserContext };
|
|
14945
15216
|
//# sourceMappingURL=index.esm.js.map
|