@vitrosoftware/common-ui-ts 1.1.219 → 1.1.220

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
@@ -61439,25 +61439,188 @@ var OverflowButton = function OverflowButton(props) {
61439
61439
  });
61440
61440
  };
61441
61441
 
61442
+ var CSS_PROPERTY = function CSS_PROPERTY() {};
61443
+ CSS_PROPERTY.FONT_WEIGHT = 'font-weight';
61444
+ CSS_PROPERTY.FONT_SIZE = 'font-size';
61445
+ CSS_PROPERTY.FONT_FAMILY = 'font-family';
61446
+
61447
+ var ValueTooltip = React.forwardRef(function (props, ref) {
61448
+ var _useState = React.useState(false),
61449
+ isEnabled = _useState[0],
61450
+ setIsEnabled = _useState[1];
61451
+ var _useState2 = React.useState(false),
61452
+ isShow = _useState2[0],
61453
+ setIsShow = _useState2[1];
61454
+ var _useState3 = React.useState(props.text),
61455
+ text = _useState3[0],
61456
+ _setText = _useState3[1];
61457
+ var canvasRef = React.useRef();
61458
+ var containerRef = React.useRef();
61459
+ var onShowTimeout = React.useMemo(function () {
61460
+ return {
61461
+ id: null
61462
+ };
61463
+ }, []);
61464
+ var resizeObserver = React__default.useMemo(function () {
61465
+ return new window.ResizeObserver(function (entries) {
61466
+ for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
61467
+ var entry = _step.value;
61468
+ setIsEnabled(isValueOverflow(text, entry.target));
61469
+ }
61470
+ });
61471
+ }, [text]);
61472
+ React.useEffect(function () {
61473
+ if (props.containerRef && props.containerRef.current) {
61474
+ containerRef.current = props.containerRef.current;
61475
+ resizeObserver.observe(containerRef.current);
61476
+ containerRef.current.addEventListener(exports.EVENT.MOUSEENTER, onMouseEnter);
61477
+ containerRef.current.addEventListener(exports.EVENT.MOUSELEAVE, onMouseLeave);
61478
+ }
61479
+ return function () {
61480
+ if (containerRef.current) {
61481
+ containerRef.current.removeEventListener(exports.EVENT.MOUSEENTER, onMouseEnter);
61482
+ containerRef.current.removeEventListener(exports.EVENT.MOUSELEAVE, onMouseLeave);
61483
+ }
61484
+ };
61485
+ }, [props.containerRef, resizeObserver]);
61486
+ React.useEffect(function () {
61487
+ return function () {
61488
+ resizeObserver.disconnect();
61489
+ };
61490
+ }, []);
61491
+ React.useEffect(function () {
61492
+ _setText(props.text);
61493
+ if (containerRef.current) {
61494
+ setIsEnabled(isValueOverflow(props.text, containerRef.current));
61495
+ } else {
61496
+ setIsEnabled(true);
61497
+ }
61498
+ }, [props.text]);
61499
+ React.useEffect(function () {
61500
+ if (props.onUpdate) {
61501
+ props.onUpdate(isEnabled);
61502
+ }
61503
+ }, [isEnabled]);
61504
+ React.useImperativeHandle(ref, function () {
61505
+ return {
61506
+ update: function update() {
61507
+ if (containerRef.current) {
61508
+ setIsEnabled(isValueOverflow(text, containerRef.current));
61509
+ }
61510
+ },
61511
+ setIsShow: function setIsShow(value) {
61512
+ if (value === false) {
61513
+ setIsEnabled(false);
61514
+ } else {
61515
+ if (containerRef.current) {
61516
+ setIsEnabled(isValueOverflow(text, containerRef.current));
61517
+ } else {
61518
+ setIsEnabled(true);
61519
+ }
61520
+ }
61521
+ },
61522
+ setText: function setText(value) {
61523
+ _setText(value);
61524
+ }
61525
+ };
61526
+ });
61527
+ var isValueOverflow = function isValueOverflow(value, container) {
61528
+ if (props.isMultiline) {
61529
+ return isValueVerticalOverflow(container);
61530
+ }
61531
+ return isValueHorizontalOverflow(value, container);
61532
+ };
61533
+ var isValueHorizontalOverflow = function isValueHorizontalOverflow(value, container) {
61534
+ var textWidth = getTextWidth(value, getCanvasFont(container), container.scrollWidth);
61535
+ if (container && textWidth > getAvailableWidth(container)) {
61536
+ return true;
61537
+ } else {
61538
+ return false;
61539
+ }
61540
+ };
61541
+ var isValueVerticalOverflow = function isValueVerticalOverflow(container) {
61542
+ return container.clientHeight + 1 < container.scrollHeight;
61543
+ };
61544
+ var getTextWidth = function getTextWidth(text, font, scrollWidth) {
61545
+ if (!canvasRef.current) {
61546
+ canvasRef.current = document.createElement('canvas');
61547
+ }
61548
+ var canvas = canvasRef.current;
61549
+ var context = canvas.getContext('2d');
61550
+ if (context) {
61551
+ context.font = font;
61552
+ var metrics = context.measureText(text);
61553
+ return metrics.width;
61554
+ }
61555
+ return scrollWidth;
61556
+ };
61557
+ var getAvailableWidth = function getAvailableWidth(element) {
61558
+ var style = getComputedStyle(element);
61559
+ var paddingX = getNumber(style.paddingLeft) + getNumber(style.paddingRight);
61560
+ var borderX = getNumber(style.borderLeftWidth) + getNumber(style.borderRightWidth);
61561
+ return element.offsetWidth - paddingX - borderX;
61562
+ };
61563
+ var getNumber = function getNumber(value) {
61564
+ return parseFloat(value) || 0;
61565
+ };
61566
+ var getCssStyle = function getCssStyle(element, prop) {
61567
+ return window.getComputedStyle(element, null).getPropertyValue(prop);
61568
+ };
61569
+ var getCanvasFont = function getCanvasFont(el) {
61570
+ if (el === void 0) {
61571
+ el = document.body;
61572
+ }
61573
+ var fontWeight = getCssStyle(el, CSS_PROPERTY.FONT_WEIGHT);
61574
+ var fontSize = getCssStyle(el, CSS_PROPERTY.FONT_SIZE);
61575
+ var fontFamily = getCssStyle(el, CSS_PROPERTY.FONT_FAMILY);
61576
+ return fontWeight + " " + fontSize + " " + fontFamily;
61577
+ };
61578
+ var onMouseEnter = function onMouseEnter(e) {
61579
+ if (onShowTimeout.id) {
61580
+ clearTimeout(onShowTimeout.id);
61581
+ }
61582
+ if (e.target == containerRef.current) {
61583
+ onShowTimeout.id = setTimeout(function () {
61584
+ setIsShow(true);
61585
+ }, 750);
61586
+ }
61587
+ };
61588
+ var onMouseLeave = function onMouseLeave(e) {
61589
+ if (onShowTimeout.id) {
61590
+ clearTimeout(onShowTimeout.id);
61591
+ }
61592
+ setTimeout(function () {
61593
+ return setIsShow(false);
61594
+ }, 300);
61595
+ };
61596
+ return React__default.createElement(Tooltip$1, Object.assign({}, props, {
61597
+ text: text,
61598
+ isShow: isEnabled ? isShow : false,
61599
+ isHideOnHover: false
61600
+ }), props.children);
61601
+ });
61602
+
61442
61603
  var styles$r = {"vitro-tab":"_tab-group_vitro-tab_1Qb50HL","vitro-item":"_tab-group_vitro-item_2YnBcmb","active":"_tab-group_active_3M-IIR2"};
