gd-sprest-bs 9.9.7 → 10.0.0

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.
@@ -16,6 +16,7 @@ var gd_sprest_1 = require("gd-sprest");
16
16
  var core_1 = require("../core");
17
17
  var datetime_1 = require("../datetime");
18
18
  var field_1 = require("../field");
19
+ var richTextBox_1 = require("../richTextBox");
19
20
  // Extend the list form
20
21
  exports.ListForm = gd_sprest_1.Helper.ListForm;
21
22
  // Method to get the fields to render
@@ -57,6 +58,7 @@ var getFieldsToRender = function (props) {
57
58
  var renderDisplay = function (fieldName, props) {
58
59
  var control = null;
59
60
  var field = props.info.fields[fieldName];
61
+ var isRichText = field.RichText;
60
62
  var value = props.info.fieldValuesAsText[fieldName] || "";
61
63
  var html = props.info.fieldValuesAsHtml[fieldName] || props.info.fieldValuesAsHtml[fieldName.replace(/\_/g, "_x005f_")] || "";
62
64
  // Ensure the field exists
@@ -131,8 +133,16 @@ var renderDisplay = function (fieldName, props) {
131
133
  }
132
134
  break;
133
135
  case gd_sprest_1.SPTypes.FieldType.Note:
134
- // Set the type
135
- control.type = core_1.Components.FormControlTypes.TextArea;
136
+ // See if this is a rich text field
137
+ if (isRichText) {
138
+ // Set the properties
139
+ control.toolbarType = richTextBox_1.RichTextBoxTypes.None;
140
+ control.type = richTextBox_1.RichTextBoxControlType;
141
+ }
142
+ else {
143
+ // Set the type
144
+ control.type = core_1.Components.FormControlTypes.TextArea;
145
+ }
136
146
  break;
137
147
  case gd_sprest_1.SPTypes.FieldType.URL:
138
148
  // Set the value
@@ -147,15 +157,18 @@ var renderDisplay = function (fieldName, props) {
147
157
  }
148
158
  // Detect html
149
159
  if (/<*>/g.test(html)) {
150
- // Update the control to be read-only
151
- control.type = core_1.Components.FormControlTypes.Readonly;
152
- // Set the rendered event
153
- control.onControlRendered = function (control) {
154
- // Get the target element
155
- var elTarget = control.el.querySelector("input") || control.el;
156
- // Override the html rendered
157
- elTarget.innerHTML = control.props.data;
158
- };
160
+ // Ensure this isn't a rich text field
161
+ if (!isRichText) {
162
+ // Update the control to be read-only
163
+ control.type = core_1.Components.FormControlTypes.Readonly;
164
+ // Set the rendered event
165
+ control.onControlRendered = isRichText ? null : function (control) {
166
+ // Get the target element
167
+ var elTarget = control.el.querySelector("input") || control.el;
168
+ // Override the html rendered
169
+ elTarget.innerHTML = control.props.data;
170
+ };
171
+ }
159
172
  }
160
173
  // Else, detect xml
161
174
  else if (/&lt;/g.test(html)) {
@@ -9,6 +9,7 @@ var Toolbars = require("./toolbar");
9
9
  */
10
10
  var RichTextBoxTypes;
11
11
  (function (RichTextBoxTypes) {
12
+ RichTextBoxTypes[RichTextBoxTypes["None"] = 0] = "None";
12
13
  RichTextBoxTypes[RichTextBoxTypes["Basic"] = 1] = "Basic";
13
14
  RichTextBoxTypes[RichTextBoxTypes["Full"] = 2] = "Full";
14
15
  })(RichTextBoxTypes = exports.RichTextBoxTypes || (exports.RichTextBoxTypes = {}));
@@ -31,17 +32,32 @@ var RichTextBox = function (props) {
31
32
  var options = props.options || {};
32
33
  options.modules = options.modules || {};
33
34
  options.placeholder ? options.placeholder = props.placeholder : null;
34
- typeof (options.readOnly) === "boolean" ? options.readOnly = props.disabled : null;
35
- typeof (options.theme) === "undefined" ? options.theme = "snow" : null;
35
+ options.readOnly == null && typeof (props.disabled) === "boolean" ? options.readOnly = props.disabled : null;
36
+ options.theme = options.theme == null ? "snow" : options.theme;
36
37
  // See if are setting the default toolbar options
38
+ var showToolbar = true;
37
39
  if (options.modules.toolbar == null) {
38
40
  // Set the toolbar options
39
- elToolbar.innerHTML = props.toolbarType == RichTextBoxTypes.Basic ? Toolbars.BasicToolbar : Toolbars.FullToolbar;
40
- // Set the container
41
+ switch (props.toolbarType) {
42
+ // None
43
+ case RichTextBoxTypes.None:
44
+ elToolbar.innerHTML = "";
45
+ showToolbar = false;
46
+ break;
47
+ // Basic
48
+ case RichTextBoxTypes.Basic:
49
+ elToolbar.innerHTML = Toolbars.BasicToolbar;
50
+ break;
51
+ // Default - Full
52
+ default:
53
+ elToolbar.innerHTML = Toolbars.FullToolbar;
54
+ break;
55
+ }
56
+ // Set the toolbar
41
57
  options.modules.toolbar = elToolbar;
42
58
  }
43
59
  else {
44
- // Set the container
60
+ // Set the toolbar container
45
61
  options.modules.toolbar.container = elToolbar;
46
62
  }
47
63
  // Create the element
@@ -67,6 +83,11 @@ var RichTextBox = function (props) {
67
83
  }
68
84
  // Apply the plugin
69
85
  var quillObj = new Quill(elEditor, options);
86
+ // See if we are hiding the toolbar
87
+ if (!showToolbar) {
88
+ // Remove the snow class
89
+ elToolbar.classList.remove("ql-snow");
90
+ }
70
91
  // Create the object
71
92
  var obj = {
72
93
  el: elRichTextBox,
@@ -74,11 +95,10 @@ var RichTextBox = function (props) {
74
95
  quillObj: quillObj,
75
96
  getHtml: function () { return quillObj.root.innerHTML; },
76
97
  getText: function () { return quillObj.getText(); },
77
- setValue: function (value) {
78
- // Set the value
79
- quillObj.setText(value);
80
- }
98
+ setHtml: function (value) { quillObj.root.innerHTML = value || ""; }
81
99
  };
100
+ // Set the value
101
+ props.value ? obj.setHtml(props.value) : null;
82
102
  // Execute the assign to event
83
103
  props.assignTo ? props.assignTo(obj) : null;
84
104
  // Return the object
@@ -99,6 +119,8 @@ gd_bs_1.Components.CustomControls.registerType(exports.RichTextBoxControlType, f
99
119
  disabled: props.isDisabled || props.isReadonly,
100
120
  el: ctrl.el,
101
121
  options: props.options,
122
+ rows: props.rows,
123
+ toolbarType: props.toolbarType,
102
124
  placeholder: props.placeholder,
103
125
  value: props.value
104
126
  });
@@ -698,7 +698,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
698
698
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
699
699
 
700
700
  "use strict";
701
- eval("\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.ListForm = void 0;\n\nvar gd_sprest_1 = __webpack_require__(/*! gd-sprest */ \"./node_modules/.pnpm/gd-sprest@7.0.8/node_modules/gd-sprest/build/index.js\");\n\nvar core_1 = __webpack_require__(/*! ../core */ \"./build/components/core.js\");\n\nvar datetime_1 = __webpack_require__(/*! ../datetime */ \"./build/components/datetime/index.js\");\n\nvar field_1 = __webpack_require__(/*! ../field */ \"./build/components/field/index.js\"); // Extend the list form\n\n\nexports.ListForm = gd_sprest_1.Helper.ListForm; // Method to get the fields to render\n\nvar getFieldsToRender = function getFieldsToRender(props) {\n var fieldNames = []; // See if the \"include\" fields property is defined\n\n if (props.includeFields) {\n // Set the field names\n fieldNames = props.includeFields;\n } else {\n // Parse the fields\n for (var fieldName in props.info.fields) {\n // See if the \"exclude\" property is set\n if (props.excludeFields) {\n var renderFl = true; // Parse the fields\n\n for (var i = 0; i < props.excludeFields.length; i++) {\n // See if we are excluding this field\n if (props.excludeFields[i] == fieldName) {\n // Set the flag\n renderFl = false;\n break;\n }\n } // Skip this field, if we are not rendering it\n\n\n if (!renderFl) {\n continue;\n }\n } // Add the field name\n\n\n fieldNames.push(fieldName);\n }\n } // Return the field names\n\n\n return fieldNames;\n}; // Method to render the display control\n\n\nvar renderDisplay = function renderDisplay(fieldName, props) {\n var control = null;\n var field = props.info.fields[fieldName];\n var value = props.info.fieldValuesAsText[fieldName] || \"\";\n var html = props.info.fieldValuesAsHtml[fieldName] || props.info.fieldValuesAsHtml[fieldName.replace(/\\_/g, \"_x005f_\")] || \"\"; // Ensure the field exists\n\n if (field == null) {\n // Log\n console.warn(\"[List Form] Field '\" + fieldName + \"' does not exist. Check the list or query.\");\n return control;\n } // See if we are hiding the field\n\n\n if (field.SchemaXml.indexOf('ShowInDisplayForm=\"FALSE\"') > 0) {\n return control;\n } // See if this is a note field\n\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Note) {\n // Update the html\n html = html.replace(/\\r?\\n/g, '<br />');\n } // Else, see if this is a user field\n else if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.User) {\n // See if this is a multi-user selection\n if (field.AllowMultipleValues) {\n var userNames = []; // Parse the users\n\n var users = (props.info.item[fieldName] ? props.info.item[fieldName].results : null) || [];\n\n for (var j = 0; j < users.length; j++) {\n // Append the user name\n userNames.push(users[j].Title);\n } // Set the html value\n\n\n html = userNames.join('<br />\\n');\n } else {\n // Extract the text only for single selections\n var elUser = document.createElement(\"div\");\n elUser.innerHTML = html;\n html = elUser.innerText;\n }\n } // Else, see if this is a choice field\n else if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Choice || field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.MultiChoice) {\n // Update the html\n html = value;\n } // Set the control\n\n\n control = {\n data: html,\n description: field.Description,\n isDisabled: true,\n label: field.Title,\n name: field.InternalName,\n type: core_1.Components.FormControlTypes.TextField,\n value: html\n }; // Update the type, based on the field\n\n switch (field.FieldTypeKind) {\n case gd_sprest_1.SPTypes.FieldType.DateTime:\n // Set the time flag\n control.showTime = field.DisplayFormat == gd_sprest_1.SPTypes.DateFormat.DateTime ? true : false; // Set the type\n\n control.type = datetime_1.DateTimeControlType;\n break;\n\n case gd_sprest_1.SPTypes.FieldType.Lookup:\n // Ensure a value exists\n if (html) {\n // Create an element to store the html\n var elLookup = document.createElement(\"div\");\n elLookup.innerHTML = html; // Update the value to be text\n\n html = elLookup.innerText;\n control.data = html;\n control.value = html;\n }\n\n break;\n\n case gd_sprest_1.SPTypes.FieldType.Note:\n // Set the type\n control.type = core_1.Components.FormControlTypes.TextArea;\n break;\n\n case gd_sprest_1.SPTypes.FieldType.URL:\n // Set the value\n var urlValue = props.info.item[fieldName];\n html = urlValue ? urlValue.Url : html;\n control.value = html;\n break;\n\n case gd_sprest_1.SPTypes.FieldType.User:\n // Set the type\n control.type = field.AllowMultipleValues ? core_1.Components.FormControlTypes.TextArea : control.type;\n break;\n } // Detect html\n\n\n if (/<*>/g.test(html)) {\n // Update the control to be read-only\n control.type = core_1.Components.FormControlTypes.Readonly; // Set the rendered event\n\n control.onControlRendered = function (control) {\n // Get the target element\n var elTarget = control.el.querySelector(\"input\") || control.el; // Override the html rendered\n\n elTarget.innerHTML = control.props.data;\n };\n } // Else, detect xml\n else if (/&lt;/g.test(html)) {\n // Update the value\n control.value = html.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/&quot;/g, '\"');\n } // Return the control\n\n\n return control;\n}; // Method to render a display form for an item\n\n\nexports.ListForm.renderDisplayForm = function (props) {\n var form = null; // Render a loading message\n\n var progress = core_1.Components.Progress({\n el: props.el,\n isAnimated: true,\n isStriped: true,\n label: \"Loading the Form\",\n size: 100\n });\n var mapper = {};\n var rows = []; // See if we are rendering attachments\n\n if (props.info.attachments) {\n // Render the attachments\n rows.push({\n columns: [{\n control: {\n id: \"ListFormAttachments\",\n label: \"Attachments\",\n name: \"Attachments\",\n onControlRendered: function onControlRendered(control) {\n var items = []; // Parse the attachments\n\n for (var i = 0; i < props.info.attachments.length; i++) {\n var attachment = props.info.attachments[i]; // Add the item\n\n items.push({\n buttons: [{\n className: \"me-1\",\n href: attachment.ServerRelativeUrl,\n isSmall: true,\n text: attachment.FileName\n }]\n });\n } // Render a toolbar\n\n\n core_1.Components.Toolbar({\n el: control.el,\n items: items\n });\n }\n }\n }]\n });\n } // Parse the fields to render\n\n\n var fieldNames = getFieldsToRender(props);\n\n for (var i = 0; i < fieldNames.length; i++) {\n var fieldName = fieldNames[i]; // Generate the control\n\n var control = renderDisplay(fieldName, props);\n\n if (control) {\n // Update the mapper\n mapper[fieldName] = control; // Add the row\n\n rows.push({\n columns: [{\n control: control\n }]\n });\n }\n } // See if there is a template\n\n\n if (props.template) {\n var updateControl = function updateControl(refControl) {\n // Get the control from the mapper\n var control = refControl ? mapper[refControl.name] : null; // Ensure the controls exists\n\n if (control && refControl) {\n // Parse the control keys\n for (var key in control) {\n // Skip if a value is already defined\n if (refControl[key]) {\n continue;\n } // Update the property\n\n\n refControl[key] = control[key];\n }\n }\n }; // Parse the template\n\n\n for (var i = 0; i < props.template.length; i++) {\n var row = props.template[i]; // Parse the columns if there are columns\n\n var columns = row.columns || [];\n\n for (var j = 0; j < columns.length; j++) {\n var column = columns[j]; // Update the control\n\n updateControl(column.control);\n }\n }\n } // Remove the progress bar\n\n\n progress.el.parentElement ? progress.el.parentElement.removeChild(progress.el) : null; // Counter for each control\n\n var ctrlCounter = 0; // Render the form\n\n form = core_1.Components.Form({\n el: props.el,\n className: props.className,\n groupClassName: props.groupClassName,\n rowClassName: props.rowClassName,\n onControlRendered: function onControlRendered(control) {\n // See if all of the controls have been rendered\n if (++ctrlCounter == rows.length) {\n // See if an event exists\n if (props.onFormRendered) {\n // Execute the form rendered event in another thread\n setTimeout(function () {\n props.onFormRendered(form);\n }, 10);\n }\n } // Return the control rendered event\n\n\n return props.onControlRendered ? props.onControlRendered(control, props.info.fields[control.props.name]) : null;\n },\n onControlRendering: function onControlRendering(control) {\n return props.onControlRendering ? props.onControlRendering(control, props.info.fields[control.name]) : null;\n },\n rows: props.template || rows\n }); // Execute the assign to event\n\n props.assignTo ? props.assignTo(form) : null; // Return the form informaiton\n\n return {\n get el() {\n return form ? form.el : null;\n }\n\n };\n}; // Render the edit form\n\n\nexports.ListForm.renderEditForm = function (props) {\n var customControls = [];\n var mapper = {};\n var rows = [];\n var value = {};\n var attachments = {\n \"delete\": [],\n \"new\": []\n }; // Method to add a refresh alert\n\n var addRefreshLink = function addRefreshLink() {\n // Ensure the link doesn't already exist\n if (props.el.querySelector(\".refresh-btn\")) {\n return;\n } // Create the refresh button\n\n\n var alert = core_1.Components.ButtonGroup({\n className: \"refresh-btn\",\n buttonType: core_1.Components.ButtonTypes.Danger,\n buttons: [{\n text: \"Refresh Form\",\n onClick: function onClick() {\n // Clear the element and reload the form\n props.el.innerHTML = \"\"; // Render the form\n\n exports.ListForm.renderEditForm(props);\n }\n }, {\n text: \"Refresh Page\",\n onClick: function onClick() {\n // Refresh the page\n document.location.href = document.location.href;\n }\n }]\n }); // Add the element at the top\n\n props.el.insertBefore(alert.el, props.el.children[0]);\n }; // Method to remove the attachments\n\n\n var removeAttachments = function removeAttachments(info) {\n // Return a promise\n return new Promise(function (resolve, reject) {\n // Ensure attachments exists\n if (attachments[\"delete\"].length == 0) {\n resolve();\n return;\n } // Get the web\n\n\n props.info.list.ParentWeb().execute(function (web) {\n // Parse the attachments\n gd_sprest_1.Helper.Executor(attachments[\"delete\"], function (attachment) {\n // Get the attachment file\n web.getFileByServerRelativeUrl(attachment.ServerRelativeUrl)[\"delete\"]().execute(); // Parse the attachments\n\n for (var i = 0; i < props.info.attachments.length; i++) {\n // See if this is the target attachment\n if (props.info.attachments[i].ServerRelativeUrl == attachment.ServerRelativeUrl) {\n // Remove this item\n props.info.attachments.splice(i, 1);\n break;\n }\n }\n }).then(function () {\n // Wait for the files to be deleted\n web.done(function () {\n // Clear the attachments\n attachments[\"delete\"] = []; // Resolve the promise\n\n resolve();\n });\n });\n });\n });\n }; // Method to save the attachments\n\n\n var saveAttachments = function saveAttachments(info) {\n // Return a promise\n return new Promise(function (resolve, reject) {\n // Ensure attachments exists\n if (attachments[\"new\"].length == 0) {\n resolve();\n return;\n } // Parse the attachments\n\n\n gd_sprest_1.Helper.Executor(attachments[\"new\"], function (attachment) {\n // Get the item's attachments\n props.info.list.Items(info.item.Id).AttachmentFiles() // Add the file\n .add(attachment.name, attachment.data) // Execute the request\n .execute(function (attachment) {\n // Ensure attachments exist\n info.attachments = info.attachments || []; // Append the attachment\n\n info.attachments.push(attachment);\n });\n }).then(function () {\n // Wait for the files to upload\n props.info.list.done(function () {\n // Clear the attachments\n attachments[\"new\"] = []; // Resolve the promise\n\n resolve();\n });\n });\n });\n }; // Render a loading message\n\n\n var progress = core_1.Components.Progress({\n el: props.el,\n isAnimated: true,\n isStriped: true,\n label: \"Loading the Form\",\n size: 100\n }); // See if we are rendering attachments\n\n if (props.info.attachments) {\n // Set a default field\n // This will help w/ the onControlRendering/ed events to not have a null value for this parameter\n props.info.fields[\"Attachments\"] = {}; // Render the attachments\n\n rows.push({\n columns: [{\n control: {\n id: \"ListFormAttachments\",\n label: \"Attachments\",\n name: \"Attachments\",\n onControlRendered: function onControlRendered(control) {\n // Render a toolbar\n var toolbar = core_1.Components.Toolbar({\n el: control.el,\n items: [{\n buttons: [{\n className: \"upload-btn me-1\",\n isSmall: true,\n text: \"Upload\",\n type: core_1.Components.ButtonTypes.Secondary,\n onClick: function onClick(btn, ev) {\n var elUpload = ev.currentTarget; // Display an upload dialog\n\n gd_sprest_1.Helper.ListForm.showFileDialog().then(function (fileInfo) {\n // Get the buttons and remove any duplicates\n var buttons = elUpload.parentElement.querySelectorAll(\".btn\");\n\n for (var i = 0; i < buttons.length; i++) {\n var button = buttons[i]; // See if this is the associated button\n\n if (button.innerText.replace(/X$/, '') == fileInfo.name) {\n // Get the badge\n var badge = button.querySelector(\".badge\");\n\n if (badge) {\n // Remove the button\n badge.click();\n }\n\n break;\n }\n } // Save the file information\n\n\n attachments[\"new\"].push(fileInfo); // Append the attachment\n\n elUpload.parentElement.appendChild(core_1.Components.Popover({\n isDismissible: true,\n type: core_1.Components.PopoverPlacements.Bottom,\n btnProps: {\n className: \"me-1 file-attachment\",\n isSmall: true,\n text: fileInfo.name\n },\n options: {\n content: core_1.Components.Button({\n data: fileInfo,\n isSmall: true,\n text: \"Remove\",\n type: core_1.Components.ButtonTypes.Danger,\n onClick: function onClick(btn, ev) {\n var fileName = btn.data.name; // Parse the array\n\n for (var i = 0; i < attachments[\"new\"].length; i++) {\n // See if this is the target attachment\n if (attachments[\"new\"][i].name == fileName) {\n // Remove this attachment\n attachments[\"new\"].splice(i, 1);\n break;\n }\n } // Get the files\n\n\n var files = btnGroup.querySelectorAll(\".btn.file-attachment\");\n\n for (var i = 0; i < files.length; i++) {\n var file = files[i]; // See if this is the target button\n\n if (file.innerText == fileName) {\n // Remove this popover\n file.parentElement.removeChild(file);\n break;\n }\n }\n }\n }).el\n }\n }).el);\n });\n }\n }]\n }]\n }); // Get the button group\n\n var btnGroup = toolbar.el.querySelector(\".btn-group\");\n\n if (btnGroup) {\n // Parse the attachments\n for (var i = 0; i < props.info.attachments.length; i++) {\n var attachment = props.info.attachments[i]; // Add the attachment\n\n btnGroup.appendChild(core_1.Components.Popover({\n isDismissible: true,\n type: core_1.Components.PopoverPlacements.Bottom,\n btnProps: {\n className: \"me-1 file-attachment\",\n isSmall: true,\n text: attachment.FileName\n },\n options: {\n content: core_1.Components.Button({\n data: attachment,\n isSmall: true,\n text: \"Remove\",\n type: core_1.Components.ButtonTypes.Danger,\n onClick: function onClick(btn, ev) {\n var attachment = btn.data; // Add this file for deletion\n\n attachments[\"delete\"].push(attachment); // Get the files\n\n var files = btnGroup.querySelectorAll(\".btn.file-attachment\");\n\n for (var i_1 = 0; i_1 < files.length; i_1++) {\n var file = files[i_1]; // See if this is the target button\n\n if (file.innerText == attachment.FileName) {\n // Remove this popover\n file.parentElement.removeChild(file);\n break;\n }\n }\n }\n }).el\n }\n }).el);\n }\n }\n }\n }\n }]\n });\n } // Parse the fields to render\n\n\n var fieldNames = getFieldsToRender(props);\n\n var _loop_1 = function _loop_1(i) {\n var fieldName = fieldNames[i];\n var field = props.info.fields[fieldName]; // Ensure the field exists\n\n if (field == null) {\n // Log\n console.error(\"[List Form] Field '\" + fieldName + \"' does not exist. Check the list or query.\");\n return \"continue\";\n } // Skip the attachment field\n\n\n if (fieldName == \"Attachments\") {\n return \"continue\";\n } // See if the item exists\n\n\n value[fieldName] = null;\n\n if (props.info.item) {\n // Set the value\n value[fieldName] = props.info.item[fieldName]; // See if this is a lookup or user field\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Lookup || field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.User) {\n // Update the value\n value[fieldName] = value[fieldName + \"Id\"] || (value[fieldName] ? value[fieldName].Id : null) || value[fieldName];\n } // See if this is a file leaf ref\n\n\n if (fieldName == \"FileLeafRef\") {\n // Update the value\n value[fieldName] = value[fieldName] || props.info.item.Title;\n }\n } // Determine the control mode\n\n\n var controlMode = props.controlMode || (props.info.item ? gd_sprest_1.SPTypes.ControlMode.Edit : gd_sprest_1.SPTypes.ControlMode.New); // See if this is an edit form and we are hiding this field\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.Edit && field.SchemaXml.indexOf('ShowInEditForm=\"FALSE\"') > 0) {\n return \"continue\";\n } // See if this is a new form and we are hiding this field\n\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.New && field.SchemaXml.indexOf('ShowInNewForm=\"FALSE\"') > 0) {\n return \"continue\";\n } // See if thi sis a new form and this is an associated lookup field\n\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.New && field.IsDependentLookup) {\n return \"continue\";\n } // See if this is a display form and we are hiding this field\n\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.Display && field.SchemaXml.indexOf('ShowInDisplayForm=\"FALSE\"') > 0) {\n return \"continue\";\n } // See if this is a read-only field\n\n\n if (field.ReadOnlyField) {\n // Do not render in the new form\n if (props.controlMode == gd_sprest_1.SPTypes.ControlMode.New) {\n return \"continue\";\n }\n } // Do not render a hidden taxonomy field\n\n\n if (field.Hidden && field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Note && /_0$/.test(field.Title)) {\n return \"continue\";\n } // See if this is an invalid field type\n\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Invalid) {\n // Ensure it's not a taxonomy field\n if (!/^TaxonomyFieldType/.test(field.TypeAsString)) {\n return \"continue\";\n }\n } // Else, see if this is a calculated column\n else if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Calculated) {\n // Do not render in the new/edit forms\n if (props.controlMode != gd_sprest_1.SPTypes.ControlMode.Display) {\n return \"continue\";\n }\n } // See if this is a lookup field\n\n\n var lookupFilter = null;\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Lookup) {\n // Call the filter event\n lookupFilter = props.onFilterLookupField ? props.onFilterLookupField(field) : null;\n } // Create the control\n\n\n var fieldControl = (0, field_1.Field)({\n controlMode: props.controlMode,\n field: field,\n listInfo: props.info,\n value: value[fieldName],\n onControlRendering: function onControlRendering(control, field) {\n // Set the lookup field filter\n lookupFilter ? control.lookupFilter = lookupFilter : null;\n },\n onControlRendered: function onControlRendered(control, field) {\n // Update the mapper\n mapper[field.InternalName].control = control;\n },\n onValidate: props.onValidate,\n onError: function onError(msg) {\n // Add the refresh link\n addRefreshLink(); // Call the event\n\n props.onError ? props.onError(msg) : null;\n }\n }); // Update the mapper\n\n mapper[fieldName] = fieldControl; // Add the row\n\n rows.push({\n columns: [{\n control: fieldControl.controlProps\n }]\n });\n };\n\n for (var i = 0; i < fieldNames.length; i++) {\n _loop_1(i);\n } // See if there is a template\n\n\n if (props.template) {\n var updateControl = function updateControl(refControl) {\n // Get the control from the mapper\n var control = refControl && mapper[refControl.name] ? mapper[refControl.name].controlProps : null; // Ensure the controls exists\n\n if (control && refControl) {\n // Parse the control keys\n for (var key in control) {\n // Skip if a value is already defined\n if (refControl[key]) {\n continue;\n } // Update the property\n\n\n refControl[key] = control[key];\n }\n }\n }; // Parse the template\n\n\n for (var i = 0; i < props.template.length; i++) {\n var row = props.template[i]; // Parse the columns if there are columns\n\n var columns = row.columns || [];\n\n for (var j = 0; j < columns.length; j++) {\n var column = columns[j]; // Update the control\n\n updateControl(column.control);\n }\n }\n } // Remove the progress bar\n\n\n progress.el.parentElement ? progress.el.parentElement.removeChild(progress.el) : null; // Counter for each control\n\n var ctrlCounter = 0; // Render the form\n\n var form = core_1.Components.Form({\n el: props.el,\n className: props.className,\n groupClassName: props.groupClassName,\n rowClassName: props.rowClassName,\n onControlRendered: function onControlRendered(control) {\n // See if all of the controls have been rendered\n if (++ctrlCounter == rows.length) {\n // See if an event exists\n if (props.onFormRendered) {\n // Execute the form rendered event in another thread\n setTimeout(function () {\n props.onFormRendered(form);\n }, 10);\n }\n } // Return the event\n\n\n return props.onControlRendered ? props.onControlRendered(control, props.info.fields[control.props.name]) : null;\n },\n onControlRendering: function onControlRendering(control) {\n var updateReadOnly = function updateReadOnly(control) {\n // See if this control is readonly\n if (control.isReadonly) {\n // Get the control display properties\n var dispControl = renderDisplay(control.name, props);\n\n if (dispControl) {\n // Update the properties\n control.data = dispControl.data;\n control.label = dispControl.label;\n control.showTime = dispControl.showTime;\n control.type = dispControl.type;\n control.value = dispControl.value;\n }\n }\n }; // Execute the rendering event\n\n\n var field = props.info.fields[control.name] || {};\n var returnVal = props.onControlRendering ? props.onControlRendering(control, field) : null;\n\n if (returnVal && returnVal.then) {\n // Wait for the event to complete\n returnVal.then(function (ctrlProps) {\n // Update the properties\n updateReadOnly(ctrlProps || control);\n });\n } else {\n // Update the properties\n updateReadOnly(control);\n }\n },\n rows: props.template || rows,\n value: value\n }); // Method to get the values\n\n var getValues = function getValues() {\n var values = {}; // See if the content type was set\n\n if (props.info.contentType) {\n // Set the content type id\n values[\"ContentTypeId\"] = props.info.contentType.Id.StringValue;\n } // Parse the fields\n\n\n for (var fieldName in props.info.fields) {\n // Get the form field and skip readonly fields\n var formField = mapper[fieldName];\n\n if (formField == null || formField.controlProps.isReadonly) {\n continue;\n } // Get the field value\n\n\n var fieldValue = formField.getValue(); // Set the item value\n\n values[fieldValue.name] = fieldValue.value; // See if this is the file leaf ref\n\n if (fieldValue.name == \"FileLeafRef\") {\n // Update the 'Title'\n values[\"Title\"] = values[\"Title\"] || values[fieldValue.name];\n }\n } // Return the form values\n\n\n return values;\n }; // Create the form object\n\n\n var formObj = {\n appendControls: function appendControls(controls) {\n // Append the controls\n form.appendControls(controls); // Wait for the controls to be loaded\n\n setTimeout(function () {\n // Parse the new controls\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i].name ? form.getControl(controls[i].name) : null;\n\n if (control) {\n // Append the control\n customControls.push(control);\n }\n }\n }, 10);\n },\n appendRows: function appendRows(rows) {\n // Append the controls\n form.appendRows(rows); // Wait for the controls to be loaded\n\n setTimeout(function () {\n // Parse the rows\n for (var i = 0; i < rows.length; i++) {\n // Parse the columns\n var columns = rows[i].columns;\n\n for (var j = 0; j < columns.length; j++) {\n // Get the control\n var control = columns[j].control && columns[j].control.name ? form.getControl(columns[j].control.name) : null;\n\n if (control) {\n // Append the control\n customControls.push(control);\n }\n }\n }\n }, 10);\n },\n el: form.el,\n getControl: function getControl(fieldName) {\n // See if it's in the mapper\n if (mapper[fieldName]) {\n // Return the control\n return mapper[fieldName].control;\n } // Parse the custom controls\n\n\n for (var i = 0; i < customControls.length; i++) {\n var control = customControls[i]; // See if this is the target control\n\n if (control.props.name == fieldName) {\n // Return the control\n return control;\n }\n } // Not found\n\n\n return null;\n },\n getItem: function getItem() {\n return props.info.item;\n },\n getValues: getValues,\n insertControl: function insertControl(idx, control) {\n // Append the controls\n form.insertControl(idx, control); // Wait for the controls to be loaded\n\n setTimeout(function () {\n var newControl = control.name ? form.getControl(control.name) : null;\n\n if (newControl) {\n // Append the control\n customControls.push(newControl);\n }\n }, 10);\n },\n isValid: function isValid() {\n var isValid = true; // Parse the fields\n\n for (var fieldName in props.info.fields) {\n // Skip readonly fields\n var formField = mapper[fieldName];\n\n if (formField == null || formField.controlProps.isReadonly) {\n continue;\n } // Validate the form field and update the status flag\n\n\n var controlIsValid = formField.isValid();\n isValid = isValid && controlIsValid;\n } // Parse the custom controls\n\n\n for (var i = 0; i < customControls.length; i++) {\n // Validate the form field and update the status flag\n var controlIsValid = customControls[i].isValid;\n isValid = isValid && controlIsValid;\n } // Return the flag\n\n\n return isValid;\n },\n save: function save(customValues) {\n if (customValues === void 0) {\n customValues = {};\n }\n\n var onSaving = function onSaving(values) {\n return new Promise(function (resolve) {\n // See if a save event exists\n var returnVal = props.onSaving ? props.onSaving(values) : null;\n\n if (returnVal && returnVal.then) {\n // Wait for the promise to complete\n returnVal.then(function (newValues) {\n // Resolve the promise\n resolve(newValues || values);\n });\n } else {\n // Resolve the promise\n resolve(values);\n }\n });\n }; // Return a promise\n\n\n return new Promise(function (resolve, reject) {\n // Call the saving event\n onSaving(__assign(__assign({}, getValues()), customValues)).then(function (values) {\n // Update the item\n exports.ListForm.saveItem(props.info, values).then(function (info) {\n // Remove the attachments\n removeAttachments(info).then(function () {\n // Save the attachments\n saveAttachments(info).then(function () {\n // Update the info\n props.info = info; // Resolve the promise\n\n resolve(props.info.item);\n });\n });\n }, reject);\n });\n });\n }\n }; // Execute the assign to event\n\n props.assignTo ? props.assignTo(formObj) : null; // Return the form\n\n return formObj;\n};\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/listForm/index.js?");
701
+ eval("\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.ListForm = void 0;\n\nvar gd_sprest_1 = __webpack_require__(/*! gd-sprest */ \"./node_modules/.pnpm/gd-sprest@7.0.8/node_modules/gd-sprest/build/index.js\");\n\nvar core_1 = __webpack_require__(/*! ../core */ \"./build/components/core.js\");\n\nvar datetime_1 = __webpack_require__(/*! ../datetime */ \"./build/components/datetime/index.js\");\n\nvar field_1 = __webpack_require__(/*! ../field */ \"./build/components/field/index.js\");\n\nvar richTextBox_1 = __webpack_require__(/*! ../richTextBox */ \"./build/components/richTextBox/index.js\"); // Extend the list form\n\n\nexports.ListForm = gd_sprest_1.Helper.ListForm; // Method to get the fields to render\n\nvar getFieldsToRender = function getFieldsToRender(props) {\n var fieldNames = []; // See if the \"include\" fields property is defined\n\n if (props.includeFields) {\n // Set the field names\n fieldNames = props.includeFields;\n } else {\n // Parse the fields\n for (var fieldName in props.info.fields) {\n // See if the \"exclude\" property is set\n if (props.excludeFields) {\n var renderFl = true; // Parse the fields\n\n for (var i = 0; i < props.excludeFields.length; i++) {\n // See if we are excluding this field\n if (props.excludeFields[i] == fieldName) {\n // Set the flag\n renderFl = false;\n break;\n }\n } // Skip this field, if we are not rendering it\n\n\n if (!renderFl) {\n continue;\n }\n } // Add the field name\n\n\n fieldNames.push(fieldName);\n }\n } // Return the field names\n\n\n return fieldNames;\n}; // Method to render the display control\n\n\nvar renderDisplay = function renderDisplay(fieldName, props) {\n var control = null;\n var field = props.info.fields[fieldName];\n var isRichText = field.RichText;\n var value = props.info.fieldValuesAsText[fieldName] || \"\";\n var html = props.info.fieldValuesAsHtml[fieldName] || props.info.fieldValuesAsHtml[fieldName.replace(/\\_/g, \"_x005f_\")] || \"\"; // Ensure the field exists\n\n if (field == null) {\n // Log\n console.warn(\"[List Form] Field '\" + fieldName + \"' does not exist. Check the list or query.\");\n return control;\n } // See if we are hiding the field\n\n\n if (field.SchemaXml.indexOf('ShowInDisplayForm=\"FALSE\"') > 0) {\n return control;\n } // See if this is a note field\n\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Note) {\n // Update the html\n html = html.replace(/\\r?\\n/g, '<br />');\n } // Else, see if this is a user field\n else if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.User) {\n // See if this is a multi-user selection\n if (field.AllowMultipleValues) {\n var userNames = []; // Parse the users\n\n var users = (props.info.item[fieldName] ? props.info.item[fieldName].results : null) || [];\n\n for (var j = 0; j < users.length; j++) {\n // Append the user name\n userNames.push(users[j].Title);\n } // Set the html value\n\n\n html = userNames.join('<br />\\n');\n } else {\n // Extract the text only for single selections\n var elUser = document.createElement(\"div\");\n elUser.innerHTML = html;\n html = elUser.innerText;\n }\n } // Else, see if this is a choice field\n else if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Choice || field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.MultiChoice) {\n // Update the html\n html = value;\n } // Set the control\n\n\n control = {\n data: html,\n description: field.Description,\n isDisabled: true,\n label: field.Title,\n name: field.InternalName,\n type: core_1.Components.FormControlTypes.TextField,\n value: html\n }; // Update the type, based on the field\n\n switch (field.FieldTypeKind) {\n case gd_sprest_1.SPTypes.FieldType.DateTime:\n // Set the time flag\n control.showTime = field.DisplayFormat == gd_sprest_1.SPTypes.DateFormat.DateTime ? true : false; // Set the type\n\n control.type = datetime_1.DateTimeControlType;\n break;\n\n case gd_sprest_1.SPTypes.FieldType.Lookup:\n // Ensure a value exists\n if (html) {\n // Create an element to store the html\n var elLookup = document.createElement(\"div\");\n elLookup.innerHTML = html; // Update the value to be text\n\n html = elLookup.innerText;\n control.data = html;\n control.value = html;\n }\n\n break;\n\n case gd_sprest_1.SPTypes.FieldType.Note:\n // See if this is a rich text field\n if (isRichText) {\n // Set the properties\n control.toolbarType = richTextBox_1.RichTextBoxTypes.None;\n control.type = richTextBox_1.RichTextBoxControlType;\n } else {\n // Set the type\n control.type = core_1.Components.FormControlTypes.TextArea;\n }\n\n break;\n\n case gd_sprest_1.SPTypes.FieldType.URL:\n // Set the value\n var urlValue = props.info.item[fieldName];\n html = urlValue ? urlValue.Url : html;\n control.value = html;\n break;\n\n case gd_sprest_1.SPTypes.FieldType.User:\n // Set the type\n control.type = field.AllowMultipleValues ? core_1.Components.FormControlTypes.TextArea : control.type;\n break;\n } // Detect html\n\n\n if (/<*>/g.test(html)) {\n // Ensure this isn't a rich text field\n if (!isRichText) {\n // Update the control to be read-only\n control.type = core_1.Components.FormControlTypes.Readonly; // Set the rendered event\n\n control.onControlRendered = isRichText ? null : function (control) {\n // Get the target element\n var elTarget = control.el.querySelector(\"input\") || control.el; // Override the html rendered\n\n elTarget.innerHTML = control.props.data;\n };\n }\n } // Else, detect xml\n else if (/&lt;/g.test(html)) {\n // Update the value\n control.value = html.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/&quot;/g, '\"');\n } // Return the control\n\n\n return control;\n}; // Method to render a display form for an item\n\n\nexports.ListForm.renderDisplayForm = function (props) {\n var form = null; // Render a loading message\n\n var progress = core_1.Components.Progress({\n el: props.el,\n isAnimated: true,\n isStriped: true,\n label: \"Loading the Form\",\n size: 100\n });\n var mapper = {};\n var rows = []; // See if we are rendering attachments\n\n if (props.info.attachments) {\n // Render the attachments\n rows.push({\n columns: [{\n control: {\n id: \"ListFormAttachments\",\n label: \"Attachments\",\n name: \"Attachments\",\n onControlRendered: function onControlRendered(control) {\n var items = []; // Parse the attachments\n\n for (var i = 0; i < props.info.attachments.length; i++) {\n var attachment = props.info.attachments[i]; // Add the item\n\n items.push({\n buttons: [{\n className: \"me-1\",\n href: attachment.ServerRelativeUrl,\n isSmall: true,\n text: attachment.FileName\n }]\n });\n } // Render a toolbar\n\n\n core_1.Components.Toolbar({\n el: control.el,\n items: items\n });\n }\n }\n }]\n });\n } // Parse the fields to render\n\n\n var fieldNames = getFieldsToRender(props);\n\n for (var i = 0; i < fieldNames.length; i++) {\n var fieldName = fieldNames[i]; // Generate the control\n\n var control = renderDisplay(fieldName, props);\n\n if (control) {\n // Update the mapper\n mapper[fieldName] = control; // Add the row\n\n rows.push({\n columns: [{\n control: control\n }]\n });\n }\n } // See if there is a template\n\n\n if (props.template) {\n var updateControl = function updateControl(refControl) {\n // Get the control from the mapper\n var control = refControl ? mapper[refControl.name] : null; // Ensure the controls exists\n\n if (control && refControl) {\n // Parse the control keys\n for (var key in control) {\n // Skip if a value is already defined\n if (refControl[key]) {\n continue;\n } // Update the property\n\n\n refControl[key] = control[key];\n }\n }\n }; // Parse the template\n\n\n for (var i = 0; i < props.template.length; i++) {\n var row = props.template[i]; // Parse the columns if there are columns\n\n var columns = row.columns || [];\n\n for (var j = 0; j < columns.length; j++) {\n var column = columns[j]; // Update the control\n\n updateControl(column.control);\n }\n }\n } // Remove the progress bar\n\n\n progress.el.parentElement ? progress.el.parentElement.removeChild(progress.el) : null; // Counter for each control\n\n var ctrlCounter = 0; // Render the form\n\n form = core_1.Components.Form({\n el: props.el,\n className: props.className,\n groupClassName: props.groupClassName,\n rowClassName: props.rowClassName,\n onControlRendered: function onControlRendered(control) {\n // See if all of the controls have been rendered\n if (++ctrlCounter == rows.length) {\n // See if an event exists\n if (props.onFormRendered) {\n // Execute the form rendered event in another thread\n setTimeout(function () {\n props.onFormRendered(form);\n }, 10);\n }\n } // Return the control rendered event\n\n\n return props.onControlRendered ? props.onControlRendered(control, props.info.fields[control.props.name]) : null;\n },\n onControlRendering: function onControlRendering(control) {\n return props.onControlRendering ? props.onControlRendering(control, props.info.fields[control.name]) : null;\n },\n rows: props.template || rows\n }); // Execute the assign to event\n\n props.assignTo ? props.assignTo(form) : null; // Return the form informaiton\n\n return {\n get el() {\n return form ? form.el : null;\n }\n\n };\n}; // Render the edit form\n\n\nexports.ListForm.renderEditForm = function (props) {\n var customControls = [];\n var mapper = {};\n var rows = [];\n var value = {};\n var attachments = {\n \"delete\": [],\n \"new\": []\n }; // Method to add a refresh alert\n\n var addRefreshLink = function addRefreshLink() {\n // Ensure the link doesn't already exist\n if (props.el.querySelector(\".refresh-btn\")) {\n return;\n } // Create the refresh button\n\n\n var alert = core_1.Components.ButtonGroup({\n className: \"refresh-btn\",\n buttonType: core_1.Components.ButtonTypes.Danger,\n buttons: [{\n text: \"Refresh Form\",\n onClick: function onClick() {\n // Clear the element and reload the form\n props.el.innerHTML = \"\"; // Render the form\n\n exports.ListForm.renderEditForm(props);\n }\n }, {\n text: \"Refresh Page\",\n onClick: function onClick() {\n // Refresh the page\n document.location.href = document.location.href;\n }\n }]\n }); // Add the element at the top\n\n props.el.insertBefore(alert.el, props.el.children[0]);\n }; // Method to remove the attachments\n\n\n var removeAttachments = function removeAttachments(info) {\n // Return a promise\n return new Promise(function (resolve, reject) {\n // Ensure attachments exists\n if (attachments[\"delete\"].length == 0) {\n resolve();\n return;\n } // Get the web\n\n\n props.info.list.ParentWeb().execute(function (web) {\n // Parse the attachments\n gd_sprest_1.Helper.Executor(attachments[\"delete\"], function (attachment) {\n // Get the attachment file\n web.getFileByServerRelativeUrl(attachment.ServerRelativeUrl)[\"delete\"]().execute(); // Parse the attachments\n\n for (var i = 0; i < props.info.attachments.length; i++) {\n // See if this is the target attachment\n if (props.info.attachments[i].ServerRelativeUrl == attachment.ServerRelativeUrl) {\n // Remove this item\n props.info.attachments.splice(i, 1);\n break;\n }\n }\n }).then(function () {\n // Wait for the files to be deleted\n web.done(function () {\n // Clear the attachments\n attachments[\"delete\"] = []; // Resolve the promise\n\n resolve();\n });\n });\n });\n });\n }; // Method to save the attachments\n\n\n var saveAttachments = function saveAttachments(info) {\n // Return a promise\n return new Promise(function (resolve, reject) {\n // Ensure attachments exists\n if (attachments[\"new\"].length == 0) {\n resolve();\n return;\n } // Parse the attachments\n\n\n gd_sprest_1.Helper.Executor(attachments[\"new\"], function (attachment) {\n // Get the item's attachments\n props.info.list.Items(info.item.Id).AttachmentFiles() // Add the file\n .add(attachment.name, attachment.data) // Execute the request\n .execute(function (attachment) {\n // Ensure attachments exist\n info.attachments = info.attachments || []; // Append the attachment\n\n info.attachments.push(attachment);\n });\n }).then(function () {\n // Wait for the files to upload\n props.info.list.done(function () {\n // Clear the attachments\n attachments[\"new\"] = []; // Resolve the promise\n\n resolve();\n });\n });\n });\n }; // Render a loading message\n\n\n var progress = core_1.Components.Progress({\n el: props.el,\n isAnimated: true,\n isStriped: true,\n label: \"Loading the Form\",\n size: 100\n }); // See if we are rendering attachments\n\n if (props.info.attachments) {\n // Set a default field\n // This will help w/ the onControlRendering/ed events to not have a null value for this parameter\n props.info.fields[\"Attachments\"] = {}; // Render the attachments\n\n rows.push({\n columns: [{\n control: {\n id: \"ListFormAttachments\",\n label: \"Attachments\",\n name: \"Attachments\",\n onControlRendered: function onControlRendered(control) {\n // Render a toolbar\n var toolbar = core_1.Components.Toolbar({\n el: control.el,\n items: [{\n buttons: [{\n className: \"upload-btn me-1\",\n isSmall: true,\n text: \"Upload\",\n type: core_1.Components.ButtonTypes.Secondary,\n onClick: function onClick(btn, ev) {\n var elUpload = ev.currentTarget; // Display an upload dialog\n\n gd_sprest_1.Helper.ListForm.showFileDialog().then(function (fileInfo) {\n // Get the buttons and remove any duplicates\n var buttons = elUpload.parentElement.querySelectorAll(\".btn\");\n\n for (var i = 0; i < buttons.length; i++) {\n var button = buttons[i]; // See if this is the associated button\n\n if (button.innerText.replace(/X$/, '') == fileInfo.name) {\n // Get the badge\n var badge = button.querySelector(\".badge\");\n\n if (badge) {\n // Remove the button\n badge.click();\n }\n\n break;\n }\n } // Save the file information\n\n\n attachments[\"new\"].push(fileInfo); // Append the attachment\n\n elUpload.parentElement.appendChild(core_1.Components.Popover({\n isDismissible: true,\n type: core_1.Components.PopoverPlacements.Bottom,\n btnProps: {\n className: \"me-1 file-attachment\",\n isSmall: true,\n text: fileInfo.name\n },\n options: {\n content: core_1.Components.Button({\n data: fileInfo,\n isSmall: true,\n text: \"Remove\",\n type: core_1.Components.ButtonTypes.Danger,\n onClick: function onClick(btn, ev) {\n var fileName = btn.data.name; // Parse the array\n\n for (var i = 0; i < attachments[\"new\"].length; i++) {\n // See if this is the target attachment\n if (attachments[\"new\"][i].name == fileName) {\n // Remove this attachment\n attachments[\"new\"].splice(i, 1);\n break;\n }\n } // Get the files\n\n\n var files = btnGroup.querySelectorAll(\".btn.file-attachment\");\n\n for (var i = 0; i < files.length; i++) {\n var file = files[i]; // See if this is the target button\n\n if (file.innerText == fileName) {\n // Remove this popover\n file.parentElement.removeChild(file);\n break;\n }\n }\n }\n }).el\n }\n }).el);\n });\n }\n }]\n }]\n }); // Get the button group\n\n var btnGroup = toolbar.el.querySelector(\".btn-group\");\n\n if (btnGroup) {\n // Parse the attachments\n for (var i = 0; i < props.info.attachments.length; i++) {\n var attachment = props.info.attachments[i]; // Add the attachment\n\n btnGroup.appendChild(core_1.Components.Popover({\n isDismissible: true,\n type: core_1.Components.PopoverPlacements.Bottom,\n btnProps: {\n className: \"me-1 file-attachment\",\n isSmall: true,\n text: attachment.FileName\n },\n options: {\n content: core_1.Components.Button({\n data: attachment,\n isSmall: true,\n text: \"Remove\",\n type: core_1.Components.ButtonTypes.Danger,\n onClick: function onClick(btn, ev) {\n var attachment = btn.data; // Add this file for deletion\n\n attachments[\"delete\"].push(attachment); // Get the files\n\n var files = btnGroup.querySelectorAll(\".btn.file-attachment\");\n\n for (var i_1 = 0; i_1 < files.length; i_1++) {\n var file = files[i_1]; // See if this is the target button\n\n if (file.innerText == attachment.FileName) {\n // Remove this popover\n file.parentElement.removeChild(file);\n break;\n }\n }\n }\n }).el\n }\n }).el);\n }\n }\n }\n }\n }]\n });\n } // Parse the fields to render\n\n\n var fieldNames = getFieldsToRender(props);\n\n var _loop_1 = function _loop_1(i) {\n var fieldName = fieldNames[i];\n var field = props.info.fields[fieldName]; // Ensure the field exists\n\n if (field == null) {\n // Log\n console.error(\"[List Form] Field '\" + fieldName + \"' does not exist. Check the list or query.\");\n return \"continue\";\n } // Skip the attachment field\n\n\n if (fieldName == \"Attachments\") {\n return \"continue\";\n } // See if the item exists\n\n\n value[fieldName] = null;\n\n if (props.info.item) {\n // Set the value\n value[fieldName] = props.info.item[fieldName]; // See if this is a lookup or user field\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Lookup || field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.User) {\n // Update the value\n value[fieldName] = value[fieldName + \"Id\"] || (value[fieldName] ? value[fieldName].Id : null) || value[fieldName];\n } // See if this is a file leaf ref\n\n\n if (fieldName == \"FileLeafRef\") {\n // Update the value\n value[fieldName] = value[fieldName] || props.info.item.Title;\n }\n } // Determine the control mode\n\n\n var controlMode = props.controlMode || (props.info.item ? gd_sprest_1.SPTypes.ControlMode.Edit : gd_sprest_1.SPTypes.ControlMode.New); // See if this is an edit form and we are hiding this field\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.Edit && field.SchemaXml.indexOf('ShowInEditForm=\"FALSE\"') > 0) {\n return \"continue\";\n } // See if this is a new form and we are hiding this field\n\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.New && field.SchemaXml.indexOf('ShowInNewForm=\"FALSE\"') > 0) {\n return \"continue\";\n } // See if thi sis a new form and this is an associated lookup field\n\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.New && field.IsDependentLookup) {\n return \"continue\";\n } // See if this is a display form and we are hiding this field\n\n\n if (controlMode == gd_sprest_1.SPTypes.ControlMode.Display && field.SchemaXml.indexOf('ShowInDisplayForm=\"FALSE\"') > 0) {\n return \"continue\";\n } // See if this is a read-only field\n\n\n if (field.ReadOnlyField) {\n // Do not render in the new form\n if (props.controlMode == gd_sprest_1.SPTypes.ControlMode.New) {\n return \"continue\";\n }\n } // Do not render a hidden taxonomy field\n\n\n if (field.Hidden && field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Note && /_0$/.test(field.Title)) {\n return \"continue\";\n } // See if this is an invalid field type\n\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Invalid) {\n // Ensure it's not a taxonomy field\n if (!/^TaxonomyFieldType/.test(field.TypeAsString)) {\n return \"continue\";\n }\n } // Else, see if this is a calculated column\n else if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Calculated) {\n // Do not render in the new/edit forms\n if (props.controlMode != gd_sprest_1.SPTypes.ControlMode.Display) {\n return \"continue\";\n }\n } // See if this is a lookup field\n\n\n var lookupFilter = null;\n\n if (field.FieldTypeKind == gd_sprest_1.SPTypes.FieldType.Lookup) {\n // Call the filter event\n lookupFilter = props.onFilterLookupField ? props.onFilterLookupField(field) : null;\n } // Create the control\n\n\n var fieldControl = (0, field_1.Field)({\n controlMode: props.controlMode,\n field: field,\n listInfo: props.info,\n value: value[fieldName],\n onControlRendering: function onControlRendering(control, field) {\n // Set the lookup field filter\n lookupFilter ? control.lookupFilter = lookupFilter : null;\n },\n onControlRendered: function onControlRendered(control, field) {\n // Update the mapper\n mapper[field.InternalName].control = control;\n },\n onValidate: props.onValidate,\n onError: function onError(msg) {\n // Add the refresh link\n addRefreshLink(); // Call the event\n\n props.onError ? props.onError(msg) : null;\n }\n }); // Update the mapper\n\n mapper[fieldName] = fieldControl; // Add the row\n\n rows.push({\n columns: [{\n control: fieldControl.controlProps\n }]\n });\n };\n\n for (var i = 0; i < fieldNames.length; i++) {\n _loop_1(i);\n } // See if there is a template\n\n\n if (props.template) {\n var updateControl = function updateControl(refControl) {\n // Get the control from the mapper\n var control = refControl && mapper[refControl.name] ? mapper[refControl.name].controlProps : null; // Ensure the controls exists\n\n if (control && refControl) {\n // Parse the control keys\n for (var key in control) {\n // Skip if a value is already defined\n if (refControl[key]) {\n continue;\n } // Update the property\n\n\n refControl[key] = control[key];\n }\n }\n }; // Parse the template\n\n\n for (var i = 0; i < props.template.length; i++) {\n var row = props.template[i]; // Parse the columns if there are columns\n\n var columns = row.columns || [];\n\n for (var j = 0; j < columns.length; j++) {\n var column = columns[j]; // Update the control\n\n updateControl(column.control);\n }\n }\n } // Remove the progress bar\n\n\n progress.el.parentElement ? progress.el.parentElement.removeChild(progress.el) : null; // Counter for each control\n\n var ctrlCounter = 0; // Render the form\n\n var form = core_1.Components.Form({\n el: props.el,\n className: props.className,\n groupClassName: props.groupClassName,\n rowClassName: props.rowClassName,\n onControlRendered: function onControlRendered(control) {\n // See if all of the controls have been rendered\n if (++ctrlCounter == rows.length) {\n // See if an event exists\n if (props.onFormRendered) {\n // Execute the form rendered event in another thread\n setTimeout(function () {\n props.onFormRendered(form);\n }, 10);\n }\n } // Return the event\n\n\n return props.onControlRendered ? props.onControlRendered(control, props.info.fields[control.props.name]) : null;\n },\n onControlRendering: function onControlRendering(control) {\n var updateReadOnly = function updateReadOnly(control) {\n // See if this control is readonly\n if (control.isReadonly) {\n // Get the control display properties\n var dispControl = renderDisplay(control.name, props);\n\n if (dispControl) {\n // Update the properties\n control.data = dispControl.data;\n control.label = dispControl.label;\n control.showTime = dispControl.showTime;\n control.type = dispControl.type;\n control.value = dispControl.value;\n }\n }\n }; // Execute the rendering event\n\n\n var field = props.info.fields[control.name] || {};\n var returnVal = props.onControlRendering ? props.onControlRendering(control, field) : null;\n\n if (returnVal && returnVal.then) {\n // Wait for the event to complete\n returnVal.then(function (ctrlProps) {\n // Update the properties\n updateReadOnly(ctrlProps || control);\n });\n } else {\n // Update the properties\n updateReadOnly(control);\n }\n },\n rows: props.template || rows,\n value: value\n }); // Method to get the values\n\n var getValues = function getValues() {\n var values = {}; // See if the content type was set\n\n if (props.info.contentType) {\n // Set the content type id\n values[\"ContentTypeId\"] = props.info.contentType.Id.StringValue;\n } // Parse the fields\n\n\n for (var fieldName in props.info.fields) {\n // Get the form field and skip readonly fields\n var formField = mapper[fieldName];\n\n if (formField == null || formField.controlProps.isReadonly) {\n continue;\n } // Get the field value\n\n\n var fieldValue = formField.getValue(); // Set the item value\n\n values[fieldValue.name] = fieldValue.value; // See if this is the file leaf ref\n\n if (fieldValue.name == \"FileLeafRef\") {\n // Update the 'Title'\n values[\"Title\"] = values[\"Title\"] || values[fieldValue.name];\n }\n } // Return the form values\n\n\n return values;\n }; // Create the form object\n\n\n var formObj = {\n appendControls: function appendControls(controls) {\n // Append the controls\n form.appendControls(controls); // Wait for the controls to be loaded\n\n setTimeout(function () {\n // Parse the new controls\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i].name ? form.getControl(controls[i].name) : null;\n\n if (control) {\n // Append the control\n customControls.push(control);\n }\n }\n }, 10);\n },\n appendRows: function appendRows(rows) {\n // Append the controls\n form.appendRows(rows); // Wait for the controls to be loaded\n\n setTimeout(function () {\n // Parse the rows\n for (var i = 0; i < rows.length; i++) {\n // Parse the columns\n var columns = rows[i].columns;\n\n for (var j = 0; j < columns.length; j++) {\n // Get the control\n var control = columns[j].control && columns[j].control.name ? form.getControl(columns[j].control.name) : null;\n\n if (control) {\n // Append the control\n customControls.push(control);\n }\n }\n }\n }, 10);\n },\n el: form.el,\n getControl: function getControl(fieldName) {\n // See if it's in the mapper\n if (mapper[fieldName]) {\n // Return the control\n return mapper[fieldName].control;\n } // Parse the custom controls\n\n\n for (var i = 0; i < customControls.length; i++) {\n var control = customControls[i]; // See if this is the target control\n\n if (control.props.name == fieldName) {\n // Return the control\n return control;\n }\n } // Not found\n\n\n return null;\n },\n getItem: function getItem() {\n return props.info.item;\n },\n getValues: getValues,\n insertControl: function insertControl(idx, control) {\n // Append the controls\n form.insertControl(idx, control); // Wait for the controls to be loaded\n\n setTimeout(function () {\n var newControl = control.name ? form.getControl(control.name) : null;\n\n if (newControl) {\n // Append the control\n customControls.push(newControl);\n }\n }, 10);\n },\n isValid: function isValid() {\n var isValid = true; // Parse the fields\n\n for (var fieldName in props.info.fields) {\n // Skip readonly fields\n var formField = mapper[fieldName];\n\n if (formField == null || formField.controlProps.isReadonly) {\n continue;\n } // Validate the form field and update the status flag\n\n\n var controlIsValid = formField.isValid();\n isValid = isValid && controlIsValid;\n } // Parse the custom controls\n\n\n for (var i = 0; i < customControls.length; i++) {\n // Validate the form field and update the status flag\n var controlIsValid = customControls[i].isValid;\n isValid = isValid && controlIsValid;\n } // Return the flag\n\n\n return isValid;\n },\n save: function save(customValues) {\n if (customValues === void 0) {\n customValues = {};\n }\n\n var onSaving = function onSaving(values) {\n return new Promise(function (resolve) {\n // See if a save event exists\n var returnVal = props.onSaving ? props.onSaving(values) : null;\n\n if (returnVal && returnVal.then) {\n // Wait for the promise to complete\n returnVal.then(function (newValues) {\n // Resolve the promise\n resolve(newValues || values);\n });\n } else {\n // Resolve the promise\n resolve(values);\n }\n });\n }; // Return a promise\n\n\n return new Promise(function (resolve, reject) {\n // Call the saving event\n onSaving(__assign(__assign({}, getValues()), customValues)).then(function (values) {\n // Update the item\n exports.ListForm.saveItem(props.info, values).then(function (info) {\n // Remove the attachments\n removeAttachments(info).then(function () {\n // Save the attachments\n saveAttachments(info).then(function () {\n // Update the info\n props.info = info; // Resolve the promise\n\n resolve(props.info.item);\n });\n });\n }, reject);\n });\n });\n }\n }; // Execute the assign to event\n\n props.assignTo ? props.assignTo(formObj) : null; // Return the form\n\n return formObj;\n};\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/listForm/index.js?");
702
702
 
703
703
  /***/ }),
704
704
 
@@ -720,7 +720,7 @@ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof =
720
720
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
721
721
 
722
722
  "use strict";
723
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.RichTextBoxControlType = exports.RichTextBox = exports.RichTextBoxTypes = void 0;\n\nvar gd_bs_1 = __webpack_require__(/*! gd-bs */ \"./node_modules/.pnpm/gd-bs@5.7.7/node_modules/gd-bs/build/index.js\");\n\nvar Quill = __webpack_require__(/*! quill */ \"./node_modules/.pnpm/quill@1.3.7/node_modules/quill/dist/quill.js\");\n\nvar Toolbars = __webpack_require__(/*! ./toolbar */ \"./build/components/richTextBox/toolbar.js\");\n/**\r\n * Toolbar Types\r\n */\n\n\nvar RichTextBoxTypes;\n\n(function (RichTextBoxTypes) {\n RichTextBoxTypes[RichTextBoxTypes[\"Basic\"] = 1] = \"Basic\";\n RichTextBoxTypes[RichTextBoxTypes[\"Full\"] = 2] = \"Full\";\n})(RichTextBoxTypes = exports.RichTextBoxTypes || (exports.RichTextBoxTypes = {}));\n/**\r\n * Rich TextBox\r\n */\n\n\nvar RichTextBox = function RichTextBox(props) {\n // Create the editor element\n var elRichTextBox = document.createElement(\"div\");\n elRichTextBox.classList.add(\"rich-textbox\"); // Create the toolbar element\n\n var elToolbar = document.createElement(\"div\");\n elToolbar.classList.add(\"toolbar-container\");\n elRichTextBox.appendChild(elToolbar); // Create the editor element\n\n var elEditor = document.createElement(\"div\");\n elEditor.classList.add(\"editor-container\");\n elRichTextBox.appendChild(elEditor); // Get the options and default the values\n\n var options = props.options || {};\n options.modules = options.modules || {};\n options.placeholder ? options.placeholder = props.placeholder : null;\n typeof options.readOnly === \"boolean\" ? options.readOnly = props.disabled : null;\n typeof options.theme === \"undefined\" ? options.theme = \"snow\" : null; // See if are setting the default toolbar options\n\n if (options.modules.toolbar == null) {\n // Set the toolbar options\n elToolbar.innerHTML = props.toolbarType == RichTextBoxTypes.Basic ? Toolbars.BasicToolbar : Toolbars.FullToolbar; // Set the container\n\n options.modules.toolbar = elToolbar;\n } else {\n // Set the container\n options.modules.toolbar.container = elToolbar;\n } // Create the element\n\n\n var el = document.createElement(\"div\");\n el.appendChild(elRichTextBox); // See if we are rendering it to an element\n\n if (props.el) {\n // Ensure the parent element exists\n if (props.el.parentElement && props.el.parentElement.classList) {\n // Set the bootstrap class\n props.el.parentElement.classList.contains(\"bs\") ? null : props.el.parentElement.classList.add(\"bs\");\n } // Append the elements\n\n\n while (el.children.length > 0) {\n props.el.appendChild(el.children[0]);\n } // Update the element\n\n\n el = props.el;\n } else {\n // Set the bootstrap class\n el.classList.add(\"bs\");\n } // Apply the plugin\n\n\n var quillObj = new Quill(elEditor, options); // Create the object\n\n var obj = {\n el: elRichTextBox,\n elContents: quillObj.root,\n quillObj: quillObj,\n getHtml: function getHtml() {\n return quillObj.root.innerHTML;\n },\n getText: function getText() {\n return quillObj.getText();\n },\n setValue: function setValue(value) {\n // Set the value\n quillObj.setText(value);\n }\n }; // Execute the assign to event\n\n props.assignTo ? props.assignTo(obj) : null; // Return the object\n\n return obj;\n};\n\nexports.RichTextBox = RichTextBox; // Customize the form control\n\nexports.RichTextBoxControlType = 102;\ngd_bs_1.Components.FormControlTypes[\"RichTextBox\"] = exports.RichTextBoxControlType;\ngd_bs_1.Components.CustomControls.registerType(exports.RichTextBoxControlType, function (props) {\n var rtb = null; // Set the created method\n\n var onRendered = props.onControlRendered;\n\n props.onControlRendered = function (ctrl) {\n // Render a date/time\n rtb = (0, exports.RichTextBox)({\n className: props.className,\n disabled: props.isDisabled || props.isReadonly,\n el: ctrl.el,\n options: props.options,\n placeholder: props.placeholder,\n value: props.value\n }); // See if the label exists\n\n var elLabel = ctrl[\"_elLabel\"];\n\n if (elLabel) {\n // Set the id and aria properties\n elLabel ? elLabel.id = (props.id || props.name) + \"_label\" : null; //rtb.el.querySelector(\"input\").setAttribute(\"aria-labelledby\", elLabel.id);\n } // Set the control\n\n\n ctrl.setControl(rtb); // Call the custom render event\n\n onRendered ? onRendered(ctrl) : null;\n }; // Register a people picker\n\n\n props.onGetValue = function (ctrl) {\n // Return the value\n return rtb ? rtb.getHtml() : ctrl.value;\n };\n});\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/richTextBox/index.js?");
723
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.RichTextBoxControlType = exports.RichTextBox = exports.RichTextBoxTypes = void 0;\n\nvar gd_bs_1 = __webpack_require__(/*! gd-bs */ \"./node_modules/.pnpm/gd-bs@5.7.7/node_modules/gd-bs/build/index.js\");\n\nvar Quill = __webpack_require__(/*! quill */ \"./node_modules/.pnpm/quill@1.3.7/node_modules/quill/dist/quill.js\");\n\nvar Toolbars = __webpack_require__(/*! ./toolbar */ \"./build/components/richTextBox/toolbar.js\");\n/**\r\n * Toolbar Types\r\n */\n\n\nvar RichTextBoxTypes;\n\n(function (RichTextBoxTypes) {\n RichTextBoxTypes[RichTextBoxTypes[\"None\"] = 0] = \"None\";\n RichTextBoxTypes[RichTextBoxTypes[\"Basic\"] = 1] = \"Basic\";\n RichTextBoxTypes[RichTextBoxTypes[\"Full\"] = 2] = \"Full\";\n})(RichTextBoxTypes = exports.RichTextBoxTypes || (exports.RichTextBoxTypes = {}));\n/**\r\n * Rich TextBox\r\n */\n\n\nvar RichTextBox = function RichTextBox(props) {\n // Create the editor element\n var elRichTextBox = document.createElement(\"div\");\n elRichTextBox.classList.add(\"rich-textbox\"); // Create the toolbar element\n\n var elToolbar = document.createElement(\"div\");\n elToolbar.classList.add(\"toolbar-container\");\n elRichTextBox.appendChild(elToolbar); // Create the editor element\n\n var elEditor = document.createElement(\"div\");\n elEditor.classList.add(\"editor-container\");\n elRichTextBox.appendChild(elEditor); // Get the options and default the values\n\n var options = props.options || {};\n options.modules = options.modules || {};\n options.placeholder ? options.placeholder = props.placeholder : null;\n options.readOnly == null && typeof props.disabled === \"boolean\" ? options.readOnly = props.disabled : null;\n options.theme = options.theme == null ? \"snow\" : options.theme; // See if are setting the default toolbar options\n\n var showToolbar = true;\n\n if (options.modules.toolbar == null) {\n // Set the toolbar options\n switch (props.toolbarType) {\n // None\n case RichTextBoxTypes.None:\n elToolbar.innerHTML = \"\";\n showToolbar = false;\n break;\n // Basic\n\n case RichTextBoxTypes.Basic:\n elToolbar.innerHTML = Toolbars.BasicToolbar;\n break;\n // Default - Full\n\n default:\n elToolbar.innerHTML = Toolbars.FullToolbar;\n break;\n } // Set the toolbar\n\n\n options.modules.toolbar = elToolbar;\n } else {\n // Set the toolbar container\n options.modules.toolbar.container = elToolbar;\n } // Create the element\n\n\n var el = document.createElement(\"div\");\n el.appendChild(elRichTextBox); // See if we are rendering it to an element\n\n if (props.el) {\n // Ensure the parent element exists\n if (props.el.parentElement && props.el.parentElement.classList) {\n // Set the bootstrap class\n props.el.parentElement.classList.contains(\"bs\") ? null : props.el.parentElement.classList.add(\"bs\");\n } // Append the elements\n\n\n while (el.children.length > 0) {\n props.el.appendChild(el.children[0]);\n } // Update the element\n\n\n el = props.el;\n } else {\n // Set the bootstrap class\n el.classList.add(\"bs\");\n } // Apply the plugin\n\n\n var quillObj = new Quill(elEditor, options); // See if we are hiding the toolbar\n\n if (!showToolbar) {\n // Remove the snow class\n elToolbar.classList.remove(\"ql-snow\");\n } // Create the object\n\n\n var obj = {\n el: elRichTextBox,\n elContents: quillObj.root,\n quillObj: quillObj,\n getHtml: function getHtml() {\n return quillObj.root.innerHTML;\n },\n getText: function getText() {\n return quillObj.getText();\n },\n setHtml: function setHtml(value) {\n quillObj.root.innerHTML = value || \"\";\n }\n }; // Set the value\n\n props.value ? obj.setHtml(props.value) : null; // Execute the assign to event\n\n props.assignTo ? props.assignTo(obj) : null; // Return the object\n\n return obj;\n};\n\nexports.RichTextBox = RichTextBox; // Customize the form control\n\nexports.RichTextBoxControlType = 102;\ngd_bs_1.Components.FormControlTypes[\"RichTextBox\"] = exports.RichTextBoxControlType;\ngd_bs_1.Components.CustomControls.registerType(exports.RichTextBoxControlType, function (props) {\n var rtb = null; // Set the created method\n\n var onRendered = props.onControlRendered;\n\n props.onControlRendered = function (ctrl) {\n // Render a date/time\n rtb = (0, exports.RichTextBox)({\n className: props.className,\n disabled: props.isDisabled || props.isReadonly,\n el: ctrl.el,\n options: props.options,\n rows: props.rows,\n toolbarType: props.toolbarType,\n placeholder: props.placeholder,\n value: props.value\n }); // See if the label exists\n\n var elLabel = ctrl[\"_elLabel\"];\n\n if (elLabel) {\n // Set the id and aria properties\n elLabel ? elLabel.id = (props.id || props.name) + \"_label\" : null; //rtb.el.querySelector(\"input\").setAttribute(\"aria-labelledby\", elLabel.id);\n } // Set the control\n\n\n ctrl.setControl(rtb); // Call the custom render event\n\n onRendered ? onRendered(ctrl) : null;\n }; // Register a people picker\n\n\n props.onGetValue = function (ctrl) {\n // Return the value\n return rtb ? rtb.getHtml() : ctrl.value;\n };\n});\n\n//# sourceURL=webpack://gd-sprest-bs/./build/components/richTextBox/index.js?");
724
724
 
725
725
  /***/ }),
726
726