@pnp/spfx-controls-react 3.21.0-beta.1386581 → 3.21.0-beta.1391106

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 (31) hide show
  1. package/.eslintrc.js +1 -1
  2. package/CHANGELOG.json +5 -2
  3. package/CHANGELOG.md +3 -1
  4. package/lib/common/telemetry/version.js +1 -1
  5. package/lib/controls/dynamicForm/DynamicForm.d.ts +5 -1
  6. package/lib/controls/dynamicForm/DynamicForm.d.ts.map +1 -1
  7. package/lib/controls/dynamicForm/DynamicForm.js +307 -111
  8. package/lib/controls/dynamicForm/DynamicForm.js.map +1 -1
  9. package/lib/controls/dynamicForm/DynamicForm.styles.d.ts +3 -0
  10. package/lib/controls/dynamicForm/DynamicForm.styles.d.ts.map +1 -0
  11. package/lib/controls/dynamicForm/DynamicForm.styles.js +143 -0
  12. package/lib/controls/dynamicForm/DynamicForm.styles.js.map +1 -0
  13. package/lib/controls/dynamicForm/IDynamicFormProps.d.ts +39 -1
  14. package/lib/controls/dynamicForm/IDynamicFormProps.d.ts.map +1 -1
  15. package/lib/controls/dynamicForm/dynamicField/DynamicField.d.ts +4 -1
  16. package/lib/controls/dynamicForm/dynamicField/DynamicField.d.ts.map +1 -1
  17. package/lib/controls/dynamicForm/dynamicField/DynamicField.js +47 -19
  18. package/lib/controls/dynamicForm/dynamicField/DynamicField.js.map +1 -1
  19. package/lib/controls/dynamicForm/dynamicField/DynamicField.styles.d.ts +3 -0
  20. package/lib/controls/dynamicForm/dynamicField/DynamicField.styles.d.ts.map +1 -0
  21. package/lib/controls/dynamicForm/dynamicField/DynamicField.styles.js +138 -0
  22. package/lib/controls/dynamicForm/dynamicField/DynamicField.styles.js.map +1 -0
  23. package/lib/controls/dynamicForm/dynamicField/IDynamicFieldProps.d.ts +26 -0
  24. package/lib/controls/dynamicForm/dynamicField/IDynamicFieldProps.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/release/manifests/45165954-80f9-44c1-9967-cd38ae92a33b.manifest.json +1 -0
  27. package/lib/controls/dynamicForm/DynamicForm.module.css +0 -2
  28. package/lib/controls/dynamicForm/DynamicForm.module.scss.d.ts +0 -29
  29. package/lib/controls/dynamicForm/DynamicForm.module.scss.d.ts.map +0 -1
  30. package/lib/controls/dynamicForm/DynamicForm.module.scss.js +0 -30
  31. package/lib/controls/dynamicForm/DynamicForm.module.scss.js.map +0 -1
@@ -72,7 +72,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
72
72
  /* eslint-disable @microsoft/spfx/no-async-await */
73
73
  import * as React from "react";
74
74
  import * as strings from "ControlStrings";
75
- import styles from "./DynamicForm.module.scss";
76
75
  // Controls
77
76
  import { DefaultButton, PrimaryButton, } from "@fluentui/react/lib/Button";
78
77
  import { Dialog, DialogFooter, DialogType, } from "@fluentui/react/lib/Dialog";
@@ -81,6 +80,7 @@ import { ProgressIndicator } from "@fluentui/react/lib/ProgressIndicator";
81
80
  import { Stack } from "@fluentui/react/lib/Stack";
82
81
  import { DynamicField } from "./dynamicField";
83
82
  import { FilePicker } from "../filePicker";
83
+ import { Guid } from '@microsoft/sp-core-library';
84
84
  // pnp/sp, helpers / utils
85
85
  import { sp } from "@pnp/sp";
86
86
  import "@pnp/sp/lists";
@@ -91,17 +91,24 @@ import { cloneDeep, isEqual } from "lodash";
91
91
  import SPservice from "../../services/SPService";
92
92
  import { FormulaEvaluation } from "../../common/utilities/FormulaEvaluation";
93
93
  import CustomFormattingHelper from "../../common/utilities/CustomFormatting";
94
+ import { SPTaxonomyService } from '../../services/SPTaxonomyService';
95
+ import { getStyles } from "./DynamicForm.styles";
96
+ import { getFluentUIThemeOrDefault } from "../../common/utilities/ThemeUtility";
97
+ import { classNamesFunction, styled } from "@fluentui/react";
94
98
  import { Icon } from "@fluentui/react/lib/Icon";
95
99
  var stackTokens = { childrenGap: 20 };
100
+ var getstyles = classNamesFunction();
101
+ var getFieldstyles = classNamesFunction();
102
+ var theme = getFluentUIThemeOrDefault();
96
103
  var timeout = function (ms) {
97
104
  return new Promise(function (resolve) { return setTimeout(resolve, ms); });
98
105
  };
99
106
  /**
100
107
  * DynamicForm Class Control
101
108
  */
