powerpagestoolkit 2.5.411 → 2.5.4111

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/README.md CHANGED
@@ -21,7 +21,7 @@ npm install powerpagestoolkit
21
21
 
22
22
  # Core Modules
23
23
 
24
- - ### DOMNodeReference
24
+ ### DOMNodeReference
25
25
 
26
26
  A powerful class for managing DOM elements with automatic value synchronization and event handling.
27
27
 
@@ -92,11 +92,11 @@ node.hide();
92
92
  node.show();
93
93
  ```
94
94
 
95
- ##### Advanced conditional rendering
95
+ **_Advanced conditional rendering_**
96
96
 
97
97
  Out of the box, Microsoft does not provide PowerPages developers the ability to hide or show fields or form elements based on the value of another field. This method allows such configurations
98
98
 
99
- - Method Signature
99
+ _Method signature:_
100
100
 
101
101
  ```typescript
102
102
  DOMNodeReference.configureConditionalRendering(
@@ -106,7 +106,7 @@ DOMNodeReference.configureConditionalRendering(
106
106
  ): DOMNodeReference
107
107
  ```
108
108
 
109
- - Method Implementation
109
+ _Example implementation:_
110
110
 
111
111
  ```typescript
112
112
  node.configureConditionalRendering(
@@ -125,6 +125,8 @@ node.configureConditionalRendering(
125
125
 
126
126
  This utility enhances PowerPages forms by adding dynamic field validation and conditional requirements based on other field values.
127
127
 
128
+ _Method signature:_
129
+
128
130
  ```typescript
129
131
  // Core method for setting up validation
130
132
  function configureValidationAndRequirements(
@@ -136,7 +138,7 @@ function configureValidationAndRequirements(
136
138
  method chaining */
137
139
  ```
138
140
 
139
- - Here's a practical example showing how to make a field required only when a "Yes" radio button is selected:
141
+ _Example implementation:_
140
142
 
141
143
  ```typescript
142
144
  node.configureValidationAndRequirements(
@@ -172,6 +174,9 @@ node.setValue(() => {
172
174
  // Sync with DOM
173
175
  node.updateValue();
174
176
 
177
+ // Clear the value for both the instance and the target element
178
+ node.clearValue()
179
+
175
180
  /****/ Content manipulation /****/
176
181
 
177
182
  node.setInnerHTML("<span>New content</span>");
@@ -213,11 +218,11 @@ node.addTooltip(
213
218
  );
214
219
  ```
215
220
 
216
- - ### DataVerse API
221
+ ### DataVerse API
217
222
 
218
- Type-safe wrapper for DataVerse API operations.
223
+ Perform secure API calls to DataVerse from your PowerPages site. This method implements the shell deferred token to send requests with `__RequestVerificationToken`
219
224
 
220
- #### Create Record
225
+ #### Create Records
221
226
 
222
227
  ```typescript
223
228
  await API.createRecord("accounts", {
@@ -277,18 +282,10 @@ node.configureConditionalRendering(
277
282
 
278
283
  3. Use TypeScript for better type safety and IntelliSense support.
279
284
 
280
- 4. Handle loading states:
285
+ 4. Use proper error handling with API operations:
281
286
 
282
287
  ```typescript
283
- node.onceLoaded((instance) => {
284
- // Safe to manipulate the element here
285
- });
286
- ```
287
-
288
- 5. Use proper error handling with API operations:
289
-
290
- ```typescript
291
- await API.createRecord(/*...*/)
288
+ /* optionally await */ API.createRecord(/*...*/)
292
289
  .then((recordId) => {})
293
290
  .catch((error) => {
294
291
  // handle your errors appropriately
@@ -306,3 +303,7 @@ Contributions are welcome, feel free to create a pull request with enhancements.
306
303
  ## License
307
304
 
308
305
  This project is licensed under the AGPL-3.0 License - see the [LICENSE](LICENSE) file for details.
306
+
307
+ ## Funding
308
+
309
+ If you like this project, found it useful, or would like to help support the long-term support of this package, please feel free to contribute via GitHub Sponsors: [Keaton-Brewster](https://github.com/sponsors/Keaton-Brewster)
@@ -80,7 +80,7 @@ export default class DOMNodeReference {
80
80
  show(): DOMNodeReference;
81
81
  /**
82
82
  *
83
- * @param {function(instance: DOMNodeReference): boolean | boolean} shouldShow - Either a function that returns true or false,
83
+ * @param shouldShow - Either a function that returns true or false,
84
84
  * or a natural boolean to determine the visibility of this
85
85
  * @returns - Instance of this [provides option to method chain]
86
86
  */
@@ -105,7 +105,7 @@ export default class DOMNodeReference {
105
105
  * @returns - Instance of this [provides option to method chain]
106
106
  * @throws If clearing values fails
107
107
  */
108
- clearValues(): Promise<DOMNodeReference>;
108
+ clearValue(): Promise<DOMNodeReference>;
109
109
  /**
110
110
  * Enables the element so that users can input data
111
111
  * @returns - Instance of this [provides option to method chain]
package/dist/bundle.js CHANGED
@@ -441,7 +441,7 @@ var DOMNodeReference = class _DOMNodeReference {
441
441
  }
442
442
  /**
443
443
  *
444
- * @param {function(instance: DOMNodeReference): boolean | boolean} shouldShow - Either a function that returns true or false,
444
+ * @param shouldShow - Either a function that returns true or false,
445
445
  * or a natural boolean to determine the visibility of this
446
446
  * @returns - Instance of this [provides option to method chain]
447
447
  */
@@ -493,7 +493,7 @@ var DOMNodeReference = class _DOMNodeReference {
493
493
  * @returns - Instance of this [provides option to method chain]
494
494
  * @throws If clearing values fails
495
495
  */
496
- async clearValues() {
496
+ async clearValue() {
497
497
  try {
498
498
  const element = this.element;
499
499
  if (element instanceof HTMLInputElement) {
@@ -534,14 +534,14 @@ var DOMNodeReference = class _DOMNodeReference {
534
534
  if (childInputs.length > 0) {
535
535
  const clearPromises = childInputs.map(async (input) => {
536
536
  const inputRef = await createDOMNodeReference(input, false);
537
- return inputRef.clearValues();
537
+ return inputRef.clearValue();
538
538
  });
539
539
  await Promise.all(clearPromises);
540
540
  }
541
541
  }
542
542
  if (this.yesRadio instanceof _DOMNodeReference && this.noRadio instanceof _DOMNodeReference) {
543
- await this.yesRadio.clearValues();
544
- await this.noRadio.clearValues();
543
+ await this.yesRadio.clearValue();
544
+ await this.noRadio.clearValue();
545
545
  }
546
546
  const events = [
547
547
  new Event("input", { bubbles: true }),
@@ -813,7 +813,7 @@ var DOMNodeReference = class _DOMNodeReference {
813
813
  const handleChange = () => {
814
814
  handler();
815
815
  if (clearValuesOnHide && window.getComputedStyle(this.visibilityController).display === "none") {
816
- this.clearValues();
816
+ this.clearValue();
817
817
  }
818
818
  };
819
819
  dep.on("change", handleChange);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerpagestoolkit",
3
- "version": "2.5.411",
3
+ "version": "2.5.4111",
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/bundle.js",
6
6
  "types": "./dist/index.d.ts",