powerpagestoolkit 2.701.213 → 3.0.0

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