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

react-ui-validations

Package Overview
Dependencies
Maintainers
3
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ui-validations - npm Package Compare versions

Comparing version 1.10.2 to 1.10.3

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [1.10.3](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@1.10.2...react-ui-validations@1.10.3) (2022-11-09)
### Bug Fixes
* **ValidationContainer:** level warning is valid ([#3026](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/issues/3026)) ([1253735](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/commit/1253735c72d788e3c439ac2dbeb5ebc2f1417c1e))
## [1.10.2](https://github.com/skbkontur/retail-ui/tree/master/packages/react-ui-validations/compare/react-ui-validations@1.10.1...react-ui-validations@1.10.2) (2022-09-09)

@@ -8,0 +19,0 @@

97

index.js

@@ -237,38 +237,2 @@ 'use strict';

function getVisibleValidation(visible, actual, changing) {
var from = function (type) { return getType(visible) === type; };
var to = function (type) { return getType(actual) === type; };
if (to('immediate')) {
return actual;
}
if (changing) {
return from('immediate') ? null : visible;
}
if (from(null) && to('lostfocus')) {
return null;
}
if (to('lostfocus')) {
return actual;
}
if (from('submit') && to('submit')) {
return visible;
}
return null;
}
function getType(validation) {
return validation ? validation.behaviour : null;
}
function getLevel(validation) {
return validation ? validation.level : null;
}
function getIndependent(validation) {
return validation ? validation.independent : null;
}
function isEqual(a, b) {
if (a === b) {
return true;
}
return !!a && !!b && a.behaviour === b.behaviour && a.message === b.message && a.independent === b.independent;
}
var ValidationContext = React__default["default"].createContext({

@@ -291,6 +255,2 @@ register: function () { return undefined; },

_this.childWrappers = [];
_this.previousValidation = [];
_this.validationsArraysEqual = function (a1, a2) {
return a1.length === a2.length && a1.every(function (o, idx) { return isEqual(o, a2[idx]); });
};
return _this;

@@ -376,19 +336,11 @@ }

return __awaiter(this, void 0, void 0, function () {
var currentValidation, validationHasNotChanged, firstInvalid;
var childrenWrappersSortedByPosition, firstInvalid, invalid;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
currentValidation = this.childWrappers.map(function (x) { return x.props.validation; });
validationHasNotChanged = this.validationsArraysEqual(this.previousValidation, currentValidation);
return [4 /*yield*/, Promise.all(this.childWrappers.map(function (x) { return x.processSubmit(); }))];
case 0: return [4 /*yield*/, Promise.all(this.childWrappers.map(function (x) { return x.processSubmit(); }))];
case 1:
_a.sent();
firstInvalid = this.getChildWrappersSortedByPosition().find(function (x) {
var hasWarning = x.hasWarning();
var hasError = x.hasError();
if (validationHasNotChanged && hasWarning && !hasError) {
return false;
}
return hasError || hasWarning;
});
childrenWrappersSortedByPosition = this.getChildWrappersSortedByPosition();
firstInvalid = childrenWrappersSortedByPosition.find(function (x) { return x.hasError() || x.hasWarning(); });
invalid = childrenWrappersSortedByPosition.some(function (x) { return x.hasError(); });
if (firstInvalid) {

@@ -402,4 +354,3 @@ if (!withoutFocus) {

}
this.previousValidation = currentValidation;
return [2 /*return*/, !firstInvalid];
return [2 /*return*/, !invalid];
}

@@ -670,2 +621,38 @@ });

function getVisibleValidation(visible, actual, changing) {
var from = function (type) { return getType(visible) === type; };
var to = function (type) { return getType(actual) === type; };
if (to('immediate')) {
return actual;
}
if (changing) {
return from('immediate') ? null : visible;
}
if (from(null) && to('lostfocus')) {
return null;
}
if (to('lostfocus')) {
return actual;
}
if (from('submit') && to('submit')) {
return visible;
}
return null;
}
function getType(validation) {
return validation ? validation.behaviour : null;
}
function getLevel(validation) {
return validation ? validation.level : null;
}
function getIndependent(validation) {
return validation ? validation.independent : null;
}
function isEqual(a, b) {
if (a === b) {
return true;
}
return !!a && !!b && a.behaviour === b.behaviour && a.message === b.message && a.independent === b.independent;
}
if (isBrowser && typeof HTMLElement === 'undefined') {

@@ -672,0 +659,0 @@ var w = window;

{
"name": "react-ui-validations",
"version": "1.10.2",
"version": "1.10.3",
"description": "Validations for @skbkontur/react-ui",

@@ -5,0 +5,0 @@ "main": "./index.js",

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