dattatable 2.10.46 → 2.10.48

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 (71) hide show
  1. package/build/common/index.d.ts +1 -0
  2. package/build/common/index.js +1 -0
  3. package/build/common/list-cfg.d.ts +26 -0
  4. package/build/common/list-cfg.js +302 -0
  5. package/build/lib.d.ts +1 -0
  6. package/dist/dattatable.js +12 -1
  7. package/dist/dattatable.min.js +1 -1
  8. package/docs/assets/navigation.js +1 -1
  9. package/docs/assets/search.js +1 -1
  10. package/docs/classes/Accordion.html +2 -2
  11. package/docs/classes/AuditLog.html +2 -2
  12. package/docs/classes/CanvasForm.html +2 -2
  13. package/docs/classes/Comments.html +2 -2
  14. package/docs/classes/Dashboard.html +4 -4
  15. package/docs/classes/DataTable.html +3 -3
  16. package/docs/classes/Documents.html +6 -6
  17. package/docs/classes/FilterSlideout.html +2 -2
  18. package/docs/classes/Footer.html +2 -2
  19. package/docs/classes/Header.html +2 -2
  20. package/docs/classes/InstallationRequired.html +2 -2
  21. package/docs/classes/ItemForm.html +4 -4
  22. package/docs/classes/List.html +4 -4
  23. package/docs/classes/ListConfig.html +6 -0
  24. package/docs/classes/ListSecurity.html +2 -2
  25. package/docs/classes/LoadingDialog.html +2 -2
  26. package/docs/classes/Modal.html +2 -2
  27. package/docs/classes/Navigation.html +3 -3
  28. package/docs/classes/Tiles.html +2 -2
  29. package/docs/classes/Timeout.html +2 -2
  30. package/docs/enums/ActionButtonTypes.html +2 -2
  31. package/docs/functions/formatBytes.html +1 -1
  32. package/docs/functions/formatDateValue.html +1 -1
  33. package/docs/functions/formatTimeValue.html +1 -1
  34. package/docs/functions/getContextInfo.html +1 -1
  35. package/docs/functions/getFileExt.html +1 -1
  36. package/docs/functions/waitForTheme.html +1 -1
  37. package/docs/index.html +1 -1
  38. package/docs/interfaces/IAccordion.html +2 -2
  39. package/docs/interfaces/IAccordionProps.html +2 -2
  40. package/docs/interfaces/IAuditLogItem.html +3 -3
  41. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  42. package/docs/interfaces/IAuditLogProps.html +2 -2
  43. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  44. package/docs/interfaces/ICommentsItem.html +2 -2
  45. package/docs/interfaces/IDashboardProps.html +2 -2
  46. package/docs/interfaces/IDataTable.html +2 -2
  47. package/docs/interfaces/IDataTableProps.html +2 -2
  48. package/docs/interfaces/IDocumentsProps.html +2 -2
  49. package/docs/interfaces/IFilterItem.html +2 -2
  50. package/docs/interfaces/IFilterProps.html +2 -2
  51. package/docs/interfaces/IFooterProps.html +2 -2
  52. package/docs/interfaces/IHeaderProps.html +2 -2
  53. package/docs/interfaces/IInstallProps.html +2 -2
  54. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  55. package/docs/interfaces/IItemFormEditProps.html +2 -2
  56. package/docs/interfaces/IItemFormTab.html +2 -2
  57. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  58. package/docs/interfaces/IItemFormViewProps.html +2 -2
  59. package/docs/interfaces/IListConfig.html +3 -0
  60. package/docs/interfaces/IListConfigProps.html +5 -0
  61. package/docs/interfaces/IListProps.html +2 -2
  62. package/docs/interfaces/IListSecurity.html +2 -2
  63. package/docs/interfaces/IListSecurityItem.html +2 -2
  64. package/docs/interfaces/IShowDialogProps.html +2 -2
  65. package/docs/interfaces/ITiles.html +2 -2
  66. package/docs/interfaces/ITilesProps.html +2 -2
  67. package/docs/interfaces/IValidateLookupsProps.html +6 -0
  68. package/docs/modules.html +5 -1
  69. package/docs/variables/DattaTable.html +1 -1
  70. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  71. package/package.json +1 -1
