powerpagestoolkit 1.1.1 → 1.1.3

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,1087 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["powerpagestoolkit"] = factory();
8
+ else
9
+ root["powerpagestoolkit"] = factory();
10
+ })(self, () => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 693:
16
+ /***/ ((module, __webpack_exports__, __webpack_require__) => {
17
+
18
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19
+ /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
20
+ /* harmony export */ });
21
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(601);
22
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
23
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(314);
24
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
25
+ // Imports
26
+
27
+
28
+ var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
29
+ // Module
30
+ ___CSS_LOADER_EXPORT___.push([module.id, `.info-icon {
31
+ position: relative;
32
+ display: inline-block;
33
+ }
34
+
35
+ .info-icon .fa-info-circle {
36
+ cursor: pointer; /* Ensures the icon is recognized as interactive */
37
+ }
38
+
39
+ .info-icon .flyout-content {
40
+ display: none; /* Initially hidden */
41
+ position: absolute;
42
+ top: 100%;
43
+ left: 50%; /* Center horizontally */
44
+ transform: translateX(-50%); /* Adjust positioning */
45
+ background-color: #f9f9f9;
46
+ padding: 10px;
47
+ border: 1px solid #ddd;
48
+ z-index: 1;
49
+ max-width: 90vw; /* Ensure it doesn't overflow on mobile */
50
+ min-width: 200px; /* Minimum width for better readability */
51
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
52
+ border-radius: 4px; /* Rounded corners */
53
+ }
54
+ `, ""]);
55
+ // Exports
56
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
57
+
58
+
59
+ /***/ }),
60
+
61
+ /***/ 314:
62
+ /***/ ((module) => {
63
+
64
+
65
+
66
+ /*
67
+ MIT License http://www.opensource.org/licenses/mit-license.php
68
+ Author Tobias Koppers @sokra
69
+ */
70
+ module.exports = function (cssWithMappingToString) {
71
+ var list = [];
72
+
73
+ // return the list of modules as css string
74
+ list.toString = function toString() {
75
+ return this.map(function (item) {
76
+ var content = "";
77
+ var needLayer = typeof item[5] !== "undefined";
78
+ if (item[4]) {
79
+ content += "@supports (".concat(item[4], ") {");
80
+ }
81
+ if (item[2]) {
82
+ content += "@media ".concat(item[2], " {");
83
+ }
84
+ if (needLayer) {
85
+ content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
86
+ }
87
+ content += cssWithMappingToString(item);
88
+ if (needLayer) {
89
+ content += "}";
90
+ }
91
+ if (item[2]) {
92
+ content += "}";
93
+ }
94
+ if (item[4]) {
95
+ content += "}";
96
+ }
97
+ return content;
98
+ }).join("");
99
+ };
100
+
101
+ // import a list of modules into the list
102
+ list.i = function i(modules, media, dedupe, supports, layer) {
103
+ if (typeof modules === "string") {
104
+ modules = [[null, modules, undefined]];
105
+ }
106
+ var alreadyImportedModules = {};
107
+ if (dedupe) {
108
+ for (var k = 0; k < this.length; k++) {
109
+ var id = this[k][0];
110
+ if (id != null) {
111
+ alreadyImportedModules[id] = true;
112
+ }
113
+ }
114
+ }
115
+ for (var _k = 0; _k < modules.length; _k++) {
116
+ var item = [].concat(modules[_k]);
117
+ if (dedupe && alreadyImportedModules[item[0]]) {
118
+ continue;
119
+ }
120
+ if (typeof layer !== "undefined") {
121
+ if (typeof item[5] === "undefined") {
122
+ item[5] = layer;
123
+ } else {
124
+ item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
125
+ item[5] = layer;
126
+ }
127
+ }
128
+ if (media) {
129
+ if (!item[2]) {
130
+ item[2] = media;
131
+ } else {
132
+ item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
133
+ item[2] = media;
134
+ }
135
+ }
136
+ if (supports) {
137
+ if (!item[4]) {
138
+ item[4] = "".concat(supports);
139
+ } else {
140
+ item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
141
+ item[4] = supports;
142
+ }
143
+ }
144
+ list.push(item);
145
+ }
146
+ };
147
+ return list;
148
+ };
149
+
150
+ /***/ }),
151
+
152
+ /***/ 601:
153
+ /***/ ((module) => {
154
+
155
+
156
+
157
+ module.exports = function (i) {
158
+ return i[1];
159
+ };
160
+
161
+ /***/ }),
162
+
163
+ /***/ 72:
164
+ /***/ ((module) => {
165
+
166
+
167
+
168
+ var stylesInDOM = [];
169
+ function getIndexByIdentifier(identifier) {
170
+ var result = -1;
171
+ for (var i = 0; i < stylesInDOM.length; i++) {
172
+ if (stylesInDOM[i].identifier === identifier) {
173
+ result = i;
174
+ break;
175
+ }
176
+ }
177
+ return result;
178
+ }
179
+ function modulesToDom(list, options) {
180
+ var idCountMap = {};
181
+ var identifiers = [];
182
+ for (var i = 0; i < list.length; i++) {
183
+ var item = list[i];
184
+ var id = options.base ? item[0] + options.base : item[0];
185
+ var count = idCountMap[id] || 0;
186
+ var identifier = "".concat(id, " ").concat(count);
187
+ idCountMap[id] = count + 1;
188
+ var indexByIdentifier = getIndexByIdentifier(identifier);
189
+ var obj = {
190
+ css: item[1],
191
+ media: item[2],
192
+ sourceMap: item[3],
193
+ supports: item[4],
194
+ layer: item[5]
195
+ };
196
+ if (indexByIdentifier !== -1) {
197
+ stylesInDOM[indexByIdentifier].references++;
198
+ stylesInDOM[indexByIdentifier].updater(obj);
199
+ } else {
200
+ var updater = addElementStyle(obj, options);
201
+ options.byIndex = i;
202
+ stylesInDOM.splice(i, 0, {
203
+ identifier: identifier,
204
+ updater: updater,
205
+ references: 1
206
+ });
207
+ }
208
+ identifiers.push(identifier);
209
+ }
210
+ return identifiers;
211
+ }
212
+ function addElementStyle(obj, options) {
213
+ var api = options.domAPI(options);
214
+ api.update(obj);
215
+ var updater = function updater(newObj) {
216
+ if (newObj) {
217
+ if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
218
+ return;
219
+ }
220
+ api.update(obj = newObj);
221
+ } else {
222
+ api.remove();
223
+ }
224
+ };
225
+ return updater;
226
+ }
227
+ module.exports = function (list, options) {
228
+ options = options || {};
229
+ list = list || [];
230
+ var lastIdentifiers = modulesToDom(list, options);
231
+ return function update(newList) {
232
+ newList = newList || [];
233
+ for (var i = 0; i < lastIdentifiers.length; i++) {
234
+ var identifier = lastIdentifiers[i];
235
+ var index = getIndexByIdentifier(identifier);
236
+ stylesInDOM[index].references--;
237
+ }
238
+ var newLastIdentifiers = modulesToDom(newList, options);
239
+ for (var _i = 0; _i < lastIdentifiers.length; _i++) {
240
+ var _identifier = lastIdentifiers[_i];
241
+ var _index = getIndexByIdentifier(_identifier);
242
+ if (stylesInDOM[_index].references === 0) {
243
+ stylesInDOM[_index].updater();
244
+ stylesInDOM.splice(_index, 1);
245
+ }
246
+ }
247
+ lastIdentifiers = newLastIdentifiers;
248
+ };
249
+ };
250
+
251
+ /***/ }),
252
+
253
+ /***/ 659:
254
+ /***/ ((module) => {
255
+
256
+
257
+
258
+ var memo = {};
259
+
260
+ /* istanbul ignore next */
261
+ function getTarget(target) {
262
+ if (typeof memo[target] === "undefined") {
263
+ var styleTarget = document.querySelector(target);
264
+
265
+ // Special case to return head of iframe instead of iframe itself
266
+ if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
267
+ try {
268
+ // This will throw an exception if access to iframe is blocked
269
+ // due to cross-origin restrictions
270
+ styleTarget = styleTarget.contentDocument.head;
271
+ } catch (e) {
272
+ // istanbul ignore next
273
+ styleTarget = null;
274
+ }
275
+ }
276
+ memo[target] = styleTarget;
277
+ }
278
+ return memo[target];
279
+ }
280
+
281
+ /* istanbul ignore next */
282
+ function insertBySelector(insert, style) {
283
+ var target = getTarget(insert);
284
+ if (!target) {
285
+ throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
286
+ }
287
+ target.appendChild(style);
288
+ }
289
+ module.exports = insertBySelector;
290
+
291
+ /***/ }),
292
+
293
+ /***/ 540:
294
+ /***/ ((module) => {
295
+
296
+
297
+
298
+ /* istanbul ignore next */
299
+ function insertStyleElement(options) {
300
+ var element = document.createElement("style");
301
+ options.setAttributes(element, options.attributes);
302
+ options.insert(element, options.options);
303
+ return element;
304
+ }
305
+ module.exports = insertStyleElement;
306
+
307
+ /***/ }),
308
+
309
+ /***/ 56:
310
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
311
+
312
+
313
+
314
+ /* istanbul ignore next */
315
+ function setAttributesWithoutAttributes(styleElement) {
316
+ var nonce = true ? __webpack_require__.nc : 0;
317
+ if (nonce) {
318
+ styleElement.setAttribute("nonce", nonce);
319
+ }
320
+ }
321
+ module.exports = setAttributesWithoutAttributes;
322
+
323
+ /***/ }),
324
+
325
+ /***/ 825:
326
+ /***/ ((module) => {
327
+
328
+
329
+
330
+ /* istanbul ignore next */
331
+ function apply(styleElement, options, obj) {
332
+ var css = "";
333
+ if (obj.supports) {
334
+ css += "@supports (".concat(obj.supports, ") {");
335
+ }
336
+ if (obj.media) {
337
+ css += "@media ".concat(obj.media, " {");
338
+ }
339
+ var needLayer = typeof obj.layer !== "undefined";
340
+ if (needLayer) {
341
+ css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
342
+ }
343
+ css += obj.css;
344
+ if (needLayer) {
345
+ css += "}";
346
+ }
347
+ if (obj.media) {
348
+ css += "}";
349
+ }
350
+ if (obj.supports) {
351
+ css += "}";
352
+ }
353
+ var sourceMap = obj.sourceMap;
354
+ if (sourceMap && typeof btoa !== "undefined") {
355
+ css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
356
+ }
357
+
358
+ // For old IE
359
+ /* istanbul ignore if */
360
+ options.styleTagTransform(css, styleElement, options.options);
361
+ }
362
+ function removeStyleElement(styleElement) {
363
+ // istanbul ignore if
364
+ if (styleElement.parentNode === null) {
365
+ return false;
366
+ }
367
+ styleElement.parentNode.removeChild(styleElement);
368
+ }
369
+
370
+ /* istanbul ignore next */
371
+ function domAPI(options) {
372
+ if (typeof document === "undefined") {
373
+ return {
374
+ update: function update() {},
375
+ remove: function remove() {}
376
+ };
377
+ }
378
+ var styleElement = options.insertStyleElement(options);
379
+ return {
380
+ update: function update(obj) {
381
+ apply(styleElement, options, obj);
382
+ },
383
+ remove: function remove() {
384
+ removeStyleElement(styleElement);
385
+ }
386
+ };
387
+ }
388
+ module.exports = domAPI;
389
+
390
+ /***/ }),
391
+
392
+ /***/ 113:
393
+ /***/ ((module) => {
394
+
395
+
396
+
397
+ /* istanbul ignore next */
398
+ function styleTagTransform(css, styleElement) {
399
+ if (styleElement.styleSheet) {
400
+ styleElement.styleSheet.cssText = css;
401
+ } else {
402
+ while (styleElement.firstChild) {
403
+ styleElement.removeChild(styleElement.firstChild);
404
+ }
405
+ styleElement.appendChild(document.createTextNode(css));
406
+ }
407
+ }
408
+ module.exports = styleTagTransform;
409
+
410
+ /***/ })
411
+
412
+ /******/ });
413
+ /************************************************************************/
414
+ /******/ // The module cache
415
+ /******/ var __webpack_module_cache__ = {};
416
+ /******/
417
+ /******/ // The require function
418
+ /******/ function __webpack_require__(moduleId) {
419
+ /******/ // Check if module is in cache
420
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
421
+ /******/ if (cachedModule !== undefined) {
422
+ /******/ return cachedModule.exports;
423
+ /******/ }
424
+ /******/ // Create a new module (and put it into the cache)
425
+ /******/ var module = __webpack_module_cache__[moduleId] = {
426
+ /******/ id: moduleId,
427
+ /******/ // no module.loaded needed
428
+ /******/ exports: {}
429
+ /******/ };
430
+ /******/
431
+ /******/ // Execute the module function
432
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
433
+ /******/
434
+ /******/ // Return the exports of the module
435
+ /******/ return module.exports;
436
+ /******/ }
437
+ /******/
438
+ /************************************************************************/
439
+ /******/ /* webpack/runtime/compat get default export */
440
+ /******/ (() => {
441
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
442
+ /******/ __webpack_require__.n = (module) => {
443
+ /******/ var getter = module && module.__esModule ?
444
+ /******/ () => (module['default']) :
445
+ /******/ () => (module);
446
+ /******/ __webpack_require__.d(getter, { a: getter });
447
+ /******/ return getter;
448
+ /******/ };
449
+ /******/ })();
450
+ /******/
451
+ /******/ /* webpack/runtime/define property getters */
452
+ /******/ (() => {
453
+ /******/ // define getter functions for harmony exports
454
+ /******/ __webpack_require__.d = (exports, definition) => {
455
+ /******/ for(var key in definition) {
456
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
457
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
458
+ /******/ }
459
+ /******/ }
460
+ /******/ };
461
+ /******/ })();
462
+ /******/
463
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
464
+ /******/ (() => {
465
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
466
+ /******/ })();
467
+ /******/
468
+ /******/ /* webpack/runtime/nonce */
469
+ /******/ (() => {
470
+ /******/ __webpack_require__.nc = undefined;
471
+ /******/ })();
472
+ /******/
473
+ /************************************************************************/
474
+ var __webpack_exports__ = {};
475
+
476
+ ;// ./src/JS/safeAjax.js
477
+ function safeAjax(ajaxOptions) {
478
+ var deferredAjax = $.Deferred();
479
+
480
+ // shell is only available via runtime in a PowerPages portal
481
+ //eslint-disable-next-line
482
+ shell.getTokenDeferred().done(function (token) {
483
+ // add headers for AJAX
484
+ if (!ajaxOptions.headers) {
485
+ $.extend(ajaxOptions, {
486
+ headers: {
487
+ __RequestVerificationToken: token
488
+ }
489
+ });
490
+ } else {
491
+ ajaxOptions.headers["__RequestVerificationToken"] = token;
492
+ }
493
+ $.ajax(ajaxOptions).done(function (data, textStatus, jqXHR) {
494
+ //eslint-disable-next-line
495
+ validateLoginSession(data, textStatus, jqXHR, deferredAjax.resolve);
496
+ }).fail(deferredAjax.reject); //AJAX
497
+ }).fail(function () {
498
+ deferredAjax.rejectWith(this, arguments); // on token failure pass the token AJAX and args
499
+ });
500
+ return deferredAjax.promise();
501
+ }
502
+ ;// ./src/JS/API.js
503
+
504
+ var API = {
505
+ /**
506
+ *
507
+ * @param {Class} schema an instance of a schema class, containing the desired information for the POST request
508
+ * @returns a Promise resolving the successful results *[record id]* of the POST request, or rejecting the failed results *[error]* of the POST request.
509
+ */
510
+ createRecord: function createRecord(schema) {
511
+ return new Promise(function (resolve, reject) {
512
+ safeAjax({
513
+ type: "POST",
514
+ url: "/_api/".concat(schema.logicalName()),
515
+ data: schema.value(),
516
+ contentType: "application/json",
517
+ success: function success(response, status, xhr) {
518
+ resolve(xhr.getResponseHeader("entityid"));
519
+ },
520
+ error: function error(_error) {
521
+ reject(_error);
522
+ }
523
+ });
524
+ });
525
+ },
526
+ /**
527
+ *
528
+ * @param {string} tableSetName The DataVerse SET name of the table being queried
529
+ * @param {string} recordID the GUID of the records to be retrieved
530
+ * @param {string} selectColumns *OPTIONAL* if desired, enter your own custom OData query for advanced GET results. Format = select=column1,column2,column3...
531
+ * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
532
+ */
533
+ getRecord: function getRecord(tableSetName, recordID, selectColumns) {
534
+ return new Promise(function (resolve, reject) {
535
+ var url = "/_api/".concat(tableSetName, "(").concat(recordID, ")").concat(selectColumns ? "?$".concat(selectColumns) : "");
536
+ safeAjax({
537
+ type: "GET",
538
+ url: url,
539
+ success: resolve,
540
+ error: reject
541
+ });
542
+ });
543
+ },
544
+ /**
545
+ *
546
+ * @param {String} tableSetName The DataVerse SET name of the table being queried
547
+ * @param {String} queryParameters *OPTIONAL* the OData query parameters for refining search results: *format = $filter=filters&$select=columns*
548
+ * @returns a Promise resolving the successful results of the GET request, or rejecting the failed results of the GET request
549
+ */
550
+ getMultiple: function getMultiple(tableSetName, queryParameters) {
551
+ return new Promise(function (resolve, reject) {
552
+ // Construct the URL based on the presence of query parameters
553
+ var url = "/_api/".concat(tableSetName).concat(queryParameters ? "?".concat(queryParameters) : "");
554
+ safeAjax({
555
+ type: "GET",
556
+ url: url,
557
+ success: function success(response) {
558
+ resolve(response.value);
559
+ },
560
+ error: reject
561
+ });
562
+ });
563
+ }
564
+ };
565
+ /* harmony default export */ const JS_API = (API);
566
+ ;// ./src/JS/common_functions.js
567
+ /**
568
+ * @description a function that will wait for a targeted element to appear in the DOM, and then resolve a promise to allow further action to be performed after the targeted elements appears
569
+ * @param {String} selector a query selector expression to target a specific element that you want to appear in the DOM before taking further action
570
+ * @returns {Promise} the element targeted by ID *selector*
571
+ */
572
+
573
+ function waitFor(selector) {
574
+ return new Promise(function (resolve) {
575
+ if (document.querySelector(selector)) {
576
+ return resolve(document.querySelector(selector));
577
+ }
578
+ var observer = new MutationObserver(function () {
579
+ if (document.querySelector(selector)) {
580
+ observer.disconnect();
581
+ resolve(document.querySelector(selector));
582
+ }
583
+ });
584
+ observer.observe(document.body, {
585
+ subtree: true
586
+ });
587
+ });
588
+ }
589
+ ;// ./src/JS/FieldValidation.class.js
590
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
591
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
592
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
593
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
594
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
595
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
596
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
597
+ var FieldValidation = /*#__PURE__*/_createClass(function FieldValidation(fieldLogicalName, fieldDisplayname, evaluationFunction) {
598
+ _classCallCheck(this, FieldValidation);
599
+ _defineProperty(this, "createValidator", function () {
600
+ if (typeof Page_Validators == "undefined") return;
601
+ // Create new validator
602
+ var newValidator = document.createElement("span");
603
+ newValidator.style.display = "none";
604
+ newValidator.id = "".concat(this.fieldLogicalName, "Validator");
605
+ newValidator.controltovalidate = "".concat(this.fieldLogicalName);
606
+ newValidator.errormessage = "<a href='#".concat(this.fieldDisplayname, "_label'>").concat(this.fieldDisplayname, " is a required field</a>");
607
+ newValidator.validationGroup = ""; // Set this if you have set ValidationGroup on the form
608
+ newValidator.initialvalue = "";
609
+ newValidator.evaluationfunction = this.evaluationFunction;
610
+ // Add the new validator to the page validators array:
611
+ // eslint-disable-next-line no-undef
612
+ Page_Validators.push(newValidator);
613
+ });
614
+ this.fieldLogicalName = fieldLogicalName;
615
+ this.fieldDisplayname = fieldDisplayname;
616
+ this.evaluationFunction = evaluationFunction.bind(this);
617
+ this.createValidator();
618
+ });
619
+
620
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
621
+ var injectStylesIntoStyleTag = __webpack_require__(72);
622
+ var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
623
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js
624
+ var styleDomAPI = __webpack_require__(825);
625
+ var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
626
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js
627
+ var insertBySelector = __webpack_require__(659);
628
+ var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
629
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
630
+ var setAttributesWithoutAttributes = __webpack_require__(56);
631
+ var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
632
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js
633
+ var insertStyleElement = __webpack_require__(540);
634
+ var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
635
+ // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js
636
+ var styleTagTransform = __webpack_require__(113);
637
+ var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
638
+ // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/CSS/infoEl.style.css
639
+ var infoEl_style = __webpack_require__(693);
640
+ ;// ./src/CSS/infoEl.style.css
641
+
642
+
643
+
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+
652
+ var options = {};
653
+
654
+ options.styleTagTransform = (styleTagTransform_default());
655
+ options.setAttributes = (setAttributesWithoutAttributes_default());
656
+ options.insert = insertBySelector_default().bind(null, "head");
657
+ options.domAPI = (styleDomAPI_default());
658
+ options.insertStyleElement = (insertStyleElement_default());
659
+
660
+ var update = injectStylesIntoStyleTag_default()(infoEl_style/* default */.A, options);
661
+
662
+
663
+
664
+
665
+ /* harmony default export */ const CSS_infoEl_style = (infoEl_style/* default */.A && infoEl_style/* default */.A.locals ? infoEl_style/* default */.A.locals : undefined);
666
+
667
+ ;// ./src/JS/createInfoElement.js
668
+ // Import the CSS file
669
+
670
+ function CreateInfoEl(titleString) {
671
+ var span = document.createElement("span");
672
+ span.classList.add("info-icon");
673
+ var icon = document.createElement("i");
674
+ icon.classList.add("fa", "fa-solid", "fa-info-circle");
675
+ icon.setAttribute("aria-label", "Info");
676
+ icon.style.cursor = "pointer";
677
+ var flyoutContent = document.createElement("div");
678
+ flyoutContent.innerHTML = titleString;
679
+ flyoutContent.classList.add("flyout-content");
680
+ span.appendChild(icon);
681
+ span.appendChild(flyoutContent);
682
+ icon.addEventListener("mouseenter", function () {
683
+ flyoutContent.style.display = "block";
684
+ });
685
+ icon.addEventListener("mouseleave", function () {
686
+ flyoutContent.style.display = "none";
687
+ });
688
+ icon.addEventListener("touchstart", function (event) {
689
+ event.preventDefault();
690
+ flyoutContent.style.display = flyoutContent.style.display === "none" ? "block" : "none";
691
+ });
692
+ document.body.addEventListener("click", function (event) {
693
+ if (!span.contains(event.target)) {
694
+ flyoutContent.style.display = "none";
695
+ }
696
+ });
697
+ return span;
698
+ }
699
+ ;// ./src/JS/DOMNodeReferences.js
700
+ function DOMNodeReferences_typeof(o) { "@babel/helpers - typeof"; return DOMNodeReferences_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, DOMNodeReferences_typeof(o); }
701
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == DOMNodeReferences_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(DOMNodeReferences_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
702
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
703
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
704
+ function DOMNodeReferences_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
705
+ function DOMNodeReferences_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, DOMNodeReferences_toPropertyKey(o.key), o); } }
706
+ function DOMNodeReferences_createClass(e, r, t) { return r && DOMNodeReferences_defineProperties(e.prototype, r), t && DOMNodeReferences_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
707
+ function DOMNodeReferences_toPropertyKey(t) { var i = DOMNodeReferences_toPrimitive(t, "string"); return "symbol" == DOMNodeReferences_typeof(i) ? i : i + ""; }
708
+ function DOMNodeReferences_toPrimitive(t, r) { if ("object" != DOMNodeReferences_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != DOMNodeReferences_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
709
+
710
+
711
+
712
+
713
+ /**
714
+ * Class representing a reference to a DOM node.
715
+ */
716
+ var DOMNodeReference = /*#__PURE__*/function () {
717
+ /**
718
+ * Creates an instance of DOMNodeReference.
719
+ * @param {string} querySelector - The CSS selector to find the desired DOM element.
720
+ */
721
+ function DOMNodeReference(querySelector) {
722
+ DOMNodeReferences_classCallCheck(this, DOMNodeReference);
723
+ this.querySelector = querySelector;
724
+ this.element = null;
725
+ this.isLoaded = false;
726
+ // Deferred initialization
727
+ }
728
+
729
+ /**
730
+ * Initializes the DOMNodeReference instance by waiting for the element to be available in the DOM.
731
+ * @returns {Promise<Proxy>} A promise that resolves to a Proxy of the DOMNodeReference instance.
732
+ * @throws {Error} Throws an error if the element cannot be found using the provided query selector.
733
+ */
734
+ return DOMNodeReferences_createClass(DOMNodeReference, [{
735
+ key: "init",
736
+ value: (function () {
737
+ var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
738
+ var element;
739
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
740
+ while (1) switch (_context.prev = _context.next) {
741
+ case 0:
742
+ _context.next = 2;
743
+ return waitFor(this.querySelector);
744
+ case 2:
745
+ element = _context.sent;
746
+ if (element) {
747
+ _context.next = 5;
748
+ break;
749
+ }
750
+ throw new Error("[SYNACT] No Element could be found with the provided query selector: ".concat(this.querySelector));
751
+ case 5:
752
+ this.element = element;
753
+ this.parentElement = element.parentElement;
754
+ this.container = element.parentElement.parentElement.parentElement;
755
+ this.isLoaded = true;
756
+ if (!this.element.classList.contains("boolean-radio")) {
757
+ _context.next = 16;
758
+ break;
759
+ }
760
+ _context.next = 12;
761
+ return createDOMNodeReference("#".concat(this.element.id, "_1"));
762
+ case 12:
763
+ this.yesRadio = _context.sent;
764
+ _context.next = 15;
765
+ return createDOMNodeReference("#".concat(this.element.id, "_0"));
766
+ case 15:
767
+ this.noRadio = _context.sent;
768
+ case 16:
769
+ this.defaultDisplay = this.element.style.display || "block";
770
+ this.defaultParentDisplay = this.parentElement.style.display || "block";
771
+ this.defaultContainerDisplay = this.container.style.display || "block";
772
+ case 19:
773
+ case "end":
774
+ return _context.stop();
775
+ }
776
+ }, _callee, this);
777
+ }));
778
+ function init() {
779
+ return _init.apply(this, arguments);
780
+ }
781
+ return init;
782
+ }()
783
+ /**
784
+ * Hides the element by setting its display style to "none".
785
+ * @method hide
786
+ */
787
+ )
788
+ }, {
789
+ key: "hide",
790
+ value: function hide() {
791
+ this.element.style.display = "none";
792
+ }
793
+
794
+ /**
795
+ * Shows the element by restoring its default display style.
796
+ * @method show
797
+ */
798
+ }, {
799
+ key: "show",
800
+ value: function show() {
801
+ this.element.style.display = this.defaultDisplay;
802
+ }
803
+
804
+ /**
805
+ * Hides the parent element by setting its display style to "none".
806
+ * @method hideParent
807
+ */
808
+ }, {
809
+ key: "hideParent",
810
+ value: function hideParent() {
811
+ this.parentElement.style.display = "none";
812
+ }
813
+
814
+ /**
815
+ * Shows the parent element by restoring its default display style.
816
+ * @method showParent
817
+ */
818
+ }, {
819
+ key: "showParent",
820
+ value: function showParent() {
821
+ this.parentElement.style.display = this.defaultParentDisplay;
822
+ }
823
+
824
+ /**
825
+ * Hides the container (grandparent of the element) by setting its display style to "none".
826
+ * @method hideContainer
827
+ */
828
+ }, {
829
+ key: "hideContainer",
830
+ value: function hideContainer() {
831
+ this.element.parentElement.parentElement.parentElement.style.display = "none";
832
+ }
833
+
834
+ /**
835
+ * Shows the container (grandparent of the element) by restoring its default display style.
836
+ * @method showContainer
837
+ */
838
+ }, {
839
+ key: "showContainer",
840
+ value: function showContainer() {
841
+ this.element.parentElement.parentElement.parentElement.style.display = this.defaultContainerDisplay;
842
+ }
843
+
844
+ /**
845
+ * Sets the value of the HTML element.
846
+ * @method setValue
847
+ * @param {string} value - The value to set for the HTML element.
848
+ */
849
+ }, {
850
+ key: "setValue",
851
+ value: function setValue(value) {
852
+ this.element.value = value;
853
+ }
854
+
855
+ /**
856
+ * Gets the value of the HTML element.
857
+ * @method getValue
858
+ * @returns {string} The current value of the HTML element.
859
+ */
860
+ }, {
861
+ key: "getValue",
862
+ value: function getValue() {
863
+ return this.element.value;
864
+ }
865
+
866
+ /**
867
+ * Appends child elements to the HTML element.
868
+ * @method append
869
+ * @param {...HTMLElement} elements - The elements to append to the HTML element.
870
+ */
871
+ }, {
872
+ key: "append",
873
+ value: function append() {
874
+ var _this$element;
875
+ (_this$element = this.element).append.apply(_this$element, arguments);
876
+ }
877
+
878
+ /**
879
+ * Inserts elements after the HTML element.
880
+ * @method after
881
+ * @param {...HTMLElement} elements - The elements to insert after the HTML element.
882
+ */
883
+ }, {
884
+ key: "after",
885
+ value: function after() {
886
+ var _this$element2;
887
+ (_this$element2 = this.element).after.apply(_this$element2, arguments);
888
+ }
889
+
890
+ /**
891
+ * Retrieves the label associated with the HTML element.
892
+ * @method getLabel
893
+ * @returns {HTMLElement} The label element associated with this element.
894
+ * @throws {Error} Throws an error if the label cannot be found.
895
+ */
896
+ }, {
897
+ key: "getLabel",
898
+ value: function getLabel() {
899
+ return document.querySelector("#".concat(this.element.id, "_label"));
900
+ }
901
+
902
+ /**
903
+ * Appends child elements to the label associated with the HTML element.
904
+ * @method appendToLabel
905
+ * @param {...HTMLElement} elements - The elements to append to the label.
906
+ */
907
+ }, {
908
+ key: "appendToLabel",
909
+ value: function appendToLabel() {
910
+ var label = this.getLabel();
911
+ for (var _len = arguments.length, elements = new Array(_len), _key = 0; _key < _len; _key++) {
912
+ elements[_key] = arguments[_key];
913
+ }
914
+ label.append.apply(label, [" "].concat(elements));
915
+ }
916
+
917
+ /**
918
+ * Adds a click event listener to the HTML element.
919
+ * @method addClickListener
920
+ * @param {Function} eventHandler - The function to execute when the element is clicked.
921
+ */
922
+ }, {
923
+ key: "addClickListener",
924
+ value: function addClickListener(eventHandler) {
925
+ this.element.addEventListener("click", function (e) {
926
+ e.preventDefault();
927
+ eventHandler();
928
+ });
929
+ }
930
+
931
+ /**
932
+ * Adds a change event listener to the HTML element.
933
+ * @method addChangeListener
934
+ * @param {Function} eventHandler - The function to execute when the element's value changes.
935
+ */
936
+ }, {
937
+ key: "addChangeListener",
938
+ value: function addChangeListener(eventHandler) {
939
+ this.element.addEventListener("change", function (e) {
940
+ e.preventDefault();
941
+ eventHandler();
942
+ });
943
+ }
944
+
945
+ /**
946
+ * Unchecks both the yes and no radio buttons if they exist.
947
+ * @method uncheckRadios
948
+ */
949
+ }, {
950
+ key: "uncheckRadios",
951
+ value: function uncheckRadios() {
952
+ if (this.yesRadio && this.noRadio) {
953
+ this.yesRadio.element.checked = false;
954
+ this.noRadio.element.checked = false;
955
+ } else {
956
+ console.error("[SYNACT] Attempted to uncheck radios for an element that has no radios");
957
+ }
958
+ }
959
+
960
+ /**
961
+ * Creates a validation instance for the field.
962
+ * @method createValidation
963
+ * @param {Function} evaluationFunction - The function used to evaluate the field.
964
+ * @param {string} fieldDisplayName - The field name to display in error if validation fails.
965
+ */
966
+ }, {
967
+ key: "createValidation",
968
+ value: function createValidation(evaluationFunction, fieldDisplayName) {
969
+ new FieldValidation(this.id, "'".concat(fieldDisplayName, "'"), evaluationFunction);
970
+ }
971
+
972
+ /**
973
+ * Adds a tooltip with specified text to the label associated with the HTML element.
974
+ * @method addLabelTooltip
975
+ * @param {string} text - The text to display in the tooltip.
976
+ */
977
+ }, {
978
+ key: "addLabelTooltip",
979
+ value: function addLabelTooltip(text) {
980
+ this.appendToLabel(CreateInfoEl(text));
981
+ }
982
+
983
+ /**
984
+ * Sets the inner HTML content of the HTML element.
985
+ * @method setTextContent
986
+ * @param {string} text - The text to set as the inner HTML of the element.
987
+ */
988
+ }, {
989
+ key: "setTextContent",
990
+ value: function setTextContent(text) {
991
+ this.element.innerHTML = text;
992
+ }
993
+
994
+ /**
995
+ * Executes a callback function once the element is fully loaded.
996
+ * If the element is already loaded, the callback is called immediately.
997
+ * Otherwise, a MutationObserver is used to detect when the element is added to the DOM.
998
+ * @method onceLoaded
999
+ * @param {Function} callback - A callback function to execute once the element is loaded.
1000
+ */
1001
+ }, {
1002
+ key: "onceLoaded",
1003
+ value: function onceLoaded(callback) {
1004
+ var _this = this;
1005
+ console.log("loading element");
1006
+ if (this.isLoaded) {
1007
+ callback(this);
1008
+ } else {
1009
+ var observer = new MutationObserver(function () {
1010
+ if (document.querySelector(_this.querySelector)) {
1011
+ observer.disconnect(); // Stop observing once loaded
1012
+ _this.isLoaded = true;
1013
+ callback(_this); // Call the provided callback
1014
+ }
1015
+ });
1016
+ observer.observe(document.body, {
1017
+ subtree: true,
1018
+ childList: true
1019
+ });
1020
+ }
1021
+ }
1022
+ }]);
1023
+ }();
1024
+ /**
1025
+ * Creates and initializes a DOMNodeReference instance.
1026
+ * @async
1027
+ * @function createDOMNodeReference
1028
+ * @param {string} querySelector - The CSS selector for the desired DOM element.
1029
+ * @returns {Promise<DOMNodeReference>} A promise that resolves to a Proxy of the initialized DOMNodeReference instance.
1030
+ */
1031
+ function createDOMNodeReference(_x) {
1032
+ return _createDOMNodeReference.apply(this, arguments);
1033
+ }
1034
+ function _createDOMNodeReference() {
1035
+ _createDOMNodeReference = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(querySelector) {
1036
+ var instance;
1037
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1038
+ while (1) switch (_context2.prev = _context2.next) {
1039
+ case 0:
1040
+ instance = new DOMNodeReference(querySelector);
1041
+ _context2.next = 3;
1042
+ return instance.init();
1043
+ case 3:
1044
+ return _context2.abrupt("return", new Proxy(instance, {
1045
+ get: function get(target, prop) {
1046
+ // do not proxy the initialization method
1047
+ // init() is only needed in this factory function
1048
+ if (prop == "init") return undefined;
1049
+
1050
+ // proxy the class to wrap all methods in the 'onceLoaded' method, to make sure the
1051
+ // element is always available before executing method
1052
+ var value = target[prop];
1053
+ if (typeof value === "function" && prop !== "onceLoaded") {
1054
+ return function () {
1055
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1056
+ args[_key2] = arguments[_key2];
1057
+ }
1058
+ return target.onceLoaded(function () {
1059
+ return value.apply(target, args);
1060
+ });
1061
+ };
1062
+ }
1063
+ return value;
1064
+ }
1065
+ }));
1066
+ case 4:
1067
+ case "end":
1068
+ return _context2.stop();
1069
+ }
1070
+ }, _callee2);
1071
+ }));
1072
+ return _createDOMNodeReference.apply(this, arguments);
1073
+ }
1074
+ ;// ./src/index.js
1075
+
1076
+
1077
+ var powerpagestoolkit = {
1078
+ API: JS_API,
1079
+ createDOMNodeReference: createDOMNodeReference
1080
+ };
1081
+
1082
+ //eslint-disable-next-line
1083
+ module.exports = powerpagestoolkit;
1084
+ /******/ return __webpack_exports__;
1085
+ /******/ })()
1086
+ ;
1087
+ });