@pnp/spfx-controls-react 3.15.0-beta.4974189 → 3.15.0-beta.5068030

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.
Files changed (156) hide show
  1. package/CHANGELOG.json +6 -2
  2. package/CHANGELOG.md +2 -1
  3. package/lib/TermSetNavigation.d.ts +2 -0
  4. package/lib/TermSetNavigation.d.ts.map +1 -0
  5. package/lib/TermSetNavigation.js +2 -0
  6. package/lib/TermSetNavigation.js.map +1 -0
  7. package/lib/common/telemetry/version.js +1 -1
  8. package/lib/controls/TermSetNavigation/ErrorMessage/ErrorMessage.d.ts +4 -0
  9. package/lib/controls/TermSetNavigation/ErrorMessage/ErrorMessage.d.ts.map +1 -0
  10. package/lib/controls/TermSetNavigation/ErrorMessage/ErrorMessage.js +16 -0
  11. package/lib/controls/TermSetNavigation/ErrorMessage/ErrorMessage.js.map +1 -0
  12. package/lib/controls/TermSetNavigation/ErrorMessage/useErrorMessageStyles.d.ts +7 -0
  13. package/lib/controls/TermSetNavigation/ErrorMessage/useErrorMessageStyles.d.ts.map +1 -0
  14. package/lib/controls/TermSetNavigation/ErrorMessage/useErrorMessageStyles.js +16 -0
  15. package/lib/controls/TermSetNavigation/ErrorMessage/useErrorMessageStyles.js.map +1 -0
  16. package/lib/controls/TermSetNavigation/INavigationProps.d.ts +14 -0
  17. package/lib/controls/TermSetNavigation/INavigationProps.d.ts.map +1 -0
  18. package/lib/controls/TermSetNavigation/INavigationProps.js +2 -0
  19. package/lib/controls/TermSetNavigation/INavigationProps.js.map +1 -0
  20. package/lib/controls/TermSetNavigation/Navigation.d.ts +4 -0
  21. package/lib/controls/TermSetNavigation/Navigation.d.ts.map +1 -0
  22. package/lib/controls/TermSetNavigation/Navigation.js +199 -0
  23. package/lib/controls/TermSetNavigation/Navigation.js.map +1 -0
  24. package/lib/controls/TermSetNavigation/NavigationContextMenu.d.ts +5 -0
  25. package/lib/controls/TermSetNavigation/NavigationContextMenu.d.ts.map +1 -0
  26. package/lib/controls/TermSetNavigation/NavigationContextMenu.js +22 -0
  27. package/lib/controls/TermSetNavigation/NavigationContextMenu.js.map +1 -0
  28. package/lib/controls/TermSetNavigation/RenderGroupHeader.d.ts +4 -0
  29. package/lib/controls/TermSetNavigation/RenderGroupHeader.d.ts.map +1 -0
  30. package/lib/controls/TermSetNavigation/RenderGroupHeader.js +14 -0
  31. package/lib/controls/TermSetNavigation/RenderGroupHeader.js.map +1 -0
  32. package/lib/controls/TermSetNavigation/RenderLink.d.ts +8 -0
  33. package/lib/controls/TermSetNavigation/RenderLink.d.ts.map +1 -0
  34. package/lib/controls/TermSetNavigation/RenderLink.js +32 -0
  35. package/lib/controls/TermSetNavigation/RenderLink.js.map +1 -0
  36. package/lib/controls/TermSetNavigation/RenderNoOptions.d.ts +5 -0
  37. package/lib/controls/TermSetNavigation/RenderNoOptions.d.ts.map +1 -0
  38. package/lib/controls/TermSetNavigation/RenderNoOptions.js +11 -0
  39. package/lib/controls/TermSetNavigation/RenderNoOptions.js.map +1 -0
  40. package/lib/controls/TermSetNavigation/TermSetNavigation.d.ts +4 -0
  41. package/lib/controls/TermSetNavigation/TermSetNavigation.d.ts.map +1 -0
  42. package/lib/controls/TermSetNavigation/TermSetNavigation.js +29 -0
  43. package/lib/controls/TermSetNavigation/TermSetNavigation.js.map +1 -0
  44. package/lib/controls/TermSetNavigation/atoms/globalState.d.ts +5 -0
  45. package/lib/controls/TermSetNavigation/atoms/globalState.d.ts.map +1 -0
  46. package/lib/controls/TermSetNavigation/atoms/globalState.js +5 -0
  47. package/lib/controls/TermSetNavigation/atoms/globalState.js.map +1 -0
  48. package/lib/controls/TermSetNavigation/constants/constants.d.ts +24 -0
  49. package/lib/controls/TermSetNavigation/constants/constants.d.ts.map +1 -0
  50. package/lib/controls/TermSetNavigation/constants/constants.js +24 -0
  51. package/lib/controls/TermSetNavigation/constants/constants.js.map +1 -0
  52. package/lib/controls/TermSetNavigation/hooks/useGraphTaxonomyAPI.d.ts +11 -0
  53. package/lib/controls/TermSetNavigation/hooks/useGraphTaxonomyAPI.d.ts.map +1 -0
  54. package/lib/controls/TermSetNavigation/hooks/useGraphTaxonomyAPI.js +195 -0
  55. package/lib/controls/TermSetNavigation/hooks/useGraphTaxonomyAPI.js.map +1 -0
  56. package/lib/controls/TermSetNavigation/hooks/useSessionStorage.d.ts +2 -0
  57. package/lib/controls/TermSetNavigation/hooks/useSessionStorage.d.ts.map +1 -0
  58. package/lib/controls/TermSetNavigation/hooks/useSessionStorage.js +25 -0
  59. package/lib/controls/TermSetNavigation/hooks/useSessionStorage.js.map +1 -0
  60. package/lib/controls/TermSetNavigation/index.d.ts +9 -0
  61. package/lib/controls/TermSetNavigation/index.d.ts.map +1 -0
  62. package/lib/controls/TermSetNavigation/index.js +9 -0
  63. package/lib/controls/TermSetNavigation/index.js.map +1 -0
  64. package/lib/controls/TermSetNavigation/models/IContextMenuOption.d.ts +6 -0
  65. package/lib/controls/TermSetNavigation/models/IContextMenuOption.d.ts.map +1 -0
  66. package/lib/controls/TermSetNavigation/models/IContextMenuOption.js +2 -0
  67. package/lib/controls/TermSetNavigation/models/IContextMenuOption.js.map +1 -0
  68. package/lib/controls/TermSetNavigation/models/IErrorMessageProps.d.ts +5 -0
  69. package/lib/controls/TermSetNavigation/models/IErrorMessageProps.d.ts.map +1 -0
  70. package/lib/controls/TermSetNavigation/models/IErrorMessageProps.js +2 -0
  71. package/lib/controls/TermSetNavigation/models/IErrorMessageProps.js.map +1 -0
  72. package/lib/controls/TermSetNavigation/models/IGlobalState.d.ts +8 -0
  73. package/lib/controls/TermSetNavigation/models/IGlobalState.d.ts.map +1 -0
  74. package/lib/controls/TermSetNavigation/models/IGlobalState.js +2 -0
  75. package/lib/controls/TermSetNavigation/models/IGlobalState.js.map +1 -0
  76. package/lib/controls/TermSetNavigation/models/ITermSetListResponse.d.ts +6 -0
  77. package/lib/controls/TermSetNavigation/models/ITermSetListResponse.d.ts.map +1 -0
  78. package/lib/controls/TermSetNavigation/models/ITermSetListResponse.js +2 -0
  79. package/lib/controls/TermSetNavigation/models/ITermSetListResponse.js.map +1 -0
  80. package/lib/controls/TermSetNavigation/models/ITerms.d.ts +6 -0
  81. package/lib/controls/TermSetNavigation/models/ITerms.d.ts.map +1 -0
  82. package/lib/controls/TermSetNavigation/models/ITerms.js +2 -0
  83. package/lib/controls/TermSetNavigation/models/ITerms.js.map +1 -0
  84. package/lib/controls/TermSetNavigation/useNavigationStyles.d.ts +2 -0
  85. package/lib/controls/TermSetNavigation/useNavigationStyles.d.ts.map +1 -0
  86. package/lib/controls/TermSetNavigation/useNavigationStyles.js +127 -0
  87. package/lib/controls/TermSetNavigation/useNavigationStyles.js.map +1 -0
  88. package/lib/controls/TermSetNavigation/utils/useTaxonomyUtils.d.ts +8 -0
  89. package/lib/controls/TermSetNavigation/utils/useTaxonomyUtils.d.ts.map +1 -0
  90. package/lib/controls/TermSetNavigation/utils/useTaxonomyUtils.js +111 -0
  91. package/lib/controls/TermSetNavigation/utils/useTaxonomyUtils.js.map +1 -0
  92. package/lib/controls/TermSetNavigation/utils/useUtils.d.ts +12 -0
  93. package/lib/controls/TermSetNavigation/utils/useUtils.d.ts.map +1 -0
  94. package/lib/controls/TermSetNavigation/utils/useUtils.js +48 -0
  95. package/lib/controls/TermSetNavigation/utils/useUtils.js.map +1 -0
  96. package/lib/controls/dynamicForm/DynamicForm.d.ts +7 -7
  97. package/lib/controls/dynamicForm/DynamicForm.d.ts.map +1 -1
  98. package/lib/controls/dynamicForm/DynamicForm.js +181 -131
  99. package/lib/controls/dynamicForm/DynamicForm.js.map +1 -1
  100. package/lib/loc/bg-bg.js +2 -0
  101. package/lib/loc/bg-bg.js.map +1 -1
  102. package/lib/loc/ca-es.js +2 -0
  103. package/lib/loc/ca-es.js.map +1 -1
  104. package/lib/loc/da-dk.js +2 -0
  105. package/lib/loc/da-dk.js.map +1 -1
  106. package/lib/loc/de-de.js +2 -0
  107. package/lib/loc/de-de.js.map +1 -1
  108. package/lib/loc/el-gr.js +2 -0
  109. package/lib/loc/el-gr.js.map +1 -1
  110. package/lib/loc/en-us.js +2 -0
  111. package/lib/loc/en-us.js.map +1 -1
  112. package/lib/loc/es-es.js +2 -0
  113. package/lib/loc/es-es.js.map +1 -1
  114. package/lib/loc/et-ee.js +2 -0
  115. package/lib/loc/et-ee.js.map +1 -1
  116. package/lib/loc/eu-es.js +2 -0
  117. package/lib/loc/eu-es.js.map +1 -1
  118. package/lib/loc/fi-fi.js +2 -0
  119. package/lib/loc/fi-fi.js.map +1 -1
  120. package/lib/loc/fr-ca.js +2 -0
  121. package/lib/loc/fr-ca.js.map +1 -1
  122. package/lib/loc/fr-fr.js +2 -0
  123. package/lib/loc/fr-fr.js.map +1 -1
  124. package/lib/loc/ja-jp.js +2 -0
  125. package/lib/loc/ja-jp.js.map +1 -1
  126. package/lib/loc/lt-lt.js +2 -0
  127. package/lib/loc/lt-lt.js.map +1 -1
  128. package/lib/loc/lv-lv.js +2 -0
  129. package/lib/loc/lv-lv.js.map +1 -1
  130. package/lib/loc/nb-no.js +2 -0
  131. package/lib/loc/nb-no.js.map +1 -1
  132. package/lib/loc/pl-pl.js +2 -0
  133. package/lib/loc/pl-pl.js.map +1 -1
  134. package/lib/loc/pt-br.js +2 -0
  135. package/lib/loc/pt-br.js.map +1 -1
  136. package/lib/loc/pt-pt.js +2 -0
  137. package/lib/loc/pt-pt.js.map +1 -1
  138. package/lib/loc/ro-ro.js +2 -0
  139. package/lib/loc/ro-ro.js.map +1 -1
  140. package/lib/loc/ru-ru.js +2 -0
  141. package/lib/loc/ru-ru.js.map +1 -1
  142. package/lib/loc/sk-sk.js +2 -0
  143. package/lib/loc/sk-sk.js.map +1 -1
  144. package/lib/loc/sr-latn-rs.js +2 -0
  145. package/lib/loc/sr-latn-rs.js.map +1 -1
  146. package/lib/loc/sv-se.js +2 -0
  147. package/lib/loc/sv-se.js.map +1 -1
  148. package/lib/loc/tr-tr.js +2 -0
  149. package/lib/loc/tr-tr.js.map +1 -1
  150. package/lib/loc/vi-vn.js +2 -0
  151. package/lib/loc/vi-vn.js.map +1 -1
  152. package/lib/loc/zh-cn.js +2 -0
  153. package/lib/loc/zh-cn.js.map +1 -1
  154. package/lib/loc/zh-tw.js +2 -0
  155. package/lib/loc/zh-tw.js.map +1 -1
  156. package/package.json +2 -1