@@ -5,6 +5,7 @@ export * from "./documents";
5
5
  export * from "./installRequired";
6
6
  export * from "./itemForm";
7
7
  export * from "./list";
8
+ export * from "./list-cfg";
8
9
  export * from "./listSecurity";
9
10
  export * from "./loadingDialog";
10
11
  export * from "./methods";
@@ -21,6 +21,7 @@ __exportStar(require("./documents"), exports);
21
21
  __exportStar(require("./installRequired"), exports);
22
22
  __exportStar(require("./itemForm"), exports);
23
23
  __exportStar(require("./list"), exports);
24
+ __exportStar(require("./list-cfg"), exports);
24
25
  __exportStar(require("./listSecurity"), exports);
25
26
  __exportStar(require("./loadingDialog"), exports);
26
27
  __exportStar(require("./methods"), exports);
@@ -0,0 +1,26 @@
1
+ import { Helper, Types } from "gd-sprest-bs";
2
+ export interface IListConfig {
3
+ cfg: Helper.ISPConfigProps;
4
+ lookupFields: Types.SP.FieldLookup[];
5
+ }
6
+ export interface IListConfigProps {
7
+ addLookupLists: boolean;
8
+ showDialog?: boolean;
9
+ srcList: Types.SP.List;
10
+ srcWebUrl: string;
11
+ }
12
+ export interface IValidateLookupsProps {
13
+ dstUrl: string;
14
+ lookupFields: Types.SP.FieldLookup[];
15
+ showDialog?: boolean;
16
+ srcList: Types.SP.List;
17
+ srcWebUrl: string;
18
+ }
19
+ /**
20
+ * List Configuration Generator
21
+ */
22
+ export declare class ListConfig {
23
+ private static InternalFields;
24
+ static generate(props: IListConfigProps): PromiseLike<IListConfig>;
25
+ static validateLookups(props: IValidateLookupsProps): PromiseLike<Helper.ISPConfigProps[]>;
26
+ }
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListConfig = void 0;
4
+ var gd_sprest_bs_1 = require("gd-sprest-bs");
5
+ var loadingDialog_1 = require("./loadingDialog");
6
+ var list_1 = require("./list");
7
+ /**
8
+ * List Configuration Generator
9
+ */
10
+ var ListConfig = /** @class */ (function () {
11
+ function ListConfig() {
12
+ }
13
+ // Generates the list configuration
14
+ ListConfig.generate = function (props) {
15
+ var _this = this;
16
+ // See if we are showing a loading dialog
17
+ if (props.showDialog) {
18
+ // Show a loading dialog
19
+ loadingDialog_1.LoadingDialog.setHeader("Loading List");
20
+ loadingDialog_1.LoadingDialog.setBody("Getting the source list configuration...");
21
+ loadingDialog_1.LoadingDialog.show();
22
+ }
23
+ // Return a promise
24
+ return new Promise(function (resolve, reject) {
25
+ // Get the list information
26
+ var list = new list_1.List({
27
+ listName: props.srcList.Title,
28
+ webUrl: props.srcWebUrl,
29
+ itemQuery: { Filter: "Id eq 0" },
30
+ onInitError: function () {
31
+ // Reject the request
32
+ reject("Error loading the list information. Please check your permission to the source list.");
33
+ },
34
+ onInitialized: function () {
35
+ var calcFields = [];
36
+ var fields = {};
37
+ var lookupFields = [];
38
+ // Update the loading dialog
39
+ loadingDialog_1.LoadingDialog.setBody("Analyzing the list information...");
40
+ // Create the configuration
41
+ var cfgProps = {
42
+ ListCfg: [{
43
+ ListInformation: {
44
+ AllowContentTypes: list.ListInfo.AllowContentTypes,
45
+ BaseTemplate: list.ListInfo.BaseTemplate,
46
+ ContentTypesEnabled: list.ListInfo.ContentTypesEnabled,
47
+ Title: props.srcList.Title,
48
+ Hidden: list.ListInfo.Hidden,
49
+ NoCrawl: list.ListInfo.NoCrawl
50
+ },
51
+ ContentTypes: [],
52
+ CustomFields: [],
53
+ ViewInformation: []
54
+ }]
55
+ };
56
+ // Parse the content types
57
+ for (var i = 0; i < list.ListContentTypes.length; i++) {
58
+ var ct = list.ListContentTypes[i];
59
+ // Skip sealed content types
60
+ if (ct.Sealed) {
61
+ continue;
62
+ }
63
+ // Parse the content type fields
64
+ var fieldRefs = [];
65
+ for (var j = 0; j < ct.FieldLinks.results.length; j++) {
66
+ var fldInfo = list.getField(ct.FieldLinks.results[j].Name);
67
+ // See if this is a lookup field
68
+ if (fldInfo.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Lookup) {
69
+ // Ensure this isn't an associated lookup field
70
+ if (fldInfo.IsDependentLookup != true) {
71
+ // Append the field ref
72
+ fieldRefs.push(fldInfo.InternalName);
73
+ }
74
+ }
75
+ else {
76
+ // Append the field ref
77
+ fieldRefs.push(fldInfo.InternalName);
78
+ }
79
+ // Skip internal fields
80
+ if (_this.InternalFields.indexOf(fldInfo.InternalName) >= 0) {
81
+ continue;
82
+ }
83
+ // See if this is a calculated field
84
+ if (fldInfo.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Calculated) {
85
+ // Add the field and continue the loop
86
+ calcFields.push(fldInfo);
87
+ }
88
+ // Else, see if this is a lookup field
89
+ else if (fldInfo.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Lookup) {
90
+ // Add the field
91
+ lookupFields.push(fldInfo);
92
+ }
93
+ // Else, ensure the field hasn't been added
94
+ else if (fields[fldInfo.InternalName] == null) {
95
+ // Add the field information
96
+ fields[fldInfo.InternalName] = true;
97
+ cfgProps.ListCfg[0].CustomFields.push({
98
+ name: fldInfo.InternalName,
99
+ schemaXml: fldInfo.SchemaXml
100
+ });
101
+ }
102
+ }
103
+ // Add the list content type
104
+ cfgProps.ListCfg[0].ContentTypes.push({
105
+ Name: ct.Name,
106
+ Description: ct.Description,
107
+ ParentName: ct.Name,
108
+ FieldRefs: fieldRefs
109
+ });
110
+ }
111
+ // Parse the views
112
+ for (var i = 0; i < list.ListViews.length; i++) {
113
+ var viewInfo = list.ListViews[i];
114
+ // Skip hidden views
115
+ if (viewInfo.Hidden) {
116
+ continue;
117
+ }
118
+ // Parse the fields
119
+ for (var j = 0; j < viewInfo.ViewFields.Items.results.length; j++) {
120
+ var field = list.getField(viewInfo.ViewFields.Items.results[j]);
121
+ // Ensure the field exists
122
+ if (fields[field.InternalName] == null) {
123
+ // See if this is a calculated field
124
+ if (field.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Calculated) {
125
+ // Add the field and continue the loop
126
+ calcFields.push(field);
127
+ }
128
+ // Else, see if this is a lookup field
129
+ else if (field.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Lookup) {
130
+ // Add the field
131
+ lookupFields.push(field);
132
+ }
133
+ else {
134
+ // Append the field
135
+ fields[field.InternalName] = true;
136
+ cfgProps.ListCfg[0].CustomFields.push({
137
+ name: field.InternalName,
138
+ schemaXml: field.SchemaXml
139
+ });
140
+ }
141
+ }
142
+ }
143
+ // Add the view
144
+ cfgProps.ListCfg[0].ViewInformation.push({
145
+ Default: viewInfo.DefaultView,
146
+ Hidden: viewInfo.Hidden,
147
+ JSLink: viewInfo.JSLink,
148
+ MobileDefaultView: viewInfo.MobileDefaultView,
149
+ MobileView: viewInfo.MobileView,
150
+ RowLimit: viewInfo.RowLimit,
151
+ Tabular: viewInfo.TabularView,
152
+ ViewName: viewInfo.Title,
153
+ ViewFields: viewInfo.ViewFields.Items.results,
154
+ ViewQuery: viewInfo.ViewQuery
155
+ });
156
+ }
157
+ // Update the loading dialog
158
+ loadingDialog_1.LoadingDialog.setBody("Analyzing the lookup fields...");
159
+ // Parse the lookup fields
160
+ gd_sprest_bs_1.Helper.Executor(lookupFields, function (lookupField) {
161
+ // Skip the field, if it was already added
162
+ if (fields[lookupField.InternalName]) {
163
+ return;
164
+ }
165
+ // Return a promise
166
+ return new Promise(function (resolve) {
167
+ // Get the lookup list
168
+ (0, gd_sprest_bs_1.Web)(props.srcWebUrl).Lists().getById(lookupField.LookupList).execute(function (list) {
169
+ // Add the lookup list field
170
+ fields[lookupField.InternalName] = true;
171
+ cfgProps.ListCfg[0].CustomFields.push({
172
+ description: lookupField.Description,
173
+ fieldRef: lookupField.PrimaryFieldId,
174
+ hidden: lookupField.Hidden,
175
+ id: lookupField.Id,
176
+ indexed: lookupField.Indexed,
177
+ listName: list.Title,
178
+ multi: lookupField.AllowMultipleValues,
179
+ name: lookupField.InternalName,
180
+ readOnly: lookupField.ReadOnlyField,
181
+ relationshipBehavior: lookupField.RelationshipDeleteBehavior,
182
+ required: lookupField.Required,
183
+ showField: lookupField.LookupField,
184
+ title: lookupField.Title,
185
+ type: gd_sprest_bs_1.Helper.SPCfgFieldType.Lookup
186
+ });
187
+ // Check the next field
188
+ resolve(null);
189
+ }, function (err) {
190
+ // Broken lookup field, don't add it
191
+ console.log("Error trying to find lookup list for field '" + lookupField.InternalName + "' with id: " + lookupField.LookupList);
192
+ resolve(null);
193
+ });
194
+ });
195
+ }).then(function () {
196
+ // Update the loading dialog
197
+ loadingDialog_1.LoadingDialog.setBody("Analyzing the calculated fields...");
198
+ // Parse the calculated fields
199
+ for (var i = 0; i < calcFields.length; i++) {
200
+ var calcField = calcFields[i];
201
+ if (fields[calcField.InternalName] == null) {
202
+ var parser = new DOMParser();
203
+ var schemaXml = parser.parseFromString(calcField.SchemaXml, "application/xml");
204
+ // Get the formula
205
+ var formula = schemaXml.querySelector("Formula");
206
+ // Parse the field refs
207
+ var fieldRefs = schemaXml.querySelectorAll("FieldRef");
208
+ for (var j = 0; j < fieldRefs.length; j++) {
209
+ var fieldRef = fieldRefs[j].getAttribute("Name");
210
+ // Ensure the field exists
211
+ var field = list.getField(fieldRef);
212
+ if (field) {
213
+ // Calculated formulas are supposed to contain the display name
214
+ // Replace any instance of the internal field w/ the correct format
215
+ var regexp = new RegExp(fieldRef, "g");
216
+ formula.innerHTML = formula.innerHTML.replace(regexp, "[" + field.Title + "]");
217
+ }
218
+ }
219
+ // Append the field
220
+ fields[calcField.InternalName] = true;
221
+ cfgProps.ListCfg[0].CustomFields.push({
222
+ name: calcField.InternalName,
223
+ schemaXml: schemaXml.querySelector("Field").outerHTML
224
+ });
225
+ }
226
+ }
227
+ // Hide the loading dialog
228
+ props.showDialog ? loadingDialog_1.LoadingDialog.hide() : null;
229
+ // Resolve the request
230
+ resolve({
231
+ cfg: cfgProps,
232
+ lookupFields: lookupFields
233
+ });
234
+ });
235
+ }
236
+ });
237
+ });
238
+ };
239
+ // Validates the lookup fields
240
+ ListConfig.validateLookups = function (props) {
241
+ var _this = this;
242
+ var listConfigs = [];
243
+ // See if we are showing a loading dialog
244
+ if (props.showDialog) {
245
+ // Show a loading dialog
246
+ loadingDialog_1.LoadingDialog.setHeader("Validating Lookup Lists");
247
+ loadingDialog_1.LoadingDialog.setBody("Validating the required lookup lists have been added...");
248
+ loadingDialog_1.LoadingDialog.show();
249
+ }
250
+ // Return a promise
251
+ return new Promise(function (resolve, reject) {
252
+ // Parse the lookup fields
253
+ gd_sprest_bs_1.Helper.Executor(props.lookupFields, function (lookupField) {
254
+ var _a;
255
+ // Ensure this lookup isn't to the source list
256
+ if (((_a = lookupField.LookupList) === null || _a === void 0 ? void 0 : _a.indexOf(props.srcList.Id)) >= 0) {
257
+ return;
258
+ }
259
+ // Return a promise
260
+ return new Promise(function (resolve, reject) {
261
+ // Get the source list
262
+ (0, gd_sprest_bs_1.Web)(props.srcWebUrl).Lists().getById(lookupField.LookupList).execute(function (list) {
263
+ // Ensure the list exists in the destination
264
+ (0, gd_sprest_bs_1.Web)(props.dstUrl).Lists(list.Title).execute(resolve, function () {
265
+ // Generate the lookup list configuration
266
+ _this.generate({
267
+ addLookupLists: true,
268
+ srcList: list,
269
+ srcWebUrl: props.srcWebUrl,
270
+ showDialog: props.showDialog
271
+ }).then(
272
+ // Success
273
+ function (cfg) {
274
+ // Append the list configuration
275
+ listConfigs.push(cfg.cfg);
276
+ // Resolve the request
277
+ resolve(null);
278
+ },
279
+ // Error
280
+ function () {
281
+ // Reject the reqeust
282
+ reject("Lookup list '" + list.Title + "' for field '" + lookupField.InternalName + "' does not exist in the configuration. Please add the lists in the appropriate order.");
283
+ });
284
+ });
285
+ }, function () {
286
+ // Reject the reqeust
287
+ reject("Lookup list for field '" + lookupField.InternalName + "' does not exist in the source web. Please review the source list for any issues.");
288
+ });
289
+ });
290
+ }).then(function () {
291
+ // Resolve the request
292
+ resolve(listConfigs);
293
+ }, reject);
294
+ });
295
+ };
296
+ // Internal Fields
297
+ ListConfig.InternalFields = [
298
+ "ContentType", "TaxCatchAll", "TaxCatchAllLabel", "Title"
299
+ ];
300
+ return ListConfig;
301
+ }());
302
+ exports.ListConfig = ListConfig;
package/build/lib.d.ts CHANGED
@@ -21,6 +21,7 @@ export declare const DattaTable: {
21
21
  InstallationRequired: typeof Common.InstallationRequired;
22
22
  ItemForm: typeof Common.ItemForm;
23
23
  List: typeof Common.List;
24
+ ListConfig: typeof Common.ListConfig;
24
25
  ListSecurityDefaultGroups: {
25
26
  Members: string;
26
27
  Owners: string;
@@ -71,7 +71,7 @@ eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assig
71
71
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
72
72
 
73
73
  "use strict";
74
- eval("\r\n/** Common Components */\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./canvas */ \"./build/common/canvas.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./comments */ \"./build/common/comments.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./documents */ \"./build/common/documents.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./installRequired */ \"./build/common/installRequired.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./itemForm */ \"./build/common/itemForm.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./list */ \"./build/common/list.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./listSecurity */ \"./build/common/listSecurity.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./methods */ \"./build/common/methods.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./modal */ \"./build/common/modal.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./timeout */ \"./build/common/timeout.js\"), exports);\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/index.js?");
74
+ eval("\r\n/** Common Components */\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n__exportStar(__webpack_require__(/*! ./canvas */ \"./build/common/canvas.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./comments */ \"./build/common/comments.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./documents */ \"./build/common/documents.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./installRequired */ \"./build/common/installRequired.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./itemForm */ \"./build/common/itemForm.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./list */ \"./build/common/list.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./list-cfg */ \"./build/common/list-cfg.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./listSecurity */ \"./build/common/listSecurity.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./methods */ \"./build/common/methods.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./modal */ \"./build/common/modal.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./timeout */ \"./build/common/timeout.js\"), exports);\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/index.js?");
75
75
 
76
76
  /***/ }),
