dattatable 0.9.3 → 0.9.7
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/common/documents.d.ts +71 -0
- package/build/common/documents.js +922 -0
- package/build/common/index.d.ts +2 -0
- package/build/common/index.js +6 -2
- package/build/common/installRequired.js +1 -1
- package/build/common/methods.d.ts +3 -0
- package/build/common/methods.js +41 -0
- package/build/dashboard/navigation.js +1 -1
- package/build/index.js +3 -1
- package/build/styles.js +1 -1
- package/dist/dattatable.js +1017 -764
- package/dist/dattatable.min.js +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +51 -8
- package/docs/classes/CanvasForm.html +1 -1
- package/docs/classes/Dashboard.html +2 -2
- package/docs/classes/DataTable.html +2 -2
- package/docs/classes/Documents.html +18 -0
- package/docs/classes/FilterSlideout.html +1 -1
- package/docs/classes/Footer.html +1 -1
- package/docs/classes/Header.html +1 -1
- package/docs/classes/InstallationRequired.html +1 -1
- package/docs/classes/ItemForm.html +3 -3
- package/docs/classes/LoadingDialog.html +1 -1
- package/docs/classes/Modal.html +1 -1
- package/docs/classes/Navigation.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/IDashboardProps.html +1 -1
- package/docs/interfaces/IDataTable.html +1 -1
- package/docs/interfaces/IDataTableProps.html +1 -1
- package/docs/interfaces/IDocumentsProps.html +3 -0
- package/docs/interfaces/IFilterItem.html +1 -1
- package/docs/interfaces/IFilterProps.html +1 -1
- package/docs/interfaces/IFooterProps.html +1 -1
- package/docs/interfaces/IHeaderProps.html +1 -1
- package/docs/modules.html +2 -2
- package/package.json +10 -9
- package/pnpm-lock.yaml +206 -176
|
@@ -0,0 +1,922 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Documents = void 0;
|
|
4
|
+
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
5
|
+
var jQuery = require("jquery");
|
|
6
|
+
var moment = require("moment");
|
|
7
|
+
var table_1 = require("../dashboard/table");
|
|
8
|
+
var itemForm_1 = require("../itemForm");
|
|
9
|
+
var loadingDialog_1 = require("./loadingDialog");
|
|
10
|
+
var methods_1 = require("./methods");
|
|
11
|
+
/** Icons */
|
|
12
|
+
var bookmarkPlus_1 = require("gd-sprest-bs/build/icons/svgs/bookmarkPlus");
|
|
13
|
+
var fileEarmark_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmark");
|
|
14
|
+
var fileEarmarkArrowDown_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkArrowDown");
|
|
15
|
+
var fileEarmarkArrowUp_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkArrowUp");
|
|
16
|
+
var fileEarmarkBarGraph_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkBarGraph");
|
|
17
|
+
var fileEarmarkBinary_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkBinary");
|
|
18
|
+
var fileEarmarkCode_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkCode");
|
|
19
|
+
var fileEarmarkExcel_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkExcel");
|
|
20
|
+
var fileEarmarkImage_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkImage");
|
|
21
|
+
var fileEarmarkMusic_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkMusic");
|
|
22
|
+
var fileEarmarkPdf_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkPdf");
|
|
23
|
+
var fileEarmarkPpt_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkPpt");
|
|
24
|
+
var fileEarmarkPlay_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkPlay");
|
|
25
|
+
var fileEarmarkRichtext_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkRichtext");
|
|
26
|
+
var fileEarmarkSpreadsheet_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkSpreadsheet");
|
|
27
|
+
var fileEarmarkText_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkText");
|
|
28
|
+
var fileEarmarkWord_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkWord");
|
|
29
|
+
var fileEarmarkZip_1 = require("gd-sprest-bs/build/icons/svgs/fileEarmarkZip");
|
|
30
|
+
var front_1 = require("gd-sprest-bs/build/icons/svgs/front");
|
|
31
|
+
var inputCursorText_1 = require("gd-sprest-bs/build/icons/svgs/inputCursorText");
|
|
32
|
+
var layoutTextSidebar_1 = require("gd-sprest-bs/build/icons/svgs/layoutTextSidebar");
|
|
33
|
+
var x_1 = require("gd-sprest-bs/build/icons/svgs/x");
|
|
34
|
+
/**
|
|
35
|
+
* Documents
|
|
36
|
+
* Renders a data table containing the contents of a document library.
|
|
37
|
+
*/
|
|
38
|
+
var Documents = /** @class */ (function () {
|
|
39
|
+
function Documents() {
|
|
40
|
+
}
|
|
41
|
+
Object.defineProperty(Documents, "DataTable", {
|
|
42
|
+
get: function () { return this._dt; },
|
|
43
|
+
enumerable: false,
|
|
44
|
+
configurable: true
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(Documents, "DocSetId", {
|
|
47
|
+
get: function () { return this._docSetId; },
|
|
48
|
+
set: function (value) { this._docSetId = value; },
|
|
49
|
+
enumerable: false,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(Documents, "ListName", {
|
|
53
|
+
get: function () { return this._listName; },
|
|
54
|
+
set: function (value) { this._listName = value; },
|
|
55
|
+
enumerable: false,
|
|
56
|
+
configurable: true
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(Documents, "CanDelete", {
|
|
59
|
+
get: function () { return this._canDelete; },
|
|
60
|
+
set: function (value) { this._canDelete = value; },
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(Documents, "CanEdit", {
|
|
65
|
+
get: function () { return this._canEdit; },
|
|
66
|
+
set: function (value) { this._canEdit = value; },
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(Documents, "CanView", {
|
|
71
|
+
get: function () { return this._canView; },
|
|
72
|
+
set: function (value) { this._canView = value; },
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(Documents, "RootFolder", {
|
|
77
|
+
get: function () { return this._rootFolder; },
|
|
78
|
+
enumerable: false,
|
|
79
|
+
configurable: true
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(Documents, "TableElement", {
|
|
82
|
+
get: function () { return this._elTable; },
|
|
83
|
+
enumerable: false,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(Documents, "TemplateFiles", {
|
|
87
|
+
get: function () { return this._templatesFiles; },
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(Documents, "TemplateFolders", {
|
|
92
|
+
get: function () { return this._templateFolders; },
|
|
93
|
+
enumerable: false,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(Documents, "TemplatesUrl", {
|
|
97
|
+
get: function () { return this._templatesUrl; },
|
|
98
|
+
set: function (value) { this._templatesUrl = value; },
|
|
99
|
+
enumerable: false,
|
|
100
|
+
configurable: true
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Copies a file to a folder to the library
|
|
104
|
+
* @param item The dropdown item containing the file/folder to copy.
|
|
105
|
+
*/
|
|
106
|
+
Documents.copyFile = function (item) {
|
|
107
|
+
var _this = this;
|
|
108
|
+
// Show a loading dialog
|
|
109
|
+
loadingDialog_1.LoadingDialog.setHeader("Initializing the Transfer");
|
|
110
|
+
loadingDialog_1.LoadingDialog.setBody("Copying the file(s) to the workspace...");
|
|
111
|
+
loadingDialog_1.LoadingDialog.show();
|
|
112
|
+
// See if this is a folder
|
|
113
|
+
if (item.data.Files) {
|
|
114
|
+
// Parse the files
|
|
115
|
+
var folder = item.data;
|
|
116
|
+
gd_sprest_bs_1.Helper.Executor(folder.Files.results, function (file) {
|
|
117
|
+
// Return a promise
|
|
118
|
+
return new Promise(function (resolve) {
|
|
119
|
+
// Get the file contents
|
|
120
|
+
(0, gd_sprest_bs_1.Web)().getFileByServerRelativeUrl(file.ServerRelativeUrl).content().execute(function (data) {
|
|
121
|
+
// Copy the file
|
|
122
|
+
(0, gd_sprest_bs_1.List)(_this.ListName).RootFolder().Files().add(file.Name, true, data).execute(resolve, resolve);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}).then(function () {
|
|
126
|
+
// Close the dialog
|
|
127
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
128
|
+
// Refresh the page
|
|
129
|
+
_this.refresh();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Copy the file
|
|
134
|
+
var file_1 = item.data;
|
|
135
|
+
file_1.content().execute(function (data) {
|
|
136
|
+
// Copy the file
|
|
137
|
+
(0, gd_sprest_bs_1.List)(_this.ListName).RootFolder().Files().add(file_1.Name, true, data).execute(function () {
|
|
138
|
+
// Close the dialog
|
|
139
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
140
|
+
// Refresh the page
|
|
141
|
+
_this.refresh();
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
// Generates the template files/folders dropdown items
|
|
147
|
+
Documents.generateItems = function () {
|
|
148
|
+
var _this = this;
|
|
149
|
+
var items = [];
|
|
150
|
+
// Parse the template folders
|
|
151
|
+
for (var i = 0; i < this.TemplateFolders.length; i++) {
|
|
152
|
+
var folder = this.TemplateFolders[i];
|
|
153
|
+
// Skip the internal forms folder
|
|
154
|
+
if (folder.Name == "Forms") {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
// Add a dropdown item
|
|
158
|
+
items.push({
|
|
159
|
+
text: folder.Name,
|
|
160
|
+
data: folder,
|
|
161
|
+
value: folder.ServerRelativeUrl,
|
|
162
|
+
onClick: function (item) { _this.copyFile(item); }
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
// Parse the template files
|
|
166
|
+
for (var i = 0; i < this.TemplateFiles.length; i++) {
|
|
167
|
+
var file = this.TemplateFiles[i];
|
|
168
|
+
// Add a dropdown item
|
|
169
|
+
items.push({
|
|
170
|
+
text: file.Name,
|
|
171
|
+
data: file,
|
|
172
|
+
value: file.ServerRelativeUrl,
|
|
173
|
+
onClick: function (item) { _this.copyFile(item); }
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// Return the dropdown items
|
|
177
|
+
return items;
|
|
178
|
+
};
|
|
179
|
+
// Returns the extension of a file name
|
|
180
|
+
Documents.getFileExt = function (fileName) {
|
|
181
|
+
var extension = fileName.split('.');
|
|
182
|
+
return extension[extension.length - 1].toLowerCase();
|
|
183
|
+
};
|
|
184
|
+
// Determines if the document can be viewed in office online servers
|
|
185
|
+
Documents.isWopi = function (file) {
|
|
186
|
+
switch (this.getFileExt(file.Name)) {
|
|
187
|
+
// Excel
|
|
188
|
+
case "csv":
|
|
189
|
+
case "doc":
|
|
190
|
+
case "docx":
|
|
191
|
+
case "dot":
|
|
192
|
+
case "dotx":
|
|
193
|
+
case "pot":
|
|
194
|
+
case "potx":
|
|
195
|
+
case "pps":
|
|
196
|
+
case "ppsx":
|
|
197
|
+
case "ppt":
|
|
198
|
+
case "pptx":
|
|
199
|
+
case "xls":
|
|
200
|
+
case "xlsx":
|
|
201
|
+
case "xlt":
|
|
202
|
+
case "xltx":
|
|
203
|
+
return true;
|
|
204
|
+
// Default
|
|
205
|
+
default: {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
// Loads the data
|
|
211
|
+
Documents.load = function () {
|
|
212
|
+
var _this = this;
|
|
213
|
+
// Return a promise
|
|
214
|
+
return new Promise(function (resolve, reject) {
|
|
215
|
+
var web = (0, gd_sprest_bs_1.Web)();
|
|
216
|
+
// See if the templates library was set
|
|
217
|
+
if (_this.TemplatesUrl) {
|
|
218
|
+
// Load the files and folders
|
|
219
|
+
web.getFolderByServerRelativeUrl(_this.TemplatesUrl).query({
|
|
220
|
+
Expand: ["Folders/Files", "Files"]
|
|
221
|
+
}).execute(function (folder) {
|
|
222
|
+
// Set the template files
|
|
223
|
+
_this._templatesFiles = folder.Files.results;
|
|
224
|
+
// Set the template folders
|
|
225
|
+
_this._templateFolders = folder.Folders.results;
|
|
226
|
+
}, reject);
|
|
227
|
+
}
|
|
228
|
+
// See if we are targeting a document set folder
|
|
229
|
+
if (_this.DocSetId) {
|
|
230
|
+
web.Lists(_this.ListName).Items(_this.DocSetId).Folder().query({
|
|
231
|
+
Expand: [
|
|
232
|
+
"Folders/Files", "Folders/Files/Author",
|
|
233
|
+
"Folders/Files/ListItemAllFields", "Folders/Files/ModifiedBy",
|
|
234
|
+
"Files", "Files/Author", "Files/ListItemAllFields", "Files/ModifiedBy"
|
|
235
|
+
]
|
|
236
|
+
}).execute(function (folder) {
|
|
237
|
+
// Set the root folder
|
|
238
|
+
_this._rootFolder = folder;
|
|
239
|
+
}, reject);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
// Load library information
|
|
243
|
+
web.Lists(_this.ListName).RootFolder().query({
|
|
244
|
+
Expand: [
|
|
245
|
+
"Folders/Files", "Folders/Files/Author",
|
|
246
|
+
"Folders/Files/ListItemAllFields", "Folders/Files/ModifiedBy",
|
|
247
|
+
"Files", "Files/Author", "Files/ListItemAllFields", "Files/ModifiedBy"
|
|
248
|
+
]
|
|
249
|
+
}).execute(function (folder) {
|
|
250
|
+
// Set the root folder
|
|
251
|
+
_this._rootFolder = folder;
|
|
252
|
+
}, reject);
|
|
253
|
+
}
|
|
254
|
+
// Wait for the requests to complete
|
|
255
|
+
web.done(function () {
|
|
256
|
+
// Resolve the request
|
|
257
|
+
resolve();
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
// Renders the file actions
|
|
262
|
+
Documents.renderActionButtons = function (el, file) {
|
|
263
|
+
var _this = this;
|
|
264
|
+
var isWopi = this.isWopi(file);
|
|
265
|
+
// Create a span to wrap the icons in
|
|
266
|
+
var span = document.createElement("span");
|
|
267
|
+
span.className = "bg-white d-inline-flex ms-2 rounded";
|
|
268
|
+
var spanEdit = span.cloneNode();
|
|
269
|
+
var spanProps = span.cloneNode();
|
|
270
|
+
var spanDownload = span.cloneNode();
|
|
271
|
+
var spanDel = span.cloneNode();
|
|
272
|
+
spanDel.classList.add("me-1");
|
|
273
|
+
// Add the icons
|
|
274
|
+
el.appendChild(span);
|
|
275
|
+
el.appendChild(spanEdit);
|
|
276
|
+
el.appendChild(spanProps);
|
|
277
|
+
el.appendChild(spanDownload);
|
|
278
|
+
el.appendChild(spanDel);
|
|
279
|
+
// Render a View tooltip
|
|
280
|
+
gd_sprest_bs_1.Components.Tooltip({
|
|
281
|
+
el: span,
|
|
282
|
+
content: "View",
|
|
283
|
+
btnProps: {
|
|
284
|
+
// Render the icon button
|
|
285
|
+
className: "img-flip-x p-1",
|
|
286
|
+
iconType: front_1.front,
|
|
287
|
+
iconSize: 24,
|
|
288
|
+
isDisabled: !this.CanView,
|
|
289
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
290
|
+
onClick: function () {
|
|
291
|
+
if (_this.CanView) {
|
|
292
|
+
// Open the file in a new tab
|
|
293
|
+
window.open(isWopi ? gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/WopiFrame.aspx?sourcedoc=" + file.ServerRelativeUrl + "&action=view" : file.ServerRelativeUrl, "_blank");
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
// Render an Edit tooltip
|
|
299
|
+
gd_sprest_bs_1.Components.Tooltip({
|
|
300
|
+
el: spanEdit,
|
|
301
|
+
content: "Edit",
|
|
302
|
+
btnProps: {
|
|
303
|
+
// Render the icon button
|
|
304
|
+
className: "p-1",
|
|
305
|
+
iconType: inputCursorText_1.inputCursorText,
|
|
306
|
+
iconSize: 24,
|
|
307
|
+
isDisabled: (!isWopi || !this.CanEdit),
|
|
308
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
309
|
+
onClick: function () {
|
|
310
|
+
if (isWopi && _this.CanEdit) {
|
|
311
|
+
// Open the file in a new tab
|
|
312
|
+
window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/WopiFrame.aspx?sourcedoc=" + file.ServerRelativeUrl + "&action=edit");
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
// Render a Properties tooltip
|
|
318
|
+
gd_sprest_bs_1.Components.Tooltip({
|
|
319
|
+
el: spanProps,
|
|
320
|
+
content: "Properties",
|
|
321
|
+
btnProps: {
|
|
322
|
+
// Render the icon button
|
|
323
|
+
className: "p-1",
|
|
324
|
+
iconType: layoutTextSidebar_1.layoutTextSidebar,
|
|
325
|
+
iconSize: 24,
|
|
326
|
+
isDisabled: !this.CanEdit,
|
|
327
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
328
|
+
onClick: function () {
|
|
329
|
+
if (_this.CanEdit) {
|
|
330
|
+
// Set the item form properties
|
|
331
|
+
itemForm_1.ItemForm.ListName = _this.ListName;
|
|
332
|
+
itemForm_1.ItemForm.UseModal = false;
|
|
333
|
+
// Show the edit form
|
|
334
|
+
itemForm_1.ItemForm.edit({
|
|
335
|
+
itemId: file.ListItemAllFields["Id"],
|
|
336
|
+
onCreateEditForm: function (props) {
|
|
337
|
+
// Set the fields to display
|
|
338
|
+
props.includeFields = ["FileLeafRef", "Title"];
|
|
339
|
+
// Set the rendering event
|
|
340
|
+
props.onControlRendering = function (ctrl, field) {
|
|
341
|
+
if (field.InternalName == "FileLeafRef") {
|
|
342
|
+
// Validate the name of the file
|
|
343
|
+
ctrl.onValidate = function (ctrl, results) {
|
|
344
|
+
var _a;
|
|
345
|
+
// Ensure the value is less than 128 characters
|
|
346
|
+
if (((_a = results.value) === null || _a === void 0 ? void 0 : _a.length) > 128) {
|
|
347
|
+
// Return an error message
|
|
348
|
+
results.invalidMessage = "The file name must be less than 128 characters.";
|
|
349
|
+
results.isValid = false;
|
|
350
|
+
}
|
|
351
|
+
// Return the results
|
|
352
|
+
return results;
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
// See if this is the title field
|
|
356
|
+
else if (field.InternalName == "Title") {
|
|
357
|
+
// Update the label
|
|
358
|
+
ctrl.label = "Description";
|
|
359
|
+
// Validate the length of the description
|
|
360
|
+
ctrl.onValidate = function (ctrl, result) {
|
|
361
|
+
var _a;
|
|
362
|
+
// Ensure the value is less than 255 characters
|
|
363
|
+
if (((_a = result.value) === null || _a === void 0 ? void 0 : _a.length) > 255) {
|
|
364
|
+
// Return an error message
|
|
365
|
+
result.invalidMessage = "The description must be less than 255 characters.";
|
|
366
|
+
result.isValid = false;
|
|
367
|
+
}
|
|
368
|
+
// Valid
|
|
369
|
+
else
|
|
370
|
+
result.isValid = true;
|
|
371
|
+
return result;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
// Return the properties
|
|
376
|
+
return props;
|
|
377
|
+
},
|
|
378
|
+
onSetFooter: function (el) {
|
|
379
|
+
var updateBtn = el.querySelector('[role="group"]').firstChild;
|
|
380
|
+
updateBtn.classList.remove("btn-outline-primary");
|
|
381
|
+
updateBtn.classList.add("btn-primary");
|
|
382
|
+
},
|
|
383
|
+
onSetHeader: function (el) {
|
|
384
|
+
// Update the header
|
|
385
|
+
el.querySelector("h5").innerHTML = "Properties";
|
|
386
|
+
},
|
|
387
|
+
onUpdate: function () {
|
|
388
|
+
_this.refresh();
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
});
|
|
395
|
+
// Render a Download tooltip
|
|
396
|
+
gd_sprest_bs_1.Components.Tooltip({
|
|
397
|
+
el: spanDownload,
|
|
398
|
+
content: "Download",
|
|
399
|
+
btnProps: {
|
|
400
|
+
// Render the icon button
|
|
401
|
+
className: "p-1",
|
|
402
|
+
iconType: fileEarmarkArrowDown_1.fileEarmarkArrowDown,
|
|
403
|
+
iconSize: 24,
|
|
404
|
+
isDisabled: !this.CanView,
|
|
405
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
406
|
+
onClick: function () {
|
|
407
|
+
if (_this.CanView) {
|
|
408
|
+
window.open(gd_sprest_bs_1.ContextInfo.webServerRelativeUrl + "/_layouts/15/download.aspx?SourceUrl=" + file.ServerRelativeUrl, "_blank");
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
});
|
|
413
|
+
// Render a Delete tooltip
|
|
414
|
+
gd_sprest_bs_1.Components.Tooltip({
|
|
415
|
+
el: spanDel,
|
|
416
|
+
content: "Delete",
|
|
417
|
+
btnProps: {
|
|
418
|
+
// Render the icon button
|
|
419
|
+
className: "p-1",
|
|
420
|
+
iconType: x_1.x,
|
|
421
|
+
iconSize: 24,
|
|
422
|
+
isDisabled: !this.CanDelete,
|
|
423
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
424
|
+
onClick: function () {
|
|
425
|
+
if (_this.CanDelete) {
|
|
426
|
+
// Confirm we want to delete the item
|
|
427
|
+
if (confirm("Are you sure you want to delete this document?")) {
|
|
428
|
+
// Display a loading dialog
|
|
429
|
+
loadingDialog_1.LoadingDialog.setHeader("Deleting Document");
|
|
430
|
+
loadingDialog_1.LoadingDialog.setBody("Deleting Document: " + file.Name + ". This will close afterwards.");
|
|
431
|
+
loadingDialog_1.LoadingDialog.show();
|
|
432
|
+
// Delete the document
|
|
433
|
+
(0, gd_sprest_bs_1.Web)().getFileByServerRelativeUrl(file.ServerRelativeUrl).delete().execute(
|
|
434
|
+
// Success
|
|
435
|
+
function () {
|
|
436
|
+
// close dialog
|
|
437
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
438
|
+
// Refresh the page
|
|
439
|
+
_this.refresh();
|
|
440
|
+
},
|
|
441
|
+
// Error
|
|
442
|
+
function (err) {
|
|
443
|
+
// TODO
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
// Renders the file icon
|
|
452
|
+
Documents.renderFileIcon = function (el, file) {
|
|
453
|
+
// Render the icon wrapper
|
|
454
|
+
var span = document.createElement("span");
|
|
455
|
+
span.className = "text-muted";
|
|
456
|
+
el.appendChild(span);
|
|
457
|
+
// Render the icon
|
|
458
|
+
var size = 28;
|
|
459
|
+
switch (this.getFileExt(file.Name)) {
|
|
460
|
+
// Power BI
|
|
461
|
+
case "pbix":
|
|
462
|
+
span.appendChild((0, fileEarmarkBarGraph_1.fileEarmarkBarGraph)(size));
|
|
463
|
+
span.title = "Power BI Report";
|
|
464
|
+
break;
|
|
465
|
+
// Binary
|
|
466
|
+
case "bin":
|
|
467
|
+
case "blg":
|
|
468
|
+
case "dat":
|
|
469
|
+
case "dmg":
|
|
470
|
+
case "dmp":
|
|
471
|
+
case "log":
|
|
472
|
+
case "pbi":
|
|
473
|
+
span.appendChild((0, fileEarmarkBinary_1.fileEarmarkBinary)(size));
|
|
474
|
+
span.title = "Binary File";
|
|
475
|
+
break;
|
|
476
|
+
// Code
|
|
477
|
+
case "asp":
|
|
478
|
+
case "aspx":
|
|
479
|
+
case "css":
|
|
480
|
+
case "hta":
|
|
481
|
+
case "htm":
|
|
482
|
+
case "html":
|
|
483
|
+
case "js":
|
|
484
|
+
case "json":
|
|
485
|
+
case "mht":
|
|
486
|
+
case "mhtml":
|
|
487
|
+
case "scss":
|
|
488
|
+
case "xml":
|
|
489
|
+
case "yaml":
|
|
490
|
+
span.appendChild((0, fileEarmarkCode_1.fileEarmarkCode)(size));
|
|
491
|
+
span.title = "Code";
|
|
492
|
+
break;
|
|
493
|
+
// Excel
|
|
494
|
+
case "csv":
|
|
495
|
+
case "ods":
|
|
496
|
+
case "xls":
|
|
497
|
+
case "xlsx":
|
|
498
|
+
case "xlt":
|
|
499
|
+
case "xltx":
|
|
500
|
+
span.appendChild((0, fileEarmarkExcel_1.fileEarmarkExcel)(size));
|
|
501
|
+
span.title = "Excel Spreadsheet";
|
|
502
|
+
break;
|
|
503
|
+
// Image
|
|
504
|
+
case "ai":
|
|
505
|
+
case "bmp":
|
|
506
|
+
case "eps":
|
|
507
|
+
case "gif":
|
|
508
|
+
case "heic":
|
|
509
|
+
case "heif":
|
|
510
|
+
case "jpe":
|
|
511
|
+
case "jpeg":
|
|
512
|
+
case "jpg":
|
|
513
|
+
case "png":
|
|
514
|
+
case "psd":
|
|
515
|
+
case "svg":
|
|
516
|
+
case "tif":
|
|
517
|
+
case "tiff":
|
|
518
|
+
case "webp":
|
|
519
|
+
span.appendChild((0, fileEarmarkImage_1.fileEarmarkImage)(size));
|
|
520
|
+
span.title = "Image";
|
|
521
|
+
break;
|
|
522
|
+
// Audio
|
|
523
|
+
case "aac":
|
|
524
|
+
case "aiff":
|
|
525
|
+
case "alac":
|
|
526
|
+
case "flac":
|
|
527
|
+
case "m4a":
|
|
528
|
+
case "m4p":
|
|
529
|
+
case "mka":
|
|
530
|
+
case "mp3":
|
|
531
|
+
case "mp4a":
|
|
532
|
+
case "wav":
|
|
533
|
+
case "wma":
|
|
534
|
+
span.appendChild((0, fileEarmarkMusic_1.fileEarmarkMusic)(size));
|
|
535
|
+
span.title = "Audio File";
|
|
536
|
+
break;
|
|
537
|
+
// PDF
|
|
538
|
+
case "pdf":
|
|
539
|
+
span.appendChild((0, fileEarmarkPdf_1.fileEarmarkPdf)(size));
|
|
540
|
+
span.title = "Adobe PDF";
|
|
541
|
+
break;
|
|
542
|
+
// PowerPoint
|
|
543
|
+
case "odp":
|
|
544
|
+
case "pot":
|
|
545
|
+
case "potx":
|
|
546
|
+
case "pps":
|
|
547
|
+
case "ppsx":
|
|
548
|
+
case "ppt":
|
|
549
|
+
case "pptx":
|
|
550
|
+
span.appendChild((0, fileEarmarkPpt_1.fileEarmarkPpt)(size));
|
|
551
|
+
span.title = "PowerPoint Presentation";
|
|
552
|
+
break;
|
|
553
|
+
// Media
|
|
554
|
+
case "avi":
|
|
555
|
+
case "flv":
|
|
556
|
+
case "m2ts":
|
|
557
|
+
case "mkv":
|
|
558
|
+
case "mov":
|
|
559
|
+
case "m4p":
|
|
560
|
+
case "m4v":
|
|
561
|
+
case "mp4":
|
|
562
|
+
case "mpe":
|
|
563
|
+
case "mpeg":
|
|
564
|
+
case "mpg":
|
|
565
|
+
case "mpv":
|
|
566
|
+
case "qt":
|
|
567
|
+
case "ts":
|
|
568
|
+
case "vob":
|
|
569
|
+
case "webm":
|
|
570
|
+
case "wmv":
|
|
571
|
+
span.appendChild((0, fileEarmarkPlay_1.fileEarmarkPlay)(size));
|
|
572
|
+
span.title = "Media File";
|
|
573
|
+
break;
|
|
574
|
+
// Rich Text
|
|
575
|
+
case "rtf":
|
|
576
|
+
span.appendChild((0, fileEarmarkRichtext_1.fileEarmarkRichtext)(size));
|
|
577
|
+
span.title = "Rich Text";
|
|
578
|
+
break;
|
|
579
|
+
// Database
|
|
580
|
+
case "ldf":
|
|
581
|
+
case "mdb":
|
|
582
|
+
case "mdf":
|
|
583
|
+
span.appendChild((0, fileEarmarkSpreadsheet_1.fileEarmarkSpreadsheet)(size));
|
|
584
|
+
span.title = "Database";
|
|
585
|
+
break;
|
|
586
|
+
// Text
|
|
587
|
+
case "md":
|
|
588
|
+
case "text":
|
|
589
|
+
case "txt":
|
|
590
|
+
span.appendChild((0, fileEarmarkText_1.fileEarmarkText)(size));
|
|
591
|
+
span.title = "Text";
|
|
592
|
+
break;
|
|
593
|
+
// Word
|
|
594
|
+
case "doc":
|
|
595
|
+
case "docx":
|
|
596
|
+
case "dot":
|
|
597
|
+
case "dotx":
|
|
598
|
+
case "odt":
|
|
599
|
+
case "wpd":
|
|
600
|
+
span.appendChild((0, fileEarmarkWord_1.fileEarmarkWord)(size));
|
|
601
|
+
span.title = "Word Document";
|
|
602
|
+
break;
|
|
603
|
+
// Compressed
|
|
604
|
+
case "7z":
|
|
605
|
+
case "cab":
|
|
606
|
+
case "gz":
|
|
607
|
+
case "iso":
|
|
608
|
+
case "rar":
|
|
609
|
+
case "tgz":
|
|
610
|
+
case "zip":
|
|
611
|
+
span.appendChild((0, fileEarmarkZip_1.fileEarmarkZip)(size));
|
|
612
|
+
span.title = "Compressed Folder";
|
|
613
|
+
break;
|
|
614
|
+
// Default
|
|
615
|
+
default: {
|
|
616
|
+
span.appendChild((0, fileEarmark_1.fileEarmark)(size));
|
|
617
|
+
span.title = "File";
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
// Renders the navigation
|
|
622
|
+
Documents.renderNavigation = function (el) {
|
|
623
|
+
var _this = this;
|
|
624
|
+
var nav = gd_sprest_bs_1.Components.Navbar({
|
|
625
|
+
el: el,
|
|
626
|
+
brand: "Documents View",
|
|
627
|
+
itemsEnd: [
|
|
628
|
+
{
|
|
629
|
+
text: "Templates",
|
|
630
|
+
className: "btn btn-sm btn-outline-secondary",
|
|
631
|
+
iconSize: 20,
|
|
632
|
+
iconType: bookmarkPlus_1.bookmarkPlus,
|
|
633
|
+
isButton: true,
|
|
634
|
+
items: this.generateItems(),
|
|
635
|
+
onRender: function (el) {
|
|
636
|
+
el.classList.add("bg-white");
|
|
637
|
+
el.querySelector("svg").style.margin = "0 0.25rem 0.1rem -0.25rem";
|
|
638
|
+
},
|
|
639
|
+
onMenuRendering: function (props) {
|
|
640
|
+
// Update the placement
|
|
641
|
+
props.options.offset = [7, 0];
|
|
642
|
+
// Return the properties
|
|
643
|
+
return props;
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
text: "Upload",
|
|
648
|
+
onRender: function (el, item) {
|
|
649
|
+
// Clear the existing button
|
|
650
|
+
el.innerHTML = "";
|
|
651
|
+
// Create a span to wrap the icon in
|
|
652
|
+
var span = document.createElement("span");
|
|
653
|
+
span.className = "bg-white d-inline-flex ms-2 rounded";
|
|
654
|
+
el.appendChild(span);
|
|
655
|
+
// Render a tooltip
|
|
656
|
+
gd_sprest_bs_1.Components.Tooltip({
|
|
657
|
+
el: span,
|
|
658
|
+
content: item.text,
|
|
659
|
+
btnProps: {
|
|
660
|
+
// Render the icon button
|
|
661
|
+
className: "p-1",
|
|
662
|
+
iconType: fileEarmarkArrowUp_1.fileEarmarkArrowUp,
|
|
663
|
+
iconSize: 24,
|
|
664
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
665
|
+
onClick: function () {
|
|
666
|
+
// Show the file upload dialog
|
|
667
|
+
gd_sprest_bs_1.Helper.ListForm.showFileDialog().then(function (fileInfo) {
|
|
668
|
+
// Show a loading dialog
|
|
669
|
+
loadingDialog_1.LoadingDialog.setHeader("Uploading File");
|
|
670
|
+
loadingDialog_1.LoadingDialog.setBody("Saving the file you selected. Please wait...");
|
|
671
|
+
loadingDialog_1.LoadingDialog.show();
|
|
672
|
+
// Upload the file to the objective folder
|
|
673
|
+
(0, gd_sprest_bs_1.List)(_this.ListName).RootFolder().Files().add(fileInfo.name, true, fileInfo.data).execute(
|
|
674
|
+
// Success
|
|
675
|
+
function (file) {
|
|
676
|
+
// Hide the dialog
|
|
677
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
678
|
+
// Refresh the page
|
|
679
|
+
_this.refresh();
|
|
680
|
+
},
|
|
681
|
+
// Error
|
|
682
|
+
function (err) {
|
|
683
|
+
// Hide the dialog
|
|
684
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
685
|
+
});
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
]
|
|
693
|
+
});
|
|
694
|
+
/* Fix the padding on the left & right of the nav */
|
|
695
|
+
nav.el.querySelector("div.container-fluid").classList.add("ps-75");
|
|
696
|
+
nav.el.querySelector("div.container-fluid").classList.add("pe-2");
|
|
697
|
+
};
|
|
698
|
+
// Renders the datatable with the file information
|
|
699
|
+
Documents.renderTable = function () {
|
|
700
|
+
var _this = this;
|
|
701
|
+
// Clear the table element
|
|
702
|
+
while (this._elTable.firstChild) {
|
|
703
|
+
this._elTable.removeChild(this._elTable.firstChild);
|
|
704
|
+
}
|
|
705
|
+
// Create an array containing the file information
|
|
706
|
+
var files = this.RootFolder.Files.results;
|
|
707
|
+
// Parse the folders
|
|
708
|
+
for (var i = 0; i < this.RootFolder.Folders.results.length; i++) {
|
|
709
|
+
var folder = this.RootFolder.Folders.results[i];
|
|
710
|
+
// Append files
|
|
711
|
+
files = files.concat(folder.Files.results);
|
|
712
|
+
}
|
|
713
|
+
// Render the table
|
|
714
|
+
this._dt = new table_1.DataTable({
|
|
715
|
+
el: this._elTable,
|
|
716
|
+
rows: files,
|
|
717
|
+
dtProps: {
|
|
718
|
+
dom: 'rt<"row"<"col-sm-4"l><"col-sm-4"i><"col-sm-4"p>>',
|
|
719
|
+
columnDefs: [
|
|
720
|
+
{ targets: 0, searchable: false },
|
|
721
|
+
{
|
|
722
|
+
targets: 2, render: function (data, type, row) {
|
|
723
|
+
// Limit the length of the Description column to 50 chars
|
|
724
|
+
var esc = function (t) {
|
|
725
|
+
return t
|
|
726
|
+
.replace(/&/g, '&')
|
|
727
|
+
.replace(/</g, '<')
|
|
728
|
+
.replace(/>/g, '>')
|
|
729
|
+
.replace(/"/g, '"');
|
|
730
|
+
};
|
|
731
|
+
// Order, search and type get the original data
|
|
732
|
+
if (type !== 'display') {
|
|
733
|
+
return data;
|
|
734
|
+
}
|
|
735
|
+
if (typeof data !== 'number' && typeof data !== 'string') {
|
|
736
|
+
return data;
|
|
737
|
+
}
|
|
738
|
+
data = data.toString(); // cast numbers
|
|
739
|
+
if (data.length < 50) {
|
|
740
|
+
return data;
|
|
741
|
+
}
|
|
742
|
+
// Find the last white space character in the string
|
|
743
|
+
var trunc = esc(data.substr(0, 50).replace(/\s([^\s]*)$/, ''));
|
|
744
|
+
return '<span title="' + esc(data) + '">' + trunc + '…</span>';
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
targets: 8,
|
|
749
|
+
orderable: false,
|
|
750
|
+
searchable: false
|
|
751
|
+
}
|
|
752
|
+
],
|
|
753
|
+
createdRow: function (row, data, index) {
|
|
754
|
+
jQuery('td', row).addClass('align-middle');
|
|
755
|
+
},
|
|
756
|
+
// Add some classes to the dataTable elements
|
|
757
|
+
drawCallback: function (settings) {
|
|
758
|
+
var api = new jQuery.fn.dataTable.Api(settings);
|
|
759
|
+
jQuery(api.context[0].nTable).removeClass('no-footer');
|
|
760
|
+
jQuery(api.context[0].nTable).addClass('tbl-footer');
|
|
761
|
+
jQuery(api.context[0].nTable).addClass('table-striped');
|
|
762
|
+
jQuery(api.context[0].nTableWrapper).find('.dataTables_info').addClass('text-center');
|
|
763
|
+
jQuery(api.context[0].nTableWrapper).find('.dataTables_length').addClass('pt-2');
|
|
764
|
+
jQuery(api.context[0].nTableWrapper).find('.dataTables_paginate').addClass('pt-03');
|
|
765
|
+
},
|
|
766
|
+
headerCallback: function (thead, data, start, end, display) {
|
|
767
|
+
jQuery('th', thead).addClass('align-middle');
|
|
768
|
+
},
|
|
769
|
+
// Order by the 1st column by default; ascending
|
|
770
|
+
order: [[1, "asc"]]
|
|
771
|
+
},
|
|
772
|
+
columns: [
|
|
773
|
+
{
|
|
774
|
+
name: "",
|
|
775
|
+
title: "Type",
|
|
776
|
+
onRenderCell: function (el, col, file) {
|
|
777
|
+
// Render the file
|
|
778
|
+
_this.renderFileIcon(el, file);
|
|
779
|
+
// Set the sort value
|
|
780
|
+
el.setAttribute("data-sort", _this.getFileExt(file.Name));
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
name: "",
|
|
785
|
+
title: "Name",
|
|
786
|
+
onRenderCell: function (el, col, file) {
|
|
787
|
+
// Render the file name
|
|
788
|
+
el.innerHTML = file.Name;
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
name: "",
|
|
793
|
+
title: "Description",
|
|
794
|
+
onRenderCell: function (el, col, file) {
|
|
795
|
+
// Render the file description
|
|
796
|
+
el.innerHTML = file.Title;
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
name: "",
|
|
801
|
+
title: "File Size",
|
|
802
|
+
onRenderCell: function (el, col, file) {
|
|
803
|
+
// Render the file size value
|
|
804
|
+
el.innerHTML = (0, methods_1.formatBytes)(file.Length);
|
|
805
|
+
// Set the sort value
|
|
806
|
+
el.setAttribute("data-sort", file.Length.toString());
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
name: "",
|
|
811
|
+
title: "Created",
|
|
812
|
+
onRenderCell: function (el, col, file) {
|
|
813
|
+
// Render the date/time value
|
|
814
|
+
el.innerHTML = (0, methods_1.formatTimeValue)(file.TimeCreated);
|
|
815
|
+
// Set the date/time filter/sort values
|
|
816
|
+
el.setAttribute("data-filter", moment(file.TimeCreated).format("dddd MMMM DD YYYY"));
|
|
817
|
+
el.setAttribute("data-sort", file.TimeCreated);
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
name: "",
|
|
822
|
+
title: "Created By",
|
|
823
|
+
onRenderCell: function (el, col, file) {
|
|
824
|
+
// Render the Person field Title
|
|
825
|
+
el.innerHTML = file.Author["Title"];
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
name: "",
|
|
830
|
+
title: "Modified",
|
|
831
|
+
onRenderCell: function (el, col, file) {
|
|
832
|
+
// Render the date/time value
|
|
833
|
+
el.innerHTML = (0, methods_1.formatTimeValue)(file.TimeLastModified);
|
|
834
|
+
// Set the date/time filter/sort values
|
|
835
|
+
el.setAttribute("data-filter", moment(file.TimeLastModified).format("dddd MMMM DD YYYY"));
|
|
836
|
+
el.setAttribute("data-sort", file.TimeLastModified);
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
name: "",
|
|
841
|
+
title: "Modified By",
|
|
842
|
+
onRenderCell: function (el, col, file) {
|
|
843
|
+
// Render the Person field Title
|
|
844
|
+
el.innerHTML = file.ModifiedBy["Title"];
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
className: "text-end text-nowrap",
|
|
849
|
+
name: "",
|
|
850
|
+
title: "",
|
|
851
|
+
onRenderCell: function (el, col, file) {
|
|
852
|
+
// Render the action buttons
|
|
853
|
+
_this.renderActionButtons(el, file);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
]
|
|
857
|
+
});
|
|
858
|
+
};
|
|
859
|
+
/** Public Methods */
|
|
860
|
+
// Refreshes the documents
|
|
861
|
+
Documents.refresh = function () {
|
|
862
|
+
var _this = this;
|
|
863
|
+
// Show a loading dialog
|
|
864
|
+
loadingDialog_1.LoadingDialog.setHeader("Reloading Workspace");
|
|
865
|
+
loadingDialog_1.LoadingDialog.setBody("Reloading the workspace data. This will close afterwards.");
|
|
866
|
+
loadingDialog_1.LoadingDialog.show();
|
|
867
|
+
// Clear the element
|
|
868
|
+
this._elTable.parentElement.removeChild(this._elTable);
|
|
869
|
+
this._elTable = null;
|
|
870
|
+
// Load the workspace item
|
|
871
|
+
this.load().then(function () {
|
|
872
|
+
// Render the component
|
|
873
|
+
_this.render(_this._elTable.parentElement);
|
|
874
|
+
// Hide the dialog
|
|
875
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
876
|
+
});
|
|
877
|
+
};
|
|
878
|
+
// Renders the component
|
|
879
|
+
Documents.render = function (el) {
|
|
880
|
+
var _this = this;
|
|
881
|
+
// Load the data
|
|
882
|
+
this.load().then(function () {
|
|
883
|
+
// Render the navigation
|
|
884
|
+
_this.renderNavigation(el);
|
|
885
|
+
// Create the element to render the table to
|
|
886
|
+
_this._elTable = document.createElement("div");
|
|
887
|
+
el.appendChild(_this._elTable);
|
|
888
|
+
// Render the table
|
|
889
|
+
_this.renderTable();
|
|
890
|
+
});
|
|
891
|
+
};
|
|
892
|
+
// Searches the data table
|
|
893
|
+
Documents.search = function (value) {
|
|
894
|
+
// Search the table data
|
|
895
|
+
this._dt.search(value);
|
|
896
|
+
};
|
|
897
|
+
Documents._props = null;
|
|
898
|
+
/** The data table. */
|
|
899
|
+
Documents._dt = null;
|
|
900
|
+
/** The document set item id. */
|
|
901
|
+
Documents._docSetId = null;
|
|
902
|
+
/** The library name. */
|
|
903
|
+
Documents._listName = null;
|
|
904
|
+
// Can delete documents
|
|
905
|
+
Documents._canDelete = true;
|
|
906
|
+
// Can edit documents
|
|
907
|
+
Documents._canEdit = true;
|
|
908
|
+
// Can view documents
|
|
909
|
+
Documents._canView = true;
|
|
910
|
+
// The root folder of the library
|
|
911
|
+
Documents._rootFolder = null;
|
|
912
|
+
// The table element
|
|
913
|
+
Documents._elTable = null;
|
|
914
|
+
// The template files
|
|
915
|
+
Documents._templatesFiles = null;
|
|
916
|
+
// The template folders
|
|
917
|
+
Documents._templateFolders = null;
|
|
918
|
+
/** Templates Library (Optional) */
|
|
919
|
+
Documents._templatesUrl = null;
|
|
920
|
+
return Documents;
|
|
921
|
+
}());
|
|
922
|
+
exports.Documents = Documents;
|