survey-creator-core 1.9.118 → 1.9.119

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.
Files changed (80) hide show
  1. package/fonts.fontless.css +1 -1
  2. package/fonts.fontless.min.css +1 -1
  3. package/i18n/arabic.js +1 -1
  4. package/i18n/arabic.min.js +1 -1
  5. package/i18n/bulgarian.js +1 -1
  6. package/i18n/bulgarian.min.js +1 -1
  7. package/i18n/croatian.js +1 -1
  8. package/i18n/croatian.min.js +1 -1
  9. package/i18n/czech.js +1 -1
  10. package/i18n/czech.min.js +1 -1
  11. package/i18n/danish.js +1 -1
  12. package/i18n/danish.min.js +1 -1
  13. package/i18n/dutch.js +1 -1
  14. package/i18n/dutch.min.js +1 -1
  15. package/i18n/english.js +1 -1
  16. package/i18n/english.min.js +1 -1
  17. package/i18n/finnish.js +1 -1
  18. package/i18n/finnish.min.js +1 -1
  19. package/i18n/french.js +1 -1
  20. package/i18n/french.min.js +1 -1
  21. package/i18n/german.js +1 -1
  22. package/i18n/german.min.js +1 -1
  23. package/i18n/hungarian.js +1 -1
  24. package/i18n/hungarian.min.js +1 -1
  25. package/i18n/index.js +1 -1
  26. package/i18n/index.min.js +1 -1
  27. package/i18n/indonesian.js +1 -1
  28. package/i18n/indonesian.min.js +1 -1
  29. package/i18n/italian.js +1 -1
  30. package/i18n/italian.min.js +1 -1
  31. package/i18n/japanese.js +1 -1
  32. package/i18n/japanese.min.js +1 -1
  33. package/i18n/korean.js +1 -1
  34. package/i18n/korean.min.js +1 -1
  35. package/i18n/malay.js +1 -1
  36. package/i18n/malay.min.js +1 -1
  37. package/i18n/mongolian.js +1 -1
  38. package/i18n/mongolian.min.js +1 -1
  39. package/i18n/norwegian.js +1 -1
  40. package/i18n/norwegian.min.js +1 -1
  41. package/i18n/persian.js +1 -1
  42. package/i18n/persian.min.js +1 -1
  43. package/i18n/polish.js +1 -1
  44. package/i18n/polish.min.js +1 -1
  45. package/i18n/portuguese.js +1 -1
  46. package/i18n/portuguese.min.js +1 -1
  47. package/i18n/russian.js +1 -1
  48. package/i18n/russian.min.js +1 -1
  49. package/i18n/simplified-chinese.js +1 -1
  50. package/i18n/simplified-chinese.min.js +1 -1
  51. package/i18n/slovak.js +1 -1
  52. package/i18n/slovak.min.js +1 -1
  53. package/i18n/spanish.js +1 -1
  54. package/i18n/spanish.min.js +1 -1
  55. package/i18n/swedish.js +1 -1
  56. package/i18n/swedish.min.js +1 -1
  57. package/i18n/tajik.js +1 -1
  58. package/i18n/tajik.min.js +1 -1
  59. package/i18n/traditional-chinese.js +1 -1
  60. package/i18n/traditional-chinese.min.js +1 -1
  61. package/i18n/turkish.js +1 -1
  62. package/i18n/turkish.min.js +1 -1
  63. package/package.json +2 -2
  64. package/survey-creator-core.css +5 -5
  65. package/survey-creator-core.fontless.css +4 -4
  66. package/survey-creator-core.fontless.css.map +1 -1
  67. package/survey-creator-core.fontless.min.css +2 -2
  68. package/survey-creator-core.i18n.js +1 -1
  69. package/survey-creator-core.i18n.min.js +1 -1
  70. package/survey-creator-core.js +299 -107
  71. package/survey-creator-core.js.map +1 -1
  72. package/survey-creator-core.min.css +3 -3
  73. package/survey-creator-core.min.js +5 -5
  74. package/typings/components/tabs/theme-builder.d.ts +3 -5
  75. package/typings/components/tabs/theme-plugin.d.ts +93 -7
  76. package/typings/creator-base.d.ts +45 -6
  77. package/typings/creator-options.d.ts +8 -1
  78. package/typings/property-grid-theme/property-grid.d.ts +2 -1
  79. package/typings/survey-helper.d.ts +2 -1
  80. package/typings/toolbox.d.ts +37 -1
