fieldOptions = function (fieldName, fieldData) {
    const { type } = fieldData
    let fieldValues
    const optionActions = [m('a', mi18n.get('addOption'), { className: 'add add-opt' })]
    const fieldLabel = fieldName === 'values' ? mi18n.get('selectOptions') : i18n[fieldName]
    const fieldOptions = [m('label', fieldLabel, { className: 'false-label' })]
    const optionsNoSelect = fieldData['noSelect'] ?? false
    const isMultiple = fieldData.multiple || type === 'checkbox-group'
    const optionDataTemplate = count => {
      const label = mi18n.get('optionCount', count)
      return {
        selected: false,
        label,
        value: hyphenCase(label),
      }
    }

    /**
     * For build-in options attributes the options are stored in the "values" key
     * For custom options the options will be in the attribute named key when in saved formData or in the values key when coming from field definition
     */
    const values = fieldName === 'options' ? fieldData['values'] : (fieldData[fieldName] || fieldData['values'])
    if (!values || !values.length) {
      let defaultOptCount = [1, 2, 3]
      if (['checkbox-group', 'checkbox'].includes(type)) {
        defaultOptCount = [1]
      }
      fieldValues = defaultOptCount.map(optionDataTemplate)

      const firstOption = fieldValues[0]
      if (firstOption.hasOwnProperty('selected') && type !== 'radio-group') {
        firstOption.selected = true
      }
    } else {
      // ensure option data contains all required keys
      fieldValues = values.map(option => Object.assign({}, { selected: false }, option))
    }
    const optionActionsWrap = m('div', optionActions, { className: 'option-actions' })

    const optionGroupName = nameAttr({type: 'grp-options'}) + '-options'
    const options = m(
      'ol',
      fieldValues.map((option, index) => {
        const optionData = config.opts.onAddOption(option, { type, index, isMultiple, fieldName })
        if (optionsNoSelect) {
          optionData.selected = false
        }
        return selectFieldOptions(optionGroupName, optionData, isMultiple)
      }),
      {
        className: 'sortable-options' + (optionsNoSelect ? ' options-no-select' : ''),
      },
    )
    const optionsWrap = m('div', [options, optionActionsWrap], { className: 'sortable-options-wrap' })

    fieldOptions.push(optionsWrap)

    return m('div', fieldOptions, { name: fieldName, className: 'form-group field-options' }).outerHTML
  }
Add data for field with options [select, checkbox-group, radio-group]

@param {string} fieldName
@param  {Object} fieldData
@return {string} field options markup