@axinom/mosaic-ui 0.32.0-rc.11 → 0.32.0-rc.12
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/Explorer/Explorer.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.model.d.ts +5 -0
- package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
- package/dist/components/Explorer/SelectionExplorer/SelectionExplorer.d.ts.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Explorer/Explorer.model.ts +5 -0
- package/src/components/Explorer/Explorer.spec.tsx +37 -5
- package/src/components/Explorer/Explorer.tsx +5 -3
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.spec.tsx +30 -0
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-ui",
|
|
3
|
-
"version": "0.32.0-rc.
|
|
3
|
+
"version": "0.32.0-rc.12",
|
|
4
4
|
"description": "UI components for building Axinom Mosaic applications",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "49d29f6c1ca2811784c79c0da36a5377d1389635"
|
|
106
106
|
}
|
|
@@ -36,6 +36,11 @@ export interface ExplorerBulkAction<T extends Data>
|
|
|
36
36
|
* Whether the Explorer should reload the data once the bulk action is completed
|
|
37
37
|
*/
|
|
38
38
|
reloadData?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether or not to show toast notification once the bulk action is started
|
|
41
|
+
* (shown by default)
|
|
42
|
+
*/
|
|
43
|
+
showStartedNotification?: boolean;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
export type PageIdentifier = string | number | undefined;
|
|
@@ -270,7 +270,7 @@ describe('Explorer', () => {
|
|
|
270
270
|
const header = wrapper.find(PageHeader);
|
|
271
271
|
|
|
272
272
|
await act(async () => {
|
|
273
|
-
header.prop('bulkActions')?.[0].onClick();
|
|
273
|
+
header.prop('bulkActions')?.[0].onClick?.();
|
|
274
274
|
|
|
275
275
|
await wrapper.update();
|
|
276
276
|
});
|
|
@@ -280,7 +280,7 @@ describe('Explorer', () => {
|
|
|
280
280
|
});
|
|
281
281
|
|
|
282
282
|
it('Calls "showNotification" when bulk action is clicked', async () => {
|
|
283
|
-
const [provider
|
|
283
|
+
const [provider] = getDataProvider();
|
|
284
284
|
|
|
285
285
|
const label = 'Something';
|
|
286
286
|
const wrapper = await actWithReturn(async () => {
|
|
@@ -303,7 +303,7 @@ describe('Explorer', () => {
|
|
|
303
303
|
|
|
304
304
|
const header = wrapper.find(PageHeader);
|
|
305
305
|
await act(async () => {
|
|
306
|
-
header.prop('bulkActions')?.[0].onClick();
|
|
306
|
+
header.prop('bulkActions')?.[0].onClick?.();
|
|
307
307
|
await wrapper.update();
|
|
308
308
|
});
|
|
309
309
|
|
|
@@ -313,6 +313,38 @@ describe('Explorer', () => {
|
|
|
313
313
|
});
|
|
314
314
|
});
|
|
315
315
|
|
|
316
|
+
it('Does not call "showNotification" when `showStartedNotification=false` and bulk action is clicked', async () => {
|
|
317
|
+
const [provider] = getDataProvider();
|
|
318
|
+
|
|
319
|
+
const label = 'Something';
|
|
320
|
+
const wrapper = await actWithReturn(async () => {
|
|
321
|
+
const wrapper = mount(
|
|
322
|
+
<Explorer
|
|
323
|
+
columns={mockListColumns}
|
|
324
|
+
dataProvider={provider}
|
|
325
|
+
stationKey="mock-key"
|
|
326
|
+
bulkActions={[
|
|
327
|
+
{
|
|
328
|
+
label,
|
|
329
|
+
onClick: jest.fn(),
|
|
330
|
+
reloadData: true,
|
|
331
|
+
showStartedNotification: false,
|
|
332
|
+
},
|
|
333
|
+
]}
|
|
334
|
+
/>,
|
|
335
|
+
);
|
|
336
|
+
return wrapper;
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
const header = wrapper.find(PageHeader);
|
|
340
|
+
await act(async () => {
|
|
341
|
+
header.prop('bulkActions')?.[0].onClick?.();
|
|
342
|
+
await wrapper.update();
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
expect(showNotificationSpy).toHaveBeenCalledTimes(0);
|
|
346
|
+
});
|
|
347
|
+
|
|
316
348
|
it.todo(`raises page header bulk action with 'SELECT_ALL'`);
|
|
317
349
|
|
|
318
350
|
it.todo(`raises page header bulk action with 'SINGLE_ITEMS'`);
|
|
@@ -1672,7 +1704,7 @@ describe('Explorer', () => {
|
|
|
1672
1704
|
const menu = wrapper.find(InlineMenu);
|
|
1673
1705
|
|
|
1674
1706
|
await act(async () => {
|
|
1675
|
-
await menu.prop('actions')?.[0].onActionSelected();
|
|
1707
|
+
await menu.prop('actions')?.[0].onActionSelected?.();
|
|
1676
1708
|
await wrapper.update();
|
|
1677
1709
|
});
|
|
1678
1710
|
|
|
@@ -1728,7 +1760,7 @@ describe('Explorer', () => {
|
|
|
1728
1760
|
const menu = wrapper.find(InlineMenu);
|
|
1729
1761
|
|
|
1730
1762
|
await act(async () => {
|
|
1731
|
-
await menu.prop('actions')?.[0].onActionSelected();
|
|
1763
|
+
await menu.prop('actions')?.[0].onActionSelected?.();
|
|
1732
1764
|
await wrapper.update();
|
|
1733
1765
|
});
|
|
1734
1766
|
|
|
@@ -365,9 +365,11 @@ export const Explorer = React.forwardRef(function Explorer<T extends Data>(
|
|
|
365
365
|
return {
|
|
366
366
|
...action,
|
|
367
367
|
onClick: async () => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
368
|
+
if (action.showStartedNotification !== false) {
|
|
369
|
+
showNotification({
|
|
370
|
+
title: `Bulk Action '${action.label}' Started`,
|
|
371
|
+
});
|
|
372
|
+
}
|
|
371
373
|
|
|
372
374
|
try {
|
|
373
375
|
const result = await action.onClick(getBulkActionSelection());
|
|
@@ -2,7 +2,9 @@ import { mount, shallow } from 'enzyme';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { act } from 'react-dom/test-utils';
|
|
4
4
|
import { actWithReturn } from '../../../helpers/testing';
|
|
5
|
+
import * as app from '../../../initialize';
|
|
5
6
|
import { Column } from '../../List';
|
|
7
|
+
import { PageHeader } from '../../PageHeader';
|
|
6
8
|
import { PageHeaderBulkActions } from '../../PageHeader/PageHeaderBulkActions/PageHeaderBulkActions';
|
|
7
9
|
import { Explorer } from '../Explorer';
|
|
8
10
|
import { ExplorerDataProvider } from '../Explorer.model';
|
|
@@ -103,6 +105,34 @@ describe('SelectionExplorer', () => {
|
|
|
103
105
|
expect(bulkActions.exists()).toBe(false);
|
|
104
106
|
});
|
|
105
107
|
|
|
108
|
+
it('Does not call "showNotification" when "Apply Selection" is clicked', async () => {
|
|
109
|
+
const [provider] = getDataProvider();
|
|
110
|
+
const showNotificationSpy: jest.SpyInstance = jest.spyOn(
|
|
111
|
+
app,
|
|
112
|
+
'showNotification',
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const wrapper = await actWithReturn(async () => {
|
|
116
|
+
const wrapper = mount(
|
|
117
|
+
<SelectionExplorer
|
|
118
|
+
columns={mockListColumns}
|
|
119
|
+
dataProvider={provider}
|
|
120
|
+
stationKey="mock-key"
|
|
121
|
+
allowBulkSelect={true}
|
|
122
|
+
/>,
|
|
123
|
+
);
|
|
124
|
+
return wrapper;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const header = wrapper.find(PageHeader);
|
|
128
|
+
await act(async () => {
|
|
129
|
+
header.prop('bulkActions')?.[0].onClick?.();
|
|
130
|
+
await wrapper.update();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
expect(showNotificationSpy).toHaveBeenCalledTimes(0);
|
|
134
|
+
});
|
|
135
|
+
|
|
106
136
|
it('sends onSelection callback when the selection of a single item is triggered', async () => {
|
|
107
137
|
const [provider] = getDataProvider();
|
|
108
138
|
const spy = jest.fn();
|