@reltio/components 1.4.2119 → 1.4.2121
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/DataTypeValueEditor/useEditorContext.d.ts +4 -4
- package/EditModeAttributesView/EditModeAttributesView.test.js +61 -3
- package/LookupEditor/LookupEditor.js +3 -3
- package/LookupEditor/LookupEditor.test.js +0 -5
- package/TypeaheadEditor/TypeaheadEditor.js +8 -4
- package/TypeaheadEditor/TypeaheadEditor.test.js +22 -0
- package/cjs/DataTypeValueEditor/useEditorContext.d.ts +4 -4
- package/cjs/EditModeAttributesView/EditModeAttributesView.test.js +60 -2
- package/cjs/LookupEditor/LookupEditor.js +2 -2
- package/cjs/LookupEditor/LookupEditor.test.js +0 -5
- package/cjs/TypeaheadEditor/TypeaheadEditor.js +8 -4
- package/cjs/TypeaheadEditor/TypeaheadEditor.test.js +22 -0
- package/package.json +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { DataTypeDefinition } from '@reltio/mdm-sdk';
|
|
1
|
+
import { DataTypeDefinition, Lookups } from '@reltio/mdm-sdk';
|
|
2
2
|
export declare const useEditorContext: (fieldName: string, dataTypeDefinition: DataTypeDefinition) => {
|
|
3
|
-
lookups:
|
|
3
|
+
lookups: Lookups;
|
|
4
4
|
lookupCode: string;
|
|
5
|
-
getLookups: () =>
|
|
5
|
+
getLookups: () => Promise<void>;
|
|
6
6
|
resolveLookups?: undefined;
|
|
7
7
|
getSuggestions?: undefined;
|
|
8
8
|
format?: undefined;
|
|
9
9
|
tenant?: undefined;
|
|
10
10
|
entries?: undefined;
|
|
11
11
|
} | {
|
|
12
|
-
lookups:
|
|
12
|
+
lookups: Lookups;
|
|
13
13
|
lookupCode: string;
|
|
14
14
|
getLookups: ({ type, parents, displayNamePrefix, max, offset }: {
|
|
15
15
|
type: any;
|
|
@@ -45,17 +45,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
+
if (ar || !(i in from)) {
|
|
51
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
+
ar[i] = from[i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
+
};
|
|
48
57
|
var _a;
|
|
49
58
|
import React from 'react';
|
|
50
59
|
import userEvent from '@testing-library/user-event';
|
|
51
60
|
import { render, screen, act, within } from '@testing-library/react';
|
|
52
61
|
import { assocPath } from 'ramda';
|
|
53
|
-
import { ErrorType, Mode, uploadImage } from '@reltio/mdm-sdk';
|
|
62
|
+
import { ErrorType, Mode, uploadImage, getLookups } from '@reltio/mdm-sdk';
|
|
54
63
|
import { MdmModuleProvider } from '../contexts/MdmModuleContext';
|
|
55
64
|
import { ScrollToElementProvider } from '../contexts/ScrollToElementContext';
|
|
56
65
|
import { HiddenAttributesContext } from '../contexts/HiddenAttributesContext';
|
|
57
66
|
import { EditModeAttributesView } from './EditModeAttributesView';
|
|
58
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { uploadImage: jest.fn() })); });
|
|
67
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { uploadImage: jest.fn(), getLookups: jest.fn().mockResolvedValue({}) })); });
|
|
59
68
|
var defaultEntity = {
|
|
60
69
|
uri: 'entities/1E4APrQW',
|
|
61
70
|
type: 'configuration/entityTypes/HCP'
|
|
@@ -121,7 +130,12 @@ var defaultMdmValues = {
|
|
|
121
130
|
metadata: defaultMetadata,
|
|
122
131
|
dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] },
|
|
123
132
|
profileErrors: [],
|
|
124
|
-
|
|
133
|
+
lookups: {},
|
|
134
|
+
user: { roles: [] },
|
|
135
|
+
tenant: {
|
|
136
|
+
id: 'tenant',
|
|
137
|
+
name: 'tenant'
|
|
138
|
+
}
|
|
125
139
|
};
|
|
126
140
|
var mdmActions = {
|
|
127
141
|
addAttributes: jest.fn(),
|
|
@@ -360,5 +374,49 @@ describe('Edit mode attributes view tests', function () {
|
|
|
360
374
|
}
|
|
361
375
|
});
|
|
362
376
|
}); });
|
|
377
|
+
it('should request lookups if there are no dependent lookups and store already has some lookups', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
378
|
+
var modifiedEntities, metadata, lookups, mdmValues;
|
|
379
|
+
var _a;
|
|
380
|
+
return __generator(this, function (_b) {
|
|
381
|
+
modifiedEntities = __assign(__assign({}, defaultModifiedEntities), (_a = {}, _a[defaultEntity.uri] = __assign(__assign({}, defaultEntity), { attributes: {
|
|
382
|
+
CountryCode: [
|
|
383
|
+
{
|
|
384
|
+
uri: 'entities/1E4APrQW/attributes/CountryCode/uri1',
|
|
385
|
+
value: 'Portugal',
|
|
386
|
+
lookupCode: 'PT',
|
|
387
|
+
type: 'configuration/entityTypes/HCP/attributes/CountryCode'
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
} }), _a));
|
|
391
|
+
metadata = {
|
|
392
|
+
uri: 'configuration',
|
|
393
|
+
entityTypes: [
|
|
394
|
+
{
|
|
395
|
+
uri: 'configuration/entityTypes/HCP',
|
|
396
|
+
attributes: __spreadArray(__spreadArray([], defaultMetadata.entityTypes[0].attributes, true), [
|
|
397
|
+
{
|
|
398
|
+
label: 'Country',
|
|
399
|
+
name: 'CountryCode',
|
|
400
|
+
type: 'String',
|
|
401
|
+
uri: 'configuration/entityTypes/HCP/attributes/CountryCode',
|
|
402
|
+
lookupCode: 'CountryCode'
|
|
403
|
+
}
|
|
404
|
+
], false)
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
};
|
|
408
|
+
lookups = {
|
|
409
|
+
CountryCode: {
|
|
410
|
+
PT: {
|
|
411
|
+
displayName: 'Portugal'
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata, modifiedEntities: modifiedEntities, lookups: lookups });
|
|
416
|
+
setUp({ mdmValues: mdmValues });
|
|
417
|
+
expect(getLookups).toHaveBeenCalled();
|
|
418
|
+
return [2 /*return*/];
|
|
419
|
+
});
|
|
420
|
+
}); });
|
|
363
421
|
});
|
|
364
422
|
});
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React, { useEffect } from 'react';
|
|
24
|
-
import { always, defaultTo,
|
|
24
|
+
import { always, defaultTo, map, path, pipe, pluck, prop, propEq } from 'ramda';
|
|
25
25
|
import { GroupedDropDownEditor } from './components/GroupedDropDownEditor';
|
|
26
26
|
import { buildLookupEntries } from './helpers';
|
|
27
27
|
export var LookupEditor = function (_a) {
|
|
@@ -32,10 +32,10 @@ export var LookupEditor = function (_a) {
|
|
|
32
32
|
}); };
|
|
33
33
|
useEffect(function () {
|
|
34
34
|
var _a;
|
|
35
|
-
if (
|
|
35
|
+
if (getLookups) {
|
|
36
36
|
(_a = getLookups()) === null || _a === void 0 ? void 0 : _a.catch(function () { });
|
|
37
37
|
}
|
|
38
|
-
}, [
|
|
38
|
+
}, [getLookups]);
|
|
39
39
|
var entries = buildLookupEntries(lookupTypeCode, lookups); // TODO: this code could be not valid if lookups are not loaded
|
|
40
40
|
var commonProps = __assign(__assign({}, otherProps), { multiple: multiple, entries: entries });
|
|
41
41
|
value = defaultTo(multiple ? [] : {}, value);
|
|
@@ -94,11 +94,6 @@ describe('LookupEditor', function () {
|
|
|
94
94
|
setUp({ getLookups: getLookups, lookups: {} });
|
|
95
95
|
expect(getLookups).toHaveBeenCalled();
|
|
96
96
|
});
|
|
97
|
-
it('should not load lookups if lookups are available', function () {
|
|
98
|
-
var getLookups = jest.fn();
|
|
99
|
-
setUp({ getLookups: getLookups });
|
|
100
|
-
expect(getLookups).not.toHaveBeenCalled();
|
|
101
|
-
});
|
|
102
97
|
describe('single mode', function () {
|
|
103
98
|
it('should show lookup value as label if lookups do not contain specified lookupCode', function () {
|
|
104
99
|
var value = { value: 'L3value', lookupCode: 'L3' };
|
|
@@ -199,7 +199,7 @@ export var TypeaheadEditor = function (_a) {
|
|
|
199
199
|
}
|
|
200
200
|
}, [multiple, onChange, value]);
|
|
201
201
|
var handleKeyDown = useCallback(function (event) {
|
|
202
|
-
if (event.
|
|
202
|
+
if (event.key !== 'Enter' || highlightedItem)
|
|
203
203
|
return;
|
|
204
204
|
if (multiple === true) {
|
|
205
205
|
handleInputValueChange({ method: ChangeMethod.Enter, newValue: inputValue });
|
|
@@ -209,9 +209,13 @@ export var TypeaheadEditor = function (_a) {
|
|
|
209
209
|
}
|
|
210
210
|
}, [handleInputValueChange, onChange, highlightedItem, inputValue, multiple]);
|
|
211
211
|
var handleBlur = useCallback(function () {
|
|
212
|
-
if (multiple !== true)
|
|
212
|
+
if (multiple !== true) {
|
|
213
213
|
onChange(inputValue);
|
|
214
|
-
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
handleInputValueChange({ method: ChangeMethod.Enter, newValue: inputValue });
|
|
217
|
+
}
|
|
218
|
+
}, [inputValue, onChange, multiple, handleInputValueChange]);
|
|
215
219
|
useEffect(function () {
|
|
216
220
|
var _a;
|
|
217
221
|
if (multiple !== true)
|
|
@@ -224,7 +228,7 @@ export var TypeaheadEditor = function (_a) {
|
|
|
224
228
|
container: fullWidth ? styles.suggestionsContainer : '',
|
|
225
229
|
suggestionsList: styles.suggestionsList,
|
|
226
230
|
suggestionsContainerOpen: styles.suggestionsContainerOpen
|
|
227
|
-
}, inputProps: __assign({ value: inputValue, onChange: pipe(nthArg(1), handleInputValueChange), onKeyDown: handleKeyDown, onBlur: handleBlur, fullWidth: fullWidth, variant: 'standard', autoComplete: '
|
|
231
|
+
}, inputProps: __assign({ value: inputValue, onChange: pipe(nthArg(1), handleInputValueChange), onKeyDown: handleKeyDown, onBlur: handleBlur, fullWidth: fullWidth, variant: 'standard', autoComplete: 'off' }, inputProps), renderInputComponent: function (_a) {
|
|
228
232
|
var _b, _c;
|
|
229
233
|
var ref = _a.ref, otherProps = __rest(_a, ["ref"]);
|
|
230
234
|
var commonClasses = {
|
|
@@ -421,6 +421,28 @@ describe('TypeaheadEditor', function () {
|
|
|
421
421
|
}
|
|
422
422
|
});
|
|
423
423
|
}); });
|
|
424
|
+
it('should add chip correctly on input blur', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
425
|
+
var values, props, user, input;
|
|
426
|
+
return __generator(this, function (_a) {
|
|
427
|
+
switch (_a.label) {
|
|
428
|
+
case 0:
|
|
429
|
+
values = ['value 1', 'value 2'];
|
|
430
|
+
props = __assign(__assign({}, defaultMultipleProps), { value: values });
|
|
431
|
+
user = setUp(props).user;
|
|
432
|
+
input = screen.getByRole('textbox');
|
|
433
|
+
return [4 /*yield*/, user.type(input, 'value 3')];
|
|
434
|
+
case 1:
|
|
435
|
+
_a.sent();
|
|
436
|
+
expect(input).toHaveAttribute('value', 'value 3');
|
|
437
|
+
return [4 /*yield*/, user.tab()];
|
|
438
|
+
case 2:
|
|
439
|
+
_a.sent(); // simulating input blur
|
|
440
|
+
expect(input).toHaveAttribute('value', '');
|
|
441
|
+
expect(props.onChange).toHaveBeenCalledWith(['value 1', 'value 2', 'value 3']);
|
|
442
|
+
return [2 /*return*/];
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}); });
|
|
424
446
|
it('should add chip correctly after select suggestion item using keyboard', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
425
447
|
var values, props, user, input;
|
|
426
448
|
return __generator(this, function (_a) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { DataTypeDefinition } from '@reltio/mdm-sdk';
|
|
1
|
+
import { DataTypeDefinition, Lookups } from '@reltio/mdm-sdk';
|
|
2
2
|
export declare const useEditorContext: (fieldName: string, dataTypeDefinition: DataTypeDefinition) => {
|
|
3
|
-
lookups:
|
|
3
|
+
lookups: Lookups;
|
|
4
4
|
lookupCode: string;
|
|
5
|
-
getLookups: () =>
|
|
5
|
+
getLookups: () => Promise<void>;
|
|
6
6
|
resolveLookups?: undefined;
|
|
7
7
|
getSuggestions?: undefined;
|
|
8
8
|
format?: undefined;
|
|
9
9
|
tenant?: undefined;
|
|
10
10
|
entries?: undefined;
|
|
11
11
|
} | {
|
|
12
|
-
lookups:
|
|
12
|
+
lookups: Lookups;
|
|
13
13
|
lookupCode: string;
|
|
14
14
|
getLookups: ({ type, parents, displayNamePrefix, max, offset }: {
|
|
15
15
|
type: any;
|
|
@@ -46,6 +46,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
49
58
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
60
|
};
|
|
@@ -60,7 +69,7 @@ var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
|
|
|
60
69
|
var ScrollToElementContext_1 = require("../contexts/ScrollToElementContext");
|
|
61
70
|
var HiddenAttributesContext_1 = require("../contexts/HiddenAttributesContext");
|
|
62
71
|
var EditModeAttributesView_1 = require("./EditModeAttributesView");
|
|
63
|
-
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { uploadImage: jest.fn() })); });
|
|
72
|
+
jest.mock('@reltio/mdm-sdk', function () { return (__assign(__assign({}, jest.requireActual('@reltio/mdm-sdk')), { uploadImage: jest.fn(), getLookups: jest.fn().mockResolvedValue({}) })); });
|
|
64
73
|
var defaultEntity = {
|
|
65
74
|
uri: 'entities/1E4APrQW',
|
|
66
75
|
type: 'configuration/entityTypes/HCP'
|
|
@@ -126,7 +135,12 @@ var defaultMdmValues = {
|
|
|
126
135
|
metadata: defaultMetadata,
|
|
127
136
|
dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] },
|
|
128
137
|
profileErrors: [],
|
|
129
|
-
|
|
138
|
+
lookups: {},
|
|
139
|
+
user: { roles: [] },
|
|
140
|
+
tenant: {
|
|
141
|
+
id: 'tenant',
|
|
142
|
+
name: 'tenant'
|
|
143
|
+
}
|
|
130
144
|
};
|
|
131
145
|
var mdmActions = {
|
|
132
146
|
addAttributes: jest.fn(),
|
|
@@ -365,5 +379,49 @@ describe('Edit mode attributes view tests', function () {
|
|
|
365
379
|
}
|
|
366
380
|
});
|
|
367
381
|
}); });
|
|
382
|
+
it('should request lookups if there are no dependent lookups and store already has some lookups', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
383
|
+
var modifiedEntities, metadata, lookups, mdmValues;
|
|
384
|
+
var _a;
|
|
385
|
+
return __generator(this, function (_b) {
|
|
386
|
+
modifiedEntities = __assign(__assign({}, defaultModifiedEntities), (_a = {}, _a[defaultEntity.uri] = __assign(__assign({}, defaultEntity), { attributes: {
|
|
387
|
+
CountryCode: [
|
|
388
|
+
{
|
|
389
|
+
uri: 'entities/1E4APrQW/attributes/CountryCode/uri1',
|
|
390
|
+
value: 'Portugal',
|
|
391
|
+
lookupCode: 'PT',
|
|
392
|
+
type: 'configuration/entityTypes/HCP/attributes/CountryCode'
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
} }), _a));
|
|
396
|
+
metadata = {
|
|
397
|
+
uri: 'configuration',
|
|
398
|
+
entityTypes: [
|
|
399
|
+
{
|
|
400
|
+
uri: 'configuration/entityTypes/HCP',
|
|
401
|
+
attributes: __spreadArray(__spreadArray([], defaultMetadata.entityTypes[0].attributes, true), [
|
|
402
|
+
{
|
|
403
|
+
label: 'Country',
|
|
404
|
+
name: 'CountryCode',
|
|
405
|
+
type: 'String',
|
|
406
|
+
uri: 'configuration/entityTypes/HCP/attributes/CountryCode',
|
|
407
|
+
lookupCode: 'CountryCode'
|
|
408
|
+
}
|
|
409
|
+
], false)
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
};
|
|
413
|
+
lookups = {
|
|
414
|
+
CountryCode: {
|
|
415
|
+
PT: {
|
|
416
|
+
displayName: 'Portugal'
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
mdmValues = __assign(__assign({}, defaultMdmValues), { metadata: metadata, modifiedEntities: modifiedEntities, lookups: lookups });
|
|
421
|
+
setUp({ mdmValues: mdmValues });
|
|
422
|
+
expect(mdm_sdk_1.getLookups).toHaveBeenCalled();
|
|
423
|
+
return [2 /*return*/];
|
|
424
|
+
});
|
|
425
|
+
}); });
|
|
368
426
|
});
|
|
369
427
|
});
|
|
@@ -58,10 +58,10 @@ var LookupEditor = function (_a) {
|
|
|
58
58
|
}); };
|
|
59
59
|
(0, react_1.useEffect)(function () {
|
|
60
60
|
var _a;
|
|
61
|
-
if (
|
|
61
|
+
if (getLookups) {
|
|
62
62
|
(_a = getLookups()) === null || _a === void 0 ? void 0 : _a.catch(function () { });
|
|
63
63
|
}
|
|
64
|
-
}, [
|
|
64
|
+
}, [getLookups]);
|
|
65
65
|
var entries = (0, helpers_1.buildLookupEntries)(lookupTypeCode, lookups); // TODO: this code could be not valid if lookups are not loaded
|
|
66
66
|
var commonProps = __assign(__assign({}, otherProps), { multiple: multiple, entries: entries });
|
|
67
67
|
value = (0, ramda_1.defaultTo)(multiple ? [] : {}, value);
|
|
@@ -99,11 +99,6 @@ describe('LookupEditor', function () {
|
|
|
99
99
|
setUp({ getLookups: getLookups, lookups: {} });
|
|
100
100
|
expect(getLookups).toHaveBeenCalled();
|
|
101
101
|
});
|
|
102
|
-
it('should not load lookups if lookups are available', function () {
|
|
103
|
-
var getLookups = jest.fn();
|
|
104
|
-
setUp({ getLookups: getLookups });
|
|
105
|
-
expect(getLookups).not.toHaveBeenCalled();
|
|
106
|
-
});
|
|
107
102
|
describe('single mode', function () {
|
|
108
103
|
it('should show lookup value as label if lookups do not contain specified lookupCode', function () {
|
|
109
104
|
var value = { value: 'L3value', lookupCode: 'L3' };
|
|
@@ -228,7 +228,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
228
228
|
}
|
|
229
229
|
}, [multiple, onChange, value]);
|
|
230
230
|
var handleKeyDown = (0, react_1.useCallback)(function (event) {
|
|
231
|
-
if (event.
|
|
231
|
+
if (event.key !== 'Enter' || highlightedItem)
|
|
232
232
|
return;
|
|
233
233
|
if (multiple === true) {
|
|
234
234
|
handleInputValueChange({ method: ChangeMethod.Enter, newValue: inputValue });
|
|
@@ -238,9 +238,13 @@ var TypeaheadEditor = function (_a) {
|
|
|
238
238
|
}
|
|
239
239
|
}, [handleInputValueChange, onChange, highlightedItem, inputValue, multiple]);
|
|
240
240
|
var handleBlur = (0, react_1.useCallback)(function () {
|
|
241
|
-
if (multiple !== true)
|
|
241
|
+
if (multiple !== true) {
|
|
242
242
|
onChange(inputValue);
|
|
243
|
-
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
handleInputValueChange({ method: ChangeMethod.Enter, newValue: inputValue });
|
|
246
|
+
}
|
|
247
|
+
}, [inputValue, onChange, multiple, handleInputValueChange]);
|
|
244
248
|
(0, react_1.useEffect)(function () {
|
|
245
249
|
var _a;
|
|
246
250
|
if (multiple !== true)
|
|
@@ -253,7 +257,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
253
257
|
container: fullWidth ? styles.suggestionsContainer : '',
|
|
254
258
|
suggestionsList: styles.suggestionsList,
|
|
255
259
|
suggestionsContainerOpen: styles.suggestionsContainerOpen
|
|
256
|
-
}, inputProps: __assign({ value: inputValue, onChange: (0, ramda_1.pipe)((0, ramda_1.nthArg)(1), handleInputValueChange), onKeyDown: handleKeyDown, onBlur: handleBlur, fullWidth: fullWidth, variant: 'standard', autoComplete: '
|
|
260
|
+
}, inputProps: __assign({ value: inputValue, onChange: (0, ramda_1.pipe)((0, ramda_1.nthArg)(1), handleInputValueChange), onKeyDown: handleKeyDown, onBlur: handleBlur, fullWidth: fullWidth, variant: 'standard', autoComplete: 'off' }, inputProps), renderInputComponent: function (_a) {
|
|
257
261
|
var _b, _c;
|
|
258
262
|
var ref = _a.ref, otherProps = __rest(_a, ["ref"]);
|
|
259
263
|
var commonClasses = {
|
|
@@ -426,6 +426,28 @@ describe('TypeaheadEditor', function () {
|
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
}); });
|
|
429
|
+
it('should add chip correctly on input blur', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
430
|
+
var values, props, user, input;
|
|
431
|
+
return __generator(this, function (_a) {
|
|
432
|
+
switch (_a.label) {
|
|
433
|
+
case 0:
|
|
434
|
+
values = ['value 1', 'value 2'];
|
|
435
|
+
props = __assign(__assign({}, defaultMultipleProps), { value: values });
|
|
436
|
+
user = setUp(props).user;
|
|
437
|
+
input = react_2.screen.getByRole('textbox');
|
|
438
|
+
return [4 /*yield*/, user.type(input, 'value 3')];
|
|
439
|
+
case 1:
|
|
440
|
+
_a.sent();
|
|
441
|
+
expect(input).toHaveAttribute('value', 'value 3');
|
|
442
|
+
return [4 /*yield*/, user.tab()];
|
|
443
|
+
case 2:
|
|
444
|
+
_a.sent(); // simulating input blur
|
|
445
|
+
expect(input).toHaveAttribute('value', '');
|
|
446
|
+
expect(props.onChange).toHaveBeenCalledWith(['value 1', 'value 2', 'value 3']);
|
|
447
|
+
return [2 /*return*/];
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
}); });
|
|
429
451
|
it('should add chip correctly after select suggestion item using keyboard', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
430
452
|
var values, props, user, input;
|
|
431
453
|
return __generator(this, function (_a) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2121",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
12
12
|
"@googlemaps/markerclusterer": "^2.5.3",
|
|
13
13
|
"@react-sigma/core": "3.4.0",
|
|
14
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
14
|
+
"@reltio/mdm-sdk": "^1.4.1952",
|
|
15
15
|
"@vis.gl/react-google-maps": "^1.3.0",
|
|
16
16
|
"d3-cloud": "^1.2.5",
|
|
17
17
|
"d3-geo": "^2.0.1",
|