VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-poser__dom__evaluation__PRQuestion.js
/*** module: node_modules/absol-poser/dom/evaluation/PRQuestion.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _Core = _interopRequireWildcard(require("../Core"));

var _PVQuestion = _interopRequireDefault(require("../viewer/question/PVQuestion"));

var _PVShortAnswer = _interopRequireDefault(require("../viewer/question/PVShortAnswer"));

var _PVLinearScaleAnswer = _interopRequireDefault(require("../viewer/question/PVLinearScaleAnswer"));

var _PVMultipleChoiceAnswer = _interopRequireDefault(require("../viewer/question/PVMultipleChoiceAnswer"));

var _PVCheckboxesAnswer = _interopRequireDefault(require("../viewer/question/PVCheckboxesAnswer"));

var _PreInput = _interopRequireDefault(require("absol-acomp/js/PreInput"));

var _PRParagraphAnswer = _interopRequireDefault(require("./PRParagraphAnswer"));

var _utils = require("absol-acomp/js/utils");

var _int = require("absol/src/Math/int");




/***
 * @extends PVQuestion
 * @constructor
 */
function PRQuestion() {
  _PVQuestion.default.call(this);

  this.$designedScore = (0, _Core.$)('.ap-question-designed-score numberinput', this);
  this.$evaluatedScore = (0, _Core.$)('.ap-question-evaluated-score numberinput', this).on('change', this.eventHandler.evaluatedChange);
  this.$note = (0, _Core.$)('.ap-question-note-ctn pre', this);
  this.$feedback = (0, _Core.$)('.ap-question-feedback-ctn preinput', this).on('focus', this.eventHandler.noteFocus).on('blur', this.eventHandler.noteBlur);
  this.designedScore = null;
  this.evaluatedScore = null;
  this.evaluationIdent = 0;
}

PRQuestion.tag = 'PRQuestion'.toLowerCase();

PRQuestion.render = function () {
  return (0, _Core._)({
    extendEvent: ['evaluationchange'],
    class: ['ap-block', 'ap-question', 'ap-evaluation'],
    child: [{
      class: 'ap-question-header',
      child: [{
        child: {
          class: 'ap-question-idx',
          child: {
            tag: 'span',
            child: {
              text: '1'
            }
          }
        }
      }, {
        class: 'ap-question-content-ctn',
        child: [{
          tag: 'span',
          child: {
            text: ''
          }
        }]
      }]
    }, {
      class: 'ap-question-description',
      child: {
        tag: 'span',
        child: {
          text: ''
        }
      }
    }, {
      class: 'ap-question-image-ctn'
    }, {
      class: 'ap-question-body'
    }, {
      class: 'ap-question-score-ctn',
      child: [{
        class: 'ap-question-designed-score',
        child: [{
          class: 'ap-field-name',
          child: {
            tag: 'span',
            child: {
              text: 'Điểm thiết kế'
            }
          }
        }, {
          tag: 'numberinput',
          class: 'ap-input',
          props: {
            readonly: true,
            disabled: true,
            valueFixed: 2,
            notNull: false
          }
        }]
      }, {
        class: 'ap-question-evaluated-score',
        child: [{
          class: 'ap-field-name',
          child: {
            tag: 'span',
            child: {
              text: 'Điểm đánh giá'
            }
          }
        }, {
          tag: 'numberinput',
          class: 'ap-input',
          props: {
            valueFixed: 2,
            notNull: false
          }
        }]
      }]
    }, {
      class: 'ap-question-note-ctn',
      child: [{
        class: 'ap-field-name',
        child: {
          tag: 'span',
          child: {
            text: 'Ghi chú'
          }
        }
      }, {
        tag: 'pre',
        class: 'ap-input',
        child: {
          text: ''
        }
      }]
    }, {
      class: 'ap-question-feedback-ctn',
      child: [{
        class: 'ap-field-name',
        child: {
          tag: 'span',
          child: {
            text: 'Nhận xét'
          }
        }
      }, {
        tag: _PreInput.default.tag,
        class: 'ap-input'
      }]
    }]
  });
};

