@vitrosoftware/common-ui-ts 1.1.172 → 1.1.173

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/dist/index.js CHANGED
@@ -480,24 +480,34 @@ var ScrollBar = function ScrollBar(props) {
480
480
  var _useState = React.useState(null),
481
481
  element = _useState[0],
482
482
  setElement = _useState[1];
483
- var _useState2 = React.useState(null),
484
- parent = _useState2[0],
485
- setParent = _useState2[1];
486
483
  var ref = React.useRef(null);
487
- var resizeObserver = new window.ResizeObserver(function (entries) {
488
- for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
489
- var entry = _step.value;
490
- if (parent && entry.target === parent) {
491
- if (parent.offsetHeight && parent.offsetWidth && ref.current) {
492
- ref.current.scrollTop = 1;
493
- ref.current.scrollLeft = 1;
484
+ React.useEffect(function () {
485
+ var checkRendered = function checkRendered() {
486
+ var _ref$current$children, _ref$current$children2;
487
+ if (ref.current && ((_ref$current$children = ref.current.children[0]) === null || _ref$current$children === void 0 ? void 0 : (_ref$current$children2 = _ref$current$children.children) === null || _ref$current$children2 === void 0 ? void 0 : _ref$current$children2.length) > 1) {
488
+ ref.current.scrollTop = 3;
489
+ ref.current.scrollLeft = 3;
490
+ if (ref.current.scrollTop || ref.current.scrollLeft) {
494
491
  ref.current.scrollTop = 0;
495
492
  ref.current.scrollLeft = 0;
496
- resizeObserver.disconnect();
493
+ observer.disconnect();
497
494
  }
498
495
  }
496
+ };
497
+ checkRendered();
498
+ var observer = new MutationObserver(checkRendered);
499
+ if (ref.current && ref.current.children[0]) {
500
+ observer.observe(ref.current.children[0], {
501
+ childList: true,
502
+ subtree: true
503
+ });
499
504
  }
500
- });
505
+ return function () {
506
+ if (ref.current) {
507
+ observer.disconnect();
508
+ }
509
+ };
510
+ }, []);
501
511
  React.useEffect(function () {
502
512
  if (ref.current) {
503
513
  ref.current.addEventListener('ps-scroll-y', onScrollY);
@@ -512,11 +522,6 @@ var ScrollBar = function ScrollBar(props) {
512
522
  }
513
523
  };
514
524
  }, []);
515
- React.useEffect(function () {
516
- if (parent) {
517
- resizeObserver.observe(parent);
518
- }
519
- }, [parent]);
520
525
  var init = function init() {
521
526
  if (w.PerfectScrollbar) {
522
527
  var scrollElement = new w.PerfectScrollbar(ref.current, {
@@ -533,15 +538,12 @@ var ScrollBar = function ScrollBar(props) {
533
538
  }
534
539
  if (props.isFocusOnScroll && ref.current) {
535
540
  ref.current.addEventListener('ps-scroll-y', function () {
536
- return ref.current.click();
541
+ var _ref$current;
542
+ return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
537
543
  });
538
544
  }
539
- updateParent(ref.current);
540
545
  }
541
546
  };
542
- var updateParent = function updateParent(element) {
543
- setParent(element.parentElement);
544
- };
545
547
  var onWheel = function onWheel(e) {
546
548
  e.stopPropagation();
547
549
  };
@@ -20790,9 +20792,6 @@ var TreeView = function TreeView(props) {
20790
20792
  var _useState2 = React.useState(null),
20791
20793
  jsTreeTreeView = _useState2[0],
20792
20794
  setJsTreeTreeView = _useState2[1];
20793
- var _useState3 = React.useState(null),
20794
- scrollableElement = _useState3[0],
20795
- setScrollableElement = _useState3[1];
20796
20795
  var jsTreeRef = React.useRef(null);
20797
20796
  var jsTreeView;
20798
20797
  React.useEffect(function () {
@@ -20839,11 +20838,6 @@ var TreeView = function TreeView(props) {
20839
20838
  });
20840
20839
  }
20841
20840
  }, [jsTreeTreeView]);
20842
- React.useEffect(function () {
20843
- if (scrollableElement && scrollableElement.scrollTop === 0) {
20844
- scrollableElement.scrollTop = 1;
20845
- }
20846
- });
20847
20841
  var onHoverNode = function onHoverNode(treeView, e, obj) {
20848
20842
  var _obj$node$original;
20849
20843
  if ((_obj$node$original = obj.node.original) !== null && _obj$node$original !== void 0 && _obj$node$original.imageHoverUrl) {
@@ -20920,8 +20914,7 @@ var TreeView = function TreeView(props) {
20920
20914
  }
20921
20915
  };
20922
20916
  return React__default.createElement(ScrollBar, {
20923
- className: styles$3['vitro-scrollbar'] + (props.className ? CTRL.SPACE + props.className : CTRL.EMPTY),
20924
- onInit: setScrollableElement
20917
+ className: styles$3['vitro-scrollbar'] + (props.className ? CTRL.SPACE + props.className : CTRL.EMPTY)
20925
20918
  }, React__default.createElement("div", {
20926
20919
  ref: jsTreeRef,
20927
20920
  id: props.id,
@@ -63552,7 +63545,7 @@ var Viewer = function Viewer(props) {
63552
63545
  };
63553
63546
 
63554
63547
  var name = "@vitrosoftware/common-ui-ts";
63555
- var version$1 = "1.1.172";
63548
+ var version$1 = "1.1.173";
63556
63549
  var description = "vitro software common ui ts";
63557
63550
  var author = "";
63558
63551
  var license = "MIT";
@@ -67364,8 +67357,8 @@ var Item$3 = function Item(props) {
67364
67357
  props.onChange(val, componentProps.name);
67365
67358
  }
67366
67359
  };
67367
- var onControlChange = function onControlChange(val, name) {
67368
- value.valueList = Array.isArray(val) ? val : [val];
67360
+ var onControlChange = function onControlChange(val) {
67361
+ value.valueList = val !== null && val !== undefined ? Array.isArray(val) ? val : [val] : [];
67369
67362
  onChange(value);
67370
67363
  };
67371
67364
  return React__default.createElement(FlexBox, {