survey-react-ui 1.9.128 → 1.9.129

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-react-ui",
3
- "version": "1.9.128",
3
+ "version": "1.9.129",
4
4
  "description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.",
5
5
  "keywords": [
6
6
  "Survey",
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - Survey JavaScript library v1.9.128
2
+ * surveyjs - Survey JavaScript library v1.9.129
3
3
  * Copyright (c) 2015-2024 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -817,18 +817,23 @@ var Base = /** @class */ (function () {
817
817
  configurable: true
818
818
  });
819
819
  Base.prototype.doPropertyValueChangedCallback = function (name, oldValue, newValue, arrayChanges, target) {
820
- if (this.isInternal)
820
+ var fireCallback = function (obj) {
821
+ if (!!obj && !!obj.onPropertyValueChangedCallback) {
822
+ obj.onPropertyValueChangedCallback(name, oldValue, newValue, target, arrayChanges);
823
+ }
824
+ };
825
+ if (this.isInternal) {
826
+ fireCallback(this);
821
827
  return;
828
+ }
822
829
  if (!target)
823
830
  target = this;
824
831
  var notifier = this.getSurvey();
825
832
  if (!notifier)
826
833
  notifier = this;
827
- if (!!notifier.onPropertyValueChangedCallback) {
828
- notifier.onPropertyValueChangedCallback(name, oldValue, newValue, target, arrayChanges);
829
- }
830
- if (notifier !== this && !!this.onPropertyValueChangedCallback) {
831
- this.onPropertyValueChangedCallback(name, oldValue, newValue, target, arrayChanges);
834
+ fireCallback(notifier);
835
+ if (notifier !== this) {
836
+ fireCallback(this);
832
837
  }
833
838
  };
834
839
  Base.prototype.addExpressionProperty = function (name, onExecute, canRun) {
@@ -2620,7 +2625,7 @@ __webpack_require__.r(__webpack_exports__);
2620
2625
 
2621
2626
 
2622
2627
 
2623
- Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.128", "survey-react-ui");
2628
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.129", "survey-react-ui");
2624
2629
 
2625
2630
 
2626
2631
  /***/ }),
@@ -6798,6 +6803,21 @@ function propertyValue(params) {
6798
6803
  return q ? q[params[1]] : undefined;
6799
6804
  }
6800
6805
  FunctionFactory.Instance.register("propertyValue", propertyValue);
6806
+ function substring_(params) {
6807
+ if (params.length < 2)
6808
+ return "";
6809
+ var s = params[0];
6810
+ if (!s || typeof s !== "string")
6811
+ return "";
6812
+ var start = params[1];
6813
+ if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(start))
6814
+ return "";
6815
+ var end = params.length > 2 ? params[2] : undefined;
6816
+ if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(end))
6817
+ return s.substring(start);
6818
+ return s.substring(start, end);
6819
+ }
6820
+ FunctionFactory.Instance.register("substring", substring_);
6801
6821
 
6802
6822
 
6803
6823
  /***/ }),
@@ -7696,22 +7716,32 @@ var JsonObjectProperty = /** @class */ (function () {
7696
7716
  enumerable: false,
7697
7717
  configurable: true
7698
7718
  });
7719
+ JsonObjectProperty.prototype.isEnable = function (obj) {
7720
+ if (this.readOnly)
7721
+ return false;
7722
+ if (!obj || !this.enableIf)
7723
+ return true;
7724
+ return this.enableIf(this.getOriginalObj(obj));
7725
+ };
7699
7726
  JsonObjectProperty.prototype.isVisible = function (layout, obj) {
7700
7727
  if (obj === void 0) { obj = null; }
7701
7728
  var isLayout = !this.layout || this.layout == layout;
7702
7729
  if (!this.visible || !isLayout)
7703
7730
  return false;
7704
7731
  if (!!this.visibleIf && !!obj) {
7705
- if (obj.getOriginalObj) {
7706
- var orjObj = obj.getOriginalObj();
7707
- if (orjObj && Serializer.findProperty(orjObj.getType(), this.name)) {
7708
- obj = orjObj;
7709
- }
7710
- }
7711
- return this.visibleIf(obj);
7732
+ return this.visibleIf(this.getOriginalObj(obj));
7712
7733
  }
7713
7734
  return true;
7714
7735
  };
