powerpagestoolkit 2.8.0-1.4 → 2.8.101

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.
@@ -1,7 +1,4 @@
1
1
  /// <reference path="../globals.d.ts" />
2
- interface ODataJSON extends object {
3
- [key: `${string}@odata.bind` | string]: any;
4
- }
5
2
  /**
6
3
  * Provides abstract class `API` that allows basic create, read, and update operations in DataVerse via the PowerPages API
7
4
  * @method `createRecord` - Create a record in DataVerse
@@ -15,7 +12,7 @@ declare abstract class API {
15
12
  * @param data The JSON of the fields and data that are to be updated on the targeted record
16
13
  * @returns a Promise resolving the successful results *[record id]* of the POST request, or rejecting the failed results *[error]* of the POST request.
17
14
  */
18
- static createRecord(tableSetName: string, data: ODataJSON): Promise<string>;
15
+ static createRecord(tableSetName: string, data: JSON): Promise<string>;
19
16
  /**
20
17
  *
21
18
  * @param tableSetName The DataVerse SET name of the table being queried
@@ -38,6 +35,6 @@ declare abstract class API {
38
35
  * @param data The JSON of the fields and data that are to be updated on the targeted record
39
36
  * @returns A Promise with the results of the API execution
40
37
  */
41
- static updateRecord(tableSetName: string, recordId: string, data: ODataJSON): Promise<any>;
38
+ static updateRecord(tableSetName: string, recordId: string, data: object): Promise<any>;
42
39
  }
43
40
  export default API;
