@axinom/mosaic-ui 0.33.0-rc.9 → 0.33.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/DynamicDataList/DynamicDataList.d.ts.map +1 -1
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts +3 -1
- package/dist/components/DynamicDataList/DynamicListRow/DynamicListRow.d.ts.map +1 -1
- package/dist/components/FormElements/CustomTags/CustomTags.d.ts.map +1 -1
- package/dist/components/FormElements/FileUploadControl/FileUploadControl.d.ts.map +1 -1
- package/dist/components/FormElements/Radio/Radio.d.ts.map +1 -1
- package/dist/components/FormElements/Tags/Tags.d.ts.map +1 -1
- package/dist/components/FormElements/formStoryHelper.d.ts.map +1 -1
- package/dist/components/FormStation/FormStation.d.ts.map +1 -1
- package/dist/components/InfoPanel/InfoImage/InfoImage.d.ts.map +1 -1
- package/dist/components/List/List.d.ts.map +1 -1
- package/dist/components/Loaders/ImageLoader/ImageLoader.d.ts +2 -0
- package/dist/components/Loaders/ImageLoader/ImageLoader.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/initialize.d.ts +7 -4
- package/dist/initialize.d.ts.map +1 -1
- package/dist/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.d.ts +9 -0
- package/dist/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.d.ts.map +1 -0
- package/dist/utils/ErrorMapper/ErrorMapper.d.ts +15 -0
- package/dist/utils/ErrorMapper/ErrorMapper.d.ts.map +1 -0
- package/dist/utils/ErrorMapper/ErrorMapper.type.d.ts +11 -0
- package/dist/utils/ErrorMapper/ErrorMapper.type.d.ts.map +1 -0
- package/dist/utils/ErrorMapper/index.d.ts +4 -0
- package/dist/utils/ErrorMapper/index.d.ts.map +1 -0
- package/dist/utils/ErrorTypeToStationError.d.ts +1 -1
- package/dist/utils/ErrorTypeToStationError.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Accordion/Accordion.scss +1 -1
- package/src/components/Accordion/AccordionItem/AccordionItem.scss +1 -1
- package/src/components/Actions/Action/Action.scss +0 -2
- package/src/components/Buttons/Button/Button.scss +66 -20
- package/src/components/Buttons/CompositeButton/CompositeButton.scss +50 -18
- package/src/components/Buttons/TextButton/TextButton.scss +45 -16
- package/src/components/DateTime/DatePicker/DatePicker.scss +15 -6
- package/src/components/DateTime/DateTimePicker.scss +6 -2
- package/src/components/DynamicDataList/DynamicDataList.tsx +1 -0
- package/src/components/DynamicDataList/DynamicListDataEntry/DynamicListDataEntry.scss +15 -5
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createInputRenderer/createInputRenderer.tsx +1 -1
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.scss +36 -12
- package/src/components/DynamicDataList/DynamicListDataEntry/Renderers/createSelectRenderer/createSelectRenderer.tsx +2 -2
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.scss +26 -0
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.tsx +7 -1
- package/src/components/Filters/Filter/Filter.scss +8 -2
- package/src/components/Filters/SelectionTypes/DateTimeFilter/DateTimeFilter.scss +4 -1
- package/src/components/FormElements/Checkbox/Checkbox.scss +20 -0
- package/src/components/FormElements/CustomTags/CustomTags.scss +24 -0
- package/src/components/FormElements/CustomTags/CustomTags.tsx +8 -2
- package/src/components/FormElements/DateTimeField/DateTimeText.spec.tsx +1 -1
- package/src/components/FormElements/DateTimeField/DateTimeText.tsx +1 -1
- package/src/components/FormElements/FileUploadControl/FileUploadControl.scss +4 -2
- package/src/components/FormElements/FileUploadControl/FileUploadControl.tsx +12 -3
- package/src/components/FormElements/Radio/Radio.scss +18 -3
- package/src/components/FormElements/Radio/Radio.tsx +2 -2
- package/src/components/FormElements/Select/Select.scss +10 -0
- package/src/components/FormElements/SingleLineText/SingleLineText.spec.tsx +2 -2
- package/src/components/FormElements/SingleLineText/SingleLineText.tsx +1 -1
- package/src/components/FormElements/Tags/Tags.scss +14 -0
- package/src/components/FormElements/Tags/Tags.tsx +5 -1
- package/src/components/FormElements/TextArea/TextArea.spec.tsx +2 -2
- package/src/components/FormElements/TextArea/TextArea.tsx +1 -1
- package/src/components/FormElements/formStoryHelper.tsx +163 -97
- package/src/components/FormStation/FormStation.spec.tsx +13 -3
- package/src/components/FormStation/FormStation.tsx +13 -3
- package/src/components/InfoPanel/InfoImage/InfoImage.scss +8 -3
- package/src/components/InfoPanel/InfoImage/InfoImage.tsx +1 -0
- package/src/components/List/List.tsx +3 -1
- package/src/components/List/ListCheckBox/ListCheckBox.scss +8 -3
- package/src/components/List/ListRow/ListRow.scss +0 -4
- package/src/components/Loaders/ImageLoader/ImageLoader.tsx +5 -0
- package/src/components/PageHeader/PageHeaderAction/PageHeaderAction.scss +0 -1
- package/src/components/index.ts +1 -1
- package/src/index.ts +1 -0
- package/src/initialize.ts +15 -12
- package/src/styles/variables.scss +32 -2
- package/src/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.spec.ts +32 -0
- package/src/utils/ErrorMapper/ApolloClient/ApolloErrorMapper.tsx +33 -0
- package/src/utils/ErrorMapper/ErrorMapper.spec.ts +67 -0
- package/src/utils/ErrorMapper/ErrorMapper.ts +31 -0
- package/src/utils/ErrorMapper/ErrorMapper.type.ts +11 -0
- package/src/utils/ErrorMapper/index.ts +3 -0
- package/src/utils/ErrorTypeToStationError.spec.tsx +12 -0
- package/src/utils/ErrorTypeToStationError.tsx +5 -1
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { faker } from '@faker-js/faker';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Checkbox,
|
|
5
|
+
CustomTags,
|
|
6
|
+
Divider,
|
|
7
|
+
FileUploadControl,
|
|
8
|
+
Radio,
|
|
9
|
+
ReadOnlyField,
|
|
10
|
+
Select,
|
|
11
|
+
SingleLineText,
|
|
12
|
+
Tags,
|
|
13
|
+
} from '.';
|
|
4
14
|
import { generateItemArray } from '../../helpers/storybook';
|
|
15
|
+
import { TextButton } from '../Buttons';
|
|
5
16
|
import { DynamicListColumn } from '../DynamicDataList/DynamicDataList.model';
|
|
6
17
|
import {
|
|
7
18
|
createInputRenderer,
|
|
@@ -10,6 +21,8 @@ import {
|
|
|
10
21
|
import { formatDateTime } from '../Utils';
|
|
11
22
|
import { BooleanViewField } from './BooleanView/BooleanViewField';
|
|
12
23
|
import { DynamicDataListControl } from './DynamicDataListControl/DynamicDataListControl';
|
|
24
|
+
import { FileUpload } from './FileUploadControl/FileUploadControl';
|
|
25
|
+
import { TextArea } from './TextArea/TextArea';
|
|
13
26
|
|
|
14
27
|
interface DynamicListStoryData {
|
|
15
28
|
position: number;
|
|
@@ -67,13 +80,13 @@ const dataListColumns: DynamicListColumn<DynamicListStoryData>[] = [
|
|
|
67
80
|
];
|
|
68
81
|
|
|
69
82
|
export const SampleForm: React.FC = () => useCreateForm().form;
|
|
70
|
-
|
|
71
83
|
export const useCreateForm = (): {
|
|
72
84
|
form: JSX.Element;
|
|
73
85
|
title: string;
|
|
74
86
|
} => {
|
|
75
87
|
const [id] = useState(faker.datatype.uuid());
|
|
76
88
|
const [title, setTitle] = useState(`The ${generateTitle()}`);
|
|
89
|
+
const [title2, setTitle2] = useState(`The ${generateTitle()}`);
|
|
77
90
|
const [genres, setGenres] = useState<string[]>(['Crime', 'Drama']);
|
|
78
91
|
const [ratings, setRatings] = useState<
|
|
79
92
|
string | number | string[] | undefined
|
|
@@ -94,104 +107,157 @@ export const useCreateForm = (): {
|
|
|
94
107
|
country: faker.address.country(),
|
|
95
108
|
})),
|
|
96
109
|
);
|
|
110
|
+
const [radio, setRadio] = useState(1);
|
|
111
|
+
const [check, setCheck] = useState<boolean>();
|
|
112
|
+
const [file, setFile] = useState<FileUpload>();
|
|
113
|
+
|
|
114
|
+
const [disabled, setDisabled] = useState<boolean>(false);
|
|
97
115
|
|
|
98
116
|
return {
|
|
99
117
|
form: (
|
|
100
|
-
|
|
101
|
-
style={{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
label="
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
118
|
+
<>
|
|
119
|
+
<div style={{ marginBottom: 10 }}>
|
|
120
|
+
<TextButton
|
|
121
|
+
onButtonClicked={() => setDisabled(!disabled)}
|
|
122
|
+
text="Toggle Disabled"
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
<Divider />
|
|
126
|
+
<form
|
|
127
|
+
style={{
|
|
128
|
+
display: 'grid',
|
|
129
|
+
gridAutoRows: 'max-content',
|
|
130
|
+
gridTemplateColumns: '1fr',
|
|
131
|
+
rowGap: '20px',
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<ReadOnlyField label="Id" value={id} />
|
|
135
|
+
<SingleLineText
|
|
136
|
+
name="title"
|
|
137
|
+
label="Title"
|
|
138
|
+
value={title}
|
|
139
|
+
disabled={disabled}
|
|
140
|
+
onChange={(e) => setTitle(e.currentTarget.value)}
|
|
141
|
+
/>
|
|
142
|
+
<ReadOnlyField label="Publish State" value="PUBLISHED" />
|
|
143
|
+
<BooleanViewField
|
|
144
|
+
label="Status"
|
|
145
|
+
value={status}
|
|
146
|
+
trueLabel="Enabled"
|
|
147
|
+
falseLabel="Disabled"
|
|
148
|
+
/>
|
|
149
|
+
<Tags
|
|
150
|
+
name="genres"
|
|
151
|
+
label="Genre(s)"
|
|
152
|
+
value={genres}
|
|
153
|
+
tagsOptions={genresOptions}
|
|
154
|
+
onChange={(e) =>
|
|
155
|
+
setGenres(e.currentTarget.value as unknown as string[])
|
|
156
|
+
}
|
|
157
|
+
disabled={disabled}
|
|
158
|
+
/>
|
|
159
|
+
<Select
|
|
160
|
+
name="ratings"
|
|
161
|
+
label="Rating"
|
|
162
|
+
value={ratings}
|
|
163
|
+
options={selectOptions}
|
|
164
|
+
onChange={(e) => setRatings(e.currentTarget.value)}
|
|
165
|
+
disabled={disabled}
|
|
166
|
+
/>
|
|
167
|
+
<SingleLineText
|
|
168
|
+
name="shortDescription"
|
|
169
|
+
label="Short Description"
|
|
170
|
+
value={shortDescription}
|
|
171
|
+
placeholder="Enter a short description..."
|
|
172
|
+
onChange={(e) => setShortDescription(e.currentTarget.value)}
|
|
173
|
+
disabled={disabled}
|
|
174
|
+
/>
|
|
175
|
+
<TextArea
|
|
176
|
+
name="longDescription"
|
|
177
|
+
label="Long Description"
|
|
178
|
+
value={longDescription}
|
|
179
|
+
placeholder="Enter a description..."
|
|
180
|
+
onChange={(e) => setLongDescription(e.currentTarget.value)}
|
|
181
|
+
disabled={disabled}
|
|
182
|
+
/>
|
|
183
|
+
<CustomTags
|
|
184
|
+
name="cast"
|
|
185
|
+
value={cast}
|
|
186
|
+
label="Cast"
|
|
187
|
+
onChange={(e) =>
|
|
188
|
+
setCast(e.currentTarget.value as unknown as string[])
|
|
189
|
+
}
|
|
190
|
+
disabled={disabled}
|
|
191
|
+
/>
|
|
192
|
+
<CustomTags
|
|
193
|
+
name="directors"
|
|
194
|
+
value={directors}
|
|
195
|
+
label="Director(s)"
|
|
196
|
+
onChange={(e) =>
|
|
197
|
+
setDirectors(e.currentTarget.value as unknown as string[])
|
|
198
|
+
}
|
|
199
|
+
disabled={disabled}
|
|
200
|
+
/>
|
|
201
|
+
<Tags
|
|
202
|
+
name="locales"
|
|
203
|
+
value={locales}
|
|
204
|
+
label="Locale(s)"
|
|
205
|
+
tagsOptions={['en_US', 'pt_PT', 'zh_CN']}
|
|
206
|
+
onChange={(e) =>
|
|
207
|
+
setLocales(e.currentTarget.value as unknown as string[])
|
|
208
|
+
}
|
|
209
|
+
disabled={disabled}
|
|
210
|
+
/>
|
|
211
|
+
<DynamicDataListControl
|
|
212
|
+
name={'dataList'}
|
|
213
|
+
label={'Subtitles'}
|
|
214
|
+
columns={dataListColumns}
|
|
215
|
+
value={dataList}
|
|
216
|
+
positionPropertyName={'position'}
|
|
217
|
+
allowReordering={true}
|
|
218
|
+
allowRowDragging={true}
|
|
219
|
+
allowNewData={true}
|
|
220
|
+
onChange={(e) => setDataList(e as DynamicListStoryData[])}
|
|
221
|
+
disabled={disabled}
|
|
222
|
+
/>
|
|
223
|
+
|
|
224
|
+
<Radio
|
|
225
|
+
value={radio}
|
|
226
|
+
onChange={(e) => setRadio(Number(e.currentTarget.value))}
|
|
227
|
+
options={[
|
|
228
|
+
{ value: 1, label: 'A' },
|
|
229
|
+
{ value: 2, label: 'B' },
|
|
230
|
+
{ value: 3, label: 'C' },
|
|
231
|
+
]}
|
|
232
|
+
name={'radio'}
|
|
233
|
+
label={'Category'}
|
|
234
|
+
disabled={disabled}
|
|
235
|
+
/>
|
|
236
|
+
|
|
237
|
+
<Checkbox
|
|
238
|
+
value={check}
|
|
239
|
+
onChange={setCheck}
|
|
240
|
+
name={'check'}
|
|
241
|
+
label={'Is Premium?'}
|
|
242
|
+
disabled={disabled}
|
|
243
|
+
/>
|
|
244
|
+
|
|
245
|
+
<FileUploadControl
|
|
246
|
+
name={'file'}
|
|
247
|
+
value={file}
|
|
248
|
+
onFileSelected={(file) => setFile(file)}
|
|
249
|
+
placeholder={'Select a file'}
|
|
250
|
+
label={'File'}
|
|
251
|
+
disabled={disabled}
|
|
252
|
+
/>
|
|
253
|
+
<ReadOnlyField
|
|
254
|
+
label="Created At"
|
|
255
|
+
value={createdTime.toISOString()}
|
|
256
|
+
transform={formatDateTime}
|
|
257
|
+
/>
|
|
258
|
+
<ReadOnlyField label="Writer(s)" value={writers} />
|
|
259
|
+
</form>
|
|
260
|
+
</>
|
|
195
261
|
),
|
|
196
262
|
title,
|
|
197
263
|
};
|
|
@@ -5,7 +5,7 @@ import { act } from 'react-dom/test-utils';
|
|
|
5
5
|
import { MemoryRouter, Route } from 'react-router-dom';
|
|
6
6
|
import * as Yup from 'yup';
|
|
7
7
|
import { noop } from '../../helpers/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { IndicatorType, setSaveIndicator } from '../../initialize';
|
|
9
9
|
import { ActionData, Actions } from '../Actions';
|
|
10
10
|
import { Action } from '../Actions/Action';
|
|
11
11
|
import { MessageBar } from '../MessageBar/MessageBar';
|
|
@@ -675,6 +675,11 @@ describe('Details', () => {
|
|
|
675
675
|
</FormStation>
|
|
676
676
|
</MemoryRouter>,
|
|
677
677
|
);
|
|
678
|
+
expect(setSaveIndicator).toHaveBeenNthCalledWith(
|
|
679
|
+
1,
|
|
680
|
+
IndicatorType.Inactive,
|
|
681
|
+
); // 1. inactive 2. dirty
|
|
682
|
+
expect(setSaveIndicator).toHaveBeenNthCalledWith(2, IndicatorType.Dirty); // 1. inactive 2. dirty
|
|
678
683
|
|
|
679
684
|
// submit form
|
|
680
685
|
const actionSelected = wrapper
|
|
@@ -692,7 +697,7 @@ describe('Details', () => {
|
|
|
692
697
|
|
|
693
698
|
wrapper.update();
|
|
694
699
|
|
|
695
|
-
expect(
|
|
700
|
+
expect(setSaveIndicator).toHaveBeenNthCalledWith(3, IndicatorType.Saving);
|
|
696
701
|
|
|
697
702
|
// complete form submission
|
|
698
703
|
await act(async () => {
|
|
@@ -700,7 +705,12 @@ describe('Details', () => {
|
|
|
700
705
|
});
|
|
701
706
|
wrapper.update();
|
|
702
707
|
|
|
703
|
-
expect(
|
|
708
|
+
expect(setSaveIndicator).toHaveBeenNthCalledWith(
|
|
709
|
+
4,
|
|
710
|
+
IndicatorType.Inactive,
|
|
711
|
+
);
|
|
712
|
+
|
|
713
|
+
console.warn((setSaveIndicator as jest.Mock).mock.calls);
|
|
704
714
|
});
|
|
705
715
|
});
|
|
706
716
|
});
|
|
@@ -16,7 +16,7 @@ import React, {
|
|
|
16
16
|
} from 'react';
|
|
17
17
|
import { useHistory } from 'react-router-dom';
|
|
18
18
|
import { OptionalObjectSchema } from 'yup/lib/object';
|
|
19
|
-
import {
|
|
19
|
+
import { IndicatorType, setSaveIndicator } from '../../initialize';
|
|
20
20
|
import { Data } from '../../types/data';
|
|
21
21
|
import { ErrorTypeToStationError } from '../../utils/ErrorTypeToStationError';
|
|
22
22
|
import { Actions, ActionsProps } from '../Actions';
|
|
@@ -155,7 +155,7 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
|
|
|
155
155
|
|
|
156
156
|
try {
|
|
157
157
|
setIsFormSubmitting(true);
|
|
158
|
-
|
|
158
|
+
setSaveIndicator(IndicatorType.Saving);
|
|
159
159
|
setStationError(undefined);
|
|
160
160
|
if (!initialData.loading && saveData) {
|
|
161
161
|
const response = await saveData(values, initialData, formikHelpers);
|
|
@@ -171,13 +171,14 @@ export const FormStation = <TValues extends Data, TSubmitResponse = unknown>({
|
|
|
171
171
|
),
|
|
172
172
|
);
|
|
173
173
|
|
|
174
|
+
setSaveIndicator(IndicatorType.Dirty);
|
|
175
|
+
|
|
174
176
|
// We still throw the error, to make sure that navigation or action execution
|
|
175
177
|
// will not continue after a failed save.
|
|
176
178
|
throw error;
|
|
177
179
|
} finally {
|
|
178
180
|
formikHelpers.setSubmitting(false);
|
|
179
181
|
setIsFormSubmitting(false);
|
|
180
|
-
hideSaveIndicator();
|
|
181
182
|
}
|
|
182
183
|
},
|
|
183
184
|
[isFormSubmitting, initialData, saveData, setStationError],
|
|
@@ -445,6 +446,15 @@ const FormStationHeader: React.FC<
|
|
|
445
446
|
> = ({ titleProperty, defaultTitle, subtitle, cancelNavigationUrl }) => {
|
|
446
447
|
const { dirty, resetForm, values } = useFormikContext<FormikValues>();
|
|
447
448
|
|
|
449
|
+
useEffect(() => {
|
|
450
|
+
// Set the save indicator to dirty depending on the form state
|
|
451
|
+
if (dirty) {
|
|
452
|
+
setSaveIndicator(IndicatorType.Dirty);
|
|
453
|
+
} else {
|
|
454
|
+
setSaveIndicator(IndicatorType.Inactive);
|
|
455
|
+
}
|
|
456
|
+
}, [dirty]);
|
|
457
|
+
|
|
448
458
|
const history = useHistory();
|
|
449
459
|
|
|
450
460
|
const title =
|
|
@@ -320,7 +320,9 @@ export const List = <T extends Data>({
|
|
|
320
320
|
horizontalTextAlign={horizontalTextAlign}
|
|
321
321
|
verticalTextAlign={verticalTextAlign}
|
|
322
322
|
showItemCheckbox={
|
|
323
|
-
enableSelectAll &&
|
|
323
|
+
enableSelectAll &&
|
|
324
|
+
selectionMode === ListSelectMode.Multi &&
|
|
325
|
+
listItems.length > 0
|
|
324
326
|
}
|
|
325
327
|
isCheckboxDisabled={listItems.length === 0}
|
|
326
328
|
onCheckboxToggled={headerCheckboxHandler}
|
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
.disabled {
|
|
11
11
|
background-color: var(
|
|
12
|
-
--
|
|
13
|
-
$
|
|
14
|
-
)
|
|
12
|
+
--actions-disabled-bg-color,
|
|
13
|
+
$actions-disabled-bg-color
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// background-color: var(
|
|
17
|
+
// --page-header-action-context-background-color,
|
|
18
|
+
// $page-header-action-context-background-color
|
|
19
|
+
// ) !important;
|
|
15
20
|
}
|
|
16
21
|
}
|
|
@@ -40,6 +40,9 @@ export interface ImageLoaderProps {
|
|
|
40
40
|
onImageClick?: (
|
|
41
41
|
event: React.MouseEvent<HTMLImageElement, MouseEvent>,
|
|
42
42
|
) => void;
|
|
43
|
+
|
|
44
|
+
/** CSS Class name for additional img element styles */
|
|
45
|
+
imageClassName?: string;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
@@ -65,6 +68,7 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
|
|
|
65
68
|
onError = noop,
|
|
66
69
|
onImageClick = noop,
|
|
67
70
|
children,
|
|
71
|
+
imageClassName = '',
|
|
68
72
|
}) => {
|
|
69
73
|
const actualViewBox = viewBox || `0 0 ${width} ${height}`;
|
|
70
74
|
|
|
@@ -135,6 +139,7 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
|
|
|
135
139
|
onError={onErrorHandler}
|
|
136
140
|
onClick={onImageClick}
|
|
137
141
|
data-test-id="image-loader-img"
|
|
142
|
+
className={imageClassName}
|
|
138
143
|
/>
|
|
139
144
|
{fallBack &&
|
|
140
145
|
(!fallbackSrc ? (
|
package/src/components/index.ts
CHANGED
|
@@ -19,8 +19,8 @@ export * from './List';
|
|
|
19
19
|
export * from './Loaders';
|
|
20
20
|
export * from './MessageBar';
|
|
21
21
|
export * from './Modal';
|
|
22
|
-
export * from './models';
|
|
23
22
|
export * from './NavigationAwareStation';
|
|
24
23
|
export * from './PageHeader';
|
|
25
24
|
export * from './ProgressBar';
|
|
26
25
|
export * from './Utils';
|
|
26
|
+
export * from './models';
|
package/src/index.ts
CHANGED
package/src/initialize.ts
CHANGED
|
@@ -5,6 +5,12 @@ import {
|
|
|
5
5
|
ShowNotification,
|
|
6
6
|
} from './types/ui-config';
|
|
7
7
|
|
|
8
|
+
export enum IndicatorType {
|
|
9
|
+
Saving = 'saving',
|
|
10
|
+
Inactive = 'inactive',
|
|
11
|
+
Dirty = 'dirty',
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
export let showNotification: ShowNotification | (() => void) =
|
|
9
15
|
polyfill('showNotification');
|
|
10
16
|
|
|
@@ -15,9 +21,8 @@ export let removeIndicator: RemoveIndicator | (() => void) =
|
|
|
15
21
|
|
|
16
22
|
export let on: CustomEventEmitter['on'] | (() => void) = polyfill('on');
|
|
17
23
|
|
|
18
|
-
export let
|
|
19
|
-
|
|
20
|
-
export let hideSaveIndicator: () => void = polyfill('hideSaveIndicator');
|
|
24
|
+
export let setSaveIndicator: (type: IndicatorType) => void =
|
|
25
|
+
polyfill('showSaveIndicator');
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* Passes the PiralApi methods to the UI library.
|
|
@@ -25,12 +30,11 @@ export let hideSaveIndicator: () => void = polyfill('hideSaveIndicator');
|
|
|
25
30
|
*/
|
|
26
31
|
export function initializeUi(app: UiConfig): void {
|
|
27
32
|
({
|
|
28
|
-
showNotification,
|
|
29
|
-
addIndicator,
|
|
30
|
-
removeIndicator,
|
|
31
|
-
on,
|
|
32
|
-
|
|
33
|
-
hideSaveIndicator,
|
|
33
|
+
showNotification = polyfill('showNotification'),
|
|
34
|
+
addIndicator = polyfill('addIndicator'),
|
|
35
|
+
removeIndicator = polyfill('removeIndicator'),
|
|
36
|
+
on = polyfill('on'),
|
|
37
|
+
setSaveIndicator = polyfill('setSaveIndicator'),
|
|
34
38
|
} = app);
|
|
35
39
|
}
|
|
36
40
|
|
|
@@ -39,15 +43,14 @@ export interface UiConfig {
|
|
|
39
43
|
addIndicator: AddIndicator;
|
|
40
44
|
removeIndicator: RemoveIndicator;
|
|
41
45
|
on: CustomEventEmitter['on'];
|
|
42
|
-
|
|
43
|
-
hideSaveIndicator: () => void;
|
|
46
|
+
setSaveIndicator: (type: IndicatorType) => void;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
function polyfill(methodName: string): () => void {
|
|
47
50
|
return () => {
|
|
48
51
|
// eslint-disable-next-line no-console
|
|
49
52
|
console.warn(
|
|
50
|
-
`Could not find ${methodName} method. Is the UI initialized in the pilet? To initialize UI library call 'initializeUi(app)' in your pilet.`,
|
|
53
|
+
`Could not find '${methodName}' method. Is the UI initialized in the pilet? To initialize UI library call 'initializeUi(app)' in your pilet.`,
|
|
51
54
|
);
|
|
52
55
|
};
|
|
53
56
|
}
|
|
@@ -41,6 +41,7 @@ $accordion-item-background-color: white;
|
|
|
41
41
|
$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
|
+
$accordion-item-arrow-color: $blue;
|
|
44
45
|
|
|
45
46
|
/* Explorer vars */
|
|
46
47
|
$explorer-background-color: #ffffff;
|
|
@@ -65,7 +66,7 @@ $filter-background-color: white;
|
|
|
65
66
|
$filter-background-selected-color: rgba($blue, 0.15);
|
|
66
67
|
$filter-light-font-color: $dark-gray;
|
|
67
68
|
$filter-option-background-color: #d7e9f1;
|
|
68
|
-
$filter-
|
|
69
|
+
$filter-context-button-color: $blue;
|
|
69
70
|
$filter-title-color: $blue;
|
|
70
71
|
$filter-font-size: 16px;
|
|
71
72
|
$filter-width: 360px;
|
|
@@ -184,7 +185,7 @@ $tag-font-color: $dark-gray;
|
|
|
184
185
|
$tag-background-color: $light-gray-2;
|
|
185
186
|
$form-error-color: $red;
|
|
186
187
|
$select-arrow-color: $blue;
|
|
187
|
-
$select-disabled-arrow-color: $
|
|
188
|
+
$select-disabled-arrow-color: $gray;
|
|
188
189
|
$label-font-size: 16px;
|
|
189
190
|
$file-upload-progress: $blue;
|
|
190
191
|
$file-upload-progress-background: $light-gray-2;
|
|
@@ -198,6 +199,16 @@ $form-element-min-height: 50px;
|
|
|
198
199
|
$read-only-text-background-color: $light-gray-2;
|
|
199
200
|
$select-background-color: white;
|
|
200
201
|
$form-indicator-color: $green;
|
|
202
|
+
$radio-hover-stroke-color: $blue;
|
|
203
|
+
$radio-checked-fill-color: $blue;
|
|
204
|
+
|
|
205
|
+
/* Date Time Picker*/
|
|
206
|
+
$calendar-tile-active: $blue;
|
|
207
|
+
$calendar-tile-active-hover: rgba($blue, 0.2);
|
|
208
|
+
$calendar-button-stroke-color: $blue;
|
|
209
|
+
$calendar-title-color: $dark-blue;
|
|
210
|
+
$calendar-container-border-color: $blue;
|
|
211
|
+
$calendar-container-bg-color: $blue;
|
|
201
212
|
|
|
202
213
|
/* Dynamic Data List */
|
|
203
214
|
$dynamic-list-row-bg-color: white;
|
|
@@ -271,3 +282,22 @@ $infotooltip-font-size: 16px;
|
|
|
271
282
|
/* Video Player */
|
|
272
283
|
$video-player-controls-background: $light-gray-2;
|
|
273
284
|
$video-player-controls-text-color: $dark-gray;
|
|
285
|
+
|
|
286
|
+
/* Buttons */
|
|
287
|
+
$navigation-button-background-color: $light-blue;
|
|
288
|
+
$navigation-button-background-color-hover: rgba($light-blue, 0.9);
|
|
289
|
+
$navigation-button-stroke-color: white;
|
|
290
|
+
$navigation-button-background-active-color: white;
|
|
291
|
+
$navigation-button-stroke-active-color: $light-blue;
|
|
292
|
+
$navigation-button-background-disabled-color: $gray;
|
|
293
|
+
$active-button-background-color: $blue;
|
|
294
|
+
$active-button-hover-background-color: rgba($blue, 0.9);
|
|
295
|
+
$active-button-stroke-background-color: white;
|
|
296
|
+
$active-button-active-background-color: white;
|
|
297
|
+
$active-button-active-stroke-color: $blue;
|
|
298
|
+
$context-button-border-color: $blue;
|
|
299
|
+
$context-button-stroke-color: $blue;
|
|
300
|
+
$context-button-hover-border-color: $blue;
|
|
301
|
+
$context-button-active-color: $blue;
|
|
302
|
+
$icon-button-stroke-color: $blue;
|
|
303
|
+
$icon-button-hover-color: $blue;
|