powerpagestoolkit 1.3.2041 → 1.3.3001
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 +20 -9
- package/index.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.bundle.js
CHANGED
|
@@ -1074,6 +1074,17 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1074
1074
|
value: function setTextContent(text) {
|
|
1075
1075
|
this.element.innerHTML = text;
|
|
1076
1076
|
}
|
|
1077
|
+
}, {
|
|
1078
|
+
key: "setStyle",
|
|
1079
|
+
value: function setStyle(options) {
|
|
1080
|
+
var _this5 = this;
|
|
1081
|
+
if (!Object.prototype.toString.call(options) !== "[object Object]") {
|
|
1082
|
+
throw new Error("powerpagestoolkit: 'DOMNodeReference.setStyle' required options to be in the form of an object. Argument passed was of type: ".concat(DOMNodeReferences_typeof(options)));
|
|
1083
|
+
}
|
|
1084
|
+
Object.keys(options).forEach(function (key) {
|
|
1085
|
+
_this5.element.style[key] = options[key];
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1077
1088
|
}, {
|
|
1078
1089
|
key: "uncheckRadios",
|
|
1079
1090
|
value: function uncheckRadios() {
|
|
@@ -1087,18 +1098,18 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1087
1098
|
}, {
|
|
1088
1099
|
key: "configureConditionalRendering",
|
|
1089
1100
|
value: function configureConditionalRendering(condition, triggerNodes) {
|
|
1090
|
-
var
|
|
1101
|
+
var _this6 = this;
|
|
1091
1102
|
try {
|
|
1092
1103
|
this.toggleVisibility(condition(this));
|
|
1093
1104
|
if (triggerNodes) {
|
|
1094
1105
|
var nodes = Array.isArray(triggerNodes) ? triggerNodes : [triggerNodes];
|
|
1095
1106
|
nodes.forEach(function (node) {
|
|
1096
1107
|
node.on("change", function () {
|
|
1097
|
-
return
|
|
1108
|
+
return _this6.toggleVisibility(condition(_this6));
|
|
1098
1109
|
});
|
|
1099
1110
|
var observer = new MutationObserver(function () {
|
|
1100
1111
|
var display = window.getComputedStyle(node.visibilityController).display;
|
|
1101
|
-
|
|
1112
|
+
_this6.toggleVisibility(display !== "none" && condition(_this6));
|
|
1102
1113
|
});
|
|
1103
1114
|
observer.observe(node.visibilityController, {
|
|
1104
1115
|
attributes: true,
|
|
@@ -1113,7 +1124,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1113
1124
|
}, {
|
|
1114
1125
|
key: "configureValidationAndRequirements",
|
|
1115
1126
|
value: function configureValidationAndRequirements(isRequired, isValid, fieldDisplayName) {
|
|
1116
|
-
var
|
|
1127
|
+
var _this7 = this;
|
|
1117
1128
|
var dependencies = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1118
1129
|
if (typeof Page_Validators !== "undefined") {
|
|
1119
1130
|
var newValidator = document.createElement("span");
|
|
@@ -1132,7 +1143,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1132
1143
|
dependencies = Array.isArray(dependencies) ? dependencies : [dependencies];
|
|
1133
1144
|
dependencies.forEach(function (dep) {
|
|
1134
1145
|
dep.element.addEventListener("change", function () {
|
|
1135
|
-
return
|
|
1146
|
+
return _this7.setRequiredLevel(isRequired(_this7));
|
|
1136
1147
|
});
|
|
1137
1148
|
});
|
|
1138
1149
|
}
|
|
@@ -1148,15 +1159,15 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1148
1159
|
}, {
|
|
1149
1160
|
key: "onceLoaded",
|
|
1150
1161
|
value: function onceLoaded(callback) {
|
|
1151
|
-
var
|
|
1162
|
+
var _this8 = this;
|
|
1152
1163
|
if (this.isLoaded) {
|
|
1153
1164
|
callback(this);
|
|
1154
1165
|
} else {
|
|
1155
1166
|
var observer = new MutationObserver(function () {
|
|
1156
|
-
if (document.querySelector(
|
|
1167
|
+
if (document.querySelector(_this8.target)) {
|
|
1157
1168
|
observer.disconnect(); // Stop observing once loaded
|
|
1158
|
-
|
|
1159
|
-
callback(
|
|
1169
|
+
_this8.isLoaded = true;
|
|
1170
|
+
callback(_this8); // Call the provided callback
|
|
1160
1171
|
}
|
|
1161
1172
|
});
|
|
1162
1173
|
observer.observe(document.body, {
|
package/index.d.ts
CHANGED
|
@@ -164,6 +164,13 @@ class DOMNodeReference {
|
|
|
164
164
|
*/
|
|
165
165
|
setTextContent(text: string): void;
|
|
166
166
|
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
* @param {Partial<CSSStyleDeclaration>} options - An object with the style properties (keys) and updated styles (values)
|
|
170
|
+
* to apply to the this. {"key": "value"}
|
|
171
|
+
*/
|
|
172
|
+
setStyle(options: Partial<CSSStyleDeclaration>): void;
|
|
173
|
+
|
|
167
174
|
/**
|
|
168
175
|
*
|
|
169
176
|
* @param {boolean} shouldShow shows or hides the target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powerpagestoolkit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3001",
|
|
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",
|