77
77
 
@@ -97,6 +97,17 @@ eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assig
97
97
 
98
98
  /***/ }),
99
99
 
100
+ /***/ "./build/common/list-cfg.js":
101
+ /*!**********************************!*\
102
+ !*** ./build/common/list-cfg.js ***!
103
+ \**********************************/
104
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
105
+
106
+ "use strict";
107
+ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ListConfig = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.82/node_modules/gd-sprest-bs/build/index.js\");\r\nvar loadingDialog_1 = __webpack_require__(/*! ./loadingDialog */ \"./build/common/loadingDialog.js\");\r\nvar list_1 = __webpack_require__(/*! ./list */ \"./build/common/list.js\");\r\n/**\r\n * List Configuration Generator\r\n */\r\nvar ListConfig = /** @class */ (function () {\r\n function ListConfig() {\r\n }\r\n // Generates the list configuration\r\n ListConfig.generate = function (props) {\r\n var _this = this;\r\n // See if we are showing a loading dialog\r\n if (props.showDialog) {\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Loading List\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Getting the source list configuration...\");\r\n loadingDialog_1.LoadingDialog.show();\r\n }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Get the list information\r\n var list = new list_1.List({\r\n listName: props.srcList.Title,\r\n webUrl: props.srcWebUrl,\r\n itemQuery: { Filter: \"Id eq 0\" },\r\n onInitError: function () {\r\n // Reject the request\r\n reject(\"Error loading the list information. Please check your permission to the source list.\");\r\n },\r\n onInitialized: function () {\r\n var calcFields = [];\r\n var fields = {};\r\n var lookupFields = [];\r\n // Update the loading dialog\r\n loadingDialog_1.LoadingDialog.setBody(\"Analyzing the list information...\");\r\n // Create the configuration\r\n var cfgProps = {\r\n ListCfg: [{\r\n ListInformation: {\r\n AllowContentTypes: list.ListInfo.AllowContentTypes,\r\n BaseTemplate: list.ListInfo.BaseTemplate,\r\n ContentTypesEnabled: list.ListInfo.ContentTypesEnabled,\r\n Title: props.srcList.Title,\r\n Hidden: list.ListInfo.Hidden,\r\n NoCrawl: list.ListInfo.NoCrawl\r\n },\r\n ContentTypes: [],\r\n CustomFields: [],\r\n ViewInformation: []\r\n }]\r\n };\r\n // Parse the content types\r\n for (var i = 0; i < list.ListContentTypes.length; i++) {\r\n var ct = list.ListContentTypes[i];\r\n // Skip sealed content types\r\n if (ct.Sealed) {\r\n continue;\r\n }\r\n // Parse the content type fields\r\n var fieldRefs = [];\r\n for (var j = 0; j < ct.FieldLinks.results.length; j++) {\r\n var fldInfo = list.getField(ct.FieldLinks.results[j].Name);\r\n // See if this is a lookup field\r\n if (fldInfo.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Lookup) {\r\n // Ensure this isn't an associated lookup field\r\n if (fldInfo.IsDependentLookup != true) {\r\n // Append the field ref\r\n fieldRefs.push(fldInfo.InternalName);\r\n }\r\n }\r\n else {\r\n // Append the field ref\r\n fieldRefs.push(fldInfo.InternalName);\r\n }\r\n // Skip internal fields\r\n if (_this.InternalFields.indexOf(fldInfo.InternalName) >= 0) {\r\n continue;\r\n }\r\n // See if this is a calculated field\r\n if (fldInfo.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Calculated) {\r\n // Add the field and continue the loop\r\n calcFields.push(fldInfo);\r\n }\r\n // Else, see if this is a lookup field\r\n else if (fldInfo.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Lookup) {\r\n // Add the field\r\n lookupFields.push(fldInfo);\r\n }\r\n // Else, ensure the field hasn't been added\r\n else if (fields[fldInfo.InternalName] == null) {\r\n // Add the field information\r\n fields[fldInfo.InternalName] = true;\r\n cfgProps.ListCfg[0].CustomFields.push({\r\n name: fldInfo.InternalName,\r\n schemaXml: fldInfo.SchemaXml\r\n });\r\n }\r\n }\r\n // Add the list content type\r\n cfgProps.ListCfg[0].ContentTypes.push({\r\n Name: ct.Name,\r\n Description: ct.Description,\r\n ParentName: ct.Name,\r\n FieldRefs: fieldRefs\r\n });\r\n }\r\n // Parse the views\r\n for (var i = 0; i < list.ListViews.length; i++) {\r\n var viewInfo = list.ListViews[i];\r\n // Skip hidden views\r\n if (viewInfo.Hidden) {\r\n continue;\r\n }\r\n // Parse the fields\r\n for (var j = 0; j < viewInfo.ViewFields.Items.results.length; j++) {\r\n var field = list.getField(viewInfo.ViewFields.Items.results[j]);\r\n // Ensure the field exists\r\n if (fields[field.InternalName] == null) {\r\n // See if this is a calculated field\r\n if (field.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Calculated) {\r\n // Add the field and continue the loop\r\n calcFields.push(field);\r\n }\r\n // Else, see if this is a lookup field\r\n else if (field.FieldTypeKind == gd_sprest_bs_1.SPTypes.FieldType.Lookup) {\r\n // Add the field\r\n lookupFields.push(field);\r\n }\r\n else {\r\n // Append the field\r\n fields[field.InternalName] = true;\r\n cfgProps.ListCfg[0].CustomFields.push({\r\n name: field.InternalName,\r\n schemaXml: field.SchemaXml\r\n });\r\n }\r\n }\r\n }\r\n // Add the view\r\n cfgProps.ListCfg[0].ViewInformation.push({\r\n Default: viewInfo.DefaultView,\r\n Hidden: viewInfo.Hidden,\r\n JSLink: viewInfo.JSLink,\r\n MobileDefaultView: viewInfo.MobileDefaultView,\r\n MobileView: viewInfo.MobileView,\r\n RowLimit: viewInfo.RowLimit,\r\n Tabular: viewInfo.TabularView,\r\n ViewName: viewInfo.Title,\r\n ViewFields: viewInfo.ViewFields.Items.results,\r\n ViewQuery: viewInfo.ViewQuery\r\n });\r\n }\r\n // Update the loading dialog\r\n loadingDialog_1.LoadingDialog.setBody(\"Analyzing the lookup fields...\");\r\n // Parse the lookup fields\r\n gd_sprest_bs_1.Helper.Executor(lookupFields, function (lookupField) {\r\n // Skip the field, if it was already added\r\n if (fields[lookupField.InternalName]) {\r\n return;\r\n }\r\n // Return a promise\r\n return new Promise(function (resolve) {\r\n // Get the lookup list\r\n (0, gd_sprest_bs_1.Web)(props.srcWebUrl).Lists().getById(lookupField.LookupList).execute(function (list) {\r\n // Add the lookup list field\r\n fields[lookupField.InternalName] = true;\r\n cfgProps.ListCfg[0].CustomFields.push({\r\n description: lookupField.Description,\r\n fieldRef: lookupField.PrimaryFieldId,\r\n hidden: lookupField.Hidden,\r\n id: lookupField.Id,\r\n indexed: lookupField.Indexed,\r\n listName: list.Title,\r\n multi: lookupField.AllowMultipleValues,\r\n name: lookupField.InternalName,\r\n readOnly: lookupField.ReadOnlyField,\r\n relationshipBehavior: lookupField.RelationshipDeleteBehavior,\r\n required: lookupField.Required,\r\n showField: lookupField.LookupField,\r\n title: lookupField.Title,\r\n type: gd_sprest_bs_1.Helper.SPCfgFieldType.Lookup\r\n });\r\n // Check the next field\r\n resolve(null);\r\n }, function (err) {\r\n // Broken lookup field, don't add it\r\n console.log(\"Error trying to find lookup list for field '\" + lookupField.InternalName + \"' with id: \" + lookupField.LookupList);\r\n resolve(null);\r\n });\r\n });\r\n }).then(function () {\r\n // Update the loading dialog\r\n loadingDialog_1.LoadingDialog.setBody(\"Analyzing the calculated fields...\");\r\n // Parse the calculated fields\r\n for (var i = 0; i < calcFields.length; i++) {\r\n var calcField = calcFields[i];\r\n if (fields[calcField.InternalName] == null) {\r\n var parser = new DOMParser();\r\n var schemaXml = parser.parseFromString(calcField.SchemaXml, \"application/xml\");\r\n // Get the formula\r\n var formula = schemaXml.querySelector(\"Formula\");\r\n // Parse the field refs\r\n var fieldRefs = schemaXml.querySelectorAll(\"FieldRef\");\r\n for (var j = 0; j < fieldRefs.length; j++) {\r\n var fieldRef = fieldRefs[j].getAttribute(\"Name\");\r\n // Ensure the field exists\r\n var field = list.getField(fieldRef);\r\n if (field) {\r\n // Calculated formulas are supposed to contain the display name\r\n // Replace any instance of the internal field w/ the correct format\r\n var regexp = new RegExp(fieldRef, \"g\");\r\n formula.innerHTML = formula.innerHTML.replace(regexp, \"[\" + field.Title + \"]\");\r\n }\r\n }\r\n // Append the field\r\n fields[calcField.InternalName] = true;\r\n cfgProps.ListCfg[0].CustomFields.push({\r\n name: calcField.InternalName,\r\n schemaXml: schemaXml.querySelector(\"Field\").outerHTML\r\n });\r\n }\r\n }\r\n // Hide the loading dialog\r\n props.showDialog ? loadingDialog_1.LoadingDialog.hide() : null;\r\n // Resolve the request\r\n resolve({\r\n cfg: cfgProps,\r\n lookupFields: lookupFields\r\n });\r\n });\r\n }\r\n });\r\n });\r\n };\r\n // Validates the lookup fields\r\n ListConfig.validateLookups = function (props) {\r\n var _this = this;\r\n var listConfigs = [];\r\n // See if we are showing a loading dialog\r\n if (props.showDialog) {\r\n // Show a loading dialog\r\n loadingDialog_1.LoadingDialog.setHeader(\"Validating Lookup Lists\");\r\n loadingDialog_1.LoadingDialog.setBody(\"Validating the required lookup lists have been added...\");\r\n loadingDialog_1.LoadingDialog.show();\r\n }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Parse the lookup fields\r\n gd_sprest_bs_1.Helper.Executor(props.lookupFields, function (lookupField) {\r\n var _a;\r\n // Ensure this lookup isn't to the source list\r\n if (((_a = lookupField.LookupList) === null || _a === void 0 ? void 0 : _a.indexOf(props.srcList.Id)) >= 0) {\r\n return;\r\n }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Get the source list\r\n (0, gd_sprest_bs_1.Web)(props.srcWebUrl).Lists().getById(lookupField.LookupList).execute(function (list) {\r\n // Ensure the list exists in the destination\r\n (0, gd_sprest_bs_1.Web)(props.dstUrl).Lists(list.Title).execute(resolve, function () {\r\n // Generate the lookup list configuration\r\n _this.generate({\r\n addLookupLists: true,\r\n srcList: list,\r\n srcWebUrl: props.srcWebUrl,\r\n showDialog: props.showDialog\r\n }).then(\r\n // Success\r\n function (cfg) {\r\n // Append the list configuration\r\n listConfigs.push(cfg.cfg);\r\n // Resolve the request\r\n resolve(null);\r\n }, \r\n // Error\r\n function () {\r\n // Reject the reqeust\r\n reject(\"Lookup list '\" + list.Title + \"' for field '\" + lookupField.InternalName + \"' does not exist in the configuration. Please add the lists in the appropriate order.\");\r\n });\r\n });\r\n }, function () {\r\n // Reject the reqeust\r\n reject(\"Lookup list for field '\" + lookupField.InternalName + \"' does not exist in the source web. Please review the source list for any issues.\");\r\n });\r\n });\r\n }).then(function () {\r\n // Resolve the request\r\n resolve(listConfigs);\r\n }, reject);\r\n });\r\n };\r\n // Internal Fields\r\n ListConfig.InternalFields = [\r\n \"ContentType\", \"TaxCatchAll\", \"TaxCatchAllLabel\", \"Title\"\r\n ];\r\n return ListConfig;\r\n}());\r\nexports.ListConfig = ListConfig;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/list-cfg.js?");
108
+
109
+ /***/ }),
110
+
100
111
  /***/ "./build/common/list.js":
101
112
  /*!******************************!*\
102
113
  !*** ./build/common/list.js ***!