dattatable 2.7.2 → 2.7.4

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 (50) hide show
  1. package/build/common/list.d.ts +7 -0
  2. package/build/common/list.js +66 -3
  3. package/dist/dattatable.js +443 -443
  4. package/dist/dattatable.min.js +1 -1
  5. package/docs/assets/search.js +1 -1
  6. package/docs/classes/AuditLog.html +13 -13
  7. package/docs/classes/CanvasForm.html +17 -17
  8. package/docs/classes/Comments.html +12 -12
  9. package/docs/classes/Dashboard.html +17 -17
  10. package/docs/classes/DataTable.html +11 -11
  11. package/docs/classes/Documents.html +45 -45
  12. package/docs/classes/FilterSlideout.html +14 -14
  13. package/docs/classes/Footer.html +4 -4
  14. package/docs/classes/Header.html +4 -4
  15. package/docs/classes/InstallationRequired.html +12 -12
  16. package/docs/classes/ItemForm.html +47 -47
  17. package/docs/classes/List.html +100 -41
  18. package/docs/classes/LoadingDialog.html +12 -12
  19. package/docs/classes/Modal.html +26 -26
  20. package/docs/classes/Navigation.html +6 -6
  21. package/docs/classes/Timeout.html +7 -7
  22. package/docs/enums/ActionButtonTypes.html +6 -6
  23. package/docs/functions/formatBytes.html +1 -1
  24. package/docs/functions/formatDateValue.html +1 -1
  25. package/docs/functions/formatTimeValue.html +1 -1
  26. package/docs/functions/getFileExt.html +1 -1
  27. package/docs/interfaces/IAuditLogItem.html +9 -9
  28. package/docs/interfaces/IAuditLogItemCreation.html +7 -7
  29. package/docs/interfaces/IAuditLogProps.html +5 -5
  30. package/docs/interfaces/IAuditLogViewProps.html +6 -6
  31. package/docs/interfaces/ICommentsItem.html +6 -6
  32. package/docs/interfaces/IDashboardProps.html +14 -14
  33. package/docs/interfaces/IDataTable.html +7 -7
  34. package/docs/interfaces/IDataTableProps.html +6 -6
  35. package/docs/interfaces/IDocumentsProps.html +25 -25
  36. package/docs/interfaces/IFilterItem.html +5 -5
  37. package/docs/interfaces/IFilterProps.html +4 -4
  38. package/docs/interfaces/IFooterProps.html +6 -6
  39. package/docs/interfaces/IHeaderProps.html +5 -5
  40. package/docs/interfaces/IInstallProps.html +4 -4
  41. package/docs/interfaces/IItemFormCreateProps.html +14 -14
  42. package/docs/interfaces/IItemFormEditProps.html +15 -15
  43. package/docs/interfaces/IItemFormTab.html +8 -8
  44. package/docs/interfaces/IItemFormTabInfo.html +3 -3
  45. package/docs/interfaces/IItemFormViewProps.html +12 -12
  46. package/docs/interfaces/IListProps.html +17 -10
  47. package/docs/interfaces/IShowDialogProps.html +7 -7
  48. package/docs/variables/DattaTable.html +1 -1
  49. package/package.json +2 -2
  50. package/pnpm-lock.yaml +7 -7