61443
61604
 
61444
61605
  var Tab = function Tab(props) {
61445
- if (!props.icon && !props.title) {
61446
- return null;
61447
- }
61606
+ var linkRef = React.useRef(null);
61448
61607
  return React__default.createElement("div", {
61449
61608
  key: props.index,
61450
61609
  className: styles$r['vitro-item']
61610
+ }, React__default.createElement(ValueTooltip, {
61611
+ text: props.text,
61612
+ containerRef: linkRef
61451
61613
  }, React__default.createElement(Nav$2.Item, {
61452
61614
  className: props.active ? styles$r['active'] : undefined,
61453
61615
  onClick: function onClick() {
61454
61616
  return props.onClick(props.index);
61455
61617
  }
61456
61618
  }, React__default.createElement(Nav$2.Link, {
61457
- eventKey: props.eventKey
61458
- }, React__default.createElement("span", null, props.icon && React__default.createElement(Image, {
61459
- defaultUrl: props.icon
61460
- }), props.title))));
61619
+ eventKey: props.eventKey,
61620
+ ref: linkRef
61621
+ }, React__default.createElement("span", null, props.imageUrl && React__default.createElement(Image, {
61622
+ defaultUrl: props.imageUrl
61623
+ }), props.text)))));
61461
61624
  };