@@ -61,21 +61,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
61
61
  }
62
62
  };
63
63
  /* eslint-disable @microsoft/spfx/no-async-await */
64
- import { SPHttpClient } from '@microsoft/sp-http';
65
- import { sp } from '@pnp/sp/presets/all';
66
- import * as strings from 'ControlStrings';
67
- import { DefaultButton, PrimaryButton } from 'office-ui-fabric-react/lib/Button';
68
- import { ProgressIndicator } from 'office-ui-fabric-react/lib/ProgressIndicator';
69
- import { Stack } from 'office-ui-fabric-react/lib/Stack';
70
- import * as React from 'react';
71
- import SPservice from '../../services/SPService';
72
- import { DynamicField } from './dynamicField';
73
- import styles from './DynamicForm.module.scss';
74
- import { Dialog, DialogFooter, DialogType } from 'office-ui-fabric-react/lib/Dialog';
75
- import '@pnp/sp/lists';
76
- import '@pnp/sp/content-types';
77
- import '@pnp/sp/folders';
78
- import '@pnp/sp/items';
64
+ import { SPHttpClient } from "@microsoft/sp-http";
65
+ import { sp } from "@pnp/sp/presets/all";
66
+ import * as strings from "ControlStrings";
67
+ import { DefaultButton, PrimaryButton, } from "office-ui-fabric-react/lib/Button";
68
+ import { ProgressIndicator } from "office-ui-fabric-react/lib/ProgressIndicator";
69
+ import { Stack } from "office-ui-fabric-react/lib/Stack";
70
+ import * as React from "react";
71
+ import SPservice from "../../services/SPService";
72
+ import { DynamicField } from "./dynamicField";
73
+ import styles from "./DynamicForm.module.scss";
74
+ import { Dialog, DialogFooter, DialogType, } from "office-ui-fabric-react/lib/Dialog";
75
+ import "@pnp/sp/lists";
76
+ import "@pnp/sp/content-types";
77
+ import "@pnp/sp/folders";
78
+ import "@pnp/sp/items";
79
79
  var stackTokens = { childrenGap: 20 };
