@webitel/ui-datalist 1.0.19 → 1.0.20
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/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sysTypes } from '@webitel/ui-sdk/api/clients/index';
|
|
2
2
|
import { WtTypeExtensionFieldKind } from '@webitel/ui-sdk/enums';
|
|
3
|
+
import get from 'lodash/get';
|
|
3
4
|
import { WebitelProtoDataField } from 'webitel-sdk';
|
|
4
5
|
|
|
5
6
|
import { FilterConfig } from '../../classes/FilterConfig';
|
|
@@ -41,7 +42,7 @@ class TypeExtensionWtSysTypeFieldFilterConfig
|
|
|
41
42
|
extends TypeExtensionFilterConfig
|
|
42
43
|
implements IWtSysTypeFilterConfig
|
|
43
44
|
{
|
|
44
|
-
searchRecords(
|
|
45
|
+
async searchRecords(
|
|
45
46
|
{ id: filterValue, ...rest },
|
|
46
47
|
// {
|
|
47
48
|
// filterValue,
|
|
@@ -49,11 +50,32 @@ class TypeExtensionWtSysTypeFieldFilterConfig
|
|
|
49
50
|
// filterValue: unknown;
|
|
50
51
|
// },
|
|
51
52
|
): Promise<{ items: unknown[]; next?: boolean }> {
|
|
52
|
-
|
|
53
|
+
const { items, ...restResponse } = await sysTypes.getLookup({
|
|
53
54
|
...rest,
|
|
54
55
|
...this.field.lookup,
|
|
55
56
|
id: filterValue,
|
|
56
57
|
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @author @dlohvinov
|
|
61
|
+
*
|
|
62
|
+
* [WTEL-6787](https://webitel.atlassian.net/browse/WTEL-6787)
|
|
63
|
+
*
|
|
64
|
+
* name from display is get here instead of wt-select props because it's
|
|
65
|
+
* much simplier than configuring wt-select, but still this code is still
|
|
66
|
+
* isolated enough.
|
|
67
|
+
*
|
|
68
|
+
* for instance, contacts:
|
|
69
|
+
* display=name.common_name
|
|
70
|
+
* objects=[{ name: { common_name: 'str' } }]
|
|
71
|
+
*/
|
|
72
|
+
return {
|
|
73
|
+
items: items.map((item) => ({
|
|
74
|
+
...item,
|
|
75
|
+
name: get(item, this.field.lookup.display),
|
|
76
|
+
})),
|
|
77
|
+
...restResponse,
|
|
78
|
+
};
|
|
57
79
|
}
|
|
58
80
|
}
|
|
59
81
|
|