@patternfly/react-table 4.104.0 → 4.104.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/umd/react-table.min.css +6193 -6193
- package/package.json +6 -6
- package/src/docs/demos/Table.md +49 -216
- package/src/docs/examples/Data.jsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "4.104.
|
|
3
|
+
"version": "4.104.1",
|
|
4
4
|
"description": "This library provides a set of React table components for use with the PatternFly 4",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^4.235.
|
|
35
|
-
"@patternfly/react-icons": "^4.86.
|
|
36
|
-
"@patternfly/react-styles": "^4.85.
|
|
37
|
-
"@patternfly/react-tokens": "^4.87.
|
|
34
|
+
"@patternfly/react-core": "^4.235.1",
|
|
35
|
+
"@patternfly/react-icons": "^4.86.1",
|
|
36
|
+
"@patternfly/react-styles": "^4.85.1",
|
|
37
|
+
"@patternfly/react-tokens": "^4.87.1",
|
|
38
38
|
"lodash": "^4.17.19",
|
|
39
39
|
"tslib": "^2.0.0"
|
|
40
40
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react": "^16.8.0 || ^17.0.0",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "7261b4ef06344b8f4bad002e5c36b140a478d538"
|
|
50
50
|
}
|
package/src/docs/demos/Table.md
CHANGED
|
@@ -5,6 +5,7 @@ section: components
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
Checkbox,
|
|
8
|
+
Label,
|
|
8
9
|
PageSection,
|
|
9
10
|
ToolbarExpandIconWrapper,
|
|
10
11
|
ToolbarContent,
|
|
@@ -46,6 +47,7 @@ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
|
46
47
|
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
47
48
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
48
49
|
import BlueprintIcon from '@patternfly/react-icons/dist/esm/icons/blueprint-icon';
|
|
50
|
+
import { rows, columns } from '../examples/Data.jsx';
|
|
49
51
|
|
|
50
52
|
## Demos
|
|
51
53
|
|
|
@@ -2784,234 +2786,65 @@ class ComplexPaginationTableDemo extends React.Component {
|
|
|
2784
2786
|
|
|
2785
2787
|
```js isFullscreen
|
|
2786
2788
|
import React from 'react';
|
|
2787
|
-
import {
|
|
2788
|
-
Avatar,
|
|
2789
|
-
Brand,
|
|
2790
|
-
Breadcrumb,
|
|
2791
|
-
BreadcrumbItem,
|
|
2792
|
-
Button,
|
|
2793
|
-
ButtonVariant,
|
|
2794
|
-
Dropdown,
|
|
2795
|
-
DropdownGroup,
|
|
2796
|
-
DropdownToggle,
|
|
2797
|
-
DropdownItem,
|
|
2798
|
-
KebabToggle,
|
|
2799
|
-
Nav,
|
|
2800
|
-
NavItem,
|
|
2801
|
-
NavList,
|
|
2802
|
-
Page,
|
|
2803
|
-
PageHeader,
|
|
2804
|
-
PageSection,
|
|
2805
|
-
PageSectionVariants,
|
|
2806
|
-
PageSidebar,
|
|
2807
|
-
SkipToContent,
|
|
2808
|
-
TextContent,
|
|
2809
|
-
Text,
|
|
2810
|
-
PageHeaderTools,
|
|
2811
|
-
PageHeaderToolsGroup,
|
|
2812
|
-
PageHeaderToolsItem
|
|
2813
|
-
} from '@patternfly/react-core';
|
|
2814
|
-
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
2815
|
-
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
2816
|
-
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
2817
|
-
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
2818
|
-
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
2789
|
+
import { Label, PageSection } from '@patternfly/react-core';
|
|
2819
2790
|
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
|
2791
|
+
import { rows } from '../examples/Data.jsx';
|
|
2820
2792
|
|
|
2821
|
-
class
|
|
2822
|
-
constructor(props) {
|
|
2823
|
-
super(props);
|
|
2824
|
-
this.state = {
|
|
2825
|
-
isDropdownOpen: false,
|
|
2826
|
-
isKebabDropdownOpen: false,
|
|
2827
|
-
activeItem: 0,
|
|
2828
|
-
res: []
|
|
2829
|
-
};
|
|
2830
|
-
this.onDropdownToggle = isDropdownOpen => {
|
|
2831
|
-
this.setState({
|
|
2832
|
-
isDropdownOpen
|
|
2833
|
-
});
|
|
2834
|
-
};
|
|
2835
|
-
|
|
2836
|
-
this.onDropdownSelect = event => {
|
|
2837
|
-
this.setState({
|
|
2838
|
-
isDropdownOpen: !this.state.isDropdownOpen
|
|
2839
|
-
});
|
|
2840
|
-
};
|
|
2841
|
-
|
|
2842
|
-
this.onKebabDropdownToggle = isKebabDropdownOpen => {
|
|
2843
|
-
this.setState({
|
|
2844
|
-
isKebabDropdownOpen
|
|
2845
|
-
});
|
|
2846
|
-
};
|
|
2847
|
-
|
|
2848
|
-
this.onKebabDropdownSelect = event => {
|
|
2849
|
-
this.setState({
|
|
2850
|
-
isKebabDropdownOpen: !this.state.isKebabDropdownOpen
|
|
2851
|
-
});
|
|
2852
|
-
};
|
|
2853
|
-
|
|
2854
|
-
this.onNavSelect = result => {
|
|
2855
|
-
this.setState({
|
|
2856
|
-
activeItem: result.itemId
|
|
2857
|
-
});
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
fetch(page, perPage) {
|
|
2862
|
-
this.setState({ loading: true });
|
|
2863
|
-
fetch(`https://jsonplaceholder.typicode.com/posts?_page=${page}&_limit=${perPage}`)
|
|
2864
|
-
.then(resp => resp.json())
|
|
2865
|
-
.then(resp => this.setState({ res: resp, perPage, page, total: 100 }))
|
|
2866
|
-
.catch(err => this.setState({ error: err, perPage: 0, page: 0, total: 0 }));
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
componentDidMount() {
|
|
2870
|
-
this.fetch(this.state.page || 1, this.state.perPage || 20);
|
|
2871
|
-
}
|
|
2872
|
-
|
|
2793
|
+
class StickyHeaderTableDemo extends React.Component {
|
|
2873
2794
|
render() {
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
<
|
|
2880
|
-
|
|
2881
|
-
</
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
Authentication
|
|
2887
|
-
</NavItem>
|
|
2888
|
-
<NavItem itemId={3} isActive={activeItem === 3}>
|
|
2889
|
-
Network Services
|
|
2890
|
-
</NavItem>
|
|
2891
|
-
<NavItem itemId={4} isActive={activeItem === 4}>
|
|
2892
|
-
Server
|
|
2893
|
-
</NavItem>
|
|
2894
|
-
</NavList>
|
|
2895
|
-
</Nav>
|
|
2896
|
-
);
|
|
2897
|
-
const kebabDropdownItems = [
|
|
2898
|
-
<DropdownItem>
|
|
2899
|
-
<CogIcon /> Settings
|
|
2900
|
-
</DropdownItem>,
|
|
2901
|
-
<DropdownItem>
|
|
2902
|
-
<HelpIcon /> Help
|
|
2903
|
-
</DropdownItem>
|
|
2904
|
-
];
|
|
2905
|
-
const userDropdownItems = [
|
|
2906
|
-
<DropdownGroup key="group 2">
|
|
2907
|
-
<DropdownItem key="group 2 profile">My profile</DropdownItem>
|
|
2908
|
-
<DropdownItem key="group 2 user" component="button">
|
|
2909
|
-
User management
|
|
2910
|
-
</DropdownItem>
|
|
2911
|
-
<DropdownItem key="group 2 logout">Logout</DropdownItem>
|
|
2912
|
-
</DropdownGroup>
|
|
2913
|
-
];
|
|
2914
|
-
const headerTools = (
|
|
2915
|
-
<PageHeaderTools>
|
|
2916
|
-
<PageHeaderToolsGroup
|
|
2917
|
-
visibility={{
|
|
2918
|
-
default: 'hidden',
|
|
2919
|
-
lg: 'visible'
|
|
2920
|
-
}} /** the settings and help icon buttons are only visible on desktop sizes and replaced by a kebab dropdown for other sizes */
|
|
2921
|
-
>
|
|
2922
|
-
<PageHeaderToolsItem>
|
|
2923
|
-
<Button aria-label="Settings actions" variant={ButtonVariant.plain}>
|
|
2924
|
-
<CogIcon />
|
|
2925
|
-
</Button>
|
|
2926
|
-
</PageHeaderToolsItem>
|
|
2927
|
-
<PageHeaderToolsItem>
|
|
2928
|
-
<Button aria-label="Help actions" variant={ButtonVariant.plain}>
|
|
2929
|
-
<QuestionCircleIcon />
|
|
2930
|
-
</Button>
|
|
2931
|
-
</PageHeaderToolsItem>
|
|
2932
|
-
</PageHeaderToolsGroup>
|
|
2933
|
-
<PageHeaderToolsGroup>
|
|
2934
|
-
<PageHeaderToolsItem
|
|
2935
|
-
visibility={{
|
|
2936
|
-
lg: 'hidden'
|
|
2937
|
-
}} /** this kebab dropdown replaces the icon buttons and is hidden for desktop sizes */
|
|
2938
|
-
>
|
|
2939
|
-
<Dropdown
|
|
2940
|
-
isPlain
|
|
2941
|
-
position="right"
|
|
2942
|
-
onSelect={this.onKebabDropdownSelect}
|
|
2943
|
-
toggle={<KebabToggle onToggle={this.onKebabDropdownToggle} />}
|
|
2944
|
-
isOpen={isKebabDropdownOpen}
|
|
2945
|
-
dropdownItems={kebabDropdownItems}
|
|
2946
|
-
/>
|
|
2947
|
-
</PageHeaderToolsItem>
|
|
2948
|
-
<PageHeaderToolsItem
|
|
2949
|
-
visibility={{ default: 'hidden', md: 'visible' }} /** this user dropdown is hidden on mobile sizes */
|
|
2950
|
-
>
|
|
2951
|
-
<Dropdown
|
|
2952
|
-
isPlain
|
|
2953
|
-
position="right"
|
|
2954
|
-
onSelect={this.onDropdownSelect}
|
|
2955
|
-
isOpen={isDropdownOpen}
|
|
2956
|
-
toggle={<DropdownToggle onToggle={this.onDropdownToggle}>John Smith</DropdownToggle>}
|
|
2957
|
-
dropdownItems={userDropdownItems}
|
|
2958
|
-
/>
|
|
2959
|
-
</PageHeaderToolsItem>
|
|
2960
|
-
</PageHeaderToolsGroup>
|
|
2961
|
-
<Avatar src={imgAvatar} alt="Avatar image" />
|
|
2962
|
-
</PageHeaderTools>
|
|
2963
|
-
);
|
|
2964
|
-
|
|
2965
|
-
const Header = (
|
|
2966
|
-
<PageHeader logo={<Brand src={imgBrand} alt="Patternfly Logo" />} headerTools={headerTools} showNavToggle />
|
|
2967
|
-
);
|
|
2968
|
-
const Sidebar = <PageSidebar nav={PageNav} />;
|
|
2969
|
-
const pageId = 'main-content-page-layout-default-nav';
|
|
2970
|
-
const PageSkipToContent = <SkipToContent href={`#${pageId}`}>Skip to content</SkipToContent>;
|
|
2971
|
-
|
|
2972
|
-
const PageBreadcrumb = (
|
|
2973
|
-
<Breadcrumb>
|
|
2974
|
-
<BreadcrumbItem>Section home</BreadcrumbItem>
|
|
2975
|
-
<BreadcrumbItem to="#">Section title</BreadcrumbItem>
|
|
2976
|
-
<BreadcrumbItem to="#">Section title</BreadcrumbItem>
|
|
2977
|
-
<BreadcrumbItem to="#" isActive>
|
|
2978
|
-
Section landing
|
|
2979
|
-
</BreadcrumbItem>
|
|
2980
|
-
</Breadcrumb>
|
|
2981
|
-
);
|
|
2795
|
+
const renderLabel = labelText => {
|
|
2796
|
+
switch (labelText) {
|
|
2797
|
+
case 'Running':
|
|
2798
|
+
return <Label color="green">{labelText}</Label>;
|
|
2799
|
+
case 'Stopped':
|
|
2800
|
+
return <Label color="orange">{labelText}</Label>;
|
|
2801
|
+
case 'Needs Maintenance':
|
|
2802
|
+
return <Label color="blue">{labelText}</Label>;
|
|
2803
|
+
case 'Down':
|
|
2804
|
+
return <Label color="red">{labelText}</Label>;
|
|
2805
|
+
}
|
|
2806
|
+
};
|
|
2982
2807
|
|
|
2983
2808
|
return (
|
|
2984
|
-
<
|
|
2985
|
-
<
|
|
2986
|
-
|
|
2987
|
-
sidebar={Sidebar}
|
|
2988
|
-
isManagedSidebar
|
|
2989
|
-
skipToContent={PageSkipToContent}
|
|
2990
|
-
breadcrumb={PageBreadcrumb}
|
|
2991
|
-
mainContainerId={pageId}
|
|
2992
|
-
>
|
|
2993
|
-
<PageSection variant={PageSectionVariants.light}>
|
|
2994
|
-
<TextContent>
|
|
2995
|
-
<Text component="h1">Main title</Text>
|
|
2996
|
-
<Text component="p">
|
|
2997
|
-
Body text should be Overpass Regular at 16px. It should have leading of 24px because <br />
|
|
2998
|
-
of its relative line height of 1.5.
|
|
2999
|
-
</Text>
|
|
3000
|
-
</TextContent>
|
|
3001
|
-
</PageSection>
|
|
3002
|
-
<PageSection>
|
|
2809
|
+
<DashboardWrapper hasPageTemplateTitle>
|
|
2810
|
+
<PageSection padding={{ default: 'noPadding', xl: 'padding' }}>
|
|
2811
|
+
<Card component="div">
|
|
3003
2812
|
<Table
|
|
3004
|
-
cells={[
|
|
3005
|
-
|
|
2813
|
+
cells={[
|
|
2814
|
+
{ title: 'Servers', transforms: [cellWidth(15)] },
|
|
2815
|
+
{ title: 'Threads', transforms: [cellWidth(10)] },
|
|
2816
|
+
{ title: 'Applications', transforms: [cellWidth(10)] },
|
|
2817
|
+
{ title: 'Workspaces', transforms: [cellWidth(10)] },
|
|
2818
|
+
{ title: 'Status', transforms: [cellWidth(10)] },
|
|
2819
|
+
{ title: 'Location', transforms: [cellWidth(15)] },
|
|
2820
|
+
{ title: 'Last Modified', transforms: [cellWidth(15)] },
|
|
2821
|
+
{ title: 'URL', transforms: [cellWidth(10)] }
|
|
2822
|
+
]}
|
|
2823
|
+
rows={rows.map(row => [
|
|
2824
|
+
row.name,
|
|
2825
|
+
row.threads,
|
|
2826
|
+
row.applications,
|
|
2827
|
+
row.workspaces,
|
|
2828
|
+
{ title: renderLabel(row.status) },
|
|
2829
|
+
row.location,
|
|
2830
|
+
row.lastModified,
|
|
2831
|
+
{
|
|
2832
|
+
title: (
|
|
2833
|
+
<a href="#">
|
|
2834
|
+
<TableText wrapModifier="truncate">{row.url} </TableText>
|
|
2835
|
+
</a>
|
|
2836
|
+
)
|
|
2837
|
+
}
|
|
2838
|
+
])}
|
|
3006
2839
|
aria-label="Sticky Header Table Demo"
|
|
3007
2840
|
isStickyHeader
|
|
3008
2841
|
>
|
|
3009
2842
|
<TableHeader />
|
|
3010
2843
|
<TableBody />
|
|
3011
2844
|
</Table>
|
|
3012
|
-
</
|
|
3013
|
-
</
|
|
3014
|
-
</
|
|
2845
|
+
</Card>
|
|
2846
|
+
</PageSection>
|
|
2847
|
+
</DashboardWrapper>
|
|
3015
2848
|
);
|
|
3016
2849
|
}
|
|
3017
2850
|
}
|
|
@@ -173,7 +173,7 @@ export const rows = [
|
|
|
173
173
|
applications: getRandomInteger(1, 50),
|
|
174
174
|
workspaces: getRandomInteger(1, 30),
|
|
175
175
|
status: ['Stopped', 'Running', 'Down', 'Needs Maintenance'][getRandomInteger(0, 3)],
|
|
176
|
-
|
|
176
|
+
location: ['Raleigh', 'Boston', 'Atlanta', 'San Francisco'][getRandomInteger(0, 3)],
|
|
177
177
|
lastModified: '5 minutes ago',
|
|
178
178
|
url: 'http://www.redhat.com/en/office-locations/US-node16'
|
|
179
179
|
},
|