-
Notifications
You must be signed in to change notification settings - Fork 853
/
Copy pathsurvey-events-api.ts
1150 lines (1132 loc) · 38.6 KB
/
survey-events-api.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { IAction } from "./actions/action";
import { Base } from "./base";
import { IDropdownMenuOptions, IElement, IPanel, ISurveyElement, IValueItemCustomPropValues } from "./base-interfaces";
import { ItemValue } from "./itemvalue";
import { PageModel } from "./page";
import { PanelModel, PanelModelBase } from "./panel";
import { PopupModel } from "./popup";
import { Question } from "./question";
import { QuestionFileModel, QuestionFileModelBase } from "./question_file";
import { MatrixDropdownCell, MatrixDropdownRowModelBase, QuestionMatrixDropdownModelBase } from "./question_matrixdropdownbase";
import { MatrixDropdownColumn } from "./question_matrixdropdowncolumn";
import { QuestionMatrixDynamicModel } from "./question_matrixdynamic";
import { QuestionPanelDynamicModel } from "./question_paneldynamic";
import { QuestionSignaturePadModel } from "./question_signaturepad";
import { SurveyModel } from "./survey";
import { SurveyError } from "./survey-error";
import { Trigger } from "./trigger";
export interface QuestionEventMixin {
/**
* A Question instance for which the event is raised.
*/
question: Question;
}
export interface FileQuestionEventMixin {
/**
* A File Upload or Signature Pad question instance for which the event is raised.
*/
question: QuestionFileModel | QuestionSignaturePadModel;
}
export interface PanelDynamicQuestionEventMixin {
/**
* A Dynamic Panel question instance for which the event is raised.
*/
question: QuestionPanelDynamicModel;
}
export interface MatrixDropdownQuestionEventMixin {
/**
* A Multi-Select Matrix question instance for which the event is raised.
*/
question: QuestionMatrixDropdownModelBase;
}
export interface MatrixDynamicQuestionEventMixin {
/**
* A Dynamic Matrix question instance for which the event is raised.
*/
question: QuestionMatrixDynamicModel;
}
export interface PanelEventMixin {
/**
* A Panel instance for which the event is raised.
*/
panel: PanelModel;
}
export interface PageEventMixin {
/**
* A Page instance for which the event is raised.
*/
page: PageModel;
}
export interface GetTitleActionsEventMixin {
/**
* An array of [actions](https://surveyjs.io/form-library/documentation/iaction) associated with the processed element.
*/
actions: Array<IAction>;
/**
* @deprecated Use `options.actions` instead.
*/
titleActions?: Array<IAction>;
}
export interface GetActionsEventMixin {
/**
* An array of [actions](https://surveyjs.io/form-library/documentation/iaction). You can modify the entire array or individual actions within it.
*/
actions: Array<IAction>;
}
export interface AfterRenderElementEventMixin {
/**
* A rendered HTML element.
*/
htmlElement: HTMLElement;
}
export interface UpdateElementCssClassesEventMixin {
/**
* An object with CSS classes applied to the element being rendered, for example, `{ root: "class1", button: "class2" }`. You can modify this object to apply custom CSS classes.
*/
cssClasses: any;
}
export interface ElementVisibleChangedEventMixin {
/**
* Indicates whether the element is visible now.
*/
visible: boolean;
}
export interface TriggerExecutedEvent {
/**
* A trigger that has been executed.
*/
trigger: Trigger;
}
export interface CompleteBaseEvent {
/**
* Returns `true` if survey completion is caused by a ["complete" trigger](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#complete).
*/
isCompleteOnTrigger: boolean;
/**
* A "complete" trigger that has been executed. This parameter has a value only if `options.isCompleteOnTrigger` is `true`.
*/
completeTrigger?: Trigger;
}
export interface CompletingEvent extends CompleteBaseEvent {
/**
* A Boolean property that you can set to `false` if you want to prevent survey completion.
*/
allow: boolean;
/**
* @deprecated Use `options.allow` instead.
*/
allowComplete: boolean;
}
export interface CompleteEvent extends CompleteBaseEvent {
/**
* Call this method to hide the save operation messages.
*/
clearSaveMessages: (test?: string) => void;
/**
* Call this method to indicate that survey results are successfully saved. You can use the `text` parameter to display a custom message.
*/
showSaveSuccess: (text?: string) => void;
/**
* Call this method to indicate that an error occurred during the save operation. You can use the `text` parameter to display a custom error message.
*/
showSaveError: (text?: string) => void;
/**
* Call this method to indicate that the save operation is in progress. You can use the `text` parameter to display a custom message.
*/
showSaveInProgress: (text?: string) => void;
/**
* @deprecated Use `options.showSaveInProgress` instead.
*/
showDataSaving: (text?: string) => void;
/**
* @deprecated Use `options.showSaveError` instead.
*/
showDataSavingError: (text?: string) => void;
/**
* @deprecated Use `options.showSaveSuccess` instead.
*/
showDataSavingSuccess: (text?: string) => void;
/**
* @deprecated Use `options.clearSaveMessages` instead.
*/
showDataSavingClear: (text?: string) => void;
}
export interface ShowingPreviewEvent {
/**
* A Boolean property that you can set to `false` if you want to cancel the preview.
*/
allow: boolean;
/**
* @deprecated Use `options.allow` instead.
*/
allowShowPreview: boolean;
}
export interface NavigateToUrlEvent {
/**
* A Boolean property that you can set to `false` if you want to cancel the navigation and show the [complete page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#complete-page).
*/
allow: boolean;
/**
* A URL to which respondents should be navigated. You can modify this parameter's value.
*/
url: string;
}
export interface CurrentPageChangedEvent {
/**
* Returns `true` if the respondent is switching to the previous page.
*/
isPrevPage: boolean;
/**
* Returns `true` if the respondent is switching to the next page.
*/
isNextPage: boolean;
/**
* Returns `true` if the respondent is going backward, that is, `newCurrentPage` or `newCurrentQuestion` is earlier in the survey than `oldCurrentPage` or `oldCurrentQuestion`.
*/
isGoingBackward: boolean;
/**
* Returns `true` if the respondent is going forward along the survey.
*/
isGoingForward: boolean;
/**
* Returns `true` if the respondent is switching from the [preview page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#preview-page).
*/
isAfterPreview: boolean;
/**
* The current page.
*/
newCurrentPage: PageModel;
/**
* A page that used to be current.\
* In [question-per-page mode](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode), the `oldCurrentPage` and `newCurrentPage` parameters may contain the same `PageModel` instance. This is because the survey doesn't create artificial pages to display only one question per page. If both the previous and current questions belong to the same page in the survey JSON schema, they have the same parent `PageModel` instance.
*/
oldCurrentPage: PageModel;
/**
* The current question.\
* This parameter has a value only in [question-per-page mode](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode).
*/
oldCurrentQuestion?: Question;
/**
* A question that used to be current.\
* This parameter has a value only in [question-per-page mode](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode).
*/
newCurrentQuestion?: Question;
}
export interface CurrentPageChangingEvent extends CurrentPageChangedEvent {
/**
* A Boolean property that you can set to `false` if you do not want to switch the current page.
*/
allow: boolean;
/**
* @deprecated Use `options.allow` instead.
*/
allowChanging: boolean;
}
export interface ValueChangeBaseEvent extends QuestionEventMixin {
/**
* The `name` of the question whose value is being changed. If you use the [`valueName`](https://surveyjs.io/form-library/documentation/api-reference/text-entry-question-model#valueName) property, this parameter contains its value.
*/
name: string;
/**
* A value that indicates what caused the value change: an [expression](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#expressions) evaluation or a run of a [trigger](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-survey-logic-triggers). If the value is changed for other reasons, this parameter is `undefined`.
*/
reason: "trigger" | "expression" | undefined;
}
export interface ValueChangedEvent extends ValueChangeBaseEvent {
/**
* A new value.
*/
value: any;
}
export interface ValueChangingEvent extends ValueChangeBaseEvent {
/**
* A new value. You can change it if required.
*/
value: any;
/**
* A previous value.
*/
oldValue: any;
}
export interface VariableChangedEvent {
/**
* A new value for the variable or calculated value.
*/
value: any;
/**
* The name of the variable or calculated value that has been changed.
*/
name: string;
}
export interface QuestionVisibleChangedEvent extends QuestionEventMixin, ElementVisibleChangedEventMixin {
/**
* The question's name.
*/
name: string;
}
export interface PageVisibleChangedEvent extends ElementVisibleChangedEventMixin, PageEventMixin { }
export interface PanelVisibleChangedEvent extends ElementVisibleChangedEventMixin, PanelEventMixin { }
export interface QuestionCreatedEvent extends QuestionEventMixin { }
export interface ElementAddedEvent {
/**
* A page that nests the added element.
*/
page: PanelModelBase;
/**
* The parent container (panel or page).
*/
parent: PanelModelBase;
/**
* @deprecated Use `options.page` instead.
*/
rootPanel: any;
/**
* @deprecated Use `options.parent` instead.
*/
parentPanel: any;
/**
* The element's index within the parent container (panel or page).
*/
index: number;
/**
* The question's name.
*/
name: string;
}
export interface ElementRemovedEvent {
/**
* The element's name.
*/
name: string;
}
export interface QuestionAddedEvent extends QuestionEventMixin, ElementAddedEvent { }
export interface QuestionRemovedEvent extends QuestionEventMixin, ElementRemovedEvent { }
export interface PanelAddedEvent extends PanelEventMixin, ElementAddedEvent { }
export interface PanelRemovedEvent extends PanelEventMixin, ElementRemovedEvent { }
export interface PageAddedEvent extends PageEventMixin { }
export interface ValidateQuestionEvent extends QuestionEventMixin {
/**
* A question value being validated.
*/
value: any;
/**
* The question's name.
*/
name: string;
/**
* An error message that you should specify if custom validation fails.
*/
error: string;
/**
* An array of other validation errors that you can modify. The array is empty if the validated question satisfies all validation rules.
*/
errors: Array<SurveyError>;
}
export interface SettingQuestionErrorsEvent extends QuestionEventMixin {
/**
* An array of errors. The array is empty if the validated question satisfies all validation rules.
*/
errors: Array<SurveyError>;
}
export interface ServerValidateQuestionsEvent {
/**
* A method that you should call when a request to the server has completed.
*/
complete: () => void;
/**
* An object for your error messages. Set error messages as follows: `options.errors["questionName"] = "My error message"`.
*/
errors: { [index: string]: any };
/**
* Question values. You can get an individual question value as follows: `options.data["questionName"]`.
*/
data: { [index: string]: any };
}
export interface ValidatePanelEvent extends PanelEventMixin {
/**
* The panel's name.
*/
name: string;
/**
* An error message that you should specify if custom validation fails.
*/
error: string;
/**
* An array of other validation errors that you can modify.
*/
errors: Array<SurveyError>;
}
export interface ErrorCustomTextEvent {
/**
* A validation error type: `"required"`, `"requireoneanswer"`, `"requirenumeric"`, `"exceedsize"`, `"webrequest"`, `"webrequestempty"`, `"otherempty"`, `"uploadingfile"`, `"requiredinallrowserror"`, `"minrowcounterror"`, `"keyduplicationerror"`, or `"custom"`
*/
name: string;
/**
* A survey element to which the validation error belongs.
*/
obj: Question | PanelModel | SurveyModel;
/**
* A validation error.
*/
error: SurveyError;
/**
* An error message. You can assign a custom message to this parameter.
*/
text: string;
}
export interface ValidatePageEvent extends PageEventMixin {
/**
* An array of questions with validation errors.
*/
questions: Array<Question>;
/**
* An array of validation errors.
*/
errors: Array<SurveyError>;
}
export interface ValidatedErrorsOnCurrentPageEvent extends ValidatePageEvent {
}
export interface ProcessHtmlEvent {
/**
* HTML markup. You can modify this parameter's value.
*/
html: string;
/**
* Indicates a page, question, or message for which HTML content is intended: [`"completed"`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completedHtml) | [`"completed-before"`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#completedBeforeHtml) | [`"loading"`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#loadingHtml) | [`"html-question"`](https://surveyjs.io/form-library/documentation/api-reference/add-custom-html-to-survey#html).
*/
reason: string;
}
export interface GetQuestionTitleEvent extends QuestionEventMixin {
/**
* A question title taken from the question's `title` or `name` property. You can change this parameter's value.
*/
title: string;
}
export interface GetTitleTagNameEvent {
/**
* A survey element (question, panel, page, or the survey itself) for which the event is raised.
*/
element: Base;
/**
* A heading used to render the title (`"h1"`-`"h6"`). You can change this parameter's value.
*/
tagName: string;
}
export interface GetQuestionNoEvent extends QuestionEventMixin {
/**
* @deprecated Use `options.number` instead.
*/
no: string;
}
export interface GetQuestionNumberEvent extends GetQuestionNoEvent {
/**
* A question number that is calculated based upon the question's [`visibleIndex`](https://surveyjs.io/form-library/documentation/api-reference/question#visibleIndex) and survey's [`questionStartIndex`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionStartIndex) properties. You can change this parameter's value.
*/
number: string;
}
export interface GetPageNumberEvent extends PageEventMixin {
/**
* A page number. Note that this is a string value that contains not only the number itself but also the characters that separate the number from the page title: `"1. "`, `"2. "`, etc. You can change this parameter's value.
*/
number: string;
}
export interface GetPanelNumberEvent extends PanelEventMixin {
/**
* A panel number. Note that this is a string value that contains not only the number itself but also the characters that separate the number from the panel title: `"1. "`, `"2. "`, etc. You can change this parameter's value.
*/
number: string;
}
export interface GetProgressTextEvent {
/**
* The number of questions with input fields. [Image](https://surveyjs.io/form-library/examples/add-image-and-video-to-survey/), [HTML](https://surveyjs.io/form-library/examples/questiontype-html/), and [Expression](https://surveyjs.io/form-library/examples/questiontype-expression/) questions are not counted.
*/
questionCount: number;
/**
* The number of answered questions.
*/
answeredQuestionCount: number;
/**
* The number of questions marked as required.
*/
requiredQuestionCount: number;
/**
* The number of answered questions marked as required.
*/
requiredAnsweredQuestionCount: number;
/**
* Progress text rendered in the [progress bar](#showProgressBar). You can change this parameter's value.
*/
text: string;
}
export interface ProgressTextEvent extends GetProgressTextEvent { }
export interface TextProcessingEvent {
/**
* A survey element (question, panel, page, or survey) for which the event is raised.
*/
element: Question | PanelModel | PageModel | SurveyModel;
/**
* The name of the property that contains the text to process.
*/
name: string;
}
export interface TextMarkdownEvent extends TextProcessingEvent {
/**
* A choice item for which the event is raised. This parameter has a value only when `options.element` is a choice-based question, such as [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) or [Checkboxes](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model).
*/
item?: ItemValue;
/**
* A string with Markdown content. Convert this content to HTML and assign the result to the `options.html` parameter.
*/
text: string;
/**
* A property to which you should assign HTML content.
*/
html?: string;
}
export interface TextRenderAsEvent extends TextProcessingEvent {
/**
* a component name used for text rendering
*/
renderAs: string;
}
export interface SendResultEvent {
/**
* A server [response](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response).
*/
response: any;
request: any;
/**
* A Boolean value that indicates whether survey results have been saved successfully.
*/
success: boolean;
}
export interface GetResultEvent {
/**
* A server [response](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response).
*/
response: any;
/**
* A Boolean value that indicates whether survey results have been retrieved successfully.
*/
success: boolean;
/**
* An object with the following structure:
*
* ```js
* {
* AnswersCount: Number, // A total number of posted answers to the question
* QuestionResult: Object // All unique answers to the question and their number
* }
* ```
*/
data: any;
/**
* An array of objects with the following structure:
*
* ```js
* {
* name: String, // A unique answer to the question
* value: Number // The number of user responses with this answer
* }
* ```
*/
dataList: Array<any>;
}
export interface LoadFilesEvent extends FileQuestionEventMixin {
/**
* A File Upload question's name.
*/
name: string;
}
export interface UploadFilesEvent extends LoadFilesEvent {
/**
* A callback function that you should call when a file is uploaded successfully or when file upload fails. Pass an array of successfully uploaded files as the first argument. As the second argument, you can pass an array of error messages if file upload failed.
*/
callback: (data: any | Array<any>, errors?: any | Array<any>) => any;
/**
* An array of JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/API/File" target="_blank">File</a> objects that represent files to upload.
*/
files: Array<File>;
}
export interface OpenFileChooserEvent {
/**
* A file input HTML element.
*/
input: HTMLInputElement;
/**
* A question for which this event is raised.
*/
element: Base;
/**
* The type of the element passed as the `options.element` parameter.\
* Possible values: any value returned from the [`getType()`](https://surveyjs.io/form-library/documentation/api-reference/question#getType) method.
*/
elementType: String;
/**
* The name of the survey element property for which files are being selected.
*/
propertyName: String;
/**
* A choice item for which the event is raised. This parameter has a value only when the dialog window is opened to select images for an [Image Picker](https://surveyjs.io/form-library/documentation/api-reference/image-picker-question-model) question.
*/
item: ItemValue;
/**
* A callback function to which you should pass selected files.
* @param files An array of selected files.
*/
callback: (files: Array<File>) => void;
}
export interface DownloadFileEvent extends LoadFilesEvent {
/**
* A callback function that you should call when a file is downloaded successfully or when deletion fails. Pass `"success"` or `"error"` as the first argument to indicate the operation status. As the second argument, you can pass the downloaded file's data as a Base64 string if file download was successful or an error message if file download failed.
*/
callback: (status: string, data?: any) => any;
/**
* The File Upload question's [`value`](https://surveyjs.io/form-library/documentation/api-reference/file-model#value) that contains metadata about uploaded files.
*/
fileValue: any;
/**
* A file identifier (URL, file name, etc.) stored in survey results.
*/
content: any;
}
export interface ClearFilesEvent extends LoadFilesEvent {
/**
* A callback function that you should call when files are deleted successfully or when deletion fails. Pass `"success"` or `"error"` as the first argument to indicate the operation status. As the second argument, you can pass deleted files' data (`options.value`) if file deletion was successful or an error message if file deletion failed.
*/
callback: (status: string, data?: any) => any;
/**
* The name of a file to delete. When this parameter is `null`, all files should be deleted.
*/
fileName: string;
/**
* The File Upload question's [`value`](https://surveyjs.io/form-library/documentation/api-reference/file-model#value) that contains metadata about uploaded files.
*/
value: any;
}
export interface ChoicesLoadedEvent extends QuestionEventMixin {
/**
* A query result as it came from the server.
*/
serverResult: any;
/**
* An array of loaded choices. You can modify this array.
*/
choices: Array<ItemValue>;
}
export interface LoadChoicesFromServerEvent extends ChoicesLoadedEvent { }
export interface ProcessDynamicTextEvent {
/**
* The name of the value being processed (the text in curly brackets).
*/
name: string;
/**
* The value being processed. You can change this parameter's value.
*/
value: any;
isExists: boolean;
canProcess: boolean;
returnDisplayValue: boolean;
}
export interface ProcessTextValueEvent extends ProcessDynamicTextEvent { }
export interface UpdateQuestionCssClassesEvent extends QuestionEventMixin, UpdateElementCssClassesEventMixin { }
export interface UpdatePanelCssClassesEvent extends PanelEventMixin, UpdateElementCssClassesEventMixin { }
export interface UpdatePageCssClassesEvent extends PageEventMixin, UpdateElementCssClassesEventMixin { }
export interface UpdateChoiceItemCssEvent extends QuestionEventMixin {
/**
* A choice item. To access its value and display text, use the `options.item.value` and `options.item.text` properties.
*/
item: ItemValue;
/**
* A string with CSS classes applied to the choice item. The CSS classes are separated by a space character. You can modify this string to apply custom CSS classes.
*/
css: string;
}
export interface AfterRenderSurveyEvent extends AfterRenderElementEventMixin {
/**
* @deprecated Use the `sender` parameter instead.
*/
survey: SurveyModel;
}
export interface AfterRenderHeaderEvent extends AfterRenderElementEventMixin { }
export interface AfterRenderPageEvent extends AfterRenderElementEventMixin, PageEventMixin { }
export interface AfterRenderQuestionEvent extends QuestionEventMixin, AfterRenderElementEventMixin { }
export interface AfterRenderQuestionInputEvent extends QuestionEventMixin, AfterRenderElementEventMixin { }
export interface AfterRenderPanelEvent extends AfterRenderElementEventMixin, PanelEventMixin { }
export interface FocusInQuestionEvent extends QuestionEventMixin {
}
export interface FocusInPanelEvent extends PanelEventMixin { }
export interface ShowingChoiceItemEvent extends QuestionEventMixin {
/**
* A choice item.
*/
item: ItemValue;
/**
* A Boolean value that specifies item visibility. Set it to `false` to hide the item.
*/
visible: boolean;
}
export interface ChoicesLazyLoadEvent extends QuestionEventMixin {
/**
* A method that you should call to assign loaded items to the question. Item objects should be structured as specified in the [`choices`](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model#choices) property description. If their structure is different, [map their properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) to bring them to the required structure.
*/
setItems: (items: Array<{ "value": any, "text"?: String, "imageLink"?: string, "customProperty"?: any } | string>, totalCount: number) => void;
/**
* A search string used to filter choices.
*/
filter: string;
/**
* The number of choice items to load. You can use the question's [`choicesLazyLoadPageSize`](https://surveyjs.io/form-library/documentation/questiondropdownmodel#choicesLazyLoadPageSize) property to change this number.
*/
take: number;
/**
* The number of choice items to skip.
*/
skip: number;
}
export interface ChoicesSearchEvent extends QuestionEventMixin {
/**
* A search string used to filter choice options.
*/
filter: string;
/**
* An array of all choice options.
*/
choices: Array<ItemValue>;
/**
* A filtered array of choice options. Apply `options.filter` to the `options.choices` array and assign the result to this parameter.
*/
filteredChoices: Array<ItemValue>;
}
export interface GetChoiceDisplayValueEvent extends QuestionEventMixin {
/**
* A method that you should call to assign display texts to the question.
*/
setItems: (displayValues: Array<string>, ...customValues: Array<IValueItemCustomPropValues>) => void;
/**
* An array of one (in Dropdown) or more (in Tag Box) default values.
*/
values: Array<any>;
}
export interface MatrixRowAddedEvent extends MatrixDynamicQuestionEventMixin {
/**
* An added matrix row.
*/
row: MatrixDropdownRowModelBase;
}
export interface MatrixBeforeRowAddedEvent extends MatrixDynamicQuestionEventMixin {
/**
* A Boolean property that you can set to `false` if you do not want to add the row.
*/
allow: boolean;
/**
* @deprecated Use `options.allow` instead.
*/
canAddRow: boolean;
}
export interface MatrixRowRemovingEvent extends MatrixDynamicQuestionEventMixin {
/**
* A matrix row to be deleted. If you want to clear row data, set the `options.row.value` property to `undefined`.
*/
row: MatrixDropdownRowModelBase;
/**
* A zero-based index of the matrix row to be deleted.
*/
rowIndex: number;
/**
* A Boolean property that you can set to `false` if you want to cancel row deletion.
*/
allow: boolean;
}
export interface MatrixRowRemovedEvent extends MatrixDynamicQuestionEventMixin {
/**
* A deleted matrix row.
*/
row: MatrixDropdownRowModelBase;
/**
* A zero-based index of the deleted row.
*/
rowIndex: number;
}
export interface MatrixAllowRemoveRowEvent extends MatrixDynamicQuestionEventMixin {
/**
* A matrix row for which the event is raised.
*/
row: MatrixDropdownRowModelBase;
/**
* A zero-based row index.
*/
rowIndex: number;
/**
* A Boolean property that you can set to `false` if you want to hide the Remove button for this row.
*/
allow: boolean;
}
export interface MatrixDetailPanelVisibleChangedEvent extends MatrixDropdownQuestionEventMixin {
/**
* A matrix row to which the detail section belongs.
*/
row: MatrixDropdownRowModelBase;
/**
* A zero-based row index.
*/
rowIndex: number;
/**
* A [PanelModel](https://surveyjs.io/form-library/documentation/panelmodel) that represents the detail section.
*/
detailPanel: PanelModel;
/**
* Indicates whether the detail section is visible now.
*/
visible: boolean;
}
export interface MatrixCellCreatingBaseEvent extends MatrixDropdownQuestionEventMixin {
/**
* A [matrix column](https://surveyjs.io/form-library/documentation/api-reference/multi-select-matrix-column-values) to which the cell belongs.
*/
column: MatrixDropdownColumn;
/**
* The name of the matrix column to which the cell belongs.
*/
columnName: string;
/**
* A matrix row to which the cell belongs.
*/
row: MatrixDropdownRowModelBase;
/**
* The values of this matrix row.\
* To access a particular column's value, use the following code: `options.rowValue["columnName"]`
*/
rowValue: any;
}
export interface MatrixCellCreatingEvent extends MatrixCellCreatingBaseEvent {
/**
* The type of this matrix cell. You can change this property value to one of the values described in the [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType) documentation.
*/
cellType: string;
}
export interface MatrixCellCreatedEvent extends MatrixCellCreatingBaseEvent {
/**
* A matrix cell for which the event is raised.
*/
cell: MatrixDropdownCell;
/**
* A Question instance within the matrix cell. You can use the properties and methods exposed by the instance to customize it.
*/
cellQuestion: Question;
}
export interface MatrixAfterCellRenderEvent extends QuestionEventMixin, AfterRenderElementEventMixin {
/**
* A matrix cell for which the event is raised.
*/
cell: MatrixDropdownCell;
/**
* A Question instance within the matrix cell.
*/
cellQuestion: Question;
/**
* A matrix row to which the cell belongs.
*/
row: MatrixDropdownRowModelBase;
/**
* A [matrix column](https://surveyjs.io/form-library/documentation/api-reference/multi-select-matrix-column-values) to which the cell belongs.
*/
column: MatrixDropdownColumn | MatrixDropdownCell;
}
export interface MatrixCellValueBaseEvent extends MatrixDropdownQuestionEventMixin {
/**
* A matrix row to which the cell belongs.
*/
row: MatrixDropdownRowModelBase;
/**
* A [matrix column](https://surveyjs.io/form-library/documentation/api-reference/multi-select-matrix-column-values) to which the cell belongs.
*/
column: MatrixDropdownColumn;
/**
* The name of a matrix column to which the cell belongs.
*/
columnName: string;
/**
* A Question instance within the matrix cell. You can use the properties and methods exposed by the instance to customize it.
*/
cellQuestion: Question;
/**
* A method that returns a Question instance within the matrix cell given a column name.
*/
getCellQuestion: (columnName: string) => Question;
/**
* A new cell value.
*/
value: any;
}
export interface MatrixCellValueChangedEvent extends MatrixCellValueBaseEvent { }
export interface MatrixCellValueChangingEvent extends MatrixCellValueBaseEvent {
/**
* A previous cell value.
*/
oldValue: any;
}
export interface MatrixCellValidateEvent extends MatrixCellValueBaseEvent {
/**
* A field for your custom error message. Default value: `undefined`.
*/
error?: string;
}
export interface DynamicPanelModifiedEvent extends PanelDynamicQuestionEventMixin, PanelEventMixin {
/**
* The panel's index within Dynamic Panel.
*/
panelIndex: number;
}
export interface DynamicPanelRemovingEvent extends DynamicPanelModifiedEvent {
/**
* A Boolean property that you can set to `false` if you want to cancel panel deletion.
*/
allow: boolean;
}
export interface TimerPanelInfoTextEvent {
/**
* the timer panel info text
*/
text: string;
}
export interface DynamicPanelValueChangedEvent extends PanelDynamicQuestionEventMixin {
/**
* The panel's data object that includes all item values.
*/
panelData: { [index: string]: any };
/**
* The panel's index within Dynamic Panel.
*/
panelIndex: number;
/**
* The item's name.
*/
name: string;
/**
* A panel that nests the item with a changed value.
*/
panel: PanelModel;
/**
* The item's new value.
*/
value: any;
}
export interface DynamicPanelValueChangingEvent extends DynamicPanelValueChangedEvent {
/**
* The item's old value.
*/
oldValue: any;
}
export interface DynamicPanelItemValueChangedEvent extends DynamicPanelValueChangedEvent {
}
export interface DynamicPanelCurrentIndexChangedEvent extends PanelDynamicQuestionEventMixin {
/**
* A panel for which the event is raised.
*/
panel: PanelModel;
/**
* The panel's index in the [`visiblePanels`](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model#visiblePanels) array of the Dynamic Panel.
*/
visiblePanelIndex: number;
}
export interface DynamicPanelGetTabTitleEvent extends DynamicPanelCurrentIndexChangedEvent {
/**
* A tab title. You can change this parameter's value.
*/
title: string;
}
export interface IsAnswerCorrectEvent extends QuestionEventMixin {
/**
* A Boolean property that specifies whether the answer is correct (`true`) or incorrect (`false`). Use the `options.question.value` and `options.question.correctAnswer` properties to check the answer.
*/
result: boolean;
/**
* @deprecated Use `options.correctAnswerCount` instead.
*/
correctAnswers?: number;
/**
* @deprecated Use `options.incorrectAnswerCount` instead.
*/
incorrectAnswers?: number;
}
export interface CheckAnswerCorrectEvent extends IsAnswerCorrectEvent {
/**
* The number of correct answers in a matrix where each row is considered as one quiz question.
*/
correctAnswerCount: number;
/**
* The number of incorrect answers in a matrix where each row is considered as one quiz question.
*/
incorrectAnswerCount: number;
}
export interface DragDropAllowEvent {
/**
* A survey element being dragged.
*/
draggedElement: IElement;
/**
* A survey element from which `draggedElement` is being dragged. This parameter is `null` if `draggedElement` is being dragged from the [Toolbox](https://surveyjs.io/survey-creator/documentation/toolbox).
*/
fromElement: IPanel;
/**
* A survey element to which `draggedElement` is being dragged.
*/
toElement: IElement;
/**
* A survey element before which the target element will be placed. This parameter is `null` if the parent container (page or panel) has no elements or if the target element will be placed below all other elements within the container.
*/
insertBefore: IElement;
/**
* A survey element after which `draggedElement` will be placed. This parameter is `null` if the parent container (page or panel) has no elements or if `draggedElement` will be placed above all other elements within the container.
*/
insertAfter: IElement;
/**
* A parent container (page or panel) within which `draggedElement` will be placed.
*/