<commit_before>let React = require("react")
let frigInput = require("./input.js")
let propsClosure = require("../higher_order_components/props_closure.js")
let NestedFeildset = require("./nested_fieldset")
let ErrorsNormalizer = require("../higher_order_components/errors_normalizer.js")

/*
 * A JSX-compatible React DOM Component.
 * FrigForm should be used as the top level component for Frig forms in JSX.
 * In coffeescript FrigForm is called by FrigDSL.
 */
@ErrorsNormalizer({as: Object})
export default class FrigForm extends React.Component {
  static propTypes = {
    data: React.PropTypes.object.isRequired,
    errors: React.PropTypes.object.isRequired,
    saved: React.PropTypes.object.isRequired,
    form: React.PropTypes.func.isRequired,
    theme: React.PropTypes.object.isRequired,
    typeMapping: React.PropTypes.objectOf(React.PropTypes.string),
    layout: React.PropTypes.string.isRequired,
    align: React.PropTypes.string.isRequired,
    // Callbacks
    onSubmit: React.PropTypes.func,
  }

  static defaultProps = {
    errors: [],
    saved: {},
    theme: undefined,
    typeMapping: {},
    layout: "vertical",
    align: "left",
    onSubmit() {},
  }

  _childComponentsByName = []

  /*
   * =========================================================================
   * Public Functions
   * =========================================================================
   */

  validate() {
    return this._childComponents().filter((c) => !c.validate()).length === 0
  }

  isValid() {
    return this._childComponents().filter((c) => !c.isValid()).length === 0
  }

  isModified() {
    return this._childComponents().filter((c) => c.isModified()).length !== 0
  }

  modifiedValues() {
    let values = {}
    this._childComponents()
      .filter((c) => c.isModified())
      .forEach((c) => values[c.props.name] = (c.modifiedValue || c.modifiedValues)())
    return values
  }

  resetModified() {
    for (let c of this._childComponents()) c.resetModified()
  }

  reset() {
    for (let c of this._childComponents()) c.reset()
  }<commit_msg>Add Bind For Each Modified Component To Get Value<commit_after>let React = require("react")
let frigInput = require("./input.js")
let propsClosure = require("../higher_order_components/props_closure.js")
let NestedFeildset = require("./nested_fieldset")
let ErrorsNormalizer = require("../higher_order_components/errors_normalizer.js")

/*
 * A JSX-compatible React DOM Component.
 * FrigForm should be used as the top level component for Frig forms in JSX.
 * In coffeescript FrigForm is called by FrigDSL.
 */
@ErrorsNormalizer({as: Object})
export default class FrigForm extends React.Component {
  static propTypes = {
    data: React.PropTypes.object.isRequired,
    errors: React.PropTypes.object.isRequired,
    saved: React.PropTypes.object.isRequired,
    form: React.PropTypes.func.isRequired,
    theme: React.PropTypes.object.isRequired,
    typeMapping: React.PropTypes.objectOf(React.PropTypes.string),
    layout: React.PropTypes.string.isRequired,
    align: React.PropTypes.string.isRequired,
    // Callbacks
    onSubmit: React.PropTypes.func,
  }

  static defaultProps = {
    errors: [],
    saved: {},
    theme: undefined,
    typeMapping: {},
    layout: "vertical",
    align: "left",
    onSubmit() {},
  }

  _childComponentsByName = []

  /*
   * =========================================================================
   * Public Functions
   * =========================================================================
   */

  validate() {
    return this._childComponents().filter((c) => !c.validate()).length === 0
  }

  isValid() {
    return this._childComponents().filter((c) => !c.isValid()).length === 0
  }

  isModified() {
    return this._childComponents().filter((c) => c.isModified()).length !== 0
  }

  modifiedValues() {
    let values = {}
    this._childComponents()
      .filter((c) => c.isModified())
      .forEach((c) =>
        values[c.props.name] = (c.modifiedValue || c.modifiedValues).bind(c)())
    return values
  }

  resetModified() {
    for (let c of this._childComponents()) c.resetModified()
  }

  reset() {
    for (let c of this._childComponents()) c.reset()
  }
{'fraction_non_alphanumeric': 0.20412517780938833, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 3.794318181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6868805', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1214, 'n_words': 260}