@patternfly/react-table 5.0.0-prerelease.7 → 5.0.0-prerelease.9
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 +12 -7991
- package/README.md +48 -87
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/js/components/Table/package.json +1 -1
- package/dist/js/components/Table/utils/decorators/package.json +1 -1
- package/dist/js/components/Table/utils/package.json +1 -1
- package/dist/js/components/package.json +1 -1
- package/dist/js/deprecated/components/Table/base/package.json +1 -1
- package/dist/js/deprecated/components/Table/package.json +1 -1
- package/dist/js/deprecated/components/package.json +1 -1
- package/dist/js/deprecated/package.json +1 -1
- package/dist/js/package.json +1 -1
- package/package.json +8 -8
- package/src/deprecated/components/Table/examples/Table.md +1 -0
- package/subpaths.config.json +4 -0
- package/components/index.d.ts +0 -2
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -2
- package/components/index.js.map +0 -1
- package/deprecated/index.d.ts +0 -2
- package/deprecated/index.d.ts.map +0 -1
- package/deprecated/index.js +0 -2
- package/deprecated/index.js.map +0 -1
- package/scripts/createSubpaths.js +0 -32
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @patternfly/react-table
|
|
2
2
|
|
|
3
|
-
This package provides Table PatternFly components based on [PatternFly
|
|
3
|
+
This package provides Table PatternFly components based on [PatternFly][patternfly]
|
|
4
4
|
|
|
5
5
|
### Prerequisite
|
|
6
6
|
|
|
7
|
-
#### Node
|
|
7
|
+
#### Node environment
|
|
8
8
|
|
|
9
9
|
This project currently supports Node [Active LTS](https://github.com/nodejs/Release#release-schedule) releases. Please stay current with Node Active LTS when developing patternfly-react.
|
|
10
10
|
|
|
11
|
-
For example, to develop with Node
|
|
11
|
+
For example, to develop with Node 18, use the following:
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
nvm install
|
|
15
|
-
nvm use
|
|
14
|
+
nvm install 18
|
|
15
|
+
nvm use 18
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
This project also requires a Yarn version of >=1.6.0. The latest version can be installed [here](https://yarnpkg.com/).
|
|
@@ -31,40 +31,50 @@ npm install @patternfly/react-table --save
|
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
|
-
It's strongly advised to use the PatternFly
|
|
34
|
+
It's strongly advised to use the PatternFly base CSS in your whole project, or some components may diverge in appearance:
|
|
35
35
|
|
|
36
36
|
```js
|
|
37
37
|
import '@patternfly/react-core/dist/styles/base.css';
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
#### Example
|
|
40
|
+
#### Example component usage
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
|
-
import { Table,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
import { Table, Thead, Tr, Th, Td, Tbody } from '@patternfly/react-table';
|
|
44
|
+
|
|
45
|
+
export const ComposableTableBasic = () => {
|
|
46
|
+
const repositories = [
|
|
47
|
+
{ name: 'one', branches: 'two', prs: 'three' },
|
|
48
|
+
{ name: 'one - 2', branches: null, prs: null },
|
|
49
|
+
{ name: 'one - 3', branches: 'two - 3', prs: 'three - 3' }
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const columnNames = {
|
|
53
|
+
name: 'Repositories',
|
|
54
|
+
branches: 'Branches',
|
|
55
|
+
prs: 'Pull requests'
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Table>
|
|
60
|
+
<Thead>
|
|
61
|
+
<Tr>
|
|
62
|
+
<Th>{columnNames.name}</Th>
|
|
63
|
+
<Th>{columnNames.branches}</Th>
|
|
64
|
+
<Th>{columnNames.prs}</Th>
|
|
65
|
+
</Tr>
|
|
66
|
+
</Thead>
|
|
67
|
+
<Tbody>
|
|
68
|
+
{repositories.map(repo => (
|
|
69
|
+
<Tr key={repo.name}>
|
|
70
|
+
<Td dataLabel={columnNames.name}>{repo.name}</Td>
|
|
71
|
+
<Td dataLabel={columnNames.branches}>{repo.branches}</Td>
|
|
72
|
+
<Td dataLabel={columnNames.prs}>{repo.prs}</Td>
|
|
73
|
+
</Tr>
|
|
74
|
+
))}
|
|
75
|
+
</Tbody>
|
|
76
|
+
</Table>
|
|
77
|
+
);
|
|
68
78
|
}
|
|
69
79
|
export default SimpleTable;
|
|
70
80
|
```
|
|
@@ -73,68 +83,19 @@ export default SimpleTable;
|
|
|
73
83
|
|
|
74
84
|
This library makes use of the babel plugin from [@patternfly/react-styles](../react-styles/README.md) to enable providing the CSS alongside the components. This removes the need for consumers to use (style|css|sass)-loaders. For an example of using CSS from core you can reference [Button.js](./src/components/Button/Button.js). For any CSS not provided by core please use the `StyleSheet.create` utility from [@patternfly/react-styles](../react-styles/README.md). This will prevent collisions with any consumers, and allow the CSS to be bundled with the component.
|
|
75
85
|
|
|
76
|
-
### Custom transformators
|
|
77
|
-
|
|
78
|
-
If you want to add custom transformators to show some special column (collapsible, checkbox) you have to include `isVisible` there as well so cellRenderer knows which cells to render (main purpose is for colSpan).
|
|
79
|
-
|
|
80
|
-
Example of such transformator can be:
|
|
81
|
-
|
|
82
|
-
```jsx
|
|
83
|
-
function someTransform(value) {
|
|
84
|
-
return {
|
|
85
|
-
isVisible: true,
|
|
86
|
-
children: <div>cell</div>
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
If you want to add this transformer as default cell (first, last, any,...) for each row you also want to change function `calculateColumns`in [HeaderUtils.js](src/components/Table/utils/HeaderUtils.js).
|
|
92
|
-
|
|
93
|
-
Notice: Any data provided as cell will be visible by default, no need to add `isVisible` if you want to change how data are displayed.
|
|
94
|
-
|
|
95
86
|
### Documentation
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
A comprehensive list of components and detailed usage of each can be found on the [PatternFly React Docs][docs] website
|
|
100
|
-
You can also find how each component is meant to be used from a design perspective on the [PatternFly 4 Core][patternfly-4] website.
|
|
88
|
+
A comprehensive list of components and detailed usage of each can be found on the [PatternFly react docs][docs] website
|
|
89
|
+
You can also find how each component is meant to be used from a design perspective on the [PatternFly core][patternfly] website.
|
|
101
90
|
|
|
102
91
|
Note: All commands below assume you are on the root directory in this repository.
|
|
103
92
|
|
|
104
|
-
### Install
|
|
93
|
+
### Install & run locally
|
|
105
94
|
|
|
106
|
-
Run to install all the dependencies
|
|
95
|
+
Run to install all the dependencies, build and run the site locally.
|
|
107
96
|
|
|
108
97
|
```sh
|
|
109
|
-
yarn
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Building
|
|
113
|
-
|
|
114
|
-
```sh
|
|
115
|
-
yarn bootstrap && yarn build && yarn build:docs
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Running
|
|
119
|
-
|
|
120
|
-
To start the site locally.
|
|
121
|
-
|
|
122
|
-
```sh
|
|
123
|
-
yarn build && yarn start:pf4
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Building
|
|
127
|
-
|
|
128
|
-
To build the site.
|
|
129
|
-
|
|
130
|
-
```sh
|
|
131
|
-
yarn build:docs
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Building
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
yarn build
|
|
98
|
+
yarn install && yarn start
|
|
138
99
|
```
|
|
139
100
|
|
|
140
101
|
### Testing
|
|
@@ -145,5 +106,5 @@ Testing is done at the root of this repo. To only run the @patternfly/react-tabl
|
|
|
145
106
|
yarn test packages/react-table
|
|
146
107
|
```
|
|
147
108
|
|
|
148
|
-
[patternfly
|
|
109
|
+
[patternfly]: https://github.com/patternfly/patternfly
|
|
149
110
|
[docs]: https://patternfly-react-main.surge.sh
|
package/components/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-components
|
|
1
|
+
{"name":"@patternfly/react-table-components","main":"../dist/js/components/index.js","module":"../dist/esm/components/index.js","typings":"../dist/esm/components/index.d.ts","version":"5.0.0-prerelease.8"}
|
package/deprecated/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-deprecated
|
|
1
|
+
{"name":"@patternfly/react-table-deprecated","main":"../dist/js/deprecated/index.js","module":"../dist/esm/deprecated/index.js","typings":"../dist/esm/deprecated/index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-table-cjs","main":"index.js","module":"./dist/js/components/Table/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-table-cjs","main":"index.js","module":"./dist/js/components/Table/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-decorators-cjs","main":"index.js","module":"./dist/js/components/Table/utils/decorators/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-decorators-cjs","main":"index.js","module":"./dist/js/components/Table/utils/decorators/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-utils-cjs","main":"index.js","module":"./dist/js/components/Table/utils/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-utils-cjs","main":"index.js","module":"./dist/js/components/Table/utils/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-components-cjs","main":"index.js","module":"./dist/js/components/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-components-cjs","main":"index.js","module":"./dist/js/components/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-base-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/components/Table/base/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-base-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/components/Table/base/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-table-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/components/Table/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-table-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/components/Table/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-components-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/components/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-components-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/components/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-deprecated-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-deprecated-deprecated-cjs","main":"index.js","module":"./dist/js/deprecated/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
package/dist/js/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-table-js-cjs","main":"index.js","module":"./dist/js/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-table-js-cjs","main":"index.js","module":"./dist/js/index.js","typings":"index.d.ts","version":"5.0.0-prerelease.8"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-table",
|
|
3
|
-
"version": "5.0.0-prerelease.
|
|
3
|
+
"version": "5.0.0-prerelease.9",
|
|
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",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build:umd": "rollup -c --environment IS_PRODUCTION",
|
|
38
38
|
"build:single:packages": "node ../../scripts/build-single-packages.js --config single-packages.config.json",
|
|
39
|
-
"clean": "rimraf dist",
|
|
40
|
-
"subpaths": "node scripts/
|
|
39
|
+
"clean": "rimraf dist components deprecated",
|
|
40
|
+
"subpaths": "node ../../scripts/exportSubpaths.js --config subpaths.config.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@patternfly/react-core": "^5.0.0-prerelease.
|
|
44
|
-
"@patternfly/react-icons": "^5.0.0-prerelease.
|
|
45
|
-
"@patternfly/react-styles": "^5.0.0-prerelease.
|
|
46
|
-
"@patternfly/react-tokens": "^5.0.0-prerelease.
|
|
43
|
+
"@patternfly/react-core": "^5.0.0-prerelease.9",
|
|
44
|
+
"@patternfly/react-icons": "^5.0.0-prerelease.4",
|
|
45
|
+
"@patternfly/react-styles": "^5.0.0-prerelease.3",
|
|
46
|
+
"@patternfly/react-tokens": "^5.0.0-prerelease.3",
|
|
47
47
|
"lodash": "^4.17.19",
|
|
48
48
|
"tslib": "^2.5.0"
|
|
49
49
|
},
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": "^17 || ^18",
|
|
56
56
|
"react-dom": "^17 || ^18"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "719eebba5d65e5bc2c7075a4ff5057276c62f0c0"
|
|
59
59
|
}
|
|
@@ -4,6 +4,7 @@ cssPrefix: pf-c-table
|
|
|
4
4
|
section: components
|
|
5
5
|
propComponents: ['Table', 'TableHeader', 'TableBody', 'ISortBy']
|
|
6
6
|
ouia: true
|
|
7
|
+
deprecated: true
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
Note: Table lives in its own package at [@patternfly/react-table](https://www.npmjs.com/package/@patternfly/react-table)!
|
package/components/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/components/index.js
DELETED
package/components/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/deprecated/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/deprecated/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/deprecated/index.js
DELETED
package/deprecated/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/deprecated/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-export subpath modules into the package root directory for ease of access.
|
|
3
|
-
*/
|
|
4
|
-
const { readdirSync, readFileSync, writeFileSync, mkdirSync } = require('fs');
|
|
5
|
-
const { resolve, join } = require('path');
|
|
6
|
-
|
|
7
|
-
const isIndex = (fileName) => fileName.match(/^index\./);
|
|
8
|
-
|
|
9
|
-
const updatePaths = (filePath, subPathName) => {
|
|
10
|
-
const contents = readFileSync(filePath, { encoding: 'utf8' });
|
|
11
|
-
if (filePath.includes('.map')) {
|
|
12
|
-
return contents.replaceAll('../../../', `../`);
|
|
13
|
-
} else {
|
|
14
|
-
return contents.replaceAll('./', `../dist/esm/${subPathName}/`);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
['deprecated', 'components'].forEach((subPathName) => {
|
|
19
|
-
const distPath = resolve(__dirname, `../dist/esm/${subPathName}`);
|
|
20
|
-
const distFileNames = readdirSync(distPath);
|
|
21
|
-
const distIndexFileNames = distFileNames.filter((fileName) => isIndex(fileName));
|
|
22
|
-
|
|
23
|
-
const destinationDir = resolve(__dirname, `../${subPathName}`);
|
|
24
|
-
mkdirSync(destinationDir, { recursive: true });
|
|
25
|
-
|
|
26
|
-
distIndexFileNames.forEach((fileName) => {
|
|
27
|
-
const filePath = join(__dirname, '../dist/esm', subPathName, fileName);
|
|
28
|
-
const newFileContent = updatePaths(filePath, subPathName);
|
|
29
|
-
const fileDestination = join(destinationDir, fileName);
|
|
30
|
-
writeFileSync(fileDestination, newFileContent);
|
|
31
|
-
});
|
|
32
|
-
});
|