@axinom/mosaic-ui 0.51.0-rc.9 → 0.52.0-rc.0
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/PageHeaderAction/PageHeaderAction.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.d.ts +2 -1
- package/dist/components/PageHeader/PageHeaderAction/PageHeaderAction.model.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 +4 -3
- 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/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 -2
- package/src/components/PageHeader/PageHeader.stories.tsx +6 -2
- package/src/components/PageHeader/PageHeader.tsx +10 -16
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.model.ts +1 -0
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.scss +7 -0
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.tsx +1 -0
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.spec.tsx +19 -7
- package/src/components/PageHeader/PageHeaderActionsGroup/PageHeaderActionsGroup.tsx +19 -12
- 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
package/dist/initialize.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare let showNotification: ShowNotification | (() => void);
|
|
|
8
8
|
export declare let addIndicator: AddIndicator | (() => void);
|
|
9
9
|
export declare let removeIndicator: RemoveIndicator | (() => void);
|
|
10
10
|
export declare let on: CustomEventEmitter['on'] | (() => void);
|
|
11
|
-
export declare let setSaveIndicator: (type: SaveIndicatorType) => void;
|
|
12
11
|
export declare let setTitle: (title?: string) => void;
|
|
12
|
+
export declare let setSaveIndicator: (type: SaveIndicatorType) => void;
|
|
13
13
|
/**
|
|
14
14
|
* Passes the PiralApi methods to the UI library.
|
|
15
15
|
* @param app {UiConfig} object containing PiralApi methods for use in UI library.
|
package/dist/initialize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB;AAED,eAAO,IAAI,gBAAgB,EAAE,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAC7B,CAAC;AAE/B,eAAO,IAAI,YAAY,EAAE,YAAY,GAAG,CAAC,MAAM,IAAI,CAA4B,CAAC;AAEhF,eAAO,IAAI,eAAe,EAAE,eAAe,GAAG,CAAC,MAAM,IAAI,CAC5B,CAAC;AAE9B,eAAO,IAAI,EAAE,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAkB,CAAC;AAExE,eAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB;AAED,eAAO,IAAI,gBAAgB,EAAE,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAC7B,CAAC;AAE/B,eAAO,IAAI,YAAY,EAAE,YAAY,GAAG,CAAC,MAAM,IAAI,CAA4B,CAAC;AAEhF,eAAO,IAAI,eAAe,EAAE,eAAe,GAAG,CAAC,MAAM,IAAI,CAC5B,CAAC;AAE9B,eAAO,IAAI,EAAE,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAkB,CAAC;AAExE,eAAO,IAAI,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAA2B,CAAC;AAErE,eAAO,IAAI,gBAAgB,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAC5B,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAShD;AAED,MAAM,WAAW,QAAQ;IACvB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC7B,gBAAgB,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpD,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0-rc.0",
|
|
4
4
|
"description": "UI components for building Axinom Mosaic applications",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
"build-storybook": "storybook build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@axinom/mosaic-core": "^0.4.
|
|
35
|
+
"@axinom/mosaic-core": "^0.4.25-rc.0",
|
|
36
36
|
"@faker-js/faker": "^7.4.0",
|
|
37
|
+
"@geoffcox/react-splitter": "^2.1.2",
|
|
37
38
|
"@popperjs/core": "^2.11.8",
|
|
38
39
|
"clsx": "^1.1.0",
|
|
39
40
|
"lodash": "^4.17.21",
|
|
@@ -105,5 +106,5 @@
|
|
|
105
106
|
"publishConfig": {
|
|
106
107
|
"access": "public"
|
|
107
108
|
},
|
|
108
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "40b2eedf8826a60afe1edd6e37dd6e12c0c3254a"
|
|
109
110
|
}
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import { mount, shallow } from 'enzyme';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { noop } from '../../helpers/utils';
|
|
4
|
+
import { initializeUi } from '../../initialize';
|
|
3
5
|
import { MessageBar } from '../MessageBar';
|
|
4
6
|
import { PageHeader } from '../PageHeader';
|
|
5
7
|
import { StationError } from '../models';
|
|
6
8
|
import { EmptyStation, EmptyStationProps } from './EmptyStation';
|
|
7
9
|
|
|
8
10
|
describe('EmptyStation', () => {
|
|
11
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
12
|
+
observe: jest.fn(),
|
|
13
|
+
unobserve: jest.fn(),
|
|
14
|
+
disconnect: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
initializeUi({
|
|
19
|
+
showNotification: () => {
|
|
20
|
+
// not implemented
|
|
21
|
+
return -1;
|
|
22
|
+
},
|
|
23
|
+
addIndicator: () => {
|
|
24
|
+
return -1;
|
|
25
|
+
},
|
|
26
|
+
removeIndicator: noop,
|
|
27
|
+
on: noop,
|
|
28
|
+
setTitle: noop,
|
|
29
|
+
setSaveIndicator: noop,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
9
33
|
const defaultProps: EmptyStationProps = {
|
|
10
34
|
title: 'test-title',
|
|
11
35
|
subtitle: 'test-subtitle',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Split, SplitProps } from '@geoffcox/react-splitter';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface ConditionalSplitProps extends React.PropsWithChildren<SplitProps> {
|
|
5
|
+
shouldSplit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ConditionalSplit: React.FC<ConditionalSplitProps> = ({
|
|
9
|
+
shouldSplit = true,
|
|
10
|
+
children,
|
|
11
|
+
...rest
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<Split
|
|
15
|
+
initialPrimarySize={shouldSplit ? '50%' : '100%'}
|
|
16
|
+
minPrimarySize={shouldSplit ? '0' : '100%'}
|
|
17
|
+
splitterSize={shouldSplit ? '7px' : '0'}
|
|
18
|
+
{...rest}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</Split>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { LocationDescriptor } from 'history';
|
|
1
2
|
import { Data } from '../../types/data';
|
|
2
3
|
import { FilterValues } from '../Filters';
|
|
4
|
+
import { IconName } from '../Icons';
|
|
3
5
|
import { SortData } from '../List';
|
|
4
|
-
import { ErrorType } from '../models';
|
|
5
6
|
import { PageHeaderJsActionProps } from '../PageHeader/PageHeaderAction/PageHeaderAction.model';
|
|
7
|
+
import { ErrorType } from '../models';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Item selection can have two modes:
|
|
@@ -105,3 +107,19 @@ export interface ExplorerStateOptions {
|
|
|
105
107
|
filters?: boolean;
|
|
106
108
|
sort?: boolean;
|
|
107
109
|
}
|
|
110
|
+
|
|
111
|
+
export interface QuickEditRegistration<T> {
|
|
112
|
+
/** The label of the action. */
|
|
113
|
+
label: string;
|
|
114
|
+
/** Optional built in icon. This prop also accepts an img src. */
|
|
115
|
+
icon?: IconName | string;
|
|
116
|
+
/** Component to render */
|
|
117
|
+
component: JSX.Element;
|
|
118
|
+
/** Function which will be used to generate the `detailsLink` in `QuickEditContext`.
|
|
119
|
+
*
|
|
120
|
+
* If set to `undefined`, `generateItemLink` prop from `Explorer` will be used.
|
|
121
|
+
*
|
|
122
|
+
* If set to `false`, `detailsLink` will not be generated.
|
|
123
|
+
*/
|
|
124
|
+
generateDetailsLink?: ((item: T) => LocationDescriptor<unknown>) | false;
|
|
125
|
+
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { noop } from '../../helpers/utils';
|
|
14
14
|
import * as expandHook from '../../hooks/useExpand/useExpand';
|
|
15
15
|
import * as app from '../../initialize';
|
|
16
|
+
import { initializeUi } from '../../initialize';
|
|
16
17
|
import { Data } from '../../types/data';
|
|
17
18
|
import { ActionData } from '../Actions';
|
|
18
19
|
import { Filters } from '../Filters/Filters';
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
ExplorerDataProvider,
|
|
33
34
|
ExplorerDataProviderConnection,
|
|
34
35
|
} from './Explorer.model';
|
|
35
|
-
import { StationMessage } from './useStationMessage';
|
|
36
|
+
import { StationMessage } from './helpers/useStationMessage';
|
|
36
37
|
|
|
37
38
|
jest.mock('../../utils/GenerateId', () => ({
|
|
38
39
|
uuid: jest.fn().mockReturnValue('test-uuid'),
|
|
@@ -73,6 +74,30 @@ const getDataProvider = function <T extends Data = ExplorerTestData>() {
|
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
describe('Explorer', () => {
|
|
77
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
78
|
+
observe: jest.fn(),
|
|
79
|
+
unobserve: jest.fn(),
|
|
80
|
+
disconnect: jest.fn(),
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
jest.clearAllMocks();
|
|
85
|
+
|
|
86
|
+
initializeUi({
|
|
87
|
+
showNotification: () => {
|
|
88
|
+
// not implemented
|
|
89
|
+
return -1;
|
|
90
|
+
},
|
|
91
|
+
addIndicator: () => {
|
|
92
|
+
return -1;
|
|
93
|
+
},
|
|
94
|
+
removeIndicator: noop,
|
|
95
|
+
on: noop,
|
|
96
|
+
setTitle: noop,
|
|
97
|
+
setSaveIndicator: noop,
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
76
101
|
it('renders the component without crashing', () => {
|
|
77
102
|
const [provider] = getDataProvider();
|
|
78
103
|
const wrapper = shallow(
|
|
@@ -1865,8 +1890,8 @@ describe('Explorer', () => {
|
|
|
1865
1890
|
};
|
|
1866
1891
|
const getStateSpy = jest
|
|
1867
1892
|
.spyOn(GS, 'getState')
|
|
1868
|
-
.mockReturnValueOnce(mockInitialState['mock-key']['
|
|
1869
|
-
.mockReturnValueOnce(mockInitialState['mock-key']['
|
|
1893
|
+
.mockReturnValueOnce(mockInitialState['mock-key']['sort'])
|
|
1894
|
+
.mockReturnValueOnce(mockInitialState['mock-key']['filters']);
|
|
1870
1895
|
|
|
1871
1896
|
const wrapper = await actWithReturn(() =>
|
|
1872
1897
|
mount(
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { faker } from '@faker-js/faker';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
import
|
|
4
|
+
import { Field } from 'formik';
|
|
5
|
+
import React, { useContext } from 'react';
|
|
5
6
|
import { MemoryRouter } from 'react-router';
|
|
7
|
+
import * as Yup from 'yup';
|
|
6
8
|
import {
|
|
7
9
|
createGroups,
|
|
8
10
|
enumToObj,
|
|
@@ -11,13 +13,20 @@ import {
|
|
|
11
13
|
} from '../../helpers/storybook';
|
|
12
14
|
import { initializeUi } from '../../initialize';
|
|
13
15
|
import { FilterTypes } from '../Filters/Filters.model';
|
|
16
|
+
import { ReadOnlyField, SingleLineTextField } from '../FormElements';
|
|
17
|
+
import {
|
|
18
|
+
FormStation,
|
|
19
|
+
InitialFormData,
|
|
20
|
+
ObjectSchemaDefinition,
|
|
21
|
+
} from '../FormStation';
|
|
14
22
|
import { IconName } from '../Icons';
|
|
15
23
|
import { ListSelectMode } from '../List';
|
|
16
24
|
import { Explorer } from './Explorer';
|
|
25
|
+
import { QuickEditContext } from './QuickEdit/QuickEditContext';
|
|
17
26
|
import {
|
|
18
27
|
createInMemoryDataProvider,
|
|
19
28
|
findAnywhereInStringCaseInsensitive,
|
|
20
|
-
} from './InMemoryDataProvider';
|
|
29
|
+
} from './helpers/InMemoryDataProvider';
|
|
21
30
|
|
|
22
31
|
interface ExplorerStoryData {
|
|
23
32
|
id: number;
|
|
@@ -74,6 +83,14 @@ const groups = createGroups({
|
|
|
74
83
|
const meta: Meta<ExplorerStoryType> = {
|
|
75
84
|
title: 'Primary Components/Station Controls/Explorer',
|
|
76
85
|
component: Explorer,
|
|
86
|
+
decorators: [
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
88
|
+
(Story) => (
|
|
89
|
+
<MemoryRouter>
|
|
90
|
+
<Story />
|
|
91
|
+
</MemoryRouter>
|
|
92
|
+
),
|
|
93
|
+
],
|
|
77
94
|
argTypes: {
|
|
78
95
|
...groups,
|
|
79
96
|
selectionMode: {
|
|
@@ -247,15 +264,15 @@ initializeUi({
|
|
|
247
264
|
removeIndicator: (args) => {
|
|
248
265
|
action('removeIndicator')(args);
|
|
249
266
|
},
|
|
250
|
-
setSaveIndicator: () => {
|
|
251
|
-
action('setSaveIndicator')();
|
|
252
|
-
},
|
|
253
267
|
on: (event, callback) => {
|
|
254
268
|
action('on')(event, callback);
|
|
255
269
|
},
|
|
256
270
|
setTitle: (args) => {
|
|
257
271
|
action('setTitle')(args);
|
|
258
272
|
},
|
|
273
|
+
setSaveIndicator: (args) => {
|
|
274
|
+
action('setSaveIndicator')(args);
|
|
275
|
+
},
|
|
259
276
|
});
|
|
260
277
|
|
|
261
278
|
export const ActionErrors: StoryObj<ExplorerStoryType> = {
|
|
@@ -399,3 +416,71 @@ export const DataProviderConnection: StoryObj<ExplorerStoryType> = {
|
|
|
399
416
|
},
|
|
400
417
|
},
|
|
401
418
|
};
|
|
419
|
+
|
|
420
|
+
const QuickEditComponent: React.FC = () => {
|
|
421
|
+
const { selectedItem } = useContext(QuickEditContext);
|
|
422
|
+
|
|
423
|
+
return (
|
|
424
|
+
<FormStation<ExplorerStoryData>
|
|
425
|
+
initialData={{ loading: false, data: selectedItem }}
|
|
426
|
+
titleProperty={'title'}
|
|
427
|
+
saveData={function (
|
|
428
|
+
values: ExplorerStoryData,
|
|
429
|
+
initialData: InitialFormData<ExplorerStoryData>,
|
|
430
|
+
): void | Promise<unknown> {
|
|
431
|
+
action('Save')(values, initialData);
|
|
432
|
+
}}
|
|
433
|
+
validationSchema={Yup.object<ObjectSchemaDefinition<ExplorerStoryData>>({
|
|
434
|
+
title: Yup.string()
|
|
435
|
+
.max(10, 'Title can only be 10 characters')
|
|
436
|
+
.required('Title is required'),
|
|
437
|
+
id: Yup.number().optional(),
|
|
438
|
+
desc: Yup.string().optional(),
|
|
439
|
+
})}
|
|
440
|
+
>
|
|
441
|
+
<>
|
|
442
|
+
<Field name="id" label="Id" as={ReadOnlyField} />
|
|
443
|
+
<Field name="title" label="Title" as={SingleLineTextField} />
|
|
444
|
+
</>
|
|
445
|
+
</FormStation>
|
|
446
|
+
);
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const QuickEditComponent2: React.FC = () => {
|
|
450
|
+
const { selectedItem } = useContext(QuickEditContext);
|
|
451
|
+
|
|
452
|
+
return (
|
|
453
|
+
<FormStation<ExplorerStoryData>
|
|
454
|
+
initialData={{ loading: false, data: selectedItem }}
|
|
455
|
+
titleProperty={'title'}
|
|
456
|
+
saveData={function (
|
|
457
|
+
values: ExplorerStoryData,
|
|
458
|
+
initialData: InitialFormData<ExplorerStoryData>,
|
|
459
|
+
): void | Promise<unknown> {
|
|
460
|
+
action('Save')(values, initialData);
|
|
461
|
+
}}
|
|
462
|
+
>
|
|
463
|
+
<>
|
|
464
|
+
<Field name="id" label="Id" as={ReadOnlyField} />
|
|
465
|
+
<Field name="desc" label="Description" as={SingleLineTextField} />
|
|
466
|
+
</>
|
|
467
|
+
</FormStation>
|
|
468
|
+
);
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export const QuickEdit: StoryObj<ExplorerStoryType> = {
|
|
472
|
+
args: {
|
|
473
|
+
...Default.args,
|
|
474
|
+
stationKey: 'StoryBookExplorer_QuickEdit',
|
|
475
|
+
quickEditRegistrations: [
|
|
476
|
+
{
|
|
477
|
+
label: 'Quick Edit (Title)',
|
|
478
|
+
component: <QuickEditComponent />,
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
label: 'Quick Edit (Description)',
|
|
482
|
+
component: <QuickEditComponent2 />,
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
},
|
|
486
|
+
};
|