<commit_before>// jscs:ignore
/* globals tia tiaEJ */
(function () {
  'use strict';

  window.tiaEJ.hEByObj = {

    // Note that for tree only expanded nodes are taking into account.
    getTableItemByIndex: function (table, index) {
      if (table.isPanel) {
        table = table.getView();
      }
      var el = table.getRow(index);
      return el;
    },

    indexOfField: function (comp, fieldValue, fieldName) {
      if (comp.isPanel) {
        comp = comp.getView();
      }
      fieldName = fieldName ? fieldName : 'name';
      var store = comp.getStore();
      var index = store.findExact(fieldName, fieldValue);
      if (index === -1) {
        return null;
      }
      return index;
    },

    getTableItemByField: function (table, fieldValue, fieldName) {
      var index = this.indexOfField(table, fieldValue, fieldName);
      if (!index) {
        return null;
      }
      return this.getTableItemByIndex(table, index);
    },

    getTableItemByFieldLocKey: function (table, fieldValueKey, fieldName) {
      var index = this.indexOfField(table, tiaEJ.locale[fieldValueKey], fieldName);
      if (!index) {
        return null;
      }
      return this.getTableItemByIndex(table, index);
    },

    getInputEl: function (field) {
      return field.inputEl.dom;
    },

    getInputElByFormName: function (form, name) {
      var field = tiaEJ.search.byFormAndName(form, name);
      return field.inputEl.dom;
    },

    getElByFormName: function (form, name) {
      var field = tiaEJ.search.byFormAndName(form, name);
      return field.getEl().dom;
    },

    getNameAndLabels: function (field) {
      return {name: field.getName(), label: field.getFieldLabel()};
    },

    getInputId: function (field) {
      return field.getInputId();
    },

    isFirstPickerItemVisible: function(picker) {
      if (picker.isXType('tablepanel')) {
        picker = picker.getView();
      }
      var res = Boolean(picker.getNode(0));
      return res;
    },

    isCBPickerVisible: function (cb) {
      var boundList = cb.getPicker();
      return boundList.isVisible(true) && cb.isExpanded && !cb.isDisabled()
        && this.isFirstPickerItemVisible(boundList);
    },

    isCBPickerVisibleByFormName: function (form, name) {
      var cb = tiaEJ.search.byFormAndName(form, name);
      var boundList = cb.getPicker();
      return boundList.isVisible(true) && cb.isExpanded && !cb.isDisabled()
        && this.isFirstPickerItemVisible(boundList);
    },

    getCBItemByIndex: function (cb, index) {
      var boundList = cb.getPicker();
      if (boundList.isXType('tablepanel')) {
        boundList = boundList.getView();
      }
      window.c3 = boundList;
      var res = boundList.getNode(index);
      if (!res) {
        throw new Error('getCBItemByIndex: can not find node with index: ' + index);
      }
      return res;
    },

    getCBItemByField: function (cb, fieldValue, fieldName) {
      var index = this.indexOfField(cb, fieldValue, fieldName);<commit_msg>Improved combobox picker nth item waitings.<commit_after>// jscs:ignore
/* globals tia tiaEJ */
(function () {
  'use strict';

  window.tiaEJ.hEByObj = {

    // Note that for tree only expanded nodes are taking into account.
    getTableItemByIndex: function (table, index) {
      if (table.isPanel) {
        table = table.getView();
      }
      var el = table.getRow(index);
      return el;
    },

    indexOfField: function (comp, fieldValue, fieldName) {
      if (comp.isPanel) {
        comp = comp.getView();
      }
      fieldName = fieldName ? fieldName : 'name';
      var store = comp.getStore();
      var index = store.findExact(fieldName, fieldValue);
      if (index === -1) {
        return null;
      }
      return index;
    },

    getTableItemByField: function (table, fieldValue, fieldName) {
      var index = this.indexOfField(table, fieldValue, fieldName);
      if (!index) {
        return null;
      }
      return this.getTableItemByIndex(table, index);
    },

    getTableItemByFieldLocKey: function (table, fieldValueKey, fieldName) {
      var index = this.indexOfField(table, tiaEJ.locale[fieldValueKey], fieldName);
      if (!index) {
        return null;
      }
      return this.getTableItemByIndex(table, index);
    },

    getInputEl: function (field) {
      return field.inputEl.dom;
    },

    getInputElByFormName: function (form, name) {
      var field = tiaEJ.search.byFormAndName(form, name);
      return field.inputEl.dom;
    },

    getElByFormName: function (form, name) {
      var field = tiaEJ.search.byFormAndName(form, name);
      return field.getEl().dom;
    },

    getNameAndLabels: function (field) {
      return {name: field.getName(), label: field.getFieldLabel()};
    },

    getInputId: function (field) {
      return field.getInputId();
    },

    isNthPickerItemVisible: function(picker, n) {
      if (picker.isXType('tablepanel')) {
        picker = picker.getView();
      }
      var res = Boolean(picker.getNode(n));
      return res;
    },

    isFirstPickerItemVisible: function(picker) {
      return this.isNthPickerItemVisible(picker, 0);
    },

    isCBPickerVisible: function (cb) {
      var boundList = cb.getPicker();
      return boundList.isVisible(true) && cb.isExpanded && !cb.isDisabled()
        && this.isFirstPickerItemVisible(boundList);
    },

    isCBPickerVisibleByFormName: function (form, name) {
      var cb = tiaEJ.search.byFormAndName(form, name);
      var boundList = cb.getPicker();
      return boundList.isVisible(true) && cb.isExpanded && !cb.isDisabled()
        && this.isFirstPickerItemVisible(boundList);
    },

    getCBItemByIndex: function (cb, index) {
      var boundList = cb.getPicker();
      if (boundList.isXType('tablepanel')) {
        boundList = boundList.getView();
      }
      window.c3 = boundList;
      var res = boundList.getNode(index);
      if (!res) {
        throw new Error('getCBItemByIndex: can not find node with index: ' + index);
      }
      return res;
    },

    getCBItemByField: function (cb, fieldValue, fieldName) {
      var index = this.indexOfField(cb, fieldValue, fieldName);
{'fraction_non_alphanumeric': 0.123682930782947, 'fraction_numerical': 0.0009726049602852974, 'mean_word_length': 2.6617210682492582, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3214587', 'n_tokens_mistral': 1946, 'n_tokens_neox': 1909, 'n_words': 430}