powerpagestoolkit 1.3.2 → 1.3.5
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 +66 -24
- package/dist/@types/API.d.ts +24 -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 +5 -0
- package/dist/@types/safeAjax.d.ts +1 -0
- package/dist/@types/waitFor.d.ts +1 -0
- package/dist/API.js +65 -0
- package/dist/API.js.map +1 -0
- package/dist/DOMNodeReference.js +447 -0
- package/dist/DOMNodeReference.js.map +1 -0
- package/dist/List.js +18 -0
- package/dist/List.js.map +1 -0
- package/dist/ListItem.js +28 -0
- package/dist/ListItem.js.map +1 -0
- package/dist/bundle.css +36 -0
- package/dist/bundle.css.map +7 -0
- package/dist/bundle.js +711 -0
- package/dist/bundle.js.map +7 -0
- package/dist/createDOMNodeReferences.js +55 -0
- package/dist/createDOMNodeReferences.js.map +1 -0
- package/dist/createInfoElement.js +51 -0
- package/dist/createInfoElement.js.map +1 -0
- package/dist/errors.js +17 -0
- package/dist/errors.js.map +1 -0
- package/dist/getList.js +29 -0
- package/dist/getList.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/safeAjax.js +31 -0
- package/dist/safeAjax.js.map +1 -0
- package/dist/waitFor.js +33 -0
- package/dist/waitFor.js.map +1 -0
- package/index.d.ts +59 -28
- package/package.json +1 -1
- package/dist/index.bundle.js +0 -1234
package/README.md
CHANGED
|
@@ -59,8 +59,15 @@ target: HTMLElement | string;
|
|
|
59
59
|
element: HTMLElement;
|
|
60
60
|
isLoaded: boolean;
|
|
61
61
|
value: any;
|
|
62
|
+
/**
|
|
63
|
+
* If the element targeted is the main input for a yes/no radio control,
|
|
64
|
+
* yesRadio and noRadio will be available as properties of 'this'
|
|
65
|
+
*/
|
|
62
66
|
yesRadio: DOMNodeReference;
|
|
63
67
|
noRadio: DOMNodeReference;
|
|
68
|
+
// and if 'this' is the instance of a yesRadio or noRadio
|
|
69
|
+
// checked will represent wether the radio has been checked or not
|
|
70
|
+
checked: boolean;
|
|
64
71
|
```
|
|
65
72
|
|
|
66
73
|
##### Methods
|
|
@@ -85,19 +92,22 @@ show()
|
|
|
85
92
|
toggleVisibility(shouldShow: boolean | () => boolean)
|
|
86
93
|
|
|
87
94
|
/**
|
|
88
|
-
* Configures conditional rendering for the target element
|
|
89
|
-
* and the visibility of one or more trigger elements.
|
|
95
|
+
* Configures conditional rendering for the target element
|
|
96
|
+
* based on a condition and the visibility of one or more trigger elements.
|
|
90
97
|
*
|
|
91
|
-
* @param {(this: DOMNodeReference) => boolean} condition -
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
98
|
+
* @param {(this: DOMNodeReference) => boolean} condition -
|
|
99
|
+
* A function that returns a boolean to determine the visibility
|
|
100
|
+
* of the target element. If `condition()` returns true, the
|
|
101
|
+
* element is shown; otherwise, it is hidden.
|
|
102
|
+
* @param {Array<DOMNodeReference>} dependencies - An array
|
|
103
|
+
* of `DOMNodeReference` instances. Event listeners are
|
|
104
|
+
* registered on each to toggle the visibility of the
|
|
105
|
+
* target element based on the `condition` and the
|
|
106
|
+
* visibility of the target node.
|
|
97
107
|
*/
|
|
98
108
|
configureConditionalRendering(
|
|
99
109
|
condition: (this: DOMNodeReference) => boolean,
|
|
100
|
-
|
|
110
|
+
dependencies: Array<DOMNodeReference>
|
|
101
111
|
)
|
|
102
112
|
|
|
103
113
|
|
|
@@ -106,18 +116,36 @@ configureConditionalRendering(
|
|
|
106
116
|
const other_node = await createDOMNodeReference(".element_class")
|
|
107
117
|
|
|
108
118
|
your_node.configureConditionalRendering(() =>
|
|
109
|
-
other_node.value == "3",
|
|
110
|
-
|
|
119
|
+
other_node.value == "3",
|
|
120
|
+
/* your_node will only be
|
|
121
|
+
visible when the value of other_node is "3"
|
|
122
|
+
*/
|
|
123
|
+
[other_node]
|
|
124
|
+
/* and we have to include any DOMNodeReferences used
|
|
125
|
+
in the evaluation logic, so that changes to them can
|
|
126
|
+
be watched and the condition evaluated again
|
|
127
|
+
*/
|
|
111
128
|
);
|
|
112
129
|
|
|
113
130
|
|
|
114
131
|
/**
|
|
115
|
-
* Sets up validation and requirement rules for the field.
|
|
132
|
+
* Sets up validation and requirement rules for the field.
|
|
133
|
+
* This function dynamically updates the field's required status
|
|
134
|
+
* and validates its input based on the specified conditions.
|
|
116
135
|
*
|
|
117
|
-
* @param {function(this: DOMNodeReference): boolean} isRequired
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* @param {
|
|
136
|
+
* @param {function(this: DOMNodeReference): boolean} isRequired
|
|
137
|
+
* A function that determines whether the field should be required.
|
|
138
|
+
* Return `true` if required, `false` to not be required.
|
|
139
|
+
* @param {function(this: DOMNodeReference): boolean} isValid
|
|
140
|
+
* A function that checks if the field's input is valid.
|
|
141
|
+
* Return `true` if validation satisfied, `false` if not.
|
|
142
|
+
* @param {string} fieldDisplayName - The name of the field, used
|
|
143
|
+
* in error messages if validation fails.
|
|
144
|
+
* @param {Array<DOMNodeReference>} [dependencies]
|
|
145
|
+
* Other fields that this field’s requirement depends on. When
|
|
146
|
+
* these Nodes or their values change, the required status
|
|
147
|
+
* of this field is re-evaluated. Make sure any DOMNodeReference
|
|
148
|
+
* used in `isRequired` or `isValid` is included in this array.
|
|
121
149
|
*/
|
|
122
150
|
configureValidationAndRequirements(
|
|
123
151
|
isRequired: (this: this) => boolean,
|
|
@@ -131,18 +159,32 @@ configureValidationAndRequirements(
|
|
|
131
159
|
const other_node = await createDOMNodeReference(".element_class")
|
|
132
160
|
|
|
133
161
|
your_node.configureValidationAndRequirements(
|
|
134
|
-
() => other_node.yesRadio.checked,
|
|
135
|
-
|
|
136
|
-
|
|
162
|
+
() => other_node.yesRadio.checked,
|
|
163
|
+
/* if 'yes' is checked for this other node,
|
|
164
|
+
this function will evaluate to true,
|
|
165
|
+
meaning that 'your_node' will be required */
|
|
166
|
+
|
|
167
|
+
function () {
|
|
168
|
+
/* important to use standard 'function' declaration,
|
|
169
|
+
instead of arrow function when needing to
|
|
170
|
+
access 'this' (the instance of 'your_node') */
|
|
171
|
+
|
|
172
|
+
if (other_node.yesRadio.checked) {
|
|
173
|
+
// when other_node radio is checked 'yes'
|
|
137
174
|
return this.value; // this is only 'valid' if it has a value
|
|
138
175
|
} else return true;
|
|
139
176
|
},
|
|
140
177
|
"Your Field Name",
|
|
141
|
-
[other_node]
|
|
178
|
+
[other_node]
|
|
179
|
+
/* since our conditions depend on
|
|
180
|
+
'other_node' it must be included in the dependency
|
|
181
|
+
array so that the requirement conditions can be
|
|
182
|
+
re-evaluated when the value of 'other_node' changes */
|
|
142
183
|
);
|
|
143
184
|
|
|
144
185
|
|
|
145
|
-
|
|
186
|
+
/* sets the elements 'disabled' to true - useful for inputs
|
|
187
|
+
that need to be enabled/disabled conditionally */
|
|
146
188
|
disable()
|
|
147
189
|
|
|
148
190
|
// Sets the element 'disabled' to false
|
|
@@ -158,6 +200,9 @@ setValue(value: any)
|
|
|
158
200
|
// Sets the inner HTML content of the associated HTML element.
|
|
159
201
|
setTextContent(text: string)
|
|
160
202
|
|
|
203
|
+
// set any style attribute for 'this' with standard CSS style declaration
|
|
204
|
+
setStyle(options: Partial<CSSStyleDeclaration>): void;
|
|
205
|
+
|
|
161
206
|
// Appends child elements to the associated HTML element.
|
|
162
207
|
append(...elements: HTMLElement[])
|
|
163
208
|
|
|
@@ -177,9 +222,6 @@ on(eventType: string, eventHandler: (this: DOMNodeReference) => void)
|
|
|
177
222
|
// Unchecks both yes and no radio buttons if they exist.
|
|
178
223
|
uncheckRadios()
|
|
179
224
|
|
|
180
|
-
//Creates a validation instance for the field.
|
|
181
|
-
createValidation(evaluationFunction: () => boolean, fieldDisplayName: string)
|
|
182
|
-
|
|
183
225
|
// Adds a tooltip to the label associated with the HTML element.
|
|
184
226
|
addLabelTooltip(text: string)
|
|
185
227
|
|
|
@@ -0,0 +1,24 @@
|
|
|
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 {string} tableSetName The DataVerse SET name of the table being queried
|
|
11
|
+
* @param {string} recordID the GUID of the records to be retrieved
|
|
12
|
+
* @param {string} 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 {String} tableSetName The DataVerse SET name of the table being queried
|
|
19
|
+
* @param {String} 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
|
+
export default API;
|
|
@@ -0,0 +1,196 @@
|
|
|
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 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 _attachVisibilityController;
|
|
44
|
+
private _attachRadioButtons;
|
|
45
|
+
/**
|
|
46
|
+
* Sets up an event listener based on the specified event type, executing the specified
|
|
47
|
+
* event handler
|
|
48
|
+
* @param {string} eventType - The DOM event to watch for
|
|
49
|
+
* @param {(this: DOMNodeReference, e: Event) => void} eventHandler - The callback function that runs when the
|
|
50
|
+
* specified event occurs
|
|
51
|
+
* @returns - Instance of this
|
|
52
|
+
*/
|
|
53
|
+
on(eventType: string, eventHandler: (e: Event) => void): DOMNodeReference;
|
|
54
|
+
/**
|
|
55
|
+
* Hides the element by setting its display style to "none".
|
|
56
|
+
* @returns - Instance of this
|
|
57
|
+
*/
|
|
58
|
+
hide(): DOMNodeReference;
|
|
59
|
+
/**
|
|
60
|
+
* Shows the element by restoring its default display style.
|
|
61
|
+
* @returns - Instance of this
|
|
62
|
+
*/
|
|
63
|
+
show(): DOMNodeReference;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {function(this: DOMNodeReference): boolean | boolean} shouldShow - Either a function that returns true or false,
|
|
67
|
+
* or a natural boolean to determine the visibility of this
|
|
68
|
+
* @returns - Instance of this
|
|
69
|
+
*/
|
|
70
|
+
toggleVisibility(shouldShow: Function | boolean): DOMNodeReference;
|
|
71
|
+
/**
|
|
72
|
+
* Sets the value of the HTML element.
|
|
73
|
+
* @param {() => any} value - The value to set for the HTML element.
|
|
74
|
+
* for parents of boolean radios, pass true or false as value, or
|
|
75
|
+
* an expression returning a boolean
|
|
76
|
+
* @returns - Instance of this
|
|
77
|
+
*/
|
|
78
|
+
setValue(value: any): DOMNodeReference;
|
|
79
|
+
/**
|
|
80
|
+
* Disables the element so that users cannot input any data
|
|
81
|
+
* @returns - Instance of this
|
|
82
|
+
*/
|
|
83
|
+
disable(): DOMNodeReference;
|
|
84
|
+
/**
|
|
85
|
+
* Enables the element so that users can input data
|
|
86
|
+
* @returns - Instance of this
|
|
87
|
+
*/
|
|
88
|
+
enable(): DOMNodeReference;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param {...HTMLElement} elements - The elements to prepend to the element targeted by this.
|
|
92
|
+
* @returns - Instance of this
|
|
93
|
+
*/
|
|
94
|
+
prepend(...elements: HTMLElement[]): DOMNodeReference;
|
|
95
|
+
/**
|
|
96
|
+
* Appends child elements to the HTML element.
|
|
97
|
+
* @param {...HTMLElement} elements - The elements to append to the element targeted by this.
|
|
98
|
+
* @returns - Instance of this
|
|
99
|
+
*/
|
|
100
|
+
append(...elements: HTMLElement[]): DOMNodeReference;
|
|
101
|
+
/**
|
|
102
|
+
* Inserts elements before the HTML element.
|
|
103
|
+
* @param {...HTMLElement} elements - The elements to insert before the HTML element.
|
|
104
|
+
* @returns - Instance of this
|
|
105
|
+
*/
|
|
106
|
+
before(...elements: HTMLElement[]): DOMNodeReference;
|
|
107
|
+
/**
|
|
108
|
+
* Inserts elements after the HTML element.
|
|
109
|
+
* @param {...HTMLElement} elements - The elements to insert after the HTML element.
|
|
110
|
+
* @returns - Instance of this
|
|
111
|
+
*/
|
|
112
|
+
after(...elements: HTMLElement[]): DOMNodeReference;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves the label associated with the HTML element.
|
|
115
|
+
* @returns {HTMLElement} The label element associated with this element.
|
|
116
|
+
*/
|
|
117
|
+
getLabel(): HTMLElement | null;
|
|
118
|
+
/**
|
|
119
|
+
* Appends child elements to the label associated with the HTML element.
|
|
120
|
+
* @param {...HTMLElement} elements - The elements to append to the label.
|
|
121
|
+
* @returns - Instance of this
|
|
122
|
+
*/
|
|
123
|
+
appendToLabel(...elements: HTMLElement[]): DOMNodeReference;
|
|
124
|
+
/**
|
|
125
|
+
* Adds a tooltip with specified text to the label associated with the HTML element.
|
|
126
|
+
* @param {string} text - The text to display in the tooltip.
|
|
127
|
+
* @returns - Instance of this
|
|
128
|
+
*/
|
|
129
|
+
addLabelTooltip(text: string): DOMNodeReference;
|
|
130
|
+
/**
|
|
131
|
+
* Adds a tooltip with the specified text to the element
|
|
132
|
+
* @param {string} text - The text to display in the tooltip
|
|
133
|
+
* @returns - Instance of this
|
|
134
|
+
*/
|
|
135
|
+
addTooltip(text: string): DOMNodeReference;
|
|
136
|
+
/**
|
|
137
|
+
* Sets the inner HTML content of the HTML element.
|
|
138
|
+
* @param {string} string - The text to set as the inner HTML of the element.
|
|
139
|
+
* @returns - Instance of this
|
|
140
|
+
*/
|
|
141
|
+
setInnerHTML(string: string): this;
|
|
142
|
+
/**
|
|
143
|
+
* Removes this element from the DOM
|
|
144
|
+
* @returns - Instance of this
|
|
145
|
+
*/
|
|
146
|
+
remove(): this;
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
* @param {Partial<CSSStyleDeclaration} options and object containing the styles you want to set : {key: value} e.g.: {'display': 'block'}
|
|
150
|
+
* @returns - Instance of this
|
|
151
|
+
*/
|
|
152
|
+
setStyle(options: Partial<CSSStyleDeclaration>): this;
|
|
153
|
+
/**
|
|
154
|
+
* Unchecks both the yes and no radio buttons if they exist.
|
|
155
|
+
* @returns - Instance of this
|
|
156
|
+
*/
|
|
157
|
+
uncheckRadios(): DOMNodeReference;
|
|
158
|
+
/**
|
|
159
|
+
* Configures conditional rendering for the target element based on a condition
|
|
160
|
+
* and the visibility of one or more trigger elements.
|
|
161
|
+
*
|
|
162
|
+
* @param {(this: DOMNodeReference) => boolean} condition - A function that returns a boolean to determine
|
|
163
|
+
* the visibility of the target element. If `condition()` returns true, the element is shown;
|
|
164
|
+
* otherwise, it is hidden.
|
|
165
|
+
* @param {Array<DOMNodeReference>} [dependencies] - An array of `DOMNodeReference` instances. Event listeners are
|
|
166
|
+
* registered on each to toggle the visibility of the target element based on the `condition` and the visibility of
|
|
167
|
+
* the target node.
|
|
168
|
+
* @returns - Instance of this
|
|
169
|
+
*/
|
|
170
|
+
configureConditionalRendering(condition: () => boolean, dependencies: Array<DOMNodeReference>): DOMNodeReference;
|
|
171
|
+
/**
|
|
172
|
+
* 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.
|
|
173
|
+
*
|
|
174
|
+
* @param {function(this: DOMNodeReference): boolean} isRequired - A function that determines whether the field should be required. Returns `true` if required, `false` otherwise.
|
|
175
|
+
* @param {function(this: DOMNodeReference): boolean} isValid - A function that checks if the field's input is valid. Returns `true` if valid, `false` otherwise.
|
|
176
|
+
* @param {string} fieldDisplayName - The name of the field, used in error messages if validation fails.
|
|
177
|
+
* @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.
|
|
178
|
+
* @returns - Instance of this
|
|
179
|
+
*/
|
|
180
|
+
configureValidationAndRequirements(isRequired: (instance: DOMNodeReference) => boolean, isValid: (instance: DOMNodeReference) => boolean, fieldDisplayName: string, dependencies: Array<DOMNodeReference>): DOMNodeReference;
|
|
181
|
+
/**
|
|
182
|
+
* Sets the required level for the field by adding or removing the "required-field" class on the label.
|
|
183
|
+
*
|
|
184
|
+
* @param {boolean} isRequired - Determines whether the field should be marked as required.
|
|
185
|
+
* If true, the "required-field" class is added to the label; if false, it is removed.
|
|
186
|
+
* @returns - Instance of this
|
|
187
|
+
*/
|
|
188
|
+
setRequiredLevel(isRequired: Function | boolean): DOMNodeReference;
|
|
189
|
+
/**
|
|
190
|
+
* Executes a callback function once the element is fully loaded.
|
|
191
|
+
* If the element is already loaded, the callback is called immediately.
|
|
192
|
+
* Otherwise, a MutationObserver is used to detect when the element is added to the DOM.
|
|
193
|
+
* @param {Function} callback - A callback function to execute once the element is loaded.
|
|
194
|
+
*/
|
|
195
|
+
onceLoaded(callback: (instance: DOMNodeReference) => any): any;
|
|
196
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import DOMNodeReference from "./DOMNodeReference.js";
|
|
2
|
+
import ListItem from "./ListItem.js";
|
|
3
|
+
export declare const _listInit: unique symbol;
|
|
4
|
+
/******/ /******/ /******/ export default class List extends DOMNodeReference {
|
|
5
|
+
/**
|
|
6
|
+
* @property an array of List Items contained within this list
|
|
7
|
+
*/
|
|
8
|
+
listItems: ListItem[];
|
|
9
|
+
constructor(target: HTMLElement | string);
|
|
10
|
+
[_listInit](): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import DOMNodeReference from "./DOMNodeReference.js";
|
|
2
|
+
/******/ /******/ /******/ export default class ListItem extends DOMNodeReference {
|
|
3
|
+
/**
|
|
4
|
+
* @property The First Column in this specific list item
|
|
5
|
+
*/
|
|
6
|
+
firstColumn: HTMLElement;
|
|
7
|
+
constructor(target: HTMLElement | string);
|
|
8
|
+
removeTarget(): void;
|
|
9
|
+
setFirstRowLink(path: string): ListItem;
|
|
10
|
+
}
|
|
@@ -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;
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import API from "./API.js";
|
|
2
|
+
import { createDOMNodeReference, createMultipleDOMNodeReferences } from "./createDOMNodeReferences.js";
|
|
3
|
+
import getList from "./getList.js";
|
|
4
|
+
import "./style.css";
|
|
5
|
+
export { API, createDOMNodeReference, createMultipleDOMNodeReferences, getList, };
|
|
@@ -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/dist/API.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import safeAjax from "./safeAjax.js";
|
|
3
|
+
const API = {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Schema} schema an instance of a schema class, containing the desired information for the POST request
|
|
7
|
+
* @returns a Promise resolving the successful results *[record id]* of the POST request, or rejecting the failed results *[error]* of the POST request.
|
|
8
|
+
*/
|
|
9
|
+
createRecord(schema) {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
safeAjax({
|
|
12
|
+
type: "POST",
|
|
13
|
+
url: `/_api/${schema.logicalName()}`,
|
|
14
|
+
data: schema.value(),
|
|
15
|
+
contentType: "application/json",
|
|
16
|
+
success: function (response, status, xhr) {
|
|
17
|
+
resolve(xhr.getResponseHeader("entityid"));
|
|
18
|
+
},
|
|
19
|
+
error: (error) => {
|
|
20
|
+
reject(error);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {string} tableSetName The DataVerse SET name of the table being queried
|
|
28
|
+
* @param {string} recordID the GUID of the records to be retrieved
|
|
29
|
+
* @param {string} selectColumns *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. Format = select=column1,column2,column3...
|
|
30
|
+
* @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
|
|
31
|
+
*/
|
|
32
|
+
getRecord(tableSetName, recordID, selectColumns) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const url = `/_api/${tableSetName}(${recordID})${selectColumns ? `?$${selectColumns}` : ""}`;
|
|
35
|
+
safeAjax({
|
|
36
|
+
type: "GET",
|
|
37
|
+
url: url,
|
|
38
|
+
success: resolve,
|
|
39
|
+
error: reject,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {String} tableSetName The DataVerse SET name of the table being queried
|
|
46
|
+
* @param {String} queryParameters *OPTIONAL* the OData query parameters for refining search results: *format = $filter=filters&$select=columns*
|
|
47
|
+
* @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
|
|
48
|
+
*/
|
|
49
|
+
getMultiple(tableSetName, queryParameters) {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
// Construct the URL based on the presence of query parameters
|
|
52
|
+
const url = `/_api/${tableSetName}${queryParameters ? `?${queryParameters}` : ""}`;
|
|
53
|
+
safeAjax({
|
|
54
|
+
type: "GET",
|
|
55
|
+
url: url,
|
|
56
|
+
success: function (response) {
|
|
57
|
+
resolve(response.value);
|
|
58
|
+
},
|
|
59
|
+
error: reject,
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export default API;
|
|
65
|
+
//# sourceMappingURL=API.js.map
|
package/dist/API.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"API.js","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,MAAM,GAAG,GAAG;IACV;;;;OAIG;IACH,YAAY,CAAC,MAAc;QACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,QAAQ,CAAC;gBACP,IAAI,EAAE,MAAM;gBACZ,GAAG,EAAE,SAAS,MAAM,CAAC,WAAW,EAAE,EAAE;gBACpC,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE;gBACpB,WAAW,EAAE,kBAAkB;gBAC/B,OAAO,EAAE,UAAU,QAAQ,EAAE,MAAM,EAAE,GAAG;oBACtC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;gBAC7C,CAAC;gBACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;oBACf,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACD;;;;;;OAMG;IACH,SAAS,CACP,YAAoB,EACpB,QAAgB,EAChB,aAAqB;QAErB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,GAAG,GAAG,SAAS,YAAY,IAAI,QAAQ,IAC3C,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,EAAE,CAAC,CAAC,CAAC,EACzC,EAAE,CAAC;YAEH,QAAQ,CAAC;gBACP,IAAI,EAAE,KAAK;gBACX,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACD;;;;;OAKG;IACH,WAAW,CACT,YAAoB,EACpB,eAAuB;QAEvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,8DAA8D;YAC9D,MAAM,GAAG,GAAG,SAAS,YAAY,GAC/B,eAAe,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC,EAC5C,EAAE,CAAC;YAEH,QAAQ,CAAC;gBACP,IAAI,EAAE,KAAK;gBACX,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,UAAU,QAAQ;oBACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;gBACD,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,GAAG,CAAC"}
|