@dexteel/mesf-core 4.7.4 → 4.7.5

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/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # CHANGELOG
2
+ ## 4.7.5
3
+ - Added function to format AssetFullPath and display a part in the input
2
4
  ## 4.7.4
3
5
  - Trending: Change size of the date navigator arrows to improve the responsive behavior
4
6
  - Trendings: Fix too many numbers on table bug. Show only the 3 digits after the comma
@@ -1,6 +1,6 @@
1
1
  import React, { Component } from "react";
2
2
  type TreePickerControlProps = {
3
- onSelect: (value: string, description: string, findNode: any) => void;
3
+ onSelect: (value: string, description: string, findNode: any, showPath?: boolean) => void;
4
4
  [key: string]: any;
5
5
  };
6
6
  export declare const TreePickerControl: (props: TreePickerControlProps) => React.JSX.Element;
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ export { LicenseManager } from 'ag-grid-enterprise';
2
2
  import { Typography, TextField, makeStyles as makeStyles$1, Button as Button$1, Grid as Grid$1, Dialog as Dialog$1, DialogTitle as DialogTitle$2, DialogContent as DialogContent$2, DialogContentText, DialogActions as DialogActions$2, FormHelperText, CircularProgress as CircularProgress$1, Badge, FormControlLabel, Checkbox, Snackbar as Snackbar$1, Paper as Paper$1, MenuItem as MenuItem$1, useTheme as useTheme$1, Tooltip, createStyles as createStyles$1, FormControl as FormControl$1, Select as Select$1, Box, Divider, IconButton as IconButton$1, debounce, List, ListItem, ListItemText } from '@material-ui/core';
3
3
  import { values, get, isNil as isNil$1, isEmpty, isNaN, round } from 'lodash-es';
4
4
  import * as React from 'react';
5
- import React__default, { useState, useRef, useEffect, Component, createContext, useContext, useMemo, useCallback, lazy, Suspense } from 'react';
5
+ import React__default, { useState, useRef, useEffect, useMemo, Component, createContext, useContext, useCallback, lazy, Suspense } from 'react';
6
6
  import { Alert as Alert$1, Modal as Modal$1, Navbar, Container, Nav, NavDropdown } from 'react-bootstrap';
7
7
  import DialogTitle$1 from '@material-ui/core/DialogTitle';
8
8
  import DialogContent$1 from '@material-ui/core/DialogContent';
@@ -450,26 +450,26 @@ ModalTreeFilterControl.propTypes = {
450
450
  data: PropTypes.object.isRequired
451
451
  };
452
452
 
453
- var TreePickerControl = function (props) {
454
- var useStyles = makeStyles(function (theme) { return ({
455
- root: {
456
- width: "100%",
457
- backgroundColor: theme.palette.background.paper,
458
- "& .MuiInputBase-input": {
459
- color: "black",
460
- cursor: "pointer",
461
- paddingRight: 45
462
- }
463
- },
464
- paper: {
465
- width: "100%",
466
- maxWidth: 600,
467
- maxHeight: 600
453
+ var useStyles$A = makeStyles(function (theme) { return ({
454
+ root: {
455
+ width: "100%",
456
+ backgroundColor: theme.palette.background.paper,
457
+ "& .MuiInputBase-input": {
458
+ color: "black",
459
+ cursor: "pointer",
460
+ paddingRight: 45
468
461
  }
469
- }); });
470
- var classes = useStyles();
471
- var onSelect = props.onSelect, value = props.value; props.styleLabel; var dataSource = props.dataSource, _a = props.inputTitle, inputTitle = _a === void 0 ? "Asset" : _a, other = __rest(props, ["onSelect", "value", "styleLabel", "dataSource", "inputTitle"]);
472
- var _b = React__default.useState(false), open = _b[0], setOpen = _b[1];
462
+ },
463
+ paper: {
464
+ width: "100%",
465
+ maxWidth: 600,
466
+ maxHeight: 600
467
+ }
468
+ }); });
469
+ var TreePickerControl = function (props) {
470
+ var classes = useStyles$A();
471
+ var onSelect = props.onSelect, value = props.value; props.styleLabel; var dataSource = props.dataSource, _a = props.inputTitle, inputTitle = _a === void 0 ? "Asset" : _a; props.showPath; var other = __rest(props, ["onSelect", "value", "styleLabel", "dataSource", "inputTitle", "showPath"]);
472
+ var _c = React__default.useState(false), open = _c[0], setOpen = _c[1];
473
473
  var handleClickListItem = function (e) {
474
474
  e.stopPropagation();
475
475
  setOpen(true);
@@ -481,10 +481,40 @@ var TreePickerControl = function (props) {
481
481
  onSelect(newValue, newDescription, findNode);
482
482
  }
483
483
  };
484
+ var formatDescription = function (description) {
485
+ if (props.showPath && (description === null || description === void 0 ? void 0 : description.includes('/')) && description.split('/').length > 3) {
486
+ var parts = description.split('/');
487
+ var formattedDescription = '';
488
+ for (var i = 0; i < parts.length; i++) {
489
+ if (i < parts.length - 2) {
490
+ formattedDescription += '.../';
491
+ }
492
+ else if (i === parts.length - 2) {
493
+ if (parts[i].length > 6) {
494
+ formattedDescription += parts[i].substring(0, 6) + '.../';
495
+ }
496
+ else {
497
+ formattedDescription += parts[i] + '/';
498
+ }
499
+ }
500
+ else {
501
+ formattedDescription += parts[i];
502
+ if (i < parts.length - 1) {
503
+ formattedDescription += '/';
504
+ }
505
+ }
506
+ }
507
+ return formattedDescription;
508
+ }
509
+ else {
510
+ return description;
511
+ }
512
+ };
513
+ var description = useMemo(function () { return formatDescription(props.description); }, [props.description]);
484
514
  return (React__default.createElement(Grid, { container: true, className: classes.root },
485
- React__default.createElement(Grid, { container: true, item: true, md: 12, xs: 12, style: { position: "relative" } },
515
+ React__default.createElement(Grid, { container: true, item: true, md: 12, xs: 12, style: { position: "relative" }, title: props.description },
486
516
  React__default.createElement(Grid, { item: true, style: { position: "relative", width: "100%" } },
487
- React__default.createElement(TextField, { label: inputTitle, variant: "outlined", value: props.description, margin: "dense", autoComplete: "off", fullWidth: true, disabled: true }),
517
+ React__default.createElement(TextField, { id: "treePickerTextField", label: inputTitle, variant: "outlined", value: description, margin: "dense", autoComplete: "off", fullWidth: true, disabled: true }),
488
518
  React__default.createElement(AccountTreeIcon, { style: {
489
519
  position: "absolute",
490
520
  right: 15,