<commit_before>import * as ko from "knockout";
import { QuestionImagePickerModel } from "../question_imagepicker";
import { Serializer } from "../jsonobject";
import { QuestionFactory } from "../questionfactory";
import { QuestionCheckboxBaseImplementor } from "./koquestion_baseselect";

export class QuestionImagePicker extends QuestionImagePickerModel {
  constructor(public name: string) {
    super(name);
    new QuestionCheckboxBaseImplementor(this);
  }
  getItemClass(item: any) {
    var itemClass =
      this.cssClasses.item +
      (this.colCount === 0
        ? " " + this.cssClasses.itemInline
        : " sv-q-col-" + this.colCount);
    this.renderedValue = this.value;
    var isChecked = this.isItemSelected(item);
    var isDisabled = this.isReadOnly || !item.isEnabled; 
    var allowHover = !isChecked && !isDisabled;
    if (isChecked) {
      itemClass += " " + this.cssClasses.itemChecked;
    }
    if (isDisabled) {
      itemClass += " " + this.cssClasses.itemDisabled;
    }
    if (allowHover) {
      itemClass += " " + this.cssClasses.itemHover;
    }
    return itemClass;
  }
}

Serializer.overrideClassCreator("imagepicker", function() {
  return new QuestionImagePicker("");
});

QuestionFactory.Instance.registerQuestion("imagepicker", name => {
  var q = new QuestionImagePicker(name);
  //q.choices = QuestionFactory.DefaultChoices;
  return q;
});
<commit_msg>Fixed https://surveyjs.answerdesk.io/ticket/details/T3061 - ability to select item with the 0 value<commit_after>import * as ko from "knockout";
import { QuestionImagePickerModel } from "../question_imagepicker";
import { Serializer } from "../jsonobject";
import { QuestionFactory } from "../questionfactory";
import { QuestionCheckboxBaseImplementor } from "./koquestion_baseselect";

export class QuestionImagePicker extends QuestionImagePickerModel {
  constructor(public name: string) {
    super(name);
    new QuestionCheckboxBaseImplementor(this);
  }
  getItemClass(item: any) {
    var itemClass =
      this.cssClasses.item +
      (this.colCount === 0
        ? " " + this.cssClasses.itemInline
        : " sv-q-col-" + this.colCount);
    if(this.multiSelect) {
      this.renderedValue = this.value;
    }
    var isChecked = this.isItemSelected(item);
    var isDisabled = this.isReadOnly || !item.isEnabled; 
    var allowHover = !isChecked && !isDisabled;
    if (isChecked) {
      itemClass += " " + this.cssClasses.itemChecked;
    }
    if (isDisabled) {
      itemClass += " " + this.cssClasses.itemDisabled;
    }
    if (allowHover) {
      itemClass += " " + this.cssClasses.itemHover;
    }
    return itemClass;
  }
}

Serializer.overrideClassCreator("imagepicker", function() {
  return new QuestionImagePicker("");
});

QuestionFactory.Instance.registerQuestion("imagepicker", name => {
  var q = new QuestionImagePicker(name);
  //q.choices = QuestionFactory.DefaultChoices;
  return q;
});

{'fraction_non_alphanumeric': 0.12735364601163984, 'fraction_numerical': 0.002396439575487847, 'mean_word_length': 3.6161137440758293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '5310348', 'n_tokens_mistral': 874, 'n_tokens_neox': 867, 'n_words': 178}