@patternfly/react-table 4.104.2 → 4.104.3
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 +11 -0
- package/dist/umd/react-table.css +6585 -6585
- package/dist/umd/react-table.js +680 -26
- package/dist/umd/react-table.min.css +7062 -7062
- package/dist/umd/react-table.min.js +6 -6
- package/package.json +6 -6
package/dist/umd/react-table.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PatternFlyTable = {}, global.React, global.
|
|
5
|
-
})(this, (function (exports, React,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PatternFlyTable = {}, global.React, global.ReactDOM));
|
|
5
|
+
})(this, (function (exports, React, ReactDOM) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -1641,6 +1641,18 @@
|
|
|
1641
1641
|
.slice(2);
|
|
1642
1642
|
return `${prefix}-${uid}`;
|
|
1643
1643
|
}
|
|
1644
|
+
/**
|
|
1645
|
+
* @param { any } this - "This" reference
|
|
1646
|
+
* @param { Function } func - Function to debounce
|
|
1647
|
+
* @param { number } wait - Debounce amount
|
|
1648
|
+
*/
|
|
1649
|
+
function debounce$1(func, wait) {
|
|
1650
|
+
let timeout;
|
|
1651
|
+
return (...args) => {
|
|
1652
|
+
clearTimeout(timeout);
|
|
1653
|
+
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1644
1656
|
/** Interpolates a parameterized templateString using values from a templateVars object.
|
|
1645
1657
|
* The templateVars object should have keys and values which match the templateString's parameters.
|
|
1646
1658
|
* Example:
|
|
@@ -1822,6 +1834,107 @@
|
|
|
1822
1834
|
* Copied from exenv
|
|
1823
1835
|
*/
|
|
1824
1836
|
const canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
1837
|
+
/**
|
|
1838
|
+
* Calculate the width of the text
|
|
1839
|
+
* Example:
|
|
1840
|
+
* getTextWidth('my text', node)
|
|
1841
|
+
*
|
|
1842
|
+
* @param {string} text The text to calculate the width for
|
|
1843
|
+
* @param {HTMLElement} node The HTML element
|
|
1844
|
+
*/
|
|
1845
|
+
const getTextWidth = (text, node) => {
|
|
1846
|
+
const computedStyle = getComputedStyle(node);
|
|
1847
|
+
// Firefox returns the empty string for .font, so this function creates the .font property manually
|
|
1848
|
+
const getFontFromComputedStyle = () => {
|
|
1849
|
+
let computedFont = '';
|
|
1850
|
+
// Firefox uses percentages for font-stretch, but Canvas does not accept percentages
|
|
1851
|
+
// so convert to keywords, as listed at:
|
|
1852
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-stretch
|
|
1853
|
+
const fontStretchLookupTable = {
|
|
1854
|
+
'50%': 'ultra-condensed',
|
|
1855
|
+
'62.5%': 'extra-condensed',
|
|
1856
|
+
'75%': 'condensed',
|
|
1857
|
+
'87.5%': 'semi-condensed',
|
|
1858
|
+
'100%': 'normal',
|
|
1859
|
+
'112.5%': 'semi-expanded',
|
|
1860
|
+
'125%': 'expanded',
|
|
1861
|
+
'150%': 'extra-expanded',
|
|
1862
|
+
'200%': 'ultra-expanded'
|
|
1863
|
+
};
|
|
1864
|
+
// If the retrieved font-stretch percentage isn't found in the lookup table, use
|
|
1865
|
+
// 'normal' as a last resort.
|
|
1866
|
+
let fontStretch;
|
|
1867
|
+
if (computedStyle.fontStretch in fontStretchLookupTable) {
|
|
1868
|
+
fontStretch = fontStretchLookupTable[computedStyle.fontStretch];
|
|
1869
|
+
}
|
|
1870
|
+
else {
|
|
1871
|
+
fontStretch = 'normal';
|
|
1872
|
+
}
|
|
1873
|
+
computedFont =
|
|
1874
|
+
computedStyle.fontStyle +
|
|
1875
|
+
' ' +
|
|
1876
|
+
computedStyle.fontVariant +
|
|
1877
|
+
' ' +
|
|
1878
|
+
computedStyle.fontWeight +
|
|
1879
|
+
' ' +
|
|
1880
|
+
fontStretch +
|
|
1881
|
+
' ' +
|
|
1882
|
+
computedStyle.fontSize +
|
|
1883
|
+
'/' +
|
|
1884
|
+
computedStyle.lineHeight +
|
|
1885
|
+
' ' +
|
|
1886
|
+
computedStyle.fontFamily;
|
|
1887
|
+
return computedFont;
|
|
1888
|
+
};
|
|
1889
|
+
const canvas = document.createElement('canvas');
|
|
1890
|
+
const context = canvas.getContext('2d');
|
|
1891
|
+
context.font = computedStyle.font || getFontFromComputedStyle();
|
|
1892
|
+
return context.measureText(text).width;
|
|
1893
|
+
};
|
|
1894
|
+
/**
|
|
1895
|
+
* Get the inner dimensions of an element
|
|
1896
|
+
*
|
|
1897
|
+
* @param {HTMLElement} node HTML element to calculate the inner dimensions for
|
|
1898
|
+
*/
|
|
1899
|
+
const innerDimensions = (node) => {
|
|
1900
|
+
const computedStyle = getComputedStyle(node);
|
|
1901
|
+
let width = node.clientWidth; // width with padding
|
|
1902
|
+
let height = node.clientHeight; // height with padding
|
|
1903
|
+
height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
|
|
1904
|
+
width -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
|
|
1905
|
+
return { height, width };
|
|
1906
|
+
};
|
|
1907
|
+
/**
|
|
1908
|
+
* This function is a helper for truncating text content on the left, leaving the right side of the content in view
|
|
1909
|
+
*
|
|
1910
|
+
* @param {HTMLElement} node HTML element
|
|
1911
|
+
* @param {string} value The original text value
|
|
1912
|
+
*/
|
|
1913
|
+
const trimLeft = (node, value) => {
|
|
1914
|
+
const availableWidth = innerDimensions(node).width;
|
|
1915
|
+
let newValue = value;
|
|
1916
|
+
if (getTextWidth(value, node) > availableWidth) {
|
|
1917
|
+
// we have text overflow, trim the text to the left and add ... in the front until it fits
|
|
1918
|
+
while (getTextWidth(`...${newValue}`, node) > availableWidth) {
|
|
1919
|
+
newValue = newValue.substring(1);
|
|
1920
|
+
}
|
|
1921
|
+
// replace text with our truncated text
|
|
1922
|
+
if (node.value) {
|
|
1923
|
+
node.value = `...${newValue}`;
|
|
1924
|
+
}
|
|
1925
|
+
else {
|
|
1926
|
+
node.innerText = `...${newValue}`;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
else {
|
|
1930
|
+
if (node.value) {
|
|
1931
|
+
node.value = value;
|
|
1932
|
+
}
|
|
1933
|
+
else {
|
|
1934
|
+
node.innerText = value;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1825
1938
|
/**
|
|
1826
1939
|
* @param {string[]} events - Operations to prevent when disabled
|
|
1827
1940
|
*/
|
|
@@ -3846,6 +3959,94 @@
|
|
|
3846
3959
|
noSpaceHandling: false
|
|
3847
3960
|
};
|
|
3848
3961
|
|
|
3962
|
+
/**
|
|
3963
|
+
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
3964
|
+
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
3965
|
+
*
|
|
3966
|
+
* Example 1:
|
|
3967
|
+
*
|
|
3968
|
+
* private containerRef = React.createRef<HTMLDivElement>();
|
|
3969
|
+
* private observer: any = () => {};
|
|
3970
|
+
*
|
|
3971
|
+
* public componentDidMount() {
|
|
3972
|
+
* this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
|
|
3973
|
+
* }
|
|
3974
|
+
*
|
|
3975
|
+
* public componentWillUnmount() {
|
|
3976
|
+
* this.observer();
|
|
3977
|
+
* }
|
|
3978
|
+
*
|
|
3979
|
+
* private handleResize = () => {
|
|
3980
|
+
* if (this.containerRef.current && this.containerRef.current.clientWidth) {
|
|
3981
|
+
* this.setState({ width: this.containerRef.current.clientWidth });
|
|
3982
|
+
* }
|
|
3983
|
+
* };
|
|
3984
|
+
*
|
|
3985
|
+
* public render() {
|
|
3986
|
+
* return (
|
|
3987
|
+
* <div ref={this.containerRef} >
|
|
3988
|
+
* <Chart width={this.state.width} ... />
|
|
3989
|
+
* </div>
|
|
3990
|
+
* );
|
|
3991
|
+
* }
|
|
3992
|
+
*
|
|
3993
|
+
* Example 2:
|
|
3994
|
+
*
|
|
3995
|
+
* private inputRef = React.createRef<HTMLInputElement>();
|
|
3996
|
+
* private observer: any = () => {};
|
|
3997
|
+
*
|
|
3998
|
+
* public componentDidMount() {
|
|
3999
|
+
* this.observer = getResizeObserver(this.inputRef.current, this.handleResize);
|
|
4000
|
+
* }
|
|
4001
|
+
*
|
|
4002
|
+
* public componentWillUnmount() {
|
|
4003
|
+
* this.observer();
|
|
4004
|
+
* }
|
|
4005
|
+
*
|
|
4006
|
+
* private handleResize = () => {
|
|
4007
|
+
* if (this.inputRef.current) {
|
|
4008
|
+
* trimLeft(inputRef.current, String(this.props.value));
|
|
4009
|
+
* }
|
|
4010
|
+
* };
|
|
4011
|
+
*
|
|
4012
|
+
* public render() {
|
|
4013
|
+
* return (
|
|
4014
|
+
* <input ref={this.inputRef} ... />
|
|
4015
|
+
* );
|
|
4016
|
+
* }
|
|
4017
|
+
*
|
|
4018
|
+
* @param {Element} containerRefElement The container reference to observe
|
|
4019
|
+
* @param {Function} handleResize The function to call for resize events
|
|
4020
|
+
* @return {Function} The function used to unobserve resize events
|
|
4021
|
+
*/
|
|
4022
|
+
const getResizeObserver = (containerRefElement, handleResize) => {
|
|
4023
|
+
let unobserve;
|
|
4024
|
+
if (canUseDOM) {
|
|
4025
|
+
const { ResizeObserver } = window;
|
|
4026
|
+
if (containerRefElement && ResizeObserver) {
|
|
4027
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
4028
|
+
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
4029
|
+
window.requestAnimationFrame(() => {
|
|
4030
|
+
if (Array.isArray(entries) && entries.length > 0) {
|
|
4031
|
+
handleResize();
|
|
4032
|
+
}
|
|
4033
|
+
});
|
|
4034
|
+
});
|
|
4035
|
+
resizeObserver.observe(containerRefElement);
|
|
4036
|
+
unobserve = () => resizeObserver.unobserve(containerRefElement);
|
|
4037
|
+
}
|
|
4038
|
+
else {
|
|
4039
|
+
window.addEventListener('resize', handleResize);
|
|
4040
|
+
unobserve = () => window.removeEventListener('resize', handleResize);
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
return () => {
|
|
4044
|
+
if (unobserve) {
|
|
4045
|
+
unobserve();
|
|
4046
|
+
}
|
|
4047
|
+
};
|
|
4048
|
+
};
|
|
4049
|
+
|
|
3849
4050
|
Promise.resolve().then(function () { return bullseye; });
|
|
3850
4051
|
var styles$c = {
|
|
3851
4052
|
"bullseye": "pf-l-bullseye"
|
|
@@ -4422,6 +4623,233 @@
|
|
|
4422
4623
|
sendRef: null
|
|
4423
4624
|
});
|
|
4424
4625
|
|
|
4626
|
+
class DropdownMenu extends React__namespace.Component {
|
|
4627
|
+
constructor() {
|
|
4628
|
+
super(...arguments);
|
|
4629
|
+
this.refsCollection = [];
|
|
4630
|
+
this.componentWillUnmount = () => {
|
|
4631
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
4632
|
+
};
|
|
4633
|
+
this.onKeyDown = (event) => {
|
|
4634
|
+
if (!this.props.isOpen ||
|
|
4635
|
+
!Array.from(document.activeElement.classList).find(className => DropdownMenu.validToggleClasses.concat(this.context.toggleClass).includes(className))) {
|
|
4636
|
+
return;
|
|
4637
|
+
}
|
|
4638
|
+
const refs = this.refsCollection;
|
|
4639
|
+
if (event.key === 'ArrowDown') {
|
|
4640
|
+
const firstFocusTargetCollection = refs.find(ref => ref && ref[0] && !ref[0].hasAttribute('disabled'));
|
|
4641
|
+
DropdownMenu.focusFirstRef(firstFocusTargetCollection);
|
|
4642
|
+
event.stopPropagation();
|
|
4643
|
+
}
|
|
4644
|
+
else if (event.key === 'ArrowUp') {
|
|
4645
|
+
const collectionLength = refs.length;
|
|
4646
|
+
const lastFocusTargetCollection = refs.slice(collectionLength - 1, collectionLength);
|
|
4647
|
+
const lastFocusTarget = lastFocusTargetCollection && lastFocusTargetCollection[0];
|
|
4648
|
+
DropdownMenu.focusFirstRef(lastFocusTarget);
|
|
4649
|
+
event.stopPropagation();
|
|
4650
|
+
}
|
|
4651
|
+
};
|
|
4652
|
+
this.childKeyHandler = (index, innerIndex, position, custom = false) => {
|
|
4653
|
+
keyHandler(index, innerIndex, position, this.refsCollection, this.props.isGrouped ? this.refsCollection : React__namespace.Children.toArray(this.props.children), custom);
|
|
4654
|
+
};
|
|
4655
|
+
this.sendRef = (index, nodes, isDisabled, isSeparator) => {
|
|
4656
|
+
this.refsCollection[index] = [];
|
|
4657
|
+
nodes.map((node, innerIndex) => {
|
|
4658
|
+
if (!node) {
|
|
4659
|
+
this.refsCollection[index][innerIndex] = null;
|
|
4660
|
+
}
|
|
4661
|
+
else if (!node.getAttribute) {
|
|
4662
|
+
// eslint-disable-next-line react/no-find-dom-node
|
|
4663
|
+
this.refsCollection[index][innerIndex] = ReactDOM__namespace.findDOMNode(node);
|
|
4664
|
+
}
|
|
4665
|
+
else if (isSeparator) {
|
|
4666
|
+
this.refsCollection[index][innerIndex] = null;
|
|
4667
|
+
}
|
|
4668
|
+
else {
|
|
4669
|
+
this.refsCollection[index][innerIndex] = node;
|
|
4670
|
+
}
|
|
4671
|
+
});
|
|
4672
|
+
};
|
|
4673
|
+
}
|
|
4674
|
+
componentDidMount() {
|
|
4675
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
4676
|
+
const { autoFocus } = this.props;
|
|
4677
|
+
if (autoFocus) {
|
|
4678
|
+
// Focus first non-disabled element
|
|
4679
|
+
const focusTargetCollection = this.refsCollection.find(ref => ref && ref[0] && !ref[0].hasAttribute('disabled'));
|
|
4680
|
+
const focusTarget = focusTargetCollection && focusTargetCollection[0];
|
|
4681
|
+
if (focusTarget && focusTarget.focus) {
|
|
4682
|
+
setTimeout(() => focusTarget.focus());
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
shouldComponentUpdate() {
|
|
4687
|
+
// reset refsCollection before updating to account for child removal between mounts
|
|
4688
|
+
this.refsCollection = [];
|
|
4689
|
+
return true;
|
|
4690
|
+
}
|
|
4691
|
+
extendChildren() {
|
|
4692
|
+
const { children, isGrouped } = this.props;
|
|
4693
|
+
if (isGrouped) {
|
|
4694
|
+
let index = 0;
|
|
4695
|
+
return React__namespace.Children.map(children, groupedChildren => {
|
|
4696
|
+
const group = groupedChildren;
|
|
4697
|
+
const props = {};
|
|
4698
|
+
if (group.props && group.props.children) {
|
|
4699
|
+
if (Array.isArray(group.props.children)) {
|
|
4700
|
+
props.children = React__namespace.Children.map(group.props.children, option => React__namespace.cloneElement(option, {
|
|
4701
|
+
index: index++
|
|
4702
|
+
}));
|
|
4703
|
+
}
|
|
4704
|
+
else {
|
|
4705
|
+
props.children = React__namespace.cloneElement(group.props.children, {
|
|
4706
|
+
index: index++
|
|
4707
|
+
});
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
return React__namespace.cloneElement(group, props);
|
|
4711
|
+
});
|
|
4712
|
+
}
|
|
4713
|
+
return React__namespace.Children.map(children, (child, index) => React__namespace.cloneElement(child, {
|
|
4714
|
+
index
|
|
4715
|
+
}));
|
|
4716
|
+
}
|
|
4717
|
+
render() {
|
|
4718
|
+
const _a = this.props, { className, isOpen, position, children, component, isGrouped, setMenuComponentRef,
|
|
4719
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4720
|
+
openedOnEnter, alignments } = _a, props = __rest$1(_a, ["className", "isOpen", "position", "children", "component", "isGrouped", "setMenuComponentRef", "openedOnEnter", "alignments"]);
|
|
4721
|
+
return (React__namespace.createElement(DropdownArrowContext.Provider, { value: {
|
|
4722
|
+
keyHandler: this.childKeyHandler,
|
|
4723
|
+
sendRef: this.sendRef
|
|
4724
|
+
} }, component === 'div' ? (React__namespace.createElement(DropdownContext.Consumer, null, ({ onSelect, menuClass }) => (React__namespace.createElement("div", { className: css(menuClass, position === DropdownPosition.right && styles$8.modifiers.alignRight, formatBreakpointMods(alignments, styles$8, 'align-'), className), hidden: !isOpen, onClick: event => onSelect && onSelect(event), ref: setMenuComponentRef }, children)))) : ((isGrouped && (React__namespace.createElement(DropdownContext.Consumer, null, ({ menuClass, menuComponent }) => {
|
|
4725
|
+
const MenuComponent = (menuComponent || 'div');
|
|
4726
|
+
return (React__namespace.createElement(MenuComponent, Object.assign({}, props, { className: css(menuClass, position === DropdownPosition.right && styles$8.modifiers.alignRight, formatBreakpointMods(alignments, styles$8, 'align-'), className), hidden: !isOpen, role: "menu", ref: setMenuComponentRef }), this.extendChildren()));
|
|
4727
|
+
}))) || (React__namespace.createElement(DropdownContext.Consumer, null, ({ menuClass, menuComponent }) => {
|
|
4728
|
+
const MenuComponent = (menuComponent || component);
|
|
4729
|
+
return (React__namespace.createElement(MenuComponent, Object.assign({}, props, { className: css(menuClass, position === DropdownPosition.right && styles$8.modifiers.alignRight, formatBreakpointMods(alignments, styles$8, 'align-'), className), hidden: !isOpen, role: "menu", ref: setMenuComponentRef }), this.extendChildren()));
|
|
4730
|
+
})))));
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
DropdownMenu.displayName = 'DropdownMenu';
|
|
4734
|
+
DropdownMenu.defaultProps = {
|
|
4735
|
+
className: '',
|
|
4736
|
+
isOpen: true,
|
|
4737
|
+
openedOnEnter: false,
|
|
4738
|
+
autoFocus: true,
|
|
4739
|
+
position: DropdownPosition.left,
|
|
4740
|
+
component: 'ul',
|
|
4741
|
+
isGrouped: false,
|
|
4742
|
+
setMenuComponentRef: null
|
|
4743
|
+
};
|
|
4744
|
+
DropdownMenu.validToggleClasses = [styles$8.dropdownToggle, styles$8.dropdownToggleButton];
|
|
4745
|
+
DropdownMenu.focusFirstRef = (refCollection) => {
|
|
4746
|
+
if (refCollection && refCollection[0] && refCollection[0].focus) {
|
|
4747
|
+
setTimeout(() => refCollection[0].focus());
|
|
4748
|
+
}
|
|
4749
|
+
};
|
|
4750
|
+
DropdownMenu.contextType = DropdownContext;
|
|
4751
|
+
|
|
4752
|
+
class DropdownWithContext extends React__namespace.Component {
|
|
4753
|
+
constructor(props) {
|
|
4754
|
+
super(props);
|
|
4755
|
+
this.openedOnEnter = false;
|
|
4756
|
+
this.baseComponentRef = React__namespace.createRef();
|
|
4757
|
+
this.menuComponentRef = React__namespace.createRef();
|
|
4758
|
+
this.onEnter = () => {
|
|
4759
|
+
this.openedOnEnter = true;
|
|
4760
|
+
};
|
|
4761
|
+
this.setMenuComponentRef = (element) => {
|
|
4762
|
+
this.menuComponentRef = element;
|
|
4763
|
+
};
|
|
4764
|
+
this.getMenuComponentRef = () => this.menuComponentRef;
|
|
4765
|
+
if (props.dropdownItems && props.dropdownItems.length > 0 && props.children) {
|
|
4766
|
+
// eslint-disable-next-line no-console
|
|
4767
|
+
console.error('Children and dropdownItems props have been provided. Only the dropdownItems prop items will be rendered');
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
componentDidUpdate() {
|
|
4771
|
+
if (!this.props.isOpen) {
|
|
4772
|
+
this.openedOnEnter = false;
|
|
4773
|
+
}
|
|
4774
|
+
}
|
|
4775
|
+
render() {
|
|
4776
|
+
const _a = this.props, { children, className, direction, dropdownItems, isOpen, isPlain, isText, isGrouped, isFullHeight,
|
|
4777
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4778
|
+
onSelect, position, toggle, autoFocus, menuAppendTo, isFlipEnabled } = _a, props = __rest$1(_a, ["children", "className", "direction", "dropdownItems", "isOpen", "isPlain", "isText", "isGrouped", "isFullHeight", "onSelect", "position", "toggle", "autoFocus", "menuAppendTo", "isFlipEnabled"]);
|
|
4779
|
+
const id = toggle.props.id || `pf-dropdown-toggle-id-${DropdownWithContext.currentId++}`;
|
|
4780
|
+
let component;
|
|
4781
|
+
let renderedContent;
|
|
4782
|
+
let ariaHasPopup = false;
|
|
4783
|
+
if (dropdownItems && dropdownItems.length > 0) {
|
|
4784
|
+
component = 'ul';
|
|
4785
|
+
renderedContent = dropdownItems;
|
|
4786
|
+
ariaHasPopup = true;
|
|
4787
|
+
}
|
|
4788
|
+
else {
|
|
4789
|
+
component = 'div';
|
|
4790
|
+
renderedContent = React__namespace.Children.toArray(children);
|
|
4791
|
+
}
|
|
4792
|
+
const openedOnEnter = this.openedOnEnter;
|
|
4793
|
+
return (React__namespace.createElement(DropdownContext.Consumer, null, ({ baseClass, baseComponent, id: contextId, ouiaId, ouiaComponentType, ouiaSafe, alignments }) => {
|
|
4794
|
+
const BaseComponent = baseComponent;
|
|
4795
|
+
const menuContainer = (React__namespace.createElement(DropdownMenu
|
|
4796
|
+
// This removes the `position: absolute` styling from the `.pf-c-dropdown__menu`
|
|
4797
|
+
// allowing the menu to flip correctly
|
|
4798
|
+
, Object.assign({}, (isFlipEnabled && { style: { position: 'revert', minWidth: 'min-content' } }), { setMenuComponentRef: this.setMenuComponentRef, component: component, isOpen: isOpen, position: position, "aria-labelledby": contextId ? `${contextId}-toggle` : id, isGrouped: isGrouped, autoFocus: openedOnEnter && autoFocus, alignments: alignments }), renderedContent));
|
|
4799
|
+
const popperContainer = (React__namespace.createElement("div", { className: css(baseClass, direction === DropdownDirection.up && styles$8.modifiers.top, position === DropdownPosition.right && styles$8.modifiers.alignRight, isOpen && styles$8.modifiers.expanded, className) }, isOpen && menuContainer));
|
|
4800
|
+
const mainContainer = (React__namespace.createElement(BaseComponent, Object.assign({}, props, { className: css(baseClass, direction === DropdownDirection.up && styles$8.modifiers.top, position === DropdownPosition.right && styles$8.modifiers.alignRight, isOpen && styles$8.modifiers.expanded, isFullHeight && styles$8.modifiers.fullHeight, className), ref: this.baseComponentRef }, getOUIAProps(ouiaComponentType, ouiaId, ouiaSafe)),
|
|
4801
|
+
React__namespace.Children.map(toggle, oneToggle => React__namespace.cloneElement(oneToggle, {
|
|
4802
|
+
parentRef: this.baseComponentRef,
|
|
4803
|
+
getMenuRef: this.getMenuComponentRef,
|
|
4804
|
+
isOpen,
|
|
4805
|
+
id,
|
|
4806
|
+
isPlain,
|
|
4807
|
+
isText,
|
|
4808
|
+
'aria-haspopup': ariaHasPopup,
|
|
4809
|
+
onEnter: () => {
|
|
4810
|
+
this.onEnter();
|
|
4811
|
+
oneToggle.props.onEnter && oneToggle.props.onEnter();
|
|
4812
|
+
}
|
|
4813
|
+
})),
|
|
4814
|
+
menuAppendTo === 'inline' && isOpen && menuContainer));
|
|
4815
|
+
const getParentElement = () => {
|
|
4816
|
+
if (this.baseComponentRef && this.baseComponentRef.current) {
|
|
4817
|
+
return this.baseComponentRef.current.parentElement;
|
|
4818
|
+
}
|
|
4819
|
+
return null;
|
|
4820
|
+
};
|
|
4821
|
+
return menuAppendTo === 'inline' ? (mainContainer) : (React__namespace.createElement(Popper, { trigger: mainContainer, popper: popperContainer, direction: direction, position: position, appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, isVisible: isOpen }));
|
|
4822
|
+
}));
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4825
|
+
DropdownWithContext.displayName = 'DropdownWithContext';
|
|
4826
|
+
// seed for the aria-labelledby ID
|
|
4827
|
+
DropdownWithContext.currentId = 0;
|
|
4828
|
+
DropdownWithContext.defaultProps = {
|
|
4829
|
+
className: '',
|
|
4830
|
+
dropdownItems: [],
|
|
4831
|
+
isOpen: false,
|
|
4832
|
+
isPlain: false,
|
|
4833
|
+
isText: false,
|
|
4834
|
+
isGrouped: false,
|
|
4835
|
+
position: DropdownPosition.left,
|
|
4836
|
+
direction: DropdownDirection.down,
|
|
4837
|
+
onSelect: () => undefined,
|
|
4838
|
+
autoFocus: true,
|
|
4839
|
+
menuAppendTo: 'inline',
|
|
4840
|
+
isFlipEnabled: false
|
|
4841
|
+
};
|
|
4842
|
+
|
|
4843
|
+
const Dropdown = (_a) => {
|
|
4844
|
+
var { onSelect,
|
|
4845
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4846
|
+
ref, // Types of Ref are different for React.FunctionComponent vs React.Component
|
|
4847
|
+
ouiaId, ouiaSafe, alignments, contextProps, menuAppendTo = 'inline', isFlipEnabled = false } = _a, props = __rest$1(_a, ["onSelect", "ref", "ouiaId", "ouiaSafe", "alignments", "contextProps", "menuAppendTo", "isFlipEnabled"]);
|
|
4848
|
+
return (React__namespace.createElement(DropdownContext.Provider, { value: Object.assign({ onSelect: event => onSelect && onSelect(event), toggleTextClass: styles$8.dropdownToggleText, toggleIconClass: styles$8.dropdownToggleImage, toggleIndicatorClass: styles$8.dropdownToggleIcon, menuClass: styles$8.dropdownMenu, itemClass: styles$8.dropdownMenuItem, toggleClass: styles$8.dropdownToggle, baseClass: styles$8.dropdown, baseComponent: 'div', sectionClass: styles$8.dropdownGroup, sectionTitleClass: styles$8.dropdownGroupTitle, sectionComponent: 'section', disabledClass: styles$8.modifiers.disabled, plainTextClass: styles$8.modifiers.text, ouiaId: useOUIAId(Dropdown.displayName, ouiaId), ouiaSafe, ouiaComponentType: Dropdown.displayName, alignments }, contextProps) },
|
|
4849
|
+
React__namespace.createElement(DropdownWithContext, Object.assign({ menuAppendTo: menuAppendTo, isFlipEnabled: isFlipEnabled }, props))));
|
|
4850
|
+
};
|
|
4851
|
+
Dropdown.displayName = 'Dropdown';
|
|
4852
|
+
|
|
4425
4853
|
class InternalDropdownItem extends React__namespace.Component {
|
|
4426
4854
|
constructor() {
|
|
4427
4855
|
super(...arguments);
|
|
@@ -4559,6 +4987,16 @@
|
|
|
4559
4987
|
inoperableEvents: ['onClick', 'onKeyPress']
|
|
4560
4988
|
};
|
|
4561
4989
|
|
|
4990
|
+
const DropdownItem = (_a) => {
|
|
4991
|
+
var { children, className, component = 'a', isDisabled = false, isAriaDisabled = false, isPlainText = false, href, tooltip, tooltipProps = {}, listItemClassName, onClick,
|
|
4992
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4993
|
+
ref, // Types of Ref are different for React.FunctionComponent vs React.Component
|
|
4994
|
+
additionalChild, customChild, tabIndex = -1, icon = null, autoFocus, description = null, styleChildren, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["children", "className", "component", "isDisabled", "isAriaDisabled", "isPlainText", "href", "tooltip", "tooltipProps", "listItemClassName", "onClick", "ref", "additionalChild", "customChild", "tabIndex", "icon", "autoFocus", "description", "styleChildren", "ouiaId", "ouiaSafe"]);
|
|
4995
|
+
const ouiaProps = useOUIAProps(DropdownItem.displayName, ouiaId, ouiaSafe);
|
|
4996
|
+
return (React__namespace.createElement(DropdownArrowContext.Consumer, null, context => (React__namespace.createElement(InternalDropdownItem, Object.assign({ context: context, role: "menuitem", tabIndex: tabIndex, className: className, component: component, isDisabled: isDisabled, isAriaDisabled: isAriaDisabled, isPlainText: isPlainText, href: href, tooltip: tooltip, tooltipProps: tooltipProps, listItemClassName: listItemClassName, onClick: onClick, additionalChild: additionalChild, customChild: customChild, icon: icon, autoFocus: autoFocus, styleChildren: styleChildren, description: description }, ouiaProps, props), children))));
|
|
4997
|
+
};
|
|
4998
|
+
DropdownItem.displayName = 'DropdownItem';
|
|
4999
|
+
|
|
4562
5000
|
Promise.resolve().then(function () { return divider; });
|
|
4563
5001
|
var styles$7 = {
|
|
4564
5002
|
"divider": "pf-c-divider",
|
|
@@ -4672,6 +5110,92 @@
|
|
|
4672
5110
|
|
|
4673
5111
|
var CaretDownIcon$1 = CaretDownIcon;
|
|
4674
5112
|
|
|
5113
|
+
const buttonVariantStyles = {
|
|
5114
|
+
default: '',
|
|
5115
|
+
primary: styles$8.modifiers.primary,
|
|
5116
|
+
secondary: styles$8.modifiers.secondary
|
|
5117
|
+
};
|
|
5118
|
+
class Toggle extends React__namespace.Component {
|
|
5119
|
+
constructor() {
|
|
5120
|
+
super(...arguments);
|
|
5121
|
+
this.buttonRef = React__namespace.createRef();
|
|
5122
|
+
this.componentDidMount = () => {
|
|
5123
|
+
document.addEventListener('click', this.onDocClick);
|
|
5124
|
+
document.addEventListener('touchstart', this.onDocClick);
|
|
5125
|
+
document.addEventListener('keydown', this.onEscPress);
|
|
5126
|
+
};
|
|
5127
|
+
this.componentWillUnmount = () => {
|
|
5128
|
+
document.removeEventListener('click', this.onDocClick);
|
|
5129
|
+
document.removeEventListener('touchstart', this.onDocClick);
|
|
5130
|
+
document.removeEventListener('keydown', this.onEscPress);
|
|
5131
|
+
};
|
|
5132
|
+
this.onDocClick = (event) => {
|
|
5133
|
+
const { isOpen, parentRef, onToggle, getMenuRef } = this.props;
|
|
5134
|
+
const menuRef = getMenuRef && getMenuRef();
|
|
5135
|
+
const clickedOnToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
|
5136
|
+
const clickedWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
|
|
5137
|
+
if (isOpen && !(clickedOnToggle || clickedWithinMenu)) {
|
|
5138
|
+
onToggle(false, event);
|
|
5139
|
+
}
|
|
5140
|
+
};
|
|
5141
|
+
this.onEscPress = (event) => {
|
|
5142
|
+
const { parentRef, getMenuRef } = this.props;
|
|
5143
|
+
const keyCode = event.keyCode || event.which;
|
|
5144
|
+
const menuRef = getMenuRef && getMenuRef();
|
|
5145
|
+
const escFromToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
|
5146
|
+
const escFromWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
|
|
5147
|
+
if (this.props.isOpen &&
|
|
5148
|
+
(keyCode === KEY_CODES.ESCAPE_KEY || event.key === 'Tab') &&
|
|
5149
|
+
(escFromToggle || escFromWithinMenu)) {
|
|
5150
|
+
this.props.onToggle(false, event);
|
|
5151
|
+
this.buttonRef.current.focus();
|
|
5152
|
+
}
|
|
5153
|
+
};
|
|
5154
|
+
this.onKeyDown = (event) => {
|
|
5155
|
+
if (event.key === 'Tab' && !this.props.isOpen) {
|
|
5156
|
+
return;
|
|
5157
|
+
}
|
|
5158
|
+
if ((event.key === 'Tab' || event.key === 'Enter' || event.key === ' ') && this.props.isOpen) {
|
|
5159
|
+
if (!this.props.bubbleEvent) {
|
|
5160
|
+
event.stopPropagation();
|
|
5161
|
+
}
|
|
5162
|
+
event.preventDefault();
|
|
5163
|
+
this.props.onToggle(!this.props.isOpen, event);
|
|
5164
|
+
}
|
|
5165
|
+
else if ((event.key === 'Enter' || event.key === ' ') && !this.props.isOpen) {
|
|
5166
|
+
if (!this.props.bubbleEvent) {
|
|
5167
|
+
event.stopPropagation();
|
|
5168
|
+
}
|
|
5169
|
+
event.preventDefault();
|
|
5170
|
+
this.props.onToggle(!this.props.isOpen, event);
|
|
5171
|
+
this.props.onEnter();
|
|
5172
|
+
}
|
|
5173
|
+
};
|
|
5174
|
+
}
|
|
5175
|
+
render() {
|
|
5176
|
+
const _a = this.props, { className, children, isOpen, isDisabled, isPlain, isText, isPrimary, isSplitButton, toggleVariant, onToggle, 'aria-haspopup': ariaHasPopup,
|
|
5177
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5178
|
+
isActive, bubbleEvent, onEnter, parentRef, getMenuRef,
|
|
5179
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
5180
|
+
id, type } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isDisabled", "isPlain", "isText", "isPrimary", "isSplitButton", "toggleVariant", "onToggle", 'aria-haspopup', "isActive", "bubbleEvent", "onEnter", "parentRef", "getMenuRef", "id", "type"]);
|
|
5181
|
+
return (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleClass }) => (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.buttonRef, className: css(isSplitButton ? styles$8.dropdownToggleButton : toggleClass || styles$8.dropdownToggle, isActive && styles$8.modifiers.active, isPlain && styles$8.modifiers.plain, isText && styles$8.modifiers.text, isPrimary && styles$8.modifiers.primary, buttonVariantStyles[toggleVariant], className), type: type || 'button', onClick: event => onToggle(!isOpen, event), "aria-expanded": isOpen, "aria-haspopup": ariaHasPopup, onKeyDown: event => this.onKeyDown(event), disabled: isDisabled }), children))));
|
|
5182
|
+
}
|
|
5183
|
+
}
|
|
5184
|
+
Toggle.displayName = 'Toggle';
|
|
5185
|
+
Toggle.defaultProps = {
|
|
5186
|
+
className: '',
|
|
5187
|
+
isOpen: false,
|
|
5188
|
+
isActive: false,
|
|
5189
|
+
isDisabled: false,
|
|
5190
|
+
isPlain: false,
|
|
5191
|
+
isText: false,
|
|
5192
|
+
isPrimary: false,
|
|
5193
|
+
isSplitButton: false,
|
|
5194
|
+
onToggle: () => { },
|
|
5195
|
+
onEnter: () => { },
|
|
5196
|
+
bubbleEvent: false
|
|
5197
|
+
};
|
|
5198
|
+
|
|
4675
5199
|
Promise.resolve().then(function () { return badge; });
|
|
4676
5200
|
var badgeStyles = {
|
|
4677
5201
|
"badge": "pf-c-badge",
|
|
@@ -4682,6 +5206,31 @@
|
|
|
4682
5206
|
"themeDark": "pf-theme-dark"
|
|
4683
5207
|
};
|
|
4684
5208
|
|
|
5209
|
+
const EllipsisVIconConfig = {
|
|
5210
|
+
name: 'EllipsisVIcon',
|
|
5211
|
+
height: 512,
|
|
5212
|
+
width: 192,
|
|
5213
|
+
svgPath: 'M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z',
|
|
5214
|
+
yOffset: 0,
|
|
5215
|
+
xOffset: 0,
|
|
5216
|
+
};
|
|
5217
|
+
|
|
5218
|
+
const EllipsisVIcon = createIcon(EllipsisVIconConfig);
|
|
5219
|
+
|
|
5220
|
+
var EllipsisVIcon$1 = EllipsisVIcon;
|
|
5221
|
+
|
|
5222
|
+
const KebabToggle = (_a) => {
|
|
5223
|
+
var { id = '',
|
|
5224
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5225
|
+
children = null, className = '', isOpen = false, 'aria-label': ariaLabel = 'Actions', parentRef = null, getMenuRef = null, isActive = false, isPlain = false, isDisabled = false, bubbleEvent = false, onToggle = () => undefined,
|
|
5226
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5227
|
+
ref } = _a, // Types of Ref are different for React.FunctionComponent vs React.Component
|
|
5228
|
+
props = __rest$1(_a, ["id", "children", "className", "isOpen", 'aria-label', "parentRef", "getMenuRef", "isActive", "isPlain", "isDisabled", "bubbleEvent", "onToggle", "ref"]);
|
|
5229
|
+
return (React__namespace.createElement(Toggle, Object.assign({ id: id, className: className, isOpen: isOpen, "aria-label": ariaLabel, parentRef: parentRef, getMenuRef: getMenuRef, isActive: isActive, isPlain: isPlain, isDisabled: isDisabled, onToggle: onToggle, bubbleEvent: bubbleEvent }, props),
|
|
5230
|
+
React__namespace.createElement(EllipsisVIcon$1, null)));
|
|
5231
|
+
};
|
|
5232
|
+
KebabToggle.displayName = 'KebabToggle';
|
|
5233
|
+
|
|
4685
5234
|
const ApplicationLauncherSeparator = (_a) => {
|
|
4686
5235
|
var props = __rest$1(_a, ["children"]);
|
|
4687
5236
|
return React__namespace.createElement(DropdownSeparator, Object.assign({}, props));
|
|
@@ -4762,6 +5311,111 @@
|
|
|
4762
5311
|
}));
|
|
4763
5312
|
};
|
|
4764
5313
|
|
|
5314
|
+
var TextInputTypes;
|
|
5315
|
+
(function (TextInputTypes) {
|
|
5316
|
+
TextInputTypes["text"] = "text";
|
|
5317
|
+
TextInputTypes["date"] = "date";
|
|
5318
|
+
TextInputTypes["datetimeLocal"] = "datetime-local";
|
|
5319
|
+
TextInputTypes["email"] = "email";
|
|
5320
|
+
TextInputTypes["month"] = "month";
|
|
5321
|
+
TextInputTypes["number"] = "number";
|
|
5322
|
+
TextInputTypes["password"] = "password";
|
|
5323
|
+
TextInputTypes["search"] = "search";
|
|
5324
|
+
TextInputTypes["tel"] = "tel";
|
|
5325
|
+
TextInputTypes["time"] = "time";
|
|
5326
|
+
TextInputTypes["url"] = "url";
|
|
5327
|
+
})(TextInputTypes || (TextInputTypes = {}));
|
|
5328
|
+
class TextInputBase extends React__namespace.Component {
|
|
5329
|
+
constructor(props) {
|
|
5330
|
+
super(props);
|
|
5331
|
+
this.inputRef = React__namespace.createRef();
|
|
5332
|
+
this.observer = () => { };
|
|
5333
|
+
this.handleChange = (event) => {
|
|
5334
|
+
if (this.props.onChange) {
|
|
5335
|
+
this.props.onChange(event.currentTarget.value, event);
|
|
5336
|
+
}
|
|
5337
|
+
};
|
|
5338
|
+
this.handleResize = () => {
|
|
5339
|
+
const inputRef = this.props.innerRef || this.inputRef;
|
|
5340
|
+
if (inputRef && inputRef.current) {
|
|
5341
|
+
trimLeft(inputRef.current, String(this.props.value));
|
|
5342
|
+
}
|
|
5343
|
+
};
|
|
5344
|
+
this.restoreText = () => {
|
|
5345
|
+
const inputRef = this.props.innerRef || this.inputRef;
|
|
5346
|
+
// restore the value
|
|
5347
|
+
inputRef.current.value = String(this.props.value);
|
|
5348
|
+
// make sure we still see the rightmost value to preserve cursor click position
|
|
5349
|
+
inputRef.current.scrollLeft = inputRef.current.scrollWidth;
|
|
5350
|
+
};
|
|
5351
|
+
this.onFocus = (event) => {
|
|
5352
|
+
const { isLeftTruncated, onFocus } = this.props;
|
|
5353
|
+
if (isLeftTruncated) {
|
|
5354
|
+
this.restoreText();
|
|
5355
|
+
}
|
|
5356
|
+
onFocus && onFocus(event);
|
|
5357
|
+
};
|
|
5358
|
+
this.onBlur = (event) => {
|
|
5359
|
+
const { isLeftTruncated, onBlur } = this.props;
|
|
5360
|
+
if (isLeftTruncated) {
|
|
5361
|
+
this.handleResize();
|
|
5362
|
+
}
|
|
5363
|
+
onBlur && onBlur(event);
|
|
5364
|
+
};
|
|
5365
|
+
this.sanitizeInputValue = (value) => typeof value === 'string' ? value.replace(/\n/g, ' ') : value;
|
|
5366
|
+
if (!props.id && !props['aria-label'] && !props['aria-labelledby']) {
|
|
5367
|
+
// eslint-disable-next-line no-console
|
|
5368
|
+
console.error('Text input:', 'Text input requires either an id or aria-label to be specified');
|
|
5369
|
+
}
|
|
5370
|
+
this.state = {
|
|
5371
|
+
ouiaStateId: getDefaultOUIAId(TextInputBase.displayName)
|
|
5372
|
+
};
|
|
5373
|
+
}
|
|
5374
|
+
componentDidMount() {
|
|
5375
|
+
if (this.props.isLeftTruncated) {
|
|
5376
|
+
const inputRef = this.props.innerRef || this.inputRef;
|
|
5377
|
+
this.observer = getResizeObserver(inputRef.current, this.handleResize);
|
|
5378
|
+
this.handleResize();
|
|
5379
|
+
}
|
|
5380
|
+
}
|
|
5381
|
+
componentWillUnmount() {
|
|
5382
|
+
if (this.props.isLeftTruncated) {
|
|
5383
|
+
this.observer();
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5386
|
+
render() {
|
|
5387
|
+
const _a = this.props, { innerRef, className, type, value, validated,
|
|
5388
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5389
|
+
onChange, onFocus, onBlur, isLeftTruncated,
|
|
5390
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
5391
|
+
isReadOnly, isRequired, isDisabled, isIconSprite, iconVariant, customIconUrl, customIconDimensions, ouiaId, ouiaSafe } = _a, props = __rest$1(_a, ["innerRef", "className", "type", "value", "validated", "onChange", "onFocus", "onBlur", "isLeftTruncated", "isReadOnly", "isRequired", "isDisabled", "isIconSprite", "iconVariant", "customIconUrl", "customIconDimensions", "ouiaId", "ouiaSafe"]);
|
|
5392
|
+
const customIconStyle = {};
|
|
5393
|
+
if (customIconUrl) {
|
|
5394
|
+
customIconStyle.backgroundImage = `url('${customIconUrl}')`;
|
|
5395
|
+
}
|
|
5396
|
+
if (customIconDimensions) {
|
|
5397
|
+
customIconStyle.backgroundSize = customIconDimensions;
|
|
5398
|
+
}
|
|
5399
|
+
return (React__namespace.createElement("input", Object.assign({}, props, { onFocus: this.onFocus, onBlur: this.onBlur, className: css(formStyles$1.formControl, isIconSprite && formStyles$1.modifiers.iconSprite, validated === ValidatedOptions.success && formStyles$1.modifiers.success, validated === ValidatedOptions.warning && formStyles$1.modifiers.warning, ((iconVariant && iconVariant !== 'search') || customIconUrl) && formStyles$1.modifiers.icon, iconVariant && formStyles$1.modifiers[iconVariant], className), onChange: this.handleChange, type: type, value: this.sanitizeInputValue(value), "aria-invalid": props['aria-invalid'] ? props['aria-invalid'] : validated === ValidatedOptions.error, required: isRequired, disabled: isDisabled, readOnly: isReadOnly, ref: innerRef || this.inputRef }, ((customIconUrl || customIconDimensions) && { style: customIconStyle }), getOUIAProps(TextInput.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe))));
|
|
5400
|
+
}
|
|
5401
|
+
}
|
|
5402
|
+
TextInputBase.displayName = 'TextInputBase';
|
|
5403
|
+
TextInputBase.defaultProps = {
|
|
5404
|
+
'aria-label': null,
|
|
5405
|
+
className: '',
|
|
5406
|
+
isRequired: false,
|
|
5407
|
+
validated: 'default',
|
|
5408
|
+
isDisabled: false,
|
|
5409
|
+
isReadOnly: false,
|
|
5410
|
+
isIconSprite: false,
|
|
5411
|
+
type: TextInputTypes.text,
|
|
5412
|
+
isLeftTruncated: false,
|
|
5413
|
+
onChange: () => undefined,
|
|
5414
|
+
ouiaSafe: true
|
|
5415
|
+
};
|
|
5416
|
+
const TextInput = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TextInputBase, Object.assign({}, props, { innerRef: ref }))));
|
|
5417
|
+
TextInput.displayName = 'TextInput';
|
|
5418
|
+
|
|
4765
5419
|
Promise.resolve().then(function () { return select; });
|
|
4766
5420
|
var styles$6 = {
|
|
4767
5421
|
"check": "pf-c-check",
|
|
@@ -7423,7 +8077,7 @@
|
|
|
7423
8077
|
onMouseEnterProp(event);
|
|
7424
8078
|
};
|
|
7425
8079
|
const text = (React__namespace.createElement(Component, Object.assign({ onMouseEnter: onMouseEnter, className: css(className, wrapModifier && styles$1.modifiers[wrapModifier], styles$1.tableText) }, props), children));
|
|
7426
|
-
return tooltip !== '' ? (React__namespace.createElement(Tooltip
|
|
8080
|
+
return tooltip !== '' ? (React__namespace.createElement(Tooltip, Object.assign({ content: tooltip, isVisible: true }, tooltipProps), text)) : (text);
|
|
7427
8081
|
};
|
|
7428
8082
|
TableText.displayName = 'TableText';
|
|
7429
8083
|
|
|
@@ -7615,7 +8269,7 @@
|
|
|
7615
8269
|
const CollapseColumn = (_a) => {
|
|
7616
8270
|
var { className = '', children = null, isOpen, onToggle } = _a, props = __rest$2(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
7617
8271
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
7618
|
-
isOpen !== undefined && (React__namespace.createElement(Button
|
|
8272
|
+
isOpen !== undefined && (React__namespace.createElement(Button, Object.assign({ className: css(className, isOpen && styles$1.modifiers.expanded) }, props, { variant: "plain", "aria-label": props['aria-label'] || 'Details', onClick: onToggle, "aria-expanded": isOpen }),
|
|
7619
8273
|
React__namespace.createElement("div", { className: css(styles$1.tableToggleIcon) },
|
|
7620
8274
|
React__namespace.createElement(AngleDownIcon$1, null)))),
|
|
7621
8275
|
children));
|
|
@@ -10370,7 +11024,7 @@
|
|
|
10370
11024
|
style: Object.assign({ '--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined, '--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined }, props.style)
|
|
10371
11025
|
})), transformedChildren));
|
|
10372
11026
|
const canDefault = tooltip === '' ? typeof children === 'string' : true;
|
|
10373
|
-
return tooltip !== null && canDefault && showTooltip ? (React__namespace.createElement(Tooltip
|
|
11027
|
+
return tooltip !== null && canDefault && showTooltip ? (React__namespace.createElement(Tooltip, { content: tooltip || (tooltip === '' && children), isVisible: true }, cell)) : (cell);
|
|
10374
11028
|
};
|
|
10375
11029
|
const Th = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(ThBase, Object.assign({}, props, { innerRef: ref }))));
|
|
10376
11030
|
Th.displayName = 'Th';
|
|
@@ -10400,20 +11054,20 @@
|
|
|
10400
11054
|
render() {
|
|
10401
11055
|
const { isOpen } = this.state;
|
|
10402
11056
|
const { items, children, dropdownPosition, dropdownDirection, isDisabled, rowData, actionsToggle } = this.props;
|
|
10403
|
-
const actionsToggleClone = actionsToggle ? (actionsToggle({ onToggle: this.onToggle, isOpen, isDisabled })) : (React__namespace.createElement(KebabToggle
|
|
11057
|
+
const actionsToggleClone = actionsToggle ? (actionsToggle({ onToggle: this.onToggle, isOpen, isDisabled })) : (React__namespace.createElement(KebabToggle, { isDisabled: isDisabled, onToggle: this.onToggle }));
|
|
10404
11058
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
10405
11059
|
items
|
|
10406
11060
|
.filter(item => item.isOutsideDropdown)
|
|
10407
11061
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10408
11062
|
.map((_a, key) => {
|
|
10409
11063
|
var { title, itemKey, onClick, isOutsideDropdown } = _a, props = __rest$2(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
10410
|
-
return typeof title === 'string' ? (React__namespace.createElement(Button
|
|
11064
|
+
return typeof title === 'string' ? (React__namespace.createElement(Button, Object.assign({ onClick: event => this.onClick(event, onClick) }, props, { isDisabled: isDisabled, key: itemKey || `outside_dropdown_${key}`, "data-key": itemKey || `outside_dropdown_${key}` }), title)) : (React__namespace.cloneElement(title, Object.assign({ onClick, isDisabled }, props)));
|
|
10411
11065
|
}),
|
|
10412
|
-
React__namespace.createElement(Dropdown
|
|
11066
|
+
React__namespace.createElement(Dropdown, Object.assign({ toggle: actionsToggleClone, position: dropdownPosition, direction: dropdownDirection, isOpen: isOpen, dropdownItems: items
|
|
10413
11067
|
.filter(item => !item.isOutsideDropdown)
|
|
10414
11068
|
.map((_a, key) => {
|
|
10415
11069
|
var { title, itemKey, onClick, isSeparator } = _a, props = __rest$2(_a, ["title", "itemKey", "onClick", "isSeparator"]);
|
|
10416
|
-
return isSeparator ? (React__namespace.createElement(DropdownSeparator
|
|
11070
|
+
return isSeparator ? (React__namespace.createElement(DropdownSeparator, Object.assign({}, props, { key: itemKey || key, "data-key": itemKey || key }))) : (React__namespace.createElement(DropdownItem, Object.assign({ component: "button", onClick: event => {
|
|
10417
11071
|
this.onClick(event, onClick);
|
|
10418
11072
|
this.onToggle(!isOpen);
|
|
10419
11073
|
} }, props, { key: itemKey || key, "data-key": itemKey || key }), title));
|
|
@@ -10425,8 +11079,8 @@
|
|
|
10425
11079
|
ActionsColumn.defaultProps = {
|
|
10426
11080
|
children: null,
|
|
10427
11081
|
items: [],
|
|
10428
|
-
dropdownPosition:
|
|
10429
|
-
dropdownDirection:
|
|
11082
|
+
dropdownPosition: DropdownPosition.right,
|
|
11083
|
+
dropdownDirection: DropdownDirection.down,
|
|
10430
11084
|
rowData: {},
|
|
10431
11085
|
extraData: {}
|
|
10432
11086
|
};
|
|
@@ -10483,7 +11137,7 @@
|
|
|
10483
11137
|
id: `favorites-button-${rowIndex}`,
|
|
10484
11138
|
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
10485
11139
|
};
|
|
10486
|
-
return (React__namespace.createElement(Button
|
|
11140
|
+
return (React__namespace.createElement(Button, Object.assign({ variant: "plain", className: className, type: "button", "aria-label": isFavorited ? 'Starred' : 'Not starred', onClick: onFavorite }, ariaProps, props),
|
|
10487
11141
|
React__namespace.createElement(StarIcon$1, { "aria-hidden": true })));
|
|
10488
11142
|
};
|
|
10489
11143
|
FavoritesCell.displayName = 'FavoritesCell';
|
|
@@ -10520,7 +11174,7 @@
|
|
|
10520
11174
|
|
|
10521
11175
|
const DraggableCell = (_a) => {
|
|
10522
11176
|
var { className, onClick, 'aria-label': ariaLabel, id } = _a, props = __rest$2(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
10523
|
-
return (React__namespace.createElement(Button
|
|
11177
|
+
return (React__namespace.createElement(Button, Object.assign({ id: id, variant: "plain", className: className, type: "button", "aria-label": ariaLabel || `Draggable row draggable button`, onClick: onClick }, props),
|
|
10524
11178
|
React__namespace.createElement(GripVerticalIcon$1, { "aria-hidden": true })));
|
|
10525
11179
|
};
|
|
10526
11180
|
DraggableCell.displayName = 'DraggableCell';
|
|
@@ -11966,7 +12620,7 @@
|
|
|
11966
12620
|
children.type === EmptyState;
|
|
11967
12621
|
}
|
|
11968
12622
|
const cell = (React__namespace.createElement(Td, Object.assign({ className: className, component: component, dataLabel: dataLabel && parentId == null && !isEmptyStateCell ? dataLabel : null, onMouseEnter: onMouseEnter, textCenter: textCenter, colSpan: colSpan }, props), children));
|
|
11969
|
-
const bodyCell = tooltip !== '' ? (React__namespace.createElement(Tooltip
|
|
12623
|
+
const bodyCell = tooltip !== '' ? (React__namespace.createElement(Tooltip, { content: tooltip, isVisible: true }, cell)) : (cell);
|
|
11970
12624
|
return (parentId !== undefined && colSpan === undefined) || !isVisible ? null : bodyCell;
|
|
11971
12625
|
};
|
|
11972
12626
|
BodyCell.displayName = 'BodyCell';
|
|
@@ -11995,15 +12649,15 @@
|
|
|
11995
12649
|
}
|
|
11996
12650
|
};
|
|
11997
12651
|
if (props.onScroll) {
|
|
11998
|
-
this.handleScroll =
|
|
12652
|
+
this.handleScroll = debounce$1(this.handleScroll, 100);
|
|
11999
12653
|
}
|
|
12000
12654
|
if (props.onResize) {
|
|
12001
|
-
this.handleResize =
|
|
12655
|
+
this.handleResize = debounce$1(this.handleResize, 100);
|
|
12002
12656
|
}
|
|
12003
12657
|
}
|
|
12004
12658
|
componentDidMount() {
|
|
12005
12659
|
this._unmounted = false;
|
|
12006
|
-
if (
|
|
12660
|
+
if (canUseDOM) {
|
|
12007
12661
|
if (this.props.onScroll) {
|
|
12008
12662
|
window.addEventListener('scroll', this.handleScroll);
|
|
12009
12663
|
}
|
|
@@ -12014,7 +12668,7 @@
|
|
|
12014
12668
|
}
|
|
12015
12669
|
componentWillUnmount() {
|
|
12016
12670
|
this._unmounted = true;
|
|
12017
|
-
if (
|
|
12671
|
+
if (canUseDOM) {
|
|
12018
12672
|
if (this.props.onScroll) {
|
|
12019
12673
|
window.removeEventListener('scroll', this.handleScroll);
|
|
12020
12674
|
}
|
|
@@ -12078,13 +12732,13 @@
|
|
|
12078
12732
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
12079
12733
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditGroup, inlineStyles.modifiers.iconGroup, 'pf-m-action-group') },
|
|
12080
12734
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditAction) },
|
|
12081
|
-
React__namespace.createElement(Button
|
|
12735
|
+
React__namespace.createElement(Button, Object.assign({ "aria-label": saveAriaLabel }, props, { onClick: e => onClick(e, 'save'), variant: "plain" }),
|
|
12082
12736
|
React__namespace.createElement(CheckIcon$1, null))),
|
|
12083
12737
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditAction) },
|
|
12084
|
-
React__namespace.createElement(Button
|
|
12738
|
+
React__namespace.createElement(Button, Object.assign({ "aria-label": cancelAriaLabel }, props, { onClick: e => onClick(e, 'cancel'), variant: "plain" }),
|
|
12085
12739
|
React__namespace.createElement(TimesIcon$1, null)))),
|
|
12086
12740
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditAction, inlineStyles.modifiers.enableEditable) },
|
|
12087
|
-
React__namespace.createElement(Button
|
|
12741
|
+
React__namespace.createElement(Button, Object.assign({ "aria-label": editAriaLabel }, props, { onClick: e => onClick(e, 'edit'), variant: "plain" }),
|
|
12088
12742
|
React__namespace.createElement(PencilAltIcon$1, null)))));
|
|
12089
12743
|
};
|
|
12090
12744
|
EditColumn.displayName = 'EditColumn';
|
|
@@ -12544,8 +13198,8 @@
|
|
|
12544
13198
|
rowLabeledBy: 'simple-node',
|
|
12545
13199
|
expandId: 'expandable-toggle',
|
|
12546
13200
|
contentId: 'expanded-content',
|
|
12547
|
-
dropdownPosition:
|
|
12548
|
-
dropdownDirection:
|
|
13201
|
+
dropdownPosition: DropdownPosition.right,
|
|
13202
|
+
dropdownDirection: DropdownDirection.down,
|
|
12549
13203
|
header: undefined,
|
|
12550
13204
|
caption: undefined,
|
|
12551
13205
|
'aria-label': undefined,
|
|
@@ -12692,7 +13346,7 @@
|
|
|
12692
13346
|
const EditableTextCell = ({ value, rowIndex, cellIndex, props, handleTextInputChange, inputAriaLabel, isDisabled = false }) => (React__namespace.createElement(React__namespace.Fragment, null,
|
|
12693
13347
|
React__namespace.createElement("div", { className: inlineStyles.inlineEditValue }, value),
|
|
12694
13348
|
React__namespace.createElement("div", { className: inlineStyles.inlineEditInput },
|
|
12695
|
-
React__namespace.createElement(TextInput
|
|
13349
|
+
React__namespace.createElement(TextInput, { isDisabled: isDisabled, value: props.editableValue !== undefined ? props.editableValue : value, validated: props.isValid !== false ? 'default' : 'error', type: "text", onChange: (newValue, event) => {
|
|
12696
13350
|
handleTextInputChange(newValue, event, rowIndex, cellIndex);
|
|
12697
13351
|
}, "aria-label": inputAriaLabel }),
|
|
12698
13352
|
React__namespace.createElement("div", { className: css(formStyles.formHelperText, formStyles.modifiers.error), "aria-live": "polite" }, props.errorText))));
|