survey-creator-core 1.9.38 → 1.9.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Type definition for Survey Creatorlibrary. Platform independent (core) v1.9.38
2
+ * Type definition for Survey Creatorlibrary. Platform independent (core) v1.9.41
3
3
  * Copyright (c) 2015-2022 Devsoft Baltic OÜ - https://surveyjs.io/
4
4
  * License: https://surveyjs.io/Licenses#SurveyCreator
5
5
  */
@@ -7,11 +7,11 @@ import { Base, JsonObjectProperty, Question, SurveyModel, ItemValue } from "surv
7
7
  import { MatrixDropdownColumn, IAction, Action, ActionContainer, DragDropSurveyElements } from "survey-core";
8
8
  import { DragDropChoices, Event, AdaptiveActionContainer, PageModel, IElement } from "survey-core";
9
9
  import { IPanel, ISurveyElement, SurveyElement, QuestionSelectBase, QuestionRowModel } from "survey-core";
10
- import { LocalizableString, DragOrClickHelper, PanelModel, QuestionDropdownModel, ListModel } from "survey-core";
11
- import { PopupModel, EventBase, PanelModelBase, QuestionNonValue, SurveyTemplateRendererTemplateData } from "survey-core";
12
- import { QuestionRatingModel, ComputedUpdater, QuestionCheckboxModel, ILocalizableString, ArrayChanges } from "survey-core";
13
- import { ImageItemValue, HashTable, QuestionMatrixDynamicModel, QuestionMatrixModel, QuestionMatrixDropdownModel } from "survey-core";
14
- import { QuestionPanelDynamicModel, QuestionCommentModel, MatrixDynamicRowModel } from "survey-core";
10
+ import { LocalizableString, Operand, DragOrClickHelper, PanelModel, QuestionDropdownModel } from "survey-core";
11
+ import { ListModel, PopupModel, EventBase, PanelModelBase, QuestionNonValue } from "survey-core";
12
+ import { SurveyTemplateRendererTemplateData, QuestionRatingModel, ComputedUpdater, QuestionCheckboxModel, ILocalizableString } from "survey-core";
13
+ import { ArrayChanges, ImageItemValue, HashTable, QuestionMatrixDynamicModel, QuestionMatrixModel } from "survey-core";
14
+ import { QuestionMatrixDropdownModel, QuestionPanelDynamicModel, QuestionCommentModel, MatrixDynamicRowModel } from "survey-core";
15
15
 
16
16
  export { editorLocalization as localization };
17
17
 
@@ -62,6 +62,7 @@ export interface ISurveyCreatorOptions {
62
62
  createSurvey(json: any, reason: string, surveyType?: any): any;
63
63
  onConditionQuestionsGetListCallback(propertyName: string, obj: Base, editor: any, list: any): any;
64
64
  onConditionGetTitleCallback(expression: string, title: string): string;
65
+ onLogicGetTitleCallback(expression: string, displayExpression: string, text: string, logicItem: any): string;
65
66
  }
66
67
  /*
67
68
  * Survey Creator configuration. Pass it as an argument to the `SurveyCreator` constructor:
@@ -192,13 +193,13 @@ export interface ICreatorOptions {
192
193
  *
193
194
  * Accepted values:
194
195
  *
195
- * - `"auto"` (default)
196
- * Display the language selector only if the survey is translated to more than one language.
196
+ * - `"auto"` (default)
197
+ * Display the language selector only if the survey is translated into more than one language.
197
198
  *
198
- * - `true`
199
+ * - `true`
199
200
  * Always display the language selector regardless of how many languages are used in the survey.
200
- *
201
- * - `false`
201
+ *
202
+ * - `false`
202
203
  * Never display the language selector.
203
204
  *
204
205
  * - `"all"`
@@ -220,6 +221,14 @@ export interface ICreatorOptions {
220
221
  */
221
222
  showObjectTitles?: boolean;
222
223
  /*
224
+ * Limits the number of visible choices. Users can click "Show more..." to view hidden choices.
225
+ *
226
+ * Specify this property if questions with many choices occupy much vertical space on the design surface.
227
+ *
228
+ * Default value: -1 (unlimited)
229
+ */
230
+ maxVisibleChoices?: number;
231
+ /*
223
232
  * Specifies whether the design surface displays the survey title and description when the survey does not contain any elements.
224
233
  *
225
234
  * Default value: `false`
@@ -269,6 +278,27 @@ export interface ICreatorOptions {
269
278
  * [View the "Switch Between Themes" demo](https://surveyjs.io/Examples/Creator?id=theme-switcher)
270
279
  */
