@vitrosoftware/common-ui-ts 1.1.241 → 1.1.243

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.
@@ -8252,4 +8252,8 @@ dialog .separator {
8252
8252
  .vitro-item-select-dialog .vitro-selected-item-list .TWBodyMid .TWPageOne .TWSection .TWDataRow td:nth-last-child(2) img,
8253
8253
  .vitro-item-select-dialog .vitro-selected-item-list .TWBodyMid .TWPageOne .TWSection .TWDataRow td:last-child img {
8254
8254
  display: none;
8255
+ }
8256
+
8257
+ .annotationLayer .popupAnnotation * {
8258
+ line-height: normal !important;
8255
8259
  }
@@ -1250,4 +1250,8 @@ dialog .separator {
1250
1250
  .vitro-item-select-dialog .vitro-selected-item-list .TWBodyMid .TWPageOne .TWSection .TWDataRow td:nth-last-child(2) img,
1251
1251
  .vitro-item-select-dialog .vitro-selected-item-list .TWBodyMid .TWPageOne .TWSection .TWDataRow td:last-child img {
1252
1252
  display: none;
1253
+ }
1254
+
1255
+ .annotationLayer .popupAnnotation * {
1256
+ line-height: normal !important;
1253
1257
  }
package/dist/index.js CHANGED
@@ -21436,11 +21436,13 @@ var TableViewServiceImpl = /*#__PURE__*/function () {
21436
21436
  function TableViewServiceImpl(grid) {
21437
21437
  this.suggestValue = CTRL.EMPTY;
21438
21438
  this.isFilterOneLevel = false;
21439
+ this.isFlatView = false;
21439
21440
  this.gridChangesFormat = 'JSON';
21440
21441
  this.searchCriterionMap = new Map();
21441
21442
  this.visibleColumnList = [];
21442
21443
  this.disabledActionList = [];
21443
21444
  this.disabledColumnList = [];
21445
+ this.isExpanding = false;
21444
21446
  this.grid = grid;
21445
21447
  this.id = grid.id;
21446
21448
  this.grid.Source.Upload.Format = this.gridChangesFormat;
@@ -21835,6 +21837,9 @@ var TableViewServiceImpl = /*#__PURE__*/function () {
21835
21837
  if (this.isFilterOneLevel) {
21836
21838
  newData = this.setXmlPart(newData, 'FilterOneLevel="1"', XML_TAG.PAGE_SETTINGS);
21837
21839
  }
21840
+ if (this.isFlatView) {
21841
+ newData = this.setXmlPart(newData, 'FlatView="1"', XML_TAG.PAGE_SETTINGS);
21842
+ }
21838
21843
  if (this.filterContentTypeList) {
21839
21844
  var filterContentTypeListJson = JSON.stringify(this.filterContentTypeList);
21840
21845
  newData = this.setXmlPart(newData, "FilterContentTypeList='" + filterContentTypeListJson + "'", XML_TAG.PAGE_SETTINGS);
@@ -22133,6 +22138,9 @@ var TreeGrid = function TreeGrid(props) {
22133
22138
  if (props.isFilterOneLevel) {
22134
22139
  grid.isFilterOneLevel = props.isFilterOneLevel;
22135
22140
  }
22141
+ if (props.isFlatView) {
22142
+ grid.isFlatView = props.isFlatView;
22143
+ }
22136
22144
  if (props.idColumnName) {
22137
22145
  grid.idColumnName = props.idColumnName;
22138
22146
  }
@@ -61674,32 +61682,72 @@ var styles$v = {"vitro-tab-button-group":"_tab-button-group_vitro-tab-button-gro
61674
61682
  var CSS_CLASS_ACTIVE = 'active';
61675
61683
  var CSS_CLASS_TAB_BUTTON_GROUP = 'vitro-tab-button-group';
61676
61684
  var CSS_CLASS_TAB_BUTTON_GROUP_CONTENT = 'vitro-tab-button-group-content';
61685
+ var ELEMENT_CANVAS$1 = 'canvas';
61686
+ var CANVAS_CONTEXT$1 = '2d';
61677
61687
  var TabButtonGroup = function TabButtonGroup(props) {
61678
61688
  var _useState = React.useState([]),
61679
61689
  tabList = _useState[0],
61680
61690
  setTabList = _useState[1];
61681
- var _useState2 = React.useState(),
61682
- activeItem = _useState2[0],
61683
- setActiveItem = _useState2[1];
61684
- var _useState3 = React.useState(),
61685
- activeItemTabBtn = _useState3[0],
61686
- setActiveItemTabBtn = _useState3[1];
61687
- var _useState4 = React.useState(0),
61688
- width = _useState4[0],
61689
- setWidth = _useState4[1];
61691
+ var _useState2 = React.useState(props.itemList.length),
61692
+ overflowIndex = _useState2[0],
61693
+ setOverflowIndex = _useState2[1];
61694
+ var _useState3 = React.useState(props.activeItem || CTRL.EMPTY),
61695
+ activeItem = _useState3[0],
61696
+ setActiveItem = _useState3[1];
61697
+ var _useState4 = React.useState(),
61698
+ activeItemTabBtn = _useState4[0],
61699
+ setActiveItemTabBtn = _useState4[1];
61700
+ var _useState5 = React.useState(0),
61701
+ width = _useState5[0],
61702
+ setWidth = _useState5[1];
61703
+ var resizeTimeout = React.useMemo(function () {
61704
+ return {
61705
+ id: null
61706
+ };
61707
+ }, []);
61690
61708
  var ref = React.useRef(null);
61691
61709
  var overflowTabList = [];
61692
- var tabMinWidth = 120;
61693
61710
  var resizeObserver = new window.ResizeObserver(function (entries) {
61694
61711
  for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
61695
61712
  var entry = _step.value;
61696
61713
  if (ref.current && entry.target === ref.current) {
61697
- if (!width || props.wrap) {
61698
- setWidth(ref.current.offsetWidth);
61714
+ if (props.wrap) {
61715
+ if (resizeTimeout.id) {
61716
+ clearTimeout(resizeTimeout.id);
61717
+ }
61718
+ resizeTimeout.id = setTimeout(function () {
61719
+ var _ref$current;
61720
+ resizeTimeout.id = null;
61721
+ setWidth(((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) || 0);
61722
+ }, 200);
61699
61723
  }
61700
61724
  }
61701
61725
  }
61702
61726
  });
61727
+ React.useEffect(function () {
61728
+ if (width) {
61729
+ setOverflowIndex(getOverflowIndex(width));
61730
+ } else {
61731
+ setOverflowIndex(tabList.length);
61732
+ }
61733
+ }, [width]);
61734
+ var getOverflowIndex = function getOverflowIndex(width) {
61735
+ var scrollWidth = (activeItemTabBtn === null || activeItemTabBtn === void 0 ? void 0 : activeItemTabBtn.width) || 0;
61736
+ for (var _iterator2 = _createForOfIteratorHelperLoose(tabList.entries()), _step2; !(_step2 = _iterator2()).done;) {
61737
+ var _step2$value = _step2.value,
61738
+ index = _step2$value[0],
61739
+ item = _step2$value[1];
61740
+ if (item.id === (activeItemTabBtn === null || activeItemTabBtn === void 0 ? void 0 : activeItemTabBtn.id)) {
61741
+ continue;
61742
+ }
61743
+ if (scrollWidth + item.width < width) {
61744
+ scrollWidth += item.width;
61745
+ } else {
61746
+ return index;
61747
+ }
61748
+ }
61749
+ return tabList.length;
61750
+ };
61703
61751
  React.useEffect(function () {
61704
61752
  if (ref.current) {
61705
61753
  resizeObserver.observe(ref.current);
@@ -61712,62 +61760,35 @@ var TabButtonGroup = function TabButtonGroup(props) {
61712
61760
  }, []);
61713
61761
  React.useEffect(function () {
61714
61762
  if (props.itemList) {
61715
- var list = props.itemList.map(function (item, index) {
61716
- return _extends({}, item, {
61717
- index: index
61718
- });
61719
- });
61720
- var isActiveItemChanged = props.activeItem != activeItem;
61721
- setTabList(list);
61722
- setActiveItem(props.activeItem);
61723
- if (props.activeItem) {
61724
- var itemTabBtn = tabList.find(function (item) {
61725
- return item.id === props.activeItem;
61726
- });
61727
- if (itemTabBtn) {
61728
- if (isActiveItemChanged) {
61729
- var overflowItem = overflowTabList.find(function (item) {
61730
- return item.index === itemTabBtn.index;
61731
- });
61732
- if (overflowItem) {
61733
- setActiveItemTabBtn(overflowItem);
61734
- } else {
61735
- setActiveItemTabBtn(null);
61736
- }
61737
- }
61738
- } else {
61739
- setActiveItemTabBtn(null);
61740
- }
61741
- } else {
61742
- setActiveItemTabBtn(null);
61743
- }
61763
+ setTabList(getItemList(props.itemList));
61744
61764
  }
61745
61765
  }, [props.itemList]);
61746
61766
  React.useEffect(function () {
61747
- var isActiveItemChanged = props.activeItem != activeItem;
61748
- setActiveItem(props.activeItem);
61749
61767
  if (props.activeItem) {
61750
- var itemTabBtn = tabList.find(function (item) {
61751
- return item.id === props.activeItem;
61752
- });
61753
- if (itemTabBtn) {
61754
- if (isActiveItemChanged) {
61755
- var overflowItem = overflowTabList.find(function (item) {
61756
- return item.index === itemTabBtn.index;
61757
- });
61758
- if (overflowItem) {
61759
- setActiveItemTabBtn(overflowItem);
61760
- } else {
61761
- setActiveItemTabBtn(null);
61762
- }
61763
- }
61764
- } else {
61765
- setActiveItemTabBtn(null);
61766
- }
61767
- } else {
61768
- setActiveItemTabBtn(null);
61768
+ setActiveItem(props.activeItem);
61769
61769
  }
61770
61770
  }, [props.activeItem]);
61771
+ var getItemList = function getItemList(itemList) {
61772
+ if (ref.current) {
61773
+ var canvas = document.createElement(ELEMENT_CANVAS$1);
61774
+ var font = window.getComputedStyle(ref.current).font;
61775
+ var newItemList = itemList.map(function (item, index) {
61776
+ return _extends({}, item, {
61777
+ width: getTextWidth(item.text, canvas, font),
61778
+ index: index
61779
+ });
61780
+ });
61781
+ return newItemList;
61782
+ }
61783
+ return itemList;
61784
+ };
61785
+ var getTextWidth = function getTextWidth(text, canvas, font) {
61786
+ var context = canvas.getContext(CANVAS_CONTEXT$1);
61787
+ context.font = font;
61788
+ var _context$measureText = context.measureText(text),
61789
+ width = _context$measureText.width;
61790
+ return width + 24;
61791
+ };
61771
61792
  var setButtonActive = function setButtonActive(index) {
61772
61793
  var overflowItem = overflowTabList.find(function (item) {
61773
61794
  return item.index === index;
@@ -61797,21 +61818,13 @@ var TabButtonGroup = function TabButtonGroup(props) {
61797
61818
  }
61798
61819
  });
61799
61820
  };
61800
- var getWidth = function getWidth() {
61801
- var count = tabList.length - overflowTabList.length;
61802
- var _width = width - count * 16;
61803
- return _width >= tabMinWidth ? _width : tabMinWidth;
61804
- };
61805
61821
  return React__default.createElement("div", {
61806
61822
  className: styles$v[CSS_CLASS_TAB_BUTTON_GROUP]
61807
61823
  }, React__default.createElement("div", {
61808
61824
  className: styles$v[CSS_CLASS_TAB_BUTTON_GROUP_CONTENT],
61809
61825
  ref: ref
61810
61826
  }, tabList.map(function (item, index) {
61811
- if ((activeItemTabBtn ? index + 2 : index + 1) * tabMinWidth < getWidth() || !props.wrap) {
61812
- if (activeItemTabBtn && activeItemTabBtn.index === index) {
61813
- setActiveItemTabBtn(null);
61814
- }
61827
+ if (index < overflowIndex || !props.wrap || activeItemTabBtn && activeItemTabBtn.index === index) {
61815
61828
  return getTabButton(item, index);
61816
61829
  }
61817
61830
  if (activeItemTabBtn && activeItemTabBtn.index === index) {
@@ -61819,15 +61832,9 @@ var TabButtonGroup = function TabButtonGroup(props) {
61819
61832
  }
61820
61833
  overflowTabList.push(item);
61821
61834
  return null;
61822
- }), activeItemTabBtn && React__default.createElement(Button$1, {
61823
- key: activeItemTabBtn.id,
61824
- className: styles$v[CSS_CLASS_ACTIVE],
61825
- text: activeItemTabBtn.text,
61826
- onClick: function onClick() {}
61827
61835
  }), tabList && props.wrap && React__default.createElement(OverflowButton, {
61828
61836
  list: overflowTabList,
61829
61837
  offset: tabList.length - overflowTabList.length,
61830
- width: width,
61831
61838
  onSelect: setButtonActive
61832
61839
  })));
61833
61840
  };
@@ -66962,7 +66969,7 @@ var Viewer = function Viewer(props) {
66962
66969
  };
66963
66970
 
66964
66971
  var name = "@vitrosoftware/common-ui-ts";
66965
- var version$1 = "1.1.241";
66972
+ var version$1 = "1.1.243";
66966
66973
  var description = "vitro software common ui ts";
66967
66974
  var author = "";
66968
66975
  var license = "MIT";