survey-react-ui 1.9.124 → 1.9.125
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 +1 -1
- package/survey-react-ui.js +65 -32
- package/survey-react-ui.js.map +1 -1
- package/survey-react-ui.min.js +2 -2
package/package.json
CHANGED
package/survey-react-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - Survey JavaScript library v1.9.
|
|
2
|
+
* surveyjs - Survey JavaScript library v1.9.125
|
|
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
|
*/
|
|
@@ -959,8 +959,8 @@ var Base = /** @class */ (function () {
|
|
|
959
959
|
Base.prototype.createCustomLocalizableObj = function (name) {
|
|
960
960
|
var locStr = this.getLocalizableString(name);
|
|
961
961
|
if (locStr)
|
|
962
|
-
return;
|
|
963
|
-
this.createLocalizableString(name, this, false, true);
|
|
962
|
+
return locStr;
|
|
963
|
+
return this.createLocalizableString(name, this, false, true);
|
|
964
964
|
};
|
|
965
965
|
Base.prototype.getLocale = function () {
|
|
966
966
|
var locOwner = this.getSurvey();
|
|
@@ -2606,7 +2606,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2606
2606
|
|
|
2607
2607
|
|
|
2608
2608
|
|
|
2609
|
-
Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.
|
|
2609
|
+
Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["checkLibraryVersion"])("" + "1.9.125", "survey-react-ui");
|
|
2610
2610
|
|
|
2611
2611
|
|
|
2612
2612
|
/***/ }),
|
|
@@ -7490,7 +7490,12 @@ var JsonObjectProperty = /** @class */ (function () {
|
|
|
7490
7490
|
return this.isRequiredValue;
|
|
7491
7491
|
},
|
|
7492
7492
|
set: function (val) {
|
|
7493
|
-
this.
|
|
7493
|
+
if (val !== this.isRequired) {
|
|
7494
|
+
this.isRequiredValue = val;
|
|
7495
|
+
if (!!this.classInfo) {
|
|
7496
|
+
this.classInfo.resetAllProperties();
|
|
7497
|
+
}
|
|
7498
|
+
}
|
|
7494
7499
|
},
|
|
7495
7500
|
enumerable: false,
|
|
7496
7501
|
configurable: true
|
|
@@ -7525,7 +7530,7 @@ var JsonObjectProperty = /** @class */ (function () {
|
|
|
7525
7530
|
JsonObjectProperty.prototype.getDefaultValue = function (obj) {
|
|
7526
7531
|
var result = !!this.defaultValueFunc ? this.defaultValueFunc(obj) : this.defaultValueValue;
|
|
7527
7532
|
if (!!JsonObjectProperty.getItemValuesDefaultValue &&
|
|
7528
|
-
|
|
7533
|
+
Serializer.isDescendantOf(this.className, "itemvalue")) {
|
|
7529
7534
|
result = JsonObjectProperty.getItemValuesDefaultValue(this.defaultValueValue || [], this.className);
|
|
7530
7535
|
}
|
|
7531
7536
|
return result;
|
|
@@ -7870,7 +7875,8 @@ var CustomPropertiesCollection = /** @class */ (function () {
|
|
|
7870
7875
|
if (prop.isLocalizable &&
|
|
7871
7876
|
prop.serializationProperty &&
|
|
7872
7877
|
obj.createCustomLocalizableObj) {
|
|
7873
|
-
obj.createCustomLocalizableObj(prop.name);
|
|
7878
|
+
var locStr = obj.createCustomLocalizableObj(prop.name);
|
|
7879
|
+
locStr.defaultValue = prop.defaultValue;
|
|
7874
7880
|
var locDesc = {
|
|
7875
7881
|
get: function () {
|
|
7876
7882
|
return obj.getLocalizableString(prop.name);
|
|
@@ -7879,7 +7885,7 @@ var CustomPropertiesCollection = /** @class */ (function () {
|
|
|
7879
7885
|
Object.defineProperty(obj, prop.serializationProperty, locDesc);
|
|
7880
7886
|
var desc = {
|
|
7881
7887
|
get: function () {
|
|
7882
|
-
return obj.getLocalizableStringText(prop.name
|
|
7888
|
+
return obj.getLocalizableStringText(prop.name);
|
|
7883
7889
|
},
|
|
7884
7890
|
set: function (v) {
|
|
7885
7891
|
obj.setLocalizableStringText(prop.name, v);
|
|
@@ -7891,7 +7897,7 @@ var CustomPropertiesCollection = /** @class */ (function () {
|
|
|
7891
7897
|
var defaultValue = prop.defaultValue;
|
|
7892
7898
|
var isArrayProp = prop.isArray || prop.type === "multiplevalues";
|
|
7893
7899
|
if (typeof obj.createNewArray === "function") {
|
|
7894
|
-
if (
|
|
7900
|
+
if (Serializer.isDescendantOf(prop.className, "itemvalue")) {
|
|
7895
7901
|
obj.createNewArray(prop.name, function (item) {
|
|
7896
7902
|
item.locOwner = obj;
|
|
7897
7903
|
item.ownerPropertyName = prop.name;
|
|
@@ -7982,8 +7988,20 @@ var JsonMetadataClass = /** @class */ (function () {
|
|
|
7982
7988
|
this.fillAllProperties();
|
|
7983
7989
|
return this.allProperties;
|
|
7984
7990
|
};
|
|
7991
|
+
JsonMetadataClass.prototype.getRequiredProperties = function () {
|
|
7992
|
+
if (!!this.requiredProperties)
|
|
7993
|
+
return this.requiredProperties;
|
|
7994
|
+
this.requiredProperties = [];
|
|
7995
|
+
var props = this.getAllProperties();
|
|
7996
|
+
for (var i = 0; i < props.length; i++) {
|
|
7997
|
+
if (props[i].isRequired)
|
|
7998
|
+
this.requiredProperties.push(props[i]);
|
|
7999
|
+
}
|
|
8000
|
+
return this.requiredProperties;
|
|
8001
|
+
};
|
|
7985
8002
|
JsonMetadataClass.prototype.resetAllProperties = function () {
|
|
7986
8003
|
this.allProperties = undefined;
|
|
8004
|
+
this.requiredProperties = undefined;
|
|
7987
8005
|
this.hashProperties = undefined;
|
|
7988
8006
|
var childClasses = Serializer.getChildrenClasses(this.name);
|
|
7989
8007
|
for (var i = 0; i < childClasses.length; i++) {
|
|
@@ -8253,6 +8271,7 @@ var JsonMetadata = /** @class */ (function () {
|
|
|
8253
8271
|
this.classes = {};
|
|
8254
8272
|
this.alternativeNames = {};
|
|
8255
8273
|
this.childrenClasses = {};
|
|
8274
|
+
this.dynamicPropsCache = {};
|
|
8256
8275
|
}
|
|
8257
8276
|
JsonMetadata.prototype.getObjPropertyValue = function (obj, name) {
|
|
8258
8277
|
if (this.isObjWrapper(obj)) {
|
|
@@ -8365,14 +8384,18 @@ var JsonMetadata = /** @class */ (function () {
|
|
|
8365
8384
|
if (dynamicType === void 0) { dynamicType = null; }
|
|
8366
8385
|
if (!obj || !obj.getType || (!obj.getDynamicType && !dynamicType))
|
|
8367
8386
|
return [];
|
|
8387
|
+
var objType = obj.getType();
|
|
8368
8388
|
var dType = !!dynamicType ? dynamicType : obj.getDynamicType();
|
|
8369
8389
|
if (!dType)
|
|
8370
8390
|
return [];
|
|
8391
|
+
var cacheType = dType + "-" + objType;
|
|
8392
|
+
if (this.dynamicPropsCache[cacheType])
|
|
8393
|
+
return this.dynamicPropsCache[cacheType];
|
|
8371
8394
|
var dynamicProps = this.getProperties(dType);
|
|
8372
8395
|
if (!dynamicProps || dynamicProps.length == 0)
|
|
8373
8396
|
return [];
|
|
8374
8397
|
var hash = {};
|
|
8375
|
-
var props = this.getProperties(
|
|
8398
|
+
var props = this.getProperties(objType);
|
|
8376
8399
|
for (var i = 0; i < props.length; i++) {
|
|
8377
8400
|
hash[props[i].name] = props[i];
|
|
8378
8401
|
}
|
|
@@ -8383,6 +8406,7 @@ var JsonMetadata = /** @class */ (function () {
|
|
|
8383
8406
|
res.push(dProp);
|
|
8384
8407
|
}
|
|
8385
8408
|
}
|
|
8409
|
+
this.dynamicPropsCache[cacheType] = res;
|
|
8386
8410
|
return res;
|
|
8387
8411
|
};
|
|
8388
8412
|
JsonMetadata.prototype.hasOriginalProperty = function (obj, propName) {
|
|
@@ -8492,12 +8516,13 @@ var JsonMetadata = /** @class */ (function () {
|
|
|
8492
8516
|
return result;
|
|
8493
8517
|
};
|
|
8494
8518
|
JsonMetadata.prototype.getRequiredProperties = function (name) {
|
|
8495
|
-
var
|
|
8519
|
+
var metaClass = this.findClass(name);
|
|
8520
|
+
if (!metaClass)
|
|
8521
|
+
return [];
|
|
8522
|
+
var props = metaClass.getRequiredProperties();
|
|
8496
8523
|
var res = [];
|
|
8497
|
-
for (var i = 0; i <
|
|
8498
|
-
|
|
8499
|
-
res.push(properties[i].name);
|
|
8500
|
-
}
|
|
8524
|
+
for (var i = 0; i < props.length; i++) {
|
|
8525
|
+
res.push(props[i].name);
|
|
8501
8526
|
}
|
|
8502
8527
|
return res;
|
|
8503
8528
|
};
|
|
@@ -8516,6 +8541,7 @@ var JsonMetadata = /** @class */ (function () {
|
|
|
8516
8541
|
return null;
|
|
8517
8542
|
var property = metaDataClass.createProperty(propertyInfo, true);
|
|
8518
8543
|
if (property) {
|
|
8544
|
+
this.clearDynamicPropsCache(metaDataClass);
|
|
8519
8545
|
metaDataClass.resetAllProperties();
|
|
8520
8546
|
}
|
|
8521
8547
|
return property;
|
|
@@ -8526,11 +8552,15 @@ var JsonMetadata = /** @class */ (function () {
|
|
|
8526
8552
|
return false;
|
|
8527
8553
|
var property = metaDataClass.find(propertyName);
|
|
8528
8554
|
if (property) {
|
|
8555
|
+
this.clearDynamicPropsCache(metaDataClass);
|
|
8529
8556
|
this.removePropertyFromClass(metaDataClass, property);
|
|
8530
8557
|
metaDataClass.resetAllProperties();
|
|
8531
8558
|
CustomPropertiesCollection.removeProperty(metaDataClass.name, propertyName);
|
|
8532
8559
|
}
|
|
8533
8560
|
};
|
|
8561
|
+
JsonMetadata.prototype.clearDynamicPropsCache = function (metaDataClass) {
|
|
8562
|
+
this.dynamicPropsCache = {};
|
|
8563
|
+
};
|
|
8534
8564
|
JsonMetadata.prototype.removePropertyFromClass = function (metaDataClass, property) {
|
|
8535
8565
|
var index = metaDataClass.properties.indexOf(property);
|
|
8536
8566
|
if (index < 0)
|
|
@@ -8757,7 +8787,7 @@ var JsonUnknownPropertyError = /** @class */ (function (_super) {
|
|
|
8757
8787
|
"' is unknown.") || this;
|
|
8758
8788
|
_this.propertyName = propertyName;
|
|
8759
8789
|
_this.className = className;
|
|
8760
|
-
var properties =
|
|
8790
|
+
var properties = Serializer.getProperties(className);
|
|
8761
8791
|
if (properties) {
|
|
8762
8792
|
_this.description = "The list of available properties are: ";
|
|
8763
8793
|
for (var i = 0; i < properties.length; i++) {
|
|
@@ -8780,7 +8810,7 @@ var JsonMissingTypeErrorBase = /** @class */ (function (_super) {
|
|
|
8780
8810
|
_this.type = type;
|
|
8781
8811
|
_this.message = message;
|
|
8782
8812
|
_this.description = "The following types are available: ";
|
|
8783
|
-
var types =
|
|
8813
|
+
var types = Serializer.getChildrenClasses(baseClassName, true);
|
|
8784
8814
|
for (var i = 0; i < types.length; i++) {
|
|
8785
8815
|
if (i > 0)
|
|
8786
8816
|
_this.description += ", ";
|
|
@@ -8886,9 +8916,9 @@ var JsonObject = /** @class */ (function () {
|
|
|
8886
8916
|
var needAddErrors = true;
|
|
8887
8917
|
if (obj.getType) {
|
|
8888
8918
|
objType = obj.getType();
|
|
8889
|
-
properties =
|
|
8919
|
+
properties = Serializer.getProperties(objType);
|
|
8890
8920
|
needAddErrors =
|
|
8891
|
-
!!objType && !
|
|
8921
|
+
!!objType && !Serializer.isDescendantOf(objType, "itemvalue");
|
|
8892
8922
|
}
|
|
8893
8923
|
if (!properties)
|
|
8894
8924
|
return;
|
|
@@ -8928,7 +8958,7 @@ var JsonObject = /** @class */ (function () {
|
|
|
8928
8958
|
if (property != null && !property.className) {
|
|
8929
8959
|
result[JsonObject.typePropertyName] = property.getObjType(obj.getType());
|
|
8930
8960
|
}
|
|
8931
|
-
this.propertiesToJson(obj,
|
|
8961
|
+
this.propertiesToJson(obj, Serializer.getProperties(obj.getType()), result, storeDefaults);
|
|
8932
8962
|
this.propertiesToJson(obj, this.getDynamicProperties(obj), result, storeDefaults);
|
|
8933
8963
|
return result;
|
|
8934
8964
|
};
|
|
@@ -9046,7 +9076,7 @@ var JsonObject = /** @class */ (function () {
|
|
|
9046
9076
|
var result = { newObj: null, error: null };
|
|
9047
9077
|
var className = this.getClassNameForNewObj(value, property);
|
|
9048
9078
|
result.newObj = className
|
|
9049
|
-
?
|
|
9079
|
+
? Serializer.createClass(className, value)
|
|
9050
9080
|
: null;
|
|
9051
9081
|
result.error = this.checkNewObjectOnErrors(result.newObj, value, property, className);
|
|
9052
9082
|
return result;
|
|
@@ -9088,16 +9118,18 @@ var JsonObject = /** @class */ (function () {
|
|
|
9088
9118
|
JsonObject.prototype.getRequiredError = function (obj, jsonValue) {
|
|
9089
9119
|
if (!obj.getType || typeof obj.getData === "function")
|
|
9090
9120
|
return null;
|
|
9091
|
-
var
|
|
9092
|
-
|
|
9093
|
-
|
|
9121
|
+
var metaClass = Serializer.findClass(obj.getType());
|
|
9122
|
+
if (!metaClass)
|
|
9123
|
+
return null;
|
|
9124
|
+
var props = metaClass.getRequiredProperties();
|
|
9125
|
+
if (!Array.isArray(props))
|
|
9094
9126
|
return null;
|
|
9095
|
-
for (var i = 0; i <
|
|
9096
|
-
var prop =
|
|
9097
|
-
if (!
|
|
9127
|
+
for (var i = 0; i < props.length; i++) {
|
|
9128
|
+
var prop = props[i];
|
|
9129
|
+
if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(prop.defaultValue))
|
|
9098
9130
|
continue;
|
|
9099
9131
|
if (!jsonValue[prop.name]) {
|
|
9100
|
-
return new JsonRequiredPropertyError(prop.name,
|
|
9132
|
+
return new JsonRequiredPropertyError(prop.name, obj.getType());
|
|
9101
9133
|
}
|
|
9102
9134
|
}
|
|
9103
9135
|
return null;
|
|
@@ -9313,7 +9345,7 @@ var LocalizableString = /** @class */ (function () {
|
|
|
9313
9345
|
}
|
|
9314
9346
|
}
|
|
9315
9347
|
if (!res)
|
|
9316
|
-
res = "";
|
|
9348
|
+
res = this.defaultValue || "";
|
|
9317
9349
|
return res;
|
|
9318
9350
|
},
|
|
9319
9351
|
enumerable: false,
|
|
@@ -9811,6 +9843,7 @@ var englishStrings = {
|
|
|
9811
9843
|
requiredError: "Response required.",
|
|
9812
9844
|
requiredErrorInPanel: "Response required: answer at least one question.",
|
|
9813
9845
|
requiredInAllRowsError: "Response required: answer questions in all rows.",
|
|
9846
|
+
eachRowUniqueError: "Each row must have a unique value.",
|
|
9814
9847
|
numericError: "The value should be numeric.",
|
|
9815
9848
|
minError: "The value should not be less than {0}",
|
|
9816
9849
|
maxError: "The value should not be greater than {0}",
|
|
@@ -19932,7 +19965,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
19932
19965
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; });
|
|
19933
19966
|
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts");
|
|
19934
19967
|
|
|
19935
|
-
var document = globalThis.document;
|
|
19968
|
+
var document = typeof globalThis !== "undefined" ? globalThis.document : undefined.document;
|
|
19936
19969
|
var defaultEnvironment = (!!document ? {
|
|
19937
19970
|
root: document,
|
|
19938
19971
|
_rootElement: document.body,
|
|
@@ -20110,12 +20143,12 @@ var settings = {
|
|
|
20110
20143
|
* import { ItemValue, settings } from "survey-core";
|
|
20111
20144
|
*
|
|
20112
20145
|
* // `itemValueSerializeAsObject` example
|
|
20113
|
-
* settings.
|
|
20146
|
+
* settings.serialization.itemValueSerializeAsObject = true;
|
|
20114
20147
|
* const item = new ItemValue(5);
|
|
20115
20148
|
* const itemString = item.toJSON(); // Produces { value: 5 } instead of 5
|
|
20116
20149
|
*
|
|
20117
20150
|
* // `itemValueSerializeDisplayText` example
|
|
20118
|
-
* settings.
|
|
20151
|
+
* settings.serialization.itemValueSerializeDisplayText = true;
|
|
20119
20152
|
* const item = new ItemValue("item1");
|
|
20120
20153
|
* const itemString = item.toJSON(); // Produces { value: "item1", text: "item1" } instead of "item1"
|
|
20121
20154
|
* ```
|