61462
61625
 
61463
61626
  var TabGroupHeader = function TabGroupHeader(props) {
@@ -61505,8 +61668,8 @@ var TabGroupHeader = function TabGroupHeader(props) {
61505
61668
  active: index === props.currentTab,
61506
61669
  onClick: onClick,
61507
61670
  eventKey: item.eventKey,
61508
- icon: item.icon,
61509
- title: item.text
61671
+ imageUrl: item.imageUrl,
61672
+ text: item.text
61510
61673
  });
61511
61674
  }
61512
61675
  if (activeItem && activeItem.index === index) {
@@ -61520,8 +61683,8 @@ var TabGroupHeader = function TabGroupHeader(props) {
61520
61683
  active: true,
61521
61684
  onClick: function onClick() {},
61522
61685
  eventKey: activeItem.eventKey,
61523
- icon: activeItem.icon,
61524
- title: activeItem.text
61686
+ imageUrl: activeItem.imageUrl,
61687
+ text: activeItem.text
61525
61688
  }), props.itemList && props.wrap && React__default.createElement(OverflowButton, {
61526
61689
  list: overflowTabList,
61527
61690
  offset: props.itemList.length - overflowTabList.length,
@@ -63273,170 +63436,9 @@ var CriterionFieldIterator = function CriterionFieldIterator(props) {
63273
63436
  })));
63274
63437
  };
63275
63438
 
63276
- var CSS_PROPERTY = function CSS_PROPERTY() {};
63277
- CSS_PROPERTY.FONT_WEIGHT = 'font-weight';
63278
- CSS_PROPERTY.FONT_SIZE = 'font-size';
63279
- CSS_PROPERTY.FONT_FAMILY = 'font-family';
63280
-
63281
- var ValueTooltip = React.forwardRef(function (props, ref) {
63282
- var _useState = React.useState(false),
63283
- isEnabled = _useState[0],
63284
- setIsEnabled = _useState[1];
63285
- var _useState2 = React.useState(false),
63286
- isShow = _useState2[0],
63287
- setIsShow = _useState2[1];
63288
- var _useState3 = React.useState(props.text),
63289
- text = _useState3[0],
63290
- _setText = _useState3[1];
63291
- var canvasRef = React.useRef();
63292
- var containerRef = React.useRef();
63293
- var onShowTimeout = React.useMemo(function () {
63294
- return {
63295
- id: null
63296
- };
63297
- }, []);
63298
- var resizeObserver = React__default.useMemo(function () {
63299
- return new window.ResizeObserver(function (entries) {
63300
- for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
63301
- var entry = _step.value;
63302
- setIsEnabled(isValueOverflow(text, entry.target));
63303
- }
63304
- });
63305
- }, [text]);
63306
- React.useEffect(function () {
63307
- if (props.containerRef && props.containerRef.current) {
63308
- containerRef.current = props.containerRef.current;
63309
- resizeObserver.observe(containerRef.current);
63310
- containerRef.current.addEventListener(exports.EVENT.MOUSEENTER, onMouseEnter);
63311
- containerRef.current.addEventListener(exports.EVENT.MOUSELEAVE, onMouseLeave);
63312
- }
63313
- return function () {
63314
- if (containerRef.current) {
63315
- containerRef.current.removeEventListener(exports.EVENT.MOUSEENTER, onMouseEnter);
63316
- containerRef.current.removeEventListener(exports.EVENT.MOUSELEAVE, onMouseLeave);
63317
- }
63318
- };
63319
- }, [props.containerRef, resizeObserver]);
63320
- React.useEffect(function () {
63321
- return function () {
63322
- resizeObserver.disconnect();
63323
- };
63324
- }, []);
63325
- React.useEffect(function () {
63326
- _setText(props.text);
63327
- if (containerRef.current) {
63328
- setIsEnabled(isValueOverflow(props.text, containerRef.current));
63329
- } else {
63330
- setIsEnabled(true);
63331
- }
63332
- }, [props.text]);
63333
- React.useEffect(function () {
63334
- if (props.onUpdate) {
63335
- props.onUpdate(isEnabled);
63336
- }
63337
- }, [isEnabled]);
63338
- React.useImperativeHandle(ref, function () {
63339
- return {
63340
- update: function update() {
63341
- if (containerRef.current) {
63342
- setIsEnabled(isValueOverflow(text, containerRef.current));
63343
- }
63344
- },
63345
- setIsShow: function setIsShow(value) {
63346
- if (value === false) {
63347
- setIsEnabled(false);
63348
- } else {
63349
- if (containerRef.current) {
63350
- setIsEnabled(isValueOverflow(text, containerRef.current));
63351
- } else {
63352
- setIsEnabled(true);
63353
- }
63354
- }
63355
- },
63356
- setText: function setText(value) {
63357
- _setText(value);
63358
- }
63359
- };
63360
- });
63361
- var isValueOverflow = function isValueOverflow(value, container) {
63362
- if (props.isMultiline) {
63363
- return isValueVerticalOverflow(container);
63364
- }
63365
- return isValueHorizontalOverflow(value, container);
63366
- };
63367
- var isValueHorizontalOverflow = function isValueHorizontalOverflow(value, container) {
63368
- var textWidth = getTextWidth(value, getCanvasFont(container), container.scrollWidth);
63369
- if (container && textWidth > getAvailableWidth(container)) {
63370
- return true;
63371
- } else {
63372
- return false;
63373
- }
63374
- };
63375
- var isValueVerticalOverflow = function isValueVerticalOverflow(container) {
63376
- return container.clientHeight + 1 < container.scrollHeight;
63377
- };
63378
- var getTextWidth = function getTextWidth(text, font, scrollWidth) {
63379
- if (!canvasRef.current) {
63380
- canvasRef.current = document.createElement('canvas');
63381
- }
63382
- var canvas = canvasRef.current;
63383
- var context = canvas.getContext('2d');
63384
- if (context) {
63385
- context.font = font;
63386
- var metrics = context.measureText(text);
63387
- return metrics.width;
63388
- }
63389
- return scrollWidth;
63390
- };
63391
- var getAvailableWidth = function getAvailableWidth(element) {
63392
- var style = getComputedStyle(element);
63393
- var paddingX = getNumber(style.paddingLeft) + getNumber(style.paddingRight);
63394
- var borderX = getNumber(style.borderLeftWidth) + getNumber(style.borderRightWidth);
63395
- return element.offsetWidth - paddingX - borderX;
63396
- };
63397
- var getNumber = function getNumber(value) {
63398
- return parseFloat(value) || 0;
63399
- };
63400
- var getCssStyle = function getCssStyle(element, prop) {
63401
- return window.getComputedStyle(element, null).getPropertyValue(prop);
63402
- };
63403
- var getCanvasFont = function getCanvasFont(el) {
63404
- if (el === void 0) {
63405
- el = document.body;
63406
- }
63407
- var fontWeight = getCssStyle(el, CSS_PROPERTY.FONT_WEIGHT);
63408
- var fontSize = getCssStyle(el, CSS_PROPERTY.FONT_SIZE);
63409
- var fontFamily = getCssStyle(el, CSS_PROPERTY.FONT_FAMILY);
63410
- return fontWeight + " " + fontSize + " " + fontFamily;
63411
- };
63412
- var onMouseEnter = function onMouseEnter(e) {
63413
- if (onShowTimeout.id) {
63414
- clearTimeout(onShowTimeout.id);
63415
- }
63416
- if (e.target == containerRef.current) {
63417
- onShowTimeout.id = setTimeout(function () {
63418
- setIsShow(true);
63419
- }, 750);
63420
- }
63421
- };
63422
- var onMouseLeave = function onMouseLeave(e) {
63423
- if (onShowTimeout.id) {
63424
- clearTimeout(onShowTimeout.id);
63425
- }
63426
- setTimeout(function () {
63427
- return setIsShow(false);
63428
- }, 300);
63429
- };
63430
- return React__default.createElement(Tooltip$1, Object.assign({}, props, {
63431
- text: text,
63432
- isShow: isEnabled ? isShow : false,
63433
- isHideOnHover: false
63434
- }), props.children);
63435
- });
63436
-
63437
63439
  var styles$M = {"vitro-selected-item-multi":"_lookup-picker-selected-item_vitro-selected-item-multi_bzL7ugZ","vitro-selected-item":"_lookup-picker-selected-item_vitro-selected-item_hw-euth","vitro-button-close":"_lookup-picker-selected-item_vitro-button-close_1SRnr_0"};
63438
63440
 
63439
- var styles$N = {"vitro-lookup-picker":"_lookup-picker_vitro-lookup-picker_1aXYQEG","vitro-content":"_lookup-picker_vitro-content_37L0slb","vitro-read-only":"_lookup-picker_vitro-read-only_32NOdGB","vitro-label":"_lookup-picker_vitro-label_2QoJkUz","vitro-focus":"_lookup-picker_vitro-focus_2UGpxXD","vitro-error":"_lookup-picker_vitro-error_dF7iopC","vitro-error-message":"_lookup-picker_vitro-error-message_2iBjyRP","vitro-copy-button":"_lookup-picker_vitro-copy-button_3UItrZb","vitro-value-container":"_lookup-picker_vitro-value-container_3GeBIaW","vitro-multi-value-container":"_lookup-picker_vitro-multi-value-container_2ScQ_Ua","vitro-lookup-picker-multi-select":"_lookup-picker_vitro-lookup-picker-multi-select_3Lkq2tk","vitro-button-close":"_lookup-picker_vitro-button-close_3_Qndrj","vitro-button-collapse-up":"_lookup-picker_vitro-button-collapse-up_3i0OJub","vitro-button-collapse-bottom":"_lookup-picker_vitro-button-collapse-bottom_3o0Pl83","vitro-tooltip":"_lookup-picker_vitro-tooltip_2a12Z4P","vitro-right":"_lookup-picker_vitro-right_1XFsL1w","vitro-library-button":"_lookup-picker_vitro-library-button_1zwNYAA"};
63441
+ var styles$N = {"vitro-lookup-picker":"_lookup-picker_vitro-lookup-picker_1aXYQEG","vitro-content":"_lookup-picker_vitro-content_37L0slb","vitro-read-only":"_lookup-picker_vitro-read-only_32NOdGB","vitro-label":"_lookup-picker_vitro-label_2QoJkUz","vitro-focus":"_lookup-picker_vitro-focus_2UGpxXD","vitro-error":"_lookup-picker_vitro-error_dF7iopC","vitro-error-message":"_lookup-picker_vitro-error-message_2iBjyRP","vitro-copy-button":"_lookup-picker_vitro-copy-button_3UItrZb","vitro-value-container":"_lookup-picker_vitro-value-container_3GeBIaW","vitro-multi-value-container":"_lookup-picker_vitro-multi-value-container_2ScQ_Ua","vitro-lookup-picker-multi-select":"_lookup-picker_vitro-lookup-picker-multi-select_3Lkq2tk","vitro-button-close":"_lookup-picker_vitro-button-close_3_Qndrj","vitro-button-collapse-up":"_lookup-picker_vitro-button-collapse-up_3i0OJub","vitro-button-collapse-bottom":"_lookup-picker_vitro-button-collapse-bottom_3o0Pl83","vitro-tooltip":"_lookup-picker_vitro-tooltip_2a12Z4P","vitro-right":"_lookup-picker_vitro-right_1XFsL1w","vitro-library-button":"_lookup-picker_vitro-library-button_1zwNYAA","vitro-placeholder":"_lookup-picker_vitro-placeholder_2Soq8bU"};
63440
63442
 
63441
63443
  var htmlValueStyles = {"vitro-item-html-value":"_lookup-picker-html-value_vitro-item-html-value_2QBoTey"};
