powerpagestoolkit 1.3.304 → 1.3.501
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 -13
- package/index.d.ts +47 -20
- package/package.json +1 -1
package/dist/index.bundle.js
CHANGED
|
@@ -804,7 +804,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
804
804
|
_context.next = 7;
|
|
805
805
|
break;
|
|
806
806
|
}
|
|
807
|
-
|
|
807
|
+
return _context.abrupt("return", new DOMNodeNotFoundError(this));
|
|
808
808
|
case 7:
|
|
809
809
|
if (!this.element.classList.contains("boolean-radio")) {
|
|
810
810
|
_context.next = 10;
|
|
@@ -822,7 +822,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
822
822
|
case 16:
|
|
823
823
|
_context.prev = 16;
|
|
824
824
|
_context.t0 = _context["catch"](0);
|
|
825
|
-
|
|
825
|
+
return _context.abrupt("return", new DOMNodeInitializationError(this, _context.t0));
|
|
826
826
|
case 19:
|
|
827
827
|
case "end":
|
|
828
828
|
return _context.stop();
|
|
@@ -976,7 +976,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
976
976
|
try {
|
|
977
977
|
this.element.disabled = true;
|
|
978
978
|
} catch (e) {
|
|
979
|
-
|
|
979
|
+
return new Error("There was an error trying to disable the target: ".concat(this.target));
|
|
980
980
|
}
|
|
981
981
|
return this;
|
|
982
982
|
}
|
|
@@ -986,7 +986,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
986
986
|
try {
|
|
987
987
|
this.element.disabled = false;
|
|
988
988
|
} catch (e) {
|
|
989
|
-
|
|
989
|
+
return new Error("There was an error trying to disable the target: ".concat(this.target));
|
|
990
990
|
}
|
|
991
991
|
return this;
|
|
992
992
|
}
|
|
@@ -1084,9 +1084,15 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1084
1084
|
return this;
|
|
1085
1085
|
}
|
|
1086
1086
|
}, {
|
|
1087
|
-
key: "
|
|
1088
|
-
value: function
|
|
1089
|
-
this.element.innerHTML =
|
|
1087
|
+
key: "setInnerHTML",
|
|
1088
|
+
value: function setInnerHTML(string) {
|
|
1089
|
+
this.element.innerHTML = string;
|
|
1090
|
+
return this;
|
|
1091
|
+
}
|
|
1092
|
+
}, {
|
|
1093
|
+
key: "remove",
|
|
1094
|
+
value: function remove() {
|
|
1095
|
+
this.element.remove();
|
|
1090
1096
|
return this;
|
|
1091
1097
|
}
|
|
1092
1098
|
}, {
|
|
@@ -1094,7 +1100,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1094
1100
|
value: function setStyle(options) {
|
|
1095
1101
|
var _this5 = this;
|
|
1096
1102
|
if (Object.prototype.toString.call(options) !== "[object Object]") {
|
|
1097
|
-
|
|
1103
|
+
return new Error("powerpagestoolkit: 'DOMNodeReference.setStyle' required options to be in the form of an object. Argument passed was of type: ".concat(DOMNodeReferences_typeof(options)));
|
|
1098
1104
|
}
|
|
1099
1105
|
Object.keys(options).forEach(function (key) {
|
|
1100
1106
|
_this5.element.style[key] = options[key];
|
|
@@ -1135,7 +1141,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1135
1141
|
});
|
|
1136
1142
|
}
|
|
1137
1143
|
} catch (e) {
|
|
1138
|
-
|
|
1144
|
+
return new ConditionalRenderingError(this, e);
|
|
1139
1145
|
}
|
|
1140
1146
|
return this;
|
|
1141
1147
|
}
|
|
@@ -1154,7 +1160,7 @@ var DOMNodeReference = /*#__PURE__*/function () {
|
|
|
1154
1160
|
//eslint-disable-next-line
|
|
1155
1161
|
Page_Validators.push(newValidator);
|
|
1156
1162
|
} else {
|
|
1157
|
-
|
|
1163
|
+
return new Error("Attempted to add to Validator where Page_Validators do not exist");
|
|
1158
1164
|
}
|
|
1159
1165
|
this.setRequiredLevel(isRequired(this));
|
|
1160
1166
|
if (!dependencies) return this;
|
|
@@ -1241,9 +1247,10 @@ function _createDOMNodeReference() {
|
|
|
1241
1247
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
1242
1248
|
args[_key6] = arguments[_key6];
|
|
1243
1249
|
}
|
|
1244
|
-
|
|
1250
|
+
target.onceLoaded(function () {
|
|
1245
1251
|
return value.apply(target, args);
|
|
1246
1252
|
});
|
|
1253
|
+
return target;
|
|
1247
1254
|
};
|
|
1248
1255
|
}
|
|
1249
1256
|
return value;
|
|
@@ -1253,7 +1260,7 @@ function _createDOMNodeReference() {
|
|
|
1253
1260
|
_context3.prev = 7;
|
|
1254
1261
|
_context3.t0 = _context3["catch"](0);
|
|
1255
1262
|
console.error("There was an error creating a DOMNodeReference: ".concat(_context3.t0));
|
|
1256
|
-
|
|
1263
|
+
return _context3.abrupt("return", new Error(_context3.t0));
|
|
1257
1264
|
case 11:
|
|
1258
1265
|
case "end":
|
|
1259
1266
|
return _context3.stop();
|
|
@@ -1294,7 +1301,7 @@ function _createMultipleDOMNodeReferences() {
|
|
|
1294
1301
|
_context4.prev = 10;
|
|
1295
1302
|
_context4.t0 = _context4["catch"](0);
|
|
1296
1303
|
console.error("There was an error creating multiple DOMNodeReferences: ".concat(_context4.t0));
|
|
1297
|
-
|
|
1304
|
+
return _context4.abrupt("return", new Error(_context4.t0));
|
|
1298
1305
|
case 14:
|
|
1299
1306
|
case "end":
|
|
1300
1307
|
return _context4.stop();
|
package/index.d.ts
CHANGED
|
@@ -47,55 +47,64 @@ class DOMNodeReference {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Hides the element by setting its display style to "none".
|
|
50
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
50
51
|
*/
|
|
51
|
-
hide():
|
|
52
|
+
hide(): DOMNodeReference;
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Shows the element by restoring its default display style.
|
|
56
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
55
57
|
*/
|
|
56
|
-
show():
|
|
58
|
+
show(): DOMNodeReference;
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* Sets the value of the HTML element.
|
|
60
62
|
* @param {() => any} value - The value to set for the HTML element.
|
|
61
63
|
* for parents of boolean radios, pass true or false as value, or
|
|
62
64
|
* an expression returning a boolean
|
|
65
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
63
66
|
*/
|
|
64
|
-
setValue(value: string):
|
|
67
|
+
setValue(value: string): DOMNodeReference;
|
|
65
68
|
|
|
66
69
|
/**
|
|
67
70
|
* Disables the element so that users cannot input any data
|
|
71
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
68
72
|
*/
|
|
69
|
-
disable():
|
|
73
|
+
disable(): DOMNodeReference;
|
|
70
74
|
|
|
71
75
|
/**
|
|
72
76
|
* Enables the element so that users can input data
|
|
77
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
73
78
|
*/
|
|
74
|
-
enable():
|
|
79
|
+
enable(): DOMNodeReference;
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
82
|
* Prepends elements to the target
|
|
78
83
|
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to prepend to the HTML element
|
|
84
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
79
85
|
*/
|
|
80
|
-
prepend(...nodes: HTMLElement[] | DOMNodeReference[]):
|
|
86
|
+
prepend(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
|
|
81
87
|
|
|
82
88
|
/**
|
|
83
89
|
* Appends child elements to the HTML element.
|
|
84
90
|
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to append to the HTML element.
|
|
91
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
85
92
|
*/
|
|
86
|
-
append(...nodes: HTMLElement[] | DOMNodeReference[]):
|
|
93
|
+
append(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
|
|
87
94
|
|
|
88
95
|
/**
|
|
89
96
|
* Inserts elements before the HTML element.
|
|
90
97
|
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to insert before the HTML element.
|
|
98
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
91
99
|
*/
|
|
92
|
-
before(...nodes: HTMLElement[] | DOMNodeReference[]):
|
|
100
|
+
before(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
|
|
93
101
|
|
|
94
102
|
/**
|
|
95
103
|
* Inserts elements after the HTML element.
|
|
96
104
|
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to insert after the HTML element.
|
|
105
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
97
106
|
*/
|
|
98
|
-
after(...nodes: HTMLElement[] | DOMNodeReference[]):
|
|
107
|
+
after(...nodes: HTMLElement[] | DOMNodeReference[]): DOMNodeReference;
|
|
99
108
|
|
|
100
109
|
/**
|
|
101
110
|
* Retrieves the label associated with the HTML element.
|
|
@@ -107,8 +116,9 @@ class DOMNodeReference {
|
|
|
107
116
|
/**
|
|
108
117
|
* Appends child elements to the label associated with the HTML element.
|
|
109
118
|
* @param {...HTMLElement} elements - The elements to append to the label.
|
|
119
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
110
120
|
*/
|
|
111
|
-
appendToLabel(...elements: HTMLElement[]):
|
|
121
|
+
appendToLabel(...elements: HTMLElement[]): DOMNodeReference;
|
|
112
122
|
|
|
113
123
|
/**
|
|
114
124
|
* Sets up an event listener based on the specified event type, executing the specified
|
|
@@ -116,12 +126,15 @@ class DOMNodeReference {
|
|
|
116
126
|
* @param {string} eventType - The DOM event to watch for
|
|
117
127
|
* @param {(this: DOMNodeReference, e: Event) => void} eventHandler - The callback function that runs when the
|
|
118
128
|
* specified event occurs
|
|
129
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
119
130
|
*/
|
|
120
|
-
on(eventType: string, eventHandler: (event: Event) => void):
|
|
131
|
+
on(eventType: string, eventHandler: (event: Event) => void): DOMNodeReference;
|
|
132
|
+
|
|
121
133
|
/**
|
|
122
134
|
* Unchecks both the yes and no radio buttons if they exist.
|
|
135
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
123
136
|
*/
|
|
124
|
-
uncheckRadios():
|
|
137
|
+
uncheckRadios(): DOMNodeReference;
|
|
125
138
|
|
|
126
139
|
/**
|
|
127
140
|
* Sets up validation and requirement rules for the field. This function dynamically updates the field's required status and validates its input based on the specified conditions.
|
|
@@ -130,53 +143,66 @@ class DOMNodeReference {
|
|
|
130
143
|
* @param {function(this: DOMNodeReference): boolean} isValid - A function that checks if the field's input is valid. Returns `true` if valid, `false` otherwise.
|
|
131
144
|
* @param {string} fieldDisplayName - The name of the field, used in error messages if validation fails.
|
|
132
145
|
* @param {Array<DOMNodeReference>} [dependencies] Other fields that this field’s requirement depends on. When these fields change, the required status of this field is re-evaluated. Make sure any DOMNodeReference used in `isRequired` or `isValid` is included in this array.
|
|
146
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
133
147
|
*/
|
|
134
148
|
configureValidationAndRequirements(
|
|
135
149
|
isRequired: (this: this) => boolean,
|
|
136
150
|
isValid: (this: this) => boolean,
|
|
137
151
|
fieldDisplayName: string,
|
|
138
152
|
dependencies: Array<DOMNodeReference>
|
|
139
|
-
):
|
|
153
|
+
): DOMNodeReference;
|
|
140
154
|
|
|
141
155
|
/**
|
|
142
156
|
* Sets the required level for the field by adding or removing the "required-field" class on the label.
|
|
143
157
|
*
|
|
144
158
|
* @param {boolean} isRequired - Determines whether the field should be marked as required.
|
|
145
159
|
* If true, the "required-field" class is added to the label; if false, it is removed.
|
|
160
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
146
161
|
*/
|
|
147
|
-
setRequiredLevel(isRequired: boolean):
|
|
162
|
+
setRequiredLevel(isRequired: boolean): DOMNodeReference;
|
|
148
163
|
|
|
149
164
|
/**
|
|
150
165
|
* Adds a tooltip with specified text to the label associated with the HTML element.
|
|
151
166
|
* @param {string} text - The text to display in the tooltip.
|
|
167
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
152
168
|
*/
|
|
153
|
-
addLabelTooltip(text: string):
|
|
169
|
+
addLabelTooltip(text: string): DOMNodeReference;
|
|
154
170
|
|
|
155
171
|
/**
|
|
156
172
|
* Adds a tooltip with the specified text to the element
|
|
157
173
|
* @param {string} text - The text to display in the tooltip
|
|
174
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
158
175
|
*/
|
|
159
|
-
addTooltip(text: string):
|
|
176
|
+
addTooltip(text: string): DOMNodeReference;
|
|
160
177
|
|
|
161
178
|
/**
|
|
162
179
|
* Sets the inner HTML content of the HTML element.
|
|
163
180
|
* @param {string} text - The text to set as the inner HTML of the element.
|
|
181
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
182
|
+
*/
|
|
183
|
+
setInnerHTML(text: string): DOMNodeReference;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Removes the element from the DOM
|
|
187
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
164
188
|
*/
|
|
165
|
-
|
|
189
|
+
remove(): DOMNodeReference;
|
|
166
190
|
|
|
167
191
|
/**
|
|
168
192
|
*
|
|
169
193
|
* @param {Partial<CSSStyleDeclaration>} options - An object with the style properties (keys) and updated styles (values)
|
|
170
194
|
* to apply to the this. {"key": "value"}
|
|
195
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
171
196
|
*/
|
|
172
|
-
setStyle(options: Partial<CSSStyleDeclaration>):
|
|
197
|
+
setStyle(options: Partial<CSSStyleDeclaration>): DOMNodeReference;
|
|
173
198
|
|
|
174
199
|
/**
|
|
175
200
|
*
|
|
176
201
|
* @param {boolean} shouldShow shows or hides the target
|
|
177
202
|
* if = true => show, if = false => hide
|
|
203
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
178
204
|
*/
|
|
179
|
-
toggleVisibility(shouldShow: boolean):
|
|
205
|
+
toggleVisibility(shouldShow: boolean): DOMNodeReference;
|
|
180
206
|
|
|
181
207
|
/**
|
|
182
208
|
* Configures conditional rendering for the target element based on a condition
|
|
@@ -188,11 +214,12 @@ class DOMNodeReference {
|
|
|
188
214
|
* @param {Array<DOMNodeReference>} dependencies - An array of `DOMNodeReference` instances. Event listeners are
|
|
189
215
|
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
190
216
|
* the target node.
|
|
217
|
+
* @returns {DOMNodeReference} Returns 'this'
|
|
191
218
|
*/
|
|
192
219
|
configureConditionalRendering(
|
|
193
220
|
condition: (this: DOMNodeReference) => boolean,
|
|
194
221
|
dependencies: DOMNodeReference[]
|
|
195
|
-
):
|
|
222
|
+
): DOMNodeReference;
|
|
196
223
|
|
|
197
224
|
/**
|
|
198
225
|
* Executes a callback function once the element is fully loaded.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powerpagestoolkit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.501",
|
|
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",
|