dattatable 2.3.3 → 2.3.5
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.
- package/build/auditLog/index.d.ts +12 -8
- package/build/auditLog/index.js +32 -45
- package/build/common/list.d.ts +20 -11
- package/build/common/list.js +118 -39
- package/dist/dattatable.js +2 -2
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/AuditLog.html +28 -55
- package/docs/classes/CanvasForm.html +17 -17
- package/docs/classes/Comments.html +12 -12
- package/docs/classes/Dashboard.html +17 -17
- package/docs/classes/DataTable.html +11 -11
- package/docs/classes/Documents.html +45 -45
- package/docs/classes/FilterSlideout.html +14 -14
- package/docs/classes/Footer.html +4 -4
- package/docs/classes/Header.html +4 -4
- package/docs/classes/InstallationRequired.html +12 -12
- package/docs/classes/ItemForm.html +47 -47
- package/docs/classes/List.html +154 -73
- package/docs/classes/LoadingDialog.html +12 -12
- package/docs/classes/Modal.html +26 -26
- package/docs/classes/Navigation.html +6 -6
- package/docs/enums/ActionButtonTypes.html +6 -6
- package/docs/functions/formatBytes.html +2 -1
- package/docs/functions/formatDateValue.html +2 -1
- package/docs/functions/formatTimeValue.html +2 -1
- package/docs/functions/getFileExt.html +2 -1
- package/docs/index.html +1 -0
- package/docs/interfaces/IAuditLogItem.html +8 -8
- package/docs/interfaces/IAuditLogItemCreation.html +7 -7
- package/docs/interfaces/IAuditLogProps.html +110 -0
- package/docs/interfaces/ICommentsItem.html +6 -6
- package/docs/interfaces/IDashboardProps.html +14 -14
- package/docs/interfaces/IDataTable.html +7 -7
- package/docs/interfaces/IDataTableProps.html +6 -6
- package/docs/interfaces/IDocumentsProps.html +25 -25
- package/docs/interfaces/IFilterItem.html +5 -5
- package/docs/interfaces/IFilterProps.html +4 -4
- package/docs/interfaces/IFooterProps.html +6 -6
- package/docs/interfaces/IHeaderProps.html +5 -5
- package/docs/interfaces/IItemFormCreateProps.html +14 -14
- package/docs/interfaces/IItemFormEditProps.html +15 -15
- package/docs/interfaces/IItemFormTab.html +7 -7
- package/docs/interfaces/IItemFormTabInfo.html +3 -3
- package/docs/interfaces/IItemFormViewProps.html +12 -12
- package/docs/interfaces/IListProps.html +63 -23
- package/docs/interfaces/IShowDialogProps.html +5 -5
- package/docs/modules.html +2 -0
- package/docs/variables/DattaTable.html +6 -5
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Helper, Types } from "gd-sprest-bs";
|
|
2
|
+
import { List } from "../common/list";
|
|
2
3
|
export interface IAuditLogItemCreation {
|
|
3
4
|
LogComment?: string;
|
|
4
5
|
LogData?: string;
|
|
@@ -15,6 +16,12 @@ export interface IAuditLogItem extends IAuditLogItemCreation, Types.SP.IListItem
|
|
|
15
16
|
Title: string;
|
|
16
17
|
};
|
|
17
18
|
}
|
|
19
|
+
export interface IAuditLogProps {
|
|
20
|
+
listName: string;
|
|
21
|
+
onInitError?: (...args: any[]) => void;
|
|
22
|
+
onInitialized?: () => void;
|
|
23
|
+
webUrl?: string;
|
|
24
|
+
}
|
|
18
25
|
/**
|
|
19
26
|
* Audit Log
|
|
20
27
|
*/
|
|
@@ -22,14 +29,11 @@ export declare class AuditLog<T = IAuditLogItem> {
|
|
|
22
29
|
private _cfg;
|
|
23
30
|
get Configuration(): Helper.ISPConfig;
|
|
24
31
|
get AuditListName(): string;
|
|
25
|
-
private
|
|
26
|
-
get
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
set WebUrl(value: string);
|
|
30
|
-
constructor(listName: string);
|
|
31
|
-
getItems(itemId: number, onQuery?: (query: Types.IODataQuery) => Types.IODataQuery): Promise<unknown>;
|
|
32
|
-
logItem(values: IAuditLogItemCreation): PromiseLike<T>;
|
|
32
|
+
private _list;
|
|
33
|
+
get List(): List<IAuditLogItem>;
|
|
34
|
+
constructor(props: IAuditLogProps);
|
|
35
|
+
getItems(itemId: number, onQuery?: (query: Types.IODataQuery) => Types.IODataQuery): PromiseLike<IAuditLogItem[]>;
|
|
33
36
|
install(): PromiseLike<void>;
|
|
37
|
+
logItem(values: IAuditLogItemCreation): PromiseLike<IAuditLogItem>;
|
|
34
38
|
uninstall(): PromiseLike<void>;
|
|
35
39
|
}
|
package/build/auditLog/index.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuditLog = void 0;
|
|
4
|
-
var
|
|
4
|
+
var list_1 = require("../common/list");
|
|
5
5
|
var cfg_1 = require("./cfg");
|
|
6
6
|
/**
|
|
7
7
|
* Audit Log
|
|
8
8
|
*/
|
|
9
9
|
var AuditLog = /** @class */ (function () {
|
|
10
10
|
// Constructor
|
|
11
|
-
function AuditLog(
|
|
11
|
+
function AuditLog(props) {
|
|
12
12
|
// Configuration
|
|
13
13
|
this._cfg = null;
|
|
14
|
-
// List
|
|
15
|
-
this.
|
|
16
|
-
// Web url
|
|
17
|
-
this._webUrl = null;
|
|
18
|
-
// Save the associated list
|
|
19
|
-
this._listName = listName;
|
|
14
|
+
// List
|
|
15
|
+
this._list = null;
|
|
20
16
|
// Set the configuration
|
|
21
17
|
this._cfg = cfg_1.Configuration;
|
|
22
|
-
//
|
|
23
|
-
this.
|
|
18
|
+
// Create the list component
|
|
19
|
+
this._list = new list_1.List({
|
|
20
|
+
listName: props.listName,
|
|
21
|
+
webUrl: props.webUrl,
|
|
22
|
+
onInitError: props.onInitError,
|
|
23
|
+
onInitialized: props.onInitialized,
|
|
24
|
+
itemQuery: {
|
|
25
|
+
Filter: "Id eq 0"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
Object.defineProperty(AuditLog.prototype, "Configuration", {
|
|
26
30
|
get: function () { return this._cfg; },
|
|
@@ -35,52 +39,35 @@ var AuditLog = /** @class */ (function () {
|
|
|
35
39
|
enumerable: false,
|
|
36
40
|
configurable: true
|
|
37
41
|
});
|
|
38
|
-
Object.defineProperty(AuditLog.prototype, "
|
|
39
|
-
get: function () { return this.
|
|
40
|
-
enumerable: false,
|
|
41
|
-
configurable: true
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(AuditLog.prototype, "WebUrl", {
|
|
44
|
-
get: function () { return this._webUrl; },
|
|
45
|
-
set: function (value) { this._webUrl = value; },
|
|
42
|
+
Object.defineProperty(AuditLog.prototype, "List", {
|
|
43
|
+
get: function () { return this._list; },
|
|
46
44
|
enumerable: false,
|
|
47
45
|
configurable: true
|
|
48
46
|
});
|
|
49
47
|
// Gets data for an associated item
|
|
50
48
|
AuditLog.prototype.getItems = function (itemId, onQuery) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
odata = onQuery ? onQuery(odata) : odata;
|
|
63
|
-
// Get the list data
|
|
64
|
-
(0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.AuditListName).Items().query(odata).execute(function (items) {
|
|
65
|
-
// Resolve the request
|
|
66
|
-
resolve(items.results);
|
|
67
|
-
}, reject);
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
// Logs an item to the audit log
|
|
71
|
-
AuditLog.prototype.logItem = function (values) {
|
|
72
|
-
var _this = this;
|
|
73
|
-
// Return a promise
|
|
74
|
-
return new Promise(function (resolve, reject) {
|
|
75
|
-
// Create the item
|
|
76
|
-
(0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.AuditListName).Items().add(values).execute(resolve, reject);
|
|
77
|
-
});
|
|
49
|
+
// Set the odata query
|
|
50
|
+
var odata = {
|
|
51
|
+
Expand: ["LogUser"],
|
|
52
|
+
Filter: "ParentListName eq '".concat(this.List.ListName, "' and ParentItemId eq ").concat(itemId),
|
|
53
|
+
OrderBy: ["Created desc"],
|
|
54
|
+
Select: ["*", "LogUser/EMail", "LogUser/Id", "LogUser/LoginName", "LogUser/Title"]
|
|
55
|
+
};
|
|
56
|
+
// Call the event
|
|
57
|
+
odata = onQuery ? onQuery(odata) : odata;
|
|
58
|
+
// Get the list data
|
|
59
|
+
return this.List.refresh(odata);
|
|
78
60
|
};
|
|
79
61
|
// Installs the list
|
|
80
62
|
AuditLog.prototype.install = function () {
|
|
81
63
|
// Installs the list
|
|
82
64
|
return this.Configuration.install();
|
|
83
65
|
};
|
|
66
|
+
// Logs an item to the audit log
|
|
67
|
+
AuditLog.prototype.logItem = function (values) {
|
|
68
|
+
// Create the item
|
|
69
|
+
return this.List.createItem(values);
|
|
70
|
+
};
|
|
84
71
|
// Removes the audit log list
|
|
85
72
|
AuditLog.prototype.uninstall = function () {
|
|
86
73
|
// Remove the audit log list
|
package/build/common/list.d.ts
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { Types } from "gd-sprest-bs";
|
|
2
2
|
import { IItemFormCreateProps, IItemFormEditProps, IItemFormViewProps } from "../common";
|
|
3
3
|
/** List Properties */
|
|
4
|
-
export interface IListProps {
|
|
4
|
+
export interface IListProps<T = Types.SP.ListItem> {
|
|
5
5
|
itemQuery?: Types.IODataQuery;
|
|
6
6
|
listName: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
onInitError?: (...args: any[]) => void;
|
|
8
|
+
onInitialized?: () => void;
|
|
9
|
+
onItemsLoaded?: (items?: T[]) => void;
|
|
9
10
|
onLoadFormError?: (...args: any[]) => void;
|
|
11
|
+
onResetForm?: () => void;
|
|
10
12
|
webUrl?: string;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* List
|
|
14
16
|
*/
|
|
15
17
|
export declare class List<T = Types.SP.ListItem> {
|
|
18
|
+
/** Public Properties */
|
|
16
19
|
get EditForm(): import("gd-sprest-bs/src/components/components").IListFormEdit;
|
|
17
20
|
get EditForms(): import("gd-sprest-bs/src/components/components").IListFormEdit[];
|
|
18
21
|
private _listContentTypes;
|
|
19
|
-
get ListContentTypes(): Types.SP.
|
|
22
|
+
get ListContentTypes(): Types.SP.ContentTypeOData[];
|
|
20
23
|
private _listFields;
|
|
21
24
|
get ListFields(): Types.SP.Field[];
|
|
22
25
|
private _listInfo;
|
|
23
26
|
get ListInfo(): Types.SP.List;
|
|
24
27
|
private _listViews;
|
|
25
|
-
get ListViews(): Types.SP.
|
|
28
|
+
get ListViews(): Types.SP.ViewOData[];
|
|
26
29
|
private _items;
|
|
27
30
|
get Items(): T[];
|
|
28
31
|
private _listName;
|
|
@@ -33,14 +36,20 @@ export declare class List<T = Types.SP.ListItem> {
|
|
|
33
36
|
get ViewForms(): import("gd-sprest-bs/src/components/components").IListFormDisplay[];
|
|
34
37
|
private _webUrl;
|
|
35
38
|
get WebUrl(): string;
|
|
39
|
+
/** Private Properties */
|
|
40
|
+
private _onInitError;
|
|
41
|
+
private _onInitialized?;
|
|
36
42
|
private _onItemsLoaded?;
|
|
37
43
|
private _onLoadFormError;
|
|
38
|
-
private
|
|
39
|
-
constructor(props: IListProps);
|
|
44
|
+
private _onResetForm;
|
|
45
|
+
constructor(props: IListProps<T>);
|
|
40
46
|
private clear;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
createItem(values: any): PromiseLike<T>;
|
|
48
|
+
newForm(props: IItemFormCreateProps): void;
|
|
49
|
+
editForm(props: IItemFormEditProps): void;
|
|
50
|
+
private init;
|
|
51
|
+
private loadItems;
|
|
44
52
|
refresh(query?: Types.IODataQuery): PromiseLike<T[]>;
|
|
45
|
-
|
|
53
|
+
updateItem(itemId: number, values: any): PromiseLike<void>;
|
|
54
|
+
viewForm(props: IItemFormViewProps): void;
|
|
46
55
|
}
|
package/build/common/list.js
CHANGED
|
@@ -26,28 +26,55 @@ var List = /** @class */ (function () {
|
|
|
26
26
|
this._odata = null;
|
|
27
27
|
// Web Url
|
|
28
28
|
this._webUrl = null;
|
|
29
|
+
/** Private Properties */
|
|
30
|
+
// Error event when loading the items fail
|
|
31
|
+
this._onInitError = null;
|
|
32
|
+
// Event triggered when the component is initialized
|
|
33
|
+
this._onInitialized = null;
|
|
29
34
|
// Items loaded event
|
|
30
35
|
this._onItemsLoaded = null;
|
|
31
36
|
// Error event when loading a form
|
|
32
37
|
this._onLoadFormError = null;
|
|
33
|
-
//
|
|
34
|
-
this.
|
|
38
|
+
// Event triggered when the form is reset
|
|
39
|
+
this._onResetForm = null;
|
|
35
40
|
// Save the properties
|
|
36
41
|
this._listName = props.listName;
|
|
37
42
|
this._odata = props.itemQuery;
|
|
43
|
+
this._onInitError = props.onInitError;
|
|
44
|
+
this._onInitialized = props.onInitialized;
|
|
38
45
|
this._onItemsLoaded = props.onItemsLoaded;
|
|
39
46
|
this._onLoadFormError = props.onLoadFormError;
|
|
40
|
-
this.
|
|
47
|
+
this._onResetForm = props.onResetForm;
|
|
41
48
|
this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;
|
|
42
|
-
// Load the
|
|
43
|
-
this.
|
|
44
|
-
//
|
|
45
|
-
_this.
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
// Load the list information
|
|
50
|
+
this.init().then(function () {
|
|
51
|
+
// Load the items
|
|
52
|
+
_this.loadItems().then(function (items) {
|
|
53
|
+
// Set the items
|
|
54
|
+
_this._items = items;
|
|
55
|
+
// Call the event
|
|
56
|
+
_this._onInitialized ? _this._onInitialized() : null;
|
|
57
|
+
// Call the items loaded event
|
|
58
|
+
_this._onItemsLoaded ? _this._onItemsLoaded(_this.Items) : null;
|
|
59
|
+
}, function () {
|
|
60
|
+
var args = [];
|
|
61
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
62
|
+
args[_i] = arguments[_i];
|
|
63
|
+
}
|
|
64
|
+
// Call the init error event
|
|
65
|
+
_this._onInitError ? _this._onInitError.apply(_this, args) : null;
|
|
66
|
+
});
|
|
67
|
+
}, function () {
|
|
68
|
+
var args = [];
|
|
69
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
70
|
+
args[_i] = arguments[_i];
|
|
71
|
+
}
|
|
72
|
+
// Call the init error event
|
|
73
|
+
_this._onInitError ? _this._onInitError.apply(_this, args) : null;
|
|
48
74
|
});
|
|
49
75
|
}
|
|
50
76
|
Object.defineProperty(List.prototype, "EditForm", {
|
|
77
|
+
/** Public Properties */
|
|
51
78
|
// Reference to the edit form
|
|
52
79
|
get: function () { return common_1.ItemForm.EditForm; },
|
|
53
80
|
enumerable: false,
|
|
@@ -117,9 +144,78 @@ var List = /** @class */ (function () {
|
|
|
117
144
|
common_1.ItemForm.UseModal ? common_1.Modal.clear() : common_1.CanvasForm.clear();
|
|
118
145
|
// Set the list name
|
|
119
146
|
common_1.ItemForm.ListName = this.ListName;
|
|
147
|
+
// Call the event
|
|
148
|
+
this._onResetForm ? this._onResetForm() : null;
|
|
149
|
+
};
|
|
150
|
+
// Reference to the create item method
|
|
151
|
+
List.prototype.createItem = function (values) {
|
|
152
|
+
var _this = this;
|
|
153
|
+
// Return a promise
|
|
154
|
+
return new Promise(function (resolve, reject) {
|
|
155
|
+
// Create the item
|
|
156
|
+
_this.ListInfo.Items().add(values).execute(resolve, reject);
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
// Displays the new form
|
|
160
|
+
List.prototype.newForm = function (props) {
|
|
161
|
+
// Clear the modal/canvas
|
|
162
|
+
this.clear();
|
|
163
|
+
// Display the form
|
|
164
|
+
common_1.ItemForm.create(props).then(null, this._onLoadFormError);
|
|
165
|
+
};
|
|
166
|
+
// Displays the edit form
|
|
167
|
+
List.prototype.editForm = function (props) {
|
|
168
|
+
// Clear the modal/canvas
|
|
169
|
+
this.clear();
|
|
170
|
+
// Display the form
|
|
171
|
+
common_1.ItemForm.edit(props).then(null, this._onLoadFormError);
|
|
172
|
+
};
|
|
173
|
+
// Initializes the list component
|
|
174
|
+
List.prototype.init = function () {
|
|
175
|
+
var _this = this;
|
|
176
|
+
// Return a promise
|
|
177
|
+
return new Promise(function (resolve, reject) {
|
|
178
|
+
var list = (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName);
|
|
179
|
+
// Query the list content types
|
|
180
|
+
list.execute(function (list) {
|
|
181
|
+
// Save the list information
|
|
182
|
+
_this._listInfo = list;
|
|
183
|
+
}, function () {
|
|
184
|
+
var args = [];
|
|
185
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
186
|
+
args[_i] = arguments[_i];
|
|
187
|
+
}
|
|
188
|
+
// Reject the request
|
|
189
|
+
reject.apply(void 0, args);
|
|
190
|
+
});
|
|
191
|
+
// Query the content types
|
|
192
|
+
list.ContentTypes().query({
|
|
193
|
+
Expand: ["FieldLinks", "Fields"]
|
|
194
|
+
}).execute(function (cts) {
|
|
195
|
+
// Save the content types
|
|
196
|
+
_this._listContentTypes = cts.results;
|
|
197
|
+
}, true);
|
|
198
|
+
// Query the list fields
|
|
199
|
+
list.Fields().execute(function (fields) {
|
|
200
|
+
// Save the fields
|
|
201
|
+
_this._listFields = fields.results;
|
|
202
|
+
}, true);
|
|
203
|
+
// Query the list views
|
|
204
|
+
list.Views().query({
|
|
205
|
+
Expand: ["FieldLinks", "Fields"]
|
|
206
|
+
}).execute(function (views) {
|
|
207
|
+
// Save the views
|
|
208
|
+
_this._listViews = views.results;
|
|
209
|
+
}, true);
|
|
210
|
+
// Wait for the requests to complete
|
|
211
|
+
list.done(function () {
|
|
212
|
+
// Resolve the request
|
|
213
|
+
resolve();
|
|
214
|
+
});
|
|
215
|
+
});
|
|
120
216
|
};
|
|
121
217
|
// Loads the items
|
|
122
|
-
List.prototype.
|
|
218
|
+
List.prototype.loadItems = function (query) {
|
|
123
219
|
var _this = this;
|
|
124
220
|
if (query === void 0) { query = this.OData; }
|
|
125
221
|
// Return a promise
|
|
@@ -128,16 +224,6 @@ var List = /** @class */ (function () {
|
|
|
128
224
|
if (_this._items) {
|
|
129
225
|
return _this._items;
|
|
130
226
|
}
|
|
131
|
-
// Query the list
|
|
132
|
-
(0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).query({
|
|
133
|
-
Expand: ["ContentTypes", "Fields", "Views"]
|
|
134
|
-
}).execute(function (list) {
|
|
135
|
-
// Save the list properties
|
|
136
|
-
_this._listInfo = list;
|
|
137
|
-
_this._listContentTypes = list.ContentTypes.results;
|
|
138
|
-
_this._listFields = list.Fields.results;
|
|
139
|
-
_this._listViews = list.Views.results;
|
|
140
|
-
});
|
|
141
227
|
// Query the items
|
|
142
228
|
(0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).Items().query(query).execute(function (items) {
|
|
143
229
|
// Save the items
|
|
@@ -149,37 +235,30 @@ var List = /** @class */ (function () {
|
|
|
149
235
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
150
236
|
args[_i] = arguments[_i];
|
|
151
237
|
}
|
|
152
|
-
// Call the event
|
|
153
|
-
_this._onLoadItemsError ? _this._onLoadItemsError.apply(_this, args) : null;
|
|
154
238
|
// Reject the request
|
|
155
239
|
reject.apply(void 0, args);
|
|
156
|
-
});
|
|
240
|
+
}, true);
|
|
157
241
|
});
|
|
158
242
|
};
|
|
159
|
-
// Displays the new form
|
|
160
|
-
List.prototype.createItem = function (props) {
|
|
161
|
-
// Clear the modal/canvas
|
|
162
|
-
this.clear();
|
|
163
|
-
// Display the form
|
|
164
|
-
common_1.ItemForm.create(props).then(null, this._onLoadFormError);
|
|
165
|
-
};
|
|
166
|
-
// Displays the edit form
|
|
167
|
-
List.prototype.editItem = function (props) {
|
|
168
|
-
// Clear the modal/canvas
|
|
169
|
-
this.clear();
|
|
170
|
-
// Display the form
|
|
171
|
-
common_1.ItemForm.edit(props).then(null, this._onLoadFormError);
|
|
172
|
-
};
|
|
173
243
|
// Refresh the data
|
|
174
244
|
List.prototype.refresh = function (query) {
|
|
175
245
|
if (query === void 0) { query = this.OData; }
|
|
176
246
|
// Clear the items
|
|
177
247
|
this._items = null;
|
|
178
248
|
// Load the data
|
|
179
|
-
return this.
|
|
249
|
+
return this.loadItems(query);
|
|
250
|
+
};
|
|
251
|
+
// Updates an item
|
|
252
|
+
List.prototype.updateItem = function (itemId, values) {
|
|
253
|
+
var _this = this;
|
|
254
|
+
// Return a promise
|
|
255
|
+
return new Promise(function (resolve, reject) {
|
|
256
|
+
// Create the item
|
|
257
|
+
_this.ListInfo.Items(itemId).update(values).execute(resolve, reject);
|
|
258
|
+
});
|
|
180
259
|
};
|
|
181
260
|
// Displays the view form
|
|
182
|
-
List.prototype.
|
|
261
|
+
List.prototype.viewForm = function (props) {
|
|
183
262
|
// Clear the modal/canvas
|
|
184
263
|
this.clear();
|
|
185
264
|
// Display the form
|
package/dist/dattatable.js
CHANGED
|
@@ -27,7 +27,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
27
27
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
28
28
|
|
|
29
29
|
"use strict";
|
|
30
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AuditLog = void 0;\r\nvar
|
|
30
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AuditLog = void 0;\r\nvar list_1 = __webpack_require__(/*! ../common/list */ \"./build/common/list.js\");\r\nvar cfg_1 = __webpack_require__(/*! ./cfg */ \"./build/auditLog/cfg.js\");\r\n/**\r\n * Audit Log\r\n */\r\nvar AuditLog = /** @class */ (function () {\r\n // Constructor\r\n function AuditLog(props) {\r\n // Configuration\r\n this._cfg = null;\r\n // List\r\n this._list = null;\r\n // Set the configuration\r\n this._cfg = cfg_1.Configuration;\r\n // Create the list component\r\n this._list = new list_1.List({\r\n listName: props.listName,\r\n webUrl: props.webUrl,\r\n onInitError: props.onInitError,\r\n onInitialized: props.onInitialized,\r\n itemQuery: {\r\n Filter: \"Id eq 0\"\r\n }\r\n });\r\n }\r\n Object.defineProperty(AuditLog.prototype, \"Configuration\", {\r\n get: function () { return this._cfg; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AuditLog.prototype, \"AuditListName\", {\r\n get: function () {\r\n // Return the list name\r\n return this.Configuration._configuration.ListCfg[0].ListInformation.Title;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(AuditLog.prototype, \"List\", {\r\n get: function () { return this._list; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Gets data for an associated item\r\n AuditLog.prototype.getItems = function (itemId, onQuery) {\r\n // Set the odata query\r\n var odata = {\r\n Expand: [\"LogUser\"],\r\n Filter: \"ParentListName eq '\".concat(this.List.ListName, \"' and ParentItemId eq \").concat(itemId),\r\n OrderBy: [\"Created desc\"],\r\n Select: [\"*\", \"LogUser/EMail\", \"LogUser/Id\", \"LogUser/LoginName\", \"LogUser/Title\"]\r\n };\r\n // Call the event\r\n odata = onQuery ? onQuery(odata) : odata;\r\n // Get the list data\r\n return this.List.refresh(odata);\r\n };\r\n // Installs the list\r\n AuditLog.prototype.install = function () {\r\n // Installs the list\r\n return this.Configuration.install();\r\n };\r\n // Logs an item to the audit log\r\n AuditLog.prototype.logItem = function (values) {\r\n // Create the item\r\n return this.List.createItem(values);\r\n };\r\n // Removes the audit log list\r\n AuditLog.prototype.uninstall = function () {\r\n // Remove the audit log list\r\n return this.Configuration.uninstall();\r\n };\r\n return AuditLog;\r\n}());\r\nexports.AuditLog = AuditLog;\r\n\n\n//# sourceURL=webpack://dattatable/./build/auditLog/index.js?");
|
|
31
31
|
|
|
32
32
|
/***/ }),
|
|
33
33
|
|
|
@@ -104,7 +104,7 @@ eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assig
|
|
|
104
104
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
105
105
|
|
|
106
106
|
"use strict";
|
|
107
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.List = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.4/node_modules/gd-sprest-bs/build/index.js\");\r\nvar common_1 = __webpack_require__(/*! ../common */ \"./build/common/index.js\");\r\n/**\r\n * List\r\n */\r\nvar List = /** @class */ (function () {\r\n // Constructor\r\n function List(props) {\r\n var _this = this;\r\n // List Content Types Information\r\n this._listContentTypes = null;\r\n // List Fields Information\r\n this._listFields = null;\r\n // List Information\r\n this._listInfo = null;\r\n // List Views Information\r\n this._listViews = null;\r\n // Items\r\n this._items = null;\r\n // List Name\r\n this._listName = null;\r\n // OData query\r\n this._odata = null;\r\n // Web Url\r\n this._webUrl = null;\r\n // Items loaded event\r\n this._onItemsLoaded = null;\r\n // Error event when loading a form\r\n this._onLoadFormError = null;\r\n // Error event when loading the items fail\r\n this._onLoadItemsError = null;\r\n // Save the properties\r\n this._listName = props.listName;\r\n this._odata = props.itemQuery;\r\n this._onItemsLoaded = props.onItemsLoaded;\r\n this._onLoadFormError = props.onLoadFormError;\r\n this._onLoadItemsError = props.onLoadItemsError;\r\n this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;\r\n // Load the data\r\n this.load().then(function (items) {\r\n // Set the items\r\n _this._items = items;\r\n // Call the items loaded event\r\n _this._onItemsLoaded ? _this._onItemsLoaded() : null;\r\n });\r\n }\r\n Object.defineProperty(List.prototype, \"EditForm\", {\r\n // Reference to the edit form\r\n get: function () { return common_1.ItemForm.EditForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"EditForms\", {\r\n // Reference to the edit forms, if tabs are used\r\n get: function () { return common_1.ItemForm.EditForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListContentTypes\", {\r\n get: function () { return this._listContentTypes; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListFields\", {\r\n get: function () { return this._listFields; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListInfo\", {\r\n get: function () { return this._listInfo; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListViews\", {\r\n get: function () { return this._listViews; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"Items\", {\r\n get: function () { return this._items; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListName\", {\r\n get: function () { return this._listName; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"OData\", {\r\n get: function () { return this._odata; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForm\", {\r\n // Reference to the display form\r\n get: function () { return common_1.ItemForm.DisplayForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForms\", {\r\n // Reference to the display forms, if tabs are used\r\n get: function () { return common_1.ItemForm.DisplayForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"WebUrl\", {\r\n get: function () { return this._webUrl; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Clears the modal or canvas\r\n List.prototype.clear = function () {\r\n // Clear the modal/form\r\n common_1.ItemForm.UseModal ? common_1.Modal.clear() : common_1.CanvasForm.clear();\r\n // Set the list name\r\n common_1.ItemForm.ListName = this.ListName;\r\n };\r\n // Loads the items\r\n List.prototype.load = function (query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items exist\r\n if (_this._items) {\r\n return _this._items;\r\n }\r\n // Query the list\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).query({\r\n Expand: [\"ContentTypes\", \"Fields\", \"Views\"]\r\n }).execute(function (list) {\r\n // Save the list properties\r\n _this._listInfo = list;\r\n _this._listContentTypes = list.ContentTypes.results;\r\n _this._listFields = list.Fields.results;\r\n _this._listViews = list.Views.results;\r\n });\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).Items().query(query).execute(function (items) {\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the event\r\n _this._onLoadItemsError ? _this._onLoadItemsError.apply(_this, args) : null;\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n });\r\n });\r\n };\r\n // Displays the new form\r\n List.prototype.createItem = function (props) {\r\n // Clear the modal/canvas\r\n this.clear();\r\n // Display the form\r\n common_1.ItemForm.create(props).then(null, this._onLoadFormError);\r\n };\r\n // Displays the edit form\r\n List.prototype.editItem = function (props) {\r\n // Clear the modal/canvas\r\n this.clear();\r\n // Display the form\r\n common_1.ItemForm.edit(props).then(null, this._onLoadFormError);\r\n };\r\n // Refresh the data\r\n List.prototype.refresh = function (query) {\r\n if (query === void 0) { query = this.OData; }\r\n // Clear the items\r\n this._items = null;\r\n // Load the data\r\n return this.load(query);\r\n };\r\n // Displays the view form\r\n List.prototype.viewItem = function (props) {\r\n // Clear the modal/canvas\r\n this.clear();\r\n // Display the form\r\n common_1.ItemForm.view(props).then(null, this._onLoadFormError);\r\n };\r\n return List;\r\n}());\r\nexports.List = List;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/list.js?");
|
|
107
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.List = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.4/node_modules/gd-sprest-bs/build/index.js\");\r\nvar common_1 = __webpack_require__(/*! ../common */ \"./build/common/index.js\");\r\n/**\r\n * List\r\n */\r\nvar List = /** @class */ (function () {\r\n // Constructor\r\n function List(props) {\r\n var _this = this;\r\n // List Content Types Information\r\n this._listContentTypes = null;\r\n // List Fields Information\r\n this._listFields = null;\r\n // List Information\r\n this._listInfo = null;\r\n // List Views Information\r\n this._listViews = null;\r\n // Items\r\n this._items = null;\r\n // List Name\r\n this._listName = null;\r\n // OData query\r\n this._odata = null;\r\n // Web Url\r\n this._webUrl = null;\r\n /** Private Properties */\r\n // Error event when loading the items fail\r\n this._onInitError = null;\r\n // Event triggered when the component is initialized\r\n this._onInitialized = null;\r\n // Items loaded event\r\n this._onItemsLoaded = null;\r\n // Error event when loading a form\r\n this._onLoadFormError = null;\r\n // Event triggered when the form is reset\r\n this._onResetForm = null;\r\n // Save the properties\r\n this._listName = props.listName;\r\n this._odata = props.itemQuery;\r\n this._onInitError = props.onInitError;\r\n this._onInitialized = props.onInitialized;\r\n this._onItemsLoaded = props.onItemsLoaded;\r\n this._onLoadFormError = props.onLoadFormError;\r\n this._onResetForm = props.onResetForm;\r\n this._webUrl = props.webUrl || gd_sprest_bs_1.ContextInfo.webServerRelativeUrl;\r\n // Load the list information\r\n this.init().then(function () {\r\n // Load the items\r\n _this.loadItems().then(function (items) {\r\n // Set the items\r\n _this._items = items;\r\n // Call the event\r\n _this._onInitialized ? _this._onInitialized() : null;\r\n // Call the items loaded event\r\n _this._onItemsLoaded ? _this._onItemsLoaded(_this.Items) : null;\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Call the init error event\r\n _this._onInitError ? _this._onInitError.apply(_this, args) : null;\r\n });\r\n }\r\n Object.defineProperty(List.prototype, \"EditForm\", {\r\n /** Public Properties */\r\n // Reference to the edit form\r\n get: function () { return common_1.ItemForm.EditForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"EditForms\", {\r\n // Reference to the edit forms, if tabs are used\r\n get: function () { return common_1.ItemForm.EditForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListContentTypes\", {\r\n get: function () { return this._listContentTypes; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListFields\", {\r\n get: function () { return this._listFields; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListInfo\", {\r\n get: function () { return this._listInfo; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListViews\", {\r\n get: function () { return this._listViews; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"Items\", {\r\n get: function () { return this._items; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ListName\", {\r\n get: function () { return this._listName; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"OData\", {\r\n get: function () { return this._odata; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForm\", {\r\n // Reference to the display form\r\n get: function () { return common_1.ItemForm.DisplayForm; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"ViewForms\", {\r\n // Reference to the display forms, if tabs are used\r\n get: function () { return common_1.ItemForm.DisplayForms; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(List.prototype, \"WebUrl\", {\r\n get: function () { return this._webUrl; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n // Clears the modal or canvas\r\n List.prototype.clear = function () {\r\n // Clear the modal/form\r\n common_1.ItemForm.UseModal ? common_1.Modal.clear() : common_1.CanvasForm.clear();\r\n // Set the list name\r\n common_1.ItemForm.ListName = this.ListName;\r\n // Call the event\r\n this._onResetForm ? this._onResetForm() : null;\r\n };\r\n // Reference to the create item method\r\n List.prototype.createItem = function (values) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Create the item\r\n _this.ListInfo.Items().add(values).execute(resolve, reject);\r\n });\r\n };\r\n // Displays the new form\r\n List.prototype.newForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear();\r\n // Display the form\r\n common_1.ItemForm.create(props).then(null, this._onLoadFormError);\r\n };\r\n // Displays the edit form\r\n List.prototype.editForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear();\r\n // Display the form\r\n common_1.ItemForm.edit(props).then(null, this._onLoadFormError);\r\n };\r\n // Initializes the list component\r\n List.prototype.init = function () {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n var list = (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName);\r\n // Query the list content types\r\n list.execute(function (list) {\r\n // Save the list information\r\n _this._listInfo = list;\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n });\r\n // Query the content types\r\n list.ContentTypes().query({\r\n Expand: [\"FieldLinks\", \"Fields\"]\r\n }).execute(function (cts) {\r\n // Save the content types\r\n _this._listContentTypes = cts.results;\r\n }, true);\r\n // Query the list fields\r\n list.Fields().execute(function (fields) {\r\n // Save the fields\r\n _this._listFields = fields.results;\r\n }, true);\r\n // Query the list views\r\n list.Views().query({\r\n Expand: [\"FieldLinks\", \"Fields\"]\r\n }).execute(function (views) {\r\n // Save the views\r\n _this._listViews = views.results;\r\n }, true);\r\n // Wait for the requests to complete\r\n list.done(function () {\r\n // Resolve the request\r\n resolve();\r\n });\r\n });\r\n };\r\n // Loads the items\r\n List.prototype.loadItems = function (query) {\r\n var _this = this;\r\n if (query === void 0) { query = this.OData; }\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // See if the items exist\r\n if (_this._items) {\r\n return _this._items;\r\n }\r\n // Query the items\r\n (0, gd_sprest_bs_1.Web)(_this.WebUrl).Lists(_this.ListName).Items().query(query).execute(function (items) {\r\n // Save the items\r\n _this._items = items.results;\r\n // Resolve the request\r\n resolve(_this._items);\r\n }, function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Reject the request\r\n reject.apply(void 0, args);\r\n }, true);\r\n });\r\n };\r\n // Refresh the data\r\n List.prototype.refresh = function (query) {\r\n if (query === void 0) { query = this.OData; }\r\n // Clear the items\r\n this._items = null;\r\n // Load the data\r\n return this.loadItems(query);\r\n };\r\n // Updates an item\r\n List.prototype.updateItem = function (itemId, values) {\r\n var _this = this;\r\n // Return a promise\r\n return new Promise(function (resolve, reject) {\r\n // Create the item\r\n _this.ListInfo.Items(itemId).update(values).execute(resolve, reject);\r\n });\r\n };\r\n // Displays the view form\r\n List.prototype.viewForm = function (props) {\r\n // Clear the modal/canvas\r\n this.clear();\r\n // Display the form\r\n common_1.ItemForm.view(props).then(null, this._onLoadFormError);\r\n };\r\n return List;\r\n}());\r\nexports.List = List;\r\n\n\n//# sourceURL=webpack://dattatable/./build/common/list.js?");
|
|
108
108
|
|
|
109
109
|
/***/ }),
|
|
110
110
|
|