@dexteel/mesf-core 4.27.0 → 4.28.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "4.27.0"
2
+ ".": "4.28.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # Changelog
2
+
3
+ ## [4.28.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.27.0...@dexteel/mesf-core-v4.28.0) (2025-04-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * **tree-picker-control-v2:** Show full path of node selected ([#373](https://github.com/dexteel/mesf-core-frontend/issues/373)) ([8ca434b](https://github.com/dexteel/mesf-core-frontend/commit/8ca434b29d1d41c1d2aed6087a52cc999f4e7452))
9
+
10
+ ## [4.27.0] - 2025-04-01
11
+
12
+
13
+
1
14
  # Changelog
2
15
 
3
16
  ## [4.27.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v4.26.5...@dexteel/mesf-core-v4.27.0) (2025-03-31)
@@ -6,6 +6,7 @@ type TreePickerControlProps = {
6
6
  setListAssetDrawings?: Function;
7
7
  onSuccess?: (success: boolean) => void;
8
8
  showClearButton?: boolean;
9
+ showFullPath?: boolean;
9
10
  disabled?: boolean;
10
11
  dataSource: TreeNode;
11
12
  [key: string]: any;
package/dist/index.esm.js CHANGED
@@ -713,10 +713,35 @@ function findNameById(node, id) {
713
713
  }
714
714
  return null;
715
715
  }
716
+ function getNodePath(node, nodeId, parentPath, isRoot) {
717
+ if (parentPath === void 0) { parentPath = ""; }
718
+ if (isRoot === void 0) { isRoot = true; }
719
+ if (node.id === nodeId) {
720
+ if (isRoot) {
721
+ return "";
722
+ }
723
+ return parentPath ? "".concat(parentPath, "/").concat(node.name) : node.name;
724
+ }
725
+ if (node.children && node.children.length > 0) {
726
+ for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
727
+ var child = _a[_i];
728
+ var currentPath = isRoot
729
+ ? ""
730
+ : parentPath
731
+ ? "".concat(parentPath, "/").concat(node.name)
732
+ : node.name;
733
+ var foundPath = getNodePath(child, nodeId, currentPath, false);
734
+ if (foundPath !== null) {
735
+ return foundPath;
736
+ }
737
+ }
738
+ }
739
+ return null;
740
+ }
716
741
  var TreePickerControlV2 = function (props) {
717
742
  var classes = useStyles$A();
718
- 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, showAssetTree = props.showAssetTree, onHide = props.onHide, _e = props.listAssetDrawings, listAssetDrawings = _e === void 0 ? [] : _e, onSuccess = props.onSuccess, isLoading = props.isLoading, _f = props.disabled, disabled = _f === void 0 ? false : _f, other = __rest(props, ["value", "onSelect", "styleLabel", "dataSource", "getOptionName", "inputTitle", "showPath", "multipleSelectNodes", "showClearButton", "showAssetTree", "onHide", "listAssetDrawings", "onSuccess", "isLoading", "disabled"]);
719
- var _g = useState(false), open = _g[0], setOpen = _g[1];
743
+ 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"]);
744
+ var _h = useState(false), open = _h[0], setOpen = _h[1];
720
745
  var handleClickListItem = function (event) {
721
746
  event.stopPropagation();
722
747
  if (disabled)
@@ -732,10 +757,11 @@ var TreePickerControlV2 = function (props) {
732
757
  }
733
758
  };
734
759
  var description = useMemo(function () { return findNameById(dataSource, value) || ""; }, [dataSource, value]);
760
+ var fullPath = useMemo(function () { return getNodePath(dataSource, value) || ""; }, [dataSource, value]);
735
761
  return (React__default.createElement(Grid, { container: true, className: classes.root },
736
762
  !showAssetTree ? (React__default.createElement(Grid, { container: true, item: true, md: 12, xs: 12, style: { position: "relative" }, title: props.description },
737
763
  React__default.createElement(Grid, { item: true, style: { position: "relative", width: "100%" } },
738
- React__default.createElement(TextField, { id: "treePickerTextField", label: inputTitle || "", variant: "outlined", value: description, margin: "dense", autoComplete: "off", fullWidth: true, disabled: true, InputProps: {
764
+ React__default.createElement(TextField, { id: "treePickerTextField", label: inputTitle || "", variant: "outlined", value: showFullPath ? fullPath : description, margin: "dense", autoComplete: "off", fullWidth: true, disabled: true, InputProps: {
739
765
  style: {
740
766
  color: disabled ? "grey" : "black",
741
767
  cursor: "pointer",