@patternfly/react-data-view 1.0.0-prerelease.1 → 1.0.0-prerelease.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DataView/DataView.d.ts +5 -3
- package/dist/cjs/DataView/DataView.js +15 -1
- package/dist/cjs/DataView/DataView.test.js +3 -2
- package/dist/cjs/DataViewToolbar/DataViewToolbar.d.ts +11 -0
- package/dist/cjs/DataViewToolbar/DataViewToolbar.js +28 -0
- package/dist/cjs/DataViewToolbar/index.d.ts +2 -0
- package/dist/cjs/DataViewToolbar/index.js +23 -0
- package/dist/cjs/Hooks/index.d.ts +1 -0
- package/dist/cjs/Hooks/index.js +17 -0
- package/dist/cjs/Hooks/useDataViewPagination.d.ts +4 -0
- package/dist/cjs/Hooks/useDataViewPagination.js +2 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +6 -2
- package/dist/dynamic/DataViewToolbar/package.json +1 -0
- package/dist/dynamic/Hooks/package.json +1 -0
- package/dist/esm/DataView/DataView.d.ts +5 -3
- package/dist/esm/DataView/DataView.js +16 -2
- package/dist/esm/DataView/DataView.test.js +3 -2
- package/dist/esm/DataViewToolbar/DataViewToolbar.d.ts +11 -0
- package/dist/esm/DataViewToolbar/DataViewToolbar.js +21 -0
- package/dist/esm/DataViewToolbar/index.d.ts +2 -0
- package/dist/esm/DataViewToolbar/index.js +2 -0
- package/dist/esm/Hooks/index.d.ts +1 -0
- package/dist/esm/Hooks/index.js +1 -0
- package/dist/esm/Hooks/useDataViewPagination.d.ts +4 -0
- package/dist/esm/Hooks/useDataViewPagination.js +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/generate-index.js +2 -1
- package/package.json +15 -14
- package/patternfly-a11y.config.js +2 -1
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md +14 -5
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataViewLayoutExample.tsx +17 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataViewPredefinedLayoutExample.tsx +24 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataViewToolbar/DataViewToolbar.md +27 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataViewToolbar/DataViewToolbarExample.tsx +7 -0
- package/patternfly-docs/content/extensions/data-view/examples/Hooks/Hooks.md +23 -0
- package/patternfly-docs/pages/index.js +1 -1
- package/src/DataView/DataView.test.tsx +2 -2
- package/src/DataView/DataView.tsx +15 -8
- package/src/DataViewToolbar/DataViewToolbar.tsx +27 -0
- package/src/DataViewToolbar/index.ts +2 -0
- package/src/Hooks/index.ts +1 -0
- package/src/Hooks/useDataViewPagination.ts +4 -0
- package/src/index.ts +4 -0
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataViewExample.tsx +0 -6
- package/patternfly-docs/generated/extensions/data-view/about-data-view/extensions.js +0 -54
- package/patternfly-docs/generated/extensions/data-view/data-view/react.js +0 -66
- package/patternfly-docs/generated/index.js +0 -24
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface DataViewProps {
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/** Content rendered inside the data view */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Custom OUIA ID */
|
|
6
|
+
ouiaId?: string;
|
|
5
7
|
}
|
|
6
|
-
export declare const DataView: React.
|
|
8
|
+
export declare const DataView: React.FC<DataViewProps>;
|
|
7
9
|
export default DataView;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -6,6 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
17
|
exports.DataView = void 0;
|
|
7
18
|
const react_1 = __importDefault(require("react"));
|
|
8
19
|
const react_core_1 = require("@patternfly/react-core");
|
|
9
|
-
const DataView = (
|
|
20
|
+
const DataView = (_a) => {
|
|
21
|
+
var { children, ouiaId = 'DataView' } = _a, props = __rest(_a, ["children", "ouiaId"]);
|
|
22
|
+
return (react_1.default.createElement(react_core_1.Stack, Object.assign({ "data-ouia-component-id": `${ouiaId}-stack}` }, props), react_1.default.Children.map(children, (child, index) => (react_1.default.createElement(react_core_1.StackItem, { "data-ouia-component-id": `${ouiaId}-stack-item-${index}` }, child)))));
|
|
23
|
+
};
|
|
10
24
|
exports.DataView = DataView;
|
|
11
25
|
exports.default = exports.DataView;
|
|
@@ -9,7 +9,8 @@ require("@testing-library/jest-dom");
|
|
|
9
9
|
const DataView_1 = __importDefault(require("./DataView"));
|
|
10
10
|
describe('DataView', () => {
|
|
11
11
|
it('should render data view', () => {
|
|
12
|
-
(0, react_2.render)(react_1.default.createElement(DataView_1.default, null
|
|
13
|
-
|
|
12
|
+
(0, react_2.render)(react_1.default.createElement(DataView_1.default, null,
|
|
13
|
+
react_1.default.createElement(react_1.default.Fragment, null, "Data view content")));
|
|
14
|
+
expect(react_2.screen.getByText('Data view content')).toBeInTheDocument();
|
|
14
15
|
});
|
|
15
16
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DataViewToolbarProps {
|
|
3
|
+
/** Toolbar className */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Custom OUIA ID */
|
|
6
|
+
ouiaId?: string;
|
|
7
|
+
/** React component to display pagination */
|
|
8
|
+
pagination?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const DataViewToolbar: React.FC<React.PropsWithChildren<DataViewToolbarProps>>;
|
|
11
|
+
export default DataViewToolbar;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.DataViewToolbar = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
20
|
+
const DataViewToolbar = (_a) => {
|
|
21
|
+
var { className, ouiaId = 'DataViewToolbar', pagination, children } = _a, props = __rest(_a, ["className", "ouiaId", "pagination", "children"]);
|
|
22
|
+
return (react_1.default.createElement(react_core_1.Toolbar, Object.assign({ ouiaId: ouiaId, className: className }, props),
|
|
23
|
+
react_1.default.createElement(react_core_1.ToolbarContent, null,
|
|
24
|
+
pagination && (react_1.default.createElement(react_core_1.ToolbarItem, { variant: react_core_1.ToolbarItemVariant.pagination }, pagination)),
|
|
25
|
+
children)));
|
|
26
|
+
};
|
|
27
|
+
exports.DataViewToolbar = DataViewToolbar;
|
|
28
|
+
exports.default = exports.DataViewToolbar;
|
|
@@ -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 DataViewToolbar_1 = require("./DataViewToolbar");
|
|
22
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(DataViewToolbar_1).default; } });
|
|
23
|
+
__exportStar(require("./DataViewToolbar"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDataViewPagination';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useDataViewPagination"), exports);
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// this file is autogenerated by generate-index.js, modifying it manually will have no effect
|
|
3
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
3
|
if (k2 === undefined) k2 = k;
|
|
5
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -18,7 +17,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
18
|
};
|
|
20
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.DataView = void 0;
|
|
20
|
+
exports.DataView = exports.DataViewToolbar = void 0;
|
|
21
|
+
// this file is autogenerated by generate-index.js, modifying it manually will have no effect
|
|
22
|
+
__exportStar(require("./Hooks"), exports);
|
|
23
|
+
var DataViewToolbar_1 = require("./DataViewToolbar");
|
|
24
|
+
Object.defineProperty(exports, "DataViewToolbar", { enumerable: true, get: function () { return __importDefault(DataViewToolbar_1).default; } });
|
|
25
|
+
__exportStar(require("./DataViewToolbar"), exports);
|
|
22
26
|
var DataView_1 = require("./DataView");
|
|
23
27
|
Object.defineProperty(exports, "DataView", { enumerable: true, get: function () { return __importDefault(DataView_1).default; } });
|
|
24
28
|
__exportStar(require("./DataView"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"main":"../../cjs/DataViewToolbar/index.js","module":"../../esm/DataViewToolbar/index.js","typings":"../../esm/DataViewToolbar/index.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"main":"../../cjs/Hooks/index.js","module":"../../esm/Hooks/index.js","typings":"../../esm/Hooks/index.d.ts"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface DataViewProps {
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/** Content rendered inside the data view */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Custom OUIA ID */
|
|
6
|
+
ouiaId?: string;
|
|
5
7
|
}
|
|
6
|
-
export declare const DataView: React.
|
|
8
|
+
export declare const DataView: React.FC<DataViewProps>;
|
|
7
9
|
export default DataView;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export const DataView = (
|
|
13
|
+
import { Stack, StackItem } from '@patternfly/react-core';
|
|
14
|
+
export const DataView = (_a) => {
|
|
15
|
+
var { children, ouiaId = 'DataView' } = _a, props = __rest(_a, ["children", "ouiaId"]);
|
|
16
|
+
return (React.createElement(Stack, Object.assign({ "data-ouia-component-id": `${ouiaId}-stack}` }, props), React.Children.map(children, (child, index) => (React.createElement(StackItem, { "data-ouia-component-id": `${ouiaId}-stack-item-${index}` }, child)))));
|
|
17
|
+
};
|
|
4
18
|
export default DataView;
|
|
@@ -4,7 +4,8 @@ import '@testing-library/jest-dom';
|
|
|
4
4
|
import DataView from './DataView';
|
|
5
5
|
describe('DataView', () => {
|
|
6
6
|
it('should render data view', () => {
|
|
7
|
-
render(React.createElement(DataView, null
|
|
8
|
-
|
|
7
|
+
render(React.createElement(DataView, null,
|
|
8
|
+
React.createElement(React.Fragment, null, "Data view content")));
|
|
9
|
+
expect(screen.getByText('Data view content')).toBeInTheDocument();
|
|
9
10
|
});
|
|
10
11
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DataViewToolbarProps {
|
|
3
|
+
/** Toolbar className */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Custom OUIA ID */
|
|
6
|
+
ouiaId?: string;
|
|
7
|
+
/** React component to display pagination */
|
|
8
|
+
pagination?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const DataViewToolbar: React.FC<React.PropsWithChildren<DataViewToolbarProps>>;
|
|
11
|
+
export default DataViewToolbar;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Toolbar, ToolbarContent, ToolbarItem, ToolbarItemVariant } from '@patternfly/react-core';
|
|
14
|
+
export const DataViewToolbar = (_a) => {
|
|
15
|
+
var { className, ouiaId = 'DataViewToolbar', pagination, children } = _a, props = __rest(_a, ["className", "ouiaId", "pagination", "children"]);
|
|
16
|
+
return (React.createElement(Toolbar, Object.assign({ ouiaId: ouiaId, className: className }, props),
|
|
17
|
+
React.createElement(ToolbarContent, null,
|
|
18
|
+
pagination && (React.createElement(ToolbarItem, { variant: ToolbarItemVariant.pagination }, pagination)),
|
|
19
|
+
children)));
|
|
20
|
+
};
|
|
21
|
+
export default DataViewToolbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDataViewPagination';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDataViewPagination';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
// this file is autogenerated by generate-index.js, modifying it manually will have no effect
|
|
2
|
+
export * from './Hooks';
|
|
3
|
+
export { default as DataViewToolbar } from './DataViewToolbar';
|
|
4
|
+
export * from './DataViewToolbar';
|
|
2
5
|
export { default as DataView } from './DataView';
|
|
3
6
|
export * from './DataView';
|
package/generate-index.js
CHANGED
|
@@ -20,7 +20,8 @@ async function generateIndex(files) {
|
|
|
20
20
|
|
|
21
21
|
files.forEach(file => {
|
|
22
22
|
const name = file.replace('/index.ts', '').split('/').pop();
|
|
23
|
-
|
|
23
|
+
// do not generate default exports for Hooks/
|
|
24
|
+
name !== 'Hooks' && stream.write(`\nexport { default as ${name} } from './${name}';\n`);
|
|
24
25
|
stream.write(`export * from './${name}';\n`);
|
|
25
26
|
});
|
|
26
27
|
stream.end();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-data-view",
|
|
3
|
-
"version": "1.0.0-prerelease.
|
|
3
|
+
"version": "1.0.0-prerelease.3",
|
|
4
4
|
"description": "Data view used for Red Hat projects.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,10 +31,11 @@
|
|
|
31
31
|
"tag": "prerelease"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@patternfly/react-core": "^
|
|
35
|
-
"@patternfly/react-icons": "^
|
|
34
|
+
"@patternfly/react-core": "^6.0.0-alpha.55",
|
|
35
|
+
"@patternfly/react-icons": "^6.0.0-alpha.20",
|
|
36
|
+
"@patternfly/react-table": "^6.0.0-alpha.55",
|
|
36
37
|
"react-jss": "^10.10.0",
|
|
37
|
-
"clsx": "^2.1.
|
|
38
|
+
"clsx": "^2.1.1"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"react": "^17 || ^18",
|
|
@@ -42,16 +43,16 @@
|
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@patternfly/patternfly-a11y": "^4.3.1",
|
|
45
|
-
"@patternfly/documentation-framework": "^
|
|
46
|
-
"@patternfly/patternfly": "^
|
|
47
|
-
"@types/react": "^18.
|
|
48
|
-
"@types/react-dom": "^18.
|
|
46
|
+
"@patternfly/documentation-framework": "^6.0.0-alpha.22",
|
|
47
|
+
"@patternfly/patternfly": "^6.0.0-alpha.117",
|
|
48
|
+
"@types/react": "^18.3.1",
|
|
49
|
+
"@types/react-dom": "^18.3.0",
|
|
49
50
|
"@types/react-router-dom": "^5.3.3",
|
|
50
|
-
"react": "^18.
|
|
51
|
-
"react-dom": "^18.
|
|
52
|
-
"react-router": "^6.
|
|
53
|
-
"react-router-dom": "^6.
|
|
54
|
-
"rimraf": "^
|
|
55
|
-
"typescript": "^5.
|
|
51
|
+
"react": "^18.3.1",
|
|
52
|
+
"react-dom": "^18.3.1",
|
|
53
|
+
"react-router": "^6.23.0",
|
|
54
|
+
"react-router-dom": "^6.23.0",
|
|
55
|
+
"rimraf": "^5.0.5",
|
|
56
|
+
"typescript": "^5.4.5"
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -5,7 +5,7 @@ section: extensions
|
|
|
5
5
|
subsection: Data view
|
|
6
6
|
# Sidenav secondary level section
|
|
7
7
|
# should be the same for all markdown files
|
|
8
|
-
id: Data view
|
|
8
|
+
id: Data view layout
|
|
9
9
|
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
10
10
|
source: react
|
|
11
11
|
# If you use typescript, the name of the interface to display props for
|
|
@@ -13,15 +13,24 @@ source: react
|
|
|
13
13
|
propComponents: ['DataView']
|
|
14
14
|
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md
|
|
15
15
|
---
|
|
16
|
-
|
|
16
|
+
import { Pagination } from '@patternfly/react-core';
|
|
17
17
|
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
18
|
+
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
18
19
|
|
|
19
20
|
The **data view** component renders record data in a configured layout.
|
|
20
21
|
|
|
21
|
-
###
|
|
22
|
+
### Layout example
|
|
23
|
+
|
|
24
|
+
Data view is expected to consist of header, data part and footer stacked below each other and passed as `children`.
|
|
25
|
+
|
|
26
|
+
```js file="./DataViewLayoutExample.tsx"
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Predefined layout components
|
|
22
31
|
|
|
23
|
-
|
|
32
|
+
You can make use of the predefined layout components to display a default header and footer. See [data view toolbar](/data-view/data-view-toolbar) for more information
|
|
24
33
|
|
|
25
|
-
```js file="./
|
|
34
|
+
```js file="./DataViewPredefinedLayoutExample.tsx"
|
|
26
35
|
|
|
27
36
|
```
|
package/patternfly-docs/content/extensions/data-view/examples/DataView/DataViewLayoutExample.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
3
|
+
|
|
4
|
+
const layoutItemStyling = {
|
|
5
|
+
width: '100%',
|
|
6
|
+
height: '5rem',
|
|
7
|
+
padding: 'var(--pf-t--global--spacer--md)',
|
|
8
|
+
border: 'var(--pf-t--global--border--width--box--default) dashed var(--pf-t--global--border--color--default)'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const BasicExample: React.FunctionComponent = () => (
|
|
12
|
+
<DataView>
|
|
13
|
+
<div style={layoutItemStyling}>Header</div>
|
|
14
|
+
<div style={layoutItemStyling}>Data representation</div>
|
|
15
|
+
<div style={layoutItemStyling}>Footer</div>
|
|
16
|
+
</DataView>
|
|
17
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
4
|
+
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
5
|
+
|
|
6
|
+
const layoutItemStyling = {
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: '5rem',
|
|
9
|
+
padding: 'var(--pf-t--global--spacer--md)',
|
|
10
|
+
border: 'var(--pf-t--global--border--width--box--default) dashed var(--pf-t--global--border--color--default)'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const PAGINATION = {
|
|
14
|
+
page: 1,
|
|
15
|
+
perPage: 1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const BasicExample: React.FunctionComponent = () => (
|
|
19
|
+
<DataView>
|
|
20
|
+
<DataViewToolbar pagination={<Pagination {...PAGINATION} />} />
|
|
21
|
+
<div style={layoutItemStyling}>Data representation</div>
|
|
22
|
+
<DataViewToolbar pagination={<Pagination isCompact {...PAGINATION} ouiaId="DataViewFooter" />} />
|
|
23
|
+
</DataView>
|
|
24
|
+
)
|
package/patternfly-docs/content/extensions/data-view/examples/DataViewToolbar/DataViewToolbar.md
ADDED
|
@@ -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 toolbar
|
|
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: ['DataViewToolbar']
|
|
14
|
+
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataViewToolbar/DataViewToolbar.md
|
|
15
|
+
---
|
|
16
|
+
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
17
|
+
|
|
18
|
+
The **data view toolbar** component renders a default opinionated data view toolbar.
|
|
19
|
+
|
|
20
|
+
### Basic example
|
|
21
|
+
|
|
22
|
+
Data view toolbar can display a pagination using the `pagination` property accepting a React node. You can also pass a custom `ouiaId` for testing purposes.
|
|
23
|
+
|
|
24
|
+
```js file="./DataViewToolbarExample.tsx"
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
4
|
+
|
|
5
|
+
export const BasicExample: React.FunctionComponent = () => (
|
|
6
|
+
<DataViewToolbar pagination={<Pagination page={1} perPage={10} />} />
|
|
7
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
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: Hooks
|
|
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: []
|
|
14
|
+
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/Hooks/Hooks.md
|
|
15
|
+
---
|
|
16
|
+
Data view hooks provide a predefined solution to manage state of the data view. This modular approach allows them to be easily replaced with a custom implementation in case of more specific needs.
|
|
17
|
+
|
|
18
|
+
### useDataViewPagination()
|
|
19
|
+
|
|
20
|
+
The `useDataViewPagination` hook manages the pagination state of the data view. It retrieves the current `page` and `perPage` values together with functions to set them (`setPage`, `setPerPage`)
|
|
21
|
+
|
|
22
|
+
Coming soon...
|
|
23
|
+
|
|
@@ -10,7 +10,7 @@ const centerStyle = {
|
|
|
10
10
|
|
|
11
11
|
const IndexPage = () => {
|
|
12
12
|
return (
|
|
13
|
-
<PageSection
|
|
13
|
+
<PageSection style={centerStyle}>
|
|
14
14
|
<div style={{ flex: 'none', textAlign: 'center' }}>
|
|
15
15
|
<Title size="4xl" headingLevel="h1">
|
|
16
16
|
My extension docs
|
|
@@ -6,8 +6,8 @@ import DataView from './DataView';
|
|
|
6
6
|
describe('DataView', () => {
|
|
7
7
|
|
|
8
8
|
it('should render data view', () => {
|
|
9
|
-
render(<DataView
|
|
10
|
-
expect(screen.getByText('
|
|
9
|
+
render(<DataView><>Data view content</></DataView>);
|
|
10
|
+
expect(screen.getByText('Data view content')).toBeInTheDocument();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
});
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Stack, StackItem } from '@patternfly/react-core';
|
|
4
3
|
export interface DataViewProps {
|
|
5
|
-
/**
|
|
6
|
-
|
|
4
|
+
/** Content rendered inside the data view */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Custom OUIA ID */
|
|
7
|
+
ouiaId?: string;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export const DataView: React.
|
|
10
|
-
|
|
10
|
+
export const DataView: React.FC<DataViewProps> = ({
|
|
11
|
+
children, ouiaId = 'DataView', ...props
|
|
11
12
|
}: DataViewProps) => (
|
|
12
|
-
<
|
|
13
|
-
)
|
|
13
|
+
<Stack data-ouia-component-id={`${ouiaId}-stack}`} {...props}>
|
|
14
|
+
{React.Children.map(children, (child, index) => (
|
|
15
|
+
<StackItem data-ouia-component-id={`${ouiaId}-stack-item-${index}`}>
|
|
16
|
+
{child}
|
|
17
|
+
</StackItem>
|
|
18
|
+
))}
|
|
19
|
+
</Stack>
|
|
20
|
+
)
|
|
14
21
|
|
|
15
22
|
export default DataView;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Toolbar, ToolbarContent, ToolbarItem, ToolbarItemVariant } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export interface DataViewToolbarProps {
|
|
5
|
+
/** Toolbar className */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Custom OUIA ID */
|
|
8
|
+
ouiaId?: string;
|
|
9
|
+
/** React component to display pagination */
|
|
10
|
+
pagination?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DataViewToolbar: React.FC<React.PropsWithChildren<DataViewToolbarProps>> = ({ className, ouiaId = 'DataViewToolbar', pagination, children, ...props }: React.PropsWithChildren<DataViewToolbarProps>) => (
|
|
14
|
+
<Toolbar ouiaId={ouiaId} className={className} {...props}>
|
|
15
|
+
<ToolbarContent>
|
|
16
|
+
{pagination && (
|
|
17
|
+
<ToolbarItem variant={ToolbarItemVariant.pagination}>
|
|
18
|
+
{ /* TO DO: Make the pagination work later */ }
|
|
19
|
+
{pagination}
|
|
20
|
+
</ToolbarItem>
|
|
21
|
+
)}
|
|
22
|
+
{children}
|
|
23
|
+
</ToolbarContent>
|
|
24
|
+
</Toolbar>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default DataViewToolbar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDataViewPagination';
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// this file is autogenerated by generate-index.js, modifying it manually will have no effect
|
|
2
|
+
export * from './Hooks';
|
|
3
|
+
|
|
4
|
+
export { default as DataViewToolbar } from './DataViewToolbar';
|
|
5
|
+
export * from './DataViewToolbar';
|
|
2
6
|
|
|
3
7
|
export { default as DataView } from './DataView';
|
|
4
8
|
export * from './DataView';
|
|
@@ -1,54 +0,0 @@
|
|
|
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;
|
|
@@ -1,66 +0,0 @@
|
|
|
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;
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|