@patternfly/react-table 4.100.9 → 4.101.0
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 +6303 -6303
- package/dist/umd/react-table.js +26 -680
- package/dist/umd/react-table.min.css +6285 -6285
- 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('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';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants'), require('@patternfly/react-core/dist/esm/components/Tooltip/Tooltip'), require('@patternfly/react-core/dist/esm/components/Dropdown'), require('@patternfly/react-core/dist/esm/components/Dropdown/KebabToggle'), require('@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem'), require('@patternfly/react-core/dist/esm/components/Dropdown/DropdownSeparator'), require('@patternfly/react-core/dist/esm/components/Button/Button'), require('react-dom'), require('@patternfly/react-core/dist/esm/helpers/util'), require('@patternfly/react-core/dist/esm/components/Button'), require('@patternfly/react-core/dist/esm/components/TextInput')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants', '@patternfly/react-core/dist/esm/components/Tooltip/Tooltip', '@patternfly/react-core/dist/esm/components/Dropdown', '@patternfly/react-core/dist/esm/components/Dropdown/KebabToggle', '@patternfly/react-core/dist/esm/components/Dropdown/DropdownItem', '@patternfly/react-core/dist/esm/components/Dropdown/DropdownSeparator', '@patternfly/react-core/dist/esm/components/Button/Button', 'react-dom', '@patternfly/react-core/dist/esm/helpers/util', '@patternfly/react-core/dist/esm/components/Button', '@patternfly/react-core/dist/esm/components/TextInput'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PatternFlyTable = {}, global.React, global.dropdownConstants, global.Tooltip$1, global.Dropdown, global.KebabToggle, global.DropdownItem, global.DropdownSeparator$1, global.Button$1, global.ReactDOM, global.util, global.Button$2, global.TextInput));
|
|
5
|
+
})(this, (function (exports, React, dropdownConstants, Tooltip$1, Dropdown, KebabToggle, DropdownItem, DropdownSeparator$1, Button$1, ReactDOM, util, Button$2, TextInput) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -1641,18 +1641,6 @@
|
|
|
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
|
-
}
|
|
1656
1644
|
/** Interpolates a parameterized templateString using values from a templateVars object.
|
|
1657
1645
|
* The templateVars object should have keys and values which match the templateString's parameters.
|
|
1658
1646
|
* Example:
|
|
@@ -1834,107 +1822,6 @@
|
|
|
1834
1822
|
* Copied from exenv
|
|
1835
1823
|
*/
|
|
1836
1824
|
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
|
-
};
|
|
1938
1825
|
/**
|
|
1939
1826
|
* @param {string[]} events - Operations to prevent when disabled
|
|
1940
1827
|
*/
|
|
@@ -3959,94 +3846,6 @@
|
|
|
3959
3846
|
noSpaceHandling: false
|
|
3960
3847
|
};
|
|
3961
3848
|
|
|
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
|
-
|
|
4050
3849
|
Promise.resolve().then(function () { return bullseye; });
|
|
4051
3850
|
var styles$c = {
|
|
4052
3851
|
"bullseye": "pf-l-bullseye"
|
|
@@ -4619,233 +4418,6 @@
|
|
|
4619
4418
|
sendRef: null
|
|
4620
4419
|
});
|
|
4621
4420
|
|
|
4622
|
-
class DropdownMenu extends React__namespace.Component {
|
|
4623
|
-
constructor() {
|
|
4624
|
-
super(...arguments);
|
|
4625
|
-
this.refsCollection = [];
|
|
4626
|
-
this.componentWillUnmount = () => {
|
|
4627
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
4628
|
-
};
|
|
4629
|
-
this.onKeyDown = (event) => {
|
|
4630
|
-
if (!this.props.isOpen ||
|
|
4631
|
-
!Array.from(document.activeElement.classList).find(className => DropdownMenu.validToggleClasses.concat(this.context.toggleClass).includes(className))) {
|
|
4632
|
-
return;
|
|
4633
|
-
}
|
|
4634
|
-
const refs = this.refsCollection;
|
|
4635
|
-
if (event.key === 'ArrowDown') {
|
|
4636
|
-
const firstFocusTargetCollection = refs.find(ref => ref && ref[0] && !ref[0].hasAttribute('disabled'));
|
|
4637
|
-
DropdownMenu.focusFirstRef(firstFocusTargetCollection);
|
|
4638
|
-
event.stopPropagation();
|
|
4639
|
-
}
|
|
4640
|
-
else if (event.key === 'ArrowUp') {
|
|
4641
|
-
const collectionLength = refs.length;
|
|
4642
|
-
const lastFocusTargetCollection = refs.slice(collectionLength - 1, collectionLength);
|
|
4643
|
-
const lastFocusTarget = lastFocusTargetCollection && lastFocusTargetCollection[0];
|
|
4644
|
-
DropdownMenu.focusFirstRef(lastFocusTarget);
|
|
4645
|
-
event.stopPropagation();
|
|
4646
|
-
}
|
|
4647
|
-
};
|
|
4648
|
-
this.childKeyHandler = (index, innerIndex, position, custom = false) => {
|
|
4649
|
-
keyHandler(index, innerIndex, position, this.refsCollection, this.props.isGrouped ? this.refsCollection : React__namespace.Children.toArray(this.props.children), custom);
|
|
4650
|
-
};
|
|
4651
|
-
this.sendRef = (index, nodes, isDisabled, isSeparator) => {
|
|
4652
|
-
this.refsCollection[index] = [];
|
|
4653
|
-
nodes.map((node, innerIndex) => {
|
|
4654
|
-
if (!node) {
|
|
4655
|
-
this.refsCollection[index][innerIndex] = null;
|
|
4656
|
-
}
|
|
4657
|
-
else if (!node.getAttribute) {
|
|
4658
|
-
// eslint-disable-next-line react/no-find-dom-node
|
|
4659
|
-
this.refsCollection[index][innerIndex] = ReactDOM__namespace.findDOMNode(node);
|
|
4660
|
-
}
|
|
4661
|
-
else if (isSeparator) {
|
|
4662
|
-
this.refsCollection[index][innerIndex] = null;
|
|
4663
|
-
}
|
|
4664
|
-
else {
|
|
4665
|
-
this.refsCollection[index][innerIndex] = node;
|
|
4666
|
-
}
|
|
4667
|
-
});
|
|
4668
|
-
};
|
|
4669
|
-
}
|
|
4670
|
-
componentDidMount() {
|
|
4671
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
4672
|
-
const { autoFocus } = this.props;
|
|
4673
|
-
if (autoFocus) {
|
|
4674
|
-
// Focus first non-disabled element
|
|
4675
|
-
const focusTargetCollection = this.refsCollection.find(ref => ref && ref[0] && !ref[0].hasAttribute('disabled'));
|
|
4676
|
-
const focusTarget = focusTargetCollection && focusTargetCollection[0];
|
|
4677
|
-
if (focusTarget && focusTarget.focus) {
|
|
4678
|
-
setTimeout(() => focusTarget.focus());
|
|
4679
|
-
}
|
|
4680
|
-
}
|
|
4681
|
-
}
|
|
4682
|
-
shouldComponentUpdate() {
|
|
4683
|
-
// reset refsCollection before updating to account for child removal between mounts
|
|
4684
|
-
this.refsCollection = [];
|
|
4685
|
-
return true;
|
|
4686
|
-
}
|
|
4687
|
-
extendChildren() {
|
|
4688
|
-
const { children, isGrouped } = this.props;
|
|
4689
|
-
if (isGrouped) {
|
|
4690
|
-
let index = 0;
|
|
4691
|
-
return React__namespace.Children.map(children, groupedChildren => {
|
|
4692
|
-
const group = groupedChildren;
|
|
4693
|
-
const props = {};
|
|
4694
|
-
if (group.props && group.props.children) {
|
|
4695
|
-
if (Array.isArray(group.props.children)) {
|
|
4696
|
-
props.children = React__namespace.Children.map(group.props.children, option => React__namespace.cloneElement(option, {
|
|
4697
|
-
index: index++
|
|
4698
|
-
}));
|
|
4699
|
-
}
|
|
4700
|
-
else {
|
|
4701
|
-
props.children = React__namespace.cloneElement(group.props.children, {
|
|
4702
|
-
index: index++
|
|
4703
|
-
});
|
|
4704
|
-
}
|
|
4705
|
-
}
|
|
4706
|
-
return React__namespace.cloneElement(group, props);
|
|
4707
|
-
});
|
|
4708
|
-
}
|
|
4709
|
-
return React__namespace.Children.map(children, (child, index) => React__namespace.cloneElement(child, {
|
|
4710
|
-
index
|
|
4711
|
-
}));
|
|
4712
|
-
}
|
|
4713
|
-
render() {
|
|
4714
|
-
const _a = this.props, { className, isOpen, position, children, component, isGrouped, setMenuComponentRef,
|
|
4715
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4716
|
-
openedOnEnter, alignments } = _a, props = __rest$1(_a, ["className", "isOpen", "position", "children", "component", "isGrouped", "setMenuComponentRef", "openedOnEnter", "alignments"]);
|
|
4717
|
-
return (React__namespace.createElement(DropdownArrowContext.Provider, { value: {
|
|
4718
|
-
keyHandler: this.childKeyHandler,
|
|
4719
|
-
sendRef: this.sendRef
|
|
4720
|
-
} }, 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 }) => {
|
|
4721
|
-
const MenuComponent = (menuComponent || 'div');
|
|
4722
|
-
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()));
|
|
4723
|
-
}))) || (React__namespace.createElement(DropdownContext.Consumer, null, ({ menuClass, menuComponent }) => {
|
|
4724
|
-
const MenuComponent = (menuComponent || component);
|
|
4725
|
-
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()));
|
|
4726
|
-
})))));
|
|
4727
|
-
}
|
|
4728
|
-
}
|
|
4729
|
-
DropdownMenu.displayName = 'DropdownMenu';
|
|
4730
|
-
DropdownMenu.defaultProps = {
|
|
4731
|
-
className: '',
|
|
4732
|
-
isOpen: true,
|
|
4733
|
-
openedOnEnter: false,
|
|
4734
|
-
autoFocus: true,
|
|
4735
|
-
position: DropdownPosition.left,
|
|
4736
|
-
component: 'ul',
|
|
4737
|
-
isGrouped: false,
|
|
4738
|
-
setMenuComponentRef: null
|
|
4739
|
-
};
|
|
4740
|
-
DropdownMenu.validToggleClasses = [styles$8.dropdownToggle, styles$8.dropdownToggleButton];
|
|
4741
|
-
DropdownMenu.focusFirstRef = (refCollection) => {
|
|
4742
|
-
if (refCollection && refCollection[0] && refCollection[0].focus) {
|
|
4743
|
-
setTimeout(() => refCollection[0].focus());
|
|
4744
|
-
}
|
|
4745
|
-
};
|
|
4746
|
-
DropdownMenu.contextType = DropdownContext;
|
|
4747
|
-
|
|
4748
|
-
class DropdownWithContext extends React__namespace.Component {
|
|
4749
|
-
constructor(props) {
|
|
4750
|
-
super(props);
|
|
4751
|
-
this.openedOnEnter = false;
|
|
4752
|
-
this.baseComponentRef = React__namespace.createRef();
|
|
4753
|
-
this.menuComponentRef = React__namespace.createRef();
|
|
4754
|
-
this.onEnter = () => {
|
|
4755
|
-
this.openedOnEnter = true;
|
|
4756
|
-
};
|
|
4757
|
-
this.setMenuComponentRef = (element) => {
|
|
4758
|
-
this.menuComponentRef = element;
|
|
4759
|
-
};
|
|
4760
|
-
this.getMenuComponentRef = () => this.menuComponentRef;
|
|
4761
|
-
if (props.dropdownItems && props.dropdownItems.length > 0 && props.children) {
|
|
4762
|
-
// eslint-disable-next-line no-console
|
|
4763
|
-
console.error('Children and dropdownItems props have been provided. Only the dropdownItems prop items will be rendered');
|
|
4764
|
-
}
|
|
4765
|
-
}
|
|
4766
|
-
componentDidUpdate() {
|
|
4767
|
-
if (!this.props.isOpen) {
|
|
4768
|
-
this.openedOnEnter = false;
|
|
4769
|
-
}
|
|
4770
|
-
}
|
|
4771
|
-
render() {
|
|
4772
|
-
const _a = this.props, { children, className, direction, dropdownItems, isOpen, isPlain, isText, isGrouped, isFullHeight,
|
|
4773
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4774
|
-
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"]);
|
|
4775
|
-
const id = toggle.props.id || `pf-dropdown-toggle-id-${DropdownWithContext.currentId++}`;
|
|
4776
|
-
let component;
|
|
4777
|
-
let renderedContent;
|
|
4778
|
-
let ariaHasPopup = false;
|
|
4779
|
-
if (dropdownItems && dropdownItems.length > 0) {
|
|
4780
|
-
component = 'ul';
|
|
4781
|
-
renderedContent = dropdownItems;
|
|
4782
|
-
ariaHasPopup = true;
|
|
4783
|
-
}
|
|
4784
|
-
else {
|
|
4785
|
-
component = 'div';
|
|
4786
|
-
renderedContent = React__namespace.Children.toArray(children);
|
|
4787
|
-
}
|
|
4788
|
-
const openedOnEnter = this.openedOnEnter;
|
|
4789
|
-
return (React__namespace.createElement(DropdownContext.Consumer, null, ({ baseClass, baseComponent, id: contextId, ouiaId, ouiaComponentType, ouiaSafe, alignments }) => {
|
|
4790
|
-
const BaseComponent = baseComponent;
|
|
4791
|
-
const menuContainer = (React__namespace.createElement(DropdownMenu
|
|
4792
|
-
// This removes the `position: absolute` styling from the `.pf-c-dropdown__menu`
|
|
4793
|
-
// allowing the menu to flip correctly
|
|
4794
|
-
, 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));
|
|
4795
|
-
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));
|
|
4796
|
-
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)),
|
|
4797
|
-
React__namespace.Children.map(toggle, oneToggle => React__namespace.cloneElement(oneToggle, {
|
|
4798
|
-
parentRef: this.baseComponentRef,
|
|
4799
|
-
getMenuRef: this.getMenuComponentRef,
|
|
4800
|
-
isOpen,
|
|
4801
|
-
id,
|
|
4802
|
-
isPlain,
|
|
4803
|
-
isText,
|
|
4804
|
-
'aria-haspopup': ariaHasPopup,
|
|
4805
|
-
onEnter: () => {
|
|
4806
|
-
this.onEnter();
|
|
4807
|
-
oneToggle.props.onEnter && oneToggle.props.onEnter();
|
|
4808
|
-
}
|
|
4809
|
-
})),
|
|
4810
|
-
menuAppendTo === 'inline' && isOpen && menuContainer));
|
|
4811
|
-
const getParentElement = () => {
|
|
4812
|
-
if (this.baseComponentRef && this.baseComponentRef.current) {
|
|
4813
|
-
return this.baseComponentRef.current.parentElement;
|
|
4814
|
-
}
|
|
4815
|
-
return null;
|
|
4816
|
-
};
|
|
4817
|
-
return menuAppendTo === 'inline' ? (mainContainer) : (React__namespace.createElement(Popper, { trigger: mainContainer, popper: popperContainer, direction: direction, position: position, appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, isVisible: isOpen }));
|
|
4818
|
-
}));
|
|
4819
|
-
}
|
|
4820
|
-
}
|
|
4821
|
-
DropdownWithContext.displayName = 'DropdownWithContext';
|
|
4822
|
-
// seed for the aria-labelledby ID
|
|
4823
|
-
DropdownWithContext.currentId = 0;
|
|
4824
|
-
DropdownWithContext.defaultProps = {
|
|
4825
|
-
className: '',
|
|
4826
|
-
dropdownItems: [],
|
|
4827
|
-
isOpen: false,
|
|
4828
|
-
isPlain: false,
|
|
4829
|
-
isText: false,
|
|
4830
|
-
isGrouped: false,
|
|
4831
|
-
position: DropdownPosition.left,
|
|
4832
|
-
direction: DropdownDirection.down,
|
|
4833
|
-
onSelect: () => undefined,
|
|
4834
|
-
autoFocus: true,
|
|
4835
|
-
menuAppendTo: 'inline',
|
|
4836
|
-
isFlipEnabled: false
|
|
4837
|
-
};
|
|
4838
|
-
|
|
4839
|
-
const Dropdown = (_a) => {
|
|
4840
|
-
var { onSelect,
|
|
4841
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4842
|
-
ref, // Types of Ref are different for React.FunctionComponent vs React.Component
|
|
4843
|
-
ouiaId, ouiaSafe, alignments, contextProps, menuAppendTo = 'inline', isFlipEnabled = false } = _a, props = __rest$1(_a, ["onSelect", "ref", "ouiaId", "ouiaSafe", "alignments", "contextProps", "menuAppendTo", "isFlipEnabled"]);
|
|
4844
|
-
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) },
|
|
4845
|
-
React__namespace.createElement(DropdownWithContext, Object.assign({ menuAppendTo: menuAppendTo, isFlipEnabled: isFlipEnabled }, props))));
|
|
4846
|
-
};
|
|
4847
|
-
Dropdown.displayName = 'Dropdown';
|
|
4848
|
-
|
|
4849
4421
|
class InternalDropdownItem extends React__namespace.Component {
|
|
4850
4422
|
constructor() {
|
|
4851
4423
|
super(...arguments);
|
|
@@ -4983,16 +4555,6 @@
|
|
|
4983
4555
|
inoperableEvents: ['onClick', 'onKeyPress']
|
|
4984
4556
|
};
|
|
4985
4557
|
|
|
4986
|
-
const DropdownItem = (_a) => {
|
|
4987
|
-
var { children, className, component = 'a', isDisabled = false, isAriaDisabled = false, isPlainText = false, href, tooltip, tooltipProps = {}, listItemClassName, onClick,
|
|
4988
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4989
|
-
ref, // Types of Ref are different for React.FunctionComponent vs React.Component
|
|
4990
|
-
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"]);
|
|
4991
|
-
const ouiaProps = useOUIAProps(DropdownItem.displayName, ouiaId, ouiaSafe);
|
|
4992
|
-
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))));
|
|
4993
|
-
};
|
|
4994
|
-
DropdownItem.displayName = 'DropdownItem';
|
|
4995
|
-
|
|
4996
4558
|
Promise.resolve().then(function () { return divider; });
|
|
4997
4559
|
var styles$7 = {
|
|
4998
4560
|
"divider": "pf-c-divider",
|
|
@@ -5106,92 +4668,6 @@
|
|
|
5106
4668
|
|
|
5107
4669
|
var CaretDownIcon$1 = CaretDownIcon;
|
|
5108
4670
|
|
|
5109
|
-
const buttonVariantStyles = {
|
|
5110
|
-
default: '',
|
|
5111
|
-
primary: styles$8.modifiers.primary,
|
|
5112
|
-
secondary: styles$8.modifiers.secondary
|
|
5113
|
-
};
|
|
5114
|
-
class Toggle extends React__namespace.Component {
|
|
5115
|
-
constructor() {
|
|
5116
|
-
super(...arguments);
|
|
5117
|
-
this.buttonRef = React__namespace.createRef();
|
|
5118
|
-
this.componentDidMount = () => {
|
|
5119
|
-
document.addEventListener('click', this.onDocClick);
|
|
5120
|
-
document.addEventListener('touchstart', this.onDocClick);
|
|
5121
|
-
document.addEventListener('keydown', this.onEscPress);
|
|
5122
|
-
};
|
|
5123
|
-
this.componentWillUnmount = () => {
|
|
5124
|
-
document.removeEventListener('click', this.onDocClick);
|
|
5125
|
-
document.removeEventListener('touchstart', this.onDocClick);
|
|
5126
|
-
document.removeEventListener('keydown', this.onEscPress);
|
|
5127
|
-
};
|
|
5128
|
-
this.onDocClick = (event) => {
|
|
5129
|
-
const { isOpen, parentRef, onToggle, getMenuRef } = this.props;
|
|
5130
|
-
const menuRef = getMenuRef && getMenuRef();
|
|
5131
|
-
const clickedOnToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
|
5132
|
-
const clickedWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
|
|
5133
|
-
if (isOpen && !(clickedOnToggle || clickedWithinMenu)) {
|
|
5134
|
-
onToggle(false, event);
|
|
5135
|
-
}
|
|
5136
|
-
};
|
|
5137
|
-
this.onEscPress = (event) => {
|
|
5138
|
-
const { parentRef, getMenuRef } = this.props;
|
|
5139
|
-
const keyCode = event.keyCode || event.which;
|
|
5140
|
-
const menuRef = getMenuRef && getMenuRef();
|
|
5141
|
-
const escFromToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
|
5142
|
-
const escFromWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
|
|
5143
|
-
if (this.props.isOpen &&
|
|
5144
|
-
(keyCode === KEY_CODES.ESCAPE_KEY || event.key === 'Tab') &&
|
|
5145
|
-
(escFromToggle || escFromWithinMenu)) {
|
|
5146
|
-
this.props.onToggle(false, event);
|
|
5147
|
-
this.buttonRef.current.focus();
|
|
5148
|
-
}
|
|
5149
|
-
};
|
|
5150
|
-
this.onKeyDown = (event) => {
|
|
5151
|
-
if (event.key === 'Tab' && !this.props.isOpen) {
|
|
5152
|
-
return;
|
|
5153
|
-
}
|
|
5154
|
-
if ((event.key === 'Tab' || event.key === 'Enter' || event.key === ' ') && this.props.isOpen) {
|
|
5155
|
-
if (!this.props.bubbleEvent) {
|
|
5156
|
-
event.stopPropagation();
|
|
5157
|
-
}
|
|
5158
|
-
event.preventDefault();
|
|
5159
|
-
this.props.onToggle(!this.props.isOpen, event);
|
|
5160
|
-
}
|
|
5161
|
-
else if ((event.key === 'Enter' || event.key === ' ') && !this.props.isOpen) {
|
|
5162
|
-
if (!this.props.bubbleEvent) {
|
|
5163
|
-
event.stopPropagation();
|
|
5164
|
-
}
|
|
5165
|
-
event.preventDefault();
|
|
5166
|
-
this.props.onToggle(!this.props.isOpen, event);
|
|
5167
|
-
this.props.onEnter();
|
|
5168
|
-
}
|
|
5169
|
-
};
|
|
5170
|
-
}
|
|
5171
|
-
render() {
|
|
5172
|
-
const _a = this.props, { className, children, isOpen, isDisabled, isPlain, isText, isPrimary, isSplitButton, toggleVariant, onToggle, 'aria-haspopup': ariaHasPopup,
|
|
5173
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5174
|
-
isActive, bubbleEvent, onEnter, parentRef, getMenuRef,
|
|
5175
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
5176
|
-
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"]);
|
|
5177
|
-
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))));
|
|
5178
|
-
}
|
|
5179
|
-
}
|
|
5180
|
-
Toggle.displayName = 'Toggle';
|
|
5181
|
-
Toggle.defaultProps = {
|
|
5182
|
-
className: '',
|
|
5183
|
-
isOpen: false,
|
|
5184
|
-
isActive: false,
|
|
5185
|
-
isDisabled: false,
|
|
5186
|
-
isPlain: false,
|
|
5187
|
-
isText: false,
|
|
5188
|
-
isPrimary: false,
|
|
5189
|
-
isSplitButton: false,
|
|
5190
|
-
onToggle: () => { },
|
|
5191
|
-
onEnter: () => { },
|
|
5192
|
-
bubbleEvent: false
|
|
5193
|
-
};
|
|
5194
|
-
|
|
5195
4671
|
Promise.resolve().then(function () { return badge; });
|
|
5196
4672
|
var badgeStyles = {
|
|
5197
4673
|
"badge": "pf-c-badge",
|
|
@@ -5202,31 +4678,6 @@
|
|
|
5202
4678
|
"themeDark": "pf-theme-dark"
|
|
5203
4679
|
};
|
|
5204
4680
|
|
|
5205
|
-
const EllipsisVIconConfig = {
|
|
5206
|
-
name: 'EllipsisVIcon',
|
|
5207
|
-
height: 512,
|
|
5208
|
-
width: 192,
|
|
5209
|
-
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',
|
|
5210
|
-
yOffset: 0,
|
|
5211
|
-
xOffset: 0,
|
|
5212
|
-
};
|
|
5213
|
-
|
|
5214
|
-
const EllipsisVIcon = createIcon(EllipsisVIconConfig);
|
|
5215
|
-
|
|
5216
|
-
var EllipsisVIcon$1 = EllipsisVIcon;
|
|
5217
|
-
|
|
5218
|
-
const KebabToggle = (_a) => {
|
|
5219
|
-
var { id = '',
|
|
5220
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5221
|
-
children = null, className = '', isOpen = false, 'aria-label': ariaLabel = 'Actions', parentRef = null, getMenuRef = null, isActive = false, isPlain = false, isDisabled = false, bubbleEvent = false, onToggle = () => undefined,
|
|
5222
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5223
|
-
ref } = _a, // Types of Ref are different for React.FunctionComponent vs React.Component
|
|
5224
|
-
props = __rest$1(_a, ["id", "children", "className", "isOpen", 'aria-label', "parentRef", "getMenuRef", "isActive", "isPlain", "isDisabled", "bubbleEvent", "onToggle", "ref"]);
|
|
5225
|
-
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),
|
|
5226
|
-
React__namespace.createElement(EllipsisVIcon$1, null)));
|
|
5227
|
-
};
|
|
5228
|
-
KebabToggle.displayName = 'KebabToggle';
|
|
5229
|
-
|
|
5230
4681
|
const ApplicationLauncherSeparator = (_a) => {
|
|
5231
4682
|
var props = __rest$1(_a, ["children"]);
|
|
5232
4683
|
return React__namespace.createElement(DropdownSeparator, Object.assign({}, props));
|
|
@@ -5307,111 +4758,6 @@
|
|
|
5307
4758
|
}));
|
|
5308
4759
|
};
|
|
5309
4760
|
|
|
5310
|
-
var TextInputTypes;
|
|
5311
|
-
(function (TextInputTypes) {
|
|
5312
|
-
TextInputTypes["text"] = "text";
|
|
5313
|
-
TextInputTypes["date"] = "date";
|
|
5314
|
-
TextInputTypes["datetimeLocal"] = "datetime-local";
|
|
5315
|
-
TextInputTypes["email"] = "email";
|
|
5316
|
-
TextInputTypes["month"] = "month";
|
|
5317
|
-
TextInputTypes["number"] = "number";
|
|
5318
|
-
TextInputTypes["password"] = "password";
|
|
5319
|
-
TextInputTypes["search"] = "search";
|
|
5320
|
-
TextInputTypes["tel"] = "tel";
|
|
5321
|
-
TextInputTypes["time"] = "time";
|
|
5322
|
-
TextInputTypes["url"] = "url";
|
|
5323
|
-
})(TextInputTypes || (TextInputTypes = {}));
|
|
5324
|
-
class TextInputBase extends React__namespace.Component {
|
|
5325
|
-
constructor(props) {
|
|
5326
|
-
super(props);
|
|
5327
|
-
this.inputRef = React__namespace.createRef();
|
|
5328
|
-
this.observer = () => { };
|
|
5329
|
-
this.handleChange = (event) => {
|
|
5330
|
-
if (this.props.onChange) {
|
|
5331
|
-
this.props.onChange(event.currentTarget.value, event);
|
|
5332
|
-
}
|
|
5333
|
-
};
|
|
5334
|
-
this.handleResize = () => {
|
|
5335
|
-
const inputRef = this.props.innerRef || this.inputRef;
|
|
5336
|
-
if (inputRef && inputRef.current) {
|
|
5337
|
-
trimLeft(inputRef.current, String(this.props.value));
|
|
5338
|
-
}
|
|
5339
|
-
};
|
|
5340
|
-
this.restoreText = () => {
|
|
5341
|
-
const inputRef = this.props.innerRef || this.inputRef;
|
|
5342
|
-
// restore the value
|
|
5343
|
-
inputRef.current.value = String(this.props.value);
|
|
5344
|
-
// make sure we still see the rightmost value to preserve cursor click position
|
|
5345
|
-
inputRef.current.scrollLeft = inputRef.current.scrollWidth;
|
|
5346
|
-
};
|
|
5347
|
-
this.onFocus = (event) => {
|
|
5348
|
-
const { isLeftTruncated, onFocus } = this.props;
|
|
5349
|
-
if (isLeftTruncated) {
|
|
5350
|
-
this.restoreText();
|
|
5351
|
-
}
|
|
5352
|
-
onFocus && onFocus(event);
|
|
5353
|
-
};
|
|
5354
|
-
this.onBlur = (event) => {
|
|
5355
|
-
const { isLeftTruncated, onBlur } = this.props;
|
|
5356
|
-
if (isLeftTruncated) {
|
|
5357
|
-
this.handleResize();
|
|
5358
|
-
}
|
|
5359
|
-
onBlur && onBlur(event);
|
|
5360
|
-
};
|
|
5361
|
-
this.sanitizeInputValue = (value) => typeof value === 'string' ? value.replace(/\n/g, ' ') : value;
|
|
5362
|
-
if (!props.id && !props['aria-label'] && !props['aria-labelledby']) {
|
|
5363
|
-
// eslint-disable-next-line no-console
|
|
5364
|
-
console.error('Text input:', 'Text input requires either an id or aria-label to be specified');
|
|
5365
|
-
}
|
|
5366
|
-
this.state = {
|
|
5367
|
-
ouiaStateId: getDefaultOUIAId(TextInputBase.displayName)
|
|
5368
|
-
};
|
|
5369
|
-
}
|
|
5370
|
-
componentDidMount() {
|
|
5371
|
-
if (this.props.isLeftTruncated) {
|
|
5372
|
-
const inputRef = this.props.innerRef || this.inputRef;
|
|
5373
|
-
this.observer = getResizeObserver(inputRef.current, this.handleResize);
|
|
5374
|
-
this.handleResize();
|
|
5375
|
-
}
|
|
5376
|
-
}
|
|
5377
|
-
componentWillUnmount() {
|
|
5378
|
-
if (this.props.isLeftTruncated) {
|
|
5379
|
-
this.observer();
|
|
5380
|
-
}
|
|
5381
|
-
}
|
|
5382
|
-
render() {
|
|
5383
|
-
const _a = this.props, { innerRef, className, type, value, validated,
|
|
5384
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5385
|
-
onChange, onFocus, onBlur, isLeftTruncated,
|
|
5386
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
5387
|
-
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"]);
|
|
5388
|
-
const customIconStyle = {};
|
|
5389
|
-
if (customIconUrl) {
|
|
5390
|
-
customIconStyle.backgroundImage = `url('${customIconUrl}')`;
|
|
5391
|
-
}
|
|
5392
|
-
if (customIconDimensions) {
|
|
5393
|
-
customIconStyle.backgroundSize = customIconDimensions;
|
|
5394
|
-
}
|
|
5395
|
-
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))));
|
|
5396
|
-
}
|
|
5397
|
-
}
|
|
5398
|
-
TextInputBase.displayName = 'TextInputBase';
|
|
5399
|
-
TextInputBase.defaultProps = {
|
|
5400
|
-
'aria-label': null,
|
|
5401
|
-
className: '',
|
|
5402
|
-
isRequired: false,
|
|
5403
|
-
validated: 'default',
|
|
5404
|
-
isDisabled: false,
|
|
5405
|
-
isReadOnly: false,
|
|
5406
|
-
isIconSprite: false,
|
|
5407
|
-
type: TextInputTypes.text,
|
|
5408
|
-
isLeftTruncated: false,
|
|
5409
|
-
onChange: () => undefined,
|
|
5410
|
-
ouiaSafe: true
|
|
5411
|
-
};
|
|
5412
|
-
const TextInput = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TextInputBase, Object.assign({}, props, { innerRef: ref }))));
|
|
5413
|
-
TextInput.displayName = 'TextInput';
|
|
5414
|
-
|
|
5415
4761
|
Promise.resolve().then(function () { return select; });
|
|
5416
4762
|
var styles$6 = {
|
|
5417
4763
|
"check": "pf-c-check",
|
|
@@ -8071,7 +7417,7 @@
|
|
|
8071
7417
|
onMouseEnterProp(event);
|
|
8072
7418
|
};
|
|
8073
7419
|
const text = (React__namespace.createElement(Component, Object.assign({ onMouseEnter: onMouseEnter, className: css(className, wrapModifier && styles$1.modifiers[wrapModifier], styles$1.tableText) }, props), children));
|
|
8074
|
-
return tooltip !== '' ? (React__namespace.createElement(Tooltip, Object.assign({ content: tooltip, isVisible: true }, tooltipProps), text)) : (text);
|
|
7420
|
+
return tooltip !== '' ? (React__namespace.createElement(Tooltip$1.Tooltip, Object.assign({ content: tooltip, isVisible: true }, tooltipProps), text)) : (text);
|
|
8075
7421
|
};
|
|
8076
7422
|
TableText.displayName = 'TableText';
|
|
8077
7423
|
|
|
@@ -8263,7 +7609,7 @@
|
|
|
8263
7609
|
const CollapseColumn = (_a) => {
|
|
8264
7610
|
var { className = '', children = null, isOpen, onToggle } = _a, props = __rest$2(_a, ["className", "children", "isOpen", "onToggle"]);
|
|
8265
7611
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
8266
|
-
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 }),
|
|
7612
|
+
isOpen !== undefined && (React__namespace.createElement(Button$1.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 }),
|
|
8267
7613
|
React__namespace.createElement("div", { className: css(styles$1.tableToggleIcon) },
|
|
8268
7614
|
React__namespace.createElement(AngleDownIcon$1, null)))),
|
|
8269
7615
|
children));
|
|
@@ -11018,7 +10364,7 @@
|
|
|
11018
10364
|
style: Object.assign({ '--pf-c-table__sticky-column--MinWidth': stickyMinWidth ? stickyMinWidth : undefined, '--pf-c-table__sticky-column--Left': stickyLeftOffset ? stickyLeftOffset : undefined }, props.style)
|
|
11019
10365
|
})), transformedChildren));
|
|
11020
10366
|
const canDefault = tooltip === '' ? typeof children === 'string' : true;
|
|
11021
|
-
return tooltip !== null && canDefault && showTooltip ? (React__namespace.createElement(Tooltip, { content: tooltip || (tooltip === '' && children), isVisible: true }, cell)) : (cell);
|
|
10367
|
+
return tooltip !== null && canDefault && showTooltip ? (React__namespace.createElement(Tooltip$1.Tooltip, { content: tooltip || (tooltip === '' && children), isVisible: true }, cell)) : (cell);
|
|
11022
10368
|
};
|
|
11023
10369
|
const Th = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(ThBase, Object.assign({}, props, { innerRef: ref }))));
|
|
11024
10370
|
Th.displayName = 'Th';
|
|
@@ -11048,20 +10394,20 @@
|
|
|
11048
10394
|
render() {
|
|
11049
10395
|
const { isOpen } = this.state;
|
|
11050
10396
|
const { items, children, dropdownPosition, dropdownDirection, isDisabled, rowData, actionsToggle } = this.props;
|
|
11051
|
-
const actionsToggleClone = actionsToggle ? (actionsToggle({ onToggle: this.onToggle, isOpen, isDisabled })) : (React__namespace.createElement(KebabToggle, { isDisabled: isDisabled, onToggle: this.onToggle }));
|
|
10397
|
+
const actionsToggleClone = actionsToggle ? (actionsToggle({ onToggle: this.onToggle, isOpen, isDisabled })) : (React__namespace.createElement(KebabToggle.KebabToggle, { isDisabled: isDisabled, onToggle: this.onToggle }));
|
|
11052
10398
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
11053
10399
|
items
|
|
11054
10400
|
.filter(item => item.isOutsideDropdown)
|
|
11055
10401
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11056
10402
|
.map((_a, key) => {
|
|
11057
10403
|
var { title, itemKey, onClick, isOutsideDropdown } = _a, props = __rest$2(_a, ["title", "itemKey", "onClick", "isOutsideDropdown"]);
|
|
11058
|
-
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)));
|
|
10404
|
+
return typeof title === 'string' ? (React__namespace.createElement(Button$1.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)));
|
|
11059
10405
|
}),
|
|
11060
|
-
React__namespace.createElement(Dropdown, Object.assign({ toggle: actionsToggleClone, position: dropdownPosition, direction: dropdownDirection, isOpen: isOpen, dropdownItems: items
|
|
10406
|
+
React__namespace.createElement(Dropdown.Dropdown, Object.assign({ toggle: actionsToggleClone, position: dropdownPosition, direction: dropdownDirection, isOpen: isOpen, dropdownItems: items
|
|
11061
10407
|
.filter(item => !item.isOutsideDropdown)
|
|
11062
10408
|
.map((_a, key) => {
|
|
11063
10409
|
var { title, itemKey, onClick, isSeparator } = _a, props = __rest$2(_a, ["title", "itemKey", "onClick", "isSeparator"]);
|
|
11064
|
-
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 => {
|
|
10410
|
+
return isSeparator ? (React__namespace.createElement(DropdownSeparator$1.DropdownSeparator, Object.assign({}, props, { key: itemKey || key, "data-key": itemKey || key }))) : (React__namespace.createElement(DropdownItem.DropdownItem, Object.assign({ component: "button", onClick: event => {
|
|
11065
10411
|
this.onClick(event, onClick);
|
|
11066
10412
|
this.onToggle(!isOpen);
|
|
11067
10413
|
} }, props, { key: itemKey || key, "data-key": itemKey || key }), title));
|
|
@@ -11073,8 +10419,8 @@
|
|
|
11073
10419
|
ActionsColumn.defaultProps = {
|
|
11074
10420
|
children: null,
|
|
11075
10421
|
items: [],
|
|
11076
|
-
dropdownPosition: DropdownPosition.right,
|
|
11077
|
-
dropdownDirection: DropdownDirection.down,
|
|
10422
|
+
dropdownPosition: dropdownConstants.DropdownPosition.right,
|
|
10423
|
+
dropdownDirection: dropdownConstants.DropdownDirection.down,
|
|
11078
10424
|
rowData: {},
|
|
11079
10425
|
extraData: {}
|
|
11080
10426
|
};
|
|
@@ -11131,7 +10477,7 @@
|
|
|
11131
10477
|
id: `favorites-button-${rowIndex}`,
|
|
11132
10478
|
'aria-labelledby': `favorites-button-${rowIndex}`
|
|
11133
10479
|
};
|
|
11134
|
-
return (React__namespace.createElement(Button, Object.assign({ variant: "plain", className: className, type: "button", "aria-label": isFavorited ? 'Starred' : 'Not starred', onClick: onFavorite }, ariaProps, props),
|
|
10480
|
+
return (React__namespace.createElement(Button$1.Button, Object.assign({ variant: "plain", className: className, type: "button", "aria-label": isFavorited ? 'Starred' : 'Not starred', onClick: onFavorite }, ariaProps, props),
|
|
11135
10481
|
React__namespace.createElement(StarIcon$1, { "aria-hidden": true })));
|
|
11136
10482
|
};
|
|
11137
10483
|
FavoritesCell.displayName = 'FavoritesCell';
|
|
@@ -11168,7 +10514,7 @@
|
|
|
11168
10514
|
|
|
11169
10515
|
const DraggableCell = (_a) => {
|
|
11170
10516
|
var { className, onClick, 'aria-label': ariaLabel, id } = _a, props = __rest$2(_a, ["className", "onClick", 'aria-label', "id"]);
|
|
11171
|
-
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),
|
|
10517
|
+
return (React__namespace.createElement(Button$1.Button, Object.assign({ id: id, variant: "plain", className: className, type: "button", "aria-label": ariaLabel || `Draggable row draggable button`, onClick: onClick }, props),
|
|
11172
10518
|
React__namespace.createElement(GripVerticalIcon$1, { "aria-hidden": true })));
|
|
11173
10519
|
};
|
|
11174
10520
|
DraggableCell.displayName = 'DraggableCell';
|
|
@@ -12614,7 +11960,7 @@
|
|
|
12614
11960
|
children.type === EmptyState;
|
|
12615
11961
|
}
|
|
12616
11962
|
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));
|
|
12617
|
-
const bodyCell = tooltip !== '' ? (React__namespace.createElement(Tooltip, { content: tooltip, isVisible: true }, cell)) : (cell);
|
|
11963
|
+
const bodyCell = tooltip !== '' ? (React__namespace.createElement(Tooltip$1.Tooltip, { content: tooltip, isVisible: true }, cell)) : (cell);
|
|
12618
11964
|
return (parentId !== undefined && colSpan === undefined) || !isVisible ? null : bodyCell;
|
|
12619
11965
|
};
|
|
12620
11966
|
BodyCell.displayName = 'BodyCell';
|
|
@@ -12643,15 +11989,15 @@
|
|
|
12643
11989
|
}
|
|
12644
11990
|
};
|
|
12645
11991
|
if (props.onScroll) {
|
|
12646
|
-
this.handleScroll = debounce
|
|
11992
|
+
this.handleScroll = util.debounce(this.handleScroll, 100);
|
|
12647
11993
|
}
|
|
12648
11994
|
if (props.onResize) {
|
|
12649
|
-
this.handleResize = debounce
|
|
11995
|
+
this.handleResize = util.debounce(this.handleResize, 100);
|
|
12650
11996
|
}
|
|
12651
11997
|
}
|
|
12652
11998
|
componentDidMount() {
|
|
12653
11999
|
this._unmounted = false;
|
|
12654
|
-
if (canUseDOM) {
|
|
12000
|
+
if (util.canUseDOM) {
|
|
12655
12001
|
if (this.props.onScroll) {
|
|
12656
12002
|
window.addEventListener('scroll', this.handleScroll);
|
|
12657
12003
|
}
|
|
@@ -12662,7 +12008,7 @@
|
|
|
12662
12008
|
}
|
|
12663
12009
|
componentWillUnmount() {
|
|
12664
12010
|
this._unmounted = true;
|
|
12665
|
-
if (canUseDOM) {
|
|
12011
|
+
if (util.canUseDOM) {
|
|
12666
12012
|
if (this.props.onScroll) {
|
|
12667
12013
|
window.removeEventListener('scroll', this.handleScroll);
|
|
12668
12014
|
}
|
|
@@ -12726,13 +12072,13 @@
|
|
|
12726
12072
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
12727
12073
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditGroup, inlineStyles.modifiers.iconGroup, 'pf-m-action-group') },
|
|
12728
12074
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditAction) },
|
|
12729
|
-
React__namespace.createElement(Button, Object.assign({ "aria-label": saveAriaLabel }, props, { onClick: e => onClick(e, 'save'), variant: "plain" }),
|
|
12075
|
+
React__namespace.createElement(Button$2.Button, Object.assign({ "aria-label": saveAriaLabel }, props, { onClick: e => onClick(e, 'save'), variant: "plain" }),
|
|
12730
12076
|
React__namespace.createElement(CheckIcon$1, null))),
|
|
12731
12077
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditAction) },
|
|
12732
|
-
React__namespace.createElement(Button, Object.assign({ "aria-label": cancelAriaLabel }, props, { onClick: e => onClick(e, 'cancel'), variant: "plain" }),
|
|
12078
|
+
React__namespace.createElement(Button$2.Button, Object.assign({ "aria-label": cancelAriaLabel }, props, { onClick: e => onClick(e, 'cancel'), variant: "plain" }),
|
|
12733
12079
|
React__namespace.createElement(TimesIcon$1, null)))),
|
|
12734
12080
|
React__namespace.createElement("div", { className: css(inlineStyles.inlineEditAction, inlineStyles.modifiers.enableEditable) },
|
|
12735
|
-
React__namespace.createElement(Button, Object.assign({ "aria-label": editAriaLabel }, props, { onClick: e => onClick(e, 'edit'), variant: "plain" }),
|
|
12081
|
+
React__namespace.createElement(Button$2.Button, Object.assign({ "aria-label": editAriaLabel }, props, { onClick: e => onClick(e, 'edit'), variant: "plain" }),
|
|
12736
12082
|
React__namespace.createElement(PencilAltIcon$1, null)))));
|
|
12737
12083
|
};
|
|
12738
12084
|
EditColumn.displayName = 'EditColumn';
|
|
@@ -13192,8 +12538,8 @@
|
|
|
13192
12538
|
rowLabeledBy: 'simple-node',
|
|
13193
12539
|
expandId: 'expandable-toggle',
|
|
13194
12540
|
contentId: 'expanded-content',
|
|
13195
|
-
dropdownPosition: DropdownPosition.right,
|
|
13196
|
-
dropdownDirection: DropdownDirection.down,
|
|
12541
|
+
dropdownPosition: dropdownConstants.DropdownPosition.right,
|
|
12542
|
+
dropdownDirection: dropdownConstants.DropdownDirection.down,
|
|
13197
12543
|
header: undefined,
|
|
13198
12544
|
caption: undefined,
|
|
13199
12545
|
'aria-label': undefined,
|
|
@@ -13340,7 +12686,7 @@
|
|
|
13340
12686
|
const EditableTextCell = ({ value, rowIndex, cellIndex, props, handleTextInputChange, inputAriaLabel, isDisabled = false }) => (React__namespace.createElement(React__namespace.Fragment, null,
|
|
13341
12687
|
React__namespace.createElement("div", { className: inlineStyles.inlineEditValue }, value),
|
|
13342
12688
|
React__namespace.createElement("div", { className: inlineStyles.inlineEditInput },
|
|
13343
|
-
React__namespace.createElement(TextInput, { isDisabled: isDisabled, value: props.editableValue !== undefined ? props.editableValue : value, validated: props.isValid !== false ? 'default' : 'error', type: "text", onChange: (newValue, event) => {
|
|
12689
|
+
React__namespace.createElement(TextInput.TextInput, { isDisabled: isDisabled, value: props.editableValue !== undefined ? props.editableValue : value, validated: props.isValid !== false ? 'default' : 'error', type: "text", onChange: (newValue, event) => {
|
|
13344
12690
|
handleTextInputChange(newValue, event, rowIndex, cellIndex);
|
|
13345
12691
|
}, "aria-label": inputAriaLabel }),
|
|
13346
12692
|
React__namespace.createElement("div", { className: css(formStyles.formHelperText, formStyles.modifiers.error), "aria-live": "polite" }, props.errorText))));
|