powerpagestoolkit 1.3.3001 → 2.0.1
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/README.md +4 -1
- package/dist/@types/API.d.ts +32 -0
- package/dist/@types/DOMNodeReference.d.ts +196 -0
- package/dist/@types/List.d.ts +11 -0
- package/dist/@types/ListItem.d.ts +10 -0
- package/dist/@types/createDOMNodeReferences.d.ts +15 -0
- package/dist/@types/createInfoElement.d.ts +1 -0
- package/dist/@types/errors.d.ts +10 -0
- package/dist/@types/getList.d.ts +2 -0
- package/dist/@types/index.d.ts +4 -0
- package/dist/@types/safeAjax.d.ts +1 -0
- package/dist/@types/waitFor.d.ts +1 -0
- package/dist/bundle.js +688 -0
- package/package.json +15 -16
- package/dist/index.bundle.js +0 -1293
- package/index.d.ts +0 -277
package/index.d.ts
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class representing a reference to a DOM node.
|
|
3
|
-
*/
|
|
4
|
-
class DOMNodeReference {
|
|
5
|
-
/**
|
|
6
|
-
* Creates an instance of DOMNodeReference.
|
|
7
|
-
* @param {string} querySelector - The CSS selector to find the desired DOM element.
|
|
8
|
-
*/
|
|
9
|
-
constructor(target: string): DOMNodeReference;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The element targeted when instantiating DOMNodeReference.
|
|
13
|
-
* Made available in order to perform normal DOM traversal,
|
|
14
|
-
* or access properties not available through this class.
|
|
15
|
-
* @type {HTMLElement | null}
|
|
16
|
-
*/
|
|
17
|
-
element: HTMLElement | null;
|
|
18
|
-
isLoaded: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The value of the element that this node represents
|
|
21
|
-
* stays in syncs with the live DOM elements via event handler
|
|
22
|
-
* @type {string | null}
|
|
23
|
-
*/
|
|
24
|
-
value: string | null;
|
|
25
|
-
/**
|
|
26
|
-
* Represents the 'yes' option of a boolean radio field.
|
|
27
|
-
* This property is only available when the parent node
|
|
28
|
-
* is a main field for a boolean radio input.
|
|
29
|
-
* @type {DOMNodeReference | undefined}
|
|
30
|
-
*/
|
|
31
|
-
yesRadio?: DOMNodeReference;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Represents the 'no' option of a boolean radio field.
|
|
35
|
-
* This property is only available when the parent node
|
|
36
|
-
* is a main field for a boolean radio input.
|
|
37
|
-
* @type {DOMNodeReference | undefined}
|
|
38
|
-
*/
|
|
39
|
-
noRadio?: DOMNodeReference;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Initializes the DOMNodeReference instance by waiting for the element to be available in the DOM.
|
|
43
|
-
* @returns {Promise<DOMNodeReference>} A promise that resolves to a Proxy of the DOMNodeReference instance.
|
|
44
|
-
* @throws {Error} Throws an error if the element cannot be found using the provided query selector.
|
|
45
|
-
*/
|
|
46
|
-
private init(): Promise<this>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Hides the element by setting its display style to "none".
|
|
50
|
-
*/
|
|
51
|
-
hide(): void;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Shows the element by restoring its default display style.
|
|
55
|
-
*/
|
|
56
|
-
show(): void;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Sets the value of the HTML element.
|
|
60
|
-
* @param {() => any} value - The value to set for the HTML element.
|
|
61
|
-
* for parents of boolean radios, pass true or false as value, or
|
|
62
|
-
* an expression returning a boolean
|
|
63
|
-
*/
|
|
64
|
-
setValue(value: string): void;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Disables the element so that users cannot input any data
|
|
68
|
-
*/
|
|
69
|
-
disable(): void;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Enables the element so that users can input data
|
|
73
|
-
*/
|
|
74
|
-
enable(): void;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Prepends elements to the target
|
|
78
|
-
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to prepend to the HTML element
|
|
79
|
-
*/
|
|
80
|
-
prepend(...nodes: HTMLElement[] | DOMNodeReference[]): void;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Appends child elements to the HTML element.
|
|
84
|
-
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to append to the HTML element.
|
|
85
|
-
*/
|
|
86
|
-
append(...nodes: HTMLElement[] | DOMNodeReference[]): void;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Inserts elements before the HTML element.
|
|
90
|
-
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to insert before the HTML element.
|
|
91
|
-
*/
|
|
92
|
-
before(...nodes: HTMLElement[] | DOMNodeReference[]): void;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Inserts elements after the HTML element.
|
|
96
|
-
* @param {HTMLElement[] | DOMNodeReference[]} nodes - The elements to insert after the HTML element.
|
|
97
|
-
*/
|
|
98
|
-
after(...nodes: HTMLElement[] | DOMNodeReference[]): void;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Retrieves the label associated with the HTML element.
|
|
102
|
-
* @returns {HTMLElement} The label element associated with this element.
|
|
103
|
-
* @throws {Error} Throws an error if the label cannot be found.
|
|
104
|
-
*/
|
|
105
|
-
getLabel(): HTMLElement;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Appends child elements to the label associated with the HTML element.
|
|
109
|
-
* @param {...HTMLElement} elements - The elements to append to the label.
|
|
110
|
-
*/
|
|
111
|
-
appendToLabel(...elements: HTMLElement[]): void;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Sets up an event listener based on the specified event type, executing the specified
|
|
115
|
-
* event handler
|
|
116
|
-
* @param {string} eventType - The DOM event to watch for
|
|
117
|
-
* @param {(this: DOMNodeReference, e: Event) => void} eventHandler - The callback function that runs when the
|
|
118
|
-
* specified event occurs
|
|
119
|
-
*/
|
|
120
|
-
on(eventType: string, eventHandler: (event: Event) => void): void;
|
|
121
|
-
/**
|
|
122
|
-
* Unchecks both the yes and no radio buttons if they exist.
|
|
123
|
-
*/
|
|
124
|
-
uncheckRadios(): void;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Sets up validation and requirement rules for the field. This function dynamically updates the field's required status and validates its input based on the specified conditions.
|
|
128
|
-
*
|
|
129
|
-
* @param {function(this: DOMNodeReference): boolean} isRequired - A function that determines whether the field should be required. Returns `true` if required, `false` otherwise.
|
|
130
|
-
* @param {function(this: DOMNodeReference): boolean} isValid - A function that checks if the field's input is valid. Returns `true` if valid, `false` otherwise.
|
|
131
|
-
* @param {string} fieldDisplayName - The name of the field, used in error messages if validation fails.
|
|
132
|
-
* @param {Array<DOMNodeReference>} [dependencies] Other fields that this field’s requirement depends on. When these fields change, the required status of this field is re-evaluated. Make sure any DOMNodeReference used in `isRequired` or `isValid` is included in this array.
|
|
133
|
-
*/
|
|
134
|
-
configureValidationAndRequirements(
|
|
135
|
-
isRequired: (this: this) => boolean,
|
|
136
|
-
isValid: (this: this) => boolean,
|
|
137
|
-
fieldDisplayName: string,
|
|
138
|
-
dependencies: Array<DOMNodeReference>
|
|
139
|
-
): void;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Sets the required level for the field by adding or removing the "required-field" class on the label.
|
|
143
|
-
*
|
|
144
|
-
* @param {boolean} isRequired - Determines whether the field should be marked as required.
|
|
145
|
-
* If true, the "required-field" class is added to the label; if false, it is removed.
|
|
146
|
-
*/
|
|
147
|
-
setRequiredLevel(isRequired: boolean): void;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Adds a tooltip with specified text to the label associated with the HTML element.
|
|
151
|
-
* @param {string} text - The text to display in the tooltip.
|
|
152
|
-
*/
|
|
153
|
-
addLabelTooltip(text: string): void;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Adds a tooltip with the specified text to the element
|
|
157
|
-
* @param {string} text - The text to display in the tooltip
|
|
158
|
-
*/
|
|
159
|
-
addTooltip(text: string): void;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Sets the inner HTML content of the HTML element.
|
|
163
|
-
* @param {string} text - The text to set as the inner HTML of the element.
|
|
164
|
-
*/
|
|
165
|
-
setTextContent(text: string): void;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
* @param {Partial<CSSStyleDeclaration>} options - An object with the style properties (keys) and updated styles (values)
|
|
170
|
-
* to apply to the this. {"key": "value"}
|
|
171
|
-
*/
|
|
172
|
-
setStyle(options: Partial<CSSStyleDeclaration>): void;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
*
|
|
176
|
-
* @param {boolean} shouldShow shows or hides the target
|
|
177
|
-
* if = true => show, if = false => hide
|
|
178
|
-
*/
|
|
179
|
-
toggleVisibility(shouldShow: boolean): void;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Configures conditional rendering for the target element based on a condition
|
|
183
|
-
* and the visibility of one or more trigger elements.
|
|
184
|
-
*
|
|
185
|
-
* @param {(this: DOMNodeReference) => boolean} condition - A function that returns a boolean to determine
|
|
186
|
-
* the visibility of the target element. If `condition()` returns true, the element is shown;
|
|
187
|
-
* otherwise, it is hidden.
|
|
188
|
-
* @param {Array<DOMNodeReference>} dependencies - An array of `DOMNodeReference` instances. Event listeners are
|
|
189
|
-
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
190
|
-
* the target node.
|
|
191
|
-
*/
|
|
192
|
-
configureConditionalRendering(
|
|
193
|
-
condition: (this: DOMNodeReference) => boolean,
|
|
194
|
-
dependencies: DOMNodeReference[]
|
|
195
|
-
): void;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Executes a callback function once the element is fully loaded.
|
|
199
|
-
* If the element is already loaded, the callback is called immediately.
|
|
200
|
-
* Otherwise, a MutationObserver is used to detect when the element is added to the DOM.
|
|
201
|
-
* @param {Function} callback - A callback function to execute once the element is loaded.
|
|
202
|
-
*/
|
|
203
|
-
onceLoaded(callback: (instance: this) => void): void;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Creates and initializes a DOMNodeReference instance.
|
|
208
|
-
* @async
|
|
209
|
-
* @function createDOMNodeReference
|
|
210
|
-
* @param {string} target - The CSS selector for the desired DOM element.
|
|
211
|
-
* @returns {Promise<DOMNodeReference>} A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
|
|
212
|
-
*/
|
|
213
|
-
export declare async function createDOMNodeReference(
|
|
214
|
-
querySelector: string | HTMLElement
|
|
215
|
-
): Promise<DOMNodeReference>;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Interface representing an array of DOMNodeReference instances with additional methods.
|
|
219
|
-
*/
|
|
220
|
-
export interface DOMNodeReferenceArray extends Array<DOMNodeReference> {
|
|
221
|
-
/**
|
|
222
|
-
* Hides all the containers of the DOMNodeReference instances in the array.
|
|
223
|
-
*/
|
|
224
|
-
hideAll(): void;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Shows all the containers of the DOMNodeReference instances in the array.
|
|
228
|
-
*/
|
|
229
|
-
showAll(): void;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Creates and initializes multiple DOMNodeReference instances.
|
|
234
|
-
* @function createMultipleDOMNodeReferences
|
|
235
|
-
* @param {string} querySelector - The CSS selector for the desired DOM elements.
|
|
236
|
-
* @returns {Promise<DOMNodeReferenceArray>}
|
|
237
|
-
* A promise that resolves to an array of Proxies of initialized
|
|
238
|
-
* DOMNodeReference instances.
|
|
239
|
-
*/
|
|
240
|
-
export declare async function createMultipleDOMNodeReferences(
|
|
241
|
-
querySelector: string
|
|
242
|
-
): Promise<DOMNodeReferenceArray>;
|
|
243
|
-
|
|
244
|
-
interface Schema {
|
|
245
|
-
logicalName(): string;
|
|
246
|
-
value(): any; // Adjust this type based on the structure of your schema values
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export declare const API: {
|
|
250
|
-
/**
|
|
251
|
-
* Creates a new record in DataVerse.
|
|
252
|
-
* @param schema An instance of a schema class, containing the desired information for the POST request.
|
|
253
|
-
* @returns A Promise resolving the successful results (record ID) of the POST request, or rejecting with the error.
|
|
254
|
-
*/
|
|
255
|
-
createRecord(schema: Schema): Promise<string>;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Retrieves a single record from DataVerse.
|
|
259
|
-
* @param tableSetName The DataVerse SET name of the table being queried.
|
|
260
|
-
* @param recordID The GUID of the record to be retrieved.
|
|
261
|
-
* @param selectColumns *OPTIONAL* Custom OData query for advanced GET results. Format: select=column1,column2,column3...
|
|
262
|
-
* @returns A Promise resolving the successful results of the GET request, or rejecting with the error.
|
|
263
|
-
*/
|
|
264
|
-
getRecord(
|
|
265
|
-
tableSetName: string,
|
|
266
|
-
recordID: string,
|
|
267
|
-
selectColumns?: string
|
|
268
|
-
): Promise<any>; // Adjust return type as necessary
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Retrieves multiple records from DataVerse.
|
|
272
|
-
* @param tableSetName The DataVerse SET name of the table being queried.
|
|
273
|
-
* @param queryParameters *OPTIONAL* OData query parameters for refining search results: format = $filter=filters&$select=columns
|
|
274
|
-
* @returns A Promise resolving the successful results of the GET request, or rejecting with the error.
|
|
275
|
-
*/
|
|
276
|
-
getMultiple(tableSetName: string, queryParameters?: string): Promise<any>; // Adjust return type as necessary
|
|
277
|
-
};
|