class FormItem {
  constructor(elem) {
    this.elem = elem;
  }
  addRightElement(el) {
    this.removeRightElement();
    el.classList.add('ez-padding-left--small');
    el.setAttribute('data-custom-item', 'true');
    this.elem.classList.add('ez-col--nowrap');
    this.elem.appendChild(el);
  }
  removeRightElement() {
    Array.from(this.elem.querySelectorAll('[data-custom-item="true"]')).forEach(item => item.remove());
  }
  get fieldName() {
    return this.elem.getAttribute('data-form-item');
  }
}
export class FormItems {
  constructor(items, formId) {
    this.items = new Map();
    this.formId = formId;
    items.forEach(item => {
      const formItem = new FormItem(item);
      this.items.set(formItem.fieldName, formItem);
    });
  }
  getItem(name) {
    return this.items.get(name);
  }
  get formName() {
    return this.formId;
  }
}