80
80
  /**
81
81
  * DynamicForm Class Control
@@ -84,32 +84,38 @@ var DynamicForm = /** @class */ (function (_super) {
84
84
  __extends(DynamicForm, _super);
85
85
  function DynamicForm(props) {
86
86
  var _this = _super.call(this, props) || this;
87
- _this.webURL = _this.props.webAbsoluteUrl ? _this.props.webAbsoluteUrl : _this.props.context.pageContext.web.absoluteUrl;
87
+ _this.webURL = _this.props.webAbsoluteUrl
88
+ ? _this.props.webAbsoluteUrl
89
+ : _this.props.context.pageContext.web.absoluteUrl;
88
90
  //trigger when the user submits the form.
89
91
  _this.onSubmitClick = function () { return __awaiter(_this, void 0, void 0, function () {
90
92
  var _a, listId, listItemId, contentTypeId, onSubmitted, onBeforeSubmit, onSubmitError, shouldBeReturnBack_1, fields, objects, _loop_1, this_1, i, len, isCancelled, newETag, iur, error_1, iar, error_2, idField, titleField, contentTypeIdField, library, folderTitle, newFolder, fields_1, folderId, iur, error_3, error_4;
91
- return __generator(this, function (_b) {
92
- switch (_b.label) {
93
+ var _b;
94
+ return __generator(this, function (_c) {
95
+ switch (_c.label) {
93
96
  case 0:
94
97
  _a = this.props, listId = _a.listId, listItemId = _a.listItemId, contentTypeId = _a.contentTypeId, onSubmitted = _a.onSubmitted, onBeforeSubmit = _a.onBeforeSubmit, onSubmitError = _a.onSubmitError;
95
- _b.label = 1;
98
+ _c.label = 1;
96
99
  case 1:
97
- _b.trys.push([1, 27, , 28]);
100
+ _c.trys.push([1, 27, , 28]);
98
101
  shouldBeReturnBack_1 = false;
99
102
  fields = (this.state.fieldCollection || []).slice();
100
103
  fields.forEach(function (val) {
101
104
  if (val.required) {
102
105
  if (val.newValue === null) {
103
- if (val.fieldDefaultValue === null || val.fieldDefaultValue === '' || val.fieldDefaultValue.length === 0) {
106
+ if (val.fieldDefaultValue === null ||
107
+ val.fieldDefaultValue === "" ||
108
+ val.fieldDefaultValue.length === 0 ||
109
+ val.fieldDefaultValue === undefined) {
104
110
  if (val.fieldType === "DateTime")
105
111
  val.fieldDefaultValue = null;
106
112
  else
107
- val.fieldDefaultValue = '';
113
+ val.fieldDefaultValue = "";
108
114
  shouldBeReturnBack_1 = true;
109
115
  }
110
116
  }
111
- else if (val.newValue === '') {
112
- val.fieldDefaultValue = '';
117
+ else if (val.newValue === "") {
118
+ val.fieldDefaultValue = "";
113
119
  shouldBeReturnBack_1 = true;
114
120
  }
115
121
  else if (Array.isArray(val.newValue) && val.newValue.length === 0) {
@@ -121,18 +127,18 @@ var DynamicForm = /** @class */ (function (_super) {
121
127
  if (shouldBeReturnBack_1) {
122
128
  this.setState({
123
129
  fieldCollection: fields,
124
- isValidationErrorDialogOpen: this.props.validationErrorDialogProps !== undefined && this.props.validationErrorDialogProps.showDialogOnValidationError === true
130
+ isValidationErrorDialogOpen: ((_b = this.props.validationErrorDialogProps) === null || _b === void 0 ? void 0 : _b.showDialogOnValidationError) === true,
125
131
  });
126
132
  return [2 /*return*/];
127
133
  }
128
134
  this.setState({
129
- isSaving: true
135
+ isSaving: true,
130
136
  });
131
137
  objects = {};
132
138
  _loop_1 = function (i, len) {
133
139
  var val, fieldType, additionalData, columnInternalName, hiddenFieldName, value_1, uploadedImage;
134
- return __generator(this, function (_c) {
135
- switch (_c.label) {
140
+ return __generator(this, function (_d) {
141
+ switch (_d.label) {
136
142
  case 0:
137
143
  val = fields[i];
138
144
  fieldType = val.fieldType, additionalData = val.additionalData, columnInternalName = val.columnInternalName, hiddenFieldName = val.hiddenFieldName;
@@ -152,20 +158,24 @@ var DynamicForm = /** @class */ (function (_super) {
152
158
  val.newValue.forEach(function (element) {
153
159
  value_1.push(element.key);
154
160
  });
155
- objects["".concat(columnInternalName, "Id")] = { results: value_1.length === 0 ? null : value_1 };
161
+ objects["".concat(columnInternalName, "Id")] = {
162
+ results: value_1.length === 0 ? null : value_1,
163
+ };
156
164
  return [3 /*break*/, 14];
157
165
  case 2:
158
166
  if (!(fieldType === "TaxonomyFieldType")) return [3 /*break*/, 3];
159
167
  objects[columnInternalName] = {
160
- '__metadata': { 'type': 'SP.Taxonomy.TaxonomyFieldValue' },
161
- 'Label': value_1[0].name,
162
- 'TermGuid': value_1[0].key,
163
- 'WssId': '-1'
168
+ __metadata: { type: "SP.Taxonomy.TaxonomyFieldValue" },
169
+ Label: value_1[0].name,
170
+ TermGuid: value_1[0].key,
171
+ WssId: "-1",
164
172
  };
165
173
  return [3 /*break*/, 14];
166
174
  case 3:
167
175
  if (!(fieldType === "TaxonomyFieldTypeMulti")) return [3 /*break*/, 4];
168
- objects[hiddenFieldName] = val.newValue.map(function (term) { return "-1#;".concat(term.name, "|").concat(term.key, ";"); }).join('#');
176
+ objects[hiddenFieldName] = val.newValue
177
+ .map(function (term) { return "-1#;".concat(term.name, "|").concat(term.key, ";"); })
178
+ .join("#");
169
179
  return [3 /*break*/, 14];
170
180
  case 4:
171
181
  if (!(fieldType === "User")) return [3 /*break*/, 5];
@@ -185,41 +195,43 @@ var DynamicForm = /** @class */ (function (_super) {
185
195
  return [3 /*break*/, 14];
186
196
  case 8:
187
197
  if (!(fieldType === "UserMulti")) return [3 /*break*/, 9];
188
- objects["".concat(columnInternalName, "Id")] = { results: val.newValue.lenght === 0 ? null : val.newValue };
198
+ objects["".concat(columnInternalName, "Id")] = {
199
+ results: val.newValue.lenght === 0 ? null : val.newValue,
200
+ };
189
201
  return [3 /*break*/, 14];
190
202
  case 9:
191
- if (!(fieldType === 'Thumbnail')) return [3 /*break*/, 13];
203
+ if (!(fieldType === "Thumbnail")) return [3 /*break*/, 13];
192
204
  if (!additionalData) return [3 /*break*/, 11];
193
205
  return [4 /*yield*/, this_1.uploadImage(additionalData)];
194
206
  case 10:
195
- uploadedImage = _c.sent();
207
+ uploadedImage = _d.sent();
196
208
  objects[columnInternalName] = JSON.stringify({
197
- type: 'thumbnail',
209
+ type: "thumbnail",
198
210
  fileName: uploadedImage.Name,
199
211
  serverRelativeUrl: uploadedImage.ServerRelativeUrl,
200
- id: uploadedImage.UniqueId
212
+ id: uploadedImage.UniqueId,
201
213
  });
202
214
  return [3 /*break*/, 12];
203
215
  case 11:
204
216
  objects[columnInternalName] = null;
205
- _c.label = 12;
217
+ _d.label = 12;
206
218
  case 12: return [3 /*break*/, 14];
207
219
  case 13:
208
220
  objects[columnInternalName] = val.newValue;
209
- _c.label = 14;
221
+ _d.label = 14;
210
222
  case 14: return [2 /*return*/];
211
223
  }
212
224
  });
213
225
  };
214
226
  this_1 = this;
215
227
  i = 0, len = fields.length;
216
- _b.label = 2;
228
+ _c.label = 2;
217
229
  case 2:
218
230
  if (!(i < len)) return [3 /*break*/, 5];
219
231
  return [5 /*yield**/, _loop_1(i, len)];
220
232
  case 3:
221
- _b.sent();
222
- _b.label = 4;
233
+ _c.sent();
234
+ _c.label = 4;
223
235
  case 4:
224
236
  i++;
225
237
  return [3 /*break*/, 2];
@@ -227,30 +239,35 @@ var DynamicForm = /** @class */ (function (_super) {
227
239
  if (!onBeforeSubmit) return [3 /*break*/, 7];
228
240
  return [4 /*yield*/, onBeforeSubmit(objects)];
229
241
  case 6:
230
- isCancelled = _b.sent();
242
+ isCancelled = _c.sent();
231
243
  if (isCancelled) {
232
244
  this.setState({
233
- isSaving: false
245
+ isSaving: false,
234
246
  });
235
247
  return [2 /*return*/];
236
248
  }
237
- _b.label = 7;
249
+ _c.label = 7;
238
250
  case 7:
239
251
  newETag = undefined;
240
252
  if (!listItemId) return [3 /*break*/, 12];
241
- _b.label = 8;
253
+ _c.label = 8;
242
254
  case 8:
243
- _b.trys.push([8, 10, , 11]);
244
- return [4 /*yield*/, sp.web.lists.getById(listId).items.getById(listItemId).update(objects, this.state.etag)];
255
+ _c.trys.push([8, 10, , 11]);
256
+ return [4 /*yield*/, sp.web.lists
257
+ .getById(listId)
258
+ .items.getById(listItemId)
259
+ .update(objects, this.state.etag)];
245
260
  case 9:
246
- iur = _b.sent();
247
- newETag = iur.data['odata.etag'];
261
+ iur = _c.sent();
262
+ newETag = iur.data["odata.etag"];
248
263
  if (onSubmitted) {
249
- onSubmitted(iur.data, this.props.returnListItemInstanceOnSubmit !== false ? iur.item : undefined);
264
+ onSubmitted(iur.data, this.props.returnListItemInstanceOnSubmit !== false
265
+ ? iur.item
266
+ : undefined);
250
267
  }
251
268
  return [3 /*break*/, 11];
252
269
  case 10:
253
- error_1 = _b.sent();
270
+ error_1 = _c.sent();
254
271
  if (onSubmitError) {
255
272
  onSubmitError(objects, error_1);
256
273
  }
@@ -258,19 +275,23 @@ var DynamicForm = /** @class */ (function (_super) {
258
275
  return [3 /*break*/, 11];
259
276
  case 11: return [3 /*break*/, 26];
260
277
  case 12:
261
- if (!(contentTypeId === undefined || contentTypeId === '' || !contentTypeId.startsWith('0x0120'))) return [3 /*break*/, 17];
262
- _b.label = 13;
278
+ if (!(contentTypeId === undefined ||
279
+ contentTypeId === "" ||
280
+ !contentTypeId.startsWith("0x0120"))) return [3 /*break*/, 17];
281
+ _c.label = 13;
263
282
  case 13:
264
- _b.trys.push([13, 15, , 16]);
283
+ _c.trys.push([13, 15, , 16]);
265
284
  return [4 /*yield*/, sp.web.lists.getById(listId).items.add(objects)];
266
285
  case 14:
267
- iar = _b.sent();
286
+ iar = _c.sent();
268
287
  if (onSubmitted) {
269
- onSubmitted(iar.data, this.props.returnListItemInstanceOnSubmit !== false ? iar.item : undefined);
288
+ onSubmitted(iar.data, this.props.returnListItemInstanceOnSubmit !== false
289
+ ? iar.item
290
+ : undefined);
270
291
  }
271
292
  return [3 /*break*/, 16];
272
293
  case 15:
273
- error_2 = _b.sent();
294
+ error_2 = _c.sent();
274
295
  if (onSubmitError) {
275
296
  onSubmitError(objects, error_2);
276
297
  }
@@ -278,40 +299,42 @@ var DynamicForm = /** @class */ (function (_super) {
278
299
  return [3 /*break*/, 16];
279
300
  case 16: return [3 /*break*/, 26];
280
301
  case 17:
281
- if (!contentTypeId.startsWith('0x0120')) return [3 /*break*/, 26];
282
- _b.label = 18;
302
+ if (!contentTypeId.startsWith("0x0120")) return [3 /*break*/, 26];
303
+ _c.label = 18;
283
304
  case 18:
284
- _b.trys.push([18, 25, , 26]);
285
- idField = 'ID';
286
- titleField = 'Title';
287
- contentTypeIdField = 'ContentTypeId';
305
+ _c.trys.push([18, 25, , 26]);
306
+ idField = "ID";
307
+ titleField = "Title";
308
+ contentTypeIdField = "ContentTypeId";
288
309
  return [4 /*yield*/, sp.web.lists.getById(listId)];
289
310
  case 19:
290
- library = _b.sent();
291
- folderTitle = (objects[titleField] !== undefined && objects[titleField] !== '') ?
292
- objects[titleField].replace(/["|*|:|<|>|?|/|\\||]/g, "_") : // Replace not allowed chars in folder name
293
- '';
311
+ library = _c.sent();
312
+ folderTitle = objects[titleField] !== undefined && objects[titleField] !== ""
313
+ ? objects[titleField].replace(/["|*|:|<|>|?|/|\\||]/g, "_") // Replace not allowed chars in folder name
314
+ : "";
294
315
  return [4 /*yield*/, library.rootFolder.addSubFolderUsingPath(folderTitle)];
295
316
  case 20:
296
- newFolder = _b.sent();
317
+ newFolder = _c.sent();
297
318
  return [4 /*yield*/, newFolder.listItemAllFields()];
298
319
  case 21:
299
- fields_1 = _b.sent();
320
+ fields_1 = _c.sent();
300
321
  if (!fields_1[idField]) return [3 /*break*/, 23];
301
322
  folderId = fields_1[idField];
302
323
  // Set the content type ID for the target item
303
324
  objects[contentTypeIdField] = contentTypeId;
304
325
  return [4 /*yield*/, library.items.getById(folderId).update(objects)];
305
326
  case 22:
306
- iur = _b.sent();
327
+ iur = _c.sent();
307
328
  if (onSubmitted) {
308
- onSubmitted(iur.data, this.props.returnListItemInstanceOnSubmit !== false ? iur.item : undefined);
329
+ onSubmitted(iur.data, this.props.returnListItemInstanceOnSubmit !== false
330
+ ? iur.item
331
+ : undefined);
309
332
  }
310
333
  return [3 /*break*/, 24];
311
- case 23: throw new Error('Unable to read the ID of the just created folder or Document Set');
334
+ case 23: throw new Error("Unable to read the ID of the just created folder or Document Set");
312
335
  case 24: return [3 /*break*/, 26];
313
336
  case 25:
314
- error_3 = _b.sent();
337
+ error_3 = _c.sent();
315
338
  if (onSubmitError) {
316
339
  onSubmitError(objects, error_3);
317
340
  }
@@ -320,11 +343,11 @@ var DynamicForm = /** @class */ (function (_super) {
320
343
  case 26:
321
344
  this.setState({
322
345
  isSaving: false,
323
- etag: newETag
346
+ etag: newETag,
324
347
  });
325
348
  return [3 /*break*/, 28];
326
349
  case 27:
327
- error_4 = _b.sent();
350
+ error_4 = _c.sent();
328
351
  if (onSubmitError) {
329
352
  onSubmitError(null, error_4);
330
353
  }
@@ -341,13 +364,16 @@ var DynamicForm = /** @class */ (function (_super) {
341
364
  switch (_a.label) {
342
365
  case 0:
343
366
  fieldCol = (this.state.fieldCollection || []).slice();
344
- field = fieldCol.filter(function (element, i) { return element.columnInternalName === internalName; })[0];
367
+ field = fieldCol.filter(function (element, i) {
368
+ return element.columnInternalName === internalName;
369
+ })[0];
345
370
  field.newValue = newValue;
346
371
  field.additionalData = additionalData;
347
372
  if (!(field.fieldType === "User" && newValue.length !== 0)) return [3 /*break*/, 4];
348
- if (!(newValue[0].id === undefined || parseInt(newValue[0].id, 10).toString() === "NaN")) return [3 /*break*/, 2];
373
+ if (!(newValue[0].id === undefined ||
374
+ parseInt(newValue[0].id, 10).toString() === "NaN")) return [3 /*break*/, 2];
349
375
  user = newValue[0].secondaryText;
350
- if (user.indexOf('@') === -1) {
376
+ if (user.indexOf("@") === -1) {
351
377
  user = newValue[0].loginName;
352
378
  }
353
379
  return [4 /*yield*/, sp.web.ensureUser(user)];
@@ -367,9 +393,10 @@ var DynamicForm = /** @class */ (function (_super) {
367
393
  case 5:
368
394
  if (!(index < newValue.length)) return [3 /*break*/, 9];
369
395
  element = newValue[index];
370
- if (!(element.id === undefined || parseInt(element.id, 10).toString() === "NaN")) return [3 /*break*/, 7];
396
+ if (!(element.id === undefined ||
397
+ parseInt(element.id, 10).toString() === "NaN")) return [3 /*break*/, 7];
371
398
  user = element.secondaryText;
372
- if (user.indexOf('@') === -1) {
399
+ if (user.indexOf("@") === -1) {
373
400
  user = element.loginName;
374
401
  }
375
402
  return [4 /*yield*/, sp.web.ensureUser(user)];
@@ -385,7 +412,7 @@ var DynamicForm = /** @class */ (function (_super) {
385
412
  return [3 /*break*/, 5];
386
413
  case 9:
387
414
  this.setState({
388
- fieldCollection: fieldCol
415
+ fieldCollection: fieldCol,
389
416
  });
390
417
  return [2 /*return*/];
391
418
  }
@@ -418,12 +445,14 @@ var DynamicForm = /** @class */ (function (_super) {
418
445
  _b.label = 5;
419
446
  case 5:
420
447
  if (respectETag !== false) {
421
- etag = item['odata.etag'];
448
+ etag = item["odata.etag"];
422
449
  }
423
450
  _b.label = 6;
424
451
  case 6:
425
- if (!(contentTypeId === undefined || contentTypeId === '')) return [3 /*break*/, 8];
426
- return [4 /*yield*/, spList.contentTypes.select("Id", "Name").get()];
452
+ if (!(contentTypeId === undefined || contentTypeId === "")) return [3 /*break*/, 8];
453
+ return [4 /*yield*/, spList.contentTypes
454
+ .select("Id", "Name")
455
+ .get()];
427
456
  case 7:
428
457
  defaultContentType = _b.sent();
429
458
  contentTypeId = defaultContentType[0].Id.StringValue;
@@ -463,7 +492,7 @@ var DynamicForm = /** @class */ (function (_super) {
463
492
  else {
464
493
  defaultValue = field.DefaultValue;
465
494
  }
466
- if (!(fieldType === 'Choice' || fieldType === 'MultiChoice')) return [3 /*break*/, 1];
495
+ if (!(fieldType === "Choice" || fieldType === "MultiChoice")) return [3 /*break*/, 1];
467
496
  field.Choices.forEach(function (element) {
468
497
  choices_1.push({ key: element, text: element });
469
498
  });
@@ -508,15 +537,21 @@ var DynamicForm = /** @class */ (function (_super) {
508
537
  anchorId = field.AnchorId;
509
538
  if (item !== null) {
510
539
  item[field.InternalName].forEach(function (element) {
511
- selectedTags_1.push({ key: element.TermGuid, name: element.Label });
540
+ selectedTags_1.push({
541
+ key: element.TermGuid,
542
+ name: element.Label,
543
+ });
512
544
  });
513
545
  defaultValue = selectedTags_1;
514
546
  }
515
547
  else {
516
548
  if (defaultValue !== null && defaultValue !== "") {
517
549
  defaultValue.split(/#|;/).forEach(function (element) {
518
- if (element.indexOf('|') !== -1)
519
- selectedTags_1.push({ key: element.split('|')[1], name: element.split('|')[0] });
550
+ if (element.indexOf("|") !== -1)
551
+ selectedTags_1.push({
552
+ key: element.split("|")[1],
553
+ name: element.split("|")[0],
554
+ });
520
555
  });
521
556
  defaultValue = selectedTags_1;
522
557
  }
@@ -533,13 +568,19 @@ var DynamicForm = /** @class */ (function (_super) {
533
568
  case 13:
534
569
  response = _e.sent();
535
570
  if (response) {
536
- selectedTags_1.push({ key: response.TermID, name: response.Label });
571
+ selectedTags_1.push({
572
+ key: response.TermID,
573
+ name: response.Label,
574
+ });
537
575
  defaultValue = selectedTags_1;
538
576
  }
539
577
  return [3 /*break*/, 15];
540
578
  case 14:
541
579
  if (defaultValue !== "") {
542
- selectedTags_1.push({ key: defaultValue.split('|')[1], name: defaultValue.split('|')[0].split('#')[1] });
580
+ selectedTags_1.push({
581
+ key: defaultValue.split("|")[1],
582
+ name: defaultValue.split("|")[0].split("#")[1],
583
+ });
543
584
  defaultValue = selectedTags_1;
544
585
  }
545
586
  _e.label = 15;
@@ -551,15 +592,19 @@ var DynamicForm = /** @class */ (function (_super) {
551
592
  if (!(fieldType === "DateTime")) return [3 /*break*/, 18];
552
593
  if (item !== null && item[field.InternalName])
553
594
  defaultValue = new Date(item[field.InternalName]);
554
- else if (defaultValue === '[today]') {
595
+ else if (defaultValue === "[today]") {
555
596
  defaultValue = new Date();
556
597
  }
557
598
  schemaXml = field.SchemaXml;
558
- dateFormatRegEx = /\s+Format="([^"]+)"/gmi.exec(schemaXml);
559
- dateFormat = dateFormatRegEx && dateFormatRegEx.length ? dateFormatRegEx[1] : 'DateOnly';
599
+ dateFormatRegEx = /\s+Format="([^"]+)"/gim.exec(schemaXml);
600
+ dateFormat =
601
+ dateFormatRegEx && dateFormatRegEx.length
602
+ ? dateFormatRegEx[1]
603
+ : "DateOnly";
560
604
  return [4 /*yield*/, this_2._spService.getRegionalWebSettings()];
561
605
  case 17:
562
- defaultDayOfWeek = (_e.sent()).FirstDayOfWeek;
606
+ defaultDayOfWeek = (_e.sent())
607
+ .FirstDayOfWeek;
563
608
  return [3 /*break*/, 28];
564
609
  case 18:
565
610
  if (!(fieldType === "UserMulti")) return [3 /*break*/, 22];
@@ -588,7 +633,7 @@ var DynamicForm = /** @class */ (function (_super) {
588
633
  _d = (_c = userEmails).push;
589
634
  return [4 /*yield*/, this_2._spService.getUserUPNFromFieldValue(listId, listItemId, field.InternalName, this_2.webURL)];
590
635
  case 24:
591
- _d.apply(_c, [(_e.sent()) + '']);
636
+ _d.apply(_c, [(_e.sent()) + ""]);
592
637
  defaultValue = userEmails;
593
638
  return [3 /*break*/, 26];
594
639
  case 25:
@@ -619,7 +664,9 @@ var DynamicForm = /** @class */ (function (_super) {
619
664
  fieldTitle: field.Title,
620
665
  fieldDefaultValue: defaultValue,
621
666
  context: this_2.props.context,
622
- disabled: this_2.props.disabled || (disabledFields && disabledFields.indexOf(field.InternalName) > -1),
667
+ disabled: this_2.props.disabled ||
668
+ (disabledFields &&
669
+ disabledFields.indexOf(field.InternalName) > -1),
623
670
  listId: this_2.props.listId,
624
671
  columnInternalName: field.EntityPropertyName,
625
672
  label: field.Title,
@@ -632,7 +679,7 @@ var DynamicForm = /** @class */ (function (_super) {
632
679
  firstDayOfWeek: defaultDayOfWeek,
633
680
  listItemId: listItemId,
634
681
  principalType: principalType,
635
- description: field.Description
682
+ description: field.Description,
636
683
  });
637
684
  tempFields.sort(function (a, b) { return a.Order - b.Order; });
638
685
  _e.label = 29;
@@ -673,7 +720,7 @@ var DynamicForm = /** @class */ (function (_super) {
673
720
  return [2 /*return*/, {
674
721
  Name: file.fileName,
675
722
  ServerRelativeUrl: file.fileAbsoluteUrl,
676
- UniqueId: ''
723
+ UniqueId: "",
677
724
  }];
678
725
  case 1: return [4 /*yield*/, file.downloadFileContent()];
679
726
  case 2:
@@ -703,9 +750,9 @@ var DynamicForm = /** @class */ (function (_super) {
703
750
  _a.trys.push([0, 4, , 5]);
704
751
  context = this.props.context;
705
752
  webAbsoluteUrl = !webUrl ? this.webURL : webUrl;
706
- apiUrl = '';
707
- if (contentTypeId !== undefined && contentTypeId !== '') {
708
- if (contentTypeId.startsWith('0x0120')) {
753
+ apiUrl = "";
754
+ if (contentTypeId !== undefined && contentTypeId !== "") {
755
+ if (contentTypeId.startsWith("0x0120")) {
709
756
  apiUrl = "".concat(webAbsoluteUrl, "/_api/web/lists(@listId)/contenttypes('").concat(contentTypeId, "')/fields?@listId=guid'").concat(encodeURIComponent(listId), "'&$filter=ReadOnlyField eq false and (Hidden eq false or StaticName eq 'Title') and (FromBaseType eq false or StaticName eq 'Title')");
710
757
  }
711
758
  else {
@@ -737,15 +784,13 @@ var DynamicForm = /** @class */ (function (_super) {
737
784
  }); };
738
785
  _this.closeValidationErrorDialog = function () {
739
786
  _this.setState({
740
- isValidationErrorDialogOpen: false
787
+ isValidationErrorDialogOpen: false,
741
788
  });
742
789
  };
743
790
  _this.getValidationErrorTitle = function () {
744
791
  var errorTitle = strings.DynamicFormDialogValidationErrorTitle;
745
792
  var validationDialogProps = _this.props.validationErrorDialogProps;
746
- if (validationDialogProps !== undefined
747
- && validationDialogProps.customTitle !== undefined
748
- && validationDialogProps.customTitle.length > 0) {
793
+ if (validationDialogProps === null || validationDialogProps === void 0 ? void 0 : validationDialogProps.customTitle) {
749
794
  errorTitle = validationDialogProps.customTitle;
750
795
  }
751
796
  return errorTitle;
@@ -753,9 +798,7 @@ var DynamicForm = /** @class */ (function (_super) {
753
798
  _this.getValidationErrorMessage = function () {
754
799
  var errorMessage = strings.DynamicFormDialogValidationErrorMessage;
755
800
  var validationDialogProps = _this.props.validationErrorDialogProps;
756
- if (validationDialogProps !== undefined
757
- && validationDialogProps.customMessage !== undefined
758
- && validationDialogProps.customMessage.length > 0) {
801
+ if (validationDialogProps === null || validationDialogProps === void 0 ? void 0 : validationDialogProps.customMessage) {
759
802
  errorMessage = validationDialogProps.customMessage;
760
803
  }
761
804
  return errorMessage;
@@ -767,13 +810,13 @@ var DynamicForm = /** @class */ (function (_super) {
767
810
  headers: {
768
811
  Accept: "application/json;odata=verbose",
769
812
  },
770
- baseUrl: _this.props.webAbsoluteUrl
813
+ baseUrl: _this.props.webAbsoluteUrl,
771
814
  },
772
815
  });
773
816
  }
774
817
  else {
775
818
  sp.setup({
776
- spfxContext: { pageContext: _this.props.context.pageContext }
819
+ spfxContext: { pageContext: _this.props.context.pageContext },
777
820
  });
778
821
  }
779
822
  // Initialize state
@@ -782,14 +825,22 @@ var DynamicForm = /** @class */ (function (_super) {
782
825
  isValidationErrorDialogOpen: false,
783
826
  };
784
827
  // Get SPService Factory
785
- _this._spService = _this.props.webAbsoluteUrl ? new SPservice(_this.props.context, _this.props.webAbsoluteUrl) : new SPservice(_this.props.context);
828
+ _this._spService = _this.props.webAbsoluteUrl
829
+ ? new SPservice(_this.props.context, _this.props.webAbsoluteUrl)
830
+ : new SPservice(_this.props.context);
786
831
  return _this;
787
832
  }
788
833
  /**
789
834
  * Lifecycle hook when component is mounted
790
835
  */
791
836
  DynamicForm.prototype.componentDidMount = function () {
792
- this.getFieldInformations().then(function () { }).catch(function () { });
837
+ this.getFieldInformations()
838
+ .then(function () {
839
+ /* no-op; */
840
+ })
841
+ .catch(function () {
842
+ /* no-op; */
843
+ });
793
844
  };
794
845
  /**
795
846
  * Default React component render method
@@ -799,28 +850,27 @@ var DynamicForm = /** @class */ (function (_super) {
799
850
  var _a = this.state, fieldCollection = _a.fieldCollection, isSaving = _a.isSaving;
800
851
  var fieldOverrides = this.props.fieldOverrides;
801
852
  return (React.createElement("div", null,
802
- fieldCollection.length === 0 ? React.createElement("div", null,
803
- React.createElement(ProgressIndicator, { label: strings.DynamicFormLoading, description: strings.DynamicFormPleaseWait })) :
804
- React.createElement("div", null,
805
- fieldCollection.map(function (v, i) {
806
- if (fieldOverrides && Object.prototype.hasOwnProperty.call(fieldOverrides, v.columnInternalName)) {
807
- v.disabled = v.disabled || isSaving;
808
- return fieldOverrides[v.columnInternalName](v);
809
- }
810
- return React.createElement(DynamicField, __assign({ key: v.columnInternalName }, v, { disabled: v.disabled || isSaving }));
811
- }),
812
- !this.props.disabled &&
813
- React.createElement(Stack, { className: styles.buttons, horizontal: true, tokens: stackTokens },
814
- React.createElement(PrimaryButton, { disabled: isSaving, text: strings.Save, onClick: function () { return _this.onSubmitClick(); } }),
815
- React.createElement(DefaultButton, { disabled: isSaving, text: strings.Cancel, onClick: this.props.onCancelled }))),
853
+ fieldCollection.length === 0 ? (React.createElement("div", null,
854
+ React.createElement(ProgressIndicator, { label: strings.DynamicFormLoading, description: strings.DynamicFormPleaseWait }))) : (React.createElement("div", null,
855
+ fieldCollection.map(function (v, i) {
856
+ if (fieldOverrides &&
857
+ Object.prototype.hasOwnProperty.call(fieldOverrides, v.columnInternalName)) {
858
+ v.disabled = v.disabled || isSaving;
859
+ return fieldOverrides[v.columnInternalName](v);
860
+ }
861
+ return (React.createElement(DynamicField, __assign({ key: v.columnInternalName }, v, { disabled: v.disabled || isSaving })));
862
+ }),
863
+ !this.props.disabled && (React.createElement(Stack, { className: styles.buttons, horizontal: true, tokens: stackTokens },
864
+ React.createElement(PrimaryButton, { disabled: isSaving, text: strings.Save, onClick: function () { return _this.onSubmitClick(); } }),
865
+ React.createElement(DefaultButton, { disabled: isSaving, text: strings.Cancel, onClick: this.props.onCancelled }))))),
816
866
  React.createElement(Dialog, { hidden: !this.state.isValidationErrorDialogOpen, onDismiss: this.closeValidationErrorDialog, dialogContentProps: {
817
867
  type: DialogType.normal,
818
868
  title: this.getValidationErrorTitle(),
819
- showCloseButton: true
869
+ showCloseButton: true,
820
870
  }, modalProps: {
821
871
  className: styles.validationErrorDialog,
822
872
  isBlocking: true,
823
- containerClassName: 'ms-dialogMainOverride'
873
+ containerClassName: "ms-dialogMainOverride",
824
874
  } },
825
875
  this.getValidationErrorMessage(),
826
876
  React.createElement(DialogFooter, { className: styles.actions },