Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/field-editor-shared

Package Overview
Dependencies
Maintainers
57
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/field-editor-shared - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

dist/PredefinedValuesError.d.ts

15

dist/field-editor-shared.cjs.development.js

@@ -8,2 +8,3 @@ 'use strict';

var throttle = _interopDefault(require('lodash/throttle'));
var forma36ReactComponents = require('@contentful/forma-36-react-components');

@@ -56,4 +57,4 @@ function identity(item) {

removeValue: function removeValue() {
_value = '';
emitter.emit('value_changed', '');
_value = undefined;
emitter.emit('value_changed', undefined);
return Promise.resolve();

@@ -111,3 +112,3 @@ }

value: props.field.getValue(),
disabled: props.initialDisabled,
disabled: props.isInitiallyDisabled,
errors: []

@@ -175,4 +176,12 @@ };

function PredefinedValuesError() {
return React.createElement(forma36ReactComponents.Note, {
noteType: "warning",
testId: "predefined-values-warning"
}, "The widget failed to initialize. You can fix the problem by providing predefined values under the validations tab in the field settings.");
}
exports.FieldConnector = FieldConnector;
exports.PredefinedValuesError = PredefinedValuesError;
exports.createFakeFieldAPI = createFakeFieldAPI;
//# sourceMappingURL=field-editor-shared.cjs.development.js.map

2

dist/field-editor-shared.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("mitt")),n=e(require("react")),r=e(require("lodash/throttle"));function u(e){return e}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var i=function(e){var t,n;function u(t){var n;return(n=e.call(this,t)||this).unsubscribeErrors=null,n.unsubscribeDisabled=null,n.unsubscribeValue=null,n.setValue=r(function(e){n.props.isEmptyValue(void 0===e?null:e)?n.props.field.removeValue():n.props.field.setValue(e)},n.props.throttle,{leading:0===n.props.throttle}),n.state={value:t.field.getValue(),disabled:t.initialDisabled,errors:[]},n}n=e,(t=u).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=u.prototype;return i.componentDidMount=function(){var e=this,t=this.props.field;this.unsubscribeErrors=t.onSchemaErrorsChanged(function(t){e.setState({errors:t||[]})}),this.unsubscribeDisabled=t.onIsDisabledChanged(function(t){e.setState({disabled:t})}),this.unsubscribeValue=t.onValueChanged(function(t){e.setState({value:t})})},i.componentWillUnmount=function(){"function"==typeof this.unsubscribeErrors&&this.unsubscribeErrors(),"function"==typeof this.unsubscribeDisabled&&this.unsubscribeDisabled(),"function"==typeof this.unsubscribeValue&&this.unsubscribeValue()},i.render=function(){return this.props.children(o({},this.state,{setValue:this.setValue}))},u}(n.Component);i.defaultProps={children:function(){return null},isEmptyValue:function(e){return null===e||""===e},throttle:300},exports.FieldConnector=i,exports.createFakeFieldAPI=function(e,n){void 0===e&&(e=u);var r=new t,o=n;return e({id:"fake-id",locale:"en-US",type:"",validations:[],required:!1,onValueChanged:function(e){return r.on("value_changed",e),function(){r.off("value_changed",e)}},onIsDisabledChanged:function(e){return r.on("disable_changed",e),function(){r.off("disable_changed",e)}},onSchemaErrorsChanged:function(e){return r.on("errors_changed",e),function(){r.off("errors_changed",e)}},getValue:function(){return o},setInvalid:function(){},setValue:function(e){return r.emit("value_changed",o=e),Promise.resolve()},removeValue:function(){return o="",r.emit("value_changed",""),Promise.resolve()}},r)};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("mitt")),n=e(require("react")),r=e(require("lodash/throttle")),i=require("@contentful/forma-36-react-components");function o(e){return e}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var s=function(e){var t,n;function i(t){var n;return(n=e.call(this,t)||this).unsubscribeErrors=null,n.unsubscribeDisabled=null,n.unsubscribeValue=null,n.setValue=r(function(e){n.props.isEmptyValue(void 0===e?null:e)?n.props.field.removeValue():n.props.field.setValue(e)},n.props.throttle,{leading:0===n.props.throttle}),n.state={value:t.field.getValue(),disabled:t.isInitiallyDisabled,errors:[]},n}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=i.prototype;return o.componentDidMount=function(){var e=this,t=this.props.field;this.unsubscribeErrors=t.onSchemaErrorsChanged(function(t){e.setState({errors:t||[]})}),this.unsubscribeDisabled=t.onIsDisabledChanged(function(t){e.setState({disabled:t})}),this.unsubscribeValue=t.onValueChanged(function(t){e.setState({value:t})})},o.componentWillUnmount=function(){"function"==typeof this.unsubscribeErrors&&this.unsubscribeErrors(),"function"==typeof this.unsubscribeDisabled&&this.unsubscribeDisabled(),"function"==typeof this.unsubscribeValue&&this.unsubscribeValue()},o.render=function(){return this.props.children(u({},this.state,{setValue:this.setValue}))},i}(n.Component);s.defaultProps={children:function(){return null},isEmptyValue:function(e){return null===e||""===e},throttle:300},exports.FieldConnector=s,exports.PredefinedValuesError=function(){return n.createElement(i.Note,{noteType:"warning",testId:"predefined-values-warning"},"The widget failed to initialize. You can fix the problem by providing predefined values under the validations tab in the field settings.")},exports.createFakeFieldAPI=function(e,n){void 0===e&&(e=o);var r=new t,i=n;return e({id:"fake-id",locale:"en-US",type:"",validations:[],required:!1,onValueChanged:function(e){return r.on("value_changed",e),function(){r.off("value_changed",e)}},onIsDisabledChanged:function(e){return r.on("disable_changed",e),function(){r.off("disable_changed",e)}},onSchemaErrorsChanged:function(e){return r.on("errors_changed",e),function(){r.off("errors_changed",e)}},getValue:function(){return i},setInvalid:function(){},setValue:function(e){return r.emit("value_changed",i=e),Promise.resolve()},removeValue:function(){return i=void 0,r.emit("value_changed",void 0),Promise.resolve()}},r)};
//# sourceMappingURL=field-editor-shared.cjs.production.min.js.map
import mitt from 'mitt';
import React from 'react';
import throttle from 'lodash-es/throttle';
import { Note } from '@contentful/forma-36-react-components';