7736
+ JsonObjectProperty.prototype.getOriginalObj = function (obj) {
7737
+ if (obj && obj.getOriginalObj) {
7738
+ var orjObj = obj.getOriginalObj();
7739
+ if (orjObj && Serializer.findProperty(orjObj.getType(), this.name)) {
7740
+ return orjObj;
7741
+ }
7742
+ }
7743
+ return obj;
7744
+ };
7715
7745
  Object.defineProperty(JsonObjectProperty.prototype, "visible", {
7716
7746
  get: function () {
7717
7747
  return this.visibleValue != null ? this.visibleValue : true;
@@ -7835,6 +7865,7 @@ var JsonObjectProperty = /** @class */ (function () {
7835
7865
  "showMode",
7836
7866
  "dependedProperties",
7837
7867
  "visibleIf",
7868
+ "enableIf",
7838
7869
  "onExecuteExpression",
7839
7870
  "onPropertyEditorUpdate",
7840
7871
  "maxLength",
@@ -8153,7 +8184,7 @@ var JsonMetadataClass = /** @class */ (function () {
8153
8184
  if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.maxLength)) {
8154
8185
  prop.maxLength = propInfo.maxLength;
8155
8186
  }
8156
- if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.displayName)) {
8187
+ if (propInfo.displayName !== undefined) {
8157
8188
  prop.displayName = propInfo.displayName;
8158
8189
  }
8159
8190
  if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.category)) {
@@ -8204,6 +8235,9 @@ var JsonMetadataClass = /** @class */ (function () {
8204
8235
  if (!!propInfo.visibleIf) {
8205
8236
  prop.visibleIf = propInfo.visibleIf;
8206
8237
  }
8238
+ if (!!propInfo.enableIf) {
8239
+ prop.enableIf = propInfo.enableIf;
8240
+ }
8207
8241
  if (!!propInfo.onExecuteExpression) {
8208
8242
  prop.onExecuteExpression = propInfo.onExecuteExpression;
8209
8243
  }
@@ -9130,9 +9164,7 @@ var JsonObject = /** @class */ (function () {
9130
9164
  JsonObject.prototype.removePosOnValueToJson = function (property, value) {
9131
9165
  if (!property.isCustom || !value)
9132
9166
  return value;
9133
- if (!!value[JsonObject.positionPropertyName]) {
9134
- delete value[JsonObject.positionPropertyName];
9135
- }
9167
+ this.removePosFromObj(value);
9136
9168
  return value;
9137
9169
  };
9138
9170
  JsonObject.prototype.removePos = function (property, value) {
@@ -9148,9 +9180,14 @@ var JsonObject = /** @class */ (function () {
9148
9180
  this.removePosFromObj(obj[i]);
9149
9181
  }
9150
9182
  }
9183
+ if (typeof obj !== "object")
9184
+ return;
9151
9185
  if (!!obj[JsonObject.positionPropertyName]) {
9152
9186
  delete obj[JsonObject.positionPropertyName];
9153
9187
  }
9188
+ for (var key in obj) {
9189
+ this.removePosFromObj(obj[key]);
9190
+ }
9154
9191
  };
9155
9192
  JsonObject.prototype.isValueArray = function (value) {
9156
9193
  return value && Array.isArray(value);
@@ -10826,7 +10863,8 @@ var SurveyFileChooseButton = /** @class */ (function (_super) {
10826
10863
  configurable: true
10827
10864
  });
10828
10865
  SurveyFileChooseButton.prototype.render = function () {
10829
- return Object(_reactSurvey__WEBPACK_IMPORTED_MODULE_1__["attachKey2click"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { tabIndex: 0, className: this.question.getChooseFileCss(), htmlFor: this.question.inputId, "aria-label": this.question.chooseButtonText },
10866
+ var _this = this;
10867
+ return Object(_reactSurvey__WEBPACK_IMPORTED_MODULE_1__["attachKey2click"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { tabIndex: 0, className: this.question.getChooseFileCss(), htmlFor: this.question.inputId, "aria-label": this.question.chooseButtonText, onClick: function () { return _this.question.chooseFile(); } },
10830
10868
  (!!this.question.cssClasses.chooseFileIconId) ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { title: this.question.chooseButtonText, iconName: this.question.cssClasses.chooseFileIconId, size: "auto" }) : null,
10831
10869
  react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, this.question.chooseButtonText)));
10832
10870
  };
@@ -11039,7 +11077,7 @@ var Header = /** @class */ (function (_super) {
11039
11077
  };
11040
11078
  Header.prototype.renderElement = function () {
11041
11079
  this.model.survey = this.props.survey;
11042
- if (!(this.props.survey.headerView === "advanced" && this.props.survey.renderedHasHeader)) {
11080
+ if (!(this.props.survey.headerView === "advanced")) {
11043
11081
  return null;
11044
11082
  }
11045
11083
  var headerContent = null;
@@ -15004,6 +15042,7 @@ var PopupSurvey = /** @class */ (function (_super) {
15004
15042
  var titleCollapsed = null;
15005
15043
  var expandCollapseIcon;
15006
15044
  var closeButton = null;
15045
+ var allowFullScreenButon = null;
15007
15046
  if (popup.isCollapsed) {
15008
15047
  headerCss += " " + popup.cssRootCollapsedMod;
15009
15048
  titleCollapsed = this.renderTitleCollapsed(popup);
@@ -15015,9 +15054,13 @@ var PopupSurvey = /** @class */ (function (_super) {
15015
15054
  if (popup.allowClose) {
15016
15055
  closeButton = this.renderCloseButton(this.popup);
15017
15056
  }
15057
+ if (popup.allowFullScreen) {
15058
+ allowFullScreenButon = this.renderAllowFullScreenButon(this.popup);
15059
+ }
15018
15060
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: popup.cssHeaderRoot },
15019
15061
  titleCollapsed,
15020
15062
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: popup.cssHeaderButtonsContainer },
15063
+ allowFullScreenButon,
15021
15064
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: popup.cssHeaderCollapseButton, onClick: this.handleOnExpanded }, expandCollapseIcon),
15022
15065
  closeButton)));
15023
15066
  };
@@ -15036,6 +15079,16 @@ var PopupSurvey = /** @class */ (function (_super) {
15036
15079
  return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: popup.cssHeaderCloseButton, onClick: function () { popup.hide(); } },
15037
15080
  react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { iconName: "icon-close_16x16", size: 16 })));
15038
15081
  };
15082
+ PopupSurvey.prototype.renderAllowFullScreenButon = function (popup) {
15083
+ var Icon;
15084
+ if (popup.isFullScreen) {
15085
+ Icon = react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { iconName: "icon-back-to-panel_16x16", size: 16 });
15086
+ }
15087
+ else {
15088
+ Icon = react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_svg_icon_svg_icon__WEBPACK_IMPORTED_MODULE_3__["SvgIcon"], { iconName: "icon-full-screen_16x16", size: 16 });
15089
+ }
15090
+ return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: popup.cssHeaderFullScreenButton, onClick: function () { popup.toggleFullScreen(); } }, Icon));
15091
+ };
15039
15092
  PopupSurvey.prototype.renderBody = function () {
15040
15093
  return react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.popup.cssBody }, this.doRender());