PRQuestion.prototype.dataHandlers = Object.assign({}, _PVQuestion.default.prototype.dataHandlers);
PRQuestion.property = Object.assign({}, _PVQuestion.default.property);
PRQuestion.property.evaluatedScore = {
  set: function (value) {
    if (!(0, _utils.isRealNumber)(value)) value = null;
    this.$evaluatedScore.value = value;
  },
  get: function () {
    var score = this.$evaluatedScore.value;
    if (!(0, _utils.isRealNumber)(score)) score = null;
    return score;
  }
};
PRQuestion.property.designedScore = {
  set: function (value) {
    if (!(0, _utils.isRealNumber)(value)) value = null;
    this.$designedScore.value = value;
  },
  get: function () {
    var score = this.$designedScore.value;
    if (!(0, _utils.isRealNumber)(score)) score = null;
    return score;
  }
};
PRQuestion.property.note = {
  set: function (value) {
    value = typeof value === 'string' ? value : (value || '') + '';

    if (value) {
      this.addClass('ap-has-note');
    } else {
      this.removeClass('ap-has-note');
    }

    this.$note.firstChild.data = value;
  },
  get: function () {
    this.$note.firstChild.data;
  }
};
PRQuestion.property.feedback = {
  set: function (value) {
    value = typeof value === 'string' ? value : (value || '') + '';

    if (value) {
      this.addClass('ap-has-feedback');
    } else {
      this.removeClass('ap-has-feedback');
    }

    this.$feedback.value = value;
  },
  get: function () {
    return this.$feedback.value;
  }
};
PRQuestion.property.evaluationIdent = {
  set: function (value) {
    if (!(0, _utils.isRealNumber)(value)) value = 0;
    this.attr('data-evaluation-ident', value + '');
  },
  get: function () {
    var ident = parseInt(this.attr('data-evaluation-ident'));
    if ((0, _utils.isRealNumber)(ident)) return ident;
    return 0;
  }
};
PRQuestion.property.readOnly = {
  set: function (value) {
    if (value) {
      this.addClass('ap-read-only');
    } else {
      this.removeClass('ap-read-only');
    }

    this.$feedback.readOnly = !!value;
  },
  get: function () {
    return this.hasClass('ap-read-only');
  }
};
PRQuestion.prototype.dataHandlers.type = {
  set: function (value) {
    this.attr('data-type', value);
    var tag = this.type2tag[value];
    this.$body.clearChild();

    if (tag) {
      this.$answer = (0, _Core._)({
        tag: tag,
        props: {
          readOnly: true
        }
      });
    } else {
      this.$answer = (0, _Core._)('pre');
    }

    this.$body.addChild(this.$answer);
    return value;
  }
};

PRQuestion.prototype.init = function (props) {
  var cProps = Object.assign({}, props);
  var result = cProps.result;
  delete cProps.result;
  Object.assign(this, cProps);

  if ('result' in props) {
    this.result = result;
  }
};

PRQuestion.prototype.type2tag = {
  short_answer: _PVShortAnswer.default.tag,
  paragraph: _PRParagraphAnswer.default.tag,
  linear_scale: _PVLinearScaleAnswer.default.tag,
  multiple_choice: _PVMultipleChoiceAnswer.default.tag,
  checkboxes: _PVCheckboxesAnswer.default.tag
};
PRQuestion.eventHandler = {};

PRQuestion.eventHandler.evaluatedChange = function (event) {
  this.emit('evaluationchange', {
    type: 'evaluationchange',
    originalEvent: event,
    target: this,
    property: 'evaluatedScore'
  });
};

PRQuestion.eventHandler.noteFocus = function () {
  this._preFeedbackValue = this.$feedback.value;
};

PRQuestion.eventHandler.noteBlur = function (event) {
  var currentValue = this.$feedback.value;

  if (this._preFeedbackValue !== currentValue) {
    this.emit('evaluationchange', {
      type: 'evaluationchange',
      originalEvent: event,
      property: 'note',
      target: this
    }, this);
  }
};

_Core.default.install(PRQuestion);

var _default = PRQuestion;
exports.default = _default;

VaKeR 2022