@@ -51,4 +52,4 @@ function identity(item) {

removeValue: function removeValue() {
_value = '';
emitter.emit('value_changed', '');
_value = undefined;
emitter.emit('value_changed', undefined);
return Promise.resolve();

@@ -106,3 +107,3 @@ }

value: props.field.getValue(),
disabled: props.initialDisabled,
disabled: props.isInitiallyDisabled,
errors: []

@@ -170,3 +171,10 @@ };

export { FieldConnector, createFakeFieldAPI };
function PredefinedValuesError() {
return React.createElement(Note, {
noteType: "warning",
testId: "predefined-values-warning"
}, "The widget failed to initialize. You can fix the problem by providing predefined values under the validations tab in the field settings.");
}
export { FieldConnector, PredefinedValuesError, createFakeFieldAPI };
//# sourceMappingURL=field-editor-shared.esm.js.map

@@ -12,3 +12,3 @@ /// <reference types="lodash" />

field: FieldAPI;
initialDisabled: boolean;
isInitiallyDisabled: boolean;
children: (state: FieldConnectorState<ValueType> & {

@@ -15,0 +15,0 @@ setValue: (value: ValueType | Nullable) => void;

export { createFakeFieldAPI } from './createFakeFieldAPI';
export { FieldAPI } from 'contentful-ui-extensions-sdk';
export { FieldAPI, ParametersAPI } from 'contentful-ui-extensions-sdk';
export { FieldConnector } from './FieldConnector';
export { PredefinedValuesError } from './PredefinedValuesError';
{
"name": "@contentful/field-editor-shared",
"version": "0.1.0",
"version": "0.2.0",
"main": "dist/index.js",

@@ -30,3 +30,3 @@ "module": "dist/field-editor-shared.esm.js",

},
"gitHead": "4320861d2d63937aff1a714c4873a4b821774394"
"gitHead": "569893bdb9d7fcde6263c92b5faa9d68c215938a"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc