powerpagestoolkit 2.0.110 → 2.0.111
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/API.d.ts +32 -0
- package/dist/DOMNodeReference.d.ts +197 -0
- package/dist/createDOMNodeReferences.d.ts +15 -0
- package/dist/createInfoElement.d.ts +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/safeAjax.d.ts +1 -0
- package/dist/waitFor.d.ts +1 -0
- package/package.json +3 -3
package/dist/API.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const API: {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {Schema} schema an instance of a schema class, containing the desired information for the POST request
|
|
5
|
+
* @returns a Promise resolving the successful results *[record id]* of the POST request, or rejecting the failed results *[error]* of the POST request.
|
|
6
|
+
*/
|
|
7
|
+
createRecord(schema: Schema): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param tableSetName The DataVerse SET name of the table being queried
|
|
11
|
+
* @param recordID the GUID of the records to be retrieved
|
|
12
|
+
* @param selectColumns *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. Format = select=column1,column2,column3...
|
|
13
|
+
* @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
|
|
14
|
+
*/
|
|
15
|
+
getRecord(tableSetName: string, recordID: string, selectColumns?: string): Promise<object>;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param tableSetName The dataverse set name of the table being queried
|
|
19
|
+
* @param queryParameters *OPTIONAL* the OData query parameters for refining search results: *format = $filter=filters&$select=columns*
|
|
20
|
+
* @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
|
|
21
|
+
*/
|
|
22
|
+
getMultiple(tableSetName: string, queryParameters?: string): Promise<Array<object>>;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param tableSetName The dataverse set name for the table that you are updating a record in
|
|
26
|
+
* @param recordId The GUID of the record that is being updated
|
|
27
|
+
* @param data The JSON of the fields and data that are to be updated on the targeted record
|
|
28
|
+
* @returns A Promise with the results of the API execution
|
|
29
|
+
*/
|
|
30
|
+
updateRecord(tableSetName: string, recordId: string, data: object): Promise<any>;
|
|
31
|
+
};
|
|
32
|
+
export default API;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
export declare const _init: unique symbol;
|
|
2
|
+
/******/ /******/ /******/ export default class DOMNodeReference {
|
|
3
|
+
target: HTMLElement | string;
|
|
4
|
+
private isLoaded;
|
|
5
|
+
private defaultDisplay;
|
|
6
|
+
/**
|
|
7
|
+
* The value of the element that this node represents
|
|
8
|
+
* stays in syncs with the live DOM elements?.,m via event handler
|
|
9
|
+
* @type {any}
|
|
10
|
+
*/
|
|
11
|
+
value: any;
|
|
12
|
+
/**
|
|
13
|
+
* The element targeted when instantiating DOMNodeReference.
|
|
14
|
+
* Made available in order to perform normal DOM traversal,
|
|
15
|
+
* or access properties not available through this class.
|
|
16
|
+
* @property {HTMLElement | null}
|
|
17
|
+
*/
|
|
18
|
+
element: HTMLElement;
|
|
19
|
+
private visibilityController;
|
|
20
|
+
checked: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Represents the 'yes' option of a boolean radio field.
|
|
23
|
+
* This property is only available when the parent node
|
|
24
|
+
* is a main field for a boolean radio input.
|
|
25
|
+
* @property {DOMNodeReferenceProxy | null}
|
|
26
|
+
*/
|
|
27
|
+
yesRadio?: DOMNodeReference | null;
|
|
28
|
+
/**
|
|
29
|
+
* Represents the 'no' option of a boolean radio field.
|
|
30
|
+
* This property is only available when the parent node
|
|
31
|
+
* is a main field for a boolean radio input.
|
|
32
|
+
* @property {DOMNodeReferenceProxy | null}
|
|
33
|
+
*/
|
|
34
|
+
noRadio?: DOMNodeReference | null;
|
|
35
|
+
/**
|
|
36
|
+
* Creates an instance of DOMNodeReference.
|
|
37
|
+
* @param {string} target - The CSS selector to find the desired DOM element.
|
|
38
|
+
*/
|
|
39
|
+
/******/ /******/ constructor(target: HTMLElement | string);
|
|
40
|
+
[_init](): Promise<void>;
|
|
41
|
+
private _initValueSync;
|
|
42
|
+
updateValue(): void;
|
|
43
|
+
private _observeValueChanges;
|
|
44
|
+
private _attachVisibilityController;
|
|
45
|
+
private _attachRadioButtons;
|
|
46
|
+
/**
|
|
47
|
+
* Sets up an event listener based on the specified event type, executing the specified
|
|
48
|
+
* event handler
|
|
49
|
+
* @param {string} eventType - The DOM event to watch for
|
|
50
|
+
* @param {(this: DOMNodeReference, e: Event) => void} eventHandler - The callback function that runs when the
|
|
51
|
+
* specified event occurs
|
|
52
|
+
* @returns - Instance of this
|
|
53
|
+
*/
|
|
54
|
+
on(eventType: string, eventHandler: (e: Event) => void): DOMNodeReference;
|
|
55
|
+
/**
|
|
56
|
+
* Hides the element by setting its display style to "none".
|
|
57
|
+
* @returns - Instance of this
|
|
58
|
+
*/
|
|
59
|
+
hide(): DOMNodeReference;
|
|
60
|
+
/**
|
|
61
|
+
* Shows the element by restoring its default display style.
|
|
62
|
+
* @returns - Instance of this
|
|
63
|
+
*/
|
|
64
|
+
show(): DOMNodeReference;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param {function(this: DOMNodeReference): boolean | boolean} shouldShow - Either a function that returns true or false,
|
|
68
|
+
* or a natural boolean to determine the visibility of this
|
|
69
|
+
* @returns - Instance of this
|
|
70
|
+
*/
|
|
71
|
+
toggleVisibility(shouldShow: Function | boolean): DOMNodeReference;
|
|
72
|
+
/**
|
|
73
|
+
* Sets the value of the HTML element.
|
|
74
|
+
* @param {() => any} value - The value to set for the HTML element.
|
|
75
|
+
* for parents of boolean radios, pass true or false as value, or
|
|
76
|
+
* an expression returning a boolean
|
|
77
|
+
* @returns - Instance of this
|
|
78
|
+
*/
|
|
79
|
+
setValue(value: any): DOMNodeReference;
|
|
80
|
+
/**
|
|
81
|
+
* Disables the element so that users cannot input any data
|
|
82
|
+
* @returns - Instance of this
|
|
83
|
+
*/
|
|
84
|
+
disable(): DOMNodeReference;
|
|
85
|
+
/**
|
|
86
|
+
* Enables the element so that users can input data
|
|
87
|
+
* @returns - Instance of this
|
|
88
|
+
*/
|
|
89
|
+
enable(): DOMNodeReference;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @param {...HTMLElement} elements - The elements to prepend to the element targeted by this.
|
|
93
|
+
* @returns - Instance of this
|
|
94
|
+
*/
|
|
95
|
+
prepend(...elements: HTMLElement[]): DOMNodeReference;
|
|
96
|
+
/**
|
|
97
|
+
* Appends child elements to the HTML element.
|
|
98
|
+
* @param {...HTMLElement} elements - The elements to append to the element targeted by this.
|
|
99
|
+
* @returns - Instance of this
|
|
100
|
+
*/
|
|
101
|
+
append(...elements: HTMLElement[]): DOMNodeReference;
|
|
102
|
+
/**
|
|
103
|
+
* Inserts elements before the HTML element.
|
|
104
|
+
* @param {...HTMLElement} elements - The elements to insert before the HTML element.
|
|
105
|
+
* @returns - Instance of this
|
|
106
|
+
*/
|
|
107
|
+
before(...elements: HTMLElement[]): DOMNodeReference;
|
|
108
|
+
/**
|
|
109
|
+
* Inserts elements after the HTML element.
|
|
110
|
+
* @param {...HTMLElement} elements - The elements to insert after the HTML element.
|
|
111
|
+
* @returns - Instance of this
|
|
112
|
+
*/
|
|
113
|
+
after(...elements: HTMLElement[]): DOMNodeReference;
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves the label associated with the HTML element.
|
|
116
|
+
* @returns {HTMLElement} The label element associated with this element.
|
|
117
|
+
*/
|
|
118
|
+
getLabel(): HTMLElement | null;
|
|
119
|
+
/**
|
|
120
|
+
* Appends child elements to the label associated with the HTML element.
|
|
121
|
+
* @param {...HTMLElement} elements - The elements to append to the label.
|
|
122
|
+
* @returns - Instance of this
|
|
123
|
+
*/
|
|
124
|
+
appendToLabel(...elements: HTMLElement[]): DOMNodeReference;
|
|
125
|
+
/**
|
|
126
|
+
* Adds a tooltip with specified text to the label associated with the HTML element.
|
|
127
|
+
* @param {string} text - The text to display in the tooltip.
|
|
128
|
+
* @returns - Instance of this
|
|
129
|
+
*/
|
|
130
|
+
addLabelTooltip(text: string): DOMNodeReference;
|
|
131
|
+
/**
|
|
132
|
+
* Adds a tooltip with the specified text to the element
|
|
133
|
+
* @param {string} text - The text to display in the tooltip
|
|
134
|
+
* @returns - Instance of this
|
|
135
|
+
*/
|
|
136
|
+
addTooltip(text: string): DOMNodeReference;
|
|
137
|
+
/**
|
|
138
|
+
* Sets the inner HTML content of the HTML element.
|
|
139
|
+
* @param {string} string - The text to set as the inner HTML of the element.
|
|
140
|
+
* @returns - Instance of this
|
|
141
|
+
*/
|
|
142
|
+
setInnerHTML(string: string): this;
|
|
143
|
+
/**
|
|
144
|
+
* Removes this element from the DOM
|
|
145
|
+
* @returns - Instance of this
|
|
146
|
+
*/
|
|
147
|
+
remove(): this;
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @param {Partial<CSSStyleDeclaration} options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
|
|
151
|
+
* @returns - Instance of this
|
|
152
|
+
*/
|
|
153
|
+
setStyle(options: Partial<CSSStyleDeclaration>): this;
|
|
154
|
+
/**
|
|
155
|
+
* Unchecks both the yes and no radio buttons if they exist.
|
|
156
|
+
* @returns - Instance of this
|
|
157
|
+
*/
|
|
158
|
+
uncheckRadios(): DOMNodeReference;
|
|
159
|
+
/**
|
|
160
|
+
* Configures conditional rendering for the target element based on a condition
|
|
161
|
+
* and the visibility of one or more trigger elements.
|
|
162
|
+
*
|
|
163
|
+
* @param {(this: DOMNodeReference) => boolean} condition - A function that returns a boolean to determine
|
|
164
|
+
* the visibility of the target element. If `condition()` returns true, the element is shown;
|
|
165
|
+
* otherwise, it is hidden.
|
|
166
|
+
* @param {Array<DOMNodeReference>} [dependencies] - An array of `DOMNodeReference` instances. Event listeners are
|
|
167
|
+
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
168
|
+
* the target node.
|
|
169
|
+
* @returns - Instance of this
|
|
170
|
+
*/
|
|
171
|
+
configureConditionalRendering(condition: () => boolean, dependencies: Array<DOMNodeReference>): DOMNodeReference;
|
|
172
|
+
/**
|
|
173
|
+
* 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.
|
|
174
|
+
*
|
|
175
|
+
* @param {function(this: DOMNodeReference): boolean} isRequired - A function that determines whether the field should be required. Returns `true` if required, `false` otherwise.
|
|
176
|
+
* @param {function(this: DOMNodeReference): boolean} isValid - A function that checks if the field's input is valid. Returns `true` if valid, `false` otherwise.
|
|
177
|
+
* @param {string} fieldDisplayName - The name of the field, used in error messages if validation fails.
|
|
178
|
+
* @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.
|
|
179
|
+
* @returns - Instance of this
|
|
180
|
+
*/
|
|
181
|
+
configureValidationAndRequirements(isRequired: (instance: DOMNodeReference) => boolean, isValid: (instance: DOMNodeReference) => boolean, fieldDisplayName: string, dependencies: Array<DOMNodeReference>): DOMNodeReference;
|
|
182
|
+
/**
|
|
183
|
+
* Sets the required level for the field by adding or removing the "required-field" class on the label.
|
|
184
|
+
*
|
|
185
|
+
* @param {boolean} isRequired - Determines whether the field should be marked as required.
|
|
186
|
+
* If true, the "required-field" class is added to the label; if false, it is removed.
|
|
187
|
+
* @returns - Instance of this
|
|
188
|
+
*/
|
|
189
|
+
setRequiredLevel(isRequired: Function | boolean): DOMNodeReference;
|
|
190
|
+
/**
|
|
191
|
+
* Executes a callback function once the element is fully loaded.
|
|
192
|
+
* If the element is already loaded, the callback is called immediately.
|
|
193
|
+
* Otherwise, a MutationObserver is used to detect when the element is added to the DOM.
|
|
194
|
+
* @param {Function} callback - A callback function to execute once the element is loaded.
|
|
195
|
+
*/
|
|
196
|
+
onceLoaded(callback: (instance: DOMNodeReference) => any): any;
|
|
197
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import DOMNodeReference from "./DOMNodeReference.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates and initializes a DOMNodeReference instance.
|
|
4
|
+
* @async
|
|
5
|
+
* @param {string | HTMLElement} target - The CSS selector for the desired DOM element, or, optionally, the element itself for which to create a DOMNodeReference.
|
|
6
|
+
* @returns {Promise<DOMNodeReference>} A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createDOMNodeReference(target: HTMLElement | string): Promise<DOMNodeReference>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates and initializes multiple DOMNodeReference instances.
|
|
11
|
+
* @async
|
|
12
|
+
* @param {string} querySelector - The CSS selector for the desired DOM elements.
|
|
13
|
+
* @returns {Promise<DOMNodeReference[]>} A promise that resolves to an array of Proxies of initialized DOMNodeReference instances.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createMultipleDOMNodeReferences(querySelector: string): Promise<DOMNodeReference[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CreateInfoEl(titleString: string): HTMLSpanElement;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import DOMNodeReference from "./DOMNodeReference.js";
|
|
2
|
+
export declare class DOMNodeInitializationError extends Error {
|
|
3
|
+
constructor(instance: DOMNodeReference, error: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class DOMNodeNotFoundError extends Error {
|
|
6
|
+
constructor(instance: DOMNodeReference);
|
|
7
|
+
}
|
|
8
|
+
export declare class ConditionalRenderingError extends Error {
|
|
9
|
+
constructor(instance: DOMNodeReference, error: string);
|
|
10
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function safeAjax(ajaxOptions: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function waitFor(target: HTMLElement | string): Promise<HTMLElement>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powerpagestoolkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.111",
|
|
4
4
|
"description": "Reference, manipulate, and engage with Power Pages sites through the nodes in the DOM; use a variety of custom methods that allow customizing your power pages site quicker and easier. ",
|
|
5
5
|
"main": "./dist/bundle.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
],
|
|
56
56
|
"files": [
|
|
57
57
|
"dist/bundle.js",
|
|
58
|
-
"dist
|
|
58
|
+
"dist/**/*.d.ts"
|
|
59
59
|
],
|
|
60
60
|
"exports": {
|
|
61
61
|
".": {
|
|
62
62
|
"import": "./dist/index.js",
|
|
63
|
-
"types": "./dist
|
|
63
|
+
"types": "./dist/index.d.ts"
|
|
64
64
|
},
|
|
65
65
|
"./createDOMNodeReference": {
|
|
66
66
|
"import": "./dist/createDOMNodeReference.js",
|