@axinom/mosaic-ui 0.49.0-rc.0 → 0.49.0-rc.10
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/DynamicDataList/DynamicDataList.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/components/Filters/Filter/Filter.d.ts +2 -1
- package/dist/components/Filters/Filter/Filter.d.ts.map +1 -1
- package/dist/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.d.ts +2 -0
- package/dist/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.d.ts.map +1 -1
- package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +1 -1
- package/dist/components/List/ListRow/ListRow.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +9 -2
- package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.model.d.ts +11 -12
- package/dist/components/PageHeader/PageHeader.model.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts +35 -0
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +1 -0
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts +7 -0
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.d.ts.map +1 -0
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts +3 -0
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.d.ts.map +1 -0
- package/dist/components/PageHeader/index.d.ts +1 -1
- package/dist/components/PageHeader/index.d.ts.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{components/DynamicDataList/helpers/generateId.d.ts → utils/GenerateId.d.ts} +1 -1
- package/dist/utils/GenerateId.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/DynamicDataList/DynamicDataList.spec.tsx +2 -1
- package/src/components/DynamicDataList/DynamicDataList.tsx +1 -1
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.spec.tsx +37 -0
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.tsx +4 -0
- package/src/components/Explorer/Explorer.spec.tsx +26 -16
- package/src/components/Explorer/Explorer.tsx +47 -28
- package/src/components/Explorer/NavigationExplorer/NavigationExplorer.spec.tsx +2 -2
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.spec.tsx +8 -32
- package/src/components/Filters/Filter/Filter.tsx +3 -0
- package/src/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.spec.tsx +16 -1
- package/src/components/Filters/SelectionTypes/FreeTextFilter/FreeTextFilter.tsx +13 -1
- package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +34 -30
- package/src/components/List/ListRow/ListRow.scss +0 -1
- package/src/components/List/ListRow/ListRow.spec.tsx +35 -0
- package/src/components/List/ListRow/ListRow.tsx +5 -1
- package/src/components/PageHeader/PageHeader.model.ts +10 -12
- package/src/components/PageHeader/PageHeader.scss +7 -3
- package/src/components/PageHeader/PageHeader.spec.tsx +28 -86
- package/src/components/PageHeader/PageHeader.stories.tsx +32 -7
- package/src/components/PageHeader/PageHeader.tsx +50 -77
- package/src/components/PageHeader/{PageHeaderBulkActions/PageHeaderBulkActions.scss → PageHeaderActionsGroup/PageHeaderActionsGroup.scss} +21 -21
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.spec.tsx +105 -0
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx +224 -0
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContext.ts +13 -0
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroupsContextProvider.tsx +30 -0
- package/src/components/PageHeader/index.ts +1 -1
- package/dist/components/DynamicDataList/helpers/generateId.d.ts.map +0 -1
- package/dist/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.d.ts +0 -22
- package/dist/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.d.ts.map +0 -1
- package/src/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.spec.tsx +0 -369
- package/src/components/PageHeader/PageHeaderBulkActions/PageHeaderBulkActions.tsx +0 -188
- /package/src/{components/DynamicDataList/helpers/generateId.ts → utils/GenerateId.ts} +0 -0
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import { noop } from '../../../helpers/utils';
|
|
4
|
-
import { useExpand } from '../../../hooks/useExpand/useExpand';
|
|
5
|
-
import { ConfirmationMode } from '../../ConfirmDialog';
|
|
6
|
-
import { IconName } from '../../Icons';
|
|
7
|
-
import { PageHeaderProps } from '../PageHeader.model';
|
|
8
|
-
import {
|
|
9
|
-
PageHeaderAction,
|
|
10
|
-
isPageHeaderJsAction,
|
|
11
|
-
} from '../PageHeaderAction/PageHeaderAction';
|
|
12
|
-
import {
|
|
13
|
-
PageHeaderActionProps,
|
|
14
|
-
PageHeaderActionType,
|
|
15
|
-
} from '../PageHeaderAction/PageHeaderAction.model';
|
|
16
|
-
import classes from './PageHeaderBulkActions.scss';
|
|
17
|
-
|
|
18
|
-
export interface PageHeaderBulkActionsProps
|
|
19
|
-
extends Pick<
|
|
20
|
-
PageHeaderProps,
|
|
21
|
-
'openBulkActionsOnStart' | 'onBulkActionsToggled'
|
|
22
|
-
> {
|
|
23
|
-
/** Array of Actions to be rendered (default: []) */
|
|
24
|
-
actions?: PageHeaderActionProps[];
|
|
25
|
-
/** Number of available slots actions can use in the PageHeader */
|
|
26
|
-
availableActionSpace: number;
|
|
27
|
-
/** Whether or not bulk actions are disabled (default: false)*/
|
|
28
|
-
bulkActionsDisabled?: boolean;
|
|
29
|
-
/** CSS Class name for additional styles */
|
|
30
|
-
className?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Used to perform bulk operations from the PageHeader component.
|
|
35
|
-
* @example
|
|
36
|
-
* <PageHeaderBulkActions>
|
|
37
|
-
* <PageHeaderAction action={action} onBulkActionsToggled={onBulkActionsToggledHandler} />
|
|
38
|
-
* </PageHeaderBulkActions>
|
|
39
|
-
*/
|
|
40
|
-
export const PageHeaderBulkActions: React.FC<PageHeaderBulkActionsProps> = ({
|
|
41
|
-
actions = [],
|
|
42
|
-
openBulkActionsOnStart = false,
|
|
43
|
-
onBulkActionsToggled = noop,
|
|
44
|
-
availableActionSpace = 0,
|
|
45
|
-
bulkActionsDisabled = false,
|
|
46
|
-
className = '',
|
|
47
|
-
}) => {
|
|
48
|
-
const { isExpanded, toggleExpanded, expand } = useExpand();
|
|
49
|
-
const {
|
|
50
|
-
isExpanded: isMoreExpanded,
|
|
51
|
-
expand: moreExpanded,
|
|
52
|
-
collapse: moreCollapse,
|
|
53
|
-
toggleExpanded: toggleMoreExpanded,
|
|
54
|
-
} = useExpand();
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (openBulkActionsOnStart) {
|
|
58
|
-
expand();
|
|
59
|
-
}
|
|
60
|
-
}, [expand, openBulkActionsOnStart]);
|
|
61
|
-
|
|
62
|
-
const [isMouseOverMore, setIsMouseOverMore] = useState<boolean>(false);
|
|
63
|
-
const [isConfirmOpen, setIsConfirmOpen] = useState<Record<string, boolean>>(
|
|
64
|
-
{},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const onConfirmToggled = (
|
|
68
|
-
isOpen: boolean,
|
|
69
|
-
data: { id: string; mode: ConfirmationMode },
|
|
70
|
-
): void => {
|
|
71
|
-
setIsConfirmOpen((prevState) => {
|
|
72
|
-
return { ...prevState, [data.id]: isOpen };
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
const hasConfirm: boolean = Object.values(isConfirmOpen).includes(true);
|
|
78
|
-
|
|
79
|
-
// open drop down
|
|
80
|
-
if (isMouseOverMore) {
|
|
81
|
-
moreExpanded();
|
|
82
|
-
// close drop down if no confirmation is active
|
|
83
|
-
} else if (!isMouseOverMore && !hasConfirm) {
|
|
84
|
-
moreCollapse();
|
|
85
|
-
// keep the drop down open if confirmation is active
|
|
86
|
-
} else if (!isMouseOverMore && hasConfirm) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
}, [isConfirmOpen, isMouseOverMore, moreCollapse, moreExpanded]);
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<div
|
|
93
|
-
className={clsx(
|
|
94
|
-
classes.container,
|
|
95
|
-
'page-header-bulk-action-container',
|
|
96
|
-
className,
|
|
97
|
-
)}
|
|
98
|
-
>
|
|
99
|
-
<PageHeaderAction
|
|
100
|
-
label="Bulk Actions"
|
|
101
|
-
actionType={
|
|
102
|
-
isExpanded
|
|
103
|
-
? PageHeaderActionType.Active
|
|
104
|
-
: PageHeaderActionType.Context
|
|
105
|
-
}
|
|
106
|
-
icon={IconName.Bulk}
|
|
107
|
-
onClick={() => {
|
|
108
|
-
toggleExpanded();
|
|
109
|
-
onBulkActionsToggled(!isExpanded);
|
|
110
|
-
}}
|
|
111
|
-
/>
|
|
112
|
-
{isExpanded &&
|
|
113
|
-
actions.slice(0, availableActionSpace).map((action, idx) =>
|
|
114
|
-
isPageHeaderJsAction(action) ? (
|
|
115
|
-
<PageHeaderAction
|
|
116
|
-
key={idx}
|
|
117
|
-
{...action}
|
|
118
|
-
disabled={bulkActionsDisabled}
|
|
119
|
-
confirmationConfig={{
|
|
120
|
-
...action.confirmationConfig,
|
|
121
|
-
onConfirmOpen: (isOpen, args) => {
|
|
122
|
-
onConfirmToggled(
|
|
123
|
-
isOpen,
|
|
124
|
-
args as { id: string; mode: ConfirmationMode },
|
|
125
|
-
);
|
|
126
|
-
action.confirmationConfig?.onConfirmOpen?.(isOpen, args);
|
|
127
|
-
},
|
|
128
|
-
}}
|
|
129
|
-
/>
|
|
130
|
-
) : (
|
|
131
|
-
<PageHeaderAction key={idx} {...action} />
|
|
132
|
-
),
|
|
133
|
-
)}
|
|
134
|
-
{isExpanded && actions.length > availableActionSpace && (
|
|
135
|
-
<div
|
|
136
|
-
className={clsx(classes.hasMore)}
|
|
137
|
-
onMouseEnter={() => setIsMouseOverMore(true)}
|
|
138
|
-
onMouseLeave={() => setIsMouseOverMore(false)}
|
|
139
|
-
>
|
|
140
|
-
<PageHeaderAction
|
|
141
|
-
label="More"
|
|
142
|
-
icon={IconName.Ellipsis}
|
|
143
|
-
actionType={
|
|
144
|
-
isMoreExpanded
|
|
145
|
-
? PageHeaderActionType.Active
|
|
146
|
-
: PageHeaderActionType.Context
|
|
147
|
-
}
|
|
148
|
-
onClick={() => toggleMoreExpanded()}
|
|
149
|
-
/>
|
|
150
|
-
{isMoreExpanded && (
|
|
151
|
-
<div className={clsx(classes.dropDownList)}>
|
|
152
|
-
{actions.slice(availableActionSpace).map((action, idx) =>
|
|
153
|
-
isPageHeaderJsAction(action) ? (
|
|
154
|
-
<PageHeaderAction
|
|
155
|
-
key={idx}
|
|
156
|
-
{...action}
|
|
157
|
-
disabled={bulkActionsDisabled}
|
|
158
|
-
onClick={() => {
|
|
159
|
-
action.onClick();
|
|
160
|
-
moreCollapse();
|
|
161
|
-
setIsMouseOverMore(false);
|
|
162
|
-
}}
|
|
163
|
-
className={clsx(classes.dropDown)}
|
|
164
|
-
confirmationConfig={{
|
|
165
|
-
...action.confirmationConfig,
|
|
166
|
-
onConfirmOpen: (isOpen, args) => {
|
|
167
|
-
onConfirmToggled(
|
|
168
|
-
isOpen,
|
|
169
|
-
args as { id: string; mode: ConfirmationMode },
|
|
170
|
-
);
|
|
171
|
-
action.confirmationConfig?.onConfirmOpen?.(
|
|
172
|
-
isOpen,
|
|
173
|
-
args,
|
|
174
|
-
);
|
|
175
|
-
},
|
|
176
|
-
}}
|
|
177
|
-
/>
|
|
178
|
-
) : (
|
|
179
|
-
<PageHeaderAction key={idx} {...action} />
|
|
180
|
-
),
|
|
181
|
-
)}
|
|
182
|
-
</div>
|
|
183
|
-
)}
|
|
184
|
-
</div>
|
|
185
|
-
)}
|
|
186
|
-
</div>
|
|
187
|
-
);
|
|
188
|
-
};
|
|
File without changes
|