@dexteel/mesf-core 5.6.1 → 5.6.3

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "5.6.1"
2
+ ".": "5.6.3"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # Changelog
2
+
3
+ ## [5.6.3](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.6.2...@dexteel/mesf-core-v5.6.3) (2025-07-16)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **tree-picker-control-v2:** Use dialogMaxWidth as optional param ([10b41d3](https://github.com/dexteel/mesf-core-frontend/commit/10b41d3965e22c5a5a6db4ec574aa958eba0b68d))
9
+ * **tree-picker-control-v2:** Use dialogMaxWidth as optional param ([3491b4a](https://github.com/dexteel/mesf-core-frontend/commit/3491b4aceb7534294a56d69fd8505f7de79affc6))
10
+
11
+ ## [5.6.2] - 2025-07-16
12
+
13
+
14
+
15
+ # Changelog
16
+
17
+ ## [5.6.2](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.6.1...@dexteel/mesf-core-v5.6.2) (2025-07-16)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **tree-picker-control-v2:** Rename params | Use itemWithParents as param ([58c9424](https://github.com/dexteel/mesf-core-frontend/commit/58c9424f6df3f05ae98e3a97558bbedbd28b3757))
23
+
24
+ ## [5.6.1] - 2025-07-15
25
+
26
+
27
+
1
28
  # Changelog
2
29
 
3
30
  ## [5.6.1](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v5.6.0...@dexteel/mesf-core-v5.6.1) (2025-07-15)
@@ -9,6 +9,9 @@ type TreePickerControlProps = {
9
9
  showFullPath?: boolean;
10
10
  disabled?: boolean;
11
11
  dataSource: TreeNode;
12
+ mostUsedCount?: number | null;
13
+ itemsWithParent?: String[];
14
+ dialogMaxWidth?: "xs" | "sm" | "md" | "lg" | "xl";
12
15
  [key: string]: any;
13
16
  };
14
17
  export declare const TreePickerControlV2: (props: TreePickerControlProps) => React.JSX.Element;
@@ -9,6 +9,8 @@ export interface TreeNode {
9
9
  isLeaf?: boolean;
10
10
  children?: TreeNode[];
11
11
  delayCategoryColor?: string;
12
+ sortOrder?: number | null;
13
+ parentName?: string;
12
14
  }
13
15
  interface ModalTreeFilterControlProps {
14
16
  onClose: (value?: number, name?: string, node?: TreeNode) => void;
@@ -25,6 +27,9 @@ interface ModalTreeFilterControlProps {
25
27
  setListAssetDrawings?: React.Dispatch<React.SetStateAction<number[]>>;
26
28
  onSuccess?: (value: boolean) => void;
27
29
  isLoading: boolean;
30
+ mostUsedCount: number;
31
+ itemsWithParent: String[];
32
+ dialogMaxWidth: "xs" | "sm" | "md" | "lg" | "xl";
28
33
  }
29
34
  declare const ModalTreeFilterControl: React.FC<ModalTreeFilterControlProps>;
30
35
  export { ModalTreeFilterControl };
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, SvgIcon, Collapse, Typography as Typography$1, Checkbox, TextField, InputAdornment, IconButton as IconButton$1, MenuItem, Box, Card, CardContent, CardActions, Paper, Tooltip, FormControl, InputLabel, Select, ListItemIcon, CircularProgress, Snackbar, FormControlLabel, Switch, Chip, DialogContentText, Badge, useTheme, Input, CssBaseline, AppBar, Toolbar, Container, Menu, Hidden, Drawer, List, ListItem, ListItemText, useMediaQuery, Divider, 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, Chip, SvgIcon, Collapse, Typography as Typography$1, Checkbox, TextField, InputAdornment, IconButton as IconButton$1, MenuItem, Box, Card, CardContent, CardActions, Paper, Tooltip, FormControl, InputLabel, Select, ListItemIcon, CircularProgress, Snackbar, FormControlLabel, Switch, DialogContentText, Badge, useTheme, Input, CssBaseline, AppBar, Toolbar, Container, Menu, Hidden, Drawer, List, ListItem, ListItemText, useMediaQuery, Divider, ListSubheader, debounce, createTheme, ThemeProvider } from '@material-ui/core';
3
3
  import IconButton from '@material-ui/core/IconButton';
4
4
  import CloseIcon from '@material-ui/icons/Close';
5
5
  import Alert$3 from '@material-ui/lab/Alert';
@@ -416,11 +416,11 @@ var useTreviewStyle = makeStyles(function (theme) { return ({
416
416
  },
417
417
  }); });
418
418
  var ModalTreeFilterControl = function (props) {
419
- var onClose = props.onClose, valueProp = props.value, open = props.open, title = props.title, data = props.data, selectBranch = props.selectBranch, selectActive = props.selectActive, selectInternal = props.selectInternal, multipleSelectNodes = props.multipleSelectNodes, onHide = props.onHide, listAssetDrawings = props.listAssetDrawings, setListAssetDrawings = props.setListAssetDrawings, onSuccess = props.onSuccess, isLoading = props.isLoading, other = __rest(props, ["onClose", "value", "open", "title", "data", "selectBranch", "selectActive", "selectInternal", "multipleSelectNodes", "onHide", "listAssetDrawings", "setListAssetDrawings", "onSuccess", "isLoading"]);
420
- var _a = useState(valueProp), value = _a[0], setValue = _a[1];
421
- var _b = useState([]), expanded = _b[0], setExpanded = _b[1];
419
+ var onClose = props.onClose, valueProp = props.value, open = props.open, title = props.title, data = props.data, selectBranch = props.selectBranch, selectActive = props.selectActive, selectInternal = props.selectInternal, multipleSelectNodes = props.multipleSelectNodes, onHide = props.onHide, listAssetDrawings = props.listAssetDrawings, setListAssetDrawings = props.setListAssetDrawings, onSuccess = props.onSuccess, isLoading = props.isLoading, mostUsedCount = props.mostUsedCount, itemsWithParent = props.itemsWithParent, _a = props.dialogMaxWidth, dialogMaxWidth = _a === void 0 ? "sm" : _a, other = __rest(props, ["onClose", "value", "open", "title", "data", "selectBranch", "selectActive", "selectInternal", "multipleSelectNodes", "onHide", "listAssetDrawings", "setListAssetDrawings", "onSuccess", "isLoading", "mostUsedCount", "itemsWithParent", "dialogMaxWidth"]);
420
+ var _b = useState(valueProp), value = _b[0], setValue = _b[1];
421
+ var _c = useState([]), expanded = _c[0], setExpanded = _c[1];
422
422
  var treeRef = useRef(null);
423
- var _c = useState([]), selectedNodes = _c[0], setSelectedNodes = _c[1];
423
+ var _d = useState([]), selectedNodes = _d[0], setSelectedNodes = _d[1];
424
424
  var classes = useTreviewStyle();
425
425
  useEffect(function () {
426
426
  if (!open) {
@@ -559,6 +559,24 @@ var ModalTreeFilterControl = function (props) {
559
559
  setExpanded(expandedBranches);
560
560
  }
561
561
  };
562
+ function treeToArray(nodes, currentParentName) {
563
+ if (currentParentName === void 0) { currentParentName = undefined; }
564
+ var treeArray = [];
565
+ var nodesToProcess = Array.isArray(nodes) ? nodes : [nodes];
566
+ nodesToProcess.forEach(function (node) {
567
+ if (currentParentName !== undefined) {
568
+ node.parentName = currentParentName;
569
+ }
570
+ else {
571
+ delete node.parentName;
572
+ }
573
+ treeArray.push(node);
574
+ if (node.children && node.children.length > 0) {
575
+ treeArray = treeArray.concat(treeToArray(node.children, node.name));
576
+ }
577
+ });
578
+ return treeArray;
579
+ }
562
580
  var renderTree = function (nodes) { return (React__default.createElement(StyledTreeItem, { isChecked: selectedNodes.includes(nodes.id), key: nodes.id, nodeId: nodes.id.toString(), label: React__default.createElement("div", { className: classes.treeLabelRoot },
563
581
  nodes.isCode === true && (React__default.createElement(Code, { className: classes.treLabelIcon, htmlColor: "#1ABC9C" })),
564
582
  nodes.isCode === false && (React__default.createElement(FolderIcon, { className: classes.treLabelIcon, htmlColor: "#F1C40F" })),
@@ -574,7 +592,7 @@ var ModalTreeFilterControl = function (props) {
574
592
  }, onClick: handleCheckboxClick }))), className: "delay-item-node", id: nodes.id.toString(), "data-isbranch": !nodes.isCode }, Array.isArray(nodes.children)
575
593
  ? nodes.children.map(function (node) { return renderTree(node); })
576
594
  : null)); };
577
- return (React__default.createElement(Dialog$1, __assign({ onClose: onHide ? function () { return onHide(false); } : function () { return null; }, "aria-label": title, maxWidth: "sm", disableAutoFocus: true, disableEnforceFocus: true, disableRestoreFocus: true, "aria-labelledby": "confirmation-dialog-title", open: open }, other, { onKeyDown: handleKeyDown }),
595
+ return (React__default.createElement(Dialog$1, __assign({ onClose: onHide ? function () { return onHide(false); } : function () { return null; }, "aria-label": title, maxWidth: dialogMaxWidth, disableAutoFocus: true, disableEnforceFocus: true, disableRestoreFocus: true, "aria-labelledby": "confirmation-dialog-title", open: open }, other, { onKeyDown: handleKeyDown }),
578
596
  React__default.createElement(DialogTitle$1, { id: "confirmation-dialog-title" }, title),
579
597
  isLoading ? (React__default.createElement("div", { style: {
580
598
  width: 600,
@@ -584,10 +602,30 @@ var ModalTreeFilterControl = function (props) {
584
602
  alignItems: "center",
585
603
  } },
586
604
  React__default.createElement(LazyLoading, null))) : (React__default.createElement(DialogContent$1, { dividers: true },
587
- React__default.createElement(TreeView, { autoFocus: false, className: classes.root, defaultCollapseIcon: React__default.createElement(MinusSquare, null), defaultExpandIcon: React__default.createElement(PlusSquare, null), ref: treeRef, selected: value === undefined ? "" : value.toString(), expanded: expanded, onNodeSelect: handleChange, onNodeToggle: handleToogle }, data && data.id !== undefined && renderTree(data)))),
605
+ React__default.createElement(TreeView, { autoFocus: false, className: classes.root, defaultCollapseIcon: React__default.createElement(MinusSquare, null), defaultExpandIcon: React__default.createElement(PlusSquare, null), ref: treeRef, selected: value === undefined ? "" : value.toString(), expanded: expanded, onNodeSelect: handleChange, onNodeToggle: handleToogle }, data && data.id !== undefined && (React__default.createElement(Grid, null,
606
+ mostUsedCount > 0 && (React__default.createElement(Grid, { item: true, md: 12 }, treeToArray(data)
607
+ .sort(function (a, b) {
608
+ if (!a.sortOrder)
609
+ return 1;
610
+ if (!b.sortOrder)
611
+ return -1;
612
+ var valA = a.sortOrder;
613
+ var valB = b.sortOrder;
614
+ return valA - valB;
615
+ })
616
+ .slice(0, mostUsedCount)
617
+ .map(function (node) { return (React__default.createElement(Button, { onClick: function () {
618
+ onClose(node.id, node.name);
619
+ if (onSuccess)
620
+ onSuccess(true);
621
+ }, style: { marginRight: 5, marginBottom: 8 } },
622
+ React__default.createElement(Chip, { label: itemsWithParent.includes(node.name)
623
+ ? "".concat(node.parentName, "/").concat(node.name)
624
+ : node.name, size: "medium", variant: "outlined", style: { cursor: "pointer" } }))); }))),
625
+ renderTree(data)))))),
588
626
  React__default.createElement(DialogActions$1, null,
589
627
  React__default.createElement(Button, { onClick: handleCancel, color: "primary" }, "Cancel"),
590
- React__default.createElement(Button, { onClick: handleOk, color: "primary" }, "OK"))));
628
+ React__default.createElement(Button, { onClick: function () { return handleOk(); }, color: "primary" }, "OK"))));
591
629
  };
