@scality/core-ui 0.132.0 → 0.133.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/UnsuccessfulResult.component.d.ts +5 -0
- package/dist/components/UnsuccessfulResult.component.d.ts.map +1 -1
- package/dist/components/UnsuccessfulResult.component.js +1 -1
- package/dist/components/tablev2/TableCommon.d.ts.map +1 -1
- package/dist/components/tablev2/TableCommon.js +7 -2
- package/dist/components/toast/useMutationsHandler.d.ts +2 -1
- package/dist/components/toast/useMutationsHandler.d.ts.map +1 -1
- package/dist/components/toast/useMutationsHandler.js +13 -8
- package/package.json +1 -1
- package/src/lib/components/UnsuccessfulResult.component.tsx +1 -1
- package/src/lib/components/tablev2/TableCommon.tsx +29 -14
- package/src/lib/components/toast/useMutationsHandler.ts +6 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TableHeightKeyType, TableLocalType } from './tablev2/TableUtils';
|
|
3
|
+
export declare const NoResult: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").GridProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & import("styled-system").BordersProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ShadowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
|
|
4
|
+
gap?: string | number | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
height: number | string;
|
|
7
|
+
}, never>;
|
|
3
8
|
export type UnsuccessfulResultProps = {
|
|
4
9
|
name?: {
|
|
5
10
|
en: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsuccessfulResult.component.d.ts","sourceRoot":"","sources":["../../src/lib/components/UnsuccessfulResult.component.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,kBAAkB,EAClB,cAAc,EAGf,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"UnsuccessfulResult.component.d.ts","sourceRoot":"","sources":["../../src/lib/components/UnsuccessfulResult.component.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,kBAAkB,EAClB,cAAc,EAGf,MAAM,sBAAsB,CAAC;AAK9B,eAAO,MAAM,QAAQ;;;YAAyB,MAAM,GAAG,MAAM;SAO5D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE;QACL,EAAE,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,EAAE,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3C,CAAC;IACF,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;CACnD,GAAG,CACA;IAAE,SAAS,EAAE,kBAAkB,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,GACtD;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CACvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,uBAAuB,gBAehE,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { tableRowHeight, translatedMessages, } from './tablev2/TableUtils';
|
|
|
6
6
|
import { Text } from './text/Text.component';
|
|
7
7
|
import { Box } from './box/Box';
|
|
8
8
|
import { spacing } from '../spacing';
|
|
9
|
-
const NoResult = styled(Box) `
|
|
9
|
+
export const NoResult = styled(Box) `
|
|
10
10
|
display: flex;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCommon.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/TableCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EACL,aAAa,EAEb,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,kBAAkB,EAClB,cAAc,EAEf,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,KAAK,mBAAmB,CACtB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAChE;IACF,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtB,SAAS,EAAE,aAAa,CAAC,uBAAuB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACnE,SAAS,EAAE,kBAAkB,CAAC;IAC9B,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,mBAA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CACtB,CAAC;AAEF,KAAK,cAAc,CACjB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAChE;IACF,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC;IAClD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;IAC1D,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAClC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,aAAa,KAAK,GAAG,CAAC,OAAO,CACjD,CAAC;CACH,CAAC;AACF,wBAAgB,SAAS,CACvB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,sBAyEzE"}
|
|
@@ -51,13 +51,18 @@ export function TableRows({ locale, children, customItemKey, RenderRow }) {
|
|
|
51
51
|
}
|
|
52
52
|
if (status === 'success' || status === undefined) {
|
|
53
53
|
if (typeof children === 'function') {
|
|
54
|
-
|
|
54
|
+
if (rows.length) {
|
|
55
|
+
return children(_jsx(VirtualizedRows, { rows: rows, listRef: bodyRef, itemKey: itemKey, rowHeight: rowHeight, setHasScrollbar: setHasScrollbar, onBottom: onBottom, onBottomOffset: onBottomOffset, RenderRow: RenderRow }));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return children(_jsx(UnsuccessfulResult, { rowHeight: rowHeight, name: entityName, status: "noResult" }));
|
|
59
|
+
}
|
|
55
60
|
}
|
|
56
61
|
else if (rows.length) {
|
|
57
62
|
return (_jsx(VirtualizedRows, { rows: rows, listRef: bodyRef, setHasScrollbar: setHasScrollbar, onBottom: onBottom, onBottomOffset: onBottomOffset, itemKey: itemKey, rowHeight: rowHeight, RenderRow: RenderRow }));
|
|
58
63
|
}
|
|
59
64
|
else {
|
|
60
|
-
return _jsx(UnsuccessfulResult, { name: entityName, status: "noResult" });
|
|
65
|
+
return (_jsx(UnsuccessfulResult, { rowHeight: rowHeight, name: entityName, status: "noResult" }));
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
return null;
|
|
@@ -13,7 +13,8 @@ declare type GetDescriptionBuilder<T> = T extends MutationConfig<MinimalMutation
|
|
|
13
13
|
declare type MutationsResults<T extends unknown[]> = T extends [] ? [] : T extends [infer Head, ...infer Tail] ? [GetResults<Head>, ...MutationsResults<Tail>] : T extends [infer Head] ? [GetResults<Head>] : unknown[] extends T ? T : never;
|
|
14
14
|
declare enum DescriptionBuilderStatus {
|
|
15
15
|
Success = "success",
|
|
16
|
-
Error = "error"
|
|
16
|
+
Error = "error",
|
|
17
|
+
Idle = "idle"
|
|
17
18
|
}
|
|
18
19
|
type DescriptionBuilder<Data = unknown, Error = unknown> = {
|
|
19
20
|
error?: Error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationsHandler.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/useMutationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAY,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,QAAQ,EAAE,CAAC,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,OAAO,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CACnD,qBAAqB,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,C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,gBAAgB,CAAC,CAAC;IAC/C,kBAAkB,CAAC,EACf,SAAS,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACjC,cAAc,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;IAC9D,yBAAyB,EAAE,CACzB,SAAS,EAAE,CAAC,SAAS,EAAE,GACnB,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,GACzC,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,EAAE,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,KACrE,SAAS,CAAC;IACf,UAAU,CAAC,EAAE,IAAI,CACf,iBAAiB,EACjB,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,iBAAiB,CACtE,CAAC;CACH,GAAG,CACA;IAAE,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,qBAAqB,CAAC,EAAE,KAAK,CAAA;CAAE,GACrE;IAAE,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,qBAAqB,CAAC,EAAE,KAAK,CAAA;CAAE,CACxE,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,KAAK,EAAE,MAAM,IAAI,IAAI,CACrD,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAClD,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CACpE,CAAC;AAEF,eAAO,MAAM,mBAAmB,oNAoF/B,CAAC"}
|
|
@@ -4,6 +4,7 @@ var DescriptionBuilderStatus;
|
|
|
4
4
|
(function (DescriptionBuilderStatus) {
|
|
5
5
|
DescriptionBuilderStatus["Success"] = "success";
|
|
6
6
|
DescriptionBuilderStatus["Error"] = "error";
|
|
7
|
+
DescriptionBuilderStatus["Idle"] = "idle";
|
|
7
8
|
})(DescriptionBuilderStatus || (DescriptionBuilderStatus = {}));
|
|
8
9
|
export const useMutationsHandler = ({ mainMutation, dependantMutations, messageDescriptionBuilder, toastProps, ...rest }) => {
|
|
9
10
|
const { showToast } = useToast();
|
|
@@ -12,7 +13,7 @@ export const useMutationsHandler = ({ mainMutation, dependantMutations, messageD
|
|
|
12
13
|
...(dependantMutations ? dependantMutations : []),
|
|
13
14
|
];
|
|
14
15
|
const handleMutationsCompletion = useCallback(async () => {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f;
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
16
17
|
const results = await Promise.all(mutations.map((m) => m.mutation));
|
|
17
18
|
const loadingMutations = mutations.filter((_, index) => results[index].isLoading);
|
|
18
19
|
const successMutations = mutations.filter((_, index) => results[index].isSuccess);
|
|
@@ -21,24 +22,28 @@ export const useMutationsHandler = ({ mainMutation, dependantMutations, messageD
|
|
|
21
22
|
data: (_a = mainMutation.mutation) === null || _a === void 0 ? void 0 : _a.data,
|
|
22
23
|
status: ((_b = mainMutation.mutation) === null || _b === void 0 ? void 0 : _b.isSuccess)
|
|
23
24
|
? DescriptionBuilderStatus.Success
|
|
24
|
-
:
|
|
25
|
+
: ((_c = mainMutation.mutation) === null || _c === void 0 ? void 0 : _c.isIdle)
|
|
26
|
+
? DescriptionBuilderStatus.Idle
|
|
27
|
+
: DescriptionBuilderStatus.Error,
|
|
25
28
|
name: mainMutation.name,
|
|
26
29
|
};
|
|
27
30
|
const descriptionBuilders = [
|
|
28
31
|
mainMutationDesc,
|
|
29
32
|
...((dependantMutations === null || dependantMutations === void 0 ? void 0 : dependantMutations.map(({ mutation, name }) => ({
|
|
30
33
|
data: mutation.data,
|
|
31
|
-
error: mutation.isError
|
|
34
|
+
error: mutation.isError ? mutation.error : null,
|
|
32
35
|
status: mutation.isSuccess
|
|
33
36
|
? DescriptionBuilderStatus.Success
|
|
34
|
-
:
|
|
37
|
+
: mutation.isIdle
|
|
38
|
+
? DescriptionBuilderStatus.Idle
|
|
39
|
+
: DescriptionBuilderStatus.Error,
|
|
35
40
|
name,
|
|
36
41
|
}))) || []),
|
|
37
42
|
];
|
|
38
43
|
if (loadingMutations.length === 0) {
|
|
39
44
|
if (errorMutations.length > 0) {
|
|
40
|
-
if ((
|
|
41
|
-
'onMainMutationSuccess' in rest && ((
|
|
45
|
+
if ((_d = mainMutation.mutation) === null || _d === void 0 ? void 0 : _d.isSuccess) {
|
|
46
|
+
'onMainMutationSuccess' in rest && ((_e = rest === null || rest === void 0 ? void 0 : rest.onMainMutationSuccess) === null || _e === void 0 ? void 0 : _e.call(rest));
|
|
42
47
|
}
|
|
43
48
|
showToast({
|
|
44
49
|
open: true,
|
|
@@ -49,9 +54,9 @@ export const useMutationsHandler = ({ mainMutation, dependantMutations, messageD
|
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
56
|
else if (successMutations.length > 0) {
|
|
52
|
-
'onMainMutationSuccess' in rest && ((
|
|
57
|
+
'onMainMutationSuccess' in rest && ((_f = rest === null || rest === void 0 ? void 0 : rest.onMainMutationSuccess) === null || _f === void 0 ? void 0 : _f.call(rest));
|
|
53
58
|
if (successMutations.length === mutations.length) {
|
|
54
|
-
'onAllMutationsSuccess' in rest && ((
|
|
59
|
+
'onAllMutationsSuccess' in rest && ((_g = rest === null || rest === void 0 ? void 0 : rest.onAllMutationsSuccess) === null || _g === void 0 ? void 0 : _g.call(rest));
|
|
55
60
|
}
|
|
56
61
|
showToast({
|
|
57
62
|
open: true,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import { Text } from './text/Text.component';
|
|
|
11
11
|
import { Box } from './box/Box';
|
|
12
12
|
import { spacing } from '../spacing';
|
|
13
13
|
|
|
14
|
-
const NoResult = styled(Box)<{ height: number | string }>`
|
|
14
|
+
export const NoResult = styled(Box)<{ height: number | string }>`
|
|
15
15
|
display: flex;
|
|
16
16
|
justify-content: center;
|
|
17
17
|
align-items: center;
|
|
@@ -147,21 +147,30 @@ export function TableRows<
|
|
|
147
147
|
/>
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
|
|
151
150
|
if (status === 'success' || status === undefined) {
|
|
152
151
|
if (typeof children === 'function') {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
152
|
+
if (rows.length) {
|
|
153
|
+
return children(
|
|
154
|
+
<VirtualizedRows
|
|
155
|
+
rows={rows}
|
|
156
|
+
listRef={bodyRef}
|
|
157
|
+
itemKey={itemKey}
|
|
158
|
+
rowHeight={rowHeight}
|
|
159
|
+
setHasScrollbar={setHasScrollbar}
|
|
160
|
+
onBottom={onBottom}
|
|
161
|
+
onBottomOffset={onBottomOffset}
|
|
162
|
+
RenderRow={RenderRow}
|
|
163
|
+
/>,
|
|
164
|
+
);
|
|
165
|
+
} else {
|
|
166
|
+
return children(
|
|
167
|
+
<UnsuccessfulResult
|
|
168
|
+
rowHeight={rowHeight}
|
|
169
|
+
name={entityName}
|
|
170
|
+
status="noResult"
|
|
171
|
+
/>,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
165
174
|
} else if (rows.length) {
|
|
166
175
|
return (
|
|
167
176
|
<VirtualizedRows
|
|
@@ -176,7 +185,13 @@ export function TableRows<
|
|
|
176
185
|
/>
|
|
177
186
|
);
|
|
178
187
|
} else {
|
|
179
|
-
return
|
|
188
|
+
return (
|
|
189
|
+
<UnsuccessfulResult
|
|
190
|
+
rowHeight={rowHeight}
|
|
191
|
+
name={entityName}
|
|
192
|
+
status="noResult"
|
|
193
|
+
/>
|
|
194
|
+
);
|
|
180
195
|
}
|
|
181
196
|
}
|
|
182
197
|
|
|
@@ -41,6 +41,7 @@ declare type MutationsResults<T extends unknown[]> = T extends []
|
|
|
41
41
|
enum DescriptionBuilderStatus {
|
|
42
42
|
Success = 'success',
|
|
43
43
|
Error = 'error',
|
|
44
|
+
Idle = 'idle',
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
type DescriptionBuilder<Data = unknown, Error = unknown> = {
|
|
@@ -124,6 +125,8 @@ export const useMutationsHandler = <
|
|
|
124
125
|
data: mainMutation.mutation?.data,
|
|
125
126
|
status: mainMutation.mutation?.isSuccess
|
|
126
127
|
? DescriptionBuilderStatus.Success
|
|
128
|
+
: mainMutation.mutation?.isIdle
|
|
129
|
+
? DescriptionBuilderStatus.Idle
|
|
127
130
|
: DescriptionBuilderStatus.Error,
|
|
128
131
|
name: mainMutation.name,
|
|
129
132
|
} as GetDescriptionBuilder<MainMutationType>;
|
|
@@ -131,9 +134,11 @@ export const useMutationsHandler = <
|
|
|
131
134
|
mainMutationDesc,
|
|
132
135
|
...((dependantMutations?.map(({ mutation, name }) => ({
|
|
133
136
|
data: mutation.data,
|
|
134
|
-
error: mutation.isError
|
|
137
|
+
error: mutation.isError ? mutation.error : null,
|
|
135
138
|
status: mutation.isSuccess
|
|
136
139
|
? DescriptionBuilderStatus.Success
|
|
140
|
+
: mutation.isIdle
|
|
141
|
+
? DescriptionBuilderStatus.Idle
|
|
137
142
|
: DescriptionBuilderStatus.Error,
|
|
138
143
|
name,
|
|
139
144
|
})) as DescriptionBuilders<T>) || ([] as DescriptionBuilders<T>)),
|