@@ -4,6 +4,7 @@ import { IItemFormCreateProps, IItemFormEditProps, IItemFormViewProps } from "..
4
4
  export interface IListProps<T = Types.SP.ListItem> {
5
5
  itemQuery?: Types.IODataQuery;
6
6
  listName: string;
7
+ viewName?: string;
7
8
  onInitError?: (...args: any[]) => void;
8
9
  onInitialized?: () => void;
9
10
  onItemsLoaded?: (items?: T[]) => void;
@@ -37,6 +38,10 @@ export declare class List<T = Types.SP.ListItem> {
37
38
  get OData(): Types.IODataQuery;
38
39
  get ViewForm(): import("gd-sprest-bs/src/components/components").IListFormDisplay;
39
40
  get ViewForms(): import("gd-sprest-bs/src/components/components").IListFormDisplay[];
41
+ private _viewName;
42
+ get ViewName(): string;
43
+ private _viewXml;
44
+ get ViewXml(): string;
40
45
  private _webUrl;
41
46
  get WebUrl(): string;
42
47
  /** Private Properties */
@@ -54,6 +59,8 @@ export declare class List<T = Types.SP.ListItem> {
54
59
  private init;
55
60
  private loadItem;
56
61
  private loadItems;
62
+ private loadItemsByQuery;
63
+ private loadItemsByView;
57
64
  refresh(query?: Types.IODataQuery): PromiseLike<T[]>;
58
65
  refreshItem(itemId: number, query?: Types.IODataQuery): PromiseLike<T>;
59
66
  updateItem(itemId: number, values: any): PromiseLike<void>;
@@ -26,6 +26,10 @@ var List = /** @class */ (function () {
26
26
  this._listName = null;
27
27
  // OData query
28
28
  this._odata = null;
29
+ // View name
30
+ this._viewName = null;
31
+ // View Xml
32
+ this._viewXml = null;
29
33
  // Web Url
30
34
  this._webUrl = null;
31
35
  /** Private Properties */
@@ -48,14 +52,14 @@ var List = /** @class */ (function () {
48
52
  this._onInitialized = props.onInitialized;
49
53
  this._onItemsLoaded = props.onItemsLoaded;
50
54
  this._onLoadFormError = props.onLoadFormError;
55
+ this._onRefreshItems = props.onRefreshItems;
51
56
  this._onResetForm = props.onResetForm;
57
+ this._viewName = props.viewName;
52
58
  this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;
53
59
  // Load the list information
54
60
  this.init().then(function () {
55
61
  // Load the items
56
- _this.loadItems().then(function (items) {
57
- // Set the items
58
- _this._items = items;
62
+ _this.loadItems().then(function () {
59
63
  // Call the event
60
64
  _this._onInitialized ? _this._onInitialized() : null;
61
65
  // Call the items loaded event
@@ -142,6 +146,16 @@ var List = /** @class */ (function () {
142
146
  enumerable: false,
143
147
  configurable: true
144
148
  });
149
+ Object.defineProperty(List.prototype, "ViewName", {
150
+ get: function () { return this._viewName; },
151
+ enumerable: false,
152
+ configurable: true
153
+ });
154
+ Object.defineProperty(List.prototype, "ViewXml", {
155
+ get: function () { return this._viewXml; },
156
+ enumerable: false,
157
+ configurable: true
158
+ });
145
159
  Object.defineProperty(List.prototype, "WebUrl", {
146
160
  get: function () { return this._webUrl; },
147
161
  enumerable: false,
@@ -223,6 +237,17 @@ var List = /** @class */ (function () {
223
237
  }, true);
224
238
  // Wait for the requests to complete
225
239
  list.done(function () {
240
+ // See if the view name is specified
241
+ if (_this.ViewName) {
242
+ // Parse the views
243
+ for (var i = 0; i < _this.ListViews.length; i++) {
244
+ var view = _this.ListViews[i];
245
+ if (view.Title.toLowerCase() == _this.ViewName.toLowerCase()) {
246
+ // Set the view xml
247
+ _this._viewXml = view.ListViewXml;
248
+ }
249
+ }
250
+ }
226
251
  // Resolve the request
227
252
  resolve();
228
253
  });
@@ -272,6 +297,18 @@ var List = /** @class */ (function () {
272
297
  };
273
298
  // Loads the items
274
299
  List.prototype.loadItems = function (query) {
300
+ // See if the view xml exists
301
+ if (this.ViewXml) {
302
+ // Get the items by the view name
303
+ return this.loadItemsByView();
304
+ }
305
+ else {
306
+ // Get the items by odata
307
+ return this.loadItemsByQuery(query);
308
+ }
309
+ };
310
+ // Loads the items by odata query
311
+ List.prototype.loadItemsByQuery = function (query) {
275
312
  var _this = this;
276
313
  if (query === void 0) { query = this.OData; }
277
314
  // Return a promise
@@ -297,6 +334,32 @@ var List = /** @class */ (function () {
297
334
  }, true);
298
335
  });
299
336
  };
337
+ // Loads the items by view name
338
+ List.prototype.loadItemsByView = function () {
339
+ var _this = this;
340
+ // Return a promise
341
+ return new Promise(function (resolve, reject) {
342
+ // See if the items already exist
343
+ if (_this._items) {
344
+ resolve(_this._items);
345
+ return;
346
+ }
347
+ // Query the items
348
+ (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).getItems(_this.ViewXml).execute(function (items) {
349
+ // Save the items
350
+ _this._items = items.results;
351
+ // Resolve the request
352
+ resolve(_this._items);
353
+ }, function () {
354
+ var args = [];
355
+ for (var _i = 0; _i < arguments.length; _i++) {
356
+ args[_i] = arguments[_i];
357
+ }
358
+ // Reject the request
359
+ reject.apply(void 0, args);
360
+ }, true);
361
+ });
362
+ };
300
363
  // Refresh the data
301
364
  List.prototype.refresh = function (query) {
302
365
  var _this = this;