survey-creator-core 1.9.118 → 1.9.120
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.
- package/fonts.fontless.css +1 -1
- package/fonts.fontless.min.css +1 -1
- package/i18n/arabic.js +1 -1
- package/i18n/arabic.min.js +1 -1
- package/i18n/bulgarian.js +1 -1
- package/i18n/bulgarian.min.js +1 -1
- package/i18n/croatian.js +1 -1
- package/i18n/croatian.min.js +1 -1
- package/i18n/czech.js +1 -1
- package/i18n/czech.min.js +1 -1
- package/i18n/danish.js +1 -1
- package/i18n/danish.min.js +1 -1
- package/i18n/dutch.js +1 -1
- package/i18n/dutch.min.js +1 -1
- package/i18n/english.js +2 -1
- package/i18n/english.js.map +1 -1
- package/i18n/english.min.js +2 -2
- package/i18n/finnish.js +1 -1
- package/i18n/finnish.min.js +1 -1
- package/i18n/french.js +1 -1
- package/i18n/french.min.js +1 -1
- package/i18n/german.js +1 -1
- package/i18n/german.min.js +1 -1
- package/i18n/hungarian.js +1 -1
- package/i18n/hungarian.min.js +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.min.js +1 -1
- package/i18n/indonesian.js +1 -1
- package/i18n/indonesian.min.js +1 -1
- package/i18n/italian.js +1 -1
- package/i18n/italian.min.js +1 -1
- package/i18n/japanese.js +1 -1
- package/i18n/japanese.min.js +1 -1
- package/i18n/korean.js +1 -1
- package/i18n/korean.min.js +1 -1
- package/i18n/malay.js +1 -1
- package/i18n/malay.min.js +1 -1
- package/i18n/mongolian.js +1 -1
- package/i18n/mongolian.min.js +1 -1
- package/i18n/norwegian.js +1 -1
- package/i18n/norwegian.min.js +1 -1
- package/i18n/persian.js +1 -1
- package/i18n/persian.min.js +1 -1
- package/i18n/polish.js +1 -1
- package/i18n/polish.min.js +1 -1
- package/i18n/portuguese.js +1 -1
- package/i18n/portuguese.min.js +1 -1
- package/i18n/russian.js +1 -1
- package/i18n/russian.min.js +1 -1
- package/i18n/simplified-chinese.js +1 -1
- package/i18n/simplified-chinese.min.js +1 -1
- package/i18n/slovak.js +1 -1
- package/i18n/slovak.min.js +1 -1
- package/i18n/spanish.js +1 -1
- package/i18n/spanish.min.js +1 -1
- package/i18n/swedish.js +1 -1
- package/i18n/swedish.min.js +1 -1
- package/i18n/tajik.js +1 -1
- package/i18n/tajik.min.js +1 -1
- package/i18n/traditional-chinese.js +1 -1
- package/i18n/traditional-chinese.min.js +1 -1
- package/i18n/turkish.js +1 -1
- package/i18n/turkish.min.js +1 -1
- package/package.json +2 -2
- package/survey-creator-core.css +35 -9
- package/survey-creator-core.fontless.css +34 -8
- package/survey-creator-core.fontless.css.map +1 -1
- package/survey-creator-core.fontless.min.css +4 -4
- package/survey-creator-core.i18n.js +1 -1
- package/survey-creator-core.i18n.min.js +1 -1
- package/survey-creator-core.js +393 -128
- package/survey-creator-core.js.map +1 -1
- package/survey-creator-core.min.css +5 -5
- package/survey-creator-core.min.js +5 -5
- package/typings/components/item-value.d.ts +1 -0
- package/typings/components/results.d.ts +4 -2
- package/typings/components/tabs/theme-builder.d.ts +6 -5
- package/typings/components/tabs/theme-plugin.d.ts +93 -7
- package/typings/creator-base.d.ts +45 -6
- package/typings/creator-options.d.ts +8 -1
- package/typings/editorLocalization.d.ts +1 -0
- package/typings/localization/english.d.ts +1 -0
- package/typings/property-grid/index.d.ts +4 -0
- package/typings/property-grid/search-manager.d.ts +2 -0
- package/typings/property-grid-theme/property-grid.d.ts +2 -1
- package/typings/survey-helper.d.ts +2 -1
- package/typings/toolbox.d.ts +37 -1
package/survey-creator-core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SurveyJS Creator v1.9.
|
|
2
|
+
* SurveyJS Creator v1.9.120
|
|
3
3
|
* (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* Github: https://github.com/surveyjs/survey-creator
|
|
5
5
|
* License: https://surveyjs.io/Licenses#SurveyCreator
|
|
@@ -130,7 +130,7 @@ License: MIT
|
|
|
130
130
|
/***/ (function(module, exports, __webpack_require__) {
|
|
131
131
|
|
|
132
132
|
/*!
|
|
133
|
-
* surveyjs - Survey JavaScript library v1.9.
|
|
133
|
+
* surveyjs - Survey JavaScript library v1.9.120
|
|
134
134
|
* Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
135
135
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
136
136
|
*/
|
|
@@ -4862,7 +4862,9 @@ var LogoImageViewModel = /** @class */ (function (_super) {
|
|
|
4862
4862
|
}
|
|
4863
4863
|
Object.defineProperty(LogoImageViewModel.prototype, "allowEdit", {
|
|
4864
4864
|
get: function () {
|
|
4865
|
-
|
|
4865
|
+
var survey = this.creator.survey;
|
|
4866
|
+
var property = survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findProperty(survey.getType(), "logo");
|
|
4867
|
+
return !this.creator.readOnly && (!property.overridingProperty || !survey[property.overridingProperty]);
|
|
4866
4868
|
},
|
|
4867
4869
|
enumerable: false,
|
|
4868
4870
|
configurable: true
|
|
@@ -5336,7 +5338,7 @@ var ItemValueWrapperViewModel = /** @class */ (function (_super) {
|
|
|
5336
5338
|
}, 100);
|
|
5337
5339
|
};
|
|
5338
5340
|
ItemValueWrapperViewModel.prototype.updateIsNew = function (question, item) {
|
|
5339
|
-
this.isNew = !question.isItemInList(item);
|
|
5341
|
+
this.isNew = !question.isItemInList(item) && !this.isAutoGeneratedItem(item);
|
|
5340
5342
|
};
|
|
5341
5343
|
Object.defineProperty(ItemValueWrapperViewModel.prototype, "allowRemove", {
|
|
5342
5344
|
get: function () {
|
|
@@ -5344,7 +5346,8 @@ var ItemValueWrapperViewModel = /** @class */ (function (_super) {
|
|
|
5344
5346
|
if (minChoices > 0 && minChoices >= this.question.choices.length)
|
|
5345
5347
|
return false;
|
|
5346
5348
|
var isNew = !this.question.isItemInList(this.item);
|
|
5347
|
-
|
|
5349
|
+
var isAutoGenerated = this.isAutoGeneratedItem(this.item);
|
|
5350
|
+
return !this.creator.readOnly && this.canTouchItems && (this.allowItemOperations.allowDelete) && !isNew && !isAutoGenerated;
|
|
5348
5351
|
},
|
|
5349
5352
|
enumerable: false,
|
|
5350
5353
|
configurable: true
|
|
@@ -5366,7 +5369,8 @@ var ItemValueWrapperViewModel = /** @class */ (function (_super) {
|
|
|
5366
5369
|
Object.defineProperty(ItemValueWrapperViewModel.prototype, "allowAdd", {
|
|
5367
5370
|
get: function () {
|
|
5368
5371
|
var isNew = !this.question.isItemInList(this.item);
|
|
5369
|
-
|
|
5372
|
+
var isAutoGenerated = this.isAutoGeneratedItem(this.item);
|
|
5373
|
+
return !this.creator.readOnly && this.canTouchItems && (this.allowItemOperations.allowAdd) && isNew && !isAutoGenerated;
|
|
5370
5374
|
},
|
|
5371
5375
|
enumerable: false,
|
|
5372
5376
|
configurable: true
|
|
@@ -5377,6 +5381,16 @@ var ItemValueWrapperViewModel = /** @class */ (function (_super) {
|
|
|
5377
5381
|
model.creator.selectElement(model.question, "choices", false);
|
|
5378
5382
|
event && event.stopPropagation();
|
|
5379
5383
|
};
|
|
5384
|
+
ItemValueWrapperViewModel.prototype.isAutoGeneratedItem = function (item) {
|
|
5385
|
+
var val = item.value;
|
|
5386
|
+
if (!survey_core__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isNumber(val))
|
|
5387
|
+
return false;
|
|
5388
|
+
var min = this.question.choicesMin;
|
|
5389
|
+
var max = this.question.choicesMax;
|
|
5390
|
+
if (!survey_core__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isNumber(min) || !survey_core__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isNumber(max))
|
|
5391
|
+
return false;
|
|
5392
|
+
return val >= min && val <= max;
|
|
5393
|
+
};
|
|
5380
5394
|
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
|
|
5381
5395
|
Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false })
|
|
5382
5396
|
], ItemValueWrapperViewModel.prototype, "isNew", void 0);
|
|
@@ -7274,15 +7288,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7274
7288
|
__webpack_require__(/*! ./results.scss */ "./src/components/results.scss");
|
|
7275
7289
|
var SurveyResultsItemModel = /** @class */ (function (_super) {
|
|
7276
7290
|
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SurveyResultsItemModel, _super);
|
|
7277
|
-
function SurveyResultsItemModel(_data, _lvl) {
|
|
7291
|
+
function SurveyResultsItemModel(survey, _data, _lvl) {
|
|
7278
7292
|
var _this = _super.call(this) || this;
|
|
7293
|
+
_this.survey = survey;
|
|
7279
7294
|
_this._data = _data;
|
|
7280
7295
|
_this._lvl = _lvl;
|
|
7281
7296
|
_this.toggle = function () {
|
|
7282
7297
|
_this.collapsed = !_this.collapsed;
|
|
7283
7298
|
};
|
|
7284
7299
|
_this.markerWidth = 16;
|
|
7285
|
-
_this.
|
|
7300
|
+
_this.question = survey.getQuestionByName(_this.name);
|
|
7301
|
+
_this.items = addCollapsed(survey, _data.data, _lvl + 1);
|
|
7286
7302
|
_this.lvl = _lvl;
|
|
7287
7303
|
return _this;
|
|
7288
7304
|
}
|
|
@@ -7357,10 +7373,10 @@ var SurveyResultsItemModel = /** @class */ (function (_super) {
|
|
|
7357
7373
|
return SurveyResultsItemModel;
|
|
7358
7374
|
}(survey_core__WEBPACK_IMPORTED_MODULE_2__["Base"]));
|
|
7359
7375
|
|
|
7360
|
-
function addCollapsed(items, initLvl) {
|
|
7376
|
+
function addCollapsed(survey, items, initLvl) {
|
|
7361
7377
|
if (items === void 0) { items = []; }
|
|
7362
7378
|
return items.filter(function (item) { return !!item; }).map(function (item) {
|
|
7363
|
-
return new SurveyResultsItemModel(item, initLvl);
|
|
7379
|
+
return new SurveyResultsItemModel(survey, item, initLvl);
|
|
7364
7380
|
});
|
|
7365
7381
|
}
|
|
7366
7382
|
var SurveyResultsModel = /** @class */ (function (_super) {
|
|
@@ -7376,7 +7392,7 @@ var SurveyResultsModel = /** @class */ (function (_super) {
|
|
|
7376
7392
|
};
|
|
7377
7393
|
_this.resultText = JSON.stringify(survey.data, null, 4);
|
|
7378
7394
|
var plainData = survey.getPlainData({ includeEmpty: false, includeValues: true });
|
|
7379
|
-
_this.resultData = addCollapsed(plainData, 0);
|
|
7395
|
+
_this.resultData = addCollapsed(survey, plainData, 0);
|
|
7380
7396
|
return _this;
|
|
7381
7397
|
}
|
|
7382
7398
|
SurveyResultsModel.prototype.getLocString = function (name) {
|
|
@@ -8995,7 +9011,7 @@ var TabDesignerPlugin = /** @class */ (function () {
|
|
|
8995
9011
|
this.saveSurveyAction = new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
|
|
8996
9012
|
id: "svd-save",
|
|
8997
9013
|
iconName: "icon-save",
|
|
8998
|
-
action: function () { return _this.creator.
|
|
9014
|
+
action: function () { return _this.creator.saveSurveyActionHandler(); },
|
|
8999
9015
|
active: false,
|
|
9000
9016
|
enabled: false,
|
|
9001
9017
|
visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () {
|
|
@@ -9232,19 +9248,12 @@ var TabDesignerViewModel = /** @class */ (function (_super) {
|
|
|
9232
9248
|
this.cssUpdater && this.cssUpdater.dispose();
|
|
9233
9249
|
};
|
|
9234
9250
|
TabDesignerViewModel.prototype.checkLastPageToDelete = function () {
|
|
9235
|
-
if (this.survey.pageCount === 0)
|
|
9236
|
-
return false;
|
|
9237
|
-
if (this.survey.pageCount === 1 && !this.creator.isInitialSurveyEmpty)
|
|
9251
|
+
if (this.survey.pageCount === 0 || this.survey.isQuestionDragging)
|
|
9238
9252
|
return false;
|
|
9239
9253
|
var lastPage = this.survey.pages[this.survey.pageCount - 1];
|
|
9240
9254
|
if (lastPage.elements.length > 0 || lastPage.isConverting)
|
|
9241
9255
|
return false;
|
|
9242
|
-
if (
|
|
9243
|
-
return false;
|
|
9244
|
-
var json = lastPage.toJSON();
|
|
9245
|
-
delete json["name"];
|
|
9246
|
-
//If there is at least one property in page is set, then return
|
|
9247
|
-
for (var key in json)
|
|
9256
|
+
if (_survey_helper__WEBPACK_IMPORTED_MODULE_4__["SurveyHelper"].isPagePropertiesAreModified(lastPage))
|
|
9248
9257
|
return false;
|
|
9249
9258
|
lastPage.delete();
|
|
9250
9259
|
if (this.survey.pageCount === 0) {
|
|
@@ -14504,8 +14513,9 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14504
14513
|
_this._availableThemes = _themes__WEBPACK_IMPORTED_MODULE_11__["PredefinedThemes"];
|
|
14505
14514
|
_this.prevQuestionValues = {};
|
|
14506
14515
|
_this.onThemeSelected = new survey_core__WEBPACK_IMPORTED_MODULE_2__["EventBase"]();
|
|
14507
|
-
_this.
|
|
14508
|
-
_this.
|
|
14516
|
+
_this.onThemePropertyChanged = new survey_core__WEBPACK_IMPORTED_MODULE_2__["EventBase"]();
|
|
14517
|
+
_this.onAllowModifyTheme = new survey_core__WEBPACK_IMPORTED_MODULE_2__["EventBase"]();
|
|
14518
|
+
_this._defaultSessionTheme = ThemeBuilder.DefaultTheme;
|
|
14509
14519
|
_this.creatorPropertyChanged = function (sender, options) {
|
|
14510
14520
|
if (options.name === "isMobileView") {
|
|
14511
14521
|
_this.updateVisibilityOfPropertyGridGroups();
|
|
@@ -14522,7 +14532,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14522
14532
|
_this.backgroundImageAttachment = _this.surveyProvider.theme.backgroundImageAttachment !== undefined ? _this.surveyProvider.theme.backgroundImageAttachment : surveyProvider.survey.backgroundImageAttachment;
|
|
14523
14533
|
_this.backgroundOpacity = ((_this.surveyProvider.theme.backgroundOpacity !== undefined ? _this.surveyProvider.theme.backgroundOpacity : surveyProvider.survey.backgroundOpacity) || 1) * 100;
|
|
14524
14534
|
_this.loadTheme(_this.surveyProvider.theme);
|
|
14525
|
-
_this.surveyProvider.
|
|
14535
|
+
_this.surveyProvider.hasPendingThemeChanges = false;
|
|
14526
14536
|
_this.undoRedoManager = new _plugins_undo_redo_undo_redo_manager__WEBPACK_IMPORTED_MODULE_10__["UndoRedoManager"]();
|
|
14527
14537
|
_this.surveyProvider.onPropertyChanged.add(_this.creatorPropertyChanged);
|
|
14528
14538
|
return _this;
|
|
@@ -14542,19 +14552,6 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14542
14552
|
}
|
|
14543
14553
|
return (_themeName || this.themeName) + "-" + this.themePalette;
|
|
14544
14554
|
};
|
|
14545
|
-
Object.defineProperty(ThemeBuilder.prototype, "activeLanguage", {
|
|
14546
|
-
get: function () {
|
|
14547
|
-
return this.getPropertyValue("activeLanguage", this.survey.locale || survey_core__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].defaultLocale);
|
|
14548
|
-
},
|
|
14549
|
-
set: function (val) {
|
|
14550
|
-
if (val === this.activeLanguage)
|
|
14551
|
-
return;
|
|
14552
|
-
this.setPropertyValue("activeLanguage", val);
|
|
14553
|
-
this.survey.locale = val;
|
|
14554
|
-
},
|
|
14555
|
-
enumerable: false,
|
|
14556
|
-
configurable: true
|
|
14557
|
-
});
|
|
14558
14555
|
Object.defineProperty(ThemeBuilder.prototype, "survey", {
|
|
14559
14556
|
get: function () {
|
|
14560
14557
|
return this.simulator.survey;
|
|
@@ -14648,8 +14645,18 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14648
14645
|
this.blockThemeChangedNotifications -= 1;
|
|
14649
14646
|
}
|
|
14650
14647
|
};
|
|
14648
|
+
Object.defineProperty(ThemeBuilder.prototype, "defaultSessionTheme", {
|
|
14649
|
+
get: function () {
|
|
14650
|
+
return this._defaultSessionTheme;
|
|
14651
|
+
},
|
|
14652
|
+
set: function (theme) {
|
|
14653
|
+
this._defaultSessionTheme = theme;
|
|
14654
|
+
},
|
|
14655
|
+
enumerable: false,
|
|
14656
|
+
configurable: true
|
|
14657
|
+
});
|
|
14651
14658
|
ThemeBuilder.prototype.resetTheme = function () {
|
|
14652
|
-
this.setTheme({});
|
|
14659
|
+
this.setTheme({ themeName: this.defaultSessionTheme.themeName, isPanelless: this.defaultSessionTheme.isPanelless, colorPalette: this.defaultSessionTheme.colorPalette });
|
|
14653
14660
|
};
|
|
14654
14661
|
ThemeBuilder.prototype.setTheme = function (theme) {
|
|
14655
14662
|
this.themeCssVariablesChanges = {};
|
|
@@ -14662,7 +14669,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14662
14669
|
};
|
|
14663
14670
|
ThemeBuilder.prototype.selectTheme = function (themeName, themePalette, themeMode) {
|
|
14664
14671
|
if (themePalette === void 0) { themePalette = "light"; }
|
|
14665
|
-
if (themeMode === void 0) { themeMode = "
|
|
14672
|
+
if (themeMode === void 0) { themeMode = "panels"; }
|
|
14666
14673
|
this.themeName = themeName;
|
|
14667
14674
|
this.themePalette = themePalette;
|
|
14668
14675
|
this.themeMode = themeMode;
|
|
@@ -14680,6 +14687,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14680
14687
|
component: "svc-complete-page",
|
|
14681
14688
|
data: this
|
|
14682
14689
|
});
|
|
14690
|
+
newSurvey.locale = json.locale;
|
|
14683
14691
|
this.simulator.survey = newSurvey;
|
|
14684
14692
|
this.updateSimulatorTheme();
|
|
14685
14693
|
if (this.onSurveyCreatedCallback)
|
|
@@ -14780,7 +14788,6 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
14780
14788
|
ThemeBuilder.prototype.show = function () {
|
|
14781
14789
|
this.showInvisibleElements = false;
|
|
14782
14790
|
this.activePage = this.survey.activePage;
|
|
14783
|
-
this.survey.locale = this.activeLanguage;
|
|
14784
14791
|
this.isRunning = true;
|
|
14785
14792
|
};
|
|
14786
14793
|
ThemeBuilder.prototype.testAgain = function () {
|
|
@@ -15208,12 +15215,12 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
15208
15215
|
var canModify = !this.surveyProvider.readOnly;
|
|
15209
15216
|
var options = {
|
|
15210
15217
|
theme: this.currentTheme,
|
|
15211
|
-
|
|
15218
|
+
allow: canModify
|
|
15212
15219
|
};
|
|
15213
|
-
this.
|
|
15220
|
+
this.onAllowModifyTheme.fire(this, options);
|
|
15214
15221
|
this.themeEditorSurvey.getAllQuestions().forEach(function (q) {
|
|
15215
15222
|
if (["themeName", "themePalette", "themeMode"].indexOf(q.name) === -1) {
|
|
15216
|
-
q.readOnly = !options.
|
|
15223
|
+
q.readOnly = !options.allow;
|
|
15217
15224
|
}
|
|
15218
15225
|
});
|
|
15219
15226
|
if (!!this.survey) {
|
|
@@ -15284,7 +15291,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
15284
15291
|
var _this = this;
|
|
15285
15292
|
var saveThemeFunc = this.saveThemeFunc;
|
|
15286
15293
|
if (!saveThemeFunc && this.surveyProvider.saveThemeFunc) {
|
|
15287
|
-
saveThemeFunc = function () { return _this.surveyProvider.
|
|
15294
|
+
saveThemeFunc = function () { return _this.surveyProvider.saveTheme(); };
|
|
15288
15295
|
}
|
|
15289
15296
|
if (!saveThemeFunc) {
|
|
15290
15297
|
return;
|
|
@@ -15309,8 +15316,8 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
15309
15316
|
this.onThemeSelected.fire(this, options);
|
|
15310
15317
|
}
|
|
15311
15318
|
else {
|
|
15312
|
-
this.surveyProvider.
|
|
15313
|
-
this.
|
|
15319
|
+
this.surveyProvider.hasPendingThemeChanges = true;
|
|
15320
|
+
this.onThemePropertyChanged.fire(this, options);
|
|
15314
15321
|
}
|
|
15315
15322
|
if (this.surveyProvider.isAutoSave) {
|
|
15316
15323
|
this.processAutoSave();
|
|
@@ -15320,14 +15327,15 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
15320
15327
|
ThemeBuilder.prototype.getDefaultTitleSetting = function (isAdvanced) {
|
|
15321
15328
|
var result = { family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily, weight: "700", size: 32 };
|
|
15322
15329
|
if (isAdvanced) {
|
|
15323
|
-
result["color"] = "rgba(
|
|
15330
|
+
result["color"] = "rgba(255, 255, 255, 1)";
|
|
15324
15331
|
}
|
|
15325
15332
|
return result;
|
|
15326
15333
|
};
|
|
15327
15334
|
ThemeBuilder.prototype.getDefaultDescriptionSetting = function (isAdvanced) {
|
|
15328
15335
|
var result = { family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily, weight: "400", size: 16 };
|
|
15329
15336
|
if (isAdvanced) {
|
|
15330
|
-
result["color"] = "rgba(
|
|
15337
|
+
result["color"] = "rgba(255, 255, 255, 1)";
|
|
15338
|
+
result["weight"] = "600";
|
|
15331
15339
|
}
|
|
15332
15340
|
return result;
|
|
15333
15341
|
};
|
|
@@ -15401,7 +15409,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
|
|
|
15401
15409
|
{
|
|
15402
15410
|
"headerView": "basic",
|
|
15403
15411
|
"logoPosition": "right",
|
|
15404
|
-
"inheritWidthFrom": "
|
|
15412
|
+
"inheritWidthFrom": "container",
|
|
15405
15413
|
"backgroundColorSwitch": "accentColor",
|
|
15406
15414
|
"backgroundImageFit": "cover",
|
|
15407
15415
|
"backgroundImageOpacity": 100,
|
|
@@ -16630,6 +16638,22 @@ function getObjectDiffs(obj1, obj2) {
|
|
|
16630
16638
|
});
|
|
16631
16639
|
return result;
|
|
16632
16640
|
}
|
|
16641
|
+
/**
|
|
16642
|
+
* 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:
|
|
16643
|
+
*
|
|
16644
|
+
* ```js
|
|
16645
|
+
* const creatorOptions = { ... };
|
|
16646
|
+
* const creator = new SurveyCreator.SurveyCreator(creatorOptions);
|
|
16647
|
+
* creator.themeEditor.settingName = "value";
|
|
16648
|
+
*
|
|
16649
|
+
* // In modular applications:
|
|
16650
|
+
* import { SurveyCreatorModel } from "survey-creator-core";
|
|
16651
|
+
*
|
|
16652
|
+
* const creatorOptions = { ... };
|
|
16653
|
+
* const creator = new SurveyCreatorModel(creatorOptions);
|
|
16654
|
+
* creator.themeEditor.settingName = "value";
|
|
16655
|
+
* ```
|
|
16656
|
+
*/
|
|
16633
16657
|
var ThemeTabPlugin = /** @class */ (function () {
|
|
16634
16658
|
function ThemeTabPlugin(creator) {
|
|
16635
16659
|
var _this = this;
|
|
@@ -16637,9 +16661,46 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16637
16661
|
this.simulatorTheme = survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyCss"][survey_core__WEBPACK_IMPORTED_MODULE_0__["defaultV2ThemeName"]];
|
|
16638
16662
|
this._availableThemes = [].concat(_themes__WEBPACK_IMPORTED_MODULE_4__["PredefinedThemes"]);
|
|
16639
16663
|
this.saveToFileHandler = _utils_utils__WEBPACK_IMPORTED_MODULE_5__["saveToFileHandler"];
|
|
16664
|
+
/**
|
|
16665
|
+
* 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.
|
|
16666
|
+
*
|
|
16667
|
+
* Parameters:
|
|
16668
|
+
*
|
|
16669
|
+
* - `sender`: `ThemeTabPlugin`\
|
|
16670
|
+
* A `ThemeTabPlugin` instance that raised the event.
|
|
16671
|
+
* - `options.theme`: [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme)\
|
|
16672
|
+
* A selected theme.
|
|
16673
|
+
* @see availableThemes
|
|
16674
|
+
* @see addTheme
|
|
16675
|
+
* @see removeTheme
|
|
16676
|
+
*/
|
|
16640
16677
|
this.onThemeSelected = new survey_core__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
|
|
16641
|
-
|
|
16642
|
-
|
|
16678
|
+
/**
|
|
16679
|
+
* An event that is raised when the value of a property or CSS variable in a theme JSON schema has changed.
|
|
16680
|
+
*
|
|
16681
|
+
* Parameters:
|
|
16682
|
+
*
|
|
16683
|
+
* - `sender`: `ThemeTabPlugin`\
|
|
16684
|
+
* A `ThemeTabPlugin` instance that raised the event.
|
|
16685
|
+
* - `options.name`: `string`\
|
|
16686
|
+
* The name of the changed property or CSS variable.
|
|
16687
|
+
* - `options.value`: `any`\
|
|
16688
|
+
* A new value of the property or CSS variable.
|
|
16689
|
+
*/
|
|
16690
|
+
this.onThemePropertyChanged = new survey_core__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
|
|
16691
|
+
/**
|
|
16692
|
+
* An event that is raised when Theme Editor renders Property Grid. Use this event to switch the current theme to read-only mode.
|
|
16693
|
+
*
|
|
16694
|
+
* Parameters:
|
|
16695
|
+
*
|
|
16696
|
+
* - `sender`: `ThemeTabPlugin`\
|
|
16697
|
+
* A `ThemeTabPlugin` instance that raised the event.
|
|
16698
|
+
* - `options.theme`: [`ITheme`](https://surveyjs.io/form-library/documentation/api-reference/itheme)\
|
|
16699
|
+
* The current theme.
|
|
16700
|
+
* - `options.allow`: `boolean`\
|
|
16701
|
+
* A Boolean property that you can set to `false` if you want to disallow theme modifications.
|
|
16702
|
+
*/
|
|
16703
|
+
this.onAllowModifyTheme = new survey_core__WEBPACK_IMPORTED_MODULE_0__["EventBase"]();
|
|
16643
16704
|
creator.addPluginTab("theme", this, "ed.themeSurvey");
|
|
16644
16705
|
this.simulatorTheme = survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyCss"][survey_core__WEBPACK_IMPORTED_MODULE_0__["defaultV2ThemeName"]];
|
|
16645
16706
|
this.createActions().forEach(function (action) { return creator.toolbar.actions.push(action); });
|
|
@@ -16711,24 +16772,27 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16711
16772
|
}
|
|
16712
16773
|
});
|
|
16713
16774
|
this.model.onThemeSelected.add(function (sender, options) {
|
|
16775
|
+
_this.resetTheme.enabled = Object(_themes__WEBPACK_IMPORTED_MODULE_4__["getThemeFullName"])(sender.defaultSessionTheme) !== Object(_themes__WEBPACK_IMPORTED_MODULE_4__["getThemeFullName"])(options.theme);
|
|
16714
16776
|
_this.saveThemeAction.enabled = true;
|
|
16715
16777
|
_this.onThemeSelected.fire(_this, options);
|
|
16716
16778
|
});
|
|
16717
|
-
this.model.
|
|
16779
|
+
this.model.onThemePropertyChanged.add(function (sender, options) {
|
|
16780
|
+
_this.resetTheme.enabled = true;
|
|
16718
16781
|
_this.saveThemeAction.enabled = true;
|
|
16719
|
-
_this.
|
|
16782
|
+
_this.onThemePropertyChanged.fire(_this, options);
|
|
16720
16783
|
});
|
|
16721
|
-
this.model.
|
|
16722
|
-
_this.
|
|
16784
|
+
this.model.onAllowModifyTheme.add(function (sender, options) {
|
|
16785
|
+
_this.onAllowModifyTheme.fire(_this, options);
|
|
16723
16786
|
});
|
|
16787
|
+
this.resetTheme.enabled = Object(_themes__WEBPACK_IMPORTED_MODULE_4__["getThemeFullName"])(this.model.defaultSessionTheme) !== Object(_themes__WEBPACK_IMPORTED_MODULE_4__["getThemeFullName"])(this.creator.theme) || this.isModified;
|
|
16724
16788
|
};
|
|
16725
16789
|
ThemeTabPlugin.prototype.deactivate = function () {
|
|
16726
16790
|
if (this.model) {
|
|
16727
16791
|
this.simulatorTheme = this.model.simulator.survey.css;
|
|
16728
16792
|
this.model.onPropertyChanged.clear();
|
|
16729
16793
|
this.model.onThemeSelected.clear();
|
|
16730
|
-
this.model.
|
|
16731
|
-
this.model.
|
|
16794
|
+
this.model.onThemePropertyChanged.clear();
|
|
16795
|
+
this.model.onAllowModifyTheme.clear();
|
|
16732
16796
|
this.model.onSurveyCreatedCallback = undefined;
|
|
16733
16797
|
this.model.dispose();
|
|
16734
16798
|
this.model = undefined;
|
|
@@ -16821,7 +16885,7 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16821
16885
|
id: "svd-save-theme",
|
|
16822
16886
|
iconName: "icon-save",
|
|
16823
16887
|
action: function () {
|
|
16824
|
-
_this.creator.
|
|
16888
|
+
_this.creator.saveThemeActionHandler();
|
|
16825
16889
|
_this.saveThemeAction.enabled = false;
|
|
16826
16890
|
},
|
|
16827
16891
|
active: false,
|
|
@@ -16835,7 +16899,7 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16835
16899
|
});
|
|
16836
16900
|
items.push(this.saveThemeAction);
|
|
16837
16901
|
this.resetTheme = new survey_core__WEBPACK_IMPORTED_MODULE_0__["Action"]({
|
|
16838
|
-
id: "
|
|
16902
|
+
id: "svc-reset-theme",
|
|
16839
16903
|
iconName: "icon-reset",
|
|
16840
16904
|
locTitleName: "ed.themeResetButton",
|
|
16841
16905
|
locTooltipName: "ed.themeResetButton",
|
|
@@ -16956,18 +17020,31 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16956
17020
|
this.creator.footerToolbar.actions.push(this.themeSettingsAction);
|
|
16957
17021
|
};
|
|
16958
17022
|
Object.defineProperty(ThemeTabPlugin.prototype, "availableThemes", {
|
|
17023
|
+
/**
|
|
17024
|
+
* A list of UI themes from which users can select. You can sort this list if you want to reorder themes in Theme Editor.
|
|
17025
|
+
* @see addTheme
|
|
17026
|
+
* @see removeTheme
|
|
17027
|
+
*/
|
|
16959
17028
|
get: function () {
|
|
16960
17029
|
return [].concat(this._availableThemes);
|
|
16961
17030
|
},
|
|
16962
|
-
set: function (
|
|
16963
|
-
this._availableThemes =
|
|
17031
|
+
set: function (availableThemes) {
|
|
17032
|
+
this._availableThemes = availableThemes || [];
|
|
16964
17033
|
if (!!this.model) {
|
|
16965
|
-
this.model.availableThemes =
|
|
17034
|
+
this.model.availableThemes = availableThemes;
|
|
16966
17035
|
}
|
|
16967
17036
|
},
|
|
16968
17037
|
enumerable: false,
|
|
16969
17038
|
configurable: true
|
|
16970
17039
|
});
|
|
17040
|
+
/**
|
|
17041
|
+
* Adds a new UI theme to Theme Editor.
|
|
17042
|
+
* @param theme A [UI theme](https://surveyjs.io/form-library/documentation/api-reference/itheme) to add.
|
|
17043
|
+
* @param setAsDefault For internal use.
|
|
17044
|
+
* @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"`).
|
|
17045
|
+
* @see removeTheme
|
|
17046
|
+
* @see getCurrentTheme
|
|
17047
|
+
*/
|
|
16971
17048
|
ThemeTabPlugin.prototype.addTheme = function (theme, setAsDefault) {
|
|
16972
17049
|
if (setAsDefault === void 0) { setAsDefault = false; }
|
|
16973
17050
|
var fullThemeName = Object(_themes__WEBPACK_IMPORTED_MODULE_4__["getThemeFullName"])(theme);
|
|
@@ -16987,8 +17064,15 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16987
17064
|
}
|
|
16988
17065
|
return fullThemeName;
|
|
16989
17066
|
};
|
|
16990
|
-
|
|
16991
|
-
|
|
17067
|
+
/**
|
|
17068
|
+
* Removes a UI theme from Theme Editor.
|
|
17069
|
+
* @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"`).
|
|
17070
|
+
* @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).
|
|
17071
|
+
* @see addTheme
|
|
17072
|
+
* @see getCurrentTheme
|
|
17073
|
+
*/
|
|
17074
|
+
ThemeTabPlugin.prototype.removeTheme = function (themeAccessor, includeModifications) {
|
|
17075
|
+
if (includeModifications === void 0) { includeModifications = false; }
|
|
16992
17076
|
var themeToDelete = typeof themeAccessor === "string" ? _themes__WEBPACK_IMPORTED_MODULE_4__["Themes"][themeAccessor] : themeAccessor;
|
|
16993
17077
|
var fullThemeName = typeof themeAccessor === "string" ? themeAccessor : Object(_themes__WEBPACK_IMPORTED_MODULE_4__["getThemeFullName"])(themeToDelete);
|
|
16994
17078
|
if (!!themeToDelete) {
|
|
@@ -16998,10 +17082,10 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
16998
17082
|
}
|
|
16999
17083
|
var registeredThemeNames = Object.keys(_themes__WEBPACK_IMPORTED_MODULE_4__["Themes"]);
|
|
17000
17084
|
var themeModifications = registeredThemeNames.filter(function (themeName) { return themeName.indexOf(themeToDelete.themeName + "-") === 0; });
|
|
17001
|
-
if (
|
|
17085
|
+
if (includeModifications && themeModifications.length > 0) {
|
|
17002
17086
|
themeModifications.forEach(function (themeModificationFullName) { return delete _themes__WEBPACK_IMPORTED_MODULE_4__["Themes"][themeModificationFullName]; });
|
|
17003
17087
|
}
|
|
17004
|
-
if (
|
|
17088
|
+
if (includeModifications || themeModifications.length === 0) {
|
|
17005
17089
|
var themeIndex = this._availableThemes.indexOf(themeToDelete.themeName);
|
|
17006
17090
|
if (themeIndex !== -1) {
|
|
17007
17091
|
var availableThemes = this.availableThemes;
|
|
@@ -17011,9 +17095,17 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
17011
17095
|
}
|
|
17012
17096
|
}
|
|
17013
17097
|
};
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17098
|
+
/**
|
|
17099
|
+
* Returns a JSON object that describes the currently applied UI theme.
|
|
17100
|
+
* @param changesOnly Pass `true` to get a JSON object that contains only changed theme settings instead of a full theme JSON schema.
|
|
17101
|
+
* @returns A currently applied [theme JSON schema](https://surveyjs.io/form-library/documentation/api-reference/itheme).
|
|
17102
|
+
* @see availableThemes
|
|
17103
|
+
* @see addTheme
|
|
17104
|
+
* @see removeTheme
|
|
17105
|
+
*/
|
|
17106
|
+
ThemeTabPlugin.prototype.getCurrentTheme = function (changesOnly) {
|
|
17107
|
+
if (changesOnly === void 0) { changesOnly = false; }
|
|
17108
|
+
if (!changesOnly) {
|
|
17017
17109
|
return this.creator.theme;
|
|
17018
17110
|
}
|
|
17019
17111
|
return this.getThemeChanges();
|
|
@@ -17035,13 +17127,18 @@ var ThemeTabPlugin = /** @class */ (function () {
|
|
|
17035
17127
|
themeChanges.isPanelless = !!fullTheme.isPanelless;
|
|
17036
17128
|
return themeChanges;
|
|
17037
17129
|
};
|
|
17038
|
-
Object.defineProperty(ThemeTabPlugin.prototype, "
|
|
17130
|
+
Object.defineProperty(ThemeTabPlugin.prototype, "isModified", {
|
|
17131
|
+
/**
|
|
17132
|
+
* Indicates whether the selected theme has been modified.
|
|
17133
|
+
* @see [`creator.saveTheme()`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveTheme)
|
|
17134
|
+
* @see [`creator.saveThemeFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveThemeFunc)
|
|
17135
|
+
*/
|
|
17039
17136
|
get: function () {
|
|
17040
17137
|
var currentThemeChanges = this.getThemeChanges();
|
|
17041
17138
|
var hasCssModifications = Object.keys(currentThemeChanges.cssVariables).length > 0;
|
|
17042
17139
|
var hasBackgroundModifications = Object.keys(currentThemeChanges).some(function (propertyName) { return propertyName.toLowerCase().indexOf("background") !== -1; });
|
|
17043
17140
|
var hasHeaderModifications = !!currentThemeChanges.header && Object.keys(currentThemeChanges.header).length === 0;
|
|
17044
|
-
return
|
|
17141
|
+
return hasCssModifications || hasBackgroundModifications || hasHeaderModifications;
|
|
17045
17142
|
},
|
|
17046
17143
|
enumerable: false,
|
|
17047
17144
|
configurable: true
|
|
@@ -18305,7 +18402,7 @@ var TranslationGroup = /** @class */ (function (_super) {
|
|
|
18305
18402
|
!!property.serializationProperty) {
|
|
18306
18403
|
var locStr = obj[property.serializationProperty];
|
|
18307
18404
|
if (!!locStr &&
|
|
18308
|
-
obj.
|
|
18405
|
+
!obj.isPage &&
|
|
18309
18406
|
(!!locStr.onGetTextCallback || locStr["onRenderedHtmlCallback"]))
|
|
18310
18407
|
return obj["name"];
|
|
18311
18408
|
}
|
|
@@ -20375,7 +20472,7 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
20375
20472
|
* @see allowChangeThemeInPreview
|
|
20376
20473
|
*/
|
|
20377
20474
|
_this.themeForPreview = "defaultV2";
|
|
20378
|
-
_this.
|
|
20475
|
+
_this.hasPendingThemeChanges = false;
|
|
20379
20476
|
_this._theme = { cssVariables: {} };
|
|
20380
20477
|
//#endregion Theme
|
|
20381
20478
|
_this._allowModifyPages = true;
|
|
@@ -20570,7 +20667,7 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
20570
20667
|
_this.updateToolboxIsCompact();
|
|
20571
20668
|
_this.initTabs();
|
|
20572
20669
|
_this.initDragDrop();
|
|
20573
|
-
_this.
|
|
20670
|
+
_this.syncSaveButtons = _this.options.saveSurveyAndTheme !== undefined ? _this.options.saveSurveyAndTheme : _this.options.syncSaveButtons;
|
|
20574
20671
|
_this.isTouch = survey_core__WEBPACK_IMPORTED_MODULE_1__["IsTouch"];
|
|
20575
20672
|
var expandAction = _this.sidebar.getExpandAction();
|
|
20576
20673
|
!!expandAction && _this.toolbar.actions.push(expandAction);
|
|
@@ -20795,13 +20892,26 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
20795
20892
|
enumerable: false,
|
|
20796
20893
|
configurable: true
|
|
20797
20894
|
});
|
|
20798
|
-
Object.defineProperty(CreatorBase.prototype, "
|
|
20895
|
+
Object.defineProperty(CreatorBase.prototype, "themeEditor", {
|
|
20799
20896
|
//#region Theme
|
|
20897
|
+
/**
|
|
20898
|
+
* 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).
|
|
20899
|
+
* @see showThemeTab
|
|
20900
|
+
* @see saveThemeFunc
|
|
20901
|
+
*/
|
|
20902
|
+
get: function () {
|
|
20903
|
+
return this.getPlugin("theme");
|
|
20904
|
+
},
|
|
20905
|
+
enumerable: false,
|
|
20906
|
+
configurable: true
|
|
20907
|
+
});
|
|
20908
|
+
Object.defineProperty(CreatorBase.prototype, "saveThemeFunc", {
|
|
20800
20909
|
/**
|
|
20801
20910
|
* 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.
|
|
20802
20911
|
*
|
|
20803
20912
|
* 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.
|
|
20804
20913
|
* @see showThemeTab
|
|
20914
|
+
* @see themeEditor
|
|
20805
20915
|
* @see saveSurveyFunc
|
|
20806
20916
|
*/
|
|
20807
20917
|
get: function () {
|
|
@@ -20819,7 +20929,7 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
20819
20929
|
},
|
|
20820
20930
|
set: function (newTheme) {
|
|
20821
20931
|
this._theme = newTheme;
|
|
20822
|
-
this.
|
|
20932
|
+
this.hasPendingThemeChanges = true;
|
|
20823
20933
|
if (this.activeTab !== "theme") {
|
|
20824
20934
|
this.updatePlugin(this.activeTab);
|
|
20825
20935
|
}
|
|
@@ -20837,7 +20947,7 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
20837
20947
|
return;
|
|
20838
20948
|
if (isSuccess) {
|
|
20839
20949
|
_this.setState("saved");
|
|
20840
|
-
_this.
|
|
20950
|
+
_this.hasPendingThemeChanges = false;
|
|
20841
20951
|
}
|
|
20842
20952
|
else {
|
|
20843
20953
|
_this.setState("modified");
|
|
@@ -20849,12 +20959,20 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
20849
20959
|
});
|
|
20850
20960
|
}
|
|
20851
20961
|
};
|
|
20852
|
-
|
|
20853
|
-
|
|
20854
|
-
|
|
20962
|
+
/**
|
|
20963
|
+
* Calls the [`saveThemeFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveThemeFunc) function to save the theme JSON schema.
|
|
20964
|
+
* @see saveSurvey
|
|
20965
|
+
* @see save
|
|
20966
|
+
*/
|
|
20967
|
+
CreatorBase.prototype.saveTheme = function () {
|
|
20968
|
+
this._doSaveThemeCore();
|
|
20969
|
+
};
|
|
20970
|
+
CreatorBase.prototype.saveThemeActionHandler = function () {
|
|
20971
|
+
if (this.syncSaveButtons) {
|
|
20972
|
+
this.save();
|
|
20855
20973
|
}
|
|
20856
20974
|
else {
|
|
20857
|
-
this.
|
|
20975
|
+
this.saveTheme();
|
|
20858
20976
|
}
|
|
20859
20977
|
};
|
|
20860
20978
|
Object.defineProperty(CreatorBase.prototype, "allowModifyPages", {
|
|
@@ -21439,15 +21557,10 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
21439
21557
|
enumerable: false,
|
|
21440
21558
|
configurable: true
|
|
21441
21559
|
});
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
|
|
21445
|
-
|
|
21446
|
-
*/
|
|
21447
|
-
get: function () { return this.isInitialSurveyEmptyValue; },
|
|
21448
|
-
enumerable: false,
|
|
21449
|
-
configurable: true
|
|
21450
|
-
});
|
|
21560
|
+
/**
|
|
21561
|
+
* Returns true if initial survey was empty. It was not set via JSON property and default new survey is empty as well.
|
|
21562
|
+
* @returns true if initial survey doesn't have any elements or properties
|
|
21563
|
+
*/
|
|
21451
21564
|
CreatorBase.prototype.initSurveyWithJSON = function (json, clearState) {
|
|
21452
21565
|
var _this = this;
|
|
21453
21566
|
if (!json) {
|
|
@@ -21461,7 +21574,6 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
21461
21574
|
survey.setDesignMode(true);
|
|
21462
21575
|
survey.lazyRendering = true;
|
|
21463
21576
|
survey.setJsonObject(json);
|
|
21464
|
-
this.isInitialSurveyEmptyValue = survey.isEmpty;
|
|
21465
21577
|
if (survey.isEmpty) {
|
|
21466
21578
|
survey.setJsonObject(this.getDefaultSurveyJson());
|
|
21467
21579
|
}
|
|
@@ -22026,7 +22138,7 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
22026
22138
|
this.newQuestionChangedNames[element.name] = newName;
|
|
22027
22139
|
element.name = newName;
|
|
22028
22140
|
}
|
|
22029
|
-
if (element.isPanel ||
|
|
22141
|
+
if (element.isPanel || element.isPage) {
|
|
22030
22142
|
if (element.isPanel) {
|
|
22031
22143
|
this.newPanels.push(element);
|
|
22032
22144
|
}
|
|
@@ -22143,9 +22255,9 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
22143
22255
|
this.selectElement(!!newPage ? newPage : this.survey);
|
|
22144
22256
|
}
|
|
22145
22257
|
else {
|
|
22146
|
-
if (this.
|
|
22258
|
+
if (this.survey.pageCount === 1) {
|
|
22147
22259
|
var page = this.survey.pages[0];
|
|
22148
|
-
if (page.elements.length === 1 && obj === page.elements[0]) {
|
|
22260
|
+
if (page.elements.length === 1 && obj === page.elements[0] && !_survey_helper__WEBPACK_IMPORTED_MODULE_9__["SurveyHelper"].isPagePropertiesAreModified(page)) {
|
|
22149
22261
|
this.deleteObjectCore(page);
|
|
22150
22262
|
return;
|
|
22151
22263
|
}
|
|
@@ -22541,7 +22653,7 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
22541
22653
|
if (objIndex == elements.length - 1) {
|
|
22542
22654
|
objIndex--;
|
|
22543
22655
|
}
|
|
22544
|
-
if (this.pageEditMode === "single" && parent.
|
|
22656
|
+
if (this.pageEditMode === "single" && parent.isPage) {
|
|
22545
22657
|
parent = this.survey;
|
|
22546
22658
|
}
|
|
22547
22659
|
if (obj["questions"]) {
|
|
@@ -22865,12 +22977,23 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
22865
22977
|
});
|
|
22866
22978
|
}
|
|
22867
22979
|
};
|
|
22980
|
+
/**
|
|
22981
|
+
* Calls the [`saveSurveyFunc`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#saveSurveyFunc) function to save the survey JSON schema.
|
|
22982
|
+
* @see saveTheme
|
|
22983
|
+
* @see save
|
|
22984
|
+
*/
|
|
22985
|
+
CreatorBase.prototype.saveSurvey = function () {
|
|
22986
|
+
this._doSaveCore();
|
|
22987
|
+
};
|
|
22868
22988
|
CreatorBase.prototype.doSave = function () {
|
|
22869
|
-
|
|
22870
|
-
|
|
22989
|
+
this._doSaveCore();
|
|
22990
|
+
};
|
|
22991
|
+
CreatorBase.prototype.saveSurveyActionHandler = function () {
|
|
22992
|
+
if (this.syncSaveButtons) {
|
|
22993
|
+
this.save();
|
|
22871
22994
|
}
|
|
22872
22995
|
else {
|
|
22873
|
-
this.
|
|
22996
|
+
this.saveSurvey();
|
|
22874
22997
|
}
|
|
22875
22998
|
};
|
|
22876
22999
|
CreatorBase.prototype._updateSaveActions = function () {
|
|
@@ -22879,18 +23002,23 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
22879
23002
|
action.enabled = this.state === "modified";
|
|
22880
23003
|
action.active = this.state === "modified";
|
|
22881
23004
|
}
|
|
22882
|
-
if (this.
|
|
23005
|
+
if (this.syncSaveButtons) {
|
|
22883
23006
|
var action_1 = this._findAction("svd-save-theme");
|
|
22884
23007
|
if (action_1) {
|
|
22885
|
-
action_1.enabled = this.
|
|
22886
|
-
action_1.active = this.
|
|
23008
|
+
action_1.enabled = this.hasPendingThemeChanges;
|
|
23009
|
+
action_1.active = this.hasPendingThemeChanges;
|
|
22887
23010
|
}
|
|
22888
23011
|
}
|
|
22889
23012
|
};
|
|
22890
|
-
|
|
23013
|
+
/**
|
|
23014
|
+
* 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.
|
|
23015
|
+
* @see saveSurvey
|
|
23016
|
+
* @see saveTheme
|
|
23017
|
+
*/
|
|
23018
|
+
CreatorBase.prototype.save = function () {
|
|
22891
23019
|
var _this = this;
|
|
22892
23020
|
var themeSaveHandler = function () {
|
|
22893
|
-
if (_this.
|
|
23021
|
+
if (_this.hasPendingThemeChanges) {
|
|
22894
23022
|
_this._doSaveThemeCore(function () {
|
|
22895
23023
|
_this._updateSaveActions();
|
|
22896
23024
|
});
|
|
@@ -23182,17 +23310,17 @@ var CreatorBase = /** @class */ (function (_super) {
|
|
|
23182
23310
|
}
|
|
23183
23311
|
if (val) {
|
|
23184
23312
|
target.onModified.add(target._syncSaveActions);
|
|
23185
|
-
themeTabPlugin.
|
|
23313
|
+
themeTabPlugin.onThemePropertyChanged.add(target._syncSaveActions);
|
|
23186
23314
|
themeTabPlugin.onThemeSelected.add(target._syncSaveActions);
|
|
23187
23315
|
}
|
|
23188
23316
|
else {
|
|
23189
23317
|
target.onModified.remove(target._syncSaveActions);
|
|
23190
|
-
themeTabPlugin.
|
|
23318
|
+
themeTabPlugin.onThemePropertyChanged.remove(target._syncSaveActions);
|
|
23191
23319
|
themeTabPlugin.onThemeSelected.remove(target._syncSaveActions);
|
|
23192
23320
|
}
|
|
23193
23321
|
},
|
|
23194
23322
|
})
|
|
23195
|
-
], CreatorBase.prototype, "
|
|
23323
|
+
], CreatorBase.prototype, "syncSaveButtons", void 0);
|
|
23196
23324
|
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
|
|
23197
23325
|
Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false })
|
|
23198
23326
|
], CreatorBase.prototype, "showSaveButton", void 0);
|
|
@@ -25574,7 +25702,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25574
25702
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! survey-core */ "survey-core");
|
|
25575
25703
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_72___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_72__);
|
|
25576
25704
|
var Version;
|
|
25577
|
-
Version = "" + "1.9.
|
|
25705
|
+
Version = "" + "1.9.120";
|
|
25578
25706
|
//should be loaded before other styles for easier override
|
|
25579
25707
|
__webpack_require__(/*! ../utils/context-button.scss */ "./src/utils/context-button.scss");
|
|
25580
25708
|
|
|
@@ -25665,7 +25793,7 @@ __webpack_require__(/*! ../utils/design.scss */ "./src/utils/design.scss");
|
|
|
25665
25793
|
__webpack_require__(/*! ../utils/layout.scss */ "./src/utils/layout.scss");
|
|
25666
25794
|
|
|
25667
25795
|
survey_core__WEBPACK_IMPORTED_MODULE_72__["settings"].supportCreatorV2 = true;
|
|
25668
|
-
Object(survey_core__WEBPACK_IMPORTED_MODULE_72__["checkLibraryVersion"])("" + "1.9.
|
|
25796
|
+
Object(survey_core__WEBPACK_IMPORTED_MODULE_72__["checkLibraryVersion"])("" + "1.9.120", "survey-creator-core");
|
|
25669
25797
|
|
|
25670
25798
|
|
|
25671
25799
|
/***/ }),
|
|
@@ -27900,6 +28028,7 @@ var enStrings = {
|
|
|
27900
28028
|
toolbox: "Toolbox",
|
|
27901
28029
|
"property-grid": "Properties",
|
|
27902
28030
|
propertyGridFilteredTextPlaceholder: "Type to search...",
|
|
28031
|
+
propertyGridNoResultsFound: "No results found",
|
|
27903
28032
|
toolboxGeneralCategory: "General",
|
|
27904
28033
|
toolboxChoiceCategory: "Choice Questions",
|
|
27905
28034
|
toolboxTextCategory: "Text Input Questions",
|
|
@@ -29715,7 +29844,8 @@ var propertyGridCss = {
|
|
|
29715
29844
|
panel: {
|
|
29716
29845
|
title: "spg-title spg-panel__title",
|
|
29717
29846
|
titleExpandable: "spg-panel__title--expandable",
|
|
29718
|
-
|
|
29847
|
+
titleExpanded: "spg-panel__title--expanded",
|
|
29848
|
+
titleCollapsed: "spg-panel__title--collapsed",
|
|
29719
29849
|
titleOnError: "spg-panel__title--error",
|
|
29720
29850
|
description: "spg-description spg-panel__description",
|
|
29721
29851
|
container: "spg-panel spg-row__panel",
|
|
@@ -31075,7 +31205,8 @@ var ConditionEditor = /** @class */ (function (_super) {
|
|
|
31075
31205
|
if (!!panel.getQuestionByName("questionValue")) {
|
|
31076
31206
|
panel.getQuestionByName("questionValue").clearValue();
|
|
31077
31207
|
}
|
|
31078
|
-
var
|
|
31208
|
+
var qName = panel.getQuestionByName("questionName").value;
|
|
31209
|
+
var json = this.getQuestionConditionJson(qName, panel.getQuestionByName("operator").value);
|
|
31079
31210
|
if (!json) {
|
|
31080
31211
|
json = {
|
|
31081
31212
|
type: "text"
|
|
@@ -31102,6 +31233,15 @@ var ConditionEditor = /** @class */ (function (_super) {
|
|
|
31102
31233
|
newQuestion.description = "";
|
|
31103
31234
|
newQuestion.titleLocation = "top";
|
|
31104
31235
|
newQuestion.hasComment = false;
|
|
31236
|
+
if (newQuestion.showOtherItem) {
|
|
31237
|
+
var question = this.getConditionQuestion(qName);
|
|
31238
|
+
if (question && question.getStoreOthersAsComment && question.getStoreOthersAsComment()) {
|
|
31239
|
+
var other = newQuestion.otherItem;
|
|
31240
|
+
newQuestion.choices.push(new survey_core__WEBPACK_IMPORTED_MODULE_1__["ItemValue"](other.value, other.title));
|
|
31241
|
+
other.value = "#" + other.value + "#";
|
|
31242
|
+
newQuestion.showOtherItem = false;
|
|
31243
|
+
}
|
|
31244
|
+
}
|
|
31105
31245
|
panel.addElement(newQuestion);
|
|
31106
31246
|
}
|
|
31107
31247
|
};
|
|
@@ -31995,6 +32135,12 @@ var PropertyGridEditorCollection = {
|
|
|
31995
32135
|
res.onValueChanged(obj, prop, question);
|
|
31996
32136
|
}
|
|
31997
32137
|
},
|
|
32138
|
+
onValueChanging: function (obj, prop, question, options) {
|
|
32139
|
+
var res = this.getEditor(prop);
|
|
32140
|
+
if (!!res && !!res.onValueChanging) {
|
|
32141
|
+
res.onValueChanging(obj, prop, question, options);
|
|
32142
|
+
}
|
|
32143
|
+
},
|
|
31998
32144
|
onMasterValueChanged: function (obj, prop, question) {
|
|
31999
32145
|
var res = this.getEditor(prop);
|
|
32000
32146
|
if (!!res && !!res.onMasterValueChanged) {
|
|
@@ -32612,6 +32758,7 @@ var PropertyGridModel = /** @class */ (function () {
|
|
|
32612
32758
|
var q = options.question;
|
|
32613
32759
|
if (!q || !q.property || survey_core__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isTwoValueEquals(options.value, options.oldValue, false, false, false))
|
|
32614
32760
|
return;
|
|
32761
|
+
PropertyGridEditorCollection.onValueChanging(this.obj, q.property, q, options);
|
|
32615
32762
|
var changingOptions = {
|
|
32616
32763
|
obj: this.obj,
|
|
32617
32764
|
propertyName: q.property.name,
|
|
@@ -33035,6 +33182,16 @@ var PropertyGridEditorNumber = /** @class */ (function (_super) {
|
|
|
33035
33182
|
}
|
|
33036
33183
|
return res;
|
|
33037
33184
|
};
|
|
33185
|
+
PropertyGridEditorNumber.prototype.onValueChanging = function (obj, prop, question, options) {
|
|
33186
|
+
if (!options.value && options.value !== 0) {
|
|
33187
|
+
if (prop.defaultValue !== undefined) {
|
|
33188
|
+
options.value = prop.defaultValue;
|
|
33189
|
+
}
|
|
33190
|
+
else {
|
|
33191
|
+
options.value = prop.minValue !== undefined && prop.minValue > 0 ? prop.minValue : 0;
|
|
33192
|
+
}
|
|
33193
|
+
}
|
|
33194
|
+
};
|
|
33038
33195
|
return PropertyGridEditorNumber;
|
|
33039
33196
|
}(PropertyGridEditor));
|
|
33040
33197
|
|
|
@@ -33521,7 +33678,7 @@ var PropertyGridEditorMatrix = /** @class */ (function (_super) {
|
|
|
33521
33678
|
return rowObj.text;
|
|
33522
33679
|
});
|
|
33523
33680
|
}
|
|
33524
|
-
if (propertyName === "title" && objType === "matrixdropdowncolumn") {
|
|
33681
|
+
if (propertyName === "title" && (objType === "matrixdropdowncolumn" || objType === "multipletextitem")) {
|
|
33525
33682
|
cellQuestion.placeholder = new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () {
|
|
33526
33683
|
if (!!rowObj.name)
|
|
33527
33684
|
return rowObj.name;
|
|
@@ -34166,7 +34323,7 @@ var PropertyGridEditorMatrixMutlipleTextItems = /** @class */ (function (_super)
|
|
|
34166
34323
|
var editor = options.row.editingObj.editor;
|
|
34167
34324
|
if (!!editor && !!q.property) {
|
|
34168
34325
|
editor.registerFunctionOnPropertyValueChanged(q.property.name, function () {
|
|
34169
|
-
q.value = editor
|
|
34326
|
+
q.value = survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getObjPropertyValue(editor, q.property.name);
|
|
34170
34327
|
});
|
|
34171
34328
|
}
|
|
34172
34329
|
};
|
|
@@ -34773,6 +34930,7 @@ var SearchManager = /** @class */ (function (_super) {
|
|
|
34773
34930
|
_this.highlightedEditorClass = " spg-editor--highlighted";
|
|
34774
34931
|
_this.searchActionBar = new survey_core__WEBPACK_IMPORTED_MODULE_1__["ActionContainer"]();
|
|
34775
34932
|
_this.filterStringPlaceholder = Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_2__["getLocString"])("ed.propertyGridFilteredTextPlaceholder");
|
|
34933
|
+
_this.propertyGridNoResultsFound = Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_2__["getLocString"])("ed.propertyGridNoResultsFound");
|
|
34776
34934
|
_this.allMatches = [];
|
|
34777
34935
|
_this.initActionBar();
|
|
34778
34936
|
return _this;
|
|
@@ -34804,8 +34962,16 @@ var SearchManager = /** @class */ (function (_super) {
|
|
|
34804
34962
|
};
|
|
34805
34963
|
SearchManager.prototype.updatedMatchCounterText = function (index) {
|
|
34806
34964
|
var count = this.allMatches.length;
|
|
34807
|
-
|
|
34808
|
-
|
|
34965
|
+
if (count === 1) {
|
|
34966
|
+
this.matchCounterText = "";
|
|
34967
|
+
}
|
|
34968
|
+
else if (this.currentMatch) {
|
|
34969
|
+
var value = index + 1;
|
|
34970
|
+
this.matchCounterText = [value, count].join("/");
|
|
34971
|
+
}
|
|
34972
|
+
else {
|
|
34973
|
+
this.matchCounterText = !!this.filterString ? this.propertyGridNoResultsFound : "";
|
|
34974
|
+
}
|
|
34809
34975
|
};
|
|
34810
34976
|
SearchManager.prototype.navigateToEditor = function (index) {
|
|
34811
34977
|
if (index < 0) {
|
|
@@ -34862,8 +35028,7 @@ var SearchManager = /** @class */ (function (_super) {
|
|
|
34862
35028
|
showTitle: false,
|
|
34863
35029
|
iconSize: 16,
|
|
34864
35030
|
innerCss: "spg-search-editor_bar-item",
|
|
34865
|
-
visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return
|
|
34866
|
-
enabled: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.allMatches.length > 0; }),
|
|
35031
|
+
visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.allMatches.length > 1; }),
|
|
34867
35032
|
action: function () {
|
|
34868
35033
|
if (_this.allMatches.length > 0) {
|
|
34869
35034
|
_this.navigateToEditor(_this.currentMatchIndex - 1);
|
|
@@ -34878,8 +35043,7 @@ var SearchManager = /** @class */ (function (_super) {
|
|
|
34878
35043
|
showTitle: false,
|
|
34879
35044
|
iconSize: 16,
|
|
34880
35045
|
innerCss: "spg-search-editor_bar-item",
|
|
34881
|
-
visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return
|
|
34882
|
-
enabled: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.allMatches.length > 0; }),
|
|
35046
|
+
visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.allMatches.length > 1; }),
|
|
34883
35047
|
action: function () {
|
|
34884
35048
|
if (_this.allMatches.length > 0) {
|
|
34885
35049
|
_this.navigateToEditor(_this.currentMatchIndex + 1);
|
|
@@ -34896,12 +35060,13 @@ var SearchManager = /** @class */ (function (_super) {
|
|
|
34896
35060
|
innerCss: "spg-search-editor_bar-item",
|
|
34897
35061
|
visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return !!_this.filterString; }),
|
|
34898
35062
|
action: function () {
|
|
34899
|
-
_this.
|
|
35063
|
+
_this.clearFilterString();
|
|
34900
35064
|
}
|
|
34901
35065
|
}));
|
|
34902
35066
|
this.searchActionBar.setItems(searchActions);
|
|
34903
35067
|
};
|
|
34904
35068
|
SearchManager.prototype.setSurvey = function (newSurvey) {
|
|
35069
|
+
this.clearFilterString();
|
|
34905
35070
|
this.survey = newSurvey;
|
|
34906
35071
|
if (!!this.survey) {
|
|
34907
35072
|
var _self_1 = this;
|
|
@@ -34913,6 +35078,9 @@ var SearchManager = /** @class */ (function (_super) {
|
|
|
34913
35078
|
});
|
|
34914
35079
|
}
|
|
34915
35080
|
};
|
|
35081
|
+
SearchManager.prototype.clearFilterString = function () {
|
|
35082
|
+
this.filterString = "";
|
|
35083
|
+
};
|
|
34916
35084
|
SearchManager.prototype.onPropertyValueChanged = function (name, oldValue, newValue) {
|
|
34917
35085
|
_super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue);
|
|
34918
35086
|
if (name === "filterString") {
|
|
@@ -35395,6 +35563,12 @@ var SurveyQuestionEditorDefinition = /** @class */ (function () {
|
|
|
35395
35563
|
"fileOrPhotoPlaceholder"
|
|
35396
35564
|
]
|
|
35397
35565
|
},
|
|
35566
|
+
signaturepad: {
|
|
35567
|
+
properties: [
|
|
35568
|
+
"waitForUpload",
|
|
35569
|
+
{ name: "storeDataAsText" },
|
|
35570
|
+
]
|
|
35571
|
+
},
|
|
35398
35572
|
html: {
|
|
35399
35573
|
properties: ["html"]
|
|
35400
35574
|
},
|
|
@@ -37234,6 +37408,17 @@ var SurveyHelper = /** @class */ (function () {
|
|
|
37234
37408
|
SurveyHelper.isPageNameAutoGenerated = function (name) {
|
|
37235
37409
|
return SurveyHelper.isNameAutoGenerated(name, _editorLocalization__WEBPACK_IMPORTED_MODULE_1__["editorLocalization"].getString("ed.newPageName"));
|
|
37236
37410
|
};
|
|
37411
|
+
SurveyHelper.isPagePropertiesAreModified = function (page) {
|
|
37412
|
+
if (!SurveyHelper.isPageNameAutoGenerated(page.name))
|
|
37413
|
+
return true;
|
|
37414
|
+
var json = page.toJSON();
|
|
37415
|
+
delete json["name"];
|
|
37416
|
+
delete json["elements"];
|
|
37417
|
+
//If there is at least one property in page is set, then return true
|
|
37418
|
+
for (var key in json)
|
|
37419
|
+
return true;
|
|
37420
|
+
return false;
|
|
37421
|
+
};
|
|
37237
37422
|
SurveyHelper.getNewQuestionName = function (objs) {
|
|
37238
37423
|
return SurveyHelper.getNewName(objs, _editorLocalization__WEBPACK_IMPORTED_MODULE_1__["editorLocalization"].getString("ed.newQuestionName"));
|
|
37239
37424
|
};
|
|
@@ -37275,15 +37460,15 @@ var SurveyHelper = /** @class */ (function () {
|
|
|
37275
37460
|
SurveyHelper.getObjectType = function (obj) {
|
|
37276
37461
|
if (!obj || !obj["getType"])
|
|
37277
37462
|
return ObjType.Unknown;
|
|
37278
|
-
if (obj.
|
|
37463
|
+
if (obj.isPage)
|
|
37279
37464
|
return ObjType.Page;
|
|
37280
|
-
if (obj.
|
|
37465
|
+
if (obj.isPanel)
|
|
37281
37466
|
return ObjType.Panel;
|
|
37282
37467
|
if (obj.getType() == "survey")
|
|
37283
37468
|
return ObjType.Survey;
|
|
37284
37469
|
if (obj.getType() == "matrixdropdowncolumn")
|
|
37285
37470
|
return ObjType.Column;
|
|
37286
|
-
if (obj
|
|
37471
|
+
if (obj.isQuestion)
|
|
37287
37472
|
return ObjType.Question;
|
|
37288
37473
|
return ObjType.Unknown;
|
|
37289
37474
|
};
|
|
@@ -38381,6 +38566,8 @@ var QuestionToolbox = /** @class */ (function (_super) {
|
|
|
38381
38566
|
* @param name
|
|
38382
38567
|
*/
|
|
38383
38568
|
QuestionToolbox.prototype.getItemByName = function (name) {
|
|
38569
|
+
if (!name)
|
|
38570
|
+
return null;
|
|
38384
38571
|
var index = this.indexOf(name);
|
|
38385
38572
|
return index > -1 ? this.actions[index] : null;
|
|
38386
38573
|
};
|
|
@@ -38476,6 +38663,79 @@ var QuestionToolbox = /** @class */ (function (_super) {
|
|
|
38476
38663
|
}
|
|
38477
38664
|
this.onItemsChanged();
|
|
38478
38665
|
};
|
|
38666
|
+
/**
|
|
38667
|
+
* Defines toolbox categories from scratch.
|
|
38668
|
+
*
|
|
38669
|
+
* 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.
|
|
38670
|
+
*
|
|
38671
|
+
* 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.
|
|
38672
|
+
*
|
|
38673
|
+
* ```
|
|
38674
|
+
* creator.toolbox.defineCategories([{
|
|
38675
|
+
* category: "Dropdowns",
|
|
38676
|
+
* items: [
|
|
38677
|
+
* "dropdown",
|
|
38678
|
+
* "tagbox"
|
|
38679
|
+
* ]
|
|
38680
|
+
* }, {
|
|
38681
|
+
* category: "Text Input",
|
|
38682
|
+
* items: [
|
|
38683
|
+
* "text",
|
|
38684
|
+
* // Override the display title
|
|
38685
|
+
* { name: "comment", title: "Multi-Line Input" }
|
|
38686
|
+
* ]
|
|
38687
|
+
* }], true);
|
|
38688
|
+
* ```
|
|
38689
|
+
*
|
|
38690
|
+
* [View Demo](https://surveyjs.io/survey-creator/examples/survey-toolbox-categories/ (linkStyle))
|
|
38691
|
+
* @param categories An array of new categories.
|
|
38692
|
+
* @param displayMisc Pass `true` if you want to collect unlisted toolbox items in the Misc category. Default value: `false`.
|
|
38693
|
+
*/
|
|
38694
|
+
QuestionToolbox.prototype.defineCategories = function (categories, displayMisc) {
|
|
38695
|
+
var _this = this;
|
|
38696
|
+
if (displayMisc === void 0) { displayMisc = false; }
|
|
38697
|
+
if (!Array.isArray(categories))
|
|
38698
|
+
return;
|
|
38699
|
+
this.actions.forEach(function (item) {
|
|
38700
|
+
item.visible = false;
|
|
38701
|
+
});
|
|
38702
|
+
var actionList = new Array();
|
|
38703
|
+
categories.forEach(function (category) {
|
|
38704
|
+
if (!Array.isArray(category.items))
|
|
38705
|
+
return;
|
|
38706
|
+
category.items.forEach(function (obj) {
|
|
38707
|
+
var name = undefined;
|
|
38708
|
+
var title = undefined;
|
|
38709
|
+
if (typeof obj === "string") {
|
|
38710
|
+
name = obj;
|
|
38711
|
+
}
|
|
38712
|
+
else {
|
|
38713
|
+
name = obj.name;
|
|
38714
|
+
title = obj.title;
|
|
38715
|
+
}
|
|
38716
|
+
var item = _this.getItemByName(name);
|
|
38717
|
+
if (item) {
|
|
38718
|
+
item.category = category.category;
|
|
38719
|
+
item.visible = true;
|
|
38720
|
+
if (!!title) {
|
|
38721
|
+
item.title = title;
|
|
38722
|
+
}
|
|
38723
|
+
actionList.push(item);
|
|
38724
|
+
}
|
|
38725
|
+
});
|
|
38726
|
+
});
|
|
38727
|
+
this.actions.forEach(function (item) {
|
|
38728
|
+
if (!item.visible) {
|
|
38729
|
+
if (displayMisc) {
|
|
38730
|
+
item.visible = true;
|
|
38731
|
+
item.category = _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("ed.toolboxMiscCategory");
|
|
38732
|
+
}
|
|
38733
|
+
actionList.push(item);
|
|
38734
|
+
}
|
|
38735
|
+
});
|
|
38736
|
+
this.setItems(actionList);
|
|
38737
|
+
this.onItemsChanged(false);
|
|
38738
|
+
};
|
|
38479
38739
|
/**
|
|
38480
38740
|
* Removes categories from the Toolbox.
|
|
38481
38741
|
*/
|
|
@@ -38561,12 +38821,15 @@ var QuestionToolbox = /** @class */ (function (_super) {
|
|
|
38561
38821
|
}
|
|
38562
38822
|
return null;
|
|
38563
38823
|
};
|
|
38564
|
-
QuestionToolbox.prototype.onItemsChanged = function () {
|
|
38824
|
+
QuestionToolbox.prototype.onItemsChanged = function (changeActions) {
|
|
38825
|
+
if (changeActions === void 0) { changeActions = true; }
|
|
38565
38826
|
var categories = new Array();
|
|
38566
38827
|
var categoriesHash = {};
|
|
38567
38828
|
var prevActiveCategory = this.activeCategory;
|
|
38568
38829
|
for (var i = 0; i < this.actions.length; i++) {
|
|
38569
38830
|
var item = this.actions[i];
|
|
38831
|
+
if (item.visible === false)
|
|
38832
|
+
continue;
|
|
38570
38833
|
var categoryName = item.category ? item.category : _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("ed.toolboxGeneralCategory");
|
|
38571
38834
|
if (!categoriesHash[categoryName]) {
|
|
38572
38835
|
var category = this.createCategory();
|
|
@@ -38593,11 +38856,13 @@ var QuestionToolbox = /** @class */ (function (_super) {
|
|
|
38593
38856
|
}
|
|
38594
38857
|
}
|
|
38595
38858
|
}
|
|
38596
|
-
|
|
38597
|
-
|
|
38598
|
-
|
|
38599
|
-
|
|
38600
|
-
|
|
38859
|
+
if (changeActions) {
|
|
38860
|
+
var newItems_1 = [];
|
|
38861
|
+
this.categories.forEach(function (cat) {
|
|
38862
|
+
newItems_1 = newItems_1.concat(cat.items);
|
|
38863
|
+
});
|
|
38864
|
+
this.actions = newItems_1;
|
|
38865
|
+
}
|
|
38601
38866
|
this.hasCategories = categories.length > 1;
|
|
38602
38867
|
//this.updateCategoriesState();
|
|
38603
38868
|
this.updateItemSeparators();
|