powerpagestoolkit 2.221.12 → 2.701.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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "imports": {
3
+ "powerpagestoolkit/": "./",
4
+ "powerpagestoolkit": "./index.js"
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ /**
3
+ * For use in setting up event management in the instances of DOMNodeReference
4
+ * @see {@link DOMNodeReference}
5
+ */
6
+ declare const eventMapping: Record<string, keyof HTMLElementEventMap>;
7
+ export default eventMapping;
@@ -0,0 +1,14 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ export declare const init: unique symbol;
3
+ export declare const destroy: unique symbol;
4
+ export declare const valueSync: unique symbol;
5
+ export declare const dateSync: unique symbol;
6
+ export declare const getElementValue: unique symbol;
7
+ export declare const attachVisibilityController: unique symbol;
8
+ export declare const attachRadioButtons: unique symbol;
9
+ export declare const bindMethods: unique symbol;
10
+ export declare const debounceTime: unique symbol;
11
+ export declare const observers: unique symbol;
12
+ export declare const boundEventListeners: unique symbol;
13
+ export declare const isValidFormElement: unique symbol;
14
+ export declare const registerEventListener: unique symbol;
@@ -1,10 +1,18 @@
1
- declare const API: {
1
+ /// <reference path="../globals.d.ts" />
2
+ /**
3
+ * Provides abstract class `API` that allows basic create, read, and update operations in DataVerse via the PowerPages API
4
+ * @method `createRecord` - Create a record in DataVerse
5
+ * @method `getRecord<T>` - Get a record by ID from DataVerse
6
+ * @method `getMultiple` - Get multiple records from DataVerse; with optional OData filtering
7
+ * @method `updateRecord` - Update a record by ID in DataVerse
8
+ */
9
+ declare abstract class API {
2
10
  /**
3
- *
4
- * @param {Schema} schema an instance of a schema class, containing the desired information for the POST request
11
+ * @param tableSetName The dataverse set name for the table that you are updating a record in
12
+ * @param data The JSON of the fields and data that are to be updated on the targeted record
5
13
  * @returns a Promise resolving the successful results *[record id]* of the POST request, or rejecting the failed results *[error]* of the POST request.
6
14
  */
7
- createRecord(schema: Schema): Promise<string>;
15
+ static createRecord(tableSetName: string, data: JSON): Promise<string>;
8
16
  /**
9
17
  *
10
18
  * @param tableSetName The DataVerse SET name of the table being queried
@@ -12,14 +20,14 @@ declare const API: {
12
20
  * @param selectColumns *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. Format = select=column1,column2,column3...
13
21
  * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
14
22
  */
15
- getRecord(tableSetName: string, recordID: string, selectColumns?: string): Promise<object>;
23
+ static getRecord<T>(tableSetName: string, recordID: string, selectColumns?: string): Promise<T>;
16
24
  /**
17
25
  *
18
26
  * @param tableSetName The dataverse set name of the table being queried
19
27
  * @param queryParameters *OPTIONAL* the OData query parameters for refining search results: *format = $filter=filters&$select=columns*
20
28
  * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
21
29
  */
22
- getMultiple(tableSetName: string, queryParameters?: string): Promise<Array<object>>;
30
+ static getMultiple(tableSetName: string, queryParameters?: string): Promise<Array<object>>;
23
31
  /**
24
32
  *
25
33
  * @param tableSetName The dataverse set name for the table that you are updating a record in
@@ -27,6 +35,6 @@ declare const API: {
27
35
  * @param data The JSON of the fields and data that are to be updated on the targeted record
28
36
  * @returns A Promise with the results of the API execution
29
37
  */
30
- updateRecord(tableSetName: string, recordId: string, data: object): Promise<any>;
31
- };
38
+ static updateRecord(tableSetName: string, recordId: string, data: object): Promise<any>;
39
+ }
32
40
  export default API;
@@ -0,0 +1,227 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import * as s from "../constants/symbols.d.ts";
3
+ export default class DOMNodeReference {
4
+ target: Element | string;
5
+ logicalName?: string;
6
+ root: Element;
7
+ protected [s.debounceTime]: number;
8
+ protected isLoaded: boolean;
9
+ protected defaultDisplay: string;
10
+ protected [s.observers]: Array<MutationObserver>;
11
+ protected [s.boundEventListeners]: Array<BoundEventListener>;
12
+ protected isRadio: boolean;
13
+ protected radioType: RadioType | null;
14
+ /**
15
+ * The value of the element that this node represents
16
+ * stays in syncs with the live DOM elements?.,m via event handler
17
+ */
18
+ value: any;
19
+ /**
20
+ * The element targeted when instantiating DOMNodeReference.
21
+ * Made available in order to perform normal DOM traversal,
22
+ * or access properties not available through this class.
23
+ */
24
+ element: HTMLElement;
25
+ protected visibilityController: HTMLElement;
26
+ checked: boolean;
27
+ /**
28
+ * Represents the 'yes' option of a boolean radio field.
29
+ * This property is only available when the parent node
30
+ * is a main field for a boolean radio input.
31
+ */
32
+ yesRadio: DOMNodeReference | null;
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
+ */
38
+ noRadio: DOMNodeReference | null;
39
+ /**
40
+ * Creates an instance of DOMNodeReference.
41
+ * @param target - The CSS selector to find the desired DOM element.
42
+ * @param root - Optionally specify the element within to search for the element targeted by 'target'
43
+ * Defaults to 'document.body'
44
+ */
45
+ /******/ /******/ constructor(target: Element | string, root: Element | undefined, debounceTime: number);
46
+ private extractLogicalName;
47
+ [s.init](): Promise<void>;
48
+ /**
49
+ * Initializes value synchronization with appropriate event listeners
50
+ * based on element type.
51
+ */
52
+ protected [s.valueSync](): void;
53
+ private determineEventType;
54
+ private isDateInput;
55
+ protected [s.isValidFormElement](element: Element): element is FormElement;
56
+ protected [s.registerEventListener](element: Element, eventType: keyof HTMLElementEventMap, handler: (e: Event) => unknown): void;
57
+ protected [s.dateSync](element: HTMLInputElement): Promise<void>;
58
+ /**
59
+ * Gets the current value of the element based on its type
60
+ * @protected
61
+ * @returns Object containing value and optional checked state
62
+ */
63
+ protected [s.getElementValue](): ElementValue;
64
+ protected [s.attachVisibilityController](): void;
65
+ protected [s.attachRadioButtons](): Promise<void>;
66
+ protected [s.bindMethods](): void;
67
+ protected [s.destroy](): void;
68
+ /**
69
+ * Updates the value and checked state based on element type
70
+ * @public
71
+ */
72
+ updateValue(e?: Event): void;
73
+ protected validateValue(value: any): any;
74
+ /**
75
+ * Sets up an event listener based on the specified event type, executing the specified
76
+ * event handler
77
+ * @param eventType - The DOM event to watch for
78
+ * @param eventHandler - The callback function that runs when the
79
+ * specified event occurs.
80
+ * @returns - Instance of this [provides option to method chain]
81
+ */
82
+ on(eventType: keyof HTMLElementEventMap, eventHandler: (e: Event) => void): DOMNodeReference;
83
+ /**
84
+ * Hides the element by setting its display style to "none".
85
+ * @returns - Instance of this [provides option to method chain]
86
+ */
87
+ hide(): DOMNodeReference;
88
+ /**
89
+ * Shows the element by restoring its default display style.
90
+ * @returns - Instance of this [provides option to method chain]
91
+ */
92
+ show(): DOMNodeReference;
93
+ /**
94
+ * @param shouldShow - Either a function that returns true or false,
95
+ * or a natural boolean to determine the visibility of this
96
+ * @returns - Instance of this [provides option to method chain]
97
+ */
98
+ toggleVisibility(shouldShow: ((instance: DOMNodeReference) => boolean) | boolean): DOMNodeReference;
99
+ /**
100
+ * Sets the value of the HTML element.
101
+ * @param value - The value to set for the HTML element.
102
+ * for parents of boolean radios, pass true or false as value, or
103
+ * an expression returning a boolean
104
+ * @returns - Instance of this [provides option to method chain]
105
+ */
106
+ setValue(value: (() => any) | any): DOMNodeReference;
107
+ /**
108
+ * Disables the element so that users cannot input any data
109
+ * @returns - Instance of this [provides option to method chain]
110
+ */
111
+ disable(): DOMNodeReference;
112
+ /**
113
+ * Clears all values and states of the element.
114
+ * Handles different input types appropriately, and can be called
115
+ * on an element containing N child inputs to clear all
116
+ *
117
+ * @returns - Instance of this [provides option to method chain]
118
+ * @throws If clearing values fails
119
+ */
120
+ clearValue(): Promise<DOMNodeReference>;
121
+ /**
122
+ * Enables the element so that users can input data
123
+ * @returns - Instance of this [provides option to method chain]
124
+ */
125
+ enable(): DOMNodeReference;
126
+ /**
127
+ * @param elements - The elements to prepend to the element targeted by this.
128
+ * @returns - Instance of this [provides option to method chain]
129
+ */
130
+ prepend(...elements: HTMLElement[]): DOMNodeReference;
131
+ /**
132
+ * Appends child elements to the HTML element.
133
+ * @param elements - The elements to append to the element targeted by this.
134
+ * @returns - Instance of this [provides option to method chain]
135
+ */
136
+ append(...elements: HTMLElement[]): DOMNodeReference;
137
+ /**
138
+ * Inserts elements before the HTML element.
139
+ * @param elements - The elements to insert before the HTML element.
140
+ * @returns - Instance of this [provides option to method chain]
141
+ */
142
+ before(...elements: HTMLElement[]): DOMNodeReference;
143
+ /**
144
+ * Inserts elements after the HTML element.
145
+ * @param elements - The elements to insert after the HTML element.
146
+ * @returns - Instance of this [provides option to method chain]
147
+ */
148
+ after(...elements: HTMLElement[]): DOMNodeReference;
149
+ /**
150
+ * Retrieves the label associated with the HTML element.
151
+ * @returns {HTMLElement} The label element associated with this element.
152
+ */
153
+ getLabel(): HTMLElement | null;
154
+ /**
155
+ * Adds a tooltip with specified text to the label associated with the HTML element.
156
+ * @param innerHTML - The innerHTML to append into the tooltip.
157
+ * @param containerStyle - Optional object with CSS Styles to apply to the info element
158
+ * @returns - Instance of this [provides option to method chain]
159
+ */
160
+ addLabelTooltip(innerHTML: string, containerStyle?: Partial<CSSStyleDeclaration>): DOMNodeReference;
161
+ /**
162
+ * Adds a tooltip with the specified text to the element
163
+ * @param innerHTML - The innerHTML to append into the tooltip
164
+ * @param containerStyle - Optional object with CSS Styles to apply to the info element
165
+ * @returns - Instance of this [provides option to method chain]
166
+ */
167
+ addTooltip(innerHTML: string, containerStyle?: Partial<CSSStyleDeclaration>): DOMNodeReference;
168
+ /**
169
+ * Sets the inner HTML content of the HTML element.
170
+ * @param {string} string - The text to set as the inner HTML of the element.
171
+ * @returns - Instance of this [provides option to method chain]
172
+ */
173
+ setInnerHTML(string: string): this;
174
+ /**
175
+ * Removes this element from the DOM
176
+ * @returns - Instance of this [provides option to method chain]
177
+ */
178
+ remove(): this;
179
+ /**
180
+ * @param options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
181
+ * @returns - Instance of this [provides option to method chain]
182
+ */
183
+ setStyle(options: Partial<CSSStyleDeclaration>): this;
184
+ /**
185
+ * Unchecks both the yes and no radio buttons if they exist.
186
+ * @returns - Instance of this [provides option to method chain]
187
+ */
188
+ uncheckRadios(): DOMNodeReference;
189
+ /**
190
+ * Applies a business rule to manage visibility, required state, value, and disabled state dynamically.
191
+ * @see {@link BusinessRule}
192
+ * @param rule The business rule containing conditions for various actions.
193
+ * @param dependencies For re-evaluation conditions when the state of the dependencies change
194
+ * @returns Instance of this for method chaining.
195
+ */
196
+ applyBusinessRule(rule: BusinessRule, dependencies: DOMNodeReference[]): DOMNodeReference;
197
+ /**
198
+ * Sets up tracking for dependencies using both event listeners and mutation observers.
199
+ * @protected
200
+ * @param handler The function to execute when dependencies change
201
+ * @param dependencies Array of dependent DOM nodes to track
202
+ * @param options Additional configuration options. clearValuesOnHide defaults to false.
203
+ * all other options defaults to true
204
+ */
205
+ protected _configDependencyTracking(handler: () => void, dependencies: Array<DOMNodeReference>, options?: {
206
+ clearValuesOnHide?: boolean;
207
+ observeVisibility?: boolean;
208
+ trackInputEvents?: boolean;
209
+ trackRadioButtons?: boolean;
210
+ }): void;
211
+ /**
212
+ * Sets the required level for the field by adding or removing the "required-field" class on the label.
213
+ *
214
+ * @param isRequired Determines whether the field should be marked as required.
215
+ * If true, the "required-field" class is added to the label; if false, it is removed.
216
+ * @returns Instance of this [provides option to method chain]
217
+ */
218
+ setRequiredLevel(isRequired: (() => boolean) | boolean): DOMNodeReference;
219
+ /**
220
+ * Executes a callback function once the element is fully loaded.
221
+ * If the element is already loaded, the callback is called immediately.
222
+ * Otherwise, a MutationObserver is used to detect when the element is added to the DOM.
223
+ * @param callback A callback function to execute once the element is loaded.
224
+ * Receives instance of 'this' as an argument
225
+ */
226
+ onceLoaded(callback: (instance: DOMNodeReference) => any): any;
227
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ export default class DOMNodeReferenceArray extends Array<DOMNodeReference> {
4
+ /**
5
+ * Hides all the containers of the DOMNodeReference instances in the array.
6
+ */
7
+ hideAll(this: DOMNodeReferenceArray): DOMNodeReferenceArray;
8
+ /**
9
+ * Shows all the containers of the DOMNodeReference instances in the array.
10
+ */
11
+ showAll(this: DOMNodeReferenceArray): DOMNodeReferenceArray;
12
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ export default class List {
3
+ private static _instance;
4
+ private _root;
5
+ private _listItems;
6
+ private _observer;
7
+ private constructor();
8
+ static get(): List;
9
+ private _observe;
10
+ private _update;
11
+ private _destroy;
12
+ destroy(): void;
13
+ }
@@ -0,0 +1,28 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ import type DOMNodeReferenceArray from "./DOMNodeReferenceArray.d.ts";
4
+ /**
5
+ * When loading into a page in PowerPages that has a form,
6
+ * you can use this function by passing in the GUID of the form, and you will receive an array/record
7
+ * of {@link DOMNodeReference}s that represent all fields, sections, sub-grids, and tabs of the given form.
8
+ * Access these properties of the {@link BoundForm} using the logical name of the control you need to access: form['logical_name']
9
+ * you can then execute all the methods available from DOMNodeReference
10
+ * @param formId - The string GUID of the form you want to bind to
11
+ * @returns An array of DOMNodeReferences, accessible as properties of a Record<string, DOMNodeReference> i.e. formProp = form["some_logicalName"]
12
+ * @example
13
+ * ```js
14
+ * bindForm("form-guid-0000").then((form) => {
15
+ * //...use the form
16
+ * const field = form["field_logical_name"]
17
+ * // or
18
+ * form["other_logical_name"].someMethod()
19
+ * })
20
+ *
21
+ * // or
22
+ *
23
+ * const form = await bindForm("form-guid-0000")
24
+ * ```
25
+ * @see {@link BoundForm}
26
+ * @see {@link DOMNodeReference}
27
+ */
28
+ export default function bindForm(formId: string): Promise<DOMNodeReferenceArray & Record<string, DOMNodeReference>>;
@@ -0,0 +1,88 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ import DOMNodeReference from "./DOMNodeReference.d.ts";
3
+ import type DOMNodeReferenceArray from "./DOMNodeReferenceArray.d.ts";
4
+ /**
5
+ * Creates and initializes a DOMNodeReference instance.
6
+ * @see {@link CreationOptions}
7
+ * @param **target** - The selector, using `querySelector` syntax, for the desired DOM element. Or, the `HTMLElement` itself for which to create a DOMNodeReference.
8
+ * @param **options** - Options for advanced retrieval of elements
9
+ * @param **options.multiple** - Should this call return an array of instantiated references, or just a single? Defaults to false, returning a single instance
10
+ * @param **options.root** - Optionally specify the element within to search for the element targeted by 'target'. Defaults to `document.body`
11
+ * @param **options.timeoutMs** - Optionally specify the amount of time that should be waited to find the targeted element before throwing error - useful for async DOM loading. Relies on MutationObserver. ***WARNING***: Implementing multiple references with timeout can result in infinite loading.
12
+ * @returns A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
13
+ *
14
+ * @see {@link DOMNodeReference}
15
+ * @see {@link DOMNodeReferenceArray}
16
+ * @see {@link enhanceArray}
17
+ */
18
+ export default function createDOMNodeReference(target: string | HTMLElement, options?: {
19
+ /**
20
+ * Should this call return an array of instantiated references, or just a single?
21
+ * Defaults to false, returning a single instance.
22
+ */
23
+ multiple?: (() => boolean) | boolean;
24
+ /**
25
+ * Optionally specify the element within which to search for the element targeted by 'target'.
26
+ * Defaults to 'document.body'.
27
+ */
28
+ root?: HTMLElement;
29
+ /**
30
+ * Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
31
+ * Useful for async DOM loading. Relies on MutationObserver.
32
+ * WARNING: Implementing multiple references with timeout can result in infinite loading.
33
+ */
34
+ timeoutMs?: number;
35
+ }): Promise<DOMNodeReference>;
36
+ export default function createDOMNodeReference(target: string, options?: {
37
+ /**
38
+ * Should this call return an array of instantiated references, or just a single?
39
+ * Defaults to false, returning a single instance.
40
+ */
41
+ multiple?: false;
42
+ /**
43
+ * Optionally specify the element within which to search for the element targeted by 'target'.
44
+ * Defaults to 'document.body'.
45
+ */
46
+ root?: HTMLElement;
47
+ /**
48
+ * Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
49
+ * Useful for async DOM loading. Relies on MutationObserver.
50
+ * WARNING: Implementing multiple references with timeout can result in infinite loading.
51
+ */
52
+ timeoutMs?: number;
53
+ }): Promise<DOMNodeReference>;
54
+ export default function createDOMNodeReference(target: Element, options?: {
55
+ /**
56
+ * Optionally specify the element within which to search for the element targeted by 'target'.
57
+ * Defaults to 'document.body'.
58
+ */
59
+ root?: HTMLElement;
60
+ /**
61
+ * Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
62
+ * Useful for async DOM loading. Relies on MutationObserver.
63
+ * WARNING: Implementing multiple references with timeout can result in infinite loading.
64
+ */
65
+ timeoutMs?: number;
66
+ }): Promise<DOMNodeReference>;
67
+ export default function createDOMNodeReference(target: string, options?: {
68
+ /**
69
+ * Should this call return an array of instantiated references, or just a single?
70
+ * Defaults to false, returning a single instance.
71
+ */
72
+ multiple?: true;
73
+ /**
74
+ * Optionally specify the element within which to search for the element targeted by 'target'.
75
+ * Defaults to 'document.body'.
76
+ */
77
+ root?: HTMLElement;
78
+ /**
79
+ * Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
80
+ * Useful for async DOM loading. Relies on MutationObserver.
81
+ * WARNING: Implementing multiple references with timeout can result in infinite loading.
82
+ */
83
+ timeoutMs?: number;
84
+ }): Promise<DOMNodeReferenceArray>;
85
+ export declare function validateOptions(options: Partial<CreationOptions>): void;
86
+ export declare function createProxyHandler(): {
87
+ get: (target: DOMNodeReference, prop: string | symbol) => any;
88
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference path="../globals.d.ts" />
2
+ /**
3
+ * Provides an async way to capture DOM elements; for when querySelector cannot capture the target due to async DOM content loading
4
+ * @param **target** - basic querySelector syntax to select an element
5
+ * @param **root** - optional parameter to replace document as the root from which to perform the node search
6
+ * @returns the element(s) targeted by the `querySelector` string
7
+ */
8
+ export default function waitFor(target: string, root: Element | Document, multiple: false, debounceTime: number): Promise<HTMLElement>;
9
+ export default function waitFor(target: string, root: Element | Document, multiple: true, debounceTime: number): Promise<HTMLElement[]>;
@@ -1,4 +1,5 @@
1
- import DOMNodeReference from "./DOMNodeReference.js";
1
+ /// <reference path="../globals.d.ts" />
2
+ import type DOMNodeReference from "../core/DOMNodeReference.d.ts";
2
3
  export declare class DOMNodeInitializationError extends Error {
3
4
  constructor(instance: DOMNodeReference, error: string);
4
5
  }
@@ -8,3 +9,6 @@ export declare class DOMNodeNotFoundError extends Error {
8
9
  export declare class ConditionalRenderingError extends Error {
9
10
  constructor(instance: DOMNodeReference, error: string);
10
11
  }
12
+ export declare class ValidationConfigError extends Error {
13
+ constructor(node: DOMNodeReference, message: string);
14
+ }
@@ -0,0 +1,152 @@
1
+ /// <reference path="../core/DOMNodeReference.ts"/>
2
+
3
+ declare type EventCallback = () => any;
4
+
5
+ declare interface CreationOptions {
6
+ /**
7
+ * Should this call return an array of instantiated references, or just a single?
8
+ * Defaults to false, returning a single instance.
9
+ */
10
+ multiple?: (() => boolean) | boolean;
11
+
12
+ /**
13
+ * Optionally specify the element within which to search for the element targeted by 'target'.
14
+ * Defaults to 'document.body'.
15
+ */
16
+ root?: HTMLElement;
17
+
18
+ /**
19
+ * Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
20
+ * Useful for async DOM loading. Relies on MutationObserver.
21
+ * WARNING: Implementing multiple references with timeout can result in infinite loading.
22
+ */
23
+ timeoutMs?: number;
24
+ }
25
+
26
+ declare interface SystemForm extends Object {
27
+ "@odata.context": string;
28
+ "@odata.etag": string;
29
+ "overwritetime@OData.Community.Display.V1.FormattedValue": string;
30
+ overwritetime: Date;
31
+ "isdesktopenabled@OData.Community.Display.V1.FormattedValue": string;
32
+ isdesktopenabled: boolean;
33
+ "publishedon@OData.Community.Display.V1.FormattedValue": Date;
34
+ publishedon: Date;
35
+ "_organizationid_value@OData.Community.Display.V1.FormattedValue": string;
36
+ "_organizationid_value@Microsoft.Dynamics.CRM.associatednavigationproperty": string;
37
+ "_organizationid_value@Microsoft.Dynamics.CRM.lookuplogicalname": string;
38
+ _organizationid_value: string;
39
+ formxml: string;
40
+ introducedversion: string;
41
+ "isairmerged@OData.Community.Display.V1.FormattedValue": string;
42
+ isairmerged: boolean;
43
+ "istabletenabled@OData.Community.Display.V1.FormattedValue": string;
44
+ istabletenabled: boolean;
45
+ solutionid: string;
46
+ formidunique: string;
47
+ "ismanaged@OData.Community.Display.V1.FormattedValue": string;
48
+ ismanaged: boolean;
49
+ "isdefault@OData.Community.Display.V1.FormattedValue": string;
50
+ isdefault: boolean;
51
+ "objecttypecode@OData.Community.Display.V1.FormattedValue": string;
52
+ objecttypecode: string;
53
+ "type@OData.Community.Display.V1.FormattedValue": string;
54
+ type: number;
55
+ "componentstate@OData.Community.Display.V1.FormattedValue": string;
56
+ componentstate: number;
57
+ "formpresentation@OData.Community.Display.V1.FormattedValue": string;
58
+ formpresentation: number;
59
+ "formactivationstate@OData.Community.Display.V1.FormattedValue": string;
60
+ formactivationstate: number;
61
+ name: string;
62
+ "versionnumber@OData.Community.Display.V1.FormattedValue": string;
63
+ versionnumber: number;
64
+ formjson: string;
65
+ description: string;
66
+ formid: string;
67
+ }
68
+
69
+ declare interface Form extends Partial<SystemForm> {
70
+ formxml: string;
71
+ }
72
+
73
+ declare interface BusinessRule {
74
+ /**
75
+ * @param condition A function that returns a boolean to determine
76
+ * the visibility of the target element. If `condition()` returns true, the element is shown;
77
+ * otherwise, it is hidden.
78
+
79
+ * @param clearValuesOnHide Should the values in the targeted field be cleared when hidden? Defaults to true
80
+ */
81
+ setVisibility?: [
82
+ condition: (this: DOMNodeReference) => boolean,
83
+ clearValuesOnHide?: boolean
84
+ ];
85
+ /**
86
+ * @param isRequired Function determining if field is required
87
+ * @param isValid Function validating field input.
88
+ */
89
+ setRequired?: [
90
+ isRequired: () => boolean,
91
+ isValid: (this: DOMNodeReference, isRequired: boolean) => boolean
92
+ ];
93
+ /**
94
+ * @param condition A function to determine if the value provided should be applied to this field
95
+ * @param value The value to set for the HTML element.
96
+ * for parents of boolean radios, pass true or false as value, or
97
+ * an expression returning a boolean
98
+ */
99
+ setValue?: [
100
+ condition: (this: DOMNodeReference) => boolean,
101
+ value: (() => any) | any
102
+ ];
103
+ /**
104
+ * @param condition A function to determine if this field
105
+ * should be enabled in a form, or disabled. True || 1 = disabled. False || 0 = enabled
106
+ */
107
+ setDisabled?: () => boolean;
108
+ }
109
+
110
+ declare interface CreationOptions {
111
+ /**
112
+ * Should this call return an array of instantiated references, or just a single?
113
+ * Defaults to false, returning a single instance.
114
+ */
115
+ multiple?: (() => boolean) | boolean;
116
+
117
+ /**
118
+ * Optionally specify the element within which to search for the element targeted by 'target'.
119
+ * Defaults to 'document.body'.
120
+ */
121
+ root?: HTMLElement;
122
+
123
+ /**
124
+ * Optionally specify the amount of time that should be waited to find the targeted element before throwing an error.
125
+ * Useful for async DOM loading. Relies on MutationObserver.
126
+ * WARNING: Implementing multiple references with timeout can result in infinite loading.
127
+ */
128
+ timeoutMs?: number;
129
+ }
130
+
131
+ declare const Page_Validators: any[];
132
+
133
+ declare interface ElementValue {
134
+ value: any;
135
+ checked?: boolean;
136
+ }
137
+
138
+ declare type RadioType = "truthy" | "falsy";
139
+
140
+ declare interface BoundEventListener {
141
+ element: Element;
142
+ event: keyof HTMLElementEventMap;
143
+ handler: (e: Event) => unknown;
144
+ }
145
+
146
+ declare type FormElement =
147
+ | HTMLInputElement
148
+ | HTMLSelectElement
149
+ | HTMLTextAreaElement
150
+ | HTMLSpanElement
151
+ | HTMLButtonElement
152
+ | HTMLFieldSetElement;
@@ -0,0 +1,5 @@
1
+ import API from "./core/API.d.ts";
2
+ import createRef from "./core/createDOMNodeReferences.d.ts";
3
+ import waitFor from "./core/waitFor.d.ts";
4
+ import bindForm from "./core/bindForm.d.ts";
5
+ export { API, bindForm, createRef, waitFor };