powerpagestoolkit 3.0.2 → 3.0.52

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,26 +21,26 @@ npm install powerpagestoolkit
21
21
 
22
22
  # Core Modules
23
23
 
24
- ### DOMNodeReference
24
+ ### PowerPagesElement
25
25
 
26
26
  A powerful class for managing DOM elements with automatic value synchronization and event handling.
27
27
 
28
28
  #### Basic Usage
29
29
 
30
- DOMNodeReferences are instantiated with the help of the following factory function: `createRef`
30
+ PowerPagesElements are instantiated with the help of the following factory function: `get`
31
31
 
32
32
  ```typescript
33
- createRef(
33
+ get(
34
34
  target: HTMLElement | string,
35
35
  options: {
36
36
  multiple: (() => boolean) | boolean = false,
37
37
  root: HTMLElement,
38
38
  timeoutMs:number
39
39
  }
40
- ): Promise<DOMNodeReference | DOMNodeReference[]>;
40
+ ): Promise<PowerPagesElement | PowerPagesElement[]>;
41
41
  ```
42
42
 
43
- createRef takes two main arguments:
43
+ get takes two main arguments:
44
44
 
45
45
  <table style="width: 100%; border-collapse: collapse;">
46
46
  <thead>
@@ -76,20 +76,20 @@ createRef takes two main arguments:
76
76
  </tbody>
77
77
  </table>
78
78
 
79
- Import the utility function for creating DOMNodeReference(s)
79
+ Import the utility function for creating PowerPagesElement(s)
80
80
 
81
81
  ```typescript
82
- import { createRef } from "powerpagestoolkit";
82
+ import { get } from "powerpagestoolkit";
83
83
  ```
84
84
 
85
- Instantiate one, or multiple instances of a DOMNodeReference, and optionally configure advanced options
85
+ Instantiate one, or multiple instances of a PowerPagesElement, and optionally configure advanced options
86
86
 
87
87
  ```javascript
88
88
  // Create a single reference (i.e. 'querySelector')
89
- const node = await createRef("#myElement");
89
+ const node = await get("#myElement");
90
90
 
91
91
  // Create multiple references (i.e. 'querySelectorAll')
92
- const nodes = await createRef(".my-class", { multiple: true });
92
+ const nodes = await get(".my-class", { multiple: true });
93
93
 
94
94
  /******************/
95
95
  // ADVANCED OPTIONS
@@ -98,31 +98,31 @@ const nodes = await createRef(".my-class", { multiple: true });
98
98
 
99
99
  // If the node you are targeting is not available at the initial execution
100
100
  // of the script, set a timeout for 2 seconds
101
- const node2 = await createRef("#target", { timeoutMs:2000 });
101
+ const node2 = await get("#target", { timeoutMs: 2000 });
102
102
 
103
103
  // need to target a node within a specific node? use that node as the root
104
104
  const otherElement = document.getElementById("id");
105
- const node3 = await createRef("#target", { root: otherElement });
105
+ const node3 = await get("#target", { root: otherElement });
106
106
 
107
107
  // implement all options:
108
- const nodes2 = await createRef("#target", {
108
+ const nodes2 = await get("#target", {
109
109
  multiple: true,
110
- timeoutMs:4000,
110
+ timeoutMs: 4000,
111
111
  root: otherElement,
112
112
  });
113
113
  ```
114
114
 
115
115
  #### Properties
116
116
 
117
- | Property | Type | Description |
118
- | -------- | ------------------------ | --------------------------------------------- |
119
- | element | HTMLElement | The referenced DOM element |
120
- | value | any | Current synchronized value of the element |
121
- | isLoaded | boolean | Element load status |
122
- | target | HTMLElement \| string | Original target selector or element |
123
- | yesRadio | DOMNodeReference \| null | Reference to 'yes' radio (for boolean fields) |
124
- | noRadio | DOMNodeReference \| null | Reference to 'no' radio (for boolean fields) |
125
- | checked | boolean | Checkbox/radio checked state |
117
+ | Property | Type | Description |
118
+ | -------- | --------------------- | -------------------------------------------- |
119
+ | element | HTMLElement | The referenced DOM element |
120
+ | value | any | Current synchronized value of the element |
121
+ | isLoaded | boolean | Element load status |
122
+ | target | HTMLElement \| string | Original target selector or element |
123
+ | yesRadio | Radio \| null | Reference to 'yes' radio (for yes/no fields) |
124
+ | noRadio | Radio \| null | Reference to 'no' radio (for yes/no fields) |
125
+ | checked | boolean | Checkbox/radio checked state |
126
126
 
