dattatable 2.11.6 → 2.11.8

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 (68) hide show
  1. package/build/common/listCfg.d.ts +3 -1
  2. package/build/common/listCfg.js +138 -58
  3. package/dist/dattatable.js +569 -569
  4. package/dist/dattatable.min.js +1 -1
  5. package/docs/assets/search.js +1 -1
  6. package/docs/classes/Accordion.html +2 -2
  7. package/docs/classes/AuditLog.html +2 -2
  8. package/docs/classes/CanvasForm.html +2 -2
  9. package/docs/classes/Comments.html +2 -2
  10. package/docs/classes/Dashboard.html +4 -4
  11. package/docs/classes/DataTable.html +3 -3
  12. package/docs/classes/Documents.html +6 -6
  13. package/docs/classes/FilterSlideout.html +2 -2
  14. package/docs/classes/Footer.html +2 -2
  15. package/docs/classes/Header.html +2 -2
  16. package/docs/classes/InstallationRequired.html +2 -2
  17. package/docs/classes/ItemForm.html +4 -4
  18. package/docs/classes/List.html +4 -4
  19. package/docs/classes/ListConfig.html +5 -2
  20. package/docs/classes/ListSecurity.html +2 -2
  21. package/docs/classes/LoadingDialog.html +2 -2
  22. package/docs/classes/Modal.html +2 -2
  23. package/docs/classes/Navigation.html +3 -3
  24. package/docs/classes/Tiles.html +2 -2
  25. package/docs/classes/Timeout.html +2 -2
  26. package/docs/enums/ActionButtonTypes.html +2 -2
  27. package/docs/functions/formatBytes.html +1 -1
  28. package/docs/functions/formatDateValue.html +1 -1
  29. package/docs/functions/formatTimeValue.html +1 -1
  30. package/docs/functions/getContextInfo.html +1 -1
  31. package/docs/functions/getFileExt.html +1 -1
  32. package/docs/functions/waitForTheme.html +1 -1
  33. package/docs/interfaces/IAccordion.html +2 -2
  34. package/docs/interfaces/IAccordionProps.html +2 -2
  35. package/docs/interfaces/IAuditLogItem.html +2 -2
  36. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  37. package/docs/interfaces/IAuditLogProps.html +2 -2
  38. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  39. package/docs/interfaces/ICommentsItem.html +2 -2
  40. package/docs/interfaces/ICreateLookupData.html +2 -2
  41. package/docs/interfaces/IDashboardProps.html +2 -2
  42. package/docs/interfaces/IDataTable.html +2 -2
  43. package/docs/interfaces/IDataTableProps.html +2 -2
  44. package/docs/interfaces/IDocumentsProps.html +2 -2
  45. package/docs/interfaces/IFilterItem.html +2 -2
  46. package/docs/interfaces/IFilterProps.html +2 -2
  47. package/docs/interfaces/IFooterProps.html +2 -2
  48. package/docs/interfaces/IGenerateLookupDataProps.html +2 -2
  49. package/docs/interfaces/IHeaderProps.html +2 -2
  50. package/docs/interfaces/IInstallProps.html +2 -2
  51. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  52. package/docs/interfaces/IItemFormEditProps.html +2 -2
  53. package/docs/interfaces/IItemFormTab.html +2 -2
  54. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  55. package/docs/interfaces/IItemFormViewProps.html +2 -2
  56. package/docs/interfaces/IListConfig.html +2 -2
  57. package/docs/interfaces/IListConfigProps.html +2 -2
  58. package/docs/interfaces/IListProps.html +2 -2
  59. package/docs/interfaces/IListSecurity.html +2 -2
  60. package/docs/interfaces/IListSecurityItem.html +2 -2
  61. package/docs/interfaces/ILookupData.html +2 -3
  62. package/docs/interfaces/IShowDialogProps.html +2 -2
  63. package/docs/interfaces/ITiles.html +2 -2
  64. package/docs/interfaces/ITilesProps.html +2 -2
  65. package/docs/interfaces/IValidateLookupsProps.html +2 -2
  66. package/docs/variables/DattaTable.html +1 -1
  67. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  68. package/package.json +2 -2
@@ -19,7 +19,6 @@ export interface ILookupData {
19
19
  items: {
20
20
  [key: string]: object | string;
21
21
  }[];
22
- srcField: string;
23
22
  }
