@contentful/field-editor-list 1.4.2 → 1.4.5
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/cjs/ListEditor.js
CHANGED
|
@@ -39,7 +39,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
39
|
if (cache && cache.has(obj)) {
|
|
40
40
|
return cache.get(obj);
|
|
41
41
|
}
|
|
42
|
-
var newObj = {
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
43
45
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
46
|
for(var key in obj){
|
|
45
47
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -61,7 +63,7 @@ function isEmptyListValue(value) {
|
|
|
61
63
|
return value === null || value.length === 0;
|
|
62
64
|
}
|
|
63
65
|
function ListEditor(props) {
|
|
64
|
-
const { field
|
|
66
|
+
const { field, locales } = props;
|
|
65
67
|
const direction = locales.direction[field.locale] || 'ltr';
|
|
66
68
|
return _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
67
69
|
debounce: 0,
|
|
@@ -74,7 +76,7 @@ function ListEditor(props) {
|
|
|
74
76
|
isRequired: field.required
|
|
75
77
|
}));
|
|
76
78
|
}
|
|
77
|
-
function ListEditorInternal({ setValue
|
|
79
|
+
function ListEditorInternal({ setValue, value, errors, disabled, direction, isRequired }) {
|
|
78
80
|
const [valueState, setValueState] = _react.useState(()=>(value || []).join(', '));
|
|
79
81
|
const onChange = (e)=>{
|
|
80
82
|
const valueAsArray = e.target.value.split(',').map((item)=>item.trim()).filter((item)=>item);
|
|
@@ -28,7 +28,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
28
28
|
if (cache && cache.has(obj)) {
|
|
29
29
|
return cache.get(obj);
|
|
30
30
|
}
|
|
31
|
-
var newObj = {
|
|
31
|
+
var newObj = {
|
|
32
|
+
__proto__: null
|
|
33
|
+
};
|
|
32
34
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
33
35
|
for(var key in obj){
|
|
34
36
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -51,11 +53,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
53
|
});
|
|
52
54
|
describe('ListEditor', ()=>{
|
|
53
55
|
afterEach(_react1.cleanup);
|
|
54
|
-
function expectInputValue({ getByTestId
|
|
56
|
+
function expectInputValue({ getByTestId }, expected) {
|
|
55
57
|
const $input = getByTestId('list-editor-input');
|
|
56
58
|
expect($input).toHaveValue(expected);
|
|
57
59
|
}
|
|
58
|
-
function changeInputValue({ getByTestId
|
|
60
|
+
function changeInputValue({ getByTestId }, value) {
|
|
59
61
|
const $input = getByTestId('list-editor-input');
|
|
60
62
|
_react1.fireEvent.change($input, {
|
|
61
63
|
target: {
|
package/dist/esm/ListEditor.js
CHANGED
|
@@ -7,7 +7,7 @@ function isEmptyListValue(value) {
|
|
|
7
7
|
return value === null || value.length === 0;
|
|
8
8
|
}
|
|
9
9
|
export function ListEditor(props) {
|
|
10
|
-
const { field
|
|
10
|
+
const { field, locales } = props;
|
|
11
11
|
const direction = locales.direction[field.locale] || 'ltr';
|
|
12
12
|
return React.createElement(FieldConnector, {
|
|
13
13
|
debounce: 0,
|
|
@@ -20,7 +20,7 @@ export function ListEditor(props) {
|
|
|
20
20
|
isRequired: field.required
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
|
-
function ListEditorInternal({ setValue
|
|
23
|
+
function ListEditorInternal({ setValue, value, errors, disabled, direction, isRequired }) {
|
|
24
24
|
const [valueState, setValueState] = React.useState(()=>(value || []).join(', '));
|
|
25
25
|
const onChange = (e)=>{
|
|
26
26
|
const valueAsArray = e.target.value.split(',').map((item)=>item.trim()).filter((item)=>item);
|
|
@@ -8,11 +8,11 @@ configure({
|
|
|
8
8
|
});
|
|
9
9
|
describe('ListEditor', ()=>{
|
|
10
10
|
afterEach(cleanup);
|
|
11
|
-
function expectInputValue({ getByTestId
|
|
11
|
+
function expectInputValue({ getByTestId }, expected) {
|
|
12
12
|
const $input = getByTestId('list-editor-input');
|
|
13
13
|
expect($input).toHaveValue(expected);
|
|
14
14
|
}
|
|
15
|
-
function changeInputValue({ getByTestId
|
|
15
|
+
function changeInputValue({ getByTestId }, value) {
|
|
16
16
|
const $input = getByTestId('list-editor-input');
|
|
17
17
|
fireEvent.change($input, {
|
|
18
18
|
target: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
|
|
3
3
|
export interface ListEditorProps {
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ export interface ListEditorProps {
|
|
|
14
14
|
*/
|
|
15
15
|
locales: LocalesAPI;
|
|
16
16
|
}
|
|
17
|
-
export declare function ListEditor(props: ListEditorProps):
|
|
17
|
+
export declare function ListEditor(props: ListEditorProps): JSX.Element;
|
|
18
18
|
export declare namespace ListEditor {
|
|
19
19
|
var defaultProps: {
|
|
20
20
|
isInitiallyDisabled: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-list",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -37,15 +37,18 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@contentful/f36-components": "^4.0.27",
|
|
39
39
|
"@contentful/f36-tokens": "^4.0.0",
|
|
40
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
40
|
+
"@contentful/field-editor-shared": "^1.4.5",
|
|
41
41
|
"emotion": "^10.0.17",
|
|
42
42
|
"lodash": "^4.17.15"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
45
|
+
"@contentful/field-editor-test-utils": "^1.4.6"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8.0"
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"registry": "https://npm.pkg.github.com/"
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "142d2039f023bf4ced956aae1dd08b27c35fdbaa"
|
|
51
54
|
}
|