powerpagestoolkit 1.3.104 → 1.3.1041
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/dist/index.bundle.js +5 -7
- package/index.d.ts +4 -7
- package/package.json +1 -1
package/dist/index.bundle.js
CHANGED
|
@@ -1064,29 +1064,27 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
}, {
|
|
1066
1066
|
key: "configureValidationAndRequirements",
|
|
1067
|
-
value: function configureValidationAndRequirements(
|
|
1067
|
+
value: function configureValidationAndRequirements(isRequired, isValid, fieldDisplayName) {
|
|
1068
1068
|
var _this2 = this;
|
|
1069
|
-
var
|
|
1070
|
-
validationLogic = _ref.validationLogic;
|
|
1071
|
-
var dependencies = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1069
|
+
var dependencies = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1072
1070
|
if (typeof Page_Validators !== "undefined") {
|
|
1073
1071
|
var newValidator = document.createElement("span");
|
|
1074
1072
|
newValidator.style.display = "none";
|
|
1075
1073
|
newValidator.id = "".concat(this.id, "Validator");
|
|
1076
1074
|
newValidator.controltovalidate = this.id;
|
|
1077
1075
|
newValidator.errormessage = "<a href='#".concat(this.element.id, "_label'>").concat(fieldDisplayName, " is a required field</a>");
|
|
1078
|
-
newValidator.evaluationfunction =
|
|
1076
|
+
newValidator.evaluationfunction = isValid.bind(this);
|
|
1079
1077
|
//eslint-disable-next-line
|
|
1080
1078
|
Page_Validators.push(newValidator);
|
|
1081
1079
|
} else {
|
|
1082
1080
|
throw new Error("Attempted to add to Validator where Page_Validators do not exist");
|
|
1083
1081
|
}
|
|
1084
|
-
this.setRequiredLevel(
|
|
1082
|
+
this.setRequiredLevel(isRequired(this));
|
|
1085
1083
|
if (!dependencies) return;
|
|
1086
1084
|
dependencies = Array.isArray(dependencies) ? dependencies : [dependencies];
|
|
1087
1085
|
dependencies.forEach(function (dep) {
|
|
1088
1086
|
dep.element.addEventListener("change", function () {
|
|
1089
|
-
return _this2.setRequiredLevel(
|
|
1087
|
+
return _this2.setRequiredLevel(isRequired(_this2));
|
|
1090
1088
|
});
|
|
1091
1089
|
});
|
|
1092
1090
|
}
|
package/index.d.ts
CHANGED
|
@@ -129,17 +129,14 @@ class DOMNodeReference {
|
|
|
129
129
|
/**
|
|
130
130
|
* Configures validation and requirement conditions for the field based on the provided logic functions and dependencies.
|
|
131
131
|
* Creates a validator and sets a required level dynamically based on dependency changes.
|
|
132
|
-
* @param {
|
|
133
|
-
* @param {(this: DOMNodeReference) => boolean}
|
|
134
|
-
* @param {(this: DOMNodeReference) => boolean} config.validationLogic - Function to evaluate the field's validity.
|
|
132
|
+
* @param {(this: DOMNodeReference) => boolean} isRequired - Function to determine if the field is required.
|
|
133
|
+
* @param {(this: DOMNodeReference) => boolean} isValid - Function to evaluate the field's validity.
|
|
135
134
|
* @param {string} fieldDisplayName - Display name used in error messages if validation fails.
|
|
136
135
|
* @param {Array<DOMNodeReference>} [dependencies] - Optional dependencies for setting requirement conditions dynamically.
|
|
137
136
|
*/
|
|
138
137
|
configureValidationAndRequirements(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
validationLogic: (this: this) => boolean;
|
|
142
|
-
},
|
|
138
|
+
isRequired: (this: this) => boolean,
|
|
139
|
+
isValid: (this: this) => boolean,
|
|
143
140
|
fieldDisplayName: string,
|
|
144
141
|
dependencies?: DOMNodeReference[]
|
|
145
142
|
): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powerpagestoolkit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1041",
|
|
4
4
|
"description": "Reference, manipulate, and engage with Power Pages sites through the nodes in the DOM; use a variety of custom methods that allow customizing your power pages site quicker and easier. ",
|
|
5
5
|
"main": "./dist/index.bundle.js",
|
|
6
6
|
"types": "index.d.ts",
|