24
23
  export interface IGenerateLookupDataProps {
25
24
  lookupFields: Types.SP.FieldLookup[];
@@ -41,7 +40,10 @@ export interface IValidateLookupsProps {
41
40
  export declare class ListConfig {
42
41
  private static InternalFields;
43
42
  static createLookupListData(props: ICreateLookupData): PromiseLike<void>;
43
+ static fixMMSFields(webUrl: string, listName: string): PromiseLike<void>;
44
44
  static generate(props: IListConfigProps): PromiseLike<IListConfig>;
45
45
  static generateLookupListData(props: IGenerateLookupDataProps): PromiseLike<ILookupData[]>;
46
+ private static getMMSLookupListId;
47
+ static readList(webUrl: string, listName: string, lookupField: string): PromiseLike<ILookupData>;
46
48
  static validateLookups(props: IValidateLookupsProps): PromiseLike<Helper.ISPConfigProps>;
47
49
  }
@@ -103,6 +103,59 @@ var ListConfig = /** @class */ (function () {
103
103
  });
104
104
  });
105
105
  };
106
+ // Fixes the MMS fields to ensure the list property is configured correctly
107
+ ListConfig.fixMMSFields = function (webUrl, listName) {
108
+ var _this = this;
109
+ // Return a promise
110
+ return new Promise(function (resolve, reject) {
111
+ // Show a loading dialog
112
+ loadingDialog_1.LoadingDialog.setHeader("Validating MMS Fields");
113
+ loadingDialog_1.LoadingDialog.setBody("Getting the list '" + listName + "' fields...");
114
+ loadingDialog_1.LoadingDialog.show();
115
+ // Get the hidden list
116
+ _this.getMMSLookupListId(webUrl).then(function (listId) {
117
+ var mmsListId = "{" + listId + "}";
118
+ // Load the list fields
119
+ (0, gd_sprest_bs_1.Web)(webUrl).Lists(listName).Fields().execute(function (fields) {
120
+ // Parse the fields
121
+ gd_sprest_bs_1.Helper.Executor(fields.results, function (field) {
122
+ // See if this is not a MMS field
123
+ if (field.TypeDisplayName != "Managed Metadata") {
124
+ return;
125
+ }
126
+ // Return a promise
127
+ return new Promise(function (resolve) {
128
+ // Get the schema for this field
129
+ var parser = new DOMParser();
130
+ var schemaXml = parser.parseFromString(field.SchemaXml, "application/xml");
131
+ var xmlField = schemaXml.querySelector("Field");
132
+ // See if the list property is correct
133
+ if (xmlField.getAttribute("List") == mmsListId) {
134
+ // Check the next field
135
+ resolve(null);
136
+ }
137
+ else {
138
+ // Update the list property
139
+ xmlField.setAttribute("List", mmsListId);
140
+ // Update the schema value and check the next field
141
+ field.update({ SchemaXml: xmlField.outerHTML }).execute(resolve, function () {
142
+ // Log the error
143
+ console.error("Error updating the MMS list property for field: " + field.InternalName);
144
+ // Check the next field
145
+ resolve(null);
146
+ });
147
+ }
148
+ });
149
+ }).then(resolve, reject);
150
+ }, reject);
151
+ }, function () {
152
+ // Error getting the list data
153
+ console.error("Error getting the taxonomy hidden list.");
154
+ // Resolve the request
155
+ resolve();
156
+ });
157
+ });
158
+ };
106
159
  // Generates the list configuration
