@ansible/ansible-ui-framework 0.0.275 → 0.0.277
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/cjs/BulkActionDialog.d.ts +5 -0
- package/cjs/BulkActionDialog.js +1 -1
- package/cjs/BulkProgressDialog.js +1 -1
- package/cjs/PageAlertToaster.d.ts +1 -1
- package/cjs/PageDataList.d.ts +2 -2
- package/cjs/PageForm.d.ts +2 -2
- package/cjs/PagePagination.d.ts +1 -1
- package/cjs/PageTable.d.ts +4 -3
- package/cjs/PageTable.js +3 -1
- package/cjs/PageTableCard.d.ts +1 -1
- package/cjs/PageTableCard.js +3 -1
- package/cjs/PageTableCards.d.ts +1 -1
- package/cjs/PageTableList.d.ts +1 -1
- package/cjs/PageTableList.js +7 -5
- package/cjs/PageTableViewType.d.ts +1 -1
- package/cjs/PageToolbar.d.ts +4 -4
- package/cjs/TypedActions/TypedActions.d.ts +5 -5
- package/cjs/cells/ElapsedTimeCell.d.ts +5 -0
- package/cjs/cells/ElapsedTimeCell.js +49 -0
- package/cjs/cells/TextCell.d.ts +3 -2
- package/cjs/cells/TextCell.js +5 -5
- package/cjs/components/Details.d.ts +1 -1
- package/cjs/components/IconWrapper.d.ts +2 -2
- package/cjs/components/IconWrapper.js +2 -2
- package/cjs/components/pfcolors.d.ts +29 -0
- package/cjs/components/{patternfly-colors.js → pfcolors.js} +19 -10
- package/cjs/components/useBreakPoint.d.ts +1 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +2 -1
- package/cjs/useInMemoryView.d.ts +1 -1
- package/cjs/useSelectDialog.d.ts +1 -1
- package/cjs/useSelectMultipleDialog.d.ts +1 -1
- package/package.json +1 -1
- package/cjs/components/patternfly-colors.d.ts +0 -23
|
@@ -17,7 +17,12 @@ export declare function BulkActionDialog<T extends object>(props: {
|
|
|
17
17
|
pendingText?: string;
|
|
18
18
|
isDanger?: boolean;
|
|
19
19
|
items: T[];
|
|
20
|
+
/** These are the columns shown when confirming the bulk actions. */
|
|
20
21
|
columns: ITableColumn<T>[];
|
|
22
|
+
/**
|
|
23
|
+
* These are the columns shown when processing the bulk actions plus an error column.
|
|
24
|
+
* @note This is usually the name column, unless the name column is not unique enough to identify the item.
|
|
25
|
+
*/
|
|
21
26
|
errorColumns: ITableColumn<T>[];
|
|
22
27
|
keyFn: (item: T) => string | number;
|
|
23
28
|
action: (item: T) => Promise<void>;
|
package/cjs/BulkActionDialog.js
CHANGED
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AlertProps } from '@patternfly/react-core';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type AlertToasterProps = AlertProps;
|
|
4
4
|
export interface IPageAlertToaster {
|
|
5
5
|
addAlert: (alert: AlertToasterProps) => void;
|
|
6
6
|
removeAlert: (alert: AlertToasterProps) => void;
|
package/cjs/PageDataList.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
|
2
2
|
import { PageHeaderProps } from './PageHeader';
|
|
3
3
|
import { IToolbarFilter } from './PageToolbar';
|
|
4
4
|
import { ITypedAction } from './TypedActions';
|
|
5
|
-
export
|
|
5
|
+
export type DataListPageProps<T extends object> = PageHeaderProps & PageDataListProps<T> & {
|
|
6
6
|
error?: Error;
|
|
7
7
|
};
|
|
8
8
|
export declare function DataListPage<T extends object>(props: DataListPageProps<T>): JSX.Element;
|
|
9
|
-
export
|
|
9
|
+
export type PageDataListProps<T extends object> = {
|
|
10
10
|
keyFn: (item: T) => string | number;
|
|
11
11
|
itemCount?: number;
|
|
12
12
|
pageItems: T[] | undefined;
|
package/cjs/PageForm.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CSSProperties, ReactNode } from 'react';
|
|
|
3
3
|
import { DeepPartial, ErrorOption, FieldPath, FieldValues, SubmitHandler, UseFormReturn } from 'react-hook-form';
|
|
4
4
|
import { PartialDeep } from 'type-fest';
|
|
5
5
|
import { PageHeaderProps } from './PageHeader';
|
|
6
|
-
export
|
|
6
|
+
export type FormPageProps<T extends object> = PageHeaderProps & {
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
defaultValues?: PartialDeep<T>;
|
|
9
9
|
onSubmit: SubmitHandler<PartialDeep<T>>;
|
|
@@ -136,7 +136,7 @@ export declare function PageForm<T extends object>(props: {
|
|
|
136
136
|
singleColumn?: boolean;
|
|
137
137
|
disableScrolling?: boolean;
|
|
138
138
|
}): JSX.Element;
|
|
139
|
-
export
|
|
139
|
+
export type FormPageSubmitHandler<T extends FieldValues> = (data: T, setError: (error: string) => void, setFieldError: (fieldName: FieldPath<T>, error: ErrorOption) => void) => Promise<unknown>;
|
|
140
140
|
export declare function PageFormSubmitButton(props: {
|
|
141
141
|
children: ReactNode;
|
|
142
142
|
style?: CSSProperties;
|
package/cjs/PagePagination.d.ts
CHANGED
package/cjs/PageTable.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { PageHeaderProps } from './PageHeader';
|
|
|
3
3
|
import { PageTableViewType } from './PageTableViewType';
|
|
4
4
|
import { IToolbarFilter } from './PageToolbar';
|
|
5
5
|
import { ITypedAction } from './TypedActions';
|
|
6
|
-
export
|
|
6
|
+
export type TablePageProps<T extends object> = PageHeaderProps & PageTableProps<T> & {
|
|
7
7
|
error?: Error;
|
|
8
8
|
};
|
|
9
9
|
export declare function TablePage<T extends object>(props: TablePageProps<T>): JSX.Element;
|
|
10
|
-
export
|
|
10
|
+
export type PageTableProps<T extends object> = {
|
|
11
11
|
keyFn: (item: T) => string | number;
|
|
12
12
|
itemCount?: number;
|
|
13
13
|
pageItems: T[] | undefined;
|
|
@@ -52,7 +52,7 @@ export declare type PageTableProps<T extends object> = {
|
|
|
52
52
|
defaultCardSubtitle?: ReactNode;
|
|
53
53
|
};
|
|
54
54
|
export declare function PageTable<T extends object>(props: PageTableProps<T>): JSX.Element;
|
|
55
|
-
|
|
55
|
+
type CellFn<T extends object> = (item: T) => ReactNode;
|
|
56
56
|
export interface ITableColumn<T extends object> {
|
|
57
57
|
id?: string;
|
|
58
58
|
header: string;
|
|
@@ -73,5 +73,6 @@ export interface ITableColumn<T extends object> {
|
|
|
73
73
|
card?: 'description' | 'hidden';
|
|
74
74
|
list?: 'primary' | 'secondary';
|
|
75
75
|
hideLabel?: boolean;
|
|
76
|
+
primary?: boolean;
|
|
76
77
|
}
|
|
77
78
|
export {};
|
package/cjs/PageTable.js
CHANGED
|
@@ -148,12 +148,14 @@ function TableHead(props) {
|
|
|
148
148
|
}, stickyMinWidth: "45px", hasRightBorder: props.scrollLeft }, { children: "\u00A0" }))), columns
|
|
149
149
|
.filter(function (column) { return column.enabled !== false; })
|
|
150
150
|
.map(function (column, index) {
|
|
151
|
+
var _a;
|
|
151
152
|
return ((0, jsx_runtime_1.jsx)(react_table_1.Th, __assign({ modifier: "fitContent", style: {
|
|
152
|
-
minWidth: column.minWidth,
|
|
153
|
+
minWidth: (_a = column.minWidth) !== null && _a !== void 0 ? _a : 0,
|
|
153
154
|
maxWidth: column.maxWidth,
|
|
154
155
|
backgroundColor: settings.theme === 'dark'
|
|
155
156
|
? 'var(--pf-global--BackgroundColor--300)'
|
|
156
157
|
: undefined,
|
|
158
|
+
width: index === 0 ? '0%' : undefined,
|
|
157
159
|
}, sort: getColumnSort(index, column) }, { children: column.header }), column.header));
|
|
158
160
|
}), itemActions !== undefined && ((0, jsx_runtime_1.jsx)(react_table_1.Th, __assign({ style: {
|
|
159
161
|
paddingRight: 8,
|
package/cjs/PageTableCard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { LabelColor } from './components/
|
|
2
|
+
import { LabelColor } from './components/pfcolors';
|
|
3
3
|
import { ITableColumn } from './PageTable';
|
|
4
4
|
import { ITypedAction } from './TypedActions';
|
|
5
5
|
export interface IPageTableCard {
|
package/cjs/PageTableCard.js
CHANGED
|
@@ -59,8 +59,10 @@ function PageTableCard(props) {
|
|
|
59
59
|
exports.PageTableCard = PageTableCard;
|
|
60
60
|
function useColumnsToTableCardFn(columns, keyFn) {
|
|
61
61
|
var cardData = (0, react_1.useMemo)(function () {
|
|
62
|
+
var _a;
|
|
62
63
|
var cols = columns.filter(function (column) { return column.card !== 'hidden'; });
|
|
63
|
-
var nameColumn = cols.
|
|
64
|
+
var nameColumn = (_a = cols.find(function (column) { return column.primary; })) !== null && _a !== void 0 ? _a : cols[0];
|
|
65
|
+
cols = cols.filter(function (column) { return column !== nameColumn; });
|
|
64
66
|
var descriptionColumn = cols.find(function (column) { return column.card === 'description'; });
|
|
65
67
|
if (descriptionColumn) {
|
|
66
68
|
cols = cols.filter(function (column) { return column !== descriptionColumn; });
|
package/cjs/PageTableCards.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PageTableProps } from './PageTable';
|
|
3
|
-
export
|
|
3
|
+
export type PageTableCardsProps<T extends object> = PageTableProps<T>;
|
|
4
4
|
export declare function PageTableCards<T extends object>(props: PageTableCardsProps<T>): JSX.Element;
|
package/cjs/PageTableList.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ITableColumn, PageTableProps } from './PageTable';
|
|
3
3
|
import { ITypedAction } from './TypedActions';
|
|
4
|
-
export
|
|
4
|
+
export type PageTableListProps<T extends object> = PageTableProps<T>;
|
|
5
5
|
export declare function PageTableList<T extends object>(props: PageTableListProps<T>): JSX.Element;
|
|
6
6
|
export declare function useColumnsToDataList<T extends object>(tableColumns: ITableColumn<T>[], keyFn: (item: T) => string | number, isSelected?: (item: T) => boolean, selectItem?: (item: T) => void, unselectItem?: (item: T) => void, rowActions?: ITypedAction<T>[], defaultCardSubtitle?: ReactNode, showSelect?: boolean): (item: T) => ReactNode;
|
package/cjs/PageTableList.js
CHANGED
|
@@ -24,8 +24,10 @@ function PageTableList(props) {
|
|
|
24
24
|
exports.PageTableList = PageTableList;
|
|
25
25
|
function useColumnsToDataList(tableColumns, keyFn, isSelected, selectItem, unselectItem, rowActions, defaultCardSubtitle, showSelect) {
|
|
26
26
|
var data = (0, react_1.useMemo)(function () {
|
|
27
|
+
var _a;
|
|
27
28
|
var cols = tableColumns.filter(function (column) { return column.card !== 'hidden'; });
|
|
28
|
-
var nameColumn = cols.
|
|
29
|
+
var nameColumn = (_a = cols.find(function (column) { return column.primary; })) !== null && _a !== void 0 ? _a : cols[0];
|
|
30
|
+
cols = cols.filter(function (column) { return column !== nameColumn; });
|
|
29
31
|
var descriptionColumn = cols.find(function (column) { return column.card === 'description'; });
|
|
30
32
|
if (descriptionColumn) {
|
|
31
33
|
cols = cols.filter(function (column) { return column !== descriptionColumn; });
|
|
@@ -50,17 +52,17 @@ function useColumnsToDataList(tableColumns, keyFn, isSelected, selectItem, unsel
|
|
|
50
52
|
var key = keyFn(item);
|
|
51
53
|
var isItemSelected = isSelected === null || isSelected === void 0 ? void 0 : isSelected(item);
|
|
52
54
|
return ((0, jsx_runtime_1.jsx)(react_core_1.DataListItem, __assign({ "aria-labelledby": "data-list-".concat(key), isExpanded: isItemSelected }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.DataListItemRow, { children: [showSelect && ((0, jsx_runtime_1.jsx)(react_core_1.DataListCheck, { "aria-labelledby": "data-list-check-".concat(key), name: "data-list-check-".concat(key), isChecked: isSelected === null || isSelected === void 0 ? void 0 : isSelected(item), onClick: function () { return onSelectClick(item); } })), (0, jsx_runtime_1.jsx)(react_core_1.DataListItemCells, { dataListCells: [
|
|
53
|
-
(0, jsx_runtime_1.jsx)(react_core_1.DataListCell, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.Stack, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h2", style: { marginTop: -4 } }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ id: "data-list-".concat(key) }, { children: (_a = data.nameColumn) === null || _a === void 0 ? void 0 : _a.cell(item) })) })), data.descriptionColumn ? ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: data.descriptionColumn.cell(item) }))) : (defaultCardSubtitle && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: defaultCardSubtitle }))))] }), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionList, __assign({ isCompact: true }, { children: data.columns.map(function (column) {
|
|
55
|
+
(0, jsx_runtime_1.jsx)(react_core_1.DataListCell, __assign({ width: 5 }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.Stack, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h2", style: { marginTop: -4 } }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ id: "data-list-".concat(key) }, { children: (_a = data.nameColumn) === null || _a === void 0 ? void 0 : _a.cell(item) })) })), data.descriptionColumn ? ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: data.descriptionColumn.cell(item) }))) : (defaultCardSubtitle && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: defaultCardSubtitle }))))] }), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionList, __assign({ isCompact: true }, { children: data.columns.map(function (column) {
|
|
54
56
|
var value = column.cell(item);
|
|
55
57
|
if (!value)
|
|
56
58
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
57
|
-
return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
|
|
58
|
-
}) }))] })) }) }, "primary"),
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7, whiteSpace: 'nowrap' } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
|
|
60
|
+
}) }))] })) }) }), "primary"),
|
|
59
61
|
data.secondary.length > 0 ? ((0, jsx_runtime_1.jsx)(react_core_1.DataListCell, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, { children: (0, jsx_runtime_1.jsx)(react_core_1.DescriptionList, __assign({ isCompact: true }, { children: data.secondary.map(function (column) {
|
|
60
62
|
var value = column.cell(item);
|
|
61
63
|
if (!value)
|
|
62
64
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
63
|
-
return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7, whiteSpace: 'nowrap' } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
|
|
64
66
|
}) })) }) }, "secondary")) : null,
|
|
65
67
|
] }), rowActions && ((0, jsx_runtime_1.jsx)(react_core_1.DataListAction, __assign({ "aria-labelledby": "check-action-item1 check-action-action1", id: "check-action-action1", "aria-label": "Actions", isPlainButtonAction: true, style: { whiteSpace: 'nowrap' } }, { children: (0, jsx_runtime_1.jsx)(TypedActions_1.TypedActions, { actions: rowActions, position: react_core_1.DropdownPosition.right, selectedItem: item }) })))] }) }), key));
|
|
66
68
|
}, [
|
package/cjs/PageToolbar.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface IItemFilter<T extends object> {
|
|
|
10
10
|
}[];
|
|
11
11
|
filter: (item: T, values: string[]) => boolean;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type SetFilterValues<T extends object> = (filter: IItemFilter<T>, values: string[]) => void;
|
|
14
14
|
export declare function toolbarActionsHaveBulkActions<T extends object>(actions?: ITypedAction<T>[]): boolean;
|
|
15
15
|
export interface IToolbarStringFilter {
|
|
16
16
|
key: string;
|
|
@@ -30,9 +30,9 @@ export interface IToolbarSelectFilter {
|
|
|
30
30
|
query: string;
|
|
31
31
|
placeholder?: string;
|
|
32
32
|
}
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
33
|
+
export type IToolbarFilter = IToolbarStringFilter | IToolbarSelectFilter;
|
|
34
|
+
export type IFilterState = Record<string, string[] | undefined>;
|
|
35
|
+
export type PagetableToolbarProps<T extends object> = {
|
|
36
36
|
openColumnModal?: () => void;
|
|
37
37
|
keyFn: (item: T) => string | number;
|
|
38
38
|
itemCount?: number;
|
|
@@ -19,27 +19,27 @@ interface ITypedActionCommon {
|
|
|
19
19
|
tooltip?: string;
|
|
20
20
|
isDanger?: boolean;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type ITypedActionButton = ITypedActionCommon & {
|
|
23
23
|
type: TypedActionType.button;
|
|
24
24
|
variant?: ButtonVariant;
|
|
25
25
|
onClick: () => void;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type ITypedBulkAction<T extends object> = ITypedActionCommon & {
|
|
28
28
|
type: TypedActionType.bulk;
|
|
29
29
|
variant?: ButtonVariant;
|
|
30
30
|
onClick: (selectedItems: T[]) => void;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type ITypedSingleAction<T extends object> = ITypedActionCommon & {
|
|
33
33
|
type: TypedActionType.single;
|
|
34
34
|
variant?: ButtonVariant;
|
|
35
35
|
onClick: (item: T) => void;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type ITypedDropdownAction<T extends object> = ITypedActionCommon & {
|
|
38
38
|
type: TypedActionType.dropdown;
|
|
39
39
|
variant?: ButtonVariant;
|
|
40
40
|
options: ITypedAction<T>[];
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type ITypedAction<T extends object> = ITypedActionSeperator | ITypedActionButton | ITypedBulkAction<T> | ITypedSingleAction<T> | ITypedDropdownAction<T>;
|
|
43
43
|
export declare function TypedActionsDropdown<T extends object>(props: {
|
|
44
44
|
actions: ITypedAction<T>[];
|
|
45
45
|
label?: string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ElapsedTimeCell = void 0;
|
|
20
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
var react_core_1 = require("@patternfly/react-core");
|
|
22
|
+
var react_1 = require("react");
|
|
23
|
+
var react_i18next_1 = require("react-i18next");
|
|
24
|
+
function ElapsedTimeCell(props) {
|
|
25
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
26
|
+
var start = (0, react_1.useMemo)(function () { var _a; return new Date((_a = props.start) !== null && _a !== void 0 ? _a : 0).valueOf(); }, [props.start]);
|
|
27
|
+
var finish = (0, react_1.useMemo)(function () { var _a; return new Date((_a = props.finish) !== null && _a !== void 0 ? _a : 0).valueOf(); }, [props.finish]);
|
|
28
|
+
var _a = __read((0, react_1.useState)(Math.max(0, finish - start.valueOf())), 2), elapsed = _a[0], setElapsed = _a[1];
|
|
29
|
+
(0, react_1.useEffect)(function () {
|
|
30
|
+
var timeout = setInterval(function () {
|
|
31
|
+
if (start) {
|
|
32
|
+
if (!props.finish)
|
|
33
|
+
setElapsed(Math.max(0, Date.now() - start));
|
|
34
|
+
else
|
|
35
|
+
setElapsed(Math.max(0, finish - start));
|
|
36
|
+
}
|
|
37
|
+
}, 1000);
|
|
38
|
+
return function () { return clearTimeout(timeout); };
|
|
39
|
+
}, [start, finish, props.finish]);
|
|
40
|
+
var totalSeconds = Math.floor(elapsed / 1000);
|
|
41
|
+
var seconds = Math.floor(totalSeconds % 60);
|
|
42
|
+
var minutes = Math.floor((totalSeconds / 60) % 60);
|
|
43
|
+
var hours = Math.floor((totalSeconds / 60 / 60) % 24);
|
|
44
|
+
var days = Math.floor(totalSeconds / 60 / 60 / 24);
|
|
45
|
+
if (!start)
|
|
46
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(react_core_1.Split, { children: [days !== 0 && ((0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [days, t('d'), "\u00A0"] })), hours !== 0 && ((0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [hours, t('h'), "\u00A0"] })), minutes !== 0 && ((0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [minutes, t('m'), "\u00A0"] })), (0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [seconds, t('s')] })] }));
|
|
48
|
+
}
|
|
49
|
+
exports.ElapsedTimeCell = ElapsedTimeCell;
|
package/cjs/cells/TextCell.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PFColor } from '../components/pfcolors';
|
|
3
3
|
export interface TextCellProps {
|
|
4
4
|
icon?: ReactNode;
|
|
5
5
|
iconSize?: 'sm' | 'md' | 'lg';
|
|
6
6
|
text?: string;
|
|
7
7
|
to?: string;
|
|
8
8
|
onClick?: () => void;
|
|
9
|
-
|
|
9
|
+
color?: PFColor;
|
|
10
|
+
iconColor?: PFColor;
|
|
10
11
|
maxWidth?: number;
|
|
11
12
|
disableLinks?: boolean;
|
|
12
13
|
}
|
package/cjs/cells/TextCell.js
CHANGED
|
@@ -15,17 +15,17 @@ exports.TextCell = void 0;
|
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_core_1 = require("@patternfly/react-core");
|
|
17
17
|
var IconWrapper_1 = require("../components/IconWrapper");
|
|
18
|
-
var
|
|
18
|
+
var pfcolors_1 = require("../components/pfcolors");
|
|
19
19
|
var usePageNavigate_1 = require("../components/usePageNavigate");
|
|
20
20
|
function TextCell(props) {
|
|
21
|
-
var _a, _b;
|
|
21
|
+
var _a, _b, _c;
|
|
22
22
|
var navigate = (0, usePageNavigate_1.usePageNavigate)();
|
|
23
|
-
return ((0, jsx_runtime_1.jsxs)(react_core_1.Split, __assign({ style: { maxWidth: '100%' } }, { children: [props.icon && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, { children: (0, jsx_runtime_1.jsx)(IconWrapper_1.IconWrapper, __assign({ size: (_a = props.iconSize) !== null && _a !== void 0 ? _a : 'sm' }, { children: props.icon })) })), props.text && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, __assign({ style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
|
|
24
|
-
maxWidth: (
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(react_core_1.Split, __assign({ style: { maxWidth: '100%' } }, { children: [props.icon && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, { children: (0, jsx_runtime_1.jsx)(IconWrapper_1.IconWrapper, __assign({ size: (_a = props.iconSize) !== null && _a !== void 0 ? _a : 'sm', color: (_b = props.iconColor) !== null && _b !== void 0 ? _b : props.color }, { children: props.icon })) })), props.text && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, __assign({ style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
|
|
24
|
+
maxWidth: (_c = props.maxWidth) !== null && _c !== void 0 ? _c : '100%',
|
|
25
25
|
whiteSpace: 'nowrap',
|
|
26
26
|
textOverflow: 'ellipsis',
|
|
27
27
|
overflow: 'hidden',
|
|
28
|
-
color: props.
|
|
28
|
+
color: props.color ? (0, pfcolors_1.getPatternflyColor)(props.color) : undefined,
|
|
29
29
|
} }, { children: !props.disableLinks && (props.to || props.onClick) ? ((0, jsx_runtime_1.jsx)("a", __assign({ href: props.to, onClick: function (e) {
|
|
30
30
|
e.preventDefault();
|
|
31
31
|
if (props.onClick) {
|
|
@@ -24,7 +24,7 @@ export interface IDetailListItem {
|
|
|
24
24
|
helpTitle?: string;
|
|
25
25
|
help?: ReactNode;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export type IDetail = IDetailText | IDetailList;
|
|
28
28
|
export declare function DetailsList(props: {
|
|
29
29
|
children?: ReactNode;
|
|
30
30
|
}): JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PFColor } from './pfcolors';
|
|
3
3
|
export declare function IconWrapper(props: {
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
color?:
|
|
5
|
+
color?: PFColor;
|
|
6
6
|
size?: 'sm' | 'md' | 'lg';
|
|
7
7
|
noPadding?: boolean;
|
|
8
8
|
}): JSX.Element;
|
|
@@ -14,11 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.IconWrapper = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var react_1 = require("react");
|
|
17
|
-
var
|
|
17
|
+
var pfcolors_1 = require("./pfcolors");
|
|
18
18
|
function IconWrapper(props) {
|
|
19
19
|
var newProps = {};
|
|
20
20
|
if (props.color) {
|
|
21
|
-
newProps.color = (0,
|
|
21
|
+
newProps.color = (0, pfcolors_1.getPatternflyColor)(props.color);
|
|
22
22
|
}
|
|
23
23
|
var marginOffset = undefined;
|
|
24
24
|
var marginRight = undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare enum PFColorE {
|
|
2
|
+
Green = "green",
|
|
3
|
+
Success = "success",
|
|
4
|
+
Blue = "blue",
|
|
5
|
+
Info = "info",
|
|
6
|
+
Red = "red",
|
|
7
|
+
Danger = "danger",
|
|
8
|
+
Yellow = "yellow",
|
|
9
|
+
Warning = "warning",
|
|
10
|
+
Grey = "grey",
|
|
11
|
+
Disabled = "disabled"
|
|
12
|
+
}
|
|
13
|
+
export type PFColor = 'green' | 'success' | 'blue' | 'info' | 'red' | 'danger' | 'yellow' | 'warning' | 'grey' | 'disabled';
|
|
14
|
+
export declare function getPatternflyColor(color: PFColor): "var(--pf-global--success-color--100)" | "var(--pf-global--danger-color--100)" | "var(--pf-global--warning-color--100)" | "var(--pf-global--info-color--100)" | "var(--pf-global--disabled-color--100)";
|
|
15
|
+
export declare const pfSuccess = "var(--pf-global--success-color--100)";
|
|
16
|
+
export declare const pfDanger = "var(--pf-global--danger-color--100)";
|
|
17
|
+
export declare const pfWarning = "var(--pf-global--warning-color--100)";
|
|
18
|
+
export declare const pfInfo = "var(--pf-global--info-color--100)";
|
|
19
|
+
export declare const pfDisabled = "var(--pf-global--disabled-color--100)";
|
|
20
|
+
export declare enum LabelColorE {
|
|
21
|
+
blue = "blue",
|
|
22
|
+
cyan = "cyan",
|
|
23
|
+
green = "green",
|
|
24
|
+
orange = "orange",
|
|
25
|
+
purple = "purple",
|
|
26
|
+
red = "red",
|
|
27
|
+
grey = "grey"
|
|
28
|
+
}
|
|
29
|
+
export type LabelColor = 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'grey';
|
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LabelColorE = exports.pfDisabled = exports.pfInfo = exports.pfWarning = exports.pfDanger = exports.pfSuccess = exports.getPatternflyColor = exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
exports.LabelColorE = exports.pfDisabled = exports.pfInfo = exports.pfWarning = exports.pfDanger = exports.pfSuccess = exports.getPatternflyColor = exports.PFColorE = void 0;
|
|
4
|
+
var PFColorE;
|
|
5
|
+
(function (PFColorE) {
|
|
6
|
+
PFColorE["Green"] = "green";
|
|
7
|
+
PFColorE["Success"] = "success";
|
|
8
|
+
PFColorE["Blue"] = "blue";
|
|
9
|
+
PFColorE["Info"] = "info";
|
|
10
|
+
PFColorE["Red"] = "red";
|
|
11
|
+
PFColorE["Danger"] = "danger";
|
|
12
|
+
PFColorE["Yellow"] = "yellow";
|
|
13
|
+
PFColorE["Warning"] = "warning";
|
|
14
|
+
PFColorE["Grey"] = "grey";
|
|
15
|
+
PFColorE["Disabled"] = "disabled";
|
|
16
|
+
})(PFColorE = exports.PFColorE || (exports.PFColorE = {}));
|
|
12
17
|
function getPatternflyColor(color) {
|
|
13
18
|
switch (color) {
|
|
14
19
|
case 'green':
|
|
20
|
+
case 'success':
|
|
15
21
|
return exports.pfSuccess;
|
|
16
22
|
case 'red':
|
|
23
|
+
case 'danger':
|
|
17
24
|
return exports.pfDanger;
|
|
18
25
|
case 'yellow':
|
|
26
|
+
case 'warning':
|
|
19
27
|
return exports.pfWarning;
|
|
20
28
|
case 'blue':
|
|
29
|
+
case 'info':
|
|
21
30
|
return exports.pfInfo;
|
|
22
31
|
case 'grey':
|
|
32
|
+
case 'disabled':
|
|
23
33
|
return exports.pfDisabled;
|
|
24
34
|
}
|
|
25
|
-
return undefined;
|
|
26
35
|
}
|
|
27
36
|
exports.getPatternflyColor = getPatternflyColor;
|
|
28
37
|
exports.pfSuccess = 'var(--pf-global--success-color--100)';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type WindowSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
2
2
|
export declare function useWindowSize(): WindowSize;
|
|
3
3
|
/** Returns true if the window size is equal to or larger than the indicated size. */
|
|
4
4
|
export declare function useBreakpoint(size: WindowSize): boolean;
|
package/cjs/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './cells/BytesCell';
|
|
|
3
3
|
export * from './cells/CapacityCell';
|
|
4
4
|
export * from './cells/CopyCell';
|
|
5
5
|
export * from './cells/DateTimeCell';
|
|
6
|
+
export * from './cells/ElapsedTimeCell';
|
|
6
7
|
export * from './cells/LabelsCell';
|
|
7
8
|
export * from './cells/TextCell';
|
|
8
9
|
export * from './components/BulkSelector';
|
|
@@ -10,7 +11,7 @@ export * from './components/Collapse';
|
|
|
10
11
|
export * from './components/Details';
|
|
11
12
|
export * from './components/Help';
|
|
12
13
|
export * from './components/icons/RunningIcon';
|
|
13
|
-
export * from './components/
|
|
14
|
+
export * from './components/pfcolors';
|
|
14
15
|
export * from './components/Scrollable';
|
|
15
16
|
export * from './components/useBreakPoint';
|
|
16
17
|
export * from './PageAlertToaster';
|
package/cjs/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./cells/BytesCell"), exports);
|
|
|
19
19
|
__exportStar(require("./cells/CapacityCell"), exports);
|
|
20
20
|
__exportStar(require("./cells/CopyCell"), exports);
|
|
21
21
|
__exportStar(require("./cells/DateTimeCell"), exports);
|
|
22
|
+
__exportStar(require("./cells/ElapsedTimeCell"), exports);
|
|
22
23
|
__exportStar(require("./cells/LabelsCell"), exports);
|
|
23
24
|
__exportStar(require("./cells/TextCell"), exports);
|
|
24
25
|
__exportStar(require("./components/BulkSelector"), exports);
|
|
@@ -26,7 +27,7 @@ __exportStar(require("./components/Collapse"), exports);
|
|
|
26
27
|
__exportStar(require("./components/Details"), exports);
|
|
27
28
|
__exportStar(require("./components/Help"), exports);
|
|
28
29
|
__exportStar(require("./components/icons/RunningIcon"), exports);
|
|
29
|
-
__exportStar(require("./components/
|
|
30
|
+
__exportStar(require("./components/pfcolors"), exports);
|
|
30
31
|
__exportStar(require("./components/Scrollable"), exports);
|
|
31
32
|
__exportStar(require("./components/useBreakPoint"), exports);
|
|
32
33
|
__exportStar(require("./PageAlertToaster"), exports);
|
package/cjs/useInMemoryView.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ITableColumn } from './PageTable';
|
|
|
2
2
|
import { IToolbarFilter } from './PageToolbar';
|
|
3
3
|
import { ISelected } from './useTableItems';
|
|
4
4
|
import { IView } from './useView';
|
|
5
|
-
export
|
|
5
|
+
export type IInMemoryView<T extends object> = IView & ISelected<T> & {
|
|
6
6
|
itemCount: number | undefined;
|
|
7
7
|
pageItems: T[] | undefined;
|
|
8
8
|
};
|
package/cjs/useSelectDialog.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface ISelectDialogOptions<T extends object> {
|
|
|
17
17
|
export declare function useSelectDialog<T extends {
|
|
18
18
|
id: number;
|
|
19
19
|
}>(options: ISelectDialogOptions<T>): (onSelect?: ((item: T) => void) | undefined, title?: string) => void;
|
|
20
|
-
export
|
|
20
|
+
export type SelectDialogProps<T extends object> = {
|
|
21
21
|
title: string;
|
|
22
22
|
open: boolean;
|
|
23
23
|
setOpen: (open: boolean) => void;
|
|
@@ -3,7 +3,7 @@ import { ITableColumn } from './PageTable';
|
|
|
3
3
|
import { IToolbarFilter } from './PageToolbar';
|
|
4
4
|
import { ISelected } from './useTableItems';
|
|
5
5
|
import { IView } from './useView';
|
|
6
|
-
export
|
|
6
|
+
export type SelectMultipleDialogProps<T extends object> = {
|
|
7
7
|
title: string;
|
|
8
8
|
view: IView & ISelected<T> & {
|
|
9
9
|
itemCount?: number;
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare enum PatternFlyColor {
|
|
2
|
-
Green = "green",
|
|
3
|
-
Blue = "blue",
|
|
4
|
-
Red = "red",
|
|
5
|
-
Yellow = "yellow",
|
|
6
|
-
Grey = "grey"
|
|
7
|
-
}
|
|
8
|
-
export declare function getPatternflyColor(color: PatternFlyColor): "var(--pf-global--success-color--100)" | "var(--pf-global--danger-color--100)" | "var(--pf-global--warning-color--100)" | "var(--pf-global--info-color--100)" | "var(--pf-global--disabled-color--100)" | undefined;
|
|
9
|
-
export declare const pfSuccess = "var(--pf-global--success-color--100)";
|
|
10
|
-
export declare const pfDanger = "var(--pf-global--danger-color--100)";
|
|
11
|
-
export declare const pfWarning = "var(--pf-global--warning-color--100)";
|
|
12
|
-
export declare const pfInfo = "var(--pf-global--info-color--100)";
|
|
13
|
-
export declare const pfDisabled = "var(--pf-global--disabled-color--100)";
|
|
14
|
-
export declare enum LabelColorE {
|
|
15
|
-
blue = "blue",
|
|
16
|
-
cyan = "cyan",
|
|
17
|
-
green = "green",
|
|
18
|
-
orange = "orange",
|
|
19
|
-
purple = "purple",
|
|
20
|
-
red = "red",
|
|
21
|
-
grey = "grey"
|
|
22
|
-
}
|
|
23
|
-
export declare type LabelColor = 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'grey';
|