New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alifd/field

Package Overview
Dependencies
Maintainers
9
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alifd/field - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

lib/utils.js

73

lib/index.js

@@ -72,3 +72,3 @@ "use strict";

if (!com) {
_utils.log.warning('`this` is missing in `Field`, you should use like `new Field(this)`');
(0, _utils.warning)('`this` is missing in `Field`, you should use like `new Field(this)`');
}

@@ -82,3 +82,3 @@

this.values = options.values || {};
this.values = Object.assign({}, options.values);
this.processErrorMessage = options.processErrorMessage;

@@ -91,3 +91,3 @@ this.afterValidateRerender = options.afterValidateRerender;

first: false,
onChange: _utils.func.noop,
onChange: function onChange() {},
autoUnmount: true,

@@ -99,6 +99,2 @@ autoValidate: true

});
if (options.values) {
this.setValues(options.values, false);
}
}

@@ -141,5 +137,2 @@

var defaultValueName = "default".concat(valueName[0].toUpperCase()).concat(valueName.slice(1));
var field = this._getInitMeta(name);
var defaultValue;

@@ -152,4 +145,7 @@

defaultValue = originalProps[defaultValueName];
}
} // get field from this.fieldsMeta or new one
var field = this._getInitMeta(name);
Object.assign(field, {

@@ -172,8 +168,6 @@ valueName: valueName,

}
} // should get value from this.values
}
/**
* a new field (value not in field)
* step 1: get value from this.values
* step 2: from defaultValue
* first init field (value not in field)
* should get field.value from this.values or defaultValue
*/

@@ -185,13 +179,19 @@

var cachedValue = (0, _utils.getIn)(this.values, name);
field.value = typeof cachedValue !== 'undefined' ? cachedValue : defaultValue;
if (typeof cachedValue !== 'undefined') {
field.value = cachedValue;
} else if (typeof defaultValue !== 'undefined') {
field.value = defaultValue;
this.values = (0, _utils.setIn)(this.values, name, field.value);
}
} else {
var _cachedValue = this.values[name];
field.value = typeof _cachedValue !== 'undefined' ? _cachedValue : defaultValue;
if (typeof _cachedValue !== 'undefined') {
field.value = _cachedValue;
} else if (typeof defaultValue !== 'undefined') {
field.value = defaultValue;
this.values[name] = field.value;
}
}
}
if (parseName && !(0, _utils.getIn)(this.values, name)) {
this.values = (0, _utils.setIn)(this.values, name, field.value);
} else if (!parseName && !this.values[name]) {
this.values[name] = field.value;
} // Component props

@@ -955,15 +955,3 @@

value: function reset(ns) {
var backToDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (ns === true) {
_utils.log.deprecated('reset(true)', 'resetToDefault()', 'Field');
this.resetToDefault();
} else if (backToDefault === true) {
_utils.log.deprecated('reset(ns,true)', 'resetToDefault(ns)', 'Field');
this.resetToDefault(ns);
} else {
this._reset(ns, false);
}
this._reset(ns, false);
}

@@ -974,10 +962,2 @@ }, {

this._reset(ns, true);
} // deprecated. TODO: remove in 2.0 version
}, {
key: "isValidating",
value: function isValidating(name) {
_utils.log.deprecated('isValidating', 'getState', 'Field');
return this.getState(name) === 'loading';
}

@@ -1030,4 +1010,3 @@ }, {

if (keyMatch.indexOf('{index}') === -1) {
_utils.log.warning('{index} not find in key');
(0, _utils.warning)('{index} not find in key');
return;

@@ -1034,0 +1013,0 @@ } // regex to match field names in the same target array

{
"name": "@alifd/field",
"version": "1.1.6",
"version": "1.1.7",
"description": "Fields can be used to manage data when it comes to form data manipulation and validation. After being associated with a component, the form data can be automatically written back, read, and verified.",

@@ -84,3 +84,3 @@ "files": [

},
"homepage": "https://unpkg.com/@alifd/field@1.1.6/build/index.html",
"homepage": "https://unpkg.com/@alifd/field@1.1.7/build/index.html",
"bugs": "https://github.com/alibaba-fusion/field/issues",

@@ -87,0 +87,0 @@ "publishConfig": {

# Field
<p align="center">
<a href="https://www.npmjs.org/package/@alifd/field"><img src="https://img.shields.io/npm/v/@alifd/field.svg"></a>
<a href="https://www.npmjs.org/package/@alifd/field"><img src="https://img.shields.io/npm/dm/@alifd/field.svg"></a>
<a href="https://codecov.io/gh/alibaba-fusion/field"><img src="https://codecov.io/gh/alibaba-fusion/field/branch/master/graph/badge.svg"></a>
<a href="https://travis-ci.com/alibaba-fusion/field"><img src="https://travis-ci.com/alibaba-fusion/field.svg?branch=master"></a>
<a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg"></a>
<a href="https://github.com/alibaba-fusion/field/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg"></a>
<a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg"></a>
</p>
- category: Components

@@ -4,0 +14,0 @@ - family: DataEntry

# Field
<p align="center">
<a href="https://www.npmjs.org/package/@alifd/field"><img src="https://img.shields.io/npm/v/@alifd/field.svg"></a>
<a href="https://www.npmjs.org/package/@alifd/field"><img src="https://img.shields.io/npm/dm/@alifd/field.svg"></a>
<a href="https://codecov.io/gh/alibaba-fusion/field"><img src="https://codecov.io/gh/alibaba-fusion/field/branch/master/graph/badge.svg"></a>
<a href="https://travis-ci.com/alibaba-fusion/field"><img src="https://travis-ci.com/alibaba-fusion/field.svg?branch=master"></a>
<a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg"></a>
<a href="https://github.com/alibaba-fusion/field/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg"></a>
<a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg"></a>
</p>
- category: Components

@@ -4,0 +14,0 @@ - family: DataEntry

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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