@patternfly/react-table 4.110.22 → 4.111.1

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.
@@ -11073,8 +11073,8 @@
11073
11073
  const cell = (React__namespace.createElement(MergedComponent, Object.assign({ "data-label": dataLabel, onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp, scope: component === 'th' && children ? scope : null, ref: innerRef, className: css(className, textCenter && styles$1.modifiers.center, isSubheader && styles$1.tableSubhead, isStickyColumn && styles.tableStickyColumn, hasRightBorder && styles.modifiers.borderRight, modifier && styles$1.modifiers[modifier], mergedClassName) }, mergedProps, props, (isStickyColumn && {
11074
11074
  style: Object.assign({ '--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined, '--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined }, props.style)
11075
11075
  })), transformedChildren));
11076
- const canDefault = tooltip === '' ? typeof children === 'string' : true;
11077
- return tooltip !== null && canDefault && showTooltip ? (React__namespace.createElement(Tooltip, { content: tooltip || (tooltip === '' && children), isVisible: true }, cell)) : (cell);
11076
+ const canMakeDefaultTooltip = tooltip === '' ? typeof children === 'string' : true;
11077
+ return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (React__namespace.createElement(Tooltip, { content: tooltip || (tooltip === '' && children), isVisible: true }, cell)) : (cell);
11078
11078
  };
11079
11079
  const Th = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(ThBase, Object.assign({}, props, { innerRef: ref }))));
11080
11080
  Th.displayName = 'Th';
@@ -11279,7 +11279,17 @@
11279
11279
  };
11280
11280
 
11281
11281
  const TdBase = (_a) => {
11282
- var { children, className, isActionCell = false, component = 'td', dataLabel, textCenter = false, modifier, select = null, actions = null, expand = null, treeRow: treeRowProp = null, compoundExpand: compoundExpandProp = null, noPadding, width, visibility, innerRef, favorites = null, draggableRow: draggableRowProp = null } = _a, props = __rest$2(_a, ["children", "className", "isActionCell", "component", "dataLabel", "textCenter", "modifier", "select", "actions", "expand", "treeRow", "compoundExpand", "noPadding", "width", "visibility", "innerRef", "favorites", "draggableRow"]);
11282
+ var { children, className, isActionCell = false, component = 'td', dataLabel, textCenter = false, modifier, select = null, actions = null, expand = null, treeRow: treeRowProp = null, compoundExpand: compoundExpandProp = null, noPadding, width, visibility, innerRef, favorites = null, draggableRow: draggableRowProp = null, tooltip = '', onMouseEnter: onMouseEnterProp = () => { } } = _a, props = __rest$2(_a, ["children", "className", "isActionCell", "component", "dataLabel", "textCenter", "modifier", "select", "actions", "expand", "treeRow", "compoundExpand", "noPadding", "width", "visibility", "innerRef", "favorites", "draggableRow", "tooltip", "onMouseEnter"]);
11283
+ const [showTooltip, setShowTooltip] = React__namespace.useState(false);
11284
+ const onMouseEnter = (event) => {
11285
+ if (event.target.offsetWidth < event.target.scrollWidth) {
11286
+ !showTooltip && setShowTooltip(true);
11287
+ }
11288
+ else {
11289
+ showTooltip && setShowTooltip(false);
11290
+ }
11291
+ onMouseEnterProp(event);
11292
+ };
11283
11293
  const selectParams = select
11284
11294
  ? selectable(children, {
11285
11295
  rowIndex: select.rowIndex,
@@ -11386,7 +11396,9 @@
11386
11396
  isVisible = null, children: mergedChildren = null, className: mergedClassName = '', component: MergedComponent = component } = merged, mergedProps = __rest$2(merged, ["isVisible", "children", "className", "component"]);
11387
11397
  const treeTableTitleCell = (className && className.includes('pf-c-table__tree-view-title-cell')) ||
11388
11398
  (mergedClassName && mergedClassName.includes('pf-c-table__tree-view-title-cell'));
11389
- return (React__namespace.createElement(MergedComponent, Object.assign({}, (!treeTableTitleCell && { 'data-label': dataLabel }), { className: css(className, isActionCell && styles$1.tableAction, textCenter && styles$1.modifiers.center, noPadding && styles$1.modifiers.noPadding, styles$1.modifiers[modifier], draggableParams && styles$1.tableDraggable, mergedClassName), ref: innerRef }, mergedProps, props), mergedChildren || children));
11399
+ const cell = (React__namespace.createElement(MergedComponent, Object.assign({}, (!treeTableTitleCell && { 'data-label': dataLabel }), { onMouseEnter: tooltip !== null ? onMouseEnter : onMouseEnterProp, className: css(className, isActionCell && styles$1.tableAction, textCenter && styles$1.modifiers.center, noPadding && styles$1.modifiers.noPadding, styles$1.modifiers[modifier], draggableParams && styles$1.tableDraggable, mergedClassName), ref: innerRef }, mergedProps, props), mergedChildren || children));
11400
+ const canMakeDefaultTooltip = tooltip === '' ? typeof children === 'string' : true;
11401
+ return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (React__namespace.createElement(Tooltip, { content: tooltip || (tooltip === '' && children), isVisible: true }, cell)) : (cell);
11390
11402
  };
11391
11403
  const Td = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TdBase, Object.assign({}, props, { innerRef: ref }))));
11392
11404
  Td.displayName = 'Td';