15041
15094
  };
@@ -15048,6 +15101,7 @@ var PopupSurvey = /** @class */ (function (_super) {
15048
15101
  this.popup.closeOnCompleteTimeout = newProps.closeOnCompleteTimeout;
15049
15102
  }
15050
15103
  this.popup.allowClose = newProps.allowClose;
15104
+ this.popup.allowFullScreen = newProps.allowFullScreen;
15051
15105
  this.popup.isShowing = true;
15052
15106
  if (!this.popup.isExpanded && (newProps.expanded || newProps.isExpanded))
15053
15107
  this.popup.expand();
@@ -15832,7 +15886,7 @@ var SurveyQuestionAndErrorsCell = /** @class */ (function (_super) {
15832
15886
  var style = this.getCellStyle();
15833
15887
  var cell = this.props.cell;
15834
15888
  var focusIn = function () { cell.focusIn(); };
15835
- return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("td", { ref: this.cellRef, className: this.itemCss, colSpan: cell.colSpans, "data-responsive-title": this.getHeaderText(), title: cell.getTitle(), style: style, onFocus: focusIn }, this.wrapCell(this.props.cell, (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.cssClasses.cellQuestionWrapper }, this.renderQuestion())))));
15889
+ return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("td", { ref: this.cellRef, className: this.itemCss, colSpan: cell.colSpans, "data-responsive-title": this.getHeaderText(), title: cell.getTitle(), style: style, onFocus: focusIn }, this.wrapCell(this.props.cell, (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", { className: this.props.cell.cellQuestionWrapperClassName }, this.renderQuestion())))));
15836
15890
  };
15837
15891
  SurveyQuestionAndErrorsCell.prototype.getCellStyle = function () {
15838
15892
  return null;
@@ -20515,8 +20569,8 @@ var settings = {
20515
20569
  * @param message A message to be displayed in the confirm dialog window.
20516
20570
  * @param callback A callback function that should be called with `true` if a user confirms an action or `false` otherwise.
20517
20571
  */
20518
- confirmActionAsync: function (message, callback, applyTitle, locale) {
20519
- return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["showConfirmDialog"])(message, callback, applyTitle, locale);
20572
+ confirmActionAsync: function (message, callback, applyTitle, locale, rootElement) {
20573
+ return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_0__["showConfirmDialog"])(message, callback, applyTitle, locale, rootElement);
20520
20574
  },
20521
20575
  /**
20522
20576
  * A minimum width value for all survey elements.
@@ -21082,7 +21136,7 @@ var VerticalResponsivityManager = /** @class */ (function (_super) {
21082
21136
  /*!****************************!*\
21083
21137
  !*** ./src/utils/utils.ts ***!
21084
21138
  \****************************/
21085
- /*! exports provided: unwrap, getRenderedSize, getRenderedStyleSize, doKey2ClickBlur, doKey2ClickUp, doKey2ClickDown, sanitizeEditableContent, Logger, showConfirmDialog, mergeValues, getElementWidth, isContainerVisible, classesToSelector, compareVersions, confirmAction, confirmActionAsync, detectIEOrEdge, detectIEBrowser, loadFileFromBase64, isMobile, isShadowDOM, getElement, isElementVisible, findScrollableParent, scrollElementByChildId, navigateToUrl, wrapUrlForBackgroundImage, createSvg, getIconNameFromProxy, increaseHeightByContent, getOriginalEvent, preventDefaults, findParentByClassNames, getFirstVisibleChild */
21139
+ /*! exports provided: unwrap, getRenderedSize, getRenderedStyleSize, doKey2ClickBlur, doKey2ClickUp, doKey2ClickDown, sanitizeEditableContent, Logger, showConfirmDialog, mergeValues, getElementWidth, isContainerVisible, classesToSelector, compareVersions, confirmAction, confirmActionAsync, detectIEOrEdge, detectIEBrowser, loadFileFromBase64, isMobile, isShadowDOM, getElement, isElementVisible, findScrollableParent, scrollElementByChildId, navigateToUrl, wrapUrlForBackgroundImage, createSvg, getIconNameFromProxy, increaseHeightByContent, getOriginalEvent, preventDefaults, findParentByClassNames, getFirstVisibleChild, chooseFiles */
21086
21140
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
21087
21141
 
21088
21142
  "use strict";
@@ -21121,6 +21175,7 @@ __webpack_require__.r(__webpack_exports__);
21121
21175
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preventDefaults", function() { return preventDefaults; });
21122
21176
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findParentByClassNames", function() { return findParentByClassNames; });
21123
21177
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFirstVisibleChild", function() { return getFirstVisibleChild; });
21178
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "chooseFiles", function() { return chooseFiles; });
21124
21179
  /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../localizablestring */ "./src/localizablestring.ts");
21125
21180
  /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../settings */ "./src/settings.ts");
21126
21181
  /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts");
@@ -21145,7 +21200,7 @@ function confirmAction(message) {
21145
21200
  return _settings__WEBPACK_IMPORTED_MODULE_1__["settings"].confirmActionFunc(message);
21146
21201
  return confirm(message);
21147
21202
  }
21148
- function confirmActionAsync(message, funcOnYes, funcOnNo, locale) {
21203
+ function confirmActionAsync(message, funcOnYes, funcOnNo, locale, rootElement) {
21149
21204
  var callbackFunc = function (res) {
21150
21205
  if (res)
21151
21206
  funcOnYes();
@@ -21153,7 +21208,7 @@ function confirmActionAsync(message, funcOnYes, funcOnNo, locale) {
21153
21208
  funcOnNo();
21154
21209
  };
21155
21210
  if (!!_settings__WEBPACK_IMPORTED_MODULE_1__["settings"] && !!_settings__WEBPACK_IMPORTED_MODULE_1__["settings"].confirmActionAsync) {
21156
- if (_settings__WEBPACK_IMPORTED_MODULE_1__["settings"].confirmActionAsync(message, callbackFunc, undefined, locale))
21211
+ if (_settings__WEBPACK_IMPORTED_MODULE_1__["settings"].confirmActionAsync(message, callbackFunc, undefined, locale, rootElement))
21157
21212
  return;
21158
21213
  }
21159
21214
  callbackFunc(confirmAction(message));
@@ -21502,7 +21557,7 @@ var Logger = /** @class */ (function () {
21502
21557
  return Logger;
21503
21558
  }());
21504
21559
 
21505
- function showConfirmDialog(message, callback, applyTitle, locale) {
21560
+ function showConfirmDialog(message, callback, applyTitle, locale, rootElement) {
21506
21561
  var locStr = new _localizablestring__WEBPACK_IMPORTED_MODULE_0__["LocalizableString"](undefined);
21507
21562
  var popupViewModel = _settings__WEBPACK_IMPORTED_MODULE_1__["settings"].showDialog({
21508
21563
  componentName: "sv-string-viewer",
@@ -21519,7 +21574,7 @@ function showConfirmDialog(message, callback, applyTitle, locale) {
21519
21574
  displayMode: "popup",
21520
21575
  isFocusedContent: false,
21521
21576
  cssClass: "sv-popup--confirm-delete"
21522
- }, /*settings.rootElement*/ document.body); //TODO survey root
21577
+ }, rootElement);
21523
21578
  var toolbar = popupViewModel.footerToolbar;
21524
21579
  var applyBtn = toolbar.getActionById("apply");
21525
21580
  var cancelBtn = toolbar.getActionById("cancel");
@@ -21530,6 +21585,23 @@ function showConfirmDialog(message, callback, applyTitle, locale) {
21530
21585
  popupViewModel.width = "452px";
21531
21586
  return true;
21532
21587
  }
21588
+ function chooseFiles(input, callback) {
21589
+ if (!window || !window["FileReader"])
21590
+ return;
21591
+ input.value = "";
21592
+ input.onchange = function (event) {
21593
+ if (!window["FileReader"])
21594
+ return;
21595
+ if (!input || !input.files || input.files.length < 1)
21596
+ return;
21597
+ var files = [];
21598
+ for (var i = 0; i < input.files.length; i++) {
21599
+ files.push(input.files[i]);
21600
+ }
21601
+ callback(files);
21602
+ };
21603
+ input.click();
21604
+ }
21533
21605
 
21534
21606
 
21535
21607