@contentful/field-editor-shared
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -124,2 +124,3 @@ "use strict"; | ||
_define_property(this, "unsubscribeValue", null); | ||
_define_property(this, "getDebounceDuration", ()=>'debounce' in this.props ? this.props.debounce : this.props.throttle); | ||
_define_property(this, "setValue", async (value)=>{ | ||
@@ -135,3 +136,3 @@ if (this.props.isEmptyValue(value ?? null)) { | ||
} | ||
if (this.props.debounce === 0) { | ||
if (this.getDebounceDuration() === 0) { | ||
await this.triggerSetValueCallbacks(value); | ||
@@ -151,3 +152,3 @@ } else { | ||
}); | ||
_define_property(this, "debouncedTriggerSetValueCallbacks", (0, _debounce.default)(this.triggerSetValueCallbacks, this.props.debounce)); | ||
_define_property(this, "debouncedTriggerSetValueCallbacks", (0, _debounce.default)(this.triggerSetValueCallbacks, this.getDebounceDuration())); | ||
const initialValue = props.field.getValue(); | ||
@@ -154,0 +155,0 @@ this.state = { |
@@ -68,2 +68,3 @@ function _define_property(obj, key, value) { | ||
_define_property(this, "unsubscribeValue", null); | ||
_define_property(this, "getDebounceDuration", ()=>'debounce' in this.props ? this.props.debounce : this.props.throttle); | ||
_define_property(this, "setValue", async (value)=>{ | ||
@@ -79,3 +80,3 @@ if (this.props.isEmptyValue(value ?? null)) { | ||
} | ||
if (this.props.debounce === 0) { | ||
if (this.getDebounceDuration() === 0) { | ||
await this.triggerSetValueCallbacks(value); | ||
@@ -95,3 +96,3 @@ } else { | ||
}); | ||
_define_property(this, "debouncedTriggerSetValueCallbacks", debounce(this.triggerSetValueCallbacks, this.props.debounce)); | ||
_define_property(this, "debouncedTriggerSetValueCallbacks", debounce(this.triggerSetValueCallbacks, this.getDebounceDuration())); | ||
const initialValue = props.field.getValue(); | ||
@@ -98,0 +99,0 @@ this.state = { |
@@ -22,3 +22,3 @@ /// <reference types="lodash" /> | ||
} | ||
interface FieldConnectorProps<ValueType> { | ||
type FieldConnectorProps<ValueType> = { | ||
field: FieldAPI; | ||
@@ -30,4 +30,8 @@ isInitiallyDisabled: boolean; | ||
isEqualValues: (value1: ValueType | Nullable, value2: ValueType | Nullable) => boolean; | ||
} & ({ | ||
debounce: number; | ||
} | ||
} | { | ||
/** @deprecated: Please use `debounce` instead */ | ||
throttle: number; | ||
}); | ||
export declare class FieldConnector<ValueType> extends React.Component<FieldConnectorProps<ValueType>, FieldConnectorState<ValueType>> { | ||
@@ -44,2 +48,3 @@ static defaultProps: { | ||
unsubscribeValue: Function | null; | ||
getDebounceDuration: () => number; | ||
setValue: (value: ValueType | Nullable) => Promise<void>; | ||
@@ -46,0 +51,0 @@ triggerSetValueCallbacks: (value: ValueType | Nullable) => Promise<unknown>; |
{ | ||
"name": "@contentful/field-editor-shared", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"main": "dist/cjs/index.js", | ||
@@ -54,3 +54,3 @@ "module": "dist/esm/index.js", | ||
}, | ||
"gitHead": "843655f104af6fb8c116869d59cd9f20e6f1ab14" | ||
"gitHead": "60fd3c2f5a58f4d42886b5f952ce3cc1aec71833" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65902
1931