@@ -4,12 +4,11 @@ export default class DOMNodeReference {
4
4
  target: Element | string;
5
5
  logicalName?: string;
6
6
  root: Element;
7
- protected timeoutMs: number;
7
+ protected [s.debounceTime]: number;
8
8
  protected isLoaded: boolean;
9
9
  protected defaultDisplay: string;
10
- protected [s.observers]: Array<MutationObserver | ResizeObserver>;
10
+ protected [s.observers]: Array<MutationObserver>;
11
11
  protected [s.boundEventListeners]: Array<BoundEventListener>;
12
- protected dependents: Dependants;
13
12
  protected isRadio: boolean;
14
13
  protected radioType: RadioType | null;
15
14
  /**
@@ -25,7 +24,6 @@ export default class DOMNodeReference {
25
24
  element: HTMLElement;
26
25
  protected visibilityController: HTMLElement;
27
26
  checked: boolean;
28
- radioParent: DOMNodeReference | null;
29
27
  /**
30
28
  * Represents the 'yes' option of a boolean radio field.
31
29
  * This property is only available when the parent node
@@ -44,7 +42,7 @@ export default class DOMNodeReference {
44
42
  * @param root - Optionally specify the element within to search for the element targeted by 'target'
45
43
  * Defaults to 'document.body'
46
44
  */
47
- /******/ /******/ constructor(target: Element | string, root: Element | undefined, timeoutMs: number);
45
+ /******/ /******/ constructor(target: Element | string, root: Element | undefined, debounceTime: number);
48
46
  private extractLogicalName;
49
47
  [s.init](): Promise<void>;
50
48
  /**
@@ -72,7 +70,6 @@ export default class DOMNodeReference {
72
70
  * @public
73
71
  */
74
72
  updateValue(e?: Event): void;
75
- protected triggerDependentsHandlers(): Promise<void>;
76
73
  protected validateValue(value: any): any;
77
74
  /**
78
75
  * Sets up an event listener based on the specified event type, executing the specified
@@ -151,7 +148,7 @@ export default class DOMNodeReference {
151
148
  after(...elements: HTMLElement[]): DOMNodeReference;
152
149
  /**
153
150
  * Retrieves the label associated with the HTML element.
154
- * @returns The label element associated with this element.
151
+ * @returns {HTMLElement} The label element associated with this element.
155
152
  */
156
153
  getLabel(): HTMLElement | null;
157
154
  /**
@@ -170,7 +167,7 @@ export default class DOMNodeReference {
170
167
  addTooltip(innerHTML: string, containerStyle?: Partial<CSSStyleDeclaration>): DOMNodeReference;
171
168
  /**
172
169
  * Sets the inner HTML content of the HTML element.
173
- * @param string - The text to set as the inner HTML of the element.
170
+ * @param {string} string - The text to set as the inner HTML of the element.
174
171
  * @returns - Instance of this [provides option to method chain]
175
172
  */
176
173
  setInnerHTML(string: string): this;
@@ -193,22 +190,24 @@ export default class DOMNodeReference {
193
190
  * Applies a business rule to manage visibility, required state, value, and disabled state dynamically.
194
191
  * @see {@link BusinessRule}
195
192
  * @param rule The business rule containing conditions for various actions.
196
- * @param dependencies For re-evaluation of conditions when the state of the dependencies change
193
+ * @param dependencies For re-evaluation conditions when the state of the dependencies change
197
194
  * @returns Instance of this for method chaining.
198
195
  */
199
196
  applyBusinessRule(rule: BusinessRule, dependencies: DOMNodeReference[]): DOMNodeReference;
200
- protected returnAggregateHandler(rule: BusinessRule): AggregateHandlerFunction;
201
- protected createValidator(evaluationFunction: () => boolean): HTMLSpanElement;
202
197
  /**
203
198
  * Sets up tracking for dependencies using both event listeners and mutation observers.
204
199
  * @protected
205
200
  * @param handler The function to execute when dependencies change
206
201
  * @param dependencies Array of dependent DOM nodes to track
202
+ * @param options Additional configuration options. clearValuesOnHide defaults to false.
207
203
  * all other options defaults to true
208
204
  */
209
- protected _configDependencyTracking(handler: AggregateHandlerFunction, dependencies: Array<DOMNodeReference>): void;
210
- protected getVisibility(): boolean;
211
- protected receiveNotification(): void;
205
+ protected _configDependencyTracking(handler: () => void, dependencies: Array<DOMNodeReference>, options?: {
206
+ clearValuesOnHide?: boolean;
207
+ observeVisibility?: boolean;
208
+ trackInputEvents?: boolean;
209
+ trackRadioButtons?: boolean;
210
+ }): void;
212
211
  /**
213
212
  * Sets the required level for the field by adding or removing the "required-field" class on the label.
214
213
  *
@@ -70,43 +70,41 @@ declare interface Form extends Partial<SystemForm> {
70
70
  formxml: string;
71
71
  }
72
72
 
73
-
74
73
  declare interface BusinessRule {
75
74
  /**
76
75
  * @param condition A function that returns a boolean to determine
77
76
  * the visibility of the target element. If `condition()` returns true, the element is shown;
78
77
  * otherwise, it is hidden.
79
78
 
79
+ * @param clearValuesOnHide Should the values in the targeted field be cleared when hidden? Defaults to true
80
80
  */
81
- setVisibility?: (this: DOMNodeReference) => boolean;
81
+ setVisibility?: [
82
+ condition: (this: DOMNodeReference) => boolean,
83
+ clearValuesOnHide?: boolean
84
+ ];
82
85
  /**
83
- * Configuration function for determining the required level, and field validity of the given fields
84
- * @param isRequired - Function determining if field is required
85
- * @param isRequired.this - Reference to this DOMNodeReference
86
- * @param isValid - Function validating field input.
87
- * @param isValid.this - Reference to this DOMNodeReference
88
- * @param isValid.isRequiredResult - Only available if 'isRequired' is also returned from the configuration function
86
+ * @param isRequired Function determining if field is required
87
+ * @param isValid Function validating field input.
89
88
  */
90
- setRequirements?: () => {
91
- isRequired?: (this: DOMNodeReference) => boolean;
92
- isValid?: (this: DOMNodeReference, isRequiredResult?: boolean) => boolean;
93
- };
94
-
89
+ setRequired?: [
90
+ isRequired: () => boolean,
91
+ isValid: (this: DOMNodeReference, isRequired: boolean) => boolean
92
+ ];
95
93
  /**
96
94
  * @param condition A function to determine if the value provided should be applied to this field
97
95
  * @param value The value to set for the HTML element.
98
96
  * for parents of boolean radios, pass true or false as value, or
99
97
  * an expression returning a boolean
100
98
  */
101
- setValue?: () => {
102
- condition: (this: DOMNodeReference) => boolean;
103
- value: (() => any) | any;
104
- };
99
+ setValue?: [
100
+ condition: (this: DOMNodeReference) => boolean,
101
+ value: (() => any) | any
102
+ ];
105
103
  /**
106
104
  * @param condition A function to determine if this field
107
105
  * should be enabled in a form, or disabled. True || 1 = disabled. False || 0 = enabled
108
106
  */
109
- setDisabled?: (this: DOMNodeReference) => boolean;
107
+ setDisabled?: () => boolean;
110
108
  }
111
109
 
112
110
  declare interface CreationOptions {
@@ -130,16 +128,6 @@ declare interface CreationOptions {
130
128
  timeoutMs?: number;
131
129
  }
132
130
 
133
- declare type AggregateHandlerFunction = () => Promise<void>;
134
-
135
- declare type Dependants = Map<DOMNodeReference, AggregateHandlerFunction>;
136
-
137
- declare type ValueElement =
138
- | HTMLInputElement
139
- | HTMLSelectElement
140
- | HTMLTextAreaElement
141
- | HTMLOptionElement;
142
-
143
131
  declare const Page_Validators: any[];
144
132
 
145
133
  declare interface ElementValue {