@axinom/mosaic-ui 0.63.0-rc.3 → 0.63.0-rc.5
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/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts +1 -1
- package/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts.map +1 -1
- package/dist/components/Explorer/BulkEdit/useBulkEdit.d.ts.map +1 -1
- package/dist/components/Explorer/Explorer.model.d.ts +1 -1
- package/dist/components/Explorer/Explorer.model.d.ts.map +1 -1
- package/dist/components/FieldSelection/FieldSelection.d.ts +2 -0
- package/dist/components/FieldSelection/FieldSelection.d.ts.map +1 -1
- package/dist/components/FormStation/FormStation.d.ts +11 -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/helpers/useDataProvider.d.ts +1 -1
- package/dist/components/FormStation/helpers/useDataProvider.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/package.json +2 -2
- package/src/components/Accordion/Accordion.scss +14 -4
- package/src/components/Accordion/Accordion.spec.tsx +44 -64
- package/src/components/Accordion/Accordion.stories.tsx +8 -0
- package/src/components/Accordion/Accordion.tsx +4 -0
- package/src/components/Accordion/AccordionItem/AccordionItem.spec.tsx +46 -84
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.spec.tsx +22 -18
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.tsx +59 -21
- package/src/components/Explorer/BulkEdit/useBulkEdit.tsx +5 -8
- package/src/components/Explorer/Explorer.model.ts +1 -1
- package/src/components/FieldSelection/FieldSelection.tsx +7 -0
- package/src/components/FormStation/FormStation.tsx +14 -1
- package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +4 -1
- package/src/components/FormStation/helpers/useDataProvider.ts +6 -2
- package/src/styles/variables.scss +1 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
+
import { noop } from '../../helpers/utils';
|
|
2
3
|
import { Accordion, AccordionItem } from '../Accordion';
|
|
3
4
|
import { Button, ButtonContext } from '../Buttons';
|
|
4
5
|
import { Select } from '../FormElements';
|
|
@@ -8,6 +9,8 @@ import classes from './FieldSelection.scss';
|
|
|
8
9
|
|
|
9
10
|
interface FieldSelectionProps {
|
|
10
11
|
className?: string;
|
|
12
|
+
onFieldAdded?: (field: string) => void;
|
|
13
|
+
onFieldRemoved?: (field: string) => void;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
interface FieldDefinition {
|
|
@@ -19,6 +22,8 @@ interface FieldDefinition {
|
|
|
19
22
|
|
|
20
23
|
export const FieldSelection: React.FC<FieldSelectionProps> = ({
|
|
21
24
|
className,
|
|
25
|
+
onFieldAdded = noop,
|
|
26
|
+
onFieldRemoved = noop,
|
|
22
27
|
children,
|
|
23
28
|
}) => {
|
|
24
29
|
useEffect(() => {
|
|
@@ -70,6 +75,7 @@ export const FieldSelection: React.FC<FieldSelectionProps> = ({
|
|
|
70
75
|
...currentFields,
|
|
71
76
|
newField,
|
|
72
77
|
]);
|
|
78
|
+
onFieldAdded(newField.value);
|
|
73
79
|
}
|
|
74
80
|
}}
|
|
75
81
|
/>
|
|
@@ -88,6 +94,7 @@ export const FieldSelection: React.FC<FieldSelectionProps> = ({
|
|
|
88
94
|
setAvailableFields((currentFields) =>
|
|
89
95
|
[...currentFields, field].sort((a, b) => a.index - b.index),
|
|
90
96
|
);
|
|
97
|
+
onFieldRemoved(field.value);
|
|
91
98
|
}}
|
|
92
99
|
/>
|
|
93
100
|
}
|
|
@@ -39,6 +39,16 @@ export interface FormStationProps<
|
|
|
39
39
|
actionsWidth?: string;
|
|
40
40
|
/** If set to true, the save header action is shown. (default: true) */
|
|
41
41
|
showSaveHeaderAction?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If set, this will override the default title of the save header action.
|
|
44
|
+
* This is useful when you want to have a custom title for the save action.
|
|
45
|
+
*/
|
|
46
|
+
saveHeaderActionTitle?: string;
|
|
47
|
+
/**
|
|
48
|
+
* If set, this will override the default notification message shown
|
|
49
|
+
* after a successful save.
|
|
50
|
+
*/
|
|
51
|
+
saveNotificationMessage?: string;
|
|
42
52
|
/**
|
|
43
53
|
* An object containing the initial data of the form.
|
|
44
54
|
*/
|
|
@@ -91,6 +101,8 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
|
|
|
91
101
|
className = '',
|
|
92
102
|
setTabTitle = true,
|
|
93
103
|
showSaveHeaderAction = true,
|
|
104
|
+
saveHeaderActionTitle,
|
|
105
|
+
saveNotificationMessage,
|
|
94
106
|
}: PropsWithChildren<
|
|
95
107
|
FormStationProps<TValues, TSubmitResponse>
|
|
96
108
|
>): JSX.Element => {
|
|
@@ -103,7 +115,7 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
|
|
|
103
115
|
setStationError,
|
|
104
116
|
isFormSubmitting,
|
|
105
117
|
lastSubmittedResponse,
|
|
106
|
-
} = useDataProvider(initialData, saveData);
|
|
118
|
+
} = useDataProvider(initialData, saveData, saveNotificationMessage);
|
|
107
119
|
|
|
108
120
|
const { setValidationError, validationWatcher } = useValidationError(
|
|
109
121
|
stationError,
|
|
@@ -137,6 +149,7 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
|
|
|
137
149
|
className={classes.header}
|
|
138
150
|
setTabTitle={setTabTitle}
|
|
139
151
|
showSaveHeaderAction={showSaveHeaderAction}
|
|
152
|
+
saveHeaderActionTitle={saveHeaderActionTitle}
|
|
140
153
|
/>
|
|
141
154
|
{!bulkEditContext && (
|
|
142
155
|
<SaveOnNavigate
|
|
@@ -22,6 +22,7 @@ export const FormStationHeader: React.FC<
|
|
|
22
22
|
cancelNavigationUrl?: string;
|
|
23
23
|
setTabTitle?: boolean;
|
|
24
24
|
showSaveHeaderAction?: boolean;
|
|
25
|
+
saveHeaderActionTitle?: string;
|
|
25
26
|
}
|
|
26
27
|
> = ({
|
|
27
28
|
titleProperty,
|
|
@@ -31,6 +32,7 @@ export const FormStationHeader: React.FC<
|
|
|
31
32
|
className,
|
|
32
33
|
setTabTitle,
|
|
33
34
|
showSaveHeaderAction,
|
|
35
|
+
saveHeaderActionTitle = 'Save',
|
|
34
36
|
}) => {
|
|
35
37
|
const { dirty, submitForm, resetForm } = useFormikContext<FormikValues>();
|
|
36
38
|
const quickEditContext = useContext(QuickEditContext);
|
|
@@ -56,7 +58,7 @@ export const FormStationHeader: React.FC<
|
|
|
56
58
|
|
|
57
59
|
if (showSaveHeaderAction) {
|
|
58
60
|
actionItems.push({
|
|
59
|
-
label:
|
|
61
|
+
label: saveHeaderActionTitle,
|
|
60
62
|
icon: IconName.Save,
|
|
61
63
|
kind: 'action',
|
|
62
64
|
actionType: PageHeaderActionType.Context,
|
|
@@ -116,6 +118,7 @@ export const FormStationHeader: React.FC<
|
|
|
116
118
|
history,
|
|
117
119
|
quickEditContext,
|
|
118
120
|
resetForm,
|
|
121
|
+
saveHeaderActionTitle,
|
|
119
122
|
showSaveHeaderAction,
|
|
120
123
|
submitForm,
|
|
121
124
|
]);
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
export type FormStationDataProvider = <TValues extends Data, TSubmitResponse>(
|
|
21
21
|
initialData: InitialFormData<TValues>,
|
|
22
22
|
saveData: SaveDataFunction<TValues, TSubmitResponse>,
|
|
23
|
+
saveNotificationMessage?: string,
|
|
23
24
|
) => {
|
|
24
25
|
onSubmit: (
|
|
25
26
|
values: TValues,
|
|
@@ -38,6 +39,7 @@ export const useDataProvider: FormStationDataProvider = <
|
|
|
38
39
|
>(
|
|
39
40
|
initialData: InitialFormData<TValues>,
|
|
40
41
|
saveData: SaveDataFunction<TValues, TSubmitResponse>,
|
|
42
|
+
saveNotificationMessage?: string,
|
|
41
43
|
) => {
|
|
42
44
|
const [stationError, setStationError] = useState<StationErrorStateType>();
|
|
43
45
|
const [isFormSubmitting, setIsFormSubmitting] = useState<boolean>(false);
|
|
@@ -92,7 +94,9 @@ export const useDataProvider: FormStationDataProvider = <
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
showNotification({
|
|
95
|
-
title:
|
|
97
|
+
title:
|
|
98
|
+
saveNotificationMessage ??
|
|
99
|
+
'Your changes were saved successfully.',
|
|
96
100
|
options: {
|
|
97
101
|
type: 'success',
|
|
98
102
|
autoClose: 1500,
|
|
@@ -115,7 +119,7 @@ export const useDataProvider: FormStationDataProvider = <
|
|
|
115
119
|
setIsFormSubmitting(false);
|
|
116
120
|
}
|
|
117
121
|
},
|
|
118
|
-
[isFormSubmitting, initialData, saveData,
|
|
122
|
+
[isFormSubmitting, initialData, saveData, saveNotificationMessage],
|
|
119
123
|
);
|
|
120
124
|
|
|
121
125
|
return {
|
|
@@ -42,6 +42,7 @@ $accordion-item-text-color: $dark-gray;
|
|
|
42
42
|
$accordion-item-hover-color: rgba($blue, 0.15);
|
|
43
43
|
$accordion-item-border: 1px solid $light-gray;
|
|
44
44
|
$accordion-item-arrow-color: $blue;
|
|
45
|
+
$accordion-item-arrow-disabled-color: $gray;
|
|
45
46
|
|
|
46
47
|
/* Explorer vars */
|
|
47
48
|
$explorer-background-color: #ffffff;
|