<commit_before>import { Component } from '@angular/core';
import { NgRedux } from '@angular-redux/store';
import { isEnumControl, JsonFormsState, RankedTester, rankWith } from '@jsonforms/core';
import { JsonFormsControl } from '@jsonforms/angular';

@Component({
  selector: 'jsonforms-enum-control',
  template: `
      <ion-item>
          <ion-label>{{label}}</ion-label>
          <ion-label stacked *ngIf="error" color="errora">{{error}}</ion-label>
          <ion-select [ngModel]="data" (ionChange)="onChange($event)">
              <ion-option *ngFor="let option of options" value="{{option}}">
                  {{option}}
              </ion-option>
          </ion-select>
      </ion-item>
  `
})
export class EnumControlRenderer extends JsonFormsControl {

  options: any[];

  constructor(ngRedux: NgRedux<JsonFormsState>) {
    super(ngRedux);
  }

  mapAdditionalProps() {
    this.options = this.scopedSchema.enum;
  }
}

export const enumControlTester: RankedTester = rankWith(
  2,
  isEnumControl
);<commit_msg>[ionic] Fix getEventValue & fix color in enum control<commit_after>import { Component } from '@angular/core';
import { NgRedux } from '@angular-redux/store';
import { isEnumControl, JsonFormsState, RankedTester, rankWith } from '@jsonforms/core';
import { JsonFormsControl } from '@jsonforms/angular';

@Component({
  selector: 'jsonforms-enum-control',
  template: `
      <ion-item>
          <ion-label>{{label}}</ion-label>
          <ion-label stacked *ngIf="error" color="error">{{error}}</ion-label>
          <ion-select [ngModel]="data" (ionChange)="onChange($event)">
              <ion-option *ngFor="let option of options" value="{{option}}">
                  {{option}}
              </ion-option>
          </ion-select>
      </ion-item>
  `
})
export class EnumControlRenderer extends JsonFormsControl {

  options: any[];

  constructor(ngRedux: NgRedux<JsonFormsState>) {
    super(ngRedux);
  }

  mapAdditionalProps() {
    this.options = this.scopedSchema.enum;
  }

  getEventValue = (ev: any) => ev;
}

export const enumControlTester: RankedTester = rankWith(
  2,
  isEnumControl
);
{'fraction_non_alphanumeric': 0.15240766713417483, 'fraction_numerical': 0.0009350163627863488, 'mean_word_length': 3.3495934959349594, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, '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': '5037363', 'n_tokens_mistral': 676, 'n_tokens_neox': 654, 'n_words': 135}