127
127
  #### Key Methods
128
128
 
@@ -151,8 +151,8 @@ _Method Signature:_
151
151
  ```typescript
152
152
  applyBusinessRule(
153
153
  rule: BusinessRule,
154
- dependencies: DOMNodeReference[]
155
- ): DOMNodeReference; /* Instance of this is returned for optional
154
+ dependencies: PowerPagesElement[]
155
+ ): PowerPagesElement; /* Instance of this is returned for optional
156
156
  method chaining */
157
157
  ```
158
158
 
@@ -160,18 +160,15 @@ applyBusinessRule(
160
160
 
161
161
  ```typescript
162
162
  interface BusinessRule {
163
- setVisibility?: [
164
- condition: () => boolean,
165
- clearValuesOnHide?: boolean = true
166
- ];
167
- setRequired?: [
168
- isRequired: () => boolean,
169
- isValid: () => boolean
170
- ];
171
- setValue?: [
172
- condition: () => boolean,
173
- value: () => any | any
174
- ];
163
+ setVisibility?: () => boolean;
164
+ setRequirements?: () => {
165
+ isRequired: () => boolean;
166
+ isValid: () => boolean;
167
+ };
168
+ setValue?: () => {
169
+ condition: () => boolean;
170
+ value: () => any | any;
171
+ };
175
172
  setDisabled?: () => boolean;
176
173
  }
177
174
  ```
@@ -183,24 +180,9 @@ interface BusinessRule {
183
180
  // 'businessTypeField' is set to 'Corporation' or 'LLC'
184
181
  taxIdField.applyBusinessRule(
185
182
  {
186
- setVisibility: [
187
- () =>
188
- businessTypeField.value === "Corporation" ||
189
- businessTypeField.value === "LLC",
190
- ],
191
- },
192
- [businessTypeField] // Re-evaluate when businessTypeField changes
193
- );
194
-
195
- // Optionally disable 'clearValuesOnHide':
196
- taxIdField.applyBusinessRule(
197
- {
198
- setVisibility: [
199
- () =>
200
- businessTypeField.value === "Corporation" ||
201
- businessTypeField.value === "LLC",
202
- false, // defaults to true. False will prevent the fields from losing it's value if it is hidden
203
- ],
183
+ setVisibility: () =>
184
+ businessTypeField.value === "Corporation" ||
185
+ businessTypeField.value === "LLC",
204
186
  },
205
187
  [businessTypeField] // Re-evaluate when businessTypeField changes
206
188
  );
@@ -212,17 +194,17 @@ taxIdField.applyBusinessRule(
212
194
  // Require 'taxIdField' when 'businessTypeField' is 'Corporation' or 'LLC'
213
195
  taxIdField.applyBusinessRule(
214
196
  {
215
- setRequired: [
216
- function () {
197
+ setRequirements: () => ({
198
+ isRequired: function () {
217
199
  return (
218
200
  businessTypeField.value === "Corporation" ||
219
201
  businessTypeField.value === "LLC"
220
202
  );
221
203
  },
222
- function () {
204
+ isValid: function () {
223
205
  return this.value != null && this.value !== "";
224
206
  },
225
- ],
207
+ }),
226
208
  },
227
209
  [businessTypeField] // Revalidate when businessTypeField changes
228
210
  );
@@ -234,10 +216,10 @@ taxIdField.applyBusinessRule(
234
216
  // Set default industry value when 'businessTypeField' is 'Corporation'
235
217
  industryField.applyBusinessRule(
236
218
  {
237
- setValue: [
238
- () => businessTypeField.value === "Corporation",
239
- "Corporate"
240
- ],
219
+ setValue: () => ({
220
+ condition: () => businessTypeField.value === "Corporation",
221
+ value: "Corporate",
222
+ }),
241
223
  },
242
224
  [businessTypeField] // Apply value when businessTypeField changes
243
225
  );
@@ -325,9 +307,9 @@ node.addTooltip(
325
307
  _Example:_
326
308
 
327
309
  ```typescript
328
- import { createRef } from "powerpagestoolkit";
310
+ import { get } from "powerpagestoolkit";
329
311
 
330
- const title = await createRef("#myTitle");
312
+ const title = await get("#myTitle");
331
313
 
332
314
  title.addTooltip("This is an Example of a tooltip!", { color: "red" });
333
315
  ```
@@ -387,7 +369,7 @@ bindForm("form-guid").then((form) => {
387
369
  * @param formGuid Unique identifier for the form
388
370
  * @returns Promise resolving to form element references
389
371
  */
390
- function bindForm(formGuid: string): Promise<DOMNodeReferenceArray & Record<string: DOMNodeReference>>;
372
+ function bindForm(formGuid: string): Promise<PowerPagesElementArray & Record<string: PowerPagesElement>>;
391
373
  ```
392
374
 
393
375
  ##### Benefits
@@ -464,10 +446,10 @@ await API.updateRecord("contacts", "record-guid", {
464
446
 
465
447
  ## Best Practices
466
448
 
467
- 1. Always await DOMNodeReference creation:
449
+ 1. Always await PowerPagesElement creation:
468
450
 
469
451
  ```typescript
470
- const node = await createRef("#element");
452
+ const node = await get("#element");
471
453
  ```
472
454
 
473
455
  2. Include all referenced nodes in dependency arrays:
@@ -1,44 +1,32 @@
1
1
  /// <reference path="../globals.d.ts" />
2
- export default class DOMNodeReference {
2
+ import type EventManager from "../ancillary/EventManager.d.ts";
3
+ import type ValueManager from "../ancillary/ValueManager.d.ts";
4
+ import type VisibilityManager from "./VisibilityManager.d.ts";
5
+ export default abstract class DOMNodeReference {
3
6
  static instances: DOMNodeReference[];
4
7
  [key: symbol]: (...arg: any[]) => any;
5
8
  target: Element | string;
6
9
  logicalName?: string;
7
10
  root: Element;
8
- protected _timeoutMs: number;
9
- protected _isLoaded: boolean;
10
- protected _defaultDisplay: string;
11
- protected _observers: Array<MutationObserver | ResizeObserver>;
12
- protected _boundListeners: Array<BoundEventListener>;
13
- protected _dependents: Dependants;
14
- protected _isRadio: boolean;
15
- protected _radioType: RadioType | null;
11
+ protected timeoutMs: number;
12
+ protected isLoaded: boolean;
16
13
  /**
17
14
  * The value of the element that this node represents
18
15
  * stays in syncs with the live DOM elements?.,m via event handler
19
16
  */
20
- value: any;
17
+ get value(): any;
18
+ set value(newValue: any);
19
+ get checked(): boolean;
20
+ set defaultDisplay(newValue: string | null);
21
21
  /**
22
22
  * The element targeted when instantiating DOMNodeReference.
23
23
  * Made available in order to perform normal DOM traversal,
24
24
  * or access properties not available through this class.
25
25
  */
26
26
  element: HTMLElement;
27
- protected _visibilityController: HTMLElement;
28
- checked: boolean;
29
- radioParent: DOMNodeReference | null;
30
- /**
31
- * Represents the 'yes' option of a boolean radio field.
32
- * This property is only available when the parent node
33
- * is a main field for a boolean radio input.
34
- */
35
- yesRadio: DOMNodeReference | null;
36
- /**
37
- * Represents the 'no' option of a boolean radio field.
38
- * This property is only available when the parent node
39
- * is a main field for a boolean radio input.
40
- */
41
- noRadio: DOMNodeReference | null;
27
+ visibilityManager: VisibilityManager | null;
28
+ valueManager: ValueManager | null;
29
+ eventManager: EventManager | null;
42
30
  /**
43
31
  * Creates an instance of DOMNodeReference.
44
32
  * @param target - The CSS selector to find the desired DOM element.
@@ -46,33 +34,22 @@ export default class DOMNodeReference {
46
34
  * Defaults to 'document.body'
47
35
  */
48
36
  /******/ /******/ constructor(target: Element | string, root: Element | undefined, timeoutMs: number);
37
+ protected abstract initValueManager(): void;
38
+ protected abstract initVisibilityManager(): void;
39
+ protected abstract initEventManager(): void;
49
40
  protected _extractLogicalName(target: Element | string): string;
50
- /**
51
- * Initializes value synchronization with appropriate event listeners
52
- * based on element type.
53
- */
54
41
  protected _valueSync(): void;
55
- protected _determineEventType(): keyof HTMLElementEventMap;
42
+ protected _determineEventType(): keyof GlobalEventHandlersEventMap;
56
43
  protected _isDateInput(): boolean;
57
44
  protected _isValidFormElement(element: Element): element is FormElement;
58
- protected _registerEventListener(element: Element, eventType: keyof HTMLElementEventMap, handler: (e: Event) => unknown): void;
59
45
  protected _dateSync(element: HTMLInputElement): Promise<void>;
60
- /**
61
- * Gets the current value of the element based on its type
62
- * @protected
63
- * @returns Object containing value and optional checked state
64
- */
65
- protected _getElementValue(): Promise<ElementValue>;
66
- protected _attachVisibilityController(): void;
67
- protected _attachRadioButtons(): Promise<void>;
68
46
  protected _bindMethods(): void;
69
47
  /**
70
48
  * Updates the value and checked state based on element type
71
49
  * @public
72
50
  */
73
51
  updateValue(e?: Event): Promise<void>;
74
- protected _triggerDependentsHandlers(): void;
75
- protected _validateValue(value: any): any;
52
+ protected triggerDependentsHandlers(): void;
76
53
  /**
77
54
  * Sets up an event listener based on the specified event type, executing the specified
78
55
  * event handler
@@ -81,7 +58,7 @@ export default class DOMNodeReference {
81
58
  * specified event occurs.
82
59
  * @returns - Instance of this [provides option to method chain]
83
60
  */
84
- on(eventType: keyof HTMLElementEventMap, eventHandler: (this: DOMNodeReference, e: Event) => void): DOMNodeReference;
61
+ on<K extends keyof GlobalEventHandlersEventMap>(eventType: K, eventHandler: (this: DOMNodeReference, e: GlobalEventHandlersEventMap[K]) => void): DOMNodeReference;
85
62
  /**
86
63
  * Hides the element by setting its display style to "none".
87
64
  * @returns - Instance of this [provides option to method chain]
@@ -97,7 +74,7 @@ export default class DOMNodeReference {
97
74
  * or a natural boolean to determine the visibility of this
98
75
  * @returns - Instance of this [provides option to method chain]
99
76
  */
100
- toggleVisibility(shouldShow: ((this: DOMNodeReference) => boolean) | boolean): DOMNodeReference;
77
+ toggleVisibility(shouldShow: EvaluationFunction | boolean): DOMNodeReference;
101
78
  /**
102
79
  * Sets the value of the HTML element.
103
80
  * @param value - The value to set for the HTML element.
@@ -115,13 +92,10 @@ export default class DOMNodeReference {
115
92
  * Clears all values and states of the element.
116
93
  * Handles different input types appropriately, and can be called
117
94
  * on an element containing N child inputs to clear all
118
- *
119
- * @returns - Instance of this [provides option to method chain]
120
- * @throws If clearing values fails
121
95
  */
122
- clearValue(): Promise<DOMNodeReference>;
96
+ clearValue(): void;
123
97
  protected _getChildren(): DOMNodeReference[] | null;
124
- protected _callAgainstChildInputs(func: (child: DOMNodeReference) => Promise<any> | any): Promise<void>;
98
+ protected callAgainstChildrenInputs(callback: (child: DOMNodeReference) => any): void;
125
99
  /**
126
100
  * Enables the element so that users can input data
127
101
  * @returns - Instance of this [provides option to method chain]
@@ -174,22 +148,18 @@ export default class DOMNodeReference {
174
148
  * @param string - The text to set as the inner HTML of the element.
175
149
  * @returns - Instance of this [provides option to method chain]
176
150
  */
177
- setInnerHTML(string: string): this;
151
+ set innerHTML(innerHTML: string);
178
152
  /**
179
153
  * Removes this element from the DOM
180
154
  * @returns - Instance of this [provides option to method chain]
181
155
  */
182
156
  remove(): this;
183
157
  /**
184
- * @param options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
185
- * @returns - Instance of this [provides option to method chain]
186
- */
187
- setStyle(options: Partial<CSSStyleDeclaration>): this;
188
- /**
189
- * Unchecks both the yes and no radio buttons if they exist.
190
- * @returns - Instance of this [provides option to method chain]
158
+ * Sets inline CSS styles on the element.
159
+ * @param options - An object containing CSS property-value pairs, e.g., { display: 'block' }.
160
+ * @returns The instance, enabling method chaining.
191
161
  */
192
- uncheckRadios(): DOMNodeReference;
162
+ setStyle(options: Partial<CSSStyleDeclaration>): DOMNodeReference;
193
163
  /**
194
164
  * Applies a business rule to manage visibility, required state, value, and disabled state dynamically.
195
165
  * @see {@link BusinessRule}
@@ -197,19 +167,11 @@ export default class DOMNodeReference {
197
167
  * @param dependencies For re-evaluation of conditions when the state of the dependencies change
198
168
  * @returns Instance of this for method chaining.
199
169
  */
200
- applyBusinessRule(rule: BusinessRule, dependencies: DOMNodeReference[]): DOMNodeReference;
201
- protected _returnAggregateHandler(rule: BusinessRule): AggregateHandlerFunction;
202
- protected _createValidator(evaluationFunction: () => boolean): void;
203
- /**
204
- * Sets up tracking for dependencies using both event listeners and mutation observers.
205
- * @protected
206
- * @param handler The function to execute when dependencies change
207
- * @param dependencies Array of dependent DOM nodes to track
208
- * all other options defaults to true
209
- */
210
- protected _configureDependencyTracking(handler: AggregateHandlerFunction, dependencies: DOMNodeReference[]): void;
211
- protected _getVisibility(): boolean;
212
- protected _receiveNotification(): void;
170
+ applyBusinessRule(rule: BusinessRule, dependencies: DependencyArray<DOMNodeReference>): DOMNodeReference;
171
+ private _setupRequirementsValidator;
172
+ private _createBusinessRuleHandler;
173
+ private _createValidator;
174
+ private _configureDependencyTracking;
213
175
  /**
214
176
  * Sets the required level for the field by adding or removing the "required-field" class on the label.
215
177
  *
@@ -217,7 +179,7 @@ export default class DOMNodeReference {
217
179
  * If true, the "required-field" class is added to the label; if false, it is removed.
218
180
  * @returns Instance of this [provides option to method chain]
219
181
  */
220
- setRequiredLevel(isRequired: (() => boolean) | boolean): DOMNodeReference;
182
+ setRequiredLevel(isRequired: EvaluationFunction | boolean): DOMNodeReference;
221
183
  /**
222
184
  * Executes a callback function once the element is fully loaded.
223
185
  * If the element is already loaded, the callback is called immediately.
@@ -225,5 +187,5 @@ export default class DOMNodeReference {
225
187
  * @param callback A callback function to execute once the element is loaded.
226
188
  * Receives instance of 'this' as an argument
227
189
  */
228
- onceLoaded(callback: (instance: DOMNodeReference) => any): any;
190
+ onceLoaded(callback: (instance: DOMNodeReference) => any): void;
229
191
  }
@@ -0,0 +1,25 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ declare type EventType = string;
4
+ declare type Handler = (this: DOMNodeReference, ...args: any[]) => void;
5
+ /********/ /********/ export default class EventManager {
6
+ private readonly events;
7
+ private readonly listeners;
8
+ private readonly dependencyHandlers;
9
+ private observers;
10
+ private boundListeners;
11
+ constructor();
12
+ /********/ dispatchDependencyHandlers(): void;
13
+ /********/ registerDependent(dependency: DOMNodeReference, handler: Handler): "success" | Error;
14
+ /********/ registerEvent(event: EventType, handler: Handler): "success" | Error;
15
+ /********/ registerListener(event: EventType, listener: DOMNodeReference): "success" | Error;
16
+ /********/ emit(eventType: EventType, ...args: any[]): void;
17
+ /********/ stopListening(listener: DOMNodeReference): void;
18
+ /********/ registerObserver(observer: MutationObserver | ResizeObserver, observerOptions: {
19
+ nodeToObserve: Element;
20
+ options: Partial<ResizeObserverOptions> | Partial<MutationObserverInit>;
21
+ }): void;
22
+ /********/ registerDOMEventListener(element: Element, eventType: keyof HTMLElementEventMap, handler: (e: Event) => unknown): void;
23
+ /********/ destroy(): void;
24
+ }
25
+ export {};
@@ -0,0 +1,25 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ /**
3
+ *
4
+ * @param {string} titleString The text to display in the tooltip flyout content
5
+ * @param iconStyle Optional CSS styles to apply to the info icon
6
+ * @returns
7
+ */
8
+ /********/ /********/ export default class InfoElement extends HTMLElement {
9
+ private flyoutContent;
10
+ private icon;
11
+ private observers;
12
+ /********/ constructor(titleString: string, iconStyle?: Partial<CSSStyleDeclaration>);
13
+ /********/ private attachEventListeners;
14
+ /********/ private setupObservers;
15
+ /********/ private getDesiredWidth;
16
+ /********/ private positionFlyout;
17
+ /********/ private updateFlyoutWidth;
18
+ /********/ private handleClick;
19
+ /********/ private handleResize;
20
+ /********/ private handleTouchStart;
21
+ /********/ private handleMouseEnter;
22
+ /********/ private handleMouseLeave;
23
+ /********/ private handleScroll;
24
+ /********/ private destroy;
25
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ /**
3
+ * @class LoadingSpinner - instantiate a spinner to handle loading state in your powerpages site
4
+ */
5
+ /********/ /********/ export default class LoadingSpinner extends HTMLElement {
6
+ private element;
7
+ constructor();
8
+ /**
9
+ * @method hide - Hides the loading spinner
10
+ */
11
+ hide(): void;
12
+ /**
13
+ * @method show - Shows the loading spinner
14
+ */
15
+ show(): void;
16
+ }
@@ -0,0 +1,11 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ export default class Radio extends DOMNodeReference {
4
+ [key: symbol]: (...arg: any[]) => any;
5
+ radioType: RadioType | undefined;
6
+ radioParent: DOMNodeReference | undefined;
7
+ constructor(parent: DOMNodeReference, target: Element | string, root: Element | undefined, timeoutMs: number, radioType: RadioType);
8
+ protected initEventManager(): void;
9
+ protected initValueManager(): void;
10
+ protected initVisibilityManager(): void;
11
+ }
@@ -0,0 +1,19 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ export default class ValueManager {
4
+ value: any;
5
+ checked: true | false;
6
+ element: HTMLElement | null;
7
+ private noRadio;
8
+ private yesRadio;
9
+ radioParent?: DOMNodeReference | undefined;
10
+ private isRadio;
11
+ private radioType;
12
+ constructor(instance: DOMNodeReference);
13
+ setValue(value: any): void;
14
+ updateValue(e?: Event): Promise<void>;
15
+ getElementValue(): Promise<ElementValue>;
16
+ protected _validateValue(value: any): any;
17
+ clearValue(): void;
18
+ destroy(): void;
19
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ export default class VisibilityManager {
3
+ private visibilityController;
4
+ private defaultVisibility;
5
+ set defaultDisplay(newValue: string | null);
6
+ constructor(target: HTMLElement);
7
+ hide(): void;
8
+ show(): void;
9
+ toggleVisibility(shouldShow: boolean): void;
10
+ getVisibility(): true | false;
11
+ destroy(): void;
12
+ }
@@ -1,7 +1,7 @@
1
1
  /// <reference path="../globals.d.ts" />
2
2
  /**
3
- * For use in setting up event management in the instances of DOMNodeReference
4
- * @see {@link DOMNodeReference}
3
+ * For use in setting up event management in the instances of PowerPagesElement
4
+ * @see {@link PowerPagesElement}
5
5
  */
6
6
  export declare const EventTypes: {
7
7
  readonly CHECKBOX: "click";
@@ -20,17 +20,21 @@ declare abstract class API {
20
20
  *
21
21
  * @param tableSetName The DataVerse SET name of the table being queried
22
22
  * @param recordID the GUID of the records to be retrieved
23
- * @param selectColumns *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. Format = select=column1,column2,column3...
23
+ * @param ODataQueryString *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. e.g.: ?$select=column1,column2,column3
24
24
  * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
25
25
  */
26
- static getRecord<T>(tableSetName: string, recordID: string, selectColumns?: string): Promise<T>;
26
+ static getRecord<T>(tableSetName: string, recordID: string, ODataQueryString?: string): Promise<T>;
27
+ /**
28
+ * More flexible method for building completely custom queries
29
+ */
30
+ static request<T>(query: string, options?: JQuery.AjaxSettings): Promise<T | Error>;
27
31
  /**
28
32
  *
29
33
  * @param tableSetName The dataverse set name of the table being queried
30
34
  * @param queryParameters *OPTIONAL* the OData query parameters for refining search results: *format = $filter=filters&$select=columns*
31
35
  * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
32
36
  */
33
- static getMultiple(tableSetName: string, queryParameters?: string): Promise<Array<object>>;
37
+ static getMultiple<T = object>(tableSetName: string, queryParameters?: string): Promise<Array<T>>;
34
38
  /**
35
39
  *
36
40
  * @param tableSetName The dataverse set name for the table that you are updating a record in
@@ -0,0 +1,53 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import DOMNodeReference from "../ancillary/DOMNodeReference.d.ts";
3
+ import Radio from "../ancillary/Radio.d.ts";
4
+ /********/ /********/ export default class PowerPagesElement extends DOMNodeReference {
5
+ [key: symbol]: (...arg: any[]) => any;
6
+ private isMasked;
7
+ /**
8
+ * Represents the 'yes' option of a boolean radio field.
9
+ * This property is only available when the parent node
10
+ * is a main field for a boolean radio input.
11
+ */
12
+ yesRadio: Radio | undefined;
13
+ /**
14
+ * Represents the 'no' option of a boolean radio field.
15
+ * This property is only available when the parent node
16
+ * is a main field for a boolean radio input.
17
+ */
18
+ noRadio: Radio | undefined;
19
+ /**
20
+ * Creates an instance of PowerPagesElement.
21
+ * @param target - The CSS selector to find the desired DOM element.
22
+ * @param root - Optionally specify the element within to search for the element targeted by 'target'
23
+ * Defaults to 'document.body'
24
+ */
25
+ /******/ constructor(target: Element | string, root: Element | undefined, timeoutMs: number);
26
+ protected initValueManager(): void;
27
+ protected initVisibilityManager(): void;
28
+ protected initEventManager(): void;
29
+ protected _attachRadioButtons(): Promise<void>;
30
+ clearValue(): void;
31
+ /**
32
+ * Unchecks both the yes and no radio buttons if they exist.
33
+ * @returns - Instance of this [provides option to method chain]
34
+ */
35
+ uncheckRadios(): PowerPagesElement;
36
+ /**
37
+ * Apply an input mask to this element
38
+ * @param type The type of input mask to apply to this element
39
+ * @param options The options to specify the behavior of the mask
40
+ */
41
+ inputMask(type: "phone" | "money", options: InputMaskOptions): void;
42
+ inputMask(type: "phone", options?: {
43
+ format?: PhoneNumberFormats;
44
+ countryCode?: CountryCodeFormats;
45
+ }): void;
46
+ inputMask(type: "money", options?: {
47
+ prefix?: CurrencySymbol;
48
+ decimalPlaces?: number;
49
+ thousandsSeparator?: string;
50
+ decimalSeparator?: string;
51
+ allowNegative?: boolean;
52
+ }): void;
53
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type PowerPagesElement from "./PowerPagesElement.d.ts";
3
+ export default class PowerPagesElementArray extends Array<PowerPagesElement> {
4
+ /**
5
+ * Hides all the containers of the PowerPagesElement instances in the array.
6
+ */
7
+ hideAll(this: PowerPagesElementArray): PowerPagesElementArray;
8
+ /**
9
+ * Shows all the containers of the PowerPagesElement instances in the array.
10
+ */
11
+ showAll(this: PowerPagesElementArray): PowerPagesElementArray;
12
+ }