powerpagestoolkit 2.7.1441 → 2.8.0-1.4
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/dist/src/core/API.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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
|
|
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,
|
|
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,8 @@ export default class DOMNodeReference {
|
|
|
70
72
|
* @public
|
|
71
73
|
*/
|
|
72
74
|
updateValue(e?: Event): void;
|
|
75
|
+
protected triggerDependentsHandlers(): Promise<void>;
|
|
76
|
+
protected validateValue(value: any): any;
|
|
73
77
|
/**
|
|
74
78
|
* Sets up an event listener based on the specified event type, executing the specified
|
|
75
79
|
* event handler
|
|
@@ -147,7 +151,7 @@ export default class DOMNodeReference {
|
|
|
147
151
|
after(...elements: HTMLElement[]): DOMNodeReference;
|
|
148
152
|
/**
|
|
149
153
|
* Retrieves the label associated with the HTML element.
|
|
150
|
-
* @returns
|
|
154
|
+
* @returns The label element associated with this element.
|
|
151
155
|
*/
|
|
152
156
|
getLabel(): HTMLElement | null;
|
|
153
157
|
/**
|
|
@@ -166,7 +170,7 @@ export default class DOMNodeReference {
|
|
|
166
170
|
addTooltip(innerHTML: string, containerStyle?: Partial<CSSStyleDeclaration>): DOMNodeReference;
|
|
167
171
|
/**
|
|
168
172
|
* Sets the inner HTML content of the HTML element.
|
|
169
|
-
* @param
|
|
173
|
+
* @param string - The text to set as the inner HTML of the element.
|
|
170
174
|
* @returns - Instance of this [provides option to method chain]
|
|
171
175
|
*/
|
|
172
176
|
setInnerHTML(string: string): this;
|
|
@@ -189,49 +193,22 @@ export default class DOMNodeReference {
|
|
|
189
193
|
* Applies a business rule to manage visibility, required state, value, and disabled state dynamically.
|
|
190
194
|
* @see {@link BusinessRule}
|
|
191
195
|
* @param rule The business rule containing conditions for various actions.
|
|
192
|
-
* @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
|
|
193
197
|
* @returns Instance of this for method chaining.
|
|
194
198
|
*/
|
|
195
199
|
applyBusinessRule(rule: BusinessRule, dependencies: DOMNodeReference[]): DOMNodeReference;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
* and the visibility of one or more trigger elements.
|
|
199
|
-
* @deprecated Use the new 'applyBusinessRule Method
|
|
200
|
-
* @param condition A function that returns a boolean to determine
|
|
201
|
-
* the visibility of the target element. If `condition()` returns true, the element is shown;
|
|
202
|
-
* otherwise, it is hidden.
|
|
203
|
-
* @param dependencies - An array of `DOMNodeReference` instances. Event listeners are
|
|
204
|
-
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
205
|
-
* the target node.
|
|
206
|
-
* @throws When there's an error in setting up conditional rendering
|
|
207
|
-
* @returns Instance of this [provides option to method chain]
|
|
208
|
-
*/
|
|
209
|
-
configureConditionalRendering(condition: () => boolean, dependencies?: Array<DOMNodeReference>, clearValuesOnHide?: boolean): DOMNodeReference;
|
|
210
|
-
/**
|
|
211
|
-
* Sets up validation and requirement rules for the field with enhanced error handling and dynamic updates.
|
|
212
|
-
* @deprecated Use the new 'applyBusinessRule Method
|
|
213
|
-
* @param isRequired Function determining if field is required
|
|
214
|
-
* @param isValid Function validating field input
|
|
215
|
-
* @param fieldDisplayName Display name for error messages
|
|
216
|
-
* @param dependencies Fields that trigger requirement/validation updates
|
|
217
|
-
* @returns Instance of this
|
|
218
|
-
* @throws If validation setup fails
|
|
219
|
-
*/
|
|
220
|
-
configureValidationAndRequirements(isRequired: () => boolean, isValid: () => boolean, fieldDisplayName: string, dependencies: Array<DOMNodeReference>): DOMNodeReference;
|
|
200
|
+
protected returnAggregateHandler(rule: BusinessRule): AggregateHandlerFunction;
|
|
201
|
+
protected createValidator(evaluationFunction: () => boolean): HTMLSpanElement;
|
|
221
202
|
/**
|
|
222
203
|
* Sets up tracking for dependencies using both event listeners and mutation observers.
|
|
223
204
|
* @protected
|
|
224
205
|
* @param handler The function to execute when dependencies change
|
|
225
206
|
* @param dependencies Array of dependent DOM nodes to track
|
|
226
|
-
* @param options Additional configuration options. clearValuesOnHide defaults to false.
|
|
227
207
|
* all other options defaults to true
|
|
228
208
|
*/
|
|
229
|
-
protected _configDependencyTracking(handler:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
trackInputEvents?: boolean;
|
|
233
|
-
trackRadioButtons?: boolean;
|
|
234
|
-
}): void;
|
|
209
|
+
protected _configDependencyTracking(handler: AggregateHandlerFunction, dependencies: Array<DOMNodeReference>): void;
|
|
210
|
+
protected getVisibility(): boolean;
|
|
211
|
+
protected receiveNotification(): void;
|
|
235
212
|
/**
|
|
236
213
|
* Sets the required level for the field by adding or removing the "required-field" class on the label.
|
|
237
214
|
*
|
package/dist/src/globals.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference path="../core/DOMNodeReference.ts"/>
|
|
2
2
|
|
|
3
|
+
declare type EventCallback = () => any;
|
|
4
|
+
|
|
3
5
|
declare interface CreationOptions {
|
|
4
6
|
/**
|
|
5
7
|
* Should this call return an array of instantiated references, or just a single?
|
|
@@ -68,41 +70,43 @@ declare interface Form extends Partial<SystemForm> {
|
|
|
68
70
|
formxml: string;
|
|
69
71
|
}
|
|
70
72
|
|
|
73
|
+
|
|
71
74
|
declare interface BusinessRule {
|
|
72
75
|
/**
|
|
73
76
|
* @param condition A function that returns a boolean to determine
|
|
74
77
|
* the visibility of the target element. If `condition()` returns true, the element is shown;
|
|
75
78
|
* otherwise, it is hidden.
|
|
76
79
|
|
|
77
|
-
* @param clearValuesOnHide Should the values in the targeted field be cleared when hidden? Defaults to true
|
|
78
80
|
*/
|
|
79
|
-
setVisibility?:
|
|
80
|
-
condition: (this: DOMNodeReference) => boolean,
|
|
81
|
-
clearValuesOnHide?: boolean
|
|
82
|
-
];
|
|
81
|
+
setVisibility?: (this: DOMNodeReference) => boolean;
|
|
83
82
|
/**
|
|
84
|
-
*
|
|
85
|
-
* @param
|
|
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
89
|
*/
|
|
87
|
-
|
|
88
|
-
isRequired:
|
|
89
|
-
isValid
|
|
90
|
-
|
|
90
|
+
setRequirements?: () => {
|
|
91
|
+
isRequired?: (this: DOMNodeReference) => boolean;
|
|
92
|
+
isValid?: (this: DOMNodeReference, isRequiredResult?: boolean) => boolean;
|
|
93
|
+
};
|
|
94
|
+
|
|
91
95
|
/**
|
|
92
96
|
* @param condition A function to determine if the value provided should be applied to this field
|
|
93
97
|
* @param value The value to set for the HTML element.
|
|
94
98
|
* for parents of boolean radios, pass true or false as value, or
|
|
95
99
|
* an expression returning a boolean
|
|
96
100
|
*/
|
|
97
|
-
setValue?:
|
|
98
|
-
condition: (this: DOMNodeReference) => boolean
|
|
99
|
-
value: () => any | any
|
|
100
|
-
|
|
101
|
+
setValue?: () => {
|
|
102
|
+
condition: (this: DOMNodeReference) => boolean;
|
|
103
|
+
value: (() => any) | any;
|
|
104
|
+
};
|
|
101
105
|
/**
|
|
102
106
|
* @param condition A function to determine if this field
|
|
103
107
|
* should be enabled in a form, or disabled. True || 1 = disabled. False || 0 = enabled
|
|
104
108
|
*/
|
|
105
|
-
setDisabled?: () => boolean;
|
|
109
|
+
setDisabled?: (this: DOMNodeReference) => boolean;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
declare interface CreationOptions {
|
|
@@ -126,6 +130,16 @@ declare interface CreationOptions {
|
|
|
126
130
|
timeoutMs?: number;
|
|
127
131
|
}
|
|
128
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
|
+
|
|
129
143
|
declare const Page_Validators: any[];
|
|
130
144
|
|
|
131
145
|
declare interface ElementValue {
|