@reltio/components 1.4.2014 → 1.4.2016
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/EntitySelector/EntitySelector.js +1 -1
- package/ProfileBandNavigation/useSearchNavigation.js +8 -2
- package/cjs/EntitySelector/EntitySelector.js +1 -1
- package/cjs/ProfileBandNavigation/useSearchNavigation.js +8 -2
- package/cjs/hooks/useCommentsEntitiesMap/useCommentsEntitiesMap.js +3 -1
- package/cjs/hooks/useMatchesLoader/useMatchesLoader.js +1 -1
- package/cjs/hooks/usePivotingDataLoader/usePivotingDataLoader.js +2 -1
- package/cjs/hooks/useSavedState/useSavedState.js +7 -3
- package/cjs/hooks/useSavedStateForEntityType/useSavedStateForEntityType.js +7 -3
- package/hooks/useCommentsEntitiesMap/useCommentsEntitiesMap.js +3 -1
- package/hooks/useMatchesLoader/useMatchesLoader.js +1 -1
- package/hooks/usePivotingDataLoader/usePivotingDataLoader.js +2 -1
- package/hooks/useSavedState/useSavedState.js +7 -3
- package/hooks/useSavedStateForEntityType/useSavedStateForEntityType.js +7 -3
- package/package.json +1 -1
|
@@ -42,7 +42,7 @@ export var EntitySelector = function (_a) {
|
|
|
42
42
|
var options = __assign(__assign({}, globalSearchRequestOptions), { max: max, sendMasked: isMasked });
|
|
43
43
|
var handleCreate = onCreate
|
|
44
44
|
? function (value, entityTypeUri) {
|
|
45
|
-
onCreate(entityTypeUri ||
|
|
45
|
+
onCreate(entityTypeUri || entityTypes[0].uri, value);
|
|
46
46
|
setInputValue('');
|
|
47
47
|
}
|
|
48
48
|
: undefined;
|
|
@@ -160,6 +160,7 @@ export var useSearchNavigation = function () {
|
|
|
160
160
|
total: total,
|
|
161
161
|
index: total - 1
|
|
162
162
|
});
|
|
163
|
+
return Promise.resolve();
|
|
163
164
|
}
|
|
164
165
|
else {
|
|
165
166
|
return requestNextPage(cache, total, index);
|
|
@@ -196,6 +197,7 @@ export var useSearchNavigation = function () {
|
|
|
196
197
|
cache: cache,
|
|
197
198
|
total: total
|
|
198
199
|
});
|
|
200
|
+
return Promise.resolve();
|
|
199
201
|
}
|
|
200
202
|
else {
|
|
201
203
|
return requestPrevPage(cache, index);
|
|
@@ -204,13 +206,17 @@ export var useSearchNavigation = function () {
|
|
|
204
206
|
var onPrev = useCallback(function () {
|
|
205
207
|
if (cache && uri) {
|
|
206
208
|
var cacheIndex = cache.indexOf(uri) - 1;
|
|
207
|
-
stepBackWithCheck(cache, cacheIndex, total, index)
|
|
209
|
+
stepBackWithCheck(cache, cacheIndex, total, index).catch(function (error) {
|
|
210
|
+
console.warn("Can't load prev page of search", error);
|
|
211
|
+
});
|
|
208
212
|
}
|
|
209
213
|
}, [stepBackWithCheck, cache, uri, total, index]);
|
|
210
214
|
var onNext = useCallback(function () {
|
|
211
215
|
if (cache && uri) {
|
|
212
216
|
var cacheIndex = cache.indexOf(uri) + 1;
|
|
213
|
-
stepForwardWithCheck(cache, cacheIndex, total, index)
|
|
217
|
+
stepForwardWithCheck(cache, cacheIndex, total, index).catch(function (error) {
|
|
218
|
+
console.warn("Can't load next page of search", error);
|
|
219
|
+
});
|
|
214
220
|
}
|
|
215
221
|
}, [stepForwardWithCheck, cache, uri, total, index]);
|
|
216
222
|
useEffect(function () {
|
|
@@ -71,7 +71,7 @@ var EntitySelector = function (_a) {
|
|
|
71
71
|
var options = __assign(__assign({}, globalSearchRequestOptions), { max: max, sendMasked: isMasked });
|
|
72
72
|
var handleCreate = onCreate
|
|
73
73
|
? function (value, entityTypeUri) {
|
|
74
|
-
onCreate(entityTypeUri ||
|
|
74
|
+
onCreate(entityTypeUri || entityTypes[0].uri, value);
|
|
75
75
|
setInputValue('');
|
|
76
76
|
}
|
|
77
77
|
: undefined;
|
|
@@ -163,6 +163,7 @@ var useSearchNavigation = function () {
|
|
|
163
163
|
total: total,
|
|
164
164
|
index: total - 1
|
|
165
165
|
});
|
|
166
|
+
return Promise.resolve();
|
|
166
167
|
}
|
|
167
168
|
else {
|
|
168
169
|
return requestNextPage(cache, total, index);
|
|
@@ -199,6 +200,7 @@ var useSearchNavigation = function () {
|
|
|
199
200
|
cache: cache,
|
|
200
201
|
total: total
|
|
201
202
|
});
|
|
203
|
+
return Promise.resolve();
|
|
202
204
|
}
|
|
203
205
|
else {
|
|
204
206
|
return requestPrevPage(cache, index);
|
|
@@ -207,13 +209,17 @@ var useSearchNavigation = function () {
|
|
|
207
209
|
var onPrev = (0, react_1.useCallback)(function () {
|
|
208
210
|
if (cache && uri) {
|
|
209
211
|
var cacheIndex = cache.indexOf(uri) - 1;
|
|
210
|
-
stepBackWithCheck(cache, cacheIndex, total, index)
|
|
212
|
+
stepBackWithCheck(cache, cacheIndex, total, index).catch(function (error) {
|
|
213
|
+
console.warn("Can't load prev page of search", error);
|
|
214
|
+
});
|
|
211
215
|
}
|
|
212
216
|
}, [stepBackWithCheck, cache, uri, total, index]);
|
|
213
217
|
var onNext = (0, react_1.useCallback)(function () {
|
|
214
218
|
if (cache && uri) {
|
|
215
219
|
var cacheIndex = cache.indexOf(uri) + 1;
|
|
216
|
-
stepForwardWithCheck(cache, cacheIndex, total, index)
|
|
220
|
+
stepForwardWithCheck(cache, cacheIndex, total, index).catch(function (error) {
|
|
221
|
+
console.warn("Can't load next page of search", error);
|
|
222
|
+
});
|
|
217
223
|
}
|
|
218
224
|
}, [stepForwardWithCheck, cache, uri, total, index]);
|
|
219
225
|
(0, react_1.useEffect)(function () {
|
|
@@ -72,7 +72,9 @@ var useCommentsEntitiesMap = function (comments) {
|
|
|
72
72
|
}, __assign({}, prevEntitiesMap));
|
|
73
73
|
});
|
|
74
74
|
})
|
|
75
|
-
.catch(function () {
|
|
75
|
+
.catch(function (error) {
|
|
76
|
+
console.warn("Can't load entities for comments map", error);
|
|
77
|
+
});
|
|
76
78
|
}
|
|
77
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
80
|
}, [getEntities, addNotFoundEntities, comments, currentEntityUri]);
|
|
@@ -34,7 +34,8 @@ var usePivotingDataLoader = function (_a) {
|
|
|
34
34
|
setEntities(Array.isArray(entities) ? entities : []);
|
|
35
35
|
setTotal(total);
|
|
36
36
|
})
|
|
37
|
-
.catch(function () {
|
|
37
|
+
.catch(function (error) {
|
|
38
|
+
console.warn("Can't load entities or total for pivoting data", error);
|
|
38
39
|
setEntities([]);
|
|
39
40
|
setTotal(0);
|
|
40
41
|
});
|
|
@@ -10,9 +10,13 @@ var useSavedState = function (getSavedState) {
|
|
|
10
10
|
.then(function (savedState) {
|
|
11
11
|
setSavedState(savedState || {});
|
|
12
12
|
})
|
|
13
|
-
.
|
|
14
|
-
.
|
|
15
|
-
|
|
13
|
+
.catch(function (error) {
|
|
14
|
+
console.warn("Can't load saved state", error);
|
|
15
|
+
})
|
|
16
|
+
.finally(function () {
|
|
17
|
+
setIsLoaded(true);
|
|
18
|
+
});
|
|
19
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
16
20
|
return { isLoaded: isLoaded, savedState: savedState };
|
|
17
21
|
};
|
|
18
22
|
exports.useSavedState = useSavedState;
|
|
@@ -41,9 +41,13 @@ var useSavedStateForEntityType = function (_a) {
|
|
|
41
41
|
.then(function (savedState) {
|
|
42
42
|
setSavedState(savedState || {});
|
|
43
43
|
})
|
|
44
|
-
.
|
|
45
|
-
.
|
|
46
|
-
|
|
44
|
+
.catch(function (error) {
|
|
45
|
+
console.warn("Can't load saved state for entity type", error);
|
|
46
|
+
})
|
|
47
|
+
.finally(function () {
|
|
48
|
+
setIsLoaded(true);
|
|
49
|
+
});
|
|
50
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
47
51
|
return { isLoaded: isLoaded && !!entityTypeUri, savedState: savedState[entityTypeUri], updateSavedState: updateSavedState };
|
|
48
52
|
};
|
|
49
53
|
exports.useSavedStateForEntityType = useSavedStateForEntityType;
|
|
@@ -69,7 +69,9 @@ export var useCommentsEntitiesMap = function (comments) {
|
|
|
69
69
|
}, __assign({}, prevEntitiesMap));
|
|
70
70
|
});
|
|
71
71
|
})
|
|
72
|
-
.catch(function () {
|
|
72
|
+
.catch(function (error) {
|
|
73
|
+
console.warn("Can't load entities for comments map", error);
|
|
74
|
+
});
|
|
73
75
|
}
|
|
74
76
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
77
|
}, [getEntities, addNotFoundEntities, comments, currentEntityUri]);
|
|
@@ -86,7 +86,7 @@ export var useMatchesLoader = function (_a) {
|
|
|
86
86
|
setMatches(response);
|
|
87
87
|
})
|
|
88
88
|
.catch(function (error) {
|
|
89
|
-
console.warn("Can't load matches:", error);
|
|
89
|
+
console.warn("Can't load entities or total for matches:", error);
|
|
90
90
|
setMatches([]);
|
|
91
91
|
setTotal(0);
|
|
92
92
|
})
|
|
@@ -31,7 +31,8 @@ export var usePivotingDataLoader = function (_a) {
|
|
|
31
31
|
setEntities(Array.isArray(entities) ? entities : []);
|
|
32
32
|
setTotal(total);
|
|
33
33
|
})
|
|
34
|
-
.catch(function () {
|
|
34
|
+
.catch(function (error) {
|
|
35
|
+
console.warn("Can't load entities or total for pivoting data", error);
|
|
35
36
|
setEntities([]);
|
|
36
37
|
setTotal(0);
|
|
37
38
|
});
|
|
@@ -7,8 +7,12 @@ export var useSavedState = function (getSavedState) {
|
|
|
7
7
|
.then(function (savedState) {
|
|
8
8
|
setSavedState(savedState || {});
|
|
9
9
|
})
|
|
10
|
-
.
|
|
11
|
-
.
|
|
12
|
-
|
|
10
|
+
.catch(function (error) {
|
|
11
|
+
console.warn("Can't load saved state", error);
|
|
12
|
+
})
|
|
13
|
+
.finally(function () {
|
|
14
|
+
setIsLoaded(true);
|
|
15
|
+
});
|
|
16
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
13
17
|
return { isLoaded: isLoaded, savedState: savedState };
|
|
14
18
|
};
|
|
@@ -38,8 +38,12 @@ export var useSavedStateForEntityType = function (_a) {
|
|
|
38
38
|
.then(function (savedState) {
|
|
39
39
|
setSavedState(savedState || {});
|
|
40
40
|
})
|
|
41
|
-
.
|
|
42
|
-
.
|
|
43
|
-
|
|
41
|
+
.catch(function (error) {
|
|
42
|
+
console.warn("Can't load saved state for entity type", error);
|
|
43
|
+
})
|
|
44
|
+
.finally(function () {
|
|
45
|
+
setIsLoaded(true);
|
|
46
|
+
});
|
|
47
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
44
48
|
return { isLoaded: isLoaded && !!entityTypeUri, savedState: savedState[entityTypeUri], updateSavedState: updateSavedState };
|
|
45
49
|
};
|