271
280
  allowChangeThemeInPreview?: boolean;
281
+ /*
282
+ * Limits question and panels types available in the Toolbox and Add Question menu.
283
+ *
284
+ * Refer to the [Limit Available Question and Panel Types](https://surveyjs.io/Documentation/Survey-Creator?id=toolbox#limit-available-question-and-panel-types) help topic for more information.
285
+ */
286
+ questionTypes?: any;
287
+ /*
288
+ * Specifies how Survey Creator users edit survey pages.
289
+ *
290
+ * Accepted values:
291
+ *
292
+ * - `"standard"` (default)
293
+ * Questions and panels are divided between pages. Users can scroll the design surface to reach a required page.
294
+ *
295
+ * - `"single"`
296
+ * All questions and panels belong to a single page. Users cannot add or remove pages.
297
+ *
298
+ * - `"bypage"`
299
+ * Questions and panels are divided between pages. Users can use the page navigator to switch to a required page.
300
+ */
301
+ pageEditMode?: "standard" | "single" | "bypage";
272
302
  }
273
303
  /*
274
304
  * The Toolbox item description.
@@ -421,6 +451,7 @@ export interface ICreatorPlugin {
421
451
  update?: any;
422
452
  deactivate?: any;
423
453
  dispose?: any;
454
+ onDesignerSurveyPropertyChanged?: (obj: Base, propName: string) => void;
424
455
  model: Base;
425
456
  }
426
457
  export interface ICreatorAction extends IAction {
@@ -558,8 +589,7 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
558
589
  footerToolbar: any;
559
590
  pageEditModeValue: "standard" | "single" | "bypage";
560
591
  /*
561
- * Set pageEditMode option to "single" to use creator in a single page mode. By default value is "standard".
562
- * You can set this option in creator constructor only
592
+ * Contains the value of the [`pageEditMode`](https://surveyjs.io/Documentation/Survey-Creator?id=ICreatorOptions#pageEditMode) property specified in the constructor.
563
593
  */
564
594
  get pageEditMode(): "standard" | "single" | "bypage";
565
595
  set pageEditMode(val: "standard" | "single" | "bypage");
@@ -834,6 +864,18 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
834
864
  */
835
865
  onConditionGetTitle: Event<(sender: CreatorBase, options: any) => any, any>;
836
866
  /*
867
+ * Use this event to modify the display text of a logic item in the Logic tab.
868
+ *
869
+ * The event handler accepts the following arguments:
870
+ *
871
+ * - `sender` - A Survey Creator instance that raised the event.
872
+ * - `options.expression` - A logical expression associated with the logic item.
873
+ * - `options.expressionText` - The same expression in a user-friendly format. It may contain question titles instead of question names.
874
+ * - `options.logicItem` - A logic item object. Contains an array of actions and other properties.
875
+ * - `options.text` - The expression and actions in a user-friendly format. Redefine this property if you want to change the display text.
876
+ */
877
+ onLogicItemDisplayText: Event<(sender: CreatorBase, options: any) => any, any>;
878
+ /*
837
879
  * The event is called when a survey is changed in the designer. A new page/question/page is added or existing is removed, a property is changed and so on.
838
880
  * - sender the survey creator object that fires the event
839
881
  * options object contains the information about certain modifications
@@ -999,22 +1041,6 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
999
1041
  */
1000
1042
  onDragDropAllow: Event<(sender: CreatorBase, options: any) => any, any>;
1001
1043
  /*
1002
- * Use this event to override/disable element adorners - wrapping component name.
1003
- * - sender the survey creator object that fires the event.
1004
- * - options.element a survey object to be wrapped.
1005
- * - options.reason why we need to wrap an element.
1006
- * - options.conponentName component wrapper name.
1007
- */
1008
- onGetElementWrapperComponentName: Event<(sender: CreatorBase, options: any) => any, any>;
1009
- /*
1010
- * Use this event to override/disable element adorners - wrapping component data.
1011
- * - sender the survey creator object that fires the event.
1012
- * - options.element a survey object to be wrapped.
1013
- * - options.reason why we need to wrap an element.
1014
- * - options.conponentData component wrapper data.
1015
- */
1016
- onGetElementWrapperComponentData: Event<(sender: CreatorBase, options: any) => any, any>;
1017
- /*
1018
1044
  * This callback is used internally for providing survey JSON text.
1019
1045
  */
1020
1046
  getSurveyJSONTextCallback: any;
