@contentful/field-editor-slug 3.1.1 → 3.1.2-canary.0
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/SlugEditor.js
CHANGED
|
@@ -81,9 +81,8 @@ function FieldConnectorCallback({ Component, value, disabled, setValue, errors,
|
|
|
81
81
|
maxLength: maxLength
|
|
82
82
|
}));
|
|
83
83
|
}
|
|
84
|
-
function SlugEditor(
|
|
85
|
-
const {
|
|
86
|
-
const { locales, entry, cma } = props.baseSdk;
|
|
84
|
+
function SlugEditor({ isInitiallyDisabled = true, autoGenerationStrategy = 'field', baseSdk, field, parameters, id }) {
|
|
85
|
+
const { locales, entry, cma } = baseSdk;
|
|
87
86
|
if (!isSupportedFieldTypes(field.type)) {
|
|
88
87
|
throw new Error(`"${field.type}" field type is not supported by SlugEditor`);
|
|
89
88
|
}
|
|
@@ -116,17 +115,17 @@ function SlugEditor(props) {
|
|
|
116
115
|
cma.entry
|
|
117
116
|
]);
|
|
118
117
|
return /*#__PURE__*/ _react.createElement(_TrackingFieldConnector.TrackingFieldConnector, {
|
|
119
|
-
sdk:
|
|
118
|
+
sdk: baseSdk,
|
|
120
119
|
field: field,
|
|
121
120
|
defaultLocale: locales.default,
|
|
122
121
|
isOptionalLocaleWithFallback: isOptionalLocaleWithFallback,
|
|
123
122
|
trackingFieldId: trackingFieldId
|
|
124
123
|
}, ({ titleValue, isPublished, isSame })=>/*#__PURE__*/ _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
125
124
|
field: field,
|
|
126
|
-
isInitiallyDisabled:
|
|
125
|
+
isInitiallyDisabled: isInitiallyDisabled,
|
|
127
126
|
debounce: 0
|
|
128
127
|
}, ({ value, errors, disabled, setValue, externalReset })=>{
|
|
129
|
-
const shouldTrackTitle = isPublished === false && isSame === false;
|
|
128
|
+
const shouldTrackTitle = autoGenerationStrategy !== 'document' && isPublished === false && isSame === false;
|
|
130
129
|
const Component = shouldTrackTitle ? _SlugEditorField.SlugEditorField : _SlugEditorField.SlugEditorFieldStatic;
|
|
131
130
|
return /*#__PURE__*/ _react.createElement(FieldConnectorCallback, {
|
|
132
131
|
Component: Component,
|
|
@@ -146,6 +145,3 @@ function SlugEditor(props) {
|
|
|
146
145
|
});
|
|
147
146
|
}));
|
|
148
147
|
}
|
|
149
|
-
SlugEditor.defaultProps = {
|
|
150
|
-
isInitiallyDisabled: true
|
|
151
|
-
};
|
package/dist/esm/SlugEditor.js
CHANGED
|
@@ -30,9 +30,8 @@ function FieldConnectorCallback({ Component, value, disabled, setValue, errors,
|
|
|
30
30
|
maxLength: maxLength
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
|
-
export function SlugEditor(
|
|
34
|
-
const {
|
|
35
|
-
const { locales, entry, cma } = props.baseSdk;
|
|
33
|
+
export function SlugEditor({ isInitiallyDisabled = true, autoGenerationStrategy = 'field', baseSdk, field, parameters, id }) {
|
|
34
|
+
const { locales, entry, cma } = baseSdk;
|
|
36
35
|
if (!isSupportedFieldTypes(field.type)) {
|
|
37
36
|
throw new Error(`"${field.type}" field type is not supported by SlugEditor`);
|
|
38
37
|
}
|
|
@@ -65,17 +64,17 @@ export function SlugEditor(props) {
|
|
|
65
64
|
cma.entry
|
|
66
65
|
]);
|
|
67
66
|
return /*#__PURE__*/ React.createElement(TrackingFieldConnector, {
|
|
68
|
-
sdk:
|
|
67
|
+
sdk: baseSdk,
|
|
69
68
|
field: field,
|
|
70
69
|
defaultLocale: locales.default,
|
|
71
70
|
isOptionalLocaleWithFallback: isOptionalLocaleWithFallback,
|
|
72
71
|
trackingFieldId: trackingFieldId
|
|
73
72
|
}, ({ titleValue, isPublished, isSame })=>/*#__PURE__*/ React.createElement(FieldConnector, {
|
|
74
73
|
field: field,
|
|
75
|
-
isInitiallyDisabled:
|
|
74
|
+
isInitiallyDisabled: isInitiallyDisabled,
|
|
76
75
|
debounce: 0
|
|
77
76
|
}, ({ value, errors, disabled, setValue, externalReset })=>{
|
|
78
|
-
const shouldTrackTitle = isPublished === false && isSame === false;
|
|
77
|
+
const shouldTrackTitle = autoGenerationStrategy !== 'document' && isPublished === false && isSame === false;
|
|
79
78
|
const Component = shouldTrackTitle ? SlugEditorField : SlugEditorFieldStatic;
|
|
80
79
|
return /*#__PURE__*/ React.createElement(FieldConnectorCallback, {
|
|
81
80
|
Component: Component,
|
|
@@ -95,6 +94,3 @@ export function SlugEditor(props) {
|
|
|
95
94
|
});
|
|
96
95
|
}));
|
|
97
96
|
}
|
|
98
|
-
SlugEditor.defaultProps = {
|
|
99
|
-
isInitiallyDisabled: true
|
|
100
|
-
};
|
|
@@ -19,10 +19,6 @@ export interface SlugEditorProps {
|
|
|
19
19
|
trackingFieldId?: string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
autoGenerationStrategy?: 'field' | 'document';
|
|
22
23
|
}
|
|
23
|
-
export declare function SlugEditor(
|
|
24
|
-
export declare namespace SlugEditor {
|
|
25
|
-
var defaultProps: {
|
|
26
|
-
isInitiallyDisabled: boolean;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
24
|
+
export declare function SlugEditor({ isInitiallyDisabled, autoGenerationStrategy, baseSdk, field, parameters, id, }: SlugEditorProps): React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-slug",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2-canary.0+47091d1a",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"registry": "https://npm.pkg.github.com/"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "47091d1abb29563fed7044e3763966dcddd14636"
|
|
63
63
|
}
|