@contentful/default-field-editors 1.6.7 → 1.6.9
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/Field.js +4 -2
- package/dist/cjs/Field.spec.js +5 -3
- package/dist/cjs/FieldWrapper.js +7 -5
- package/dist/cjs/FieldWrapper.spec.js +6 -4
- package/dist/esm/Field.js +1 -1
- package/dist/esm/Field.spec.js +2 -2
- package/dist/esm/FieldWrapper.js +4 -4
- package/dist/esm/FieldWrapper.spec.js +3 -3
- package/package.json +23 -23
package/dist/cjs/Field.js
CHANGED
|
@@ -49,7 +49,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
49
49
|
if (cache && cache.has(obj)) {
|
|
50
50
|
return cache.get(obj);
|
|
51
51
|
}
|
|
52
|
-
var newObj = {
|
|
52
|
+
var newObj = {
|
|
53
|
+
__proto__: null
|
|
54
|
+
};
|
|
53
55
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
54
56
|
for(var key in obj){
|
|
55
57
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -167,7 +169,7 @@ const widgetComponents = {
|
|
|
167
169
|
]
|
|
168
170
|
};
|
|
169
171
|
const Field = (props)=>{
|
|
170
|
-
const { sdk
|
|
172
|
+
const { sdk, widgetId: possiblyUndefinedWidgetId, isInitiallyDisabled = false, renderFieldEditor, getOptions } = props;
|
|
171
173
|
const field = sdk.field;
|
|
172
174
|
const locales = sdk.locales;
|
|
173
175
|
const widgetId = possiblyUndefinedWidgetId ?? (0, _getDefaultWidgetId.getDefaultWidgetId)(sdk);
|
package/dist/cjs/Field.spec.js
CHANGED
|
@@ -29,7 +29,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
29
29
|
if (cache && cache.has(obj)) {
|
|
30
30
|
return cache.get(obj);
|
|
31
31
|
}
|
|
32
|
-
var newObj = {
|
|
32
|
+
var newObj = {
|
|
33
|
+
__proto__: null
|
|
34
|
+
};
|
|
33
35
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
34
36
|
for(var key in obj){
|
|
35
37
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -68,7 +70,7 @@ describe('Field', ()=>{
|
|
|
68
70
|
afterEach(_react1.cleanup);
|
|
69
71
|
it('renders custom field editor specified by renderFieldEditor', ()=>{
|
|
70
72
|
const sdk = getSdk();
|
|
71
|
-
const { queryByTestId
|
|
73
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_Field.Field, {
|
|
72
74
|
sdk: sdk,
|
|
73
75
|
isInitiallyDisabled: false,
|
|
74
76
|
widgetId: "customEditor",
|
|
@@ -104,7 +106,7 @@ describe('Field', ()=>{
|
|
|
104
106
|
isInitiallyDisabled: false,
|
|
105
107
|
widgetId: 'singleLine'
|
|
106
108
|
};
|
|
107
|
-
const { container
|
|
109
|
+
const { container, rerender } = (0, _react1.render)(_react.createElement(_Field.Field, {
|
|
108
110
|
...props,
|
|
109
111
|
sdk: getSdk((field)=>{
|
|
110
112
|
field.locale = 'en-US';
|
package/dist/cjs/FieldWrapper.js
CHANGED
|
@@ -34,7 +34,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
34
34
|
if (cache && cache.has(obj)) {
|
|
35
35
|
return cache.get(obj);
|
|
36
36
|
}
|
|
37
|
-
var newObj = {
|
|
37
|
+
var newObj = {
|
|
38
|
+
__proto__: null
|
|
39
|
+
};
|
|
38
40
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
41
|
for(var key in obj){
|
|
40
42
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -53,11 +55,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
53
55
|
return newObj;
|
|
54
56
|
}
|
|
55
57
|
const FieldWrapper = function(props) {
|
|
56
|
-
const { ids
|
|
58
|
+
const { ids } = props.sdk;
|
|
57
59
|
const defaultGetEntryUrl = (entry)=>`/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${entry.sys.id}`;
|
|
58
|
-
const { name
|
|
59
|
-
const { field
|
|
60
|
-
const helpText =
|
|
60
|
+
const { name, sdk, className, children, renderHeading, renderHelpText, showFocusBar = true, getEntryURL = defaultGetEntryUrl } = props;
|
|
61
|
+
const { field } = sdk;
|
|
62
|
+
const helpText = sdk.parameters?.instance?.helpText ?? '';
|
|
61
63
|
const [hasErrors, setHasErrors] = _react.useState(false);
|
|
62
64
|
_react.useEffect(()=>{
|
|
63
65
|
return field.onSchemaErrorsChanged((errors)=>{
|
|
@@ -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)) {
|
|
@@ -68,7 +70,7 @@ describe('Field', ()=>{
|
|
|
68
70
|
helpText: 'help'
|
|
69
71
|
}
|
|
70
72
|
};
|
|
71
|
-
const { queryByTestId
|
|
73
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_FieldWrapper.FieldWrapper, {
|
|
72
74
|
name: "field",
|
|
73
75
|
sdk: sdk,
|
|
74
76
|
getEntryURL: getEntryURL
|
|
@@ -87,7 +89,7 @@ describe('Field', ()=>{
|
|
|
87
89
|
expect(queryByTestId('field-hint')).toBeInTheDocument();
|
|
88
90
|
});
|
|
89
91
|
it('renders custom label', ()=>{
|
|
90
|
-
const { queryByTestId
|
|
92
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_FieldWrapper.FieldWrapper, {
|
|
91
93
|
name: "field",
|
|
92
94
|
sdk: sdk,
|
|
93
95
|
getEntryURL: getEntryURL,
|
|
@@ -98,7 +100,7 @@ describe('Field', ()=>{
|
|
|
98
100
|
expect(queryByTestId('custom-label')).toBeInTheDocument();
|
|
99
101
|
});
|
|
100
102
|
it('renders custom help text', ()=>{
|
|
101
|
-
const { queryByTestId
|
|
103
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_FieldWrapper.FieldWrapper, {
|
|
102
104
|
name: "field",
|
|
103
105
|
sdk: sdk,
|
|
104
106
|
getEntryURL: getEntryURL,
|
package/dist/esm/Field.js
CHANGED
|
@@ -118,7 +118,7 @@ const widgetComponents = {
|
|
|
118
118
|
]
|
|
119
119
|
};
|
|
120
120
|
export const Field = (props)=>{
|
|
121
|
-
const { sdk
|
|
121
|
+
const { sdk, widgetId: possiblyUndefinedWidgetId, isInitiallyDisabled = false, renderFieldEditor, getOptions } = props;
|
|
122
122
|
const field = sdk.field;
|
|
123
123
|
const locales = sdk.locales;
|
|
124
124
|
const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);
|
package/dist/esm/Field.spec.js
CHANGED
|
@@ -25,7 +25,7 @@ describe('Field', ()=>{
|
|
|
25
25
|
afterEach(cleanup);
|
|
26
26
|
it('renders custom field editor specified by renderFieldEditor', ()=>{
|
|
27
27
|
const sdk = getSdk();
|
|
28
|
-
const { queryByTestId
|
|
28
|
+
const { queryByTestId } = render(React.createElement(Field, {
|
|
29
29
|
sdk: sdk,
|
|
30
30
|
isInitiallyDisabled: false,
|
|
31
31
|
widgetId: "customEditor",
|
|
@@ -61,7 +61,7 @@ describe('Field', ()=>{
|
|
|
61
61
|
isInitiallyDisabled: false,
|
|
62
62
|
widgetId: 'singleLine'
|
|
63
63
|
};
|
|
64
|
-
const { container
|
|
64
|
+
const { container, rerender } = render(React.createElement(Field, {
|
|
65
65
|
...props,
|
|
66
66
|
sdk: getSdk((field)=>{
|
|
67
67
|
field.locale = 'en-US';
|
package/dist/esm/FieldWrapper.js
CHANGED
|
@@ -4,11 +4,11 @@ import { ValidationErrors } from '@contentful/field-editor-validation-errors';
|
|
|
4
4
|
import { cx } from 'emotion';
|
|
5
5
|
import { styles } from './FieldWrapper.styles';
|
|
6
6
|
export const FieldWrapper = function(props) {
|
|
7
|
-
const { ids
|
|
7
|
+
const { ids } = props.sdk;
|
|
8
8
|
const defaultGetEntryUrl = (entry)=>`/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${entry.sys.id}`;
|
|
9
|
-
const { name
|
|
10
|
-
const { field
|
|
11
|
-
const helpText =
|
|
9
|
+
const { name, sdk, className, children, renderHeading, renderHelpText, showFocusBar = true, getEntryURL = defaultGetEntryUrl } = props;
|
|
10
|
+
const { field } = sdk;
|
|
11
|
+
const helpText = sdk.parameters?.instance?.helpText ?? '';
|
|
12
12
|
const [hasErrors, setHasErrors] = React.useState(false);
|
|
13
13
|
React.useEffect(()=>{
|
|
14
14
|
return field.onSchemaErrorsChanged((errors)=>{
|
|
@@ -25,7 +25,7 @@ describe('Field', ()=>{
|
|
|
25
25
|
helpText: 'help'
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
const { queryByTestId
|
|
28
|
+
const { queryByTestId } = render(React.createElement(FieldWrapper, {
|
|
29
29
|
name: "field",
|
|
30
30
|
sdk: sdk,
|
|
31
31
|
getEntryURL: getEntryURL
|
|
@@ -44,7 +44,7 @@ describe('Field', ()=>{
|
|
|
44
44
|
expect(queryByTestId('field-hint')).toBeInTheDocument();
|
|
45
45
|
});
|
|
46
46
|
it('renders custom label', ()=>{
|
|
47
|
-
const { queryByTestId
|
|
47
|
+
const { queryByTestId } = render(React.createElement(FieldWrapper, {
|
|
48
48
|
name: "field",
|
|
49
49
|
sdk: sdk,
|
|
50
50
|
getEntryURL: getEntryURL,
|
|
@@ -55,7 +55,7 @@ describe('Field', ()=>{
|
|
|
55
55
|
expect(queryByTestId('custom-label')).toBeInTheDocument();
|
|
56
56
|
});
|
|
57
57
|
it('renders custom help text', ()=>{
|
|
58
|
-
const { queryByTestId
|
|
58
|
+
const { queryByTestId } = render(React.createElement(FieldWrapper, {
|
|
59
59
|
name: "field",
|
|
60
60
|
sdk: sdk,
|
|
61
61
|
getEntryURL: getEntryURL,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/default-field-editors",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -36,31 +36,31 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@contentful/f36-components": "^4.0.27",
|
|
39
|
-
"@contentful/field-editor-boolean": "^1.4.
|
|
40
|
-
"@contentful/field-editor-checkbox": "^1.4.
|
|
41
|
-
"@contentful/field-editor-date": "^1.6.
|
|
42
|
-
"@contentful/field-editor-dropdown": "^1.4.
|
|
43
|
-
"@contentful/field-editor-json": "^3.3.
|
|
44
|
-
"@contentful/field-editor-list": "^1.4.
|
|
45
|
-
"@contentful/field-editor-location": "^1.3.
|
|
46
|
-
"@contentful/field-editor-markdown": "^1.5.
|
|
47
|
-
"@contentful/field-editor-multiple-line": "^1.3.
|
|
48
|
-
"@contentful/field-editor-number": "^1.3.
|
|
49
|
-
"@contentful/field-editor-radio": "^1.4.
|
|
50
|
-
"@contentful/field-editor-rating": "^1.4.
|
|
51
|
-
"@contentful/field-editor-reference": "^5.21.
|
|
52
|
-
"@contentful/field-editor-rich-text": "^3.16.
|
|
53
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
54
|
-
"@contentful/field-editor-single-line": "^1.3.
|
|
55
|
-
"@contentful/field-editor-slug": "^1.4.
|
|
56
|
-
"@contentful/field-editor-tags": "^1.4.
|
|
57
|
-
"@contentful/field-editor-url": "^1.3.
|
|
58
|
-
"@contentful/field-editor-validation-errors": "^1.3.
|
|
39
|
+
"@contentful/field-editor-boolean": "^1.4.4",
|
|
40
|
+
"@contentful/field-editor-checkbox": "^1.4.4",
|
|
41
|
+
"@contentful/field-editor-date": "^1.6.4",
|
|
42
|
+
"@contentful/field-editor-dropdown": "^1.4.4",
|
|
43
|
+
"@contentful/field-editor-json": "^3.3.8",
|
|
44
|
+
"@contentful/field-editor-list": "^1.4.4",
|
|
45
|
+
"@contentful/field-editor-location": "^1.3.8",
|
|
46
|
+
"@contentful/field-editor-markdown": "^1.5.5",
|
|
47
|
+
"@contentful/field-editor-multiple-line": "^1.3.6",
|
|
48
|
+
"@contentful/field-editor-number": "^1.3.6",
|
|
49
|
+
"@contentful/field-editor-radio": "^1.4.4",
|
|
50
|
+
"@contentful/field-editor-rating": "^1.4.4",
|
|
51
|
+
"@contentful/field-editor-reference": "^5.21.5",
|
|
52
|
+
"@contentful/field-editor-rich-text": "^3.16.12",
|
|
53
|
+
"@contentful/field-editor-shared": "^1.4.4",
|
|
54
|
+
"@contentful/field-editor-single-line": "^1.3.6",
|
|
55
|
+
"@contentful/field-editor-slug": "^1.4.4",
|
|
56
|
+
"@contentful/field-editor-tags": "^1.4.4",
|
|
57
|
+
"@contentful/field-editor-url": "^1.3.6",
|
|
58
|
+
"@contentful/field-editor-validation-errors": "^1.3.6",
|
|
59
59
|
"contentful-management": "^10.0.0 || ^11.0.0",
|
|
60
60
|
"emotion": "^10.0.27"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
63
|
+
"@contentful/field-editor-test-utils": "^1.4.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": ">=16.8.0"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://npm.pkg.github.com/"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "89b14d123bc36f18214825404a33a6c2f7bc26b3"
|
|
72
72
|
}
|