How to use the formiojs/utils.eachComponent function in formiojs

To help you get started, we’ve selected a few formiojs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github formio / ngFormio / src / components / datagrid.js View on Github external
angular.forEach(data, function(row) {
            view += '';
            formioUtils.eachComponent(component.components, function(component) {
              // Don't render disabled fields, or fields with undefined data.
              if (!component.tableView || row[component.key] === undefined) {
                return;
              }

              // If the component has a defined tableView, use that, otherwise try and use the raw data as a string.
              var info = componentInfo.components.hasOwnProperty(component.type) ? componentInfo.components[component.type] : {};
              if (info.tableView) {
                // Reset the tableChild value for datagrids, so that components have headers.
                view += '' + info.tableView(row[component.key] || '', component, $interpolate, componentInfo, false) + '';
              }
              else {
                view += '';
                if (component.prefix) {
                  view += component.prefix;
                }
github formio / react-formio / src / components / FormComponents / editgrid.js View on Github external
componentWillReceiveProps = (nextProps) => {
    const { components } = this.props;
    // If one of the fields is set to refresh on a value outside the datagrid, check it as well.
    this.refresh = false;
    FormioUtils.eachComponent(components, (component) => {
      if ('refreshOn' in component && component.refreshOn) {
        const { refreshOn } = component;
        if (refreshOn === 'data') {
          this.refresh = true;
        }
        if ((!this.data.hasOwnProperty(refreshOn) && nextProps.hasOwnProperty(refreshOn)) || this.data[refreshOn] !== nextProps.data[refreshOn]) {
          this.refresh = true;
        }
      }
    });
    this.data = Object.assign({}, nextProps.data);
  };
github formio / react-formio / src / components / SubmissionGrid.js View on Github external
getColumns = () => {
    let columns = [];
    FormioUtils.eachComponent(this.props.form.components, function(component) {
      if (component.input && component.tableView && component.key) {
        columns.push({
          key: 'data.' + component.key,
          title: component.label || component.title || component.key,
          sort: true,
          component: Components.create(component, null, null, true)
        });
      }
    });
    return columns.slice(0, columns.length - 1);
  };
github formio / angular-formio / src / modules / grid / grid.component.ts View on Github external
setupColumns() {
        FormioUtils.eachComponent(this.form.components, (component:any) => {
            if (component.input && component.tableView) {
                this.columns.push({
                    label: component.label,
                    key: 'data.' + component.key,
                    sort: '',
                    component: Components.create(component, null, null, true)
                });
            }
        });
    }
github formio / react-formio / src / components / SubmissionGrid.js View on Github external
getColumns = () => {
    let columns = [];
    FormioUtils.eachComponent(this.props.form.components, function(component) {
      if (component.input && component.tableView && component.key) {
        columns.push({
          key: 'data.' + component.key,
          title: component.label || component.title || component.key,
          sort: true,
          component: Components.create(component, null, null, true)
        });
      }
    });

    columns.push({
      key: 'operations',
      title: 'Operations',
      sort: false
    });
github formio / angular-formio / src / users / index / index.component.ts View on Github external
this.service.loadForm().then(form => {
      this.inviteForm = form;
      FormioUtils.eachComponent(this.inviteForm.components, (component) => {
        if (component.type === 'password' || component.key === 'invited' || component.key === 'onBoarded') {
          component.hidden = true;
        }
      });
      this.inviteSubmission.data.invited = true;
      this.inviteSubmission.data.appUrl = window.location.origin;
      this.inviteSubmission.data.projectUrl = encodeURIComponent(this.service.formio.projectUrl);
    });
    this.modalService.open(content, { size: 'lg' });
github formio / angular-formio / dist / modules / grid / grid.component.js View on Github external
FormioGridComponent.prototype.setupColumns = function () {
        var _this = this;
        FormioUtils.eachComponent(this.form.components, function (component) {
            if (component.input && component.tableView) {
                _this.columns.push({
                    label: component.label,
                    key: 'data.' + component.key,
                    sort: '',
                    component: component
                });
            }
        });
    };
    Object.defineProperty(FormioGridComponent.prototype, "loading", {