102
- var DynamicForm = /** @class */ (function (_super) {
103
- __extends(DynamicForm, _super);
104
- function DynamicForm(props) {
109
+ var DynamicFormBase = /** @class */ (function (_super) {
110
+ __extends(DynamicFormBase, _super);
111
+ function DynamicFormBase(props) {
105
112
  var _this = _super.call(this, props) || this;
106
113
  _this.webURL = _this.props.webAbsoluteUrl
107
114
  ? _this.props.webAbsoluteUrl
@@ -124,8 +131,9 @@ var DynamicForm = /** @class */ (function (_super) {
124
131
  _this.renderField = function (field) {
125
132
  var fieldOverrides = _this.props.fieldOverrides;
126
133
  var _a = _this.state, hiddenByFormula = _a.hiddenByFormula, isSaving = _a.isSaving, validationErrors = _a.validationErrors;
127
- // If the field is hidden by a formula, don't render it
128
- if (hiddenByFormula.find(function (h) { return h === field.columnInternalName; })) {
134
+ var styles = getFieldstyles(_this._classNames.subComponentStyles.fieldStyles(), { theme: theme });
135
+ // If the field is hidden by a formula or field doesn't exist (usually occurs in custom formatting section layout when field display name changed), don't render it
136
+ if (!field || hiddenByFormula.find(function (h) { return h === field.columnInternalName; })) {
129
137
  return null;
130
138
  }
131
139
  // If validation error, show error message
@@ -139,23 +147,23 @@ var DynamicForm = /** @class */ (function (_super) {
139
147
  return fieldOverrides[field.columnInternalName](__assign(__assign({}, field), { disabled: field.disabled || isSaving }));
140
148
  }
141
149
  // Default render
142
- return (React.createElement(DynamicField, __assign({ key: field.columnInternalName }, field, { disabled: field.disabled || isSaving, validationErrorMessage: validationErrorMessage })));
150
+ return (React.createElement(DynamicField, __assign({ key: field.columnInternalName, styles: styles }, field, { disabled: field.disabled || isSaving, validationErrorMessage: validationErrorMessage })));
143
151
  };
144
152
  /** Triggered when the user submits the form. */
145
153
  _this.onSubmitClick = function () { return __awaiter(_this, void 0, void 0, function () {
146
- var _a, listId, listItemId, onSubmitted, onBeforeSubmit, onSubmitError, enableFileSelection, validationErrorDialogProps, returnListItemInstanceOnSubmit, contentTypeId, fileSelectRendered, shouldBeReturnBack_1, fields, validationDisabled, validationErrors, objects, _loop_1, this_1, i, len, isCancelled, apiError, newETag, iur, error_1, contentTypeIdField, iar, error_2, idField, contentTypeIdField, library, folderFileName, folder, _b, newFolder, fields_2, folderId, iur, error_3, error_4;
147
- var _c, _d, _e, _f;
148
- return __generator(this, function (_g) {
149
- switch (_g.label) {
154
+ var _a, listId, listItemId, onSubmitted, onBeforeSubmit, onSubmitError, enableFileSelection, validationErrorDialogProps, returnListItemInstanceOnSubmit, useModernTaxonomyPicker, contentTypeId, fileSelectRendered, shouldBeReturnBack_1, fields, validationDisabled, validationErrors, objects, _loop_1, this_1, i, len, isCancelled, apiError, newETag, iur, error_1, contentTypeIdField, iar, error_2, idField, contentTypeIdField, library, folderFileName, folder, _b, newFolder, fields_2, folderId, iur, error_3, error_4;
155
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
156
+ return __generator(this, function (_m) {
157
+ switch (_m.label) {
150
158
  case 0:
151
- _a = this.props, listId = _a.listId, listItemId = _a.listItemId, onSubmitted = _a.onSubmitted, onBeforeSubmit = _a.onBeforeSubmit, onSubmitError = _a.onSubmitError, enableFileSelection = _a.enableFileSelection, validationErrorDialogProps = _a.validationErrorDialogProps, returnListItemInstanceOnSubmit = _a.returnListItemInstanceOnSubmit;
159
+ _a = this.props, listId = _a.listId, listItemId = _a.listItemId, onSubmitted = _a.onSubmitted, onBeforeSubmit = _a.onBeforeSubmit, onSubmitError = _a.onSubmitError, enableFileSelection = _a.enableFileSelection, validationErrorDialogProps = _a.validationErrorDialogProps, returnListItemInstanceOnSubmit = _a.returnListItemInstanceOnSubmit, useModernTaxonomyPicker = _a.useModernTaxonomyPicker;
152
160
  contentTypeId = this.props.contentTypeId;
153
161
  if (this.state.contentTypeId !== undefined)
154
162
  contentTypeId = this.state.contentTypeId;
155
163
  fileSelectRendered = !listItemId && contentTypeId.startsWith("0x0101") && enableFileSelection === true;
156
- _g.label = 1;
164
+ _m.label = 1;
157
165
  case 1:
158
- _g.trys.push([1, 33, , 34]);
166
+ _m.trys.push([1, 33, , 34]);
159
167
  shouldBeReturnBack_1 = false;
160
168
  fields = (this.state.fieldCollection || []).slice();
161
169
  fields.forEach(function (field) {
@@ -194,11 +202,11 @@ var DynamicForm = /** @class */ (function (_super) {
194
202
  if (!!validationDisabled) return [3 /*break*/, 3];
195
203
  return [4 /*yield*/, this.evaluateFormulas(this.state.validationFormulas, true, true, this.state.hiddenByFormula)];
196
204
  case 2:
197
- validationErrors = (_g.sent());
205
+ validationErrors = (_m.sent());
198
206
  if (Object.keys(validationErrors).length > 0) {
199
207
  shouldBeReturnBack_1 = true;
200
208
  }
201
- _g.label = 3;
209
+ _m.label = 3;
202
210
  case 3:
203
211
  // If validation failed, return without saving
204
212
  if (shouldBeReturnBack_1) {
@@ -222,8 +230,8 @@ var DynamicForm = /** @class */ (function (_super) {
222
230
  objects = {};
223
231
  _loop_1 = function (i, len) {
224
232
  var field, fieldType, additionalData, columnInternalName, hiddenFieldName, fieldcolumnInternalName, value_1, uploadedImage;
225
- return __generator(this, function (_h) {
226
- switch (_h.label) {
233
+ return __generator(this, function (_o) {
234
+ switch (_o.label) {
227
235
  case 0:
228
236
  field = fields[i];
229
237
  fieldType = field.fieldType, additionalData = field.additionalData, columnInternalName = field.columnInternalName, hiddenFieldName = field.hiddenFieldName;
@@ -271,18 +279,37 @@ var DynamicForm = /** @class */ (function (_super) {
271
279
  };
272
280
  }
273
281
  // Taxonomy / Managed Metadata fields
274
- if (fieldType === "TaxonomyFieldType") {
275
- objects[fieldcolumnInternalName] = {
276
- __metadata: { type: "SP.Taxonomy.TaxonomyFieldValue" },
277
- Label: (_d = (_c = value_1[0]) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "",
278
- TermGuid: (_f = (_e = value_1[0]) === null || _e === void 0 ? void 0 : _e.key) !== null && _f !== void 0 ? _f : "11111111-1111-1111-1111-111111111111",
279
- WssId: "-1",
280
- };
282
+ if (useModernTaxonomyPicker) {
283
+ //Use ITermInfo[] for modern taxonomy picker
284
+ if (fieldType === "TaxonomyFieldType") {
285
+ objects[fieldcolumnInternalName] = {
286
+ __metadata: { type: "SP.Taxonomy.TaxonomyFieldValue" },
287
+ Label: (_e = (_d = (_c = value_1[0]) === null || _c === void 0 ? void 0 : _c.labels[0]) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : "",
288
+ TermGuid: (_g = (_f = value_1[0]) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : "11111111-1111-1111-1111-111111111111",
289
+ WssId: "-1",
290
+ };
291
+ }
292
+ if (fieldType === "TaxonomyFieldTypeMulti") {
293
+ objects[hiddenFieldName] = field.newValue
294
+ .map(function (term) { var _a; return "-1#;".concat(((_a = term.labels[0]) === null || _a === void 0 ? void 0 : _a.name) || "", "|").concat(term.id, ";"); })
295
+ .join("#");
296
+ }
281
297
  }
282
- if (fieldType === "TaxonomyFieldTypeMulti") {
283
- objects[hiddenFieldName] = field.newValue
284
- .map(function (term) { return "-1#;".concat(term.name, "|").concat(term.key, ";"); })
285
- .join("#");
298
+ else {
299
+ //Use IPickerTerms
300
+ if (fieldType === "TaxonomyFieldType") {
301
+ objects[fieldcolumnInternalName] = {
302
+ __metadata: { type: "SP.Taxonomy.TaxonomyFieldValue" },
303
+ Label: (_j = (_h = value_1[0]) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : "",
304
+ TermGuid: (_l = (_k = value_1[0]) === null || _k === void 0 ? void 0 : _k.key) !== null && _l !== void 0 ? _l : "11111111-1111-1111-1111-111111111111",
305
+ WssId: "-1",
306
+ };
307
+ }
308
+ if (fieldType === "TaxonomyFieldTypeMulti") {
309
+ objects[hiddenFieldName] = field.newValue
310
+ .map(function (term) { return "-1#;".concat(term.name, "|").concat(term.key, ";"); })
311
+ .join("#");
312
+ }
286
313
  }
287
314
  // Other fields
288
315
  if (fieldType === "Location") {
@@ -292,7 +319,7 @@ var DynamicForm = /** @class */ (function (_super) {
292
319
  if (!additionalData) return [3 /*break*/, 2];
293
320
  return [4 /*yield*/, this_1.uploadImage(additionalData)];
294
321
  case 1:
295
- uploadedImage = _h.sent();
322
+ uploadedImage = _o.sent();
296
323
  objects[fieldcolumnInternalName] = JSON.stringify({
297
324
  type: "thumbnail",
298
325
  fileName: uploadedImage.Name,
@@ -302,20 +329,20 @@ var DynamicForm = /** @class */ (function (_super) {
302
329
  return [3 /*break*/, 3];
303
330
  case 2:
304
331
  objects[fieldcolumnInternalName] = null;
305
- _h.label = 3;
332
+ _o.label = 3;
306
333
  case 3: return [2 /*return*/];
307
334
  }
308
335
  });
309
336
  };
310
337
  this_1 = this;
311
338
  i = 0, len = fields.length;
312
- _g.label = 4;
339
+ _m.label = 4;
313
340
  case 4:
314
341
  if (!(i < len)) return [3 /*break*/, 7];
315
342
  return [5 /*yield**/, _loop_1(i, len)];
316
343
  case 5:
317
- _g.sent();
318
- _g.label = 6;
344
+ _m.sent();
345
+ _m.label = 6;
319
346
  case 6:
320
347
  i++;
321
348
  return [3 /*break*/, 4];
@@ -323,27 +350,27 @@ var DynamicForm = /** @class */ (function (_super) {
323
350
  if (!onBeforeSubmit) return [3 /*break*/, 9];
324
351
  return [4 /*yield*/, onBeforeSubmit(objects)];
325
352
  case 8:
326
- isCancelled = _g.sent();
353
+ isCancelled = _m.sent();
327
354
  if (isCancelled) {
328
355
  this.setState({
329
356
  isSaving: false,
330
357
  });
331
358
  return [2 /*return*/];
332
359
  }
333
- _g.label = 9;
360
+ _m.label = 9;
334
361
  case 9:
335
362
  apiError = void 0;
336
363
  newETag = undefined;
337
364
  if (!listItemId) return [3 /*break*/, 14];
338
- _g.label = 10;
365
+ _m.label = 10;
339
366
  case 10:
340
- _g.trys.push([10, 12, , 13]);
367
+ _m.trys.push([10, 12, , 13]);
341
368
  return [4 /*yield*/, sp.web.lists
342
369
  .getById(listId)
343
370
  .items.getById(listItemId)
344
371
  .update(objects, this.state.etag)];
345
372
  case 11:
346
- iur = _g.sent();
373
+ iur = _m.sent();
347
374
  newETag = iur.data["odata.etag"];
348
375
  if (onSubmitted) {
349
376
  onSubmitted(iur.data, returnListItemInstanceOnSubmit !== false
@@ -352,7 +379,7 @@ var DynamicForm = /** @class */ (function (_super) {
352
379
  }
353
380
  return [3 /*break*/, 13];
354
381
  case 12:
355
- error_1 = _g.sent();
382
+ error_1 = _m.sent();
356
383
  apiError = error_1.message;
357
384
  if (onSubmitError) {
358
385
  onSubmitError(objects, error_1);
@@ -368,17 +395,17 @@ var DynamicForm = /** @class */ (function (_super) {
368
395
  if (!(fileSelectRendered === true)) return [3 /*break*/, 16];
369
396
  return [4 /*yield*/, this.addFileToLibrary(objects)];
370
397
  case 15:
371
- _g.sent();
398
+ _m.sent();
372
399
  return [3 /*break*/, 19];
373
400
  case 16:
374
- _g.trys.push([16, 18, , 19]);
401
+ _m.trys.push([16, 18, , 19]);
375
402
  contentTypeIdField = "ContentTypeId";
376
403
  // check if item contenttype is passed, then update the object with content type id, else, pass the object
377
404
  if (contentTypeId !== undefined && contentTypeId.startsWith("0x01"))
378
405
  objects[contentTypeIdField] = contentTypeId;
379
406
  return [4 /*yield*/, sp.web.lists.getById(listId).items.add(objects)];
380
407
  case 17:
381
- iar = _g.sent();
408
+ iar = _m.sent();
382
409
  if (onSubmitted) {
383
410
  onSubmitted(iar.data, this.props.returnListItemInstanceOnSubmit !== false
384
411
  ? iar.item
@@ -386,7 +413,7 @@ var DynamicForm = /** @class */ (function (_super) {
386
413
  }
387
414
  return [3 /*break*/, 19];
388
415
  case 18:
389
- error_2 = _g.sent();
416
+ error_2 = _m.sent();
390
417
  apiError = error_2.message;
391
418
  if (onSubmitError) {
392
419
  onSubmitError(objects, error_2);
@@ -396,37 +423,37 @@ var DynamicForm = /** @class */ (function (_super) {
396
423
  case 19: return [3 /*break*/, 32];
397
424
  case 20:
398
425
  if (!contentTypeId.startsWith("0x0120")) return [3 /*break*/, 32];
399
- _g.label = 21;
426
+ _m.label = 21;
400
427
  case 21:
401
- _g.trys.push([21, 31, , 32]);
428
+ _m.trys.push([21, 31, , 32]);
402
429
  idField = "ID";
403
430
  contentTypeIdField = "ContentTypeId";
404
431
  return [4 /*yield*/, sp.web.lists.getById(listId)];
405
432
  case 22:
406
- library = _g.sent();
433
+ library = _m.sent();
407
434
  folderFileName = this.getFolderName(objects);
408
435
  if (!!this.props.folderPath) return [3 /*break*/, 23];
409
436
  _b = library.rootFolder;
410
437
  return [3 /*break*/, 25];
411
438
  case 23: return [4 /*yield*/, this.getFolderByPath(this.props.folderPath, library.rootFolder)];
412
439
  case 24:
413
- _b = _g.sent();
414
- _g.label = 25;
440
+ _b = _m.sent();
441
+ _m.label = 25;
415
442
  case 25:
416
443
  folder = _b;
417
444
  return [4 /*yield*/, folder.addSubFolderUsingPath(folderFileName)];
418
445
  case 26:
419
- newFolder = _g.sent();
446
+ newFolder = _m.sent();
420
447
  return [4 /*yield*/, newFolder.listItemAllFields()];
421
448
  case 27:
422
- fields_2 = _g.sent();
449
+ fields_2 = _m.sent();
423
450
  if (!fields_2[idField]) return [3 /*break*/, 29];
424
451
  folderId = fields_2[idField];
425
452
  // Set the content type ID for the target item
426
453
  objects[contentTypeIdField] = contentTypeId;
427
454
  return [4 /*yield*/, this.updateListItemRetry(library, folderId, objects)];
428
455
  case 28:
429
- iur = _g.sent();
456
+ iur = _m.sent();
430
457
  if (onSubmitted) {
431
458
  onSubmitted(iur.data, this.props.returnListItemInstanceOnSubmit !== false
432
459
  ? iur.item
@@ -436,7 +463,7 @@ var DynamicForm = /** @class */ (function (_super) {
436
463
  case 29: throw new Error("Unable to read the ID of the just created folder or Document Set");
437
464
  case 30: return [3 /*break*/, 32];
438
465
  case 31:
439
- error_3 = _g.sent();
466
+ error_3 = _m.sent();
440
467
  apiError = error_3.message;
441
468
  if (onSubmitError) {
442
469
  onSubmitError(objects, error_3);
@@ -451,7 +478,7 @@ var DynamicForm = /** @class */ (function (_super) {
451
478
  });
452
479
  return [3 /*break*/, 34];
453
480
  case 33:
454
- error_4 = _g.sent();
481
+ error_4 = _m.sent();
455
482
  if (onSubmitError) {
456
483
  onSubmitError(null, error_4);
457
484
  }
@@ -533,7 +560,7 @@ var DynamicForm = /** @class */ (function (_super) {
533
560
  _this.onChange = function (internalName,
534
561
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
535
562
  newValue, validate, additionalData) { return __awaiter(_this, void 0, void 0, function () {
536
- var fieldCol, field, user, result, emails, index, element, user, result, validationErrors;
563
+ var fieldCol, field, useModernTaxonomyPicker, user, result, emails, index, element, user, result, validationErrors;
537
564
  var _this = this;
538
565
  return __generator(this, function (_a) {
539
566
  switch (_a.label) {
@@ -542,6 +569,7 @@ var DynamicForm = /** @class */ (function (_super) {
542
569
  field = fieldCol.filter(function (element, i) {
543
570
  return element.columnInternalName === internalName;
544
571
  })[0];
572
+ useModernTaxonomyPicker = this.props.useModernTaxonomyPicker;
545
573
  // Init new value(s)
546
574
  field.newValue = newValue;
547
575
  field.stringValue = newValue.toString();
@@ -557,8 +585,20 @@ var DynamicForm = /** @class */ (function (_super) {
557
585
  if (field.fieldType === "Lookup" || field.fieldType === "LookupMulti") {
558
586
  field.stringValue = newValue.map(function (nv) { return nv.key + ';#' + nv.name; }).join(';#');
559
587
  }
560
- if (field.fieldType === "TaxonomyFieldType" || field.fieldType === "TaxonomyFieldTypeMulti") {
561
- field.stringValue = newValue.map(function (nv) { return nv.name; }).join(';');
588
+ if (useModernTaxonomyPicker) {
589
+ if (field.fieldType === "TaxonomyFieldType" || field.fieldType === "TaxonomyFieldTypeMulti") {
590
+ if (Array.isArray(newValue) && newValue.length > 0) {
591
+ field.stringValue = newValue.map(function (nv) { return nv.labels.map(function (label) { return label.name; }).join(';'); }).join(';');
592
+ }
593
+ else {
594
+ field.stringValue = "";
595
+ }
596
+ }
597
+ }
598
+ else {
599
+ if (field.fieldType === "TaxonomyFieldType" || field.fieldType === "TaxonomyFieldTypeMulti") {
600
+ field.stringValue = newValue.map(function (nv) { return nv.name; }).join(';');
601
+ }
562
602
  }
563
603
  if (!(field.fieldType === "User" && newValue.length !== 0)) return [3 /*break*/, 3];
564
604
  if (!(newValue[0].id === undefined ||
@@ -752,21 +792,21 @@ var DynamicForm = /** @class */ (function (_super) {
752
792
  _this.getListInformation = function () { return __awaiter(_this, void 0, void 0, function () {
753
793
  var _a, listId, listItemId, disabledFields, respectETag, customIcons, onListItemLoaded, contentTypeId, listInfo, additionalInfo, numberFields, validationFormulas, contentTypeName, clientValidationFormulas, headerJSON, footerJSON, bodySections, customFormatInfo, spList, item, isEditingItem, etag, spListItem, tempFields, sortedFields, installedLanguages, error_6;
754
794
  var _this = this;
755
- var _b;
756
- return __generator(this, function (_c) {
757
- switch (_c.label) {
795
+ var _b, _c;
796
+ return __generator(this, function (_d) {
797
+ switch (_d.label) {
758
798
  case 0:
759
799
  _a = this.props, listId = _a.listId, listItemId = _a.listItemId, disabledFields = _a.disabledFields, respectETag = _a.respectETag, customIcons = _a.customIcons, onListItemLoaded = _a.onListItemLoaded;
760
800
  contentTypeId = this.props.contentTypeId;
761
- _c.label = 1;
801
+ _d.label = 1;
762
802
  case 1:
763
- _c.trys.push([1, 11, , 12]);
803
+ _d.trys.push([1, 11, , 12]);
764
804
  return [4 /*yield*/, this._spService.getListFormRenderInfo(listId, this.webURL)];
765
805
  case 2:
766
- listInfo = _c.sent();
806
+ listInfo = _d.sent();
767
807
  return [4 /*yield*/, this._spService.getAdditionalListFormFieldInfo(listId, this.webURL)];
768
808
  case 3:
769
- additionalInfo = _c.sent();
809
+ additionalInfo = _d.sent();
770
810
  numberFields = additionalInfo.filter(function (f) { return f.TypeAsString === "Number" || f.TypeAsString === "Currency"; });
771
811
  validationFormulas = additionalInfo.reduce(function (prev, cur) {
772
812
  if (!prev[cur.InternalName] && cur.ValidationFormula) {
@@ -795,7 +835,7 @@ var DynamicForm = /** @class */ (function (_super) {
795
835
  bodySections = void 0;
796
836
  if (listInfo.ClientFormCustomFormatter && listInfo.ClientFormCustomFormatter[contentTypeId]) {
797
837
  customFormatInfo = JSON.parse(listInfo.ClientFormCustomFormatter[contentTypeId]);
798
- bodySections = customFormatInfo.bodyJSONFormatter.sections;
838
+ bodySections = (_b = customFormatInfo.bodyJSONFormatter) === null || _b === void 0 ? void 0 : _b.sections;
799
839
  headerJSON = customFormatInfo.headerJSONFormatter;
800
840
  footerJSON = customFormatInfo.footerJSONFormatter;
801
841
  }
@@ -810,29 +850,29 @@ var DynamicForm = /** @class */ (function (_super) {
810
850
  }
811
851
  return [4 /*yield*/, spListItem.get().catch(function (err) { return _this.updateFormMessages(MessageBarType.error, err.message); })];
812
852
  case 4:
813
- item = _c.sent();
853
+ item = _d.sent();
814
854
  if (!onListItemLoaded) return [3 /*break*/, 6];
815
855
  return [4 /*yield*/, onListItemLoaded(item)];
816
856
  case 5:
817
- _c.sent();
818
- _c.label = 6;
857
+ _d.sent();
858
+ _d.label = 6;
819
859
  case 6:
820
860
  if (respectETag !== false) {
821
861
  etag = item["odata.etag"];
822
862
  }
823
- _c.label = 7;
863
+ _d.label = 7;
824
864
  case 7: return [4 /*yield*/, this.buildFieldCollection(listInfo, contentTypeName, item, numberFields, listId, listItemId, disabledFields, customIcons)];
825
865
  case 8:
826
- tempFields = _c.sent();
827
- sortedFields = ((_b = this.props.fieldOrder) === null || _b === void 0 ? void 0 : _b.length) > 0
866
+ tempFields = _d.sent();
867
+ sortedFields = ((_c = this.props.fieldOrder) === null || _c === void 0 ? void 0 : _c.length) > 0
828
868
  ? this.sortFields(tempFields, this.props.fieldOrder)
829
869
  : tempFields;
830
870
  installedLanguages = void 0;
831
871
  if (!(tempFields.filter(function (f) { return f.fieldType === "Currency"; }).length > 0)) return [3 /*break*/, 10];
832
872
  return [4 /*yield*/, sp.web.regionalSettings.getInstalledLanguages()];
833
873
  case 9:
834
- installedLanguages = _c.sent();
835
- _c.label = 10;
874
+ installedLanguages = _d.sent();
875
+ _d.label = 10;
836
876
  case 10:
837
877
  this.setState({
838
878
  contentTypeId: contentTypeId,
@@ -849,7 +889,7 @@ var DynamicForm = /** @class */ (function (_super) {
849
889
  }, function () { return _this.performValidation(true); });
850
890
  return [3 /*break*/, 12];
851
891
  case 11:
852
- error_6 = _c.sent();
892
+ error_6 = _d.sent();
853
893
  this.updateFormMessages(MessageBarType.error, 'An error occurred while loading: ' + error_6.message);
854
894
  console.error("An error occurred while loading DynamicForm", error_6);
855
895
  return [2 /*return*/, null];
@@ -857,6 +897,68 @@ var DynamicForm = /** @class */ (function (_super) {
857
897
  }
858
898
  });
859
899
  }); };
900
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
901
+ _this.getTermsForModernTaxonomyPicker = function (termsetId, terms) { return __awaiter(_this, void 0, void 0, function () {
902
+ var selectedTerms;
903
+ var _this = this;
904
+ return __generator(this, function (_a) {
905
+ switch (_a.label) {
906
+ case 0:
907
+ if (!terms || terms.length === 0) {
908
+ return [2 /*return*/, []];
909
+ }
910
+ return [4 /*yield*/, Promise.all(
911
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
912
+ terms.map(function (fetchedterm) { return __awaiter(_this, void 0, void 0, function () {
913
+ var response, error_7;
914
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
915
+ return __generator(this, function (_v) {
916
+ switch (_v.label) {
917
+ case 0:
918
+ if (!(fetchedterm === null || fetchedterm === void 0 ? void 0 : fetchedterm.TermGuid)) {
919
+ console.error("Error: TermGuid is undefined for term", fetchedterm);
920
+ return [2 /*return*/, null];
921
+ }
922
+ _v.label = 1;
923
+ case 1:
924
+ _v.trys.push([1, 3, , 4]);
925
+ return [4 /*yield*/, this._taxonomyService.getTermById(Guid.parse(termsetId), Guid.parse(fetchedterm.TermGuid))];
926
+ case 2:
927
+ response = _v.sent();
928
+ return [2 /*return*/, {
929
+ id: response.id,
930
+ labels: [
931
+ {
932
+ name: (_c = (_b = (_a = response.labels) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : fetchedterm.Label,
933
+ isDefault: (_f = (_e = (_d = response.labels) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.isDefault) !== null && _f !== void 0 ? _f : true,
934
+ languageTag: (_j = (_h = (_g = response.labels) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.languageTag) !== null && _j !== void 0 ? _j : "en-US",
935
+ },
936
+ ],
937
+ childrenCount: (_k = response.childrenCount) !== null && _k !== void 0 ? _k : 0,
938
+ createdDateTime: (_l = response.createdDateTime) !== null && _l !== void 0 ? _l : new Date().toISOString(),
939
+ lastModifiedDateTime: (_m = response.lastModifiedDateTime) !== null && _m !== void 0 ? _m : new Date().toISOString(),
940
+ descriptions: (_o = response.descriptions) !== null && _o !== void 0 ? _o : [],
941
+ customSortOrder: (_p = response.customSortOrder) !== null && _p !== void 0 ? _p : [],
942
+ properties: (_q = response.properties) !== null && _q !== void 0 ? _q : [],
943
+ localProperties: (_r = response.localProperties) !== null && _r !== void 0 ? _r : [],
944
+ isDeprecated: (_s = response.isDeprecated) !== null && _s !== void 0 ? _s : false,
945
+ isAvailableForTagging: (_t = response.isAvailableForTagging) !== null && _t !== void 0 ? _t : [],
946
+ topicRequested: (_u = response.topicRequested) !== null && _u !== void 0 ? _u : false,
947
+ }];
948
+ case 3:
949
+ error_7 = _v.sent();
950
+ console.error("Error fetching term ".concat(fetchedterm.TermGuid, ":"), error_7);
951
+ return [2 /*return*/, null];
952
+ case 4: return [2 /*return*/];
953
+ }
954
+ });
955
+ }); }))];
956
+ case 1:
957
+ selectedTerms = _a.sent();
958
+ return [2 /*return*/, selectedTerms.filter(function (term) { return term !== null; })];
959
+ }
960
+ });
961
+ }); };
860
962
  _this.uploadImage = function (file) { return __awaiter(_this, void 0, void 0, function () {
861
963
  var _a, listId, listItemId, fileInstance, buffer;
862
964
  return __generator(this, function (_b) {
@@ -913,6 +1015,7 @@ var DynamicForm = /** @class */ (function (_super) {
913
1015
  _this.renderFileSelectionControl = function () {
914
1016
  var _a;
915
1017
  var _b = _this.state, selectedFile = _b.selectedFile, missingSelectedFile = _b.missingSelectedFile;
1018
+ var styles = getFieldstyles(_this._classNames.subComponentStyles.fieldStyles(), { theme: theme });
916
1019
  var labelEl = React.createElement("label", { className: styles.fieldRequired + ' ' + styles.fieldLabel }, strings.DynamicFormChooseFileLabel);
917
1020
  return React.createElement("div", null,
918
1021
  React.createElement("div", { className: styles.titleContainer },
@@ -1013,7 +1116,7 @@ var DynamicForm = /** @class */ (function (_super) {
1013
1116
  _this.updateListItemRetry = function (list, itemId, objects, retry) {
1014
1117
  if (retry === void 0) { retry = 0; }
1015
1118
  return __awaiter(_this, void 0, void 0, function () {
1016
- var error_7;
1119
+ var error_8;
1017
1120
  return __generator(this, function (_a) {
1018
1121
  switch (_a.label) {
1019
1122
  case 0:
@@ -1021,14 +1124,14 @@ var DynamicForm = /** @class */ (function (_super) {
1021
1124
  return [4 /*yield*/, list.items.getById(itemId).update(objects)];
1022
1125
  case 1: return [2 /*return*/, _a.sent()];
1023
1126
  case 2:
1024
- error_7 = _a.sent();
1025
- if (!(error_7.status === 409 && retry < 3)) return [3 /*break*/, 5];
1127
+ error_8 = _a.sent();
1128
+ if (!(error_8.status === 409 && retry < 3)) return [3 /*break*/, 5];
1026
1129
  return [4 /*yield*/, timeout(100)];
1027
1130
  case 3:
1028
1131
  _a.sent();
1029
1132
  return [4 /*yield*/, this.updateListItemRetry(list, itemId, objects, retry + 1)];
1030
1133
  case 4: return [2 /*return*/, _a.sent()];
1031
- case 5: throw error_7;
1134
+ case 5: throw error_8;
1032
1135
  case 6: return [2 /*return*/];
1033
1136
  }
1034
1137
  });
@@ -1050,6 +1153,8 @@ var DynamicForm = /** @class */ (function (_super) {
1050
1153
  spfxContext: { pageContext: _this.props.context.pageContext },
1051
1154
  });
1052
1155
  }
1156
+ // Initialize taxonomy service
1157
+ _this._taxonomyService = new SPTaxonomyService(_this.props.context);
1053
1158
  // Initialize state
1054
1159
  _this.state = {
1055
1160
  infoErrorMessages: [],
@@ -1073,7 +1178,7 @@ var DynamicForm = /** @class */ (function (_super) {
1073
1178
  /**
1074
1179
  * Lifecycle hook when component is mounted
1075
1180
  */
1076
- DynamicForm.prototype.componentDidMount = function () {
1181
+ DynamicFormBase.prototype.componentDidMount = function () {
1077
1182
  this.getListInformation()
1078
1183
  .then(function () {
1079
1184
  /* no-op; */
@@ -1083,7 +1188,7 @@ var DynamicForm = /** @class */ (function (_super) {
1083
1188
  console.error(err);
1084
1189
  });
1085
1190
  };
1086
- DynamicForm.prototype.componentDidUpdate = function (prevProps, prevState) {
1191
+ DynamicFormBase.prototype.componentDidUpdate = function (prevProps, prevState) {
1087
1192
  var _this = this;
1088
1193
  if (!isEqual(prevProps, this.props)) {
1089
1194
  // Props have changed due to parent component or workbench config, reset state
@@ -1111,15 +1216,17 @@ var DynamicForm = /** @class */ (function (_super) {
1111
1216
  /**
1112
1217
  * Default React component render method
1113
1218
  */
1114
- DynamicForm.prototype.render = function () {
1219
+ DynamicFormBase.prototype.render = function () {
1115
1220
  var _a;
1116
1221
  var _this = this;
1117
1222
  var _b = this.state, customFormatting = _b.customFormatting, fieldCollection = _b.fieldCollection, hiddenByFormula = _b.hiddenByFormula, infoErrorMessages = _b.infoErrorMessages, isSaving = _b.isSaving;
1118
1223
  var customFormattingDisabled = this.props.useCustomFormatting === false;
1224
+ var className = this.props.className;
1225
+ var styles = (this._classNames = getstyles(this.props.styles, { className: className }));
1119
1226
  // Custom Formatting - Header
1120
1227
  var headerContent;
1121
1228
  if (!customFormattingDisabled && (customFormatting === null || customFormatting === void 0 ? void 0 : customFormatting.header)) {
1122
- headerContent = this._customFormatter.renderCustomFormatContent(customFormatting.header, this.getFormValuesForValidation(), true);
1229
+ headerContent = React.createElement("div", { className: styles.header }, this._customFormatter.renderCustomFormatContent(customFormatting.header, this.getFormValuesForValidation(), true));
1123
1230
  }
1124
1231
  // Custom Formatting - Body
1125
1232
  var bodySections = [];
@@ -1137,7 +1244,7 @@ var DynamicForm = /** @class */ (function (_super) {
1137
1244
  // Custom Formatting - Footer
1138
1245
  var footerContent;
1139
1246
  if (!customFormattingDisabled && (customFormatting === null || customFormatting === void 0 ? void 0 : customFormatting.footer)) {
1140
- footerContent = this._customFormatter.renderCustomFormatContent(customFormatting.footer, this.getFormValuesForValidation(), true);
1247
+ footerContent = React.createElement("div", { className: styles.footer }, this._customFormatter.renderCustomFormatContent(customFormatting.footer, this.getFormValuesForValidation(), true));
1141
1248
  }
1142
1249
  // Content Type
1143
1250
  var contentTypeId = this.props.contentTypeId;
@@ -1178,7 +1285,7 @@ var DynamicForm = /** @class */ (function (_super) {
1178
1285
  React.createElement("div", { className: "ms-Dialog-actionsRight ".concat(styles.actionsRight) },
1179
1286
  React.createElement(DefaultButton, { className: styles.action, onClick: this.closeValidationErrorDialog, text: strings.CloseButton }))))));
1180
1287
  };
1181
- DynamicForm.prototype.updateFormMessages = function (type, message) {
1288
+ DynamicFormBase.prototype.updateFormMessages = function (type, message) {
1182
1289
  var infoErrorMessages = this.state.infoErrorMessages;
1183
1290
  var newMessages = infoErrorMessages.slice();
1184
1291
  newMessages.push({ type: type, message: message });
@@ -1196,24 +1303,25 @@ var DynamicForm = /** @class */ (function (_super) {
1196
1303
  * @returns
1197
1304
  */
1198
1305
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1199
- DynamicForm.prototype.buildFieldCollection = function (listInfo, contentTypeName, item, numberFields, listId, listItemId, disabledFields, customIcons) {
1306
+ DynamicFormBase.prototype.buildFieldCollection = function (listInfo, contentTypeName, item, numberFields, listId, listItemId, disabledFields, customIcons) {
1200
1307
  return __awaiter(this, void 0, void 0, function () {
1201
- var tempFields, order, hiddenFields, defaultDayOfWeek, _loop_3, this_2, i, len;
1308
+ var useModernTaxonomyPicker, tempFields, order, hiddenFields, defaultDayOfWeek, _loop_3, this_2, i, len;
1202
1309
  return __generator(this, function (_a) {
1203
1310
  switch (_a.label) {
1204
1311
  case 0:
1312
+ useModernTaxonomyPicker = this.props.useModernTaxonomyPicker;
1205
1313
  tempFields = [];
1206
1314
  order = 0;
1207
1315
  hiddenFields = this.props.hiddenFields !== undefined ? this.props.hiddenFields : [];
1208
1316
  defaultDayOfWeek = 0;
1209
1317
  _loop_3 = function (i, len) {
1210
- var field, hiddenName, termSetId, anchorId, lookupListId, lookupField, choices_1, defaultValue, value, stringValue, subPropertyValues, richText, dateFormat, principalType, cultureName, minValue, maxValue, showAsPercentage, selectedTags_1, fieldName, numberField, userEmails, _b, _c, response;
1318
+ var field, hiddenName, termSetId, anchorId, lookupListId, lookupField, choices_1, defaultValue, value, stringValue, subPropertyValues, richText, dateFormat, principalType, cultureName, minValue, maxValue, showAsPercentage, selectedTags_1, fieldName, numberField, userEmails, _b, _c, response, term, _selectedTags, response;
1211
1319
  return __generator(this, function (_d) {
1212
1320
  switch (_d.label) {
1213
1321
  case 0:
1214
1322
  field = listInfo.ClientForms.Edit[contentTypeName][i];
1215
- if (!(hiddenFields.indexOf(field.InternalName) < 0)) return [3 /*break*/, 18];
1216
- if (!(field.Hidden === false)) return [3 /*break*/, 18];
1323
+ if (!(hiddenFields.indexOf(field.InternalName) < 0)) return [3 /*break*/, 30];
1324
+ if (!(field.Hidden === false)) return [3 /*break*/, 30];
1217
1325
  order++;
1218
1326
  hiddenName = "";
1219
1327
  termSetId = "";
@@ -1325,12 +1433,82 @@ var DynamicForm = /** @class */ (function (_super) {
1325
1433
  principalType = field.PrincipalAccountType;
1326
1434
  _d.label = 11;
1327
1435
  case 11:
1328
- if (!(field.FieldType === "TaxonomyFieldType")) return [3 /*break*/, 15];
1436
+ if (!useModernTaxonomyPicker) return [3 /*break*/, 22];
1437
+ if (!(field.FieldType === "TaxonomyFieldType")) return [3 /*break*/, 17];
1329
1438
  termSetId = field.TermSetId;
1330
- anchorId = field.AnchorId;
1331
- if (!(item !== null)) return [3 /*break*/, 13];
1439
+ anchorId = field.AnchorId !== Guid.empty.toString() ? field.AnchorId : null;
1440
+ if (!(item !== null)) return [3 /*break*/, 15];
1332
1441
  return [4 /*yield*/, this_2._spService.getSingleManagedMetadataLabel(listId, listItemId, field.InternalName, this_2.webURL)];
1333
1442
  case 12:
1443
+ response = _d.sent();
1444
+ if (!response) return [3 /*break*/, 14];
1445
+ return [4 /*yield*/, this_2._taxonomyService.getTermById(Guid.parse(field.TermSetId), Guid.parse(response.TermID))];
1446
+ case 13:
1447
+ term = _d.sent();
1448
+ selectedTags_1.push({
1449
+ key: response.TermID,
1450
+ name: response.Label,
1451
+ });
1452
+ value = term; //selectedTags;
1453
+ stringValue = selectedTags_1 === null || selectedTags_1 === void 0 ? void 0 : selectedTags_1.map(function (dv) { return dv.key + ';#' + dv.name; }).join(';#');
1454
+ _d.label = 14;
1455
+ case 14: return [3 /*break*/, 16];
1456
+ case 15:
1457
+ if (defaultValue !== "") {
1458
+ selectedTags_1.push({
1459
+ key: defaultValue.split("|")[1],
1460
+ name: defaultValue.split("|")[0].split("#")[1],
1461
+ });
1462
+ value = selectedTags_1;
1463
+ }
1464
+ _d.label = 16;
1465
+ case 16:
1466
+ if (defaultValue === "")
1467
+ defaultValue = null;
1468
+ _d.label = 17;
1469
+ case 17:
1470
+ if (!(field.FieldType === "TaxonomyFieldTypeMulti")) return [3 /*break*/, 21];
1471
+ hiddenName = field.HiddenListInternalName;
1472
+ termSetId = field.TermSetId;
1473
+ anchorId = field.AnchorId !== Guid.empty.toString() ? field.AnchorId : null;
1474
+ if (!(item && item[field.InternalName])) return [3 /*break*/, 19];
1475
+ return [4 /*yield*/, this_2.getTermsForModernTaxonomyPicker(field.TermSetId, item[field.InternalName])];
1476
+ case 18:
1477
+ _selectedTags = _d.sent();
1478
+ item[field.InternalName].forEach(function (element) {
1479
+ selectedTags_1.push({
1480
+ key: element.TermGuid,
1481
+ name: element.Label,
1482
+ });
1483
+ });
1484
+ //value = selectedTags; _selectedTags
1485
+ value = _selectedTags;
1486
+ return [3 /*break*/, 20];
1487
+ case 19:
1488
+ if (defaultValue && defaultValue !== "") {
1489
+ defaultValue.split(/#|;/).forEach(function (element) {
1490
+ if (element.indexOf("|") !== -1)
1491
+ selectedTags_1.push({
1492
+ key: element.split("|")[1],
1493
+ name: element.split("|")[0],
1494
+ });
1495
+ });
1496
+ value = selectedTags_1;
1497
+ stringValue = selectedTags_1 === null || selectedTags_1 === void 0 ? void 0 : selectedTags_1.map(function (dv) { return dv.key + ';#' + dv.name; }).join(';#');
1498
+ }
1499
+ _d.label = 20;
1500
+ case 20:
1501
+ if (defaultValue === "")
1502
+ defaultValue = null;
1503
+ _d.label = 21;
1504
+ case 21: return [3 /*break*/, 27];
1505
+ case 22:
1506
+ if (!(field.FieldType === "TaxonomyFieldType")) return [3 /*break*/, 26];
1507
+ termSetId = field.TermSetId;
1508
+ anchorId = field.AnchorId;
1509
+ if (!(item !== null)) return [3 /*break*/, 24];
1510
+ return [4 /*yield*/, this_2._spService.getSingleManagedMetadataLabel(listId, listItemId, field.InternalName, this_2.webURL)];
1511
+ case 23:
1334
1512
  response = _d.sent();
1335
1513
  if (response) {
1336
1514
  selectedTags_1.push({
@@ -1340,8 +1518,8 @@ var DynamicForm = /** @class */ (function (_super) {
1340
1518
  value = selectedTags_1;
1341
1519
  stringValue = selectedTags_1 === null || selectedTags_1 === void 0 ? void 0 : selectedTags_1.map(function (dv) { return dv.key + ';#' + dv.name; }).join(';#');
1342
1520
  }
1343
- return [3 /*break*/, 14];
1344
- case 13:
1521
+ return [3 /*break*/, 25];
1522
+ case 24:
1345
1523
  if (defaultValue !== "") {
1346
1524
  selectedTags_1.push({
1347
1525
  key: defaultValue.split("|")[1],
@@ -1349,12 +1527,12 @@ var DynamicForm = /** @class */ (function (_super) {
1349
1527
  });
1350
1528
  value = selectedTags_1;
1351
1529
  }
1352
- _d.label = 14;
1353
- case 14:
1530
+ _d.label = 25;
1531
+ case 25:
1354
1532
  if (defaultValue === "")
1355
1533
  defaultValue = null;
1356
- _d.label = 15;
1357
- case 15:
1534
+ _d.label = 26;
1535
+ case 26:
1358
1536
  if (field.FieldType === "TaxonomyFieldTypeMulti") {
1359
1537
  hiddenName = field.HiddenListInternalName;
1360
1538
  termSetId = field.TermSetId;
@@ -1378,13 +1556,27 @@ var DynamicForm = /** @class */ (function (_super) {
1378
1556
  });
1379
1557
  });
1380
1558
  value = selectedTags_1;
1381
- stringValue = selectedTags_1 === null || selectedTags_1 === void 0 ? void 0 : selectedTags_1.map(function (dv) { return dv.key + ';#' + dv.name; }).join(';#');
1382
1559
  }
1560
+ else {
1561
+ if (defaultValue && defaultValue !== "") {
1562
+ defaultValue.split(/#|;/).forEach(function (element) {
1563
+ if (element.indexOf("|") !== -1)
1564
+ selectedTags_1.push({
1565
+ key: element.split("|")[1],
1566
+ name: element.split("|")[0],
1567
+ });
1568
+ });
1569
+ value = selectedTags_1;
1570
+ stringValue = selectedTags_1 === null || selectedTags_1 === void 0 ? void 0 : selectedTags_1.map(function (dv) { return dv.key + ';#' + dv.name; }).join(';#');
1571
+ }
1572
+ }
1573
+ if (defaultValue === "")
1574
+ defaultValue = null;
1383
1575
  }
1384
- if (defaultValue === "")
1385
- defaultValue = null;
1386
1576
  }
1387
- if (!(field.FieldType === "DateTime")) return [3 /*break*/, 17];
1577
+ _d.label = 27;
1578
+ case 27:
1579
+ if (!(field.FieldType === "DateTime")) return [3 /*break*/, 29];
1388
1580
  if (item !== null && item[fieldName]) {
1389
1581
  value = new Date(item[fieldName]);
1390
1582
  stringValue = value.toISOString();
@@ -1397,10 +1589,10 @@ var DynamicForm = /** @class */ (function (_super) {
1397
1589
  }
1398
1590
  dateFormat = field.DateFormat || "DateOnly";
1399
1591
  return [4 /*yield*/, this_2._spService.getRegionalWebSettings(this_2.webURL)];
1400
- case 16:
1592
+ case 28:
1401
1593
  defaultDayOfWeek = (_d.sent()).FirstDayOfWeek;
1402
- _d.label = 17;
1403
- case 17:
1594
+ _d.label = 29;
1595
+ case 29:
1404
1596
  // Setup Thumbnail, Location and Boolean fields
1405
1597
  if (field.FieldType === "Thumbnail") {
1406
1598
  if (defaultValue) {
@@ -1457,12 +1649,13 @@ var DynamicForm = /** @class */ (function (_super) {
1457
1649
  minimumValue: minValue,
1458
1650
  maximumValue: maxValue,
1459
1651
  showAsPercentage: showAsPercentage,
1460
- customIcon: customIcons ? customIcons[field.InternalName] : undefined
1652
+ customIcon: customIcons ? customIcons[field.InternalName] : undefined,
1653
+ useModernTaxonomyPickerControl: useModernTaxonomyPicker,
1461
1654
  });
1462
1655
  // This may not be necessary now using RenderListDataAsStream
1463
1656
  tempFields.sort(function (a, b) { return a.Order - b.Order; });
1464
- _d.label = 18;
1465
- case 18: return [2 /*return*/];
1657
+ _d.label = 30;
1658
+ case 30: return [2 /*return*/];
1466
1659
  }
1467
1660
  });
1468
1661
  };
@@ -1483,14 +1676,17 @@ var DynamicForm = /** @class */ (function (_super) {
1483
1676
  });
1484
1677
  });
1485
1678
  };
1486
- DynamicForm.prototype.cultureNameLookup = function (lcid) {
1679
+ DynamicFormBase.prototype.cultureNameLookup = function (lcid) {
1487
1680
  var _a, _b;
1488
1681
  var pageCulture = this.props.context.pageContext.cultureInfo.currentCultureName;
1489
1682
  if (!lcid)
1490
1683
  return pageCulture;
1491
1684
  return (_b = (_a = this.state.installedLanguages) === null || _a === void 0 ? void 0 : _a.find(function (lang) { return lang.Lcid === lcid; }).DisplayName) !== null && _b !== void 0 ? _b : pageCulture;
1492
1685
  };
1493
- return DynamicForm;
1686
+ return DynamicFormBase;
1494
1687
  }(React.Component));
1495
- export { DynamicForm };
1688
+ export { DynamicFormBase };
1689
+ export var DynamicForm = styled(DynamicFormBase, getStyles, undefined, {
1690
+ scope: 'DynamicForm',
1691
+ });
1496
1692
  //# sourceMappingURL=DynamicForm.js.map