107
160
  ListConfig.generate = function (props) {
108
161
  var _this = this;
@@ -414,6 +467,7 @@ var ListConfig = /** @class */ (function () {
414
467
  };
415
468
  // Generates the lookup list data
416
469
  ListConfig.generateLookupListData = function (props) {
470
+ var _this = this;
417
471
  var lookupListData = [];
418
472
  // See if we are showing a loading dialog
419
473
  if (props.showDialog) {
@@ -444,69 +498,18 @@ var ListConfig = /** @class */ (function () {
444
498
  return new Promise(function (resolve) {
445
499
  // Get the source list
446
500
  (0, gd_sprest_bs_1.Web)(props.srcWebUrl).Lists().getById(lookupField.LookupList).execute(function (list) {
447
- var fields = [];
448
- // Get the list content type fields
449
- list.ContentTypes().query({ Expand: ["Fields"] }).execute(function (cts) {
450
- // Parse the content type fields
451
- for (var i = 0; i < cts.results[0].Fields.results.length; i++) {
452
- var field = cts.results[0].Fields.results[i];
453
- // Add the field link
454
- fields.push(field);
455
- }
456
- });
457
- // Get the list items
458
- list.Items().query({
459
- GetAllItems: true,
460
- Top: 5000,
461
- OrderBy: ["Id"]
462
- }).execute(function (items) {
463
- var lookupItems = [];
464
- // Parse the items
465
- for (var i = 0; i < items.results.length; i++) {
466
- var lookupItem = {};
467
- // Parse the field links
468
- for (var j = 0; j < fields.length; j++) {
469
- var field = fields[j];
470
- var value = items.results[i][field.InternalName];
471
- // Ensure a value exists
472
- if (value == null) {
473
- continue;
474
- }
475
- // See if this is a collection
476
- if (value.results) {
477
- // Set the results
478
- value = { results: value.results };
479
- }
480
- // Add the value, based on the type
481
- switch (field.FieldTypeKind) {
482
- case gd_sprest_bs_1.SPTypes.FieldType.URL:
483
- lookupItem[field.InternalName] = {
484
- Description: value.Description,
485
- Url: value.Url
486
- };
487
- break;
488
- default:
489
- // Set the value
490
- lookupItem[field.InternalName] = value;
491
- break;
492
- }
493
- }
494
- // Add the lookup item
495
- lookupItems.push(lookupItem);
496
- }
497
- // Save the item data
498
- lookupListData.push({
499
- field: lookupField.LookupField,
500
- items: lookupItems,
501
- list: list.Title,
502
- srcField: lookupField.InternalName
503
- });
501
+ // Read the list
502
+ _this.readList(props.srcWebUrl, list.Title, lookupField.LookupField).then(function (data) {
504
503
  // Set the flag
505
504
  lookupLists[listId] = true;
505
+ // Save the item data
506
+ lookupListData.push(data);
506
507
  // Check the next list
507
508
  resolve(null);
508
- }, true); // Set the flag to run this after the previous request completes
509
+ }, resolve);
509
510
  }, function () {
511
+ // Log
512
+ console.error("Error: List with id '".concat(lookupField.LookupList, "' does not exist in web '").concat(props.srcWebUrl, "'."));
510
513
  // Check the next list
511
514
  resolve(null);
512
515
  });
@@ -517,6 +520,83 @@ var ListConfig = /** @class */ (function () {
517
520
  }, reject);
518
521
  });
519
522
  };
523
+ // Gets the taxonomy hidden list
524
+ ListConfig.getMMSLookupListId = function (webUrl) {
525
+ // Return a promise
526
+ return new Promise(function (resolve, reject) {
527
+ // Query the web for the hidden list
528
+ (0, gd_sprest_bs_1.Web)(webUrl).Lists("TaxonomyHiddenList").execute(function (list) {
529
+ // Resolve the request
530
+ resolve(list.Id);
531
+ }, reject);
532
+ });
533
+ };
534
+ // Generates the lookup list data
535
+ ListConfig.readList = function (webUrl, listName, lookupField) {
536
+ // Return a promise
537
+ return new Promise(function (resolve, reject) {
538
+ // Get the source list
539
+ (0, gd_sprest_bs_1.Web)(webUrl).Lists(listName).execute(function (list) {
540
+ var fields = [];
541
+ // Get the list content type fields
542
+ list.ContentTypes().query({ Expand: ["Fields"] }).execute(function (cts) {
543
+ // Parse the content type fields
544
+ for (var i = 0; i < cts.results[0].Fields.results.length; i++) {
545
+ var field = cts.results[0].Fields.results[i];
546
+ // Add the field link
547
+ fields.push(field);
548
+ }
549
+ });
550
+ // Get the list items
551
+ list.Items().query({
552
+ GetAllItems: true,
553
+ Top: 5000,
554
+ OrderBy: ["Id"]
555
+ }).execute(function (items) {
556
+ var lookupItems = [];
557
+ // Parse the items
558
+ for (var i = 0; i < items.results.length; i++) {
559
+ var lookupItem = {};
560
+ // Parse the field links
561
+ for (var j = 0; j < fields.length; j++) {
562
+ var field = fields[j];
563
+ var value = items.results[i][field.InternalName];
564
+ // Ensure a value exists
565
+ if (value == null) {
566
+ continue;
567
+ }
568
+ // See if this is a collection
569
+ if (value.results) {
570
+ // Set the results
571
+ value = { results: value.results };
572
+ }
573
+ // Add the value, based on the type
574
+ switch (field.FieldTypeKind) {
575
+ case gd_sprest_bs_1.SPTypes.FieldType.URL:
576
+ lookupItem[field.InternalName] = {
577
+ Description: value.Description,
578
+ Url: value.Url
579
+ };
580
+ break;
581
+ default:
582
+ // Set the value
583
+ lookupItem[field.InternalName] = value;
584
+ break;
585
+ }
586
+ }
587
+ // Add the lookup item
588
+ lookupItems.push(lookupItem);
589
+ }
590
+ // Resolve the request
591
+ resolve({
592
+ field: lookupField,
593
+ items: lookupItems,
594
+ list: list.Title
595
+ });
596
+ }, true); // Set the flag to run this after the previous request completes
597
+ }, reject);
598
+ });
599
+ };
520
600
  // Validates the lookup fields
521
601
  ListConfig.validateLookups = function (props) {
522
602
  var _this = this;