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

formstate

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formstate - npm Package Compare versions

Comparing version 0.22.0 to 0.23.0

6

lib/core/fieldState.d.ts

@@ -55,11 +55,11 @@ import { ComposibleValidatable, Validator } from './types';

*/
protected _onWillChange: (config: {
protected _onDidChange: (config: {
newValue: TValue;
oldValue: TValue;
}) => any;
onWillChange: (handler: (config: {
onDidChange: (handler: (config: {
newValue: TValue;
oldValue: TValue;
}) => any) => this;
protected executeOnWillChange: (config: {
protected executeOnDidChange: (config: {
newValue: TValue;

@@ -66,0 +66,0 @@ oldValue: TValue;

@@ -74,8 +74,8 @@ "use strict";

};
this.onWillChange = function (handler) {
_this._onWillChange = handler;
this.onDidChange = function (handler) {
_this._onDidChange = handler;
return _this;
};
this.executeOnWillChange = function (config) {
_this._onWillChange && _this._onWillChange(config);
this.executeOnDidChange = function (config) {
_this._onDidChange && _this._onDidChange(config);
};

@@ -93,6 +93,8 @@ this.setAutoValidationDebouncedMs = function (milliseconds) {

_this.preventNextQueuedValidation = false;
// Call on will change if any
_this.executeOnWillChange({ newValue: value, oldValue: _this.value });
// Store local old value for onDidChange
var oldValue = _this.value;
// Immediately set for local ui binding
_this.value = value;
// Call on did change if any
_this.executeOnDidChange({ newValue: value, oldValue: oldValue });
_this.dirty = true;

@@ -264,6 +266,6 @@ _this.executeOnUpdate();

mobx_1.action
], FieldState.prototype, "onWillChange", void 0);
], FieldState.prototype, "onDidChange", void 0);
__decorate([
mobx_1.action
], FieldState.prototype, "executeOnWillChange", void 0);
], FieldState.prototype, "executeOnDidChange", void 0);
__decorate([

@@ -270,0 +272,0 @@ mobx_1.action

{
"name": "formstate",
"version": "0.22.0",
"version": "0.23.0",
"description": "Painless and simple MobX form management",

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

@@ -93,9 +93,9 @@ import { observable, action, computed, runInAction } from 'mobx';

*/
protected _onWillChange: (config: { newValue: TValue, oldValue: TValue }) => any;
@action public onWillChange = (handler: (config: { newValue: TValue, oldValue: TValue }) => any) => {
this._onWillChange = handler;
protected _onDidChange: (config: { newValue: TValue, oldValue: TValue }) => any;
@action public onDidChange = (handler: (config: { newValue: TValue, oldValue: TValue }) => any) => {
this._onDidChange = handler;
return this;
}
@action protected executeOnWillChange = (config: { newValue: TValue, oldValue: TValue }) => {
this._onWillChange && this._onWillChange(config);
@action protected executeOnDidChange = (config: { newValue: TValue, oldValue: TValue }) => {
this._onDidChange && this._onDidChange(config);
}

@@ -113,11 +113,15 @@

/** On change on the component side */
@action onChange = (value: TValue) => {
@action
onChange = (value: TValue) => {
// no long prevent any debounced validation request
this.preventNextQueuedValidation = false;
// Call on will change if any
this.executeOnWillChange({ newValue: value, oldValue: this.value });
// Store local old value for onDidChange
const oldValue = this.value;
// Immediately set for local ui binding
this.value = value;
// Call on did change if any
this.executeOnDidChange({ newValue: value, oldValue });
this.dirty = true;

@@ -124,0 +128,0 @@ this.executeOnUpdate();

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