powerpagestoolkit 2.8.105 → 2.8.212

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