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/forms / build / dist / new-forms / OneForm / OneFormState.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const forms_1 = require("../forms");
// @todo maybe put in forms?s
const toFormState_1 = require("./toFormState");
/**
 * @todo how do we adapt the form state here...
 */
class OneFormState {
    constructor() {
        this.store = new Map();
    }
    // @todo and typings for compat, with depreciations and warnings
    setInputsList(inputsList) {
        // trigger getter, though this should be an action if it was not compat
        this.inputsList = inputsList;
        return this;
    }
    /**
     * @todo need to solve different types here
     * https://github.com/Microsoft/TypeScript/issues/2521
     */
    set inputsList(inputsList) {
        const formState = toFormState_1.toFormState(inputsList);
        this.store.set('inputsConfigList', inputsList);
        this.store.set('inputsList', formState.inputsList);
        this.store.set('formState', formState);
    }
    /**
     * note that this MUST have same return type as setter
     * but we always return inputState so we use `as`
     */
    get inputsList() {
        return this.store.get('inputsList');
    }
    get formState() {
        return this.store.get('formState');
    }
}
exports.OneFormState = OneFormState;
OneFormState.prototype.get = forms_1.FormState.prototype.get;
OneFormState.prototype.toJSON = forms_1.FormState.prototype.toJSON;
//# sourceMappingURL=OneFormState.js.map