@sphereon/ui-components.ssi-react 0.1.3-unstable.100 → 0.1.3-unstable.102
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/components/buttons/RowActionMenuButton/index.d.ts +5 -5
- package/dist/components/buttons/RowActionMenuButton/index.js +8 -2
- package/dist/components/buttons/SSIIconButton/index.d.ts +2 -2
- package/dist/components/views/SSITableView/index.d.ts +1 -1
- package/dist/styles/components/components/RowActionMenuButton/index.js +2 -0
- package/dist/types/table/index.d.ts +5 -5
- package/package.json +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CSSProperties,
|
|
1
|
+
import { CSSProperties, ReactElement } from 'react';
|
|
2
2
|
import { ButtonIcon } from '@sphereon/ui-components.core';
|
|
3
3
|
import { ActionButton } from '../../../index';
|
|
4
4
|
import { Row } from '@tanstack/react-table';
|
|
5
|
-
type Props = {
|
|
6
|
-
actions: ActionButton[];
|
|
5
|
+
type Props<T> = {
|
|
6
|
+
actions: ActionButton<T>[];
|
|
7
7
|
icon: ButtonIcon;
|
|
8
8
|
color?: string;
|
|
9
9
|
style?: CSSProperties;
|
|
10
|
-
rowData
|
|
10
|
+
rowData: Row<T>;
|
|
11
11
|
};
|
|
12
|
-
declare const RowActionMenuButton:
|
|
12
|
+
declare const RowActionMenuButton: <T>({ actions, icon, color, style, rowData }: Props<T>) => ReactElement;
|
|
13
13
|
export default RowActionMenuButton;
|
|
@@ -17,11 +17,17 @@ const RowActionMenuButton = ({ actions, icon, color, style = {}, rowData }) => {
|
|
|
17
17
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
18
18
|
};
|
|
19
19
|
}, [dropdownRef]);
|
|
20
|
-
const toggleDropdown =
|
|
20
|
+
const toggleDropdown = (event) => {
|
|
21
|
+
event?.stopPropagation();
|
|
21
22
|
setIsDropdownVisible(!isDropdownVisible);
|
|
22
23
|
};
|
|
24
|
+
const handleActionClick = (action, rowData) => async (event) => {
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
await action.onClick(rowData);
|
|
27
|
+
setIsDropdownVisible(false);
|
|
28
|
+
};
|
|
23
29
|
const renderDropdown = () => {
|
|
24
|
-
return (_jsx(DropdownContainer, { ref: dropdownRef, style: { display: isDropdownVisible ? 'block' : 'none' }, children: actions.map((action, index) => (_jsxs(ActionItemContainer, { onClick: (
|
|
30
|
+
return (_jsx(DropdownContainer, { ref: dropdownRef, style: { display: isDropdownVisible ? 'block' : 'none' }, children: actions.map((action, index) => (_jsxs(ActionItemContainer, { onClick: handleActionClick(action, rowData), children: [_jsx(ItemCaption, { children: action.caption }), action.icon && _jsx(SSIIconButton, { onClick: handleActionClick(action, rowData), icon: action.icon })] }, index))) }));
|
|
25
31
|
};
|
|
26
32
|
return (_jsxs(ButtonContainer, { style: { ...style }, children: [_jsx(SSIIconButton, { icon: icon || ButtonIcon.BITTERBALLEN, color: color, onClick: toggleDropdown }), renderDropdown()] }));
|
|
27
33
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, MouseEventHandler } from 'react';
|
|
2
2
|
import { ButtonIcon } from '@sphereon/ui-components.core';
|
|
3
3
|
type Props = {
|
|
4
4
|
icon: ButtonIcon;
|
|
5
|
-
onClick:
|
|
5
|
+
onClick: MouseEventHandler;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
color?: string;
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ type Props<T> = {
|
|
|
11
11
|
enableResultCount?: boolean;
|
|
12
12
|
columnResizeMode?: ColumnResizeMode;
|
|
13
13
|
actions?: Array<Button>;
|
|
14
|
-
actionGroup?: ActionGroup
|
|
14
|
+
actionGroup?: ActionGroup<T>;
|
|
15
15
|
};
|
|
16
16
|
declare const SSITableView: <T extends {}>(props: Props<T>) => ReactElement;
|
|
17
17
|
export default SSITableView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessorFn, DeepKeys } from '@tanstack/react-table';
|
|
1
|
+
import { AccessorFn, DeepKeys, Row } from '@tanstack/react-table';
|
|
2
2
|
import { ButtonIcon } from '@sphereon/ui-components.core';
|
|
3
3
|
export declare enum TableCellType {
|
|
4
4
|
TEXT = "text",
|
|
@@ -19,13 +19,13 @@ export type TableCellOptions = {
|
|
|
19
19
|
columnMaxWidth?: number;
|
|
20
20
|
columnWidth?: number;
|
|
21
21
|
};
|
|
22
|
-
export type ActionGroup = {
|
|
22
|
+
export type ActionGroup<T> = {
|
|
23
23
|
caption: string;
|
|
24
|
-
actions: ActionButton[];
|
|
24
|
+
actions: ActionButton<T>[];
|
|
25
25
|
};
|
|
26
|
-
export type ActionButton = {
|
|
26
|
+
export type ActionButton<T> = {
|
|
27
27
|
caption: string;
|
|
28
|
-
onClick: (rowData:
|
|
28
|
+
onClick: (rowData: Row<T>) => Promise<void>;
|
|
29
29
|
icon?: ButtonIcon;
|
|
30
30
|
disabled?: boolean;
|
|
31
31
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ui-components.ssi-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.3-unstable.
|
|
4
|
+
"version": "0.1.3-unstable.102+c69e63d",
|
|
5
5
|
"description": "SSI UI components for React",
|
|
6
6
|
"repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
|
|
7
7
|
"author": "Sphereon <dev@sphereon.com>",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@sphereon/ui-components.core": "0.1.3-unstable.
|
|
31
|
+
"@sphereon/ui-components.core": "0.1.3-unstable.102+c69e63d",
|
|
32
32
|
"@tanstack/react-table": "^8.9.3",
|
|
33
33
|
"react-loader-spinner": "^5.4.5",
|
|
34
34
|
"react-toastify": "^9.1.3",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">= 16.8.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "c69e63d160b0a84bd636c89ad421b1f33c99c334"
|
|
46
46
|
}
|