@@ -36,8 +36,6 @@ export declare class ThemeBuilder extends Base {
36
36
  themePalette: any;
37
37
  themeMode: any;
38
38
  getFullThemeName(_themeName?: string): any;
39
- get activeLanguage(): string;
40
- set activeLanguage(val: string);
41
39
  get survey(): SurveyModel;
42
40
  get pageActions(): Array<Action>;
43
41
  get isPageToolbarVisible(): boolean;
@@ -49,13 +47,13 @@ export declare class ThemeBuilder extends Base {
49
47
  onThemeSelected: EventBase<ThemeBuilder, {
50
48
  theme: ITheme;
51
49
  }>;
52
- onThemeModified: EventBase<ThemeBuilder, {
50
+ onThemePropertyChanged: EventBase<ThemeBuilder, {
53
51
  name: string;
54
52
  value: any;
55
53
  }>;
56
- onCanModifyTheme: EventBase<ThemeBuilder, {
54
+ onAllowModifyTheme: EventBase<ThemeBuilder, {
57
55
  theme: ITheme;
58
- canModify: boolean;
56
+ allow: boolean;
59
57
  }>;
60
58
  constructor(surveyProvider: CreatorBase, startThemeClasses?: any);
61
59
  get isMobileView(): boolean;
@@ -2,6 +2,22 @@ import { Action, ITheme, EventBase } from "survey-core";
2
2
  import { CreatorBase, ICreatorPlugin } from "../../creator-base";
3
3
  import { ThemeBuilder } from "./theme-builder";
4
4
  import { saveToFileHandler } from "../../utils/utils";
5
+ /**
6
+ * An object that enables you to modify, add, and remove UI themes and handle theme-related events. To access this object, use the [`themeEditor`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#themeEditor) property on a Survey Creator instance:
7
+ *
8
+ * ```js
9
+ * const creatorOptions = { ... };
10
+ * const creator = new SurveyCreator.SurveyCreator(creatorOptions);
11
+ * creator.themeEditor.settingName = "value";
12
+ *
13
+ * // In modular applications:
14
+ * import { SurveyCreatorModel } from "survey-creator-core";
15
+ *
16
+ * const creatorOptions = { ... };
17
+ * const creator = new SurveyCreatorModel(creatorOptions);
18
+ * creator.themeEditor.settingName = "value";
19
+ * ```
20
+ */
5
21
  export declare class ThemeTabPlugin implements ICreatorPlugin {
6
22
  private creator;
7
23
  private previewAction;
@@ -35,22 +51,92 @@ export declare class ThemeTabPlugin implements ICreatorPlugin {
35
51
  redo(): void;
36
52
  private updateUndeRedoActions;
37
53
  addFooterActions(): void;
54
+ /**
55
+ * A list of UI themes from which users can select. You can sort this list if you want to reorder themes in Theme Editor.
56
+ * @see addTheme
57
+ * @see removeTheme
58
+ */
38
59
  get availableThemes(): string[];
39
- set availableThemes(availebleThemes: string[]);
60
+ set availableThemes(availableThemes: string[]);
61
+ /**
62
+ * Adds a new UI theme to Theme Editor.
63
+ * @param theme A [UI theme](https://surveyjs.io/form-library/documentation/api-reference/itheme) to add.
64
+ * @param setAsDefault For internal use.
65
+ * @returns An identifier of the added theme, which is a concatenation of the [`themeName`](https://surveyjs.io/form-library/documentation/api-reference/itheme#themeName), [`colorPalette`](https://surveyjs.io/form-library/documentation/api-reference/itheme#colorPalette), and [`isPanelless`](https://surveyjs.io/form-library/documentation/api-reference/itheme#isPanelless) settings (for example, `"default-dark-panelless"`).
66
+ * @see removeTheme
67
+ * @see getCurrentTheme
68
+ */
40
69
  addTheme(theme: ITheme, setAsDefault?: boolean): string;
41
- removeTheme(themeAccessor: string | ITheme, withModifications?: boolean): void;
42
- getCurrentTheme(content?: "full" | "changes"): ITheme;
70
+ /**
71
+ * Removes a UI theme from Theme Editor.
72
+ * @param themeAccessor A [UI theme](https://surveyjs.io/form-library/documentation/api-reference/itheme) to delete or a theme identifier, which is a concatenation of the [`themeName`](https://surveyjs.io/form-library/documentation/api-reference/itheme#themeName), [`colorPalette`](https://surveyjs.io/form-library/documentation/api-reference/itheme#colorPalette), and [`isPanelless`](https://surveyjs.io/form-library/documentation/api-reference/itheme#isPanelless) settings (for example, `"default-dark-panelless"`).
73
+ * @param includeModifications Pass `true` to delete not only the specified UI theme, but also all other themes with the same `themeName` value (dark/light and panelless modifications).
74
+ * @see addTheme
75
+ * @see getCurrentTheme
76
+ */
77
+ removeTheme(themeAccessor: string | ITheme, includeModifications?: boolean): void;
78
+ /**
79
+ * Returns a JSON object that describes the currently applied UI theme.
80
+ * @param changesOnly Pass `true` to get a JSON object that contains only changed theme settings instead of a full theme JSON schema.
81
+ * @returns A currently applied [theme JSON schema](https://surveyjs.io/form-library/documentation/api-reference/itheme).
82
+ * @see availableThemes
83
+ * @see addTheme
84
+ * @see removeTheme
85
+ */
86
+ getCurrentTheme(changesOnly?: boolean): ITheme;
43
87
  getThemeChanges(): ITheme;
44
- get isThemePristine(): boolean;
88
+ /**
89
+ * Indicates whether the selected theme has been modified.
90
+ * @see [`creator.saveTheme()`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveTheme)
91
+ * @see [`creator.saveThemeFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveThemeFunc)
92
+ */
93
+ get isModified(): boolean;
94
+ /**
95
+ * An event that is raised when users select a UI theme from a drop-down list, choose a dark or light color palette, and switch between regular and panelless theme modifications.
96
+ *
97
+ * Parameters:
98
+ *
99
+ * - `sender`: `ThemeTabPlugin`\
100
+ * A `ThemeTabPlugin` instance that raised the event.
101
+ * - `options.theme`: [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme)\
102
+ * A selected theme.
103
+ * @see availableThemes
104
+ * @see addTheme
105
+ * @see removeTheme
106
+ */
45
107
  onThemeSelected: EventBase<ThemeTabPlugin, {
46
108
  theme: ITheme;
47
109
  }>;
48
- onThemeModified: EventBase<ThemeTabPlugin, {
110
+ /**
111
+ * An event that is raised when the value of a property or CSS variable in a theme JSON schema has changed.
112
+ *
113
+ * Parameters:
114
+ *
115
+ * - `sender`: `ThemeTabPlugin`\
116
+ * A `ThemeTabPlugin` instance that raised the event.
117
+ * - `options.name`: `string`\
118
+ * The name of the changed property or CSS variable.
119
+ * - `options.value`: `any`\
120
+ * A new value of the property or CSS variable.
121
+ */
122
+ onThemePropertyChanged: EventBase<ThemeTabPlugin, {
49
123
  name: string;
50
124
  value: any;
51
125
  }>;
52
- onCanModifyTheme: EventBase<ThemeTabPlugin, {
126
+ /**
127
+ * An event that is raised when Theme Editor renders Property Grid. Use this event to switch the current theme to read-only mode.
128
+ *
129
+ * Parameters:
130
+ *
131
+ * - `sender`: `ThemeTabPlugin`\
132
+ * A `ThemeTabPlugin` instance that raised the event.
133
+ * - `options.theme`: [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme)\
134
+ * The current theme.
135
+ * - `options.allow`: `boolean`\
136
+ * A Boolean property that you can set to `false` if you want to disallow theme modifications.
137
+ */
138
+ onAllowModifyTheme: EventBase<ThemeTabPlugin, {
53
139
  theme: ITheme;
54
- canModify: boolean;
140
+ allow: boolean;
55
141
  }>;
56
142
  }
@@ -11,6 +11,7 @@ import { UndoRedoManager } from "./plugins/undo-redo/undo-redo-manager";
11
11
  import { UndoRedoController } from "./plugins/undo-redo/undo-redo-controller";
12
12
  import { SidebarModel } from "./components/side-bar/side-bar-model";
13
13
  import { ICreatorOptions } from "./creator-options";
14
+ import { ThemeTabPlugin } from "./components/tabs/theme-plugin";
14
15
  import { DragDropSurveyElements } from "./survey-elements";
15
16
  import { PageAdorner } from "./components/page";
16
17
  export interface IKeyboardShortcut {
@@ -97,6 +98,8 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
97
98
  * Specifies whether to display the Themes tab.
98
99
  *
99
100
  * Default value: `false`
101
+ *
102
+ * Use the [`themeEditor`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#themeEditor) object to manage UI themes available in the Themes tab.
100
103
  * @see activeTab
101
104
  * @see saveThemeFunc
102
105
  */
@@ -1052,21 +1055,34 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1052
1055
  * @see allowChangeThemeInPreview
1053
1056
  */
1054
1057
  themeForPreview: string;
1058
+ /**
1059
+ * An object that enables you to manage UI themes. Refer to the following API section for information on available properties, methods, and events: [`ThemeTabPlugin`](https://surveyjs.io/survey-creator/documentation/api-reference/themetabplugin).
1060
+ * @see showThemeTab
1061
+ * @see saveThemeFunc
1062
+ */
1063
+ get themeEditor(): ThemeTabPlugin;
1055
1064
  /**
1056
1065
  * A function that is called each time users click the [Save button](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#showSaveButton) or [auto-save](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#isAutoSave) is triggered to save a theme JSON object.
1057
1066
  *
1058
1067
  * For more information, refer to the [Save and Load Custom Themes](https://surveyjs.io/survey-creator/documentation/theme-editor#save-and-load-custom-themes) help topic.
1059
1068
  * @see showThemeTab
1069
+ * @see themeEditor
1060
1070
  * @see saveSurveyFunc
1061
1071
  */
1062
1072
  get saveThemeFunc(): any;
1063
1073
  set saveThemeFunc(value: any);
1064
- isThemeModified: boolean;
1074
+ hasPendingThemeChanges: boolean;
1065
1075
  private _theme;
1066
1076
  get theme(): ITheme;
1067
1077
  set theme(newTheme: ITheme);
1068
1078
  private _doSaveThemeCore;
1069
- doSaveTheme(): void;
1079
+ /**
1080
+ * Calls the [`saveThemeFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveThemeFunc) function to save the theme JSON schema.
1081
+ * @see saveSurvey
1082
+ * @see save
1083
+ */
1084
+ saveTheme(): void;
1085
+ saveThemeActionHandler(): void;
1070
1086
  private _allowModifyPages;
1071
1087
  /**
1072
1088
  * Specifies whether users can add, edit, and delete survey pages.
@@ -1314,12 +1330,10 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1314
1330
  */
1315
1331
  get survey(): SurveyModel;
1316
1332
  private existingPages;
1317
- private isInitialSurveyEmptyValue;
1318
1333
  /**
1319
1334
  * Returns true if initial survey was empty. It was not set via JSON property and default new survey is empty as well.
1320
1335
  * @returns true if initial survey doesn't have any elements or properties
1321
1336
  */
1322
- get isInitialSurveyEmpty(): boolean;
1323
1337
  protected initSurveyWithJSON(json: any, clearState: boolean): void;
1324
1338
  private updatePlugin;
1325
1339
  protected initDragDrop(): void;
@@ -1607,14 +1621,39 @@ export declare class CreatorBase extends Base implements ISurveyCreatorOptions,
1607
1621
  protected doAutoSave(): void;
1608
1622
  saveNo: number;
1609
1623
  private _doSaveCore;
1624
+ /**
1625
+ * Calls the [`saveSurveyFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveSurveyFunc) function to save the survey JSON schema.
1626
+ * @see saveTheme
1627
+ * @see save
1628
+ */
1629
+ saveSurvey(): void;
1610
1630
  doSave(): void;
1631
+ saveSurveyActionHandler(): void;
1611
1632
  private _updateSaveActions;
1612
- doSaveSurveyAndTheme(): void;
1633
+ /**
1634
+ * Calls the [`saveSurveyFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveSurveyFunc) and [`saveThemeFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveThemeFunc) functions to save the survey and theme JSON schemas.
1635
+ * @see saveSurvey
1636
+ * @see saveTheme
1637
+ */
1638
+ save(): void;
1613
1639
  protected _syncSaveActions: (sender: any, options: any) => void;
1614
- saveSurveyAndTheme: boolean;
1640
+ /**
1641
+ * Specifies whether to synchronize [Save buttons](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#showSaveButton) in the Designer and Themes tabs.
1642
+ *
1643
+ * Default value: `false`
1644
+ *
1645
+ * When this property is disabled, the Save button in the Designer tab saves only the survey JSON schema, while the Save button in the Themes tab saves only the theme JSON schema. If you enable this property, both buttons will save both JSON schemas.
1646
+ * @see saveSurveyFunc
1647
+ * @see saveThemeFunc
1648
+ * @see save
1649
+ */
1650
+ syncSaveButtons: boolean;
1615
1651
  /**
1616
1652
  * Specifies whether to display a button that saves the survey or theme (executes the [`saveSurveyFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveSurveyFunc) or [`saveThemeFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveThemeFunc) function).
1653
+ *
1654
+ * Default value: `false`
1617
1655
  * @see isAutoSave
1656
+ * @see syncSaveButtons
1618
1657
  */
1619
1658
  showSaveButton: boolean;
1620
1659
  /**
@@ -1,8 +1,15 @@
1
1
  /**
2
- * Survey Creator configuration. Pass it as an argument to the `SurveyCreator` constructor:
2
+ * Survey Creator configuration. Pass it as an argument to the `SurveyCreator`/`SurveyCreatorModel` constructor:
3
3
  *
4
4
  * ```js
5
+ * const creatorOptions = { ... };
5
6
  * const creator = new SurveyCreator.SurveyCreator(creatorOptions);
7
+ *
8
+ * // In modular applications:
9
+ * import { SurveyCreatorModel } from "survey-creator-core";
10
+ *
11
+ * const creatorOptions = { ... };
12
+ * const creator = new SurveyCreatorModel(creatorOptions);
6
13
  * ```
7
14
  */
8
15
  export interface ICreatorOptions {
@@ -23,7 +23,8 @@ export declare var propertyGridCss: {
23
23
  panel: {
24
24
  title: string;
25
25
  titleExpandable: string;
26
- titleOnExpand: string;
26
+ titleExpanded: string;
27
+ titleCollapsed: string;
27
28
  titleOnError: string;
28
29
  description: string;
29
30
  container: string;
@@ -1,4 +1,4 @@
1
- import { Base, ISurveyElement, ItemValue, JsonObjectProperty, SurveyElement, SurveyModel } from "survey-core";
1
+ import { Base, ISurveyElement, ItemValue, JsonObjectProperty, SurveyElement, SurveyModel, PageModel } from "survey-core";
2
2
  import { ISurveyCreatorOptions } from "./creator-settings";
3
3
  export declare enum ObjType {
4
4
  Unknown = "unknown",
@@ -12,6 +12,7 @@ export declare class SurveyHelper {
12
12
  static getNewElementName(el: ISurveyElement): string;
13
13
  static getNewPageName(objs: Array<any>): string;
14
14
  static isPageNameAutoGenerated(name: string): boolean;
15
+ static isPagePropertiesAreModified(page: PageModel): boolean;
15
16
  static getNewQuestionName(objs: Array<any>): string;
16
17
  static getNewPanelName(objs: Array<any>): string;
17
18
  static generateNewName(name: string): string;
@@ -37,6 +37,13 @@ export interface IQuestionToolboxItem extends IAction {
37
37
  export interface IQuestionToolbox {
38
38
  toggleCategoryState(name: string): any;
39
39
  }
40
+ export interface IToolboxCategoryDefinition {
41
+ category: string;
42
+ items: Array<string | {
43
+ name: string;
44
+ title?: string;
45
+ }>;
46
+ }
40
47
  export declare class QuestionToolboxCategory extends Base {
41
48
  private toolbox;
42
49
  constructor(toolbox: IQuestionToolbox);
@@ -221,6 +228,35 @@ export declare class QuestionToolbox extends AdaptiveActionContainer<QuestionToo
221
228
  * @param changedItems the array of objects {name: "your toolbox item name", category: "new category name"}
222
229
  */
223
230
  changeCategories(changedItems: Array<any>): void;
231
+ /**
232
+ * Defines toolbox categories from scratch.
233
+ *
234
+ * This method accepts an array of objects as the `categories` parameter. Each object defines a single category and lists items included into it. Unlisted items can be collected in the Misc category if you pass `true` as the `displayMisc` parameter. Optionally, you can override display titles for individual items.
235
+ *
236
+ * The following code defines two toolbox categories: Dropdowns and Text Input. Items that do not fall into either category are collected in Misc. The `"comment"` item has a custom display title.
237
+ *
238
+ * ```
239
+ * creator.toolbox.defineCategories([{
240
+ * category: "Dropdowns",
241
+ * items: [
242
+ * "dropdown",
243
+ * "tagbox"
244
+ * ]
245
+ * }, {
246
+ * category: "Text Input",
247
+ * items: [
248
+ * "text",
249
+ * // Override the display title
250
+ * { name: "comment", title: "Multi-Line Input" }
251
+ * ]
252
+ * }], true);
253
+ * ```
254
+ *
255
+ * [View Demo](https://surveyjs.io/survey-creator/examples/survey-toolbox-categories/ (linkStyle))
256
+ * @param categories An array of new categories.
257
+ * @param displayMisc Pass `true` if you want to collect unlisted toolbox items in the Misc category. Default value: `false`.
258
+ */
259
+ defineCategories(categories: Array<IToolboxCategoryDefinition>, displayMisc?: boolean): void;
224
260
  /**
225
261
  * Removes categories from the Toolbox.
226
262
  */
@@ -252,7 +288,7 @@ export declare class QuestionToolbox extends AdaptiveActionContainer<QuestionToo
252
288
  hiddenItemSelected(model: Action): void;
253
289
  private expandCollapseAllCategories;
254
290
  private getCategoryByName;
255
- protected onItemsChanged(): void;
291
+ protected onItemsChanged(changeActions?: boolean): void;
256
292
  protected createCategory(): QuestionToolboxCategory;
257
293
  private indexOf;
258
294
  private updateItemSeparators;