@@ -1035,6 +1061,14 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1035
1061
  */
1036
1062
  showObjectTitles: boolean;
1037
1063
  /*
1064
+ * Limits the number of visible choices. Users can click "Show more..." to view hidden choices.
1065
+ *
1066
+ * Specify this property if questions with many choices occupy much vertical space on the design surface.
1067
+ *
1068
+ * Default value: -1 (unlimited)
1069
+ */
1070
+ maxVisibleChoices: number;
1071
+ /*
1038
1072
  * Specifies whether to display question titles instead of names when users edit logical expressions.
1039
1073
  *
1040
1074
  * Default value: `false`
@@ -1102,12 +1136,14 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1102
1136
  * Default value: `"defaultV2"`
1103
1137
  */
1104
1138
  themeForPreview: string;
1139
+ _allowModifyPages: boolean;
1105
1140
  /*
1106
1141
  * Specifies whether users can add, edit, and delete survey pages.
1107
1142
  *
1108
1143
  * Default value: `true`
1109
1144
  */
1110
- allowModifyPages: boolean;
1145
+ get allowModifyPages(): boolean;
1146
+ set allowModifyPages(val: boolean);
1111
1147
  /*
1112
1148
  * Obsolete. Use the [`showDefaultLanguageInPreviewTab`](https://surveyjs.io/Documentation/Survey-Creator?id=surveycreator#showDefaultLanguageInPreviewTab) property instead.
1113
1149
  */
@@ -1117,16 +1153,16 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1117
1153
  *
1118
1154
  * Accepted values:
1119
1155
  *
1120
- * - `"auto"` (default)
1121
- * Display the language selector only if the survey is translated to more than one language.
1156
+ * - `"auto"` (default)
1157
+ * Display the language selector only if the survey is translated into more than one language.
1122
1158
  *
1123
- * - `true`
1159
+ * - `true`
1124
1160
  * Always display the language selector regardless of how many languages are used in the survey.
1125
1161
  *
1126
- * - `false`
1162
+ * - `false`
1127
1163
  * Never display the language selector.
1128
1164
  *