592
630
 
593
631
  var useStyles$I = makeStyles(function (theme) { return ({
@@ -742,8 +780,8 @@ function getNodePath(node, nodeId, parentPath, isRoot) {
742
780
  }
743
781
  var TreePickerControlV2 = function (props) {
744
782
  var classes = useStyles$H();
745
- var value = props.value, onSelect = props.onSelect; props.styleLabel; var dataSource = props.dataSource; props.getOptionName; var _a = props.inputTitle, inputTitle = _a === void 0 ? "Asset" : _a; props.showPath; var _c = props.multipleSelectNodes, multipleSelectNodes = _c === void 0 ? false : _c, _d = props.showClearButton, showClearButton = _d === void 0 ? false : _d, _e = props.showFullPath, showFullPath = _e === void 0 ? false : _e, showAssetTree = props.showAssetTree, onHide = props.onHide, _f = props.listAssetDrawings, listAssetDrawings = _f === void 0 ? [] : _f, onSuccess = props.onSuccess, isLoading = props.isLoading, _g = props.disabled, disabled = _g === void 0 ? false : _g, other = __rest(props, ["value", "onSelect", "styleLabel", "dataSource", "getOptionName", "inputTitle", "showPath", "multipleSelectNodes", "showClearButton", "showFullPath", "showAssetTree", "onHide", "listAssetDrawings", "onSuccess", "isLoading", "disabled"]);
746
- var _h = useState(false), open = _h[0], setOpen = _h[1];
783
+ var value = props.value, onSelect = props.onSelect; props.styleLabel; var dataSource = props.dataSource; props.getOptionName; var _a = props.inputTitle, inputTitle = _a === void 0 ? "Asset" : _a; props.showPath; var _c = props.multipleSelectNodes, multipleSelectNodes = _c === void 0 ? false : _c, _d = props.showClearButton, showClearButton = _d === void 0 ? false : _d, _e = props.showFullPath, showFullPath = _e === void 0 ? false : _e, showAssetTree = props.showAssetTree, onHide = props.onHide, _f = props.listAssetDrawings, listAssetDrawings = _f === void 0 ? [] : _f, onSuccess = props.onSuccess, isLoading = props.isLoading, _g = props.disabled, disabled = _g === void 0 ? false : _g, _h = props.mostUsedCount, mostUsedCount = _h === void 0 ? 0 : _h, _j = props.itemsWithParent, itemsWithParent = _j === void 0 ? [] : _j, _k = props.dialogMaxWidth, dialogMaxWidth = _k === void 0 ? "sm" : _k, other = __rest(props, ["value", "onSelect", "styleLabel", "dataSource", "getOptionName", "inputTitle", "showPath", "multipleSelectNodes", "showClearButton", "showFullPath", "showAssetTree", "onHide", "listAssetDrawings", "onSuccess", "isLoading", "disabled", "mostUsedCount", "itemsWithParent", "dialogMaxWidth"]);
784
+ var _l = useState(false), open = _l[0], setOpen = _l[1];
747
785
  var handleClickListItem = function (event) {
748
786
  event.stopPropagation();
749
787
  if (disabled)
@@ -795,7 +833,7 @@ var TreePickerControlV2 = function (props) {
795
833
  React__default.createElement(Grid, { item: true, xs: 12, md: 12 },
796
834
  React__default.createElement(ModalTreeFilterControl, __assign({ classes: {
797
835
  paper: classes.paper,
798
- }, onHide: onHide, id: "modal-treeview-filter", title: props.title, keepMounted: true, open: open, onClose: handleClose, isLoading: isLoading, value: value, data: dataSource, onBackdropClick: function () { return setOpen(false); }, multipleSelectNodes: multipleSelectNodes, listAssetDrawings: listAssetDrawings, setListAssetDrawings: listAssetDrawings, onSuccess: onSuccess }, other)))));
836
+ }, onHide: onHide, id: "modal-treeview-filter", title: props.title, keepMounted: true, open: open, onClose: handleClose, isLoading: isLoading, value: value, data: dataSource, onBackdropClick: function () { return setOpen(false); }, multipleSelectNodes: multipleSelectNodes, listAssetDrawings: listAssetDrawings, setListAssetDrawings: listAssetDrawings, onSuccess: onSuccess, mostUsedCount: mostUsedCount, itemsWithParent: itemsWithParent, dialogMaxWidth: dialogMaxWidth }, other)))));
799
837
  };
800
838
 
801
839
  var SimplePasswordControl = /** @class */ (function (_super) {