powerpagestoolkit 2.8.2 → 2.8.105

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