@patternfly/react-data-view 1.0.0-prerelease.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/dist/cjs/DataView/DataView.d.ts +7 -0
- package/dist/cjs/DataView/DataView.js +11 -0
- package/dist/cjs/DataView/DataView.test.d.ts +1 -0
- package/dist/cjs/DataView/DataView.test.js +15 -0
- package/dist/cjs/DataView/index.d.ts +2 -0
- package/dist/cjs/DataView/index.js +23 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +24 -0
- package/dist/dynamic/DataView/package.json +1 -0
- package/dist/esm/DataView/DataView.d.ts +7 -0
- package/dist/esm/DataView/DataView.js +4 -0
- package/dist/esm/DataView/DataView.test.d.ts +1 -0
- package/dist/esm/DataView/DataView.test.js +10 -0
- package/dist/esm/DataView/index.d.ts +2 -0
- package/dist/esm/DataView/index.js +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -0
- package/generate-fed-package-json.js +77 -0
- package/generate-index.js +44 -0
- package/package.json +57 -0
- package/patternfly-a11y.config.js +28 -0
- package/patternfly-docs/content/extensions/data-view/about-data-view.md +14 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md +27 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataViewExample.tsx +6 -0
- package/patternfly-docs/generated/extensions/data-view/about-data-view/extensions.js +54 -0
- package/patternfly-docs/generated/extensions/data-view/data-view/react.js +66 -0
- package/patternfly-docs/generated/index.js +24 -0
- package/patternfly-docs/pages/index.js +27 -0
- package/patternfly-docs/patternfly-docs.config.js +6 -0
- package/patternfly-docs/patternfly-docs.css.js +8 -0
- package/patternfly-docs/patternfly-docs.routes.js +12 -0
- package/patternfly-docs/patternfly-docs.source.js +24 -0
- package/release.config.js +14 -0
- package/src/DataView/DataView.test.tsx +13 -0
- package/src/DataView/DataView.tsx +15 -0
- package/src/DataView/index.ts +2 -0
- package/src/index.ts +4 -0
- package/tsconfig.cjs.json +8 -0
- package/tsconfig.json +73 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DataView = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
9
|
+
const DataView = ({ text = 'This is Data view' }) => (react_1.default.createElement(react_core_1.Text, null, text));
|
|
10
|
+
exports.DataView = DataView;
|
|
11
|
+
exports.default = exports.DataView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const react_2 = require("@testing-library/react");
|
|
8
|
+
require("@testing-library/jest-dom");
|
|
9
|
+
const DataView_1 = __importDefault(require("./DataView"));
|
|
10
|
+
describe('DataView', () => {
|
|
11
|
+
it('should render data view', () => {
|
|
12
|
+
(0, react_2.render)(react_1.default.createElement(DataView_1.default, null));
|
|
13
|
+
expect(react_2.screen.getByText('This is Data view')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.default = void 0;
|
|
21
|
+
var DataView_1 = require("./DataView");
|
|
22
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(DataView_1).default; } });
|
|
23
|
+
__exportStar(require("./DataView"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this file is autogenerated by generate-index.js, modifying it manually will have no effect
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.DataView = void 0;
|
|
22
|
+
var DataView_1 = require("./DataView");
|
|
23
|
+
Object.defineProperty(exports, "DataView", { enumerable: true, get: function () { return __importDefault(DataView_1).default; } });
|
|
24
|
+
__exportStar(require("./DataView"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"main":"../../cjs/DataView/index.js","module":"../../esm/DataView/index.js","typings":"../../esm/DataView/index.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import DataView from './DataView';
|
|
5
|
+
describe('DataView', () => {
|
|
6
|
+
it('should render data view', () => {
|
|
7
|
+
render(React.createElement(DataView, null));
|
|
8
|
+
expect(screen.getByText('This is Data view')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const fse = require('fs-extra');
|
|
2
|
+
const glob = require('glob');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const root = process.cwd();
|
|
6
|
+
|
|
7
|
+
const sourceFiles = glob
|
|
8
|
+
.sync(`${root}/src/*/`)
|
|
9
|
+
.map((name) => name.replace(/\/$/, ''));
|
|
10
|
+
|
|
11
|
+
const indexTypings = glob.sync(`${root}/src/index.d.ts`);
|
|
12
|
+
|
|
13
|
+
const ENV_AGNOSTIC_ROOT = `${root}/dist/dynamic`
|
|
14
|
+
|
|
15
|
+
async function copyTypings(files, dest) {
|
|
16
|
+
const cmds = [];
|
|
17
|
+
files.forEach((file) => {
|
|
18
|
+
const fileName = file.split('/').pop();
|
|
19
|
+
cmds.push(fse.copyFile(file, `${dest}/${fileName}`));
|
|
20
|
+
});
|
|
21
|
+
return Promise.all(cmds);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function createPackage(file) {
|
|
25
|
+
const fileName = file.split('/').pop();
|
|
26
|
+
const esmSource = glob.sync(`${root}/dist/esm/${fileName}/**/index.js`)[0];
|
|
27
|
+
const cjsSource = glob.sync(`${root}/dist/cjs/${fileName}/**/index.js`)[0];
|
|
28
|
+
const typingsSource = glob.sync(`${root}/dist/esm/${fileName}/**/index.d.ts`)[0]
|
|
29
|
+
/**
|
|
30
|
+
* Prevent creating package.json for directories with no JS files (like CSS directories)
|
|
31
|
+
*/
|
|
32
|
+
if (!esmSource) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const destDir = path.resolve(`${ENV_AGNOSTIC_ROOT}`, fileName)
|
|
37
|
+
const destFile = `${destDir}/package.json`;
|
|
38
|
+
|
|
39
|
+
// ensure the directory exists
|
|
40
|
+
fse.ensureDirSync(destDir)
|
|
41
|
+
|
|
42
|
+
const esmRelative = path.relative(file, esmSource).replace('/dist', '');
|
|
43
|
+
const cjsRelative = path.relative(file, cjsSource).replace('/dist', '');
|
|
44
|
+
const tsRelative = path.relative(file, typingsSource).replace('/dist', '')
|
|
45
|
+
const content = {
|
|
46
|
+
main: cjsRelative,
|
|
47
|
+
module: esmRelative,
|
|
48
|
+
};
|
|
49
|
+
const typings = glob.sync(`${root}/src/${fileName}/*.d.ts`);
|
|
50
|
+
const cmds = [];
|
|
51
|
+
content.typings = tsRelative;
|
|
52
|
+
cmds.push(copyTypings(typings, `${root}/dist/${fileName}`));
|
|
53
|
+
cmds.push(fse.writeJSON(destFile, content));
|
|
54
|
+
return Promise.all(cmds);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function generatePackages(files) {
|
|
58
|
+
// ensure the dynamic root exists
|
|
59
|
+
fse.ensureDirSync(path.resolve(ENV_AGNOSTIC_ROOT))
|
|
60
|
+
const cmds = files.map((file) => createPackage(file));
|
|
61
|
+
return Promise.all(cmds);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function run(files) {
|
|
65
|
+
try {
|
|
66
|
+
await generatePackages(files);
|
|
67
|
+
if (indexTypings.length === 1) {
|
|
68
|
+
copyTypings(indexTypings, root);
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
// eslint-disable-next-line no-console
|
|
72
|
+
console.error(error);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
run(sourceFiles);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const fse = require('fs-extra');
|
|
2
|
+
const glob = require('glob');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const root = process.cwd();
|
|
6
|
+
|
|
7
|
+
const ENV_AGNOSTIC_ROOT = `${root}/src`
|
|
8
|
+
|
|
9
|
+
const sourceFiles = glob.sync(path.resolve(__dirname, './src/*/index.ts'))
|
|
10
|
+
|
|
11
|
+
async function generateIndex(files) {
|
|
12
|
+
// ensure the dynamic root exists
|
|
13
|
+
fse.ensureDirSync(path.resolve(ENV_AGNOSTIC_ROOT));
|
|
14
|
+
|
|
15
|
+
const destFile = `${ENV_AGNOSTIC_ROOT}/index.ts`;
|
|
16
|
+
|
|
17
|
+
const stream = fse.createWriteStream(destFile);
|
|
18
|
+
stream.once('open', () => {
|
|
19
|
+
stream.write('// this file is autogenerated by generate-index.js, modifying it manually will have no effect\n');
|
|
20
|
+
|
|
21
|
+
files.forEach(file => {
|
|
22
|
+
const name = file.replace('/index.ts', '').split('/').pop();
|
|
23
|
+
stream.write(`\nexport { default as ${name} } from './${name}';\n`);
|
|
24
|
+
stream.write(`export * from './${name}';\n`);
|
|
25
|
+
});
|
|
26
|
+
stream.end();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return Promise.resolve();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function run(files) {
|
|
33
|
+
try {
|
|
34
|
+
await generateIndex(files);
|
|
35
|
+
|
|
36
|
+
} catch (error) {
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.error(error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
run(sourceFiles);
|
|
44
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@patternfly/react-data-view",
|
|
3
|
+
"version": "1.0.0-prerelease.1",
|
|
4
|
+
"description": "Data view used for Red Hat projects.",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "npm run build:index && npm run build:js && npm run build:esm && npm run build:fed:packages",
|
|
9
|
+
"build:watch": "npm run build:js && npm run build:esm -- --watch && npm run build:fed:packages -- --watch",
|
|
10
|
+
"build:esm": "tsc --build --verbose ./tsconfig.json",
|
|
11
|
+
"build:fed:packages": "node generate-fed-package-json.js",
|
|
12
|
+
"build:js": "tsc -p tsconfig.cjs.json",
|
|
13
|
+
"build:index": "node generate-index.js",
|
|
14
|
+
"clean": "rimraf dist",
|
|
15
|
+
"docs:develop": "pf-docs-framework start",
|
|
16
|
+
"docs:build": "pf-docs-framework build all --output public",
|
|
17
|
+
"docs:serve": "pf-docs-framework serve public --port 5001",
|
|
18
|
+
"docs:screenshots": "pf-docs-framework screenshots --urlPrefix http://localhost:5001",
|
|
19
|
+
"test:a11y": "patternfly-a11y --config patternfly-a11y.config",
|
|
20
|
+
"serve:a11y": "serve coverage"
|
|
21
|
+
},
|
|
22
|
+
"repository": "git+https://github.com/patternfly/react-data-view.git",
|
|
23
|
+
"author": "Red Hat",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/patternfly/react-data-view/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/patternfly/react-data-view#readme",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"tag": "prerelease"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@patternfly/react-core": "^5.1.2",
|
|
35
|
+
"@patternfly/react-icons": "^5.1.2",
|
|
36
|
+
"react-jss": "^10.10.0",
|
|
37
|
+
"clsx": "^2.1.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "^17 || ^18",
|
|
41
|
+
"react-dom": "^17 || ^18"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@patternfly/patternfly-a11y": "^4.3.1",
|
|
45
|
+
"@patternfly/documentation-framework": "^2.0.0-alpha.57",
|
|
46
|
+
"@patternfly/patternfly": "^5.1.0",
|
|
47
|
+
"@types/react": "^18.2.61",
|
|
48
|
+
"@types/react-dom": "^18.2.19",
|
|
49
|
+
"@types/react-router-dom": "^5.3.3",
|
|
50
|
+
"react": "^18.2.0",
|
|
51
|
+
"react-dom": "^18.2.0",
|
|
52
|
+
"react-router": "^6.22.2",
|
|
53
|
+
"react-router-dom": "^6.22.2",
|
|
54
|
+
"rimraf": "^2.7.1",
|
|
55
|
+
"typescript": "^5.3.3"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { fullscreenRoutes } = require('@patternfly/documentation-framework/routes');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wait for a selector before running axe
|
|
5
|
+
*
|
|
6
|
+
* @param page page from puppeteer
|
|
7
|
+
*/
|
|
8
|
+
async function waitFor(page) {
|
|
9
|
+
await page.waitForSelector('#root > *');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const urls = Object.keys(fullscreenRoutes)
|
|
13
|
+
.map((key) => (fullscreenRoutes[key].isFullscreenOnly ? key : fullscreenRoutes[key].path.replace(/\/react$/, '')))
|
|
14
|
+
.reduce((result, item) => (result.includes(item) ? result : [ ...result, item ]), []);
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
prefix: 'http://localhost:5001',
|
|
18
|
+
waitFor,
|
|
19
|
+
crawl: false,
|
|
20
|
+
urls: [ ...urls ],
|
|
21
|
+
ignoreRules: [
|
|
22
|
+
'color-contrast',
|
|
23
|
+
'landmark-no-duplicate-main',
|
|
24
|
+
'landmark-main-is-top-level',
|
|
25
|
+
'scrollable-region-focusable'
|
|
26
|
+
].join(','),
|
|
27
|
+
ignoreIncomplete: true
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
section: extensions
|
|
3
|
+
subsection: Data view
|
|
4
|
+
id: About data view
|
|
5
|
+
sortValue: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Data view lives in its own package [`@patternfly/react-data-view`](https://www.npmjs.com/package/@patternfly/react-data-view)
|
|
9
|
+
|
|
10
|
+
# Data view
|
|
11
|
+
|
|
12
|
+
The data view extension contains implementation of the data view component allowing to display record data in a configured layout.
|
|
13
|
+
|
|
14
|
+
If you notice a bug or have a suggestion for the data view, feel free to file an issue in our [GitHub repository](https://github.com/patternfly/react-data-view/issues)! Please make sure to check if there is already a pre-existing issue before creating a new issue.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Sidenav top-level section
|
|
3
|
+
# should be the same for all markdown files
|
|
4
|
+
section: extensions
|
|
5
|
+
subsection: Data view
|
|
6
|
+
# Sidenav secondary level section
|
|
7
|
+
# should be the same for all markdown files
|
|
8
|
+
id: Data view
|
|
9
|
+
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
10
|
+
source: react
|
|
11
|
+
# If you use typescript, the name of the interface to display props for
|
|
12
|
+
# These are found through the sourceProps function provided in patternfly-docs.source.js
|
|
13
|
+
propComponents: ['DataView']
|
|
14
|
+
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
18
|
+
|
|
19
|
+
The **data view** component renders record data in a configured layout.
|
|
20
|
+
|
|
21
|
+
### Basic example
|
|
22
|
+
|
|
23
|
+
A blank example of the data view layout.
|
|
24
|
+
|
|
25
|
+
```js file="./DataViewExample.tsx"
|
|
26
|
+
|
|
27
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
|
|
4
|
+
const pageData = {
|
|
5
|
+
"id": "About data view",
|
|
6
|
+
"section": "extensions",
|
|
7
|
+
"subsection": "Data view",
|
|
8
|
+
"deprecated": false,
|
|
9
|
+
"beta": false,
|
|
10
|
+
"demo": false,
|
|
11
|
+
"newImplementationLink": false,
|
|
12
|
+
"source": "extensions",
|
|
13
|
+
"tabName": null,
|
|
14
|
+
"slug": "/extensions/data-view/about-data-view/extensions",
|
|
15
|
+
"sourceLink": "https://github.com/patternfly/patternfly-org/blob/main/packages/module/patternfly-docs/content/extensions/data-view/about-data-view.md",
|
|
16
|
+
"relPath": "packages/module/patternfly-docs/content/extensions/data-view/about-data-view.md",
|
|
17
|
+
"sortValue": 1
|
|
18
|
+
};
|
|
19
|
+
pageData.relativeImports = {
|
|
20
|
+
|
|
21
|
+
};
|
|
22
|
+
pageData.examples = {
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Component = () => (
|
|
27
|
+
<React.Fragment>
|
|
28
|
+
<p {...{"className":"ws-p"}}>
|
|
29
|
+
{`Data view lives in its own package `}
|
|
30
|
+
<PatternflyThemeLink {...{"to":"https://www.npmjs.com/package/@patternfly/react-data-view"}}>
|
|
31
|
+
<code {...{"className":"ws-code"}}>
|
|
32
|
+
{`@patternfly/react-data-view`}
|
|
33
|
+
</code>
|
|
34
|
+
</PatternflyThemeLink>
|
|
35
|
+
</p>
|
|
36
|
+
<AutoLinkHeader {...{"id":"data-view","size":"h1","className":"ws-title ws-h1"}}>
|
|
37
|
+
{`Data view`}
|
|
38
|
+
</AutoLinkHeader>
|
|
39
|
+
<p {...{"className":"ws-p"}}>
|
|
40
|
+
{`The data view extension contains implementation of the data view component allowing to display record data in a configured layout.`}
|
|
41
|
+
</p>
|
|
42
|
+
<p {...{"className":"ws-p"}}>
|
|
43
|
+
{`If you notice a bug or have a suggestion for the data view, feel free to file an issue in our `}
|
|
44
|
+
<PatternflyThemeLink {...{"to":"https://github.com/patternfly/react-data-view/issues"}}>
|
|
45
|
+
{`GitHub repository`}
|
|
46
|
+
</PatternflyThemeLink>
|
|
47
|
+
{`! Please make sure to check if there is already a pre-existing issue before creating a new issue.`}
|
|
48
|
+
</p>
|
|
49
|
+
</React.Fragment>
|
|
50
|
+
);
|
|
51
|
+
Component.displayName = 'ExtensionsDataViewAboutDataViewExtensionsDocs';
|
|
52
|
+
Component.pageData = pageData;
|
|
53
|
+
|
|
54
|
+
export default Component;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
4
|
+
const pageData = {
|
|
5
|
+
"id": "Data view",
|
|
6
|
+
"section": "extensions",
|
|
7
|
+
"subsection": "Data view",
|
|
8
|
+
"deprecated": false,
|
|
9
|
+
"beta": false,
|
|
10
|
+
"demo": false,
|
|
11
|
+
"newImplementationLink": false,
|
|
12
|
+
"source": "react",
|
|
13
|
+
"tabName": null,
|
|
14
|
+
"slug": "/extensions/data-view/data-view/react",
|
|
15
|
+
"sourceLink": "https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md",
|
|
16
|
+
"relPath": "packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md",
|
|
17
|
+
"propComponents": [
|
|
18
|
+
{
|
|
19
|
+
"name": "DataView",
|
|
20
|
+
"description": "",
|
|
21
|
+
"props": [
|
|
22
|
+
{
|
|
23
|
+
"name": "text",
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Example prop",
|
|
26
|
+
"defaultValue": "'This is Data view'"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"examples": [
|
|
32
|
+
"Basic example"
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
pageData.liveContext = {
|
|
36
|
+
DataView
|
|
37
|
+
};
|
|
38
|
+
pageData.relativeImports = {
|
|
39
|
+
|
|
40
|
+
};
|
|
41
|
+
pageData.examples = {
|
|
42
|
+
'Basic example': props =>
|
|
43
|
+
<Example {...pageData} {...props} {...{"code":"import React from 'react';\nimport DataView from '@patternfly/react-data-view/dist/dynamic/DataView';\n\nexport const BasicExample: React.FunctionComponent = () => (\n <DataView />\n);\n","title":"Basic example","lang":"js"}}>
|
|
44
|
+
|
|
45
|
+
<p {...{"className":"ws-p"}}>
|
|
46
|
+
{`A blank example of the data view layout.`}
|
|
47
|
+
</p>
|
|
48
|
+
</Example>
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const Component = () => (
|
|
52
|
+
<React.Fragment>
|
|
53
|
+
<p {...{"className":"ws-p"}}>
|
|
54
|
+
{`The `}
|
|
55
|
+
<strong>
|
|
56
|
+
{`data view`}
|
|
57
|
+
</strong>
|
|
58
|
+
{` component renders record data in a configured layout.`}
|
|
59
|
+
</p>
|
|
60
|
+
{React.createElement(pageData.examples["Basic example"])}
|
|
61
|
+
</React.Fragment>
|
|
62
|
+
);
|
|
63
|
+
Component.displayName = 'ExtensionsDataViewDataViewReactDocs';
|
|
64
|
+
Component.pageData = pageData;
|
|
65
|
+
|
|
66
|
+
export default Component;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'/extensions/data-view/about-data-view/extensions': {
|
|
3
|
+
id: "About data view",
|
|
4
|
+
title: "About data view",
|
|
5
|
+
toc: [],
|
|
6
|
+
section: "extensions",
|
|
7
|
+
subsection: "Data view",
|
|
8
|
+
source: "extensions",
|
|
9
|
+
tabName: null,
|
|
10
|
+
sortValue: 1,
|
|
11
|
+
Component: () => import(/* webpackChunkName: "extensions/data-view/about-data-view/extensions/index" */ './extensions/data-view/about-data-view/extensions')
|
|
12
|
+
},
|
|
13
|
+
'/extensions/data-view/data-view/react': {
|
|
14
|
+
id: "Data view",
|
|
15
|
+
title: "Data view",
|
|
16
|
+
toc: [[{"text":"Basic example"}]],
|
|
17
|
+
examples: ["Basic example"],
|
|
18
|
+
section: "extensions",
|
|
19
|
+
subsection: "Data view",
|
|
20
|
+
source: "react",
|
|
21
|
+
tabName: null,
|
|
22
|
+
Component: () => import(/* webpackChunkName: "extensions/data-view/data-view/react/index" */ './extensions/data-view/data-view/react')
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Title, PageSection } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
const centerStyle = {
|
|
5
|
+
flexGrow: 1,
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
justifyContent: 'center'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const IndexPage = () => {
|
|
12
|
+
return (
|
|
13
|
+
<PageSection variant="light" style={centerStyle}>
|
|
14
|
+
<div style={{ flex: 'none', textAlign: 'center' }}>
|
|
15
|
+
<Title size="4xl" headingLevel="h1">
|
|
16
|
+
My extension docs
|
|
17
|
+
</Title>
|
|
18
|
+
<Title size="2xl" headingLevel="h2">
|
|
19
|
+
{'Hi people!'}
|
|
20
|
+
</Title>
|
|
21
|
+
<p>Welcome to my extension docs.</p>
|
|
22
|
+
</div>
|
|
23
|
+
</PageSection>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default IndexPage;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This module is shared between NodeJS and babelled ES5
|
|
2
|
+
const isClient = Boolean(process.env.NODE_ENV);
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
'/': {
|
|
6
|
+
SyncComponent: isClient && require('./pages/index').default
|
|
7
|
+
},
|
|
8
|
+
'/404': {
|
|
9
|
+
SyncComponent: isClient && require('@patternfly/documentation-framework/pages/404/index').default,
|
|
10
|
+
title: '404 Error'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = (sourceMD, sourceProps) => {
|
|
4
|
+
// Parse source content for props so that we can display them
|
|
5
|
+
const propsIgnore = [ '**/*.test.tsx', '**/examples/*.tsx' ];
|
|
6
|
+
const extensionPath = path.join(__dirname, '../src');
|
|
7
|
+
sourceProps(path.join(extensionPath, '/**/*.tsx'), propsIgnore);
|
|
8
|
+
|
|
9
|
+
// Parse md files
|
|
10
|
+
const contentBase = path.join(__dirname, './content');
|
|
11
|
+
sourceMD(path.join(contentBase, 'extensions/**/*.md'), 'extensions');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
If you want to parse content from node_modules instead of providing a relative/absolute path,
|
|
15
|
+
you can do something similar to this:
|
|
16
|
+
const extensionPath = require
|
|
17
|
+
.resolve('@patternfly/react-log-viewer/package.json')
|
|
18
|
+
.replace('package.json', 'src');
|
|
19
|
+
sourceProps(path.join(extensionPath, '/**\/*.tsx'), propsIgnore);
|
|
20
|
+
sourceMD(path.join(extensionPath, '../patternfly-docs/**\/examples/*.md'), 'react');
|
|
21
|
+
sourceMD(path.join(extensionPath, '../patternfly-docs/**\/demos/*.md'), 'react-demos');
|
|
22
|
+
sourceMD(path.join(extensionPath, '../patternfly-docs/**\/design-guidelines/*.md'), 'design-guidelines');
|
|
23
|
+
*/
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
branches: [ 'do-not-delete', { name: 'main', channel: 'prerelease', prerelease: 'prerelease' } ],
|
|
3
|
+
analyzeCommits: {
|
|
4
|
+
preset: 'angular'
|
|
5
|
+
},
|
|
6
|
+
plugins: [
|
|
7
|
+
'@semantic-release/commit-analyzer',
|
|
8
|
+
'@semantic-release/release-notes-generator',
|
|
9
|
+
'@semantic-release/github',
|
|
10
|
+
'@semantic-release/npm'
|
|
11
|
+
],
|
|
12
|
+
tagFormat: 'prerelease-v${version}',
|
|
13
|
+
dryRun: false
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom'
|
|
4
|
+
import DataView from './DataView';
|
|
5
|
+
|
|
6
|
+
describe('DataView', () => {
|
|
7
|
+
|
|
8
|
+
it('should render data view', () => {
|
|
9
|
+
render(<DataView />);
|
|
10
|
+
expect(screen.getByText('This is Data view')).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export interface DataViewProps {
|
|
5
|
+
/** Example prop */
|
|
6
|
+
text?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const DataView: React.FunctionComponent<DataViewProps> = ({
|
|
10
|
+
text = 'This is Data view'
|
|
11
|
+
}: DataViewProps) => (
|
|
12
|
+
<Text>{text}</Text>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default DataView;
|
package/src/index.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Basic Options */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
"target": "es2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
|
|
8
|
+
"module": "es2015" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
|
9
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
+
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */,
|
|
13
|
+
"declaration": true /* Generates corresponding '.d.ts' file. */,
|
|
14
|
+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
+
"outDir": "./dist/esm" /* Redirect output structure to the directory. */,
|
|
18
|
+
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
|
19
|
+
// "composite": true, /* Enable project compilation */
|
|
20
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
21
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
22
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
23
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
24
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
25
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
26
|
+
|
|
27
|
+
/* Strict Type-Checking Options */
|
|
28
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
29
|
+
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
30
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
31
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
32
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
33
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
34
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
35
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
36
|
+
|
|
37
|
+
/* Additional Checks */
|
|
38
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
39
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
40
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
41
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
42
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
43
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
|
|
44
|
+
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
|
45
|
+
|
|
46
|
+
/* Module Resolution Options */
|
|
47
|
+
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
48
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
49
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
51
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
52
|
+
// "types": [], /* Type declaration files to be included in compilation. */
|
|
53
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
54
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
55
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
56
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
57
|
+
|
|
58
|
+
/* Source Map Options */
|
|
59
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
60
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
62
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
63
|
+
|
|
64
|
+
/* Experimental Options */
|
|
65
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
66
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
67
|
+
|
|
68
|
+
/* Advanced Options */
|
|
69
|
+
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
|
70
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
|
+
},
|
|
72
|
+
"include": ["./src/*", "./src/**/*", "./cypress/**/*"],
|
|
73
|
+
}
|