1129
- * - `"all"`
1165
+ * - `"all"`
1130
1166
  * Always display the language selector with [all supported languages](https://github.com/surveyjs/survey-creator/tree/master/packages/survey-creator-core/src/localization).
1131
1167
  *
1132
1168
  * **See also**: [Localization & Globalization](https://surveyjs.io/Documentation/Survey-Creator?id=localization)
@@ -1294,7 +1330,10 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1294
1330
  onBeforeDrop: Event<() => any, any>;
1295
1331
  onAfterDrop: Event<() => any, any>;
1296
1332
  updateElementsOnLocaleChanged(obj: Base, propertyName: string): void;
1297
- updateConditionsOnQuestionNameChanged(obj: Base, propertyName: string, oldValue: any): void;
1333
+ updateConditionsOnNameChanged(obj: Base, propertyName: string, oldValue: any): void;
1334
+ surveyLogicForUpdate: SurveyLogic;
1335
+ surveyLogicRenaming: boolean;
1336
+ protected createSurveyLogicForUpdate(): SurveyLogic;
1298
1337
  isObjQuestion(obj: Base): boolean;
1299
1338
  isObjPage(obj: Base): boolean;
1300
1339
  protected setSurvey(survey: SurveyModel): void;
@@ -1438,6 +1477,7 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1438
1477
  onGetElementEditorTitleCallback(obj: Base, title: string): string;
1439
1478
  onConditionQuestionsGetListCallback(propertyName: string, obj: Base, editor: any, list: any): void;
1440
1479
  onConditionGetTitleCallback(expression: string, title: string): string;
1480
+ onLogicGetTitleCallback(expression: string, expressionText: string, text: string, logicItem: any): string;
1441
1481
  /*
1442
1482
  * The delay on saving survey JSON on autoSave in ms. It is 500 ms by default.
1443
1483
  * If during this period of time an end-user modify survey, then the last version will be saved only. Set to 0 to save immediately.
@@ -1563,6 +1603,7 @@ export declare class ExpressionToDisplayText {
1563
1603
  currentQuestion: Question;
1564
1604
  showTitles: boolean;
1565
1605
  toDisplayText(expression: string): string;
1606
+ toExpression(node: Operand): string;
1566
1607
  static operatorText: any;
1567
1608
  }
1568
1609
  export declare class ItemValueWrapperViewModel extends Base {
@@ -1627,6 +1668,7 @@ export declare class LogoImageViewModel extends Base {
1627
1668
  constructor(creator: CreatorBase, root: any);
1628
1669
  root: any;
1629
1670
  get allowEdit(): boolean;
1671
+ get containerCss(): string;
1630
1672
  get survey(): SurveyModel;
1631
1673
  chooseFile(model: LogoImageViewModel): void;
1632
1674
  remove(model: LogoImageViewModel): void;
@@ -2056,6 +2098,7 @@ export declare class StringEditorViewModelBase extends Base {
2056
2098
  onClick(event: any): void;
2057
2099
  onFocus(event: any): void;
2058
2100
  onInput(event: any): void;
2101
+ onBlur(event: any): void;
2059
2102
  done(event: any): void;
2060
2103
  onKeyDown(event: any): boolean;
2061
2104
  onKeyUp(event: any): boolean;
@@ -2202,6 +2245,9 @@ export declare class SurveyLogic extends Base implements ISurveyLogicItemOwner {
2202
2245
  protected onEditableItemApply(): void;
2203
2246
  protected onItemChanged(item: SurveyLogicItem, changeType: string): void;
2204
2247
  renameQuestion(oldName: string, newName: string): void;
2248
+ renameItemValue(item: ItemValue, oldValue: any): void;
2249
+ renameRowValue(item: ItemValue, oldValue: any): void;
2250
+ renameColumn(column: MatrixDropdownColumn, oldName: string): void;
2205
2251
  removeQuestion(name: string): void;
2206
2252
  hasError(): boolean;
2207
2253
  getUsedQuestions(): Array<Question>;
@@ -2249,6 +2295,15 @@ export declare class SurveyLogicAction {
2249
2295
  addQuestionNames(names: any): void;
2250
2296
  get elementName(): string;
2251
2297
  }
2298
+ export declare class SurveyLogicExpressionUpdater {
2299
+ constructor(expresion: string);
2300
+ operand: Operand;
2301
+ constChanges: any;
2302
+ update(varName: string, oldValue: any, newValue: any): void;
2303
+ get isModified(): boolean;
2304
+ toString(): string;
2305
+ static operatorText: any;
2306
+ }
2252
2307
  export declare class SurveyLogicItem {
2253
2308
  constructor(owner: ISurveyLogicItemOwner, expression?: string);
2254
2309
  expression: string;
@@ -2276,6 +2331,9 @@ export declare class SurveyLogicItem {
2276
2331
  equals(item: SurveyLogicItem): boolean;
2277
2332
  apply(expression: string): void;
2278
2333
  renameQuestion(oldName: string, newName: string): void;
2334
+ renameColumn(question: Question, column: MatrixDropdownColumn, oldName: string): void;
2335
+ renameItemValue(question: Question, item: ItemValue, oldValue: any): void;
2336
+ renameRowValue(question: Question, item: ItemValue, oldValue: any): void;
2279
2337
  removeQuestion(name: string): void;
2280
2338
  getQuestionNames(): Array<any>;
2281
2339
  getActionTypes(): Array<any>;
@@ -2424,9 +2482,6 @@ export declare class SurveyTextWorker {
2424
2482
  export declare class TabDesignerViewModel extends Base {
2425
2483
  constructor(creator: CreatorBase);
2426
2484
  widthUpdater: any;
2427
- checkNewPageHandler: (sender: SurveyModel, options: any) => void;
2428
- checkRemovePageHandler: (sender: SurveyModel, options: any) => void;
2429
- surveyOnPropertyChanged: (sender: SurveyModel, options: any) => void;
2430
2485
  pagesControllerValue: PagesController;
2431
2486
  newPage: PageModel;
2432
2487
  showNewPage: boolean;
@@ -2438,8 +2493,9 @@ export declare class TabDesignerViewModel extends Base {
2438
2493
  get pagesController(): PagesController;
2439
2494
  get isToolboxVisible(): boolean;
2440
2495
  get placeholderText(): string;
2496
+ isUpdatingNewPage: boolean;
2497
+ onDesignerSurveyPropertyChanged(obj: Base, propName: string): void;
2441
2498
  initSurvey(): void;
2442
- dispose(): void;
2443
2499
  clickDesigner(): void;
2444
2500
  getDesignerCss(): string;
2445
2501
  getRootCss(): string;
@@ -2585,6 +2641,7 @@ export declare class UndoRedoController extends Base {
2585
2641
  undoAction: Action;
2586
2642
  redoAction: Action;
2587
2643
  undoRedoManager: UndoRedoManager;
2644
+ updateSurvey(): void;
2588
2645
  undo(): void;
2589
2646
  redo(): void;
2590
2647
  startTransaction(name?: string): void;
@@ -2679,6 +2736,7 @@ export declare class EmptySurveyCreatorOptions implements ISurveyCreatorOptions
2679
2736
  createSurvey(json: any, reason: string, surveyType?: any): SurveyModel;
2680
2737
  onConditionQuestionsGetListCallback(propertyName: string, obj: Base, editor: any, list: any): void;
2681
2738
  onConditionGetTitleCallback(expression: string, title: string): string;
2739
+ onLogicGetTitleCallback(expression: string, displayExpression: string, text: string, logicItem: any): string;
2682
2740
  }
2683
2741
  export declare class ImageItemValueWrapperViewModel extends ItemValueWrapperViewModel {
2684
2742
  constructor(creator: CreatorBase, question: QuestionSelectBase, item: ImageItemValue, templateData: any, itemsRoot: any);
@@ -2852,6 +2910,7 @@ export declare class TabDesignerPlugin implements ICreatorPlugin {
2852
2910
  previewAction: Action;
2853
2911
  activate(): void;
2854
2912
  deactivate(): boolean;
2913
+ onDesignerSurveyPropertyChanged(obj: Base, propName: string): void;
2855
2914
  update(): void;
2856
2915
  createActions(): any;
2857
2916
  selectSurvey(): void;
@@ -3212,6 +3271,20 @@ export declare class PropertyGridValueEditorBase extends PropertyGridEditor {
3212
3271
  protected isValueEmpty(val: any): boolean;
3213
3272
  isSupportGrouping(): boolean;
3214
3273
  }
3274
+ export declare class QuestionDropdownAdornerViewModel extends QuestionAdornerViewModel {
3275
+ constructor(creator: CreatorBase, surveyElement: SurveyElement, templateData: SurveyTemplateRendererTemplateData);
3276
+ isCollapsed: boolean;
3277
+ visibleCount: number;
3278
+ get question(): QuestionDropdownModel;
3279
+ get needToCollapse(): boolean;
3280
+ get isCollapseView(): boolean;
3281
+ leftFocus(): void;
3282
+ getChoiceCss(): string;
3283
+ getRenderedItems(): any;
3284
+ getButtonText(): string;
3285
+ switchCollapse: any;
3286
+ dispose(): void;
3287
+ }
3215
3288
  export declare class QuestionImageAdornerViewModel extends QuestionAdornerViewModel {
3216
3289
  constructor(creator: CreatorBase, surveyElement: SurveyElement, templateData: SurveyTemplateRendererTemplateData, questionRoot: any);
3217
3290
  questionRoot: any;
@@ -3449,6 +3522,7 @@ export declare function assignDefaultV2Classes(destination: any, questionType: s
3449
3522
  export declare function wrapTextByCurlyBraces(text: string): string;
3450
3523
  export declare function capitalize(str: string): string;
3451
3524
  export declare function getLocString(strName: string, locale?: string): string;
3525
+ export declare function updateLogicExpression(expression: string, varName: string, oldValue: any, newValue: any): string;
3452
3526
  export declare function getLogicString(name: string): string;
3453
3527
  export declare function parsePropertyDescription(text: string): string;
3454
3528
  export declare function setSurveyJSONForPropertyGrid(json: any, updateOnTyping?: boolean, titleLocationLeft?: boolean): void;
@@ -3508,6 +3582,14 @@ export declare var settings: {
3508
3582
  logicItemTitleMaxChars: number,
3509
3583
  openBracket: string,
3510
3584
  closeBracket: string,
3585
+ /*
3586
+ * Set these properties to false if you don't want to update expressions on changing question and column names and on changing choices values
3587
+ */
3588
+ updateExpressionsOnChanging: {
3589
+ questionName: boolean,
3590
+ columnName: boolean,
3591
+ choiceValue: boolean,
3592
+ },
3511
3593
  },
3512
3594
  /*
3513
3595
  * Determines which types of questions the conversion will be available for.
@@ -3810,6 +3892,7 @@ export declare var propertyGridCss: {
3810
3892
  dragElementDecorator: string,
3811
3893
  iconDragElement: string,
3812
3894
  iconDrag: string,
3895
+ footer: string,
3813
3896
  dragDropGhostPositionTop: string,
3814
3897
  dragDropGhostPositionBottom: string,
3815
3898
  emptyRowsSection: string,