Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/ui / dist / forms / views / ShippingAddress / Form / state.js
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

const tslib_1 = require("tslib");

const mobx_1 = require("xmobx/mobx");

const exotic_1 = require("exotic");

class ShippingAddressFormState {
  constructor() {
    this.shippingAddress = {};

    this.handleShippingAddressFormBlur = () => {
      const {
        validateForm,
        state,
        props
      } = this.shippingAddress;
      const {
        onFormBlur,
        hasBlurValidation
      } = props;

      if (hasBlurValidation === true) {
        const isValidForm = validateForm();

        if (isValidForm === true && exotic_1.isFunction(onFormBlur)) {
          console.log('[Shipping Address] onBlur serialized data', state.toSerialized());
          onFormBlur({
            props,
            state
          });
        }
      }
    };
  }

  setShippingAddressForm(form) {
    this.shippingAddress = form;
    console.log('[Shipping Address] setShippingAddressForm()', this);
  }

}

tslib_1.__decorate([mobx_1.observable], ShippingAddressFormState.prototype, "shippingAddress", void 0);

tslib_1.__decorate([mobx_1.action], ShippingAddressFormState.prototype, "setShippingAddressForm", null);

tslib_1.__decorate([mobx_1.action.bound], ShippingAddressFormState.prototype, "handleShippingAddressFormBlur", void 0); // Object Creation


const shippingAddressFormState = new ShippingAddressFormState();
exports.shippingAddressFormState = shippingAddressFormState;
exports.default = shippingAddressFormState; //# sourceMappingURL=state.js.map