@axinom/mosaic-ui 0.51.0-rc.1 → 0.51.0-rc.11
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/ConditionalSplit/ConditionalSplit.d.ts +8 -0
- package/dist/components/Explorer/ConditionalSplit/ConditionalSplit.d.ts.map +1 -0
- package/dist/components/Explorer/Explorer.d.ts +3 -1
- package/dist/components/Explorer/Explorer.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.model.d.ts +18 -1
- package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
- package/dist/components/Explorer/QuickEdit/QuickEditContext.d.ts +11 -0
- package/dist/components/Explorer/QuickEdit/QuickEditContext.d.ts.map +1 -0
- package/dist/components/Explorer/QuickEdit/useQuickEdit.d.ts +22 -0
- package/dist/components/Explorer/QuickEdit/useQuickEdit.d.ts.map +1 -0
- package/dist/components/Explorer/{InMemoryDataProvider.d.ts → helpers/InMemoryDataProvider.d.ts} +3 -3
- package/dist/components/Explorer/helpers/InMemoryDataProvider.d.ts.map +1 -0
- package/dist/components/Explorer/helpers/useActions.d.ts +31 -0
- package/dist/components/Explorer/helpers/useActions.d.ts.map +1 -0
- package/dist/components/Explorer/{useDataProvider.d.ts → helpers/useDataProvider.d.ts} +6 -6
- package/dist/components/Explorer/helpers/useDataProvider.d.ts.map +1 -0
- package/dist/components/Explorer/helpers/useFilters.d.ts +21 -0
- package/dist/components/Explorer/helpers/useFilters.d.ts.map +1 -0
- package/dist/components/Explorer/helpers/useStationMessage.d.ts +17 -0
- package/dist/components/Explorer/helpers/useStationMessage.d.ts.map +1 -0
- package/dist/components/Explorer/index.d.ts +2 -1
- package/dist/components/Explorer/index.d.ts.map +1 -1
- package/dist/components/FormStation/Create/Create.d.ts.map +1 -1
- package/dist/components/FormStation/FormStation.d.ts +4 -1
- package/dist/components/FormStation/FormStation.d.ts.map +1 -1
- package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts +1 -0
- package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +1 -1
- package/dist/components/FormStation/SaveOnDemand/SaveOnDemand.d.ts +11 -0
- package/dist/components/FormStation/SaveOnDemand/SaveOnDemand.d.ts.map +1 -0
- package/dist/components/FormStation/helpers/useDataProvider.d.ts.map +1 -1
- package/dist/components/Icons/Icons.d.ts.map +1 -1
- package/dist/components/Icons/Icons.models.d.ts +28 -24
- package/dist/components/Icons/Icons.models.d.ts.map +1 -1
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/List/List.d.ts.map +1 -1
- package/dist/components/List/List.model.d.ts +4 -0
- package/dist/components/List/List.model.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts +1 -1
- package/dist/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.d.ts.map +1 -1
- package/dist/components/PageHeader/helpers/useElementWidthObserver.d.ts +6 -0
- package/dist/components/PageHeader/helpers/useElementWidthObserver.d.ts.map +1 -0
- 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/initialize.d.ts +1 -1
- package/dist/initialize.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/components/EmptyStation/EmptyStation.spec.tsx +24 -0
- package/src/components/Explorer/ConditionalSplit/ConditionalSplit.tsx +23 -0
- package/src/components/Explorer/Explorer.model.ts +19 -1
- package/src/components/Explorer/Explorer.scss +4 -0
- package/src/components/Explorer/Explorer.spec.tsx +28 -3
- package/src/components/Explorer/Explorer.stories.tsx +90 -5
- package/src/components/Explorer/Explorer.tsx +149 -185
- package/src/components/Explorer/NavigationExplorer/NavigationExplorer.spec.tsx +26 -0
- package/src/components/Explorer/NavigationExplorer/NavigationExplorer.stories.tsx +2 -2
- package/src/components/Explorer/QuickEdit/QuickEditContext.tsx +16 -0
- package/src/components/Explorer/QuickEdit/useQuickEdit.spec.tsx +461 -0
- package/src/components/Explorer/QuickEdit/useQuickEdit.tsx +169 -0
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.spec.tsx +6 -0
- package/src/components/Explorer/SelectionExplorer/SelectionExplorer.stories.tsx +2 -2
- package/src/components/Explorer/{InMemoryDataProvider.ts → helpers/InMemoryDataProvider.ts} +4 -4
- package/src/components/Explorer/helpers/useActions.ts +203 -0
- package/src/components/Explorer/{useDataProvider.tsx → helpers/useDataProvider.tsx} +11 -11
- package/src/components/Explorer/helpers/useFilters.tsx +77 -0
- package/src/components/Explorer/{useStationMessage.tsx → helpers/useStationMessage.tsx} +8 -6
- package/src/components/Explorer/index.ts +10 -6
- package/src/components/Filters/Filter/Filter.scss +2 -1
- package/src/components/FormStation/Create/Create.tsx +1 -0
- package/src/components/FormStation/FormStation.spec.tsx +62 -73
- package/src/components/FormStation/FormStation.tsx +31 -15
- package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +38 -18
- package/src/components/FormStation/SaveOnDemand/SaveOnDemand.tsx +55 -0
- package/src/components/FormStation/helpers/useDataProvider.ts +1 -8
- package/src/components/Icons/Icons.models.ts +4 -0
- package/src/components/Icons/Icons.tsx +78 -0
- package/src/components/InlineMenu/InlineMenu.spec.tsx +18 -0
- package/src/components/List/List.model.ts +5 -0
- package/src/components/List/List.tsx +29 -5
- package/src/components/List/ListRow/ListRow.spec.tsx +0 -10
- package/src/components/List/ListRow/ListRow.tsx +1 -1
- package/src/components/PageHeader/PageHeader.scss +1 -1
- package/src/components/PageHeader/PageHeader.stories.tsx +6 -2
- package/src/components/PageHeader/PageHeader.tsx +7 -12
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.spec.tsx +19 -7
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx +9 -4
- package/src/components/PageHeader/helpers/useElementWidthObserver.tsx +30 -0
- package/src/initialize.ts +2 -2
- package/dist/components/Explorer/InMemoryDataProvider.d.ts.map +0 -1
- package/dist/components/Explorer/useDataProvider.d.ts.map +0 -1
- package/dist/components/Explorer/useStationMessage.d.ts +0 -15
- package/dist/components/Explorer/useStationMessage.d.ts.map +0 -1
- /package/src/components/Explorer/{InMemoryDataProvider.spec.ts → helpers/InMemoryDataProvider.spec.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mount, shallow } from 'enzyme';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { act } from 'react-dom/test-utils';
|
|
3
4
|
import { noop } from '../../../helpers/utils';
|
|
4
5
|
import { PageHeaderAction } from '../PageHeaderAction/PageHeaderAction';
|
|
5
6
|
import {
|
|
@@ -45,16 +46,18 @@ describe('PageHeaderActionsGroup', () => {
|
|
|
45
46
|
expect(wrapper).toBeTruthy();
|
|
46
47
|
});
|
|
47
48
|
|
|
48
|
-
it(`'Group Actions' has the 'Context' actionType when closed and 'Active' actionType when open`, () => {
|
|
49
|
+
it(`'Group Actions' has the 'Context' actionType when closed and 'Active' actionType when open`, async () => {
|
|
49
50
|
const wrapper = mount(<PageHeaderActionsGroup {...defaultProps} />);
|
|
50
51
|
let groupActionsToggle = wrapper.find(PageHeaderAction).first();
|
|
51
|
-
// let action = wrapper.find(PageHeaderAction);
|
|
52
52
|
|
|
53
53
|
expect(groupActionsToggle.prop('actionType')).toBe(
|
|
54
54
|
PageHeaderActionType.Context,
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
await act(async () => {
|
|
58
|
+
await groupActionsToggle.prop('onClick')?.();
|
|
59
|
+
wrapper.update();
|
|
60
|
+
});
|
|
58
61
|
|
|
59
62
|
groupActionsToggle = wrapper.find(PageHeaderAction).first();
|
|
60
63
|
|
|
@@ -63,19 +66,23 @@ describe('PageHeaderActionsGroup', () => {
|
|
|
63
66
|
);
|
|
64
67
|
});
|
|
65
68
|
|
|
66
|
-
it(`renders all actions when 'Group Actions' is selected and there is enough available action slots`, () => {
|
|
69
|
+
it(`renders all actions when 'Group Actions' is selected and there is enough available action slots`, async () => {
|
|
67
70
|
const wrapper = mount(
|
|
68
71
|
<PageHeaderActionsGroup {...defaultProps} availableActionSpace={5} />,
|
|
69
72
|
);
|
|
70
73
|
const groupActionsToggle = wrapper.find(PageHeaderAction).first();
|
|
71
74
|
let actions = wrapper.find(PageHeaderAction);
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
await act(async () => {
|
|
77
|
+
await groupActionsToggle.prop('onClick')?.();
|
|
78
|
+
wrapper.update();
|
|
79
|
+
});
|
|
80
|
+
|
|
74
81
|
actions = wrapper.find(PageHeaderAction);
|
|
75
82
|
expect(actions).toHaveLength(5);
|
|
76
83
|
});
|
|
77
84
|
|
|
78
|
-
it(`raises onActionsGroupToggled`, () => {
|
|
85
|
+
it(`raises onActionsGroupToggled`, async () => {
|
|
79
86
|
const groupActionSpy = jest.fn();
|
|
80
87
|
const wrapper = mount(
|
|
81
88
|
<PageHeaderActionsGroup
|
|
@@ -84,7 +91,12 @@ describe('PageHeaderActionsGroup', () => {
|
|
|
84
91
|
/>,
|
|
85
92
|
);
|
|
86
93
|
const groupActionsToggle = wrapper.find(PageHeaderAction).first();
|
|
87
|
-
|
|
94
|
+
|
|
95
|
+
await act(async () => {
|
|
96
|
+
await groupActionsToggle.prop('onClick')?.();
|
|
97
|
+
wrapper.update();
|
|
98
|
+
});
|
|
99
|
+
|
|
88
100
|
expect(groupActionSpy).toHaveBeenCalledTimes(1);
|
|
89
101
|
expect(groupActionSpy).toHaveBeenCalledWith(true);
|
|
90
102
|
});
|
|
@@ -37,7 +37,7 @@ export interface PageHeaderActionsGroupProps {
|
|
|
37
37
|
* Callback to emit when Group Actions is toggled
|
|
38
38
|
* The expanded state is supplied as an argument
|
|
39
39
|
*/
|
|
40
|
-
onActionsGroupToggled?: (expanded: boolean) => void
|
|
40
|
+
onActionsGroupToggled?: (expanded: boolean) => Promise<void>;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -134,12 +134,17 @@ export const PageHeaderActionsGroup: React.FC<PageHeaderActionsGroupProps> = ({
|
|
|
134
134
|
: PageHeaderActionType.Context
|
|
135
135
|
}
|
|
136
136
|
icon={icon}
|
|
137
|
-
onClick={() => {
|
|
137
|
+
onClick={async () => {
|
|
138
138
|
if (!isExpanded) {
|
|
139
139
|
collapseAll();
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
try {
|
|
142
|
+
await onActionsGroupToggled(!isExpanded);
|
|
143
|
+
toggleExpanded();
|
|
144
|
+
} catch (e) {
|
|
145
|
+
// Abort the action if an error occurs
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
143
148
|
}}
|
|
144
149
|
disabled={disabled}
|
|
145
150
|
/>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export const useElementWidthObserver = <T extends HTMLElement>(): {
|
|
4
|
+
width: number;
|
|
5
|
+
ref: React.RefObject<T>;
|
|
6
|
+
} => {
|
|
7
|
+
const [width, setWidth] = useState(0);
|
|
8
|
+
const ref = useRef<T>(null);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const observer = new ResizeObserver((entries) => {
|
|
12
|
+
setWidth(entries[0].contentRect.width);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const current = ref.current;
|
|
16
|
+
|
|
17
|
+
if (current) {
|
|
18
|
+
observer.observe(current);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
current && observer.unobserve(current);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
width,
|
|
28
|
+
ref,
|
|
29
|
+
};
|
|
30
|
+
};
|
package/src/initialize.ts
CHANGED
|
@@ -21,11 +21,11 @@ export let removeIndicator: RemoveIndicator | (() => void) =
|
|
|
21
21
|
|
|
22
22
|
export let on: CustomEventEmitter['on'] | (() => void) = polyfill('on');
|
|
23
23
|
|
|
24
|
+
export let setTitle: (title?: string) => void = polyfill('setTitle');
|
|
25
|
+
|
|
24
26
|
export let setSaveIndicator: (type: SaveIndicatorType) => void =
|
|
25
27
|
polyfill('setSaveIndicator');
|
|
26
28
|
|
|
27
|
-
export let setTitle: (title?: string) => void = polyfill('setTitle');
|
|
28
|
-
|
|
29
29
|
/**
|
|
30
30
|
* Passes the PiralApi methods to the UI library.
|
|
31
31
|
* @param app {UiConfig} object containing PiralApi methods for use in UI library.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryDataProvider.d.ts","sourceRoot":"","sources":["../../../src/components/Explorer/InMemoryDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,KAAK,cAAc,CAAC,CAAC,SAAS,IAAI,IAAI,CACpC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,CAAC,KACJ,OAAO,CAAC;AAEb,UAAU,uBAAuB,CAAC,CAAC,SAAS,IAAI;IAC9C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE;QAChB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;KACvC,CAAC;CACH;AAED,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,IAAI,EACvD,IAAI,EAAE,CAAC,EAAE,EACT,EACE,iBAAyB,EACzB,eAAoB,GACrB,GAAE,uBAAuB,CAAC,CAAC,CAAM,GACjC,oBAAoB,CAAC,CAAC,CAAC,CAqBzB;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,IAAI,CAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,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AC,YAAY,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAC/B,KAAK,CAAC,cAAc,CAAC,cAAc,GAAG,SAAS,CAAC,CACjD,CAAC;IACF,gBAAgB,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,IAAI,EAAE,EAC9C,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,WAAW,GACZ,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAsIzD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MessageBarProps } from '../MessageBar/MessageBar';
|
|
3
|
-
export interface StationMessage {
|
|
4
|
-
type: MessageBarProps['type'];
|
|
5
|
-
title: MessageBarProps['title'];
|
|
6
|
-
body?: React.ReactNode;
|
|
7
|
-
canClose: boolean;
|
|
8
|
-
onRetry?: MessageBarProps['onRetry'];
|
|
9
|
-
}
|
|
10
|
-
export declare const useStationMessage: () => {
|
|
11
|
-
stationMessage: StationMessage | undefined;
|
|
12
|
-
setStationMessage: React.Dispatch<React.SetStateAction<StationMessage | undefined>>;
|
|
13
|
-
StationMessage: JSX.Element;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=useStationMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStationMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Explorer/useStationMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAc,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9B,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,iBAAiB;;;oBAKZ,WAAW;CAwB5B,CAAC"}
|
|
File without changes
|