63442
63444
 
@@ -63989,7 +63991,9 @@ var LookupPicker = React.forwardRef(function (props, ref) {
63989
63991
  isReadOnly: props.isReadOnly,
63990
63992
  isValueListVisible: valueListVisible,
63991
63993
  getHtmlValue: getHtmlValue
63992
- }) : !valueListVisible && React__default.createElement(React__default.Fragment, null, props.placeholder), isEditable && React__default.createElement("input", {
63994
+ }) : !valueListVisible && React__default.createElement("div", {
63995
+ className: styles$N['vitro-placeholder']
63996
+ }, props.placeholder), isEditable && React__default.createElement("input", {
63993
63997
  ref: inputRef,
63994
63998
  value: inputValue,
63995
63999
  onKeyDown: onKeyDown,
@@ -67100,7 +67104,7 @@ var Viewer = function Viewer(props) {
67100
67104
  };
67101
67105
 
67102
67106
  var name = "@vitrosoftware/common-ui-ts";
67103
- var version$1 = "1.1.219";
67107
+ var version$1 = "1.1.220";
67104
67108
  var description = "vitro software common ui ts";
67105
67109
  var author = "";
67106
67110
  var license = "MIT";
@@ -83470,7 +83474,6 @@ var EditableFieldIterator = function EditableFieldIterator(props) {
83470
83474
  changedFieldValueMap: changedFieldValueMap,
83471
83475
  componentMap: componentMap,
83472
83476
  onChange: onChange,
83473
- isVisibleOverflow: true,
83474
83477
  className: styles$1r['vitro-field-iterator']
83475
83478
  }) : React__default.createElement(ScrollBar, {
83476
83479
  className: styles$1r['vitro-scrollbar']
@@ -83480,7 +83483,6 @@ var EditableFieldIterator = function EditableFieldIterator(props) {
83480
83483
  changedFieldValueMap: changedFieldValueMap,
83481
83484
  componentMap: componentMap,
83482
83485
  onChange: onChange,
83483
- isVisibleOverflow: true,
83484
83486
  className: styles$1r['vitro-field-iterator']
83485
83487
  })));
83486
83488
  };
@@ -84882,7 +84884,7 @@ var DxfViewer = function DxfViewer(props) {
84882
84884
  });
84883
84885
  };
84884
84886
 
84885
- var styles$1O = {"vitro-select":"_select_vitro-select_EObExkL","vitro-active":"_select_vitro-active_3I2oZ9Y","vitro-label":"_select_vitro-label_1sD79dR","vitro-list-container":"_select_vitro-list-container_1iaPtG5","vitro-item":"_select_vitro-item_3Q88bWt"};
84887
+ var styles$1O = {"vitro-select":"_select_vitro-select_EObExkL","vitro-active":"_select_vitro-active_3I2oZ9Y","vitro-label":"_select_vitro-label_1sD79dR","vitro-list-container":"_select_vitro-list-container_1iaPtG5","vitro-item":"_select_vitro-item_3Q88bWt","vitro-scrollbar":"_select_vitro-scrollbar_1T9-kjS"};
84886
84888
 
84887
84889
  var Select = function Select(props) {
84888
84890
  var _useState = React.useState(null),
@@ -84948,11 +84950,13 @@ var Select = function Select(props) {
84948
84950
  }), React__default.createElement(itemTemplate, value), React__default.createElement("div", {
84949
84951
  className: styles$1O['vitro-list-container'],
84950
84952
  ref: listRef
84953
+ }, React__default.createElement(ScrollBar, {
84954
+ className: styles$1O['vitro-scrollbar']
84951
84955
  }, React__default.createElement(List$1, {
84952
84956
  itemList: props.itemList,
84953
84957
  onClick: onClick,
84954
84958
  itemTemplate: itemTemplate
84955
- })));
84959
+ }))));
84956
84960
  };
84957
84961
 
84958
84962
  var styles$1P = {"vitro-switch":"_switch_vitro-switch_1noCcra","vitro-slider":"_switch_vitro-slider_3wesxda","vitro-active":"_switch_vitro-active_3LJI9TW"};