-
Notifications
You must be signed in to change notification settings - Fork 776
/
koquestion_ranking.ts
43 lines (41 loc) · 1.32 KB
/
koquestion_ranking.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {
Serializer,
QuestionFactory,
QuestionRankingModel,
ItemValue,
} from "survey-core";
import { QuestionImplementor } from "./koquestion";
export class QuestionRanking extends QuestionRankingModel {
private _implementor: QuestionImplementor;
protected onBaseCreating() {
super.onBaseCreating();
this._implementor = new QuestionImplementor(this);
}
public dispose(): void {
this._implementor.dispose();
this._implementor = undefined;
super.dispose();
}
public koHandleKeydown = (data: ItemValue, event: KeyboardEvent) => {
this.handleKeydown(event, data);
return true;
};
public koHandlePointerDown = (data: ItemValue, event: PointerEvent) => {
if(!this.survey.isDesignMode) event.preventDefault();
this.handlePointerDown(event, data, <HTMLElement>event.currentTarget);
return true;
};
public koHandlePointerUp = (data: ItemValue, event: PointerEvent) => {
if(!this.survey.isDesignMode) event.preventDefault();
this.handlePointerUp(event, data, <HTMLElement>event.currentTarget);
return true;
};
}
Serializer.overrideClassCreator("ranking", function() {
return new QuestionRanking("");
});
QuestionFactory.Instance.registerQuestion("ranking", (name) => {
const q = new QuestionRanking(name);
q.choices = QuestionFactory.DefaultChoices;
return q;
});