@memberjunction/ng-file-storage 5.21.0 → 5.23.0
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/dist/lib/category-tree/category-tree.d.ts +29 -5
- package/dist/lib/category-tree/category-tree.d.ts.map +1 -1
- package/dist/lib/category-tree/category-tree.js +226 -104
- package/dist/lib/category-tree/category-tree.js.map +1 -1
- package/dist/lib/file-browser/file-grid.component.js +1 -2
- package/dist/lib/file-browser/file-grid.component.js.map +1 -1
- package/dist/lib/file-browser/folder-tree.component.js +4 -4
- package/dist/lib/file-browser/folder-tree.component.js.map +1 -1
- package/dist/lib/file-upload/file-upload.d.ts +15 -5
- package/dist/lib/file-upload/file-upload.d.ts.map +1 -1
- package/dist/lib/file-upload/file-upload.js +54 -33
- package/dist/lib/file-upload/file-upload.js.map +1 -1
- package/dist/lib/files-grid/files-grid.d.ts +14 -0
- package/dist/lib/files-grid/files-grid.d.ts.map +1 -1
- package/dist/lib/files-grid/files-grid.js +123 -71
- package/dist/lib/files-grid/files-grid.js.map +1 -1
- package/dist/lib/module.d.ts +6 -17
- package/dist/lib/module.d.ts.map +1 -1
- package/dist/lib/module.js +13 -53
- package/dist/lib/module.js.map +1 -1
- package/package.json +21 -19
|
@@ -1,71 +1,45 @@
|
|
|
1
1
|
import { Component, Input } from '@angular/core';
|
|
2
2
|
import { RunView } from '@memberjunction/core';
|
|
3
3
|
import { GraphQLDataProvider, gql } from '@memberjunction/graphql-dataprovider';
|
|
4
|
+
import { ModuleRegistry, AllCommunityModule, themeAlpine, colorSchemeVariable } from 'ag-grid-community';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
import * as i1 from "@memberjunction/ng-shared";
|
|
7
8
|
import * as i2 from "@angular/forms";
|
|
8
|
-
import * as i3 from "
|
|
9
|
-
import * as i4 from "@
|
|
10
|
-
import * as i5 from "@
|
|
11
|
-
import * as i6 from "
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const _r1 = i0.ɵɵgetCurrentView();
|
|
16
|
-
i0.ɵɵelementStart(0, "button", 12);
|
|
17
|
-
i0.ɵɵlistener("click", function FilesGridComponent_ng_template_8_Template_button_click_0_listener() { const dataItem_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.downloadFile(dataItem_r2)); });
|
|
18
|
-
i0.ɵɵelement(1, "span", 13);
|
|
19
|
-
i0.ɵɵelementEnd();
|
|
20
|
-
i0.ɵɵelementStart(2, "button", 12);
|
|
21
|
-
i0.ɵɵlistener("click", function FilesGridComponent_ng_template_8_Template_button_click_2_listener() { const dataItem_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.deleteFile(dataItem_r2)); });
|
|
22
|
-
i0.ɵɵelement(3, "span", 14);
|
|
23
|
-
i0.ɵɵelementEnd();
|
|
24
|
-
i0.ɵɵelementStart(4, "button", 12);
|
|
25
|
-
i0.ɵɵlistener("click", function FilesGridComponent_ng_template_8_Template_button_click_4_listener() { const dataItem_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.editFile = dataItem_r2); });
|
|
26
|
-
i0.ɵɵelement(5, "span", 15);
|
|
9
|
+
import * as i3 from "ag-grid-angular";
|
|
10
|
+
import * as i4 from "@memberjunction/ng-shared-generic";
|
|
11
|
+
import * as i5 from "@memberjunction/ng-ui-components";
|
|
12
|
+
import * as i6 from "../file-upload/file-upload";
|
|
13
|
+
function FilesGridComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
14
|
+
i0.ɵɵelementStart(0, "div", 2);
|
|
15
|
+
i0.ɵɵelement(1, "mj-loading", 9);
|
|
27
16
|
i0.ɵɵelementEnd();
|
|
28
|
-
} if (rf & 2) {
|
|
29
|
-
const dataItem_r2 = ctx.$implicit;
|
|
30
|
-
const ctx_r2 = i0.ɵɵnextContext();
|
|
31
|
-
i0.ɵɵproperty("disabled", dataItem_r2.Status !== "Uploaded");
|
|
32
|
-
i0.ɵɵadvance(2);
|
|
33
|
-
i0.ɵɵproperty("disabled", !ctx_r2.canBeDeleted(dataItem_r2));
|
|
34
|
-
i0.ɵɵadvance(2);
|
|
35
|
-
i0.ɵɵproperty("disabled", dataItem_r2.Status !== "Uploaded");
|
|
36
17
|
} }
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
i0.ɵɵelementStart(0, "
|
|
40
|
-
i0.ɵɵ
|
|
41
|
-
i0.ɵɵ
|
|
42
|
-
i0.ɵɵ
|
|
18
|
+
function FilesGridComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
20
|
+
i0.ɵɵelementStart(0, "div", 6)(1, "form", null, 0)(3, "label", 10)(4, "span", 11);
|
|
21
|
+
i0.ɵɵtext(5, "Name");
|
|
22
|
+
i0.ɵɵelementEnd();
|
|
23
|
+
i0.ɵɵelementStart(6, "input", 12);
|
|
24
|
+
i0.ɵɵtwoWayListener("ngModelChange", function FilesGridComponent_Conditional_5_Template_input_ngModelChange_6_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.editFile.Name, $event) || (ctx_r1.editFile.Name = $event); return i0.ɵɵresetView($event); });
|
|
43
25
|
i0.ɵɵelementEnd()();
|
|
44
|
-
i0.ɵɵelementStart(
|
|
45
|
-
i0.ɵɵ
|
|
46
|
-
i0.ɵɵelementEnd()()()();
|
|
47
|
-
i0.ɵɵelementStart(8, "kendo-dialog-actions")(9, "button", 12);
|
|
48
|
-
i0.ɵɵlistener("click", function FilesGridComponent_Conditional_10_Template_button_click_9_listener() { i0.ɵɵrestoreView(_r4); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.resetEditFile()); });
|
|
49
|
-
i0.ɵɵtext(10, "Cancel");
|
|
26
|
+
i0.ɵɵelementStart(7, "label", 10)(8, "span", 11);
|
|
27
|
+
i0.ɵɵtext(9, "Description");
|
|
50
28
|
i0.ɵɵelementEnd();
|
|
51
|
-
i0.ɵɵelementStart(
|
|
52
|
-
i0.ɵɵ
|
|
53
|
-
i0.ɵɵ
|
|
54
|
-
i0.ɵɵelementEnd()()();
|
|
29
|
+
i0.ɵɵelementStart(10, "input", 13);
|
|
30
|
+
i0.ɵɵtwoWayListener("ngModelChange", function FilesGridComponent_Conditional_5_Template_input_ngModelChange_10_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.editFile.Description, $event) || (ctx_r1.editFile.Description = $event); return i0.ɵɵresetView($event); });
|
|
31
|
+
i0.ɵɵelementEnd()()()();
|
|
55
32
|
} if (rf & 2) {
|
|
56
|
-
const
|
|
57
|
-
i0.ɵɵ
|
|
58
|
-
i0.ɵɵ
|
|
59
|
-
i0.ɵɵ
|
|
60
|
-
i0.ɵɵ
|
|
61
|
-
i0.ɵɵ
|
|
62
|
-
i0.ɵɵ
|
|
63
|
-
i0.ɵɵproperty("disabled", ctx_r2.isLoading);
|
|
64
|
-
i0.ɵɵadvance(2);
|
|
65
|
-
i0.ɵɵproperty("disabled", ctx_r2.isLoading);
|
|
66
|
-
i0.ɵɵadvance(2);
|
|
67
|
-
i0.ɵɵproperty("disabled", ctx_r2.isLoading || !ctx_r2.editFile.Dirty);
|
|
33
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
34
|
+
i0.ɵɵadvance(6);
|
|
35
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.editFile.Name);
|
|
36
|
+
i0.ɵɵproperty("disabled", ctx_r1.isLoading);
|
|
37
|
+
i0.ɵɵadvance(4);
|
|
38
|
+
i0.ɵɵtwoWayProperty("ngModel", ctx_r1.editFile.Description);
|
|
39
|
+
i0.ɵɵproperty("disabled", ctx_r1.isLoading);
|
|
68
40
|
} }
|
|
41
|
+
// Register AG Grid modules
|
|
42
|
+
ModuleRegistry.registerModules([AllCommunityModule]);
|
|
69
43
|
/**
|
|
70
44
|
* Downloads a file from the provided URL.
|
|
71
45
|
*
|
|
@@ -112,8 +86,18 @@ export class FilesGridComponent {
|
|
|
112
86
|
files = [];
|
|
113
87
|
isLoading = false;
|
|
114
88
|
editFile;
|
|
89
|
+
// AG Grid configuration
|
|
90
|
+
GridTheme = themeAlpine.withPart(colorSchemeVariable);
|
|
91
|
+
ColumnDefs = [];
|
|
92
|
+
DefaultColDef = {
|
|
93
|
+
sortable: true,
|
|
94
|
+
resizable: true,
|
|
95
|
+
filter: false,
|
|
96
|
+
};
|
|
97
|
+
gridApi = null;
|
|
115
98
|
constructor(sharedService) {
|
|
116
99
|
this.sharedService = sharedService;
|
|
100
|
+
this.ColumnDefs = this.buildColumnDefs();
|
|
117
101
|
}
|
|
118
102
|
CategoryID = undefined;
|
|
119
103
|
ngOnInit() {
|
|
@@ -124,6 +108,9 @@ export class FilesGridComponent {
|
|
|
124
108
|
this.Refresh();
|
|
125
109
|
}
|
|
126
110
|
}
|
|
111
|
+
OnGridReady(event) {
|
|
112
|
+
this.gridApi = event.api;
|
|
113
|
+
}
|
|
127
114
|
/**
|
|
128
115
|
* Resets the edited file.
|
|
129
116
|
*
|
|
@@ -151,6 +138,10 @@ export class FilesGridComponent {
|
|
|
151
138
|
if (success) {
|
|
152
139
|
this.sharedService.CreateSimpleNotification(`Successfully saved file ${this.editFile.ID} ${this.editFile.Name}`, 'success');
|
|
153
140
|
this.editFile = undefined;
|
|
141
|
+
// Refresh the grid to show the updated data
|
|
142
|
+
if (this.gridApi) {
|
|
143
|
+
this.gridApi.setGridOption('rowData', this.files);
|
|
144
|
+
}
|
|
154
145
|
}
|
|
155
146
|
else {
|
|
156
147
|
this.sharedService.CreateSimpleNotification(`Unable to save file ${this.editFile.ID} ${this.editFile.Name}`, 'error');
|
|
@@ -193,7 +184,6 @@ export class FilesGridComponent {
|
|
|
193
184
|
canBeDeleted(file) {
|
|
194
185
|
const status = file.Status;
|
|
195
186
|
const deletable = status === 'Uploaded' || Date.now() - +file.__mj_CreatedAt > 10 * 60 * 60;
|
|
196
|
-
// console.log({ status, deletable, ID: file.ID, CreatedAt: file.CreatedAt });
|
|
197
187
|
return deletable;
|
|
198
188
|
}
|
|
199
189
|
/**
|
|
@@ -229,6 +219,7 @@ export class FilesGridComponent {
|
|
|
229
219
|
return;
|
|
230
220
|
}
|
|
231
221
|
this.files.push(e.file);
|
|
222
|
+
this.files = [...this.files]; // trigger AG Grid row data change
|
|
232
223
|
this.isLoading = false;
|
|
233
224
|
}
|
|
234
225
|
/**
|
|
@@ -251,32 +242,93 @@ export class FilesGridComponent {
|
|
|
251
242
|
}
|
|
252
243
|
this.isLoading = false;
|
|
253
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Builds AG Grid column definitions from the entity fields.
|
|
247
|
+
*/
|
|
248
|
+
buildColumnDefs() {
|
|
249
|
+
return [
|
|
250
|
+
{ field: 'ID', headerName: 'ID' },
|
|
251
|
+
{ field: 'Category', headerName: 'Category' },
|
|
252
|
+
{ field: 'Name', headerName: 'Name' },
|
|
253
|
+
{ field: 'Description', headerName: 'Description' },
|
|
254
|
+
{ field: 'Status', headerName: 'Status' },
|
|
255
|
+
{
|
|
256
|
+
headerName: 'Actions',
|
|
257
|
+
sortable: false,
|
|
258
|
+
resizable: false,
|
|
259
|
+
filter: false,
|
|
260
|
+
cellRenderer: (params) => {
|
|
261
|
+
const container = document.createElement('div');
|
|
262
|
+
container.className = 'action-buttons';
|
|
263
|
+
const downloadBtn = this.createActionButton('fa-download', params.data?.Status !== 'Uploaded');
|
|
264
|
+
downloadBtn.addEventListener('click', () => this.downloadFile(params.data));
|
|
265
|
+
const deleteBtn = this.createActionButton('fa-trash-can', !this.canBeDeleted(params.data));
|
|
266
|
+
deleteBtn.addEventListener('click', () => this.deleteFile(params.data));
|
|
267
|
+
const editBtn = this.createActionButton('fa-pen-to-square', params.data?.Status !== 'Uploaded');
|
|
268
|
+
editBtn.addEventListener('click', () => { this.editFile = params.data; });
|
|
269
|
+
container.appendChild(downloadBtn);
|
|
270
|
+
container.appendChild(deleteBtn);
|
|
271
|
+
container.appendChild(editBtn);
|
|
272
|
+
return container;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Creates a small action button element for the AG Grid cell renderer.
|
|
279
|
+
*/
|
|
280
|
+
createActionButton(iconClass, disabled) {
|
|
281
|
+
const btn = document.createElement('button');
|
|
282
|
+
btn.className = 'mj-btn mj-btn-flat mj-btn-sm grid-action-btn';
|
|
283
|
+
btn.disabled = disabled;
|
|
284
|
+
const icon = document.createElement('span');
|
|
285
|
+
icon.className = `fa-solid ${iconClass}`;
|
|
286
|
+
btn.appendChild(icon);
|
|
287
|
+
return btn;
|
|
288
|
+
}
|
|
254
289
|
static ɵfac = function FilesGridComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FilesGridComponent)(i0.ɵɵdirectiveInject(i1.SharedService)); };
|
|
255
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FilesGridComponent, selectors: [["mj-files-grid"]], inputs: { CategoryID: "CategoryID" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 11, vars:
|
|
256
|
-
i0.ɵɵelementStart(0, "div", 1)
|
|
257
|
-
i0.ɵɵ
|
|
258
|
-
i0.ɵɵelementStart(
|
|
259
|
-
i0.ɵɵ
|
|
260
|
-
i0.ɵɵelementEnd()
|
|
261
|
-
i0.ɵɵelementStart(
|
|
262
|
-
i0.ɵɵlistener("uploadStarted", function
|
|
290
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FilesGridComponent, selectors: [["mj-files-grid"]], inputs: { CategoryID: "CategoryID" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 11, vars: 14, consts: [["templateForm", "ngForm"], [1, "container"], [1, "grid-loading-overlay"], [1, "files-grid", 3, "gridReady", "theme", "rowData", "columnDefs", "defaultColDef", "loading"], [3, "uploadStarted", "fileUpload", "CategoryID", "disabled"], ["Title", "Edit file", 3, "Close", "Visible", "Width", "MinWidth"], [1, "edit-form-container"], ["mjButton", "", "variant", "primary", 3, "click", "disabled"], ["mjButton", "", 3, "click", "disabled"], ["text", "Loading files...", "size", "medium"], [1, "mj-form-field"], [1, "mj-form-label"], ["name", "name", "required", "", 1, "mj-input", 3, "ngModelChange", "ngModel", "disabled"], ["name", "description", 1, "mj-input", 3, "ngModelChange", "ngModel", "disabled"]], template: function FilesGridComponent_Template(rf, ctx) { if (rf & 1) {
|
|
291
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
292
|
+
i0.ɵɵconditionalCreate(1, FilesGridComponent_Conditional_1_Template, 2, 0, "div", 2);
|
|
293
|
+
i0.ɵɵelementStart(2, "ag-grid-angular", 3);
|
|
294
|
+
i0.ɵɵlistener("gridReady", function FilesGridComponent_Template_ag_grid_angular_gridReady_2_listener($event) { return ctx.OnGridReady($event); });
|
|
295
|
+
i0.ɵɵelementEnd();
|
|
296
|
+
i0.ɵɵelementStart(3, "mj-files-file-upload", 4);
|
|
297
|
+
i0.ɵɵlistener("uploadStarted", function FilesGridComponent_Template_mj_files_file_upload_uploadStarted_3_listener() { return ctx.isLoading = true; })("fileUpload", function FilesGridComponent_Template_mj_files_file_upload_fileUpload_3_listener($event) { return ctx.handleFileUpload($event); });
|
|
263
298
|
i0.ɵɵelementEnd();
|
|
264
|
-
i0.ɵɵ
|
|
299
|
+
i0.ɵɵelementStart(4, "mj-dialog", 5);
|
|
300
|
+
i0.ɵɵlistener("Close", function FilesGridComponent_Template_mj_dialog_Close_4_listener() { return ctx.resetEditFile(); });
|
|
301
|
+
i0.ɵɵconditionalCreate(5, FilesGridComponent_Conditional_5_Template, 11, 4, "div", 6);
|
|
302
|
+
i0.ɵɵelementStart(6, "mj-dialog-actions")(7, "button", 7);
|
|
303
|
+
i0.ɵɵlistener("click", function FilesGridComponent_Template_button_click_7_listener() { return ctx.saveEditFile(); });
|
|
304
|
+
i0.ɵɵtext(8, "Save");
|
|
265
305
|
i0.ɵɵelementEnd();
|
|
306
|
+
i0.ɵɵelementStart(9, "button", 8);
|
|
307
|
+
i0.ɵɵlistener("click", function FilesGridComponent_Template_button_click_9_listener() { return ctx.resetEditFile(); });
|
|
308
|
+
i0.ɵɵtext(10, "Cancel");
|
|
309
|
+
i0.ɵɵelementEnd()()()();
|
|
266
310
|
} if (rf & 2) {
|
|
267
311
|
i0.ɵɵadvance();
|
|
268
|
-
i0.ɵɵ
|
|
269
|
-
i0.ɵɵadvance(
|
|
312
|
+
i0.ɵɵconditional(ctx.isLoading ? 1 : -1);
|
|
313
|
+
i0.ɵɵadvance();
|
|
314
|
+
i0.ɵɵproperty("theme", ctx.GridTheme)("rowData", ctx.files)("columnDefs", ctx.ColumnDefs)("defaultColDef", ctx.DefaultColDef)("loading", ctx.isLoading);
|
|
315
|
+
i0.ɵɵadvance();
|
|
270
316
|
i0.ɵɵproperty("CategoryID", ctx.CategoryID)("disabled", ctx.isLoading);
|
|
271
317
|
i0.ɵɵadvance();
|
|
272
|
-
i0.ɵɵ
|
|
273
|
-
|
|
318
|
+
i0.ɵɵproperty("Visible", !!ctx.editFile)("Width", 450)("MinWidth", 250);
|
|
319
|
+
i0.ɵɵadvance();
|
|
320
|
+
i0.ɵɵconditional(ctx.editFile ? 5 : -1);
|
|
321
|
+
i0.ɵɵadvance(2);
|
|
322
|
+
i0.ɵɵproperty("disabled", ctx.isLoading || !(ctx.editFile == null ? null : ctx.editFile.Dirty));
|
|
323
|
+
i0.ɵɵadvance(2);
|
|
324
|
+
i0.ɵɵproperty("disabled", ctx.isLoading);
|
|
325
|
+
} }, dependencies: [i2.ɵNgNoValidate, i2.DefaultValueAccessor, i2.NgControlStatus, i2.NgControlStatusGroup, i2.RequiredValidator, i2.NgModel, i2.NgForm, i3.AgGridAngular, i4.LoadingComponent, i5.MJButtonDirective, i5.MJDialogComponent, i5.MJDialogActionsComponent, i6.FileUploadComponent], styles: [".container[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n}\n\n.files-grid[_ngcontent-%COMP%] {\n width: 100%;\n height: 400px;\n}\n\n.grid-loading-overlay[_ngcontent-%COMP%] {\n display: flex;\n justify-content: center;\n padding: 16px;\n}\n\n.edit-form-container[_ngcontent-%COMP%] {\n padding: 8px 0;\n}\n\n.mj-form-field[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: row;\n align-items: center;\n column-gap: 12px;\n margin-bottom: 8px;\n}\n\n.mj-form-label[_ngcontent-%COMP%] {\n min-width: 80px;\n color: var(--mj-text-secondary);\n font-weight: 500;\n}\n\n.mj-form-field[_ngcontent-%COMP%] .mj-input[_ngcontent-%COMP%] {\n width: 100%;\n}\n\n.action-buttons[_ngcontent-%COMP%] {\n display: flex;\n gap: 4px;\n}\n\n.grid-action-btn[_ngcontent-%COMP%] {\n background: none;\n border: none;\n cursor: pointer;\n padding: 4px 6px;\n border-radius: 4px;\n color: var(--mj-text-secondary);\n transition: color 0.15s, background-color 0.15s;\n}\n\n.grid-action-btn[_ngcontent-%COMP%]:hover:not(:disabled) {\n color: var(--mj-text-primary);\n background-color: var(--mj-bg-surface-hover);\n}\n\n.grid-action-btn[_ngcontent-%COMP%]:disabled {\n opacity: 0.4;\n cursor: default;\n}"] });
|
|
274
326
|
}
|
|
275
327
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FilesGridComponent, [{
|
|
276
328
|
type: Component,
|
|
277
|
-
args: [{ standalone: false, selector: 'mj-files-grid', template: "<div class=\"container\">\n
|
|
329
|
+
args: [{ standalone: false, selector: 'mj-files-grid', template: "<div class=\"container\">\n @if (isLoading) {\n <div class=\"grid-loading-overlay\">\n <mj-loading text=\"Loading files...\" size=\"medium\"></mj-loading>\n </div>\n }\n <ag-grid-angular\n class=\"files-grid\"\n [theme]=\"GridTheme\"\n [rowData]=\"files\"\n [columnDefs]=\"ColumnDefs\"\n [defaultColDef]=\"DefaultColDef\"\n [loading]=\"isLoading\"\n (gridReady)=\"OnGridReady($event)\">\n </ag-grid-angular>\n\n <mj-files-file-upload\n [CategoryID]=\"CategoryID\"\n [disabled]=\"isLoading\"\n (uploadStarted)=\"isLoading = true\"\n (fileUpload)=\"handleFileUpload($event)\"\n ></mj-files-file-upload>\n\n <mj-dialog\n [Visible]=\"!!editFile\"\n Title=\"Edit file\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"resetEditFile()\">\n @if (editFile) {\n <div class=\"edit-form-container\">\n <form #templateForm=\"ngForm\">\n <label class=\"mj-form-field\">\n <span class=\"mj-form-label\">Name</span>\n <input\n class=\"mj-input\"\n name=\"name\"\n [(ngModel)]=\"editFile.Name\"\n required\n [disabled]=\"isLoading\" />\n </label>\n <label class=\"mj-form-field\">\n <span class=\"mj-form-label\">Description</span>\n <input\n class=\"mj-input\"\n name=\"description\"\n [(ngModel)]=\"editFile.Description\"\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n }\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveEditFile()\" [disabled]=\"isLoading || !editFile?.Dirty\">Save</button>\n <button mjButton (click)=\"resetEditFile()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n</div>\n", styles: [".container {\n display: flex;\n flex-direction: column;\n}\n\n.files-grid {\n width: 100%;\n height: 400px;\n}\n\n.grid-loading-overlay {\n display: flex;\n justify-content: center;\n padding: 16px;\n}\n\n.edit-form-container {\n padding: 8px 0;\n}\n\n.mj-form-field {\n display: flex;\n flex-direction: row;\n align-items: center;\n column-gap: 12px;\n margin-bottom: 8px;\n}\n\n.mj-form-label {\n min-width: 80px;\n color: var(--mj-text-secondary);\n font-weight: 500;\n}\n\n.mj-form-field .mj-input {\n width: 100%;\n}\n\n.action-buttons {\n display: flex;\n gap: 4px;\n}\n\n.grid-action-btn {\n background: none;\n border: none;\n cursor: pointer;\n padding: 4px 6px;\n border-radius: 4px;\n color: var(--mj-text-secondary);\n transition: color 0.15s, background-color 0.15s;\n}\n\n.grid-action-btn:hover:not(:disabled) {\n color: var(--mj-text-primary);\n background-color: var(--mj-bg-surface-hover);\n}\n\n.grid-action-btn:disabled {\n opacity: 0.4;\n cursor: default;\n}\n"] }]
|
|
278
330
|
}], () => [{ type: i1.SharedService }], { CategoryID: [{
|
|
279
331
|
type: Input
|
|
280
332
|
}] }); })();
|
|
281
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FilesGridComponent, { className: "FilesGridComponent", filePath: "src/lib/files-grid/files-grid.ts", lineNumber:
|
|
333
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FilesGridComponent, { className: "FilesGridComponent", filePath: "src/lib/files-grid/files-grid.ts", lineNumber: 76 }); })();
|
|
282
334
|
//# sourceMappingURL=files-grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files-grid.js","sourceRoot":"","sources":["../../../src/lib/files-grid/files-grid.ts","../../../src/lib/files-grid/files-grid.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAoC,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;ICGhB,kCAGG;IADD,oNAAS,gCAAsB,KAAC;IAEhC,2BAA0C;IAC5C,iBAAS;IACT,kCAAwF;IAA/B,oNAAS,8BAAoB,KAAC;IACrF,2BAA2C;IAC7C,iBAAS;I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AY,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;4GAtJU,kBAAkB;6DAAlB,kBAAkB;YC5D7B,AADF,8BAAuB,oBAC4B;YAK/C,AADA,AADA,AADA,AADA,uCAA8D,2BACY,2BACR,2BACc,2BACV;YACtE,4CAAmC;YACjC,mFAAgD;YAkBpD,AADE,iBAAoB,EACT;YAEb,gDAKC;YADC,AADA,6IAA6B,IAAI,IAAC,gHACpB,4BAAwB,IAAC;YACxC,iBAAuB;YAExB,iGAAgB;YAyBlB,iBAAM;;YA3DQ,cAAc;YAAC,AAAf,gCAAc,0BAAsB;YA4B9C,eAAyB;YACzB,AADA,2CAAyB,2BACH;YAKxB,cAwBC;YAxBD,wCAwBC;;;iFDEU,kBAAkB;cAN9B,SAAS;6BACI,KAAK,YACP,eAAe;;kBAWxB,KAAK;;kFAPK,kBAAkB","sourcesContent":["import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\n\nimport { RunView } from '@memberjunction/core';\nimport { MJFileEntity } from '@memberjunction/core-entities';\nimport { GraphQLDataProvider, gql } from '@memberjunction/graphql-dataprovider';\nimport { SharedService } from '@memberjunction/ng-shared';\nimport { z } from 'zod';\nimport { FileUploadEvent } from '../file-upload/file-upload';\n\n/**\n * Downloads a file from the provided URL.\n *\n * @param url - The URL of the file to be downloaded.\n * @param fileName - The name to be given to the downloaded file.\n * @param contentType - The content type of the file. Defaults to 'application/octet-stream'.\n * @returns Promise<void> - A promise that resolves when the file download is complete.\n */\nconst downloadFromUrl = async (url: string, fileName: string, contentType?: string | null) => {\n // First, fetch the data and create a blob with the correct content type\n const response = await fetch(url);\n if (!response.ok) {\n return false;\n }\n const rawBlob = await response.blob();\n const blob = new Blob([rawBlob], { type: contentType || 'application/octet-stream' });\n\n // Then add a temporary link to the document and click it\n const link = document.createElement('a');\n const blobUrl = window.URL.createObjectURL(blob);\n link.href = blobUrl;\n link.setAttribute('download', fileName);\n document.body.appendChild(link);\n link.click();\n link.parentNode?.removeChild(link);\n window.URL.revokeObjectURL(blobUrl);\n\n return true;\n};\n\nconst FileDownloadQuery = gql`\n query FileDownloadUrl($FileID: String!) {\n MJFile(ID: $FileID) {\n ContentType\n DownloadUrl\n }\n }\n`;\n\nconst FileDownloadQuerySchema = z.object({\n MJFile: z.object({\n ContentType: z.string().optional(),\n DownloadUrl: z.string(),\n }),\n});\n\n@Component({\n standalone: false,\n selector: 'mj-files-grid',\n templateUrl: './files-grid.html',\n styleUrls: ['./files-grid.css'],\n})\nexport class FilesGridComponent implements OnInit, OnChanges {\n public files: MJFileEntity[] = [];\n public isLoading: boolean = false;\n public editFile: MJFileEntity | undefined;\n\n constructor(private sharedService: SharedService) {}\n\n @Input() CategoryID: string | undefined = undefined;\n\n ngOnInit(): void {\n this.Refresh();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['CategoryID']) {\n this.Refresh();\n }\n }\n\n /**\n * Resets the edited file.\n *\n * This method reverts any changes made to the edited file by calling the Revert method of the MJFileEntity class. It then sets the editFile property to undefined, indicating that there is no longer an edited file.\n *\n * @returns void\n */\n public resetEditFile() {\n this.editFile?.Revert();\n this.editFile = undefined;\n }\n\n /**\n * Saves the edited file.\n *\n * This method saves the changes made to the edited file. It first checks if there is an edited file available. If so, it sets the isLoading property to true to indicate that the save operation is in progress. Then, it calls the Save method of the edited file to save the changes. If the save operation is successful, it creates a success notification using the sharedService.CreateSimpleNotification method. The notification message includes the ID and name of the saved file. Finally, it sets the edited file to undefined and sets the isLoading property to false to indicate that the save operation is complete.\n *\n * @returns Promise<void> - A promise that resolves when the save operation is complete.\n * @throws Error - If there is an error during the save operation.\n */\n public async saveEditFile() {\n if (this.editFile) {\n this.isLoading = true;\n //\n const success = await this.editFile.Save();\n if (success) {\n this.sharedService.CreateSimpleNotification(`Successfully saved file ${this.editFile.ID} ${this.editFile.Name}`, 'success');\n this.editFile = undefined;\n } else {\n this.sharedService.CreateSimpleNotification(`Unable to save file ${this.editFile.ID} ${this.editFile.Name}`, 'error');\n }\n this.isLoading = false;\n }\n }\n\n /**\n * Downloads a file using the provided MJFileEntity.\n *\n * @param file - The MJFileEntity representing the file to be downloaded.\n * @returns Promise<void> - A promise that resolves when the file download is complete.\n * @throws Error - If there is an error during the file download process.\n */\n public downloadFile = async (file: MJFileEntity) => {\n this.isLoading = true;\n const result = await GraphQLDataProvider.ExecuteGQL(FileDownloadQuery, {\n FileID: file.ID,\n });\n const parsedResult = FileDownloadQuerySchema.safeParse(result);\n\n if (parsedResult.success) {\n const downloadUrl = parsedResult.data.MJFile.DownloadUrl;\n const success = downloadFromUrl(downloadUrl, file.Name, file.ContentType);\n if (!success) {\n this.sharedService.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');\n }\n } else {\n console.error(parsedResult.error);\n this.sharedService.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');\n }\n this.isLoading = false;\n };\n\n /**\n * Determines whether a file can be deleted based on its status and creation time.\n *\n * @param file - The MJFileEntity representing the file to be checked.\n * @returns boolean - True if the file can be deleted, false otherwise.\n */\n public canBeDeleted(file: MJFileEntity): boolean {\n const status = file.Status;\n const deletable = status === 'Uploaded' || Date.now() - +file.__mj_CreatedAt > 10 * 60 * 60;\n // console.log({ status, deletable, ID: file.ID, CreatedAt: file.CreatedAt });\n return deletable;\n }\n\n /**\n * Deletes a file using the provided MJFileEntity.\n *\n * @param file - The MJFileEntity representing the file to be deleted.\n * @returns Promise<void> - A promise that resolves when the file deletion is complete.\n * @throws Error - If there is an error during the file deletion process.\n */\n public deleteFile = async (file: MJFileEntity) => {\n this.isLoading = true;\n const ID = file.ID;\n const Name = file.Name;\n const deleteResult = await file.Delete();\n if (deleteResult) {\n this.sharedService.CreateSimpleNotification(`Successfully deleted file ${ID} ${Name}`, 'info');\n this.files = this.files.filter((f) => typeof f.ID === 'string' && f.ID !== ID);\n } else {\n this.sharedService.CreateSimpleNotification(`Unable to delete file ${ID} ${Name}`, 'error');\n }\n this.isLoading = false;\n };\n\n /**\n * Handles the file upload event, sending a notification in case of failure and otherwise adding\n * the newly uploaded files to the files currently displayed.\n *\n * @param e - The file upload event.\n */\n public handleFileUpload(e: FileUploadEvent) {\n if (!e.success) {\n this.sharedService.CreateSimpleNotification(`Unable to upload file '${e.file.name}'`, 'error');\n return;\n }\n\n this.files.push(e.file);\n this.isLoading = false;\n }\n\n /**\n * Refreshes the data by running a view and loading the files.\n * @returns {Promise<void>} - A promise that resolves when the data is refreshed.\n */\n async Refresh() {\n this.isLoading = true;\n\n const rv = new RunView();\n const result = await rv.RunView({\n EntityName: 'MJ: Files',\n ResultType: 'entity_object',\n ...(this.CategoryID !== undefined && { ExtraFilter: `CategoryID='${this.CategoryID}'` }),\n });\n if (result.Success) {\n this.files = <MJFileEntity[]>result.Results ?? [];\n } else {\n throw new Error('Error loading files: ' + result.ErrorMessage);\n }\n this.isLoading = false;\n }\n}\n","<div class=\"container\">\n <kendo-grid [data]=\"files\" [loading]=\"isLoading\">\n <kendo-grid-column field=\"ID\" title=\"ID\"> </kendo-grid-column>\n <kendo-grid-column field=\"Category\" title=\"Category\"> </kendo-grid-column>\n <kendo-grid-column field=\"Name\" title=\"Name\"> </kendo-grid-column>\n <kendo-grid-column field=\"Description\" title=\"Description\"> </kendo-grid-column>\n <kendo-grid-column field=\"Status\" title=\"Status\"> </kendo-grid-column>\n <kendo-grid-column field=\"Actions\">\n <ng-template kendoGridCellTemplate let-dataItem>\n <button kendoButton\n [disabled]=\"dataItem.Status!=='Uploaded'\"\n (click)=\"downloadFile(dataItem)\"\n >\n <span class=\"fa-solid fa-download\"></span>\n </button>\n <button kendoButton [disabled]=\"!canBeDeleted(dataItem)\" (click)=\"deleteFile(dataItem)\">\n <span class=\"fa-solid fa-trash-can\"></span>\n </button>\n <button kendoButton\n [disabled]=\"dataItem.Status!=='Uploaded'\"\n (click)=\"editFile = dataItem\"\n >\n <span class=\"fa-solid fa-pen-to-square\"></span>\n </button>\n </ng-template>\n </kendo-grid-column>\n </kendo-grid>\n\n <mj-files-file-upload\n [CategoryID]=\"CategoryID\"\n [disabled]=\"isLoading\"\n (uploadStarted)=\"isLoading = true\"\n (fileUpload)=\"handleFileUpload($event)\"\n ></mj-files-file-upload>\n\n @if (editFile) {\n <kendo-dialog title=\"Edit file\" (close)=\"resetEditFile()\" [minWidth]=\"250\" [width]=\"450\">\n <div class=\"container\">\n <form #templateForm=\"ngForm\">\n <kendo-label class=\"k-form\" text=\"Name\">\n <kendo-textbox\n name=\"name\"\n [(ngModel)]=\"editFile.Name\"\n [showSuccessIcon]=\"editFile.Name.length > 0\"\n showErrorIcon=\"initial\"\n required\n [disabled]=\"isLoading\"\n ></kendo-textbox>\n </kendo-label>\n <kendo-label class=\"k-form\" text=\"Description\">\n <kendo-textbox name=\"description\" [(ngModel)]=\"editFile.Description\" [disabled]=\"isLoading\"></kendo-textbox>\n </kendo-label>\n </form>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"resetEditFile()\" [disabled]=\"isLoading\">Cancel</button>\n <button kendoButton (click)=\"saveEditFile()\" [disabled]=\"isLoading || !editFile.Dirty\" themeColor=\"primary\">Save</button>\n </kendo-dialog-actions>\n </kendo-dialog>\n }\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"files-grid.js","sourceRoot":"","sources":["../../../src/lib/files-grid/files-grid.ts","../../../src/lib/files-grid/files-grid.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAoC,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAIL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;ICfpB,8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BAAkB;YC3E/B,8BAAuB;YACrB,oFAAiB;YAKjB,0CAOoC;YAAlC,sHAAa,uBAAmB,IAAC;YACnC,iBAAkB;YAElB,+CAKC;YADC,AADA,6IAA6B,IAAI,IAAC,gHACpB,4BAAwB,IAAC;YACxC,iBAAuB;YAExB,oCAK4B;YAA1B,kGAAS,mBAAe,IAAC;YACzB,qFAAgB;YAwBd,AADF,yCAAmB,gBACsF;YAApE,+FAAS,kBAAc,IAAC;YAA4C,oBAAI;YAAA,iBAAS;YACpH,iCAAkE;YAAjD,+FAAS,mBAAe,IAAC;YAAwB,uBAAM;YAG9E,AADE,AADE,AAD0E,iBAAS,EAC/D,EACV,EACR;;YAxDJ,cAIC;YAJD,wCAIC;YAGC,cAAmB;YAInB,AADA,AADA,AADA,AADA,qCAAmB,sBACF,8BACQ,oCACM,0BACV;YAKrB,cAAyB;YACzB,AADA,2CAAyB,2BACH;YAMtB,cAAsB;YAGtB,AADA,AAFA,wCAAsB,cAET,iBACG;YAEhB,cAsBC;YAtBD,uCAsBC;YAE6D,eAA0C;YAA1C,+FAA0C;YAC3D,eAAsB;YAAtB,wCAAsB;;;iFDqB1D,kBAAkB;cAN9B,SAAS;6BACI,KAAK,YACP,eAAe;;kBAuBxB,KAAK;;kFAnBK,kBAAkB","sourcesContent":["import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\n\nimport { RunView } from '@memberjunction/core';\nimport { MJFileEntity } from '@memberjunction/core-entities';\nimport { GraphQLDataProvider, gql } from '@memberjunction/graphql-dataprovider';\nimport { SharedService } from '@memberjunction/ng-shared';\nimport {\n ColDef,\n GridReadyEvent,\n GridApi,\n ModuleRegistry,\n AllCommunityModule,\n themeAlpine,\n colorSchemeVariable,\n type Theme,\n ICellRendererParams\n} from 'ag-grid-community';\nimport { z } from 'zod';\nimport { FileUploadEvent } from '../file-upload/file-upload';\n\n// Register AG Grid modules\nModuleRegistry.registerModules([AllCommunityModule]);\n\n/**\n * Downloads a file from the provided URL.\n *\n * @param url - The URL of the file to be downloaded.\n * @param fileName - The name to be given to the downloaded file.\n * @param contentType - The content type of the file. Defaults to 'application/octet-stream'.\n * @returns Promise<void> - A promise that resolves when the file download is complete.\n */\nconst downloadFromUrl = async (url: string, fileName: string, contentType?: string | null) => {\n // First, fetch the data and create a blob with the correct content type\n const response = await fetch(url);\n if (!response.ok) {\n return false;\n }\n const rawBlob = await response.blob();\n const blob = new Blob([rawBlob], { type: contentType || 'application/octet-stream' });\n\n // Then add a temporary link to the document and click it\n const link = document.createElement('a');\n const blobUrl = window.URL.createObjectURL(blob);\n link.href = blobUrl;\n link.setAttribute('download', fileName);\n document.body.appendChild(link);\n link.click();\n link.parentNode?.removeChild(link);\n window.URL.revokeObjectURL(blobUrl);\n\n return true;\n};\n\nconst FileDownloadQuery = gql`\n query FileDownloadUrl($FileID: String!) {\n MJFile(ID: $FileID) {\n ContentType\n DownloadUrl\n }\n }\n`;\n\nconst FileDownloadQuerySchema = z.object({\n MJFile: z.object({\n ContentType: z.string().optional(),\n DownloadUrl: z.string(),\n }),\n});\n\n@Component({\n standalone: false,\n selector: 'mj-files-grid',\n templateUrl: './files-grid.html',\n styleUrls: ['./files-grid.css'],\n})\nexport class FilesGridComponent implements OnInit, OnChanges {\n public files: MJFileEntity[] = [];\n public isLoading: boolean = false;\n public editFile: MJFileEntity | undefined;\n\n // AG Grid configuration\n public GridTheme: Theme = themeAlpine.withPart(colorSchemeVariable);\n public ColumnDefs: ColDef[] = [];\n public DefaultColDef: ColDef = {\n sortable: true,\n resizable: true,\n filter: false,\n };\n private gridApi: GridApi | null = null;\n\n constructor(private sharedService: SharedService) {\n this.ColumnDefs = this.buildColumnDefs();\n }\n\n @Input() CategoryID: string | undefined = undefined;\n\n ngOnInit(): void {\n this.Refresh();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['CategoryID']) {\n this.Refresh();\n }\n }\n\n public OnGridReady(event: GridReadyEvent): void {\n this.gridApi = event.api;\n }\n\n /**\n * Resets the edited file.\n *\n * This method reverts any changes made to the edited file by calling the Revert method of the MJFileEntity class. It then sets the editFile property to undefined, indicating that there is no longer an edited file.\n *\n * @returns void\n */\n public resetEditFile() {\n this.editFile?.Revert();\n this.editFile = undefined;\n }\n\n /**\n * Saves the edited file.\n *\n * This method saves the changes made to the edited file. It first checks if there is an edited file available. If so, it sets the isLoading property to true to indicate that the save operation is in progress. Then, it calls the Save method of the edited file to save the changes. If the save operation is successful, it creates a success notification using the sharedService.CreateSimpleNotification method. The notification message includes the ID and name of the saved file. Finally, it sets the edited file to undefined and sets the isLoading property to false to indicate that the save operation is complete.\n *\n * @returns Promise<void> - A promise that resolves when the save operation is complete.\n * @throws Error - If there is an error during the save operation.\n */\n public async saveEditFile() {\n if (this.editFile) {\n this.isLoading = true;\n //\n const success = await this.editFile.Save();\n if (success) {\n this.sharedService.CreateSimpleNotification(`Successfully saved file ${this.editFile.ID} ${this.editFile.Name}`, 'success');\n this.editFile = undefined;\n // Refresh the grid to show the updated data\n if (this.gridApi) {\n this.gridApi.setGridOption('rowData', this.files);\n }\n } else {\n this.sharedService.CreateSimpleNotification(`Unable to save file ${this.editFile.ID} ${this.editFile.Name}`, 'error');\n }\n this.isLoading = false;\n }\n }\n\n /**\n * Downloads a file using the provided MJFileEntity.\n *\n * @param file - The MJFileEntity representing the file to be downloaded.\n * @returns Promise<void> - A promise that resolves when the file download is complete.\n * @throws Error - If there is an error during the file download process.\n */\n public downloadFile = async (file: MJFileEntity) => {\n this.isLoading = true;\n const result = await GraphQLDataProvider.ExecuteGQL(FileDownloadQuery, {\n FileID: file.ID,\n });\n const parsedResult = FileDownloadQuerySchema.safeParse(result);\n\n if (parsedResult.success) {\n const downloadUrl = parsedResult.data.MJFile.DownloadUrl;\n const success = downloadFromUrl(downloadUrl, file.Name, file.ContentType);\n if (!success) {\n this.sharedService.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');\n }\n } else {\n console.error(parsedResult.error);\n this.sharedService.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');\n }\n this.isLoading = false;\n };\n\n /**\n * Determines whether a file can be deleted based on its status and creation time.\n *\n * @param file - The MJFileEntity representing the file to be checked.\n * @returns boolean - True if the file can be deleted, false otherwise.\n */\n public canBeDeleted(file: MJFileEntity): boolean {\n const status = file.Status;\n const deletable = status === 'Uploaded' || Date.now() - +file.__mj_CreatedAt > 10 * 60 * 60;\n return deletable;\n }\n\n /**\n * Deletes a file using the provided MJFileEntity.\n *\n * @param file - The MJFileEntity representing the file to be deleted.\n * @returns Promise<void> - A promise that resolves when the file deletion is complete.\n * @throws Error - If there is an error during the file deletion process.\n */\n public deleteFile = async (file: MJFileEntity) => {\n this.isLoading = true;\n const ID = file.ID;\n const Name = file.Name;\n const deleteResult = await file.Delete();\n if (deleteResult) {\n this.sharedService.CreateSimpleNotification(`Successfully deleted file ${ID} ${Name}`, 'info');\n this.files = this.files.filter((f) => typeof f.ID === 'string' && f.ID !== ID);\n } else {\n this.sharedService.CreateSimpleNotification(`Unable to delete file ${ID} ${Name}`, 'error');\n }\n this.isLoading = false;\n };\n\n /**\n * Handles the file upload event, sending a notification in case of failure and otherwise adding\n * the newly uploaded files to the files currently displayed.\n *\n * @param e - The file upload event.\n */\n public handleFileUpload(e: FileUploadEvent) {\n if (!e.success) {\n this.sharedService.CreateSimpleNotification(`Unable to upload file '${e.file.name}'`, 'error');\n return;\n }\n\n this.files.push(e.file);\n this.files = [...this.files]; // trigger AG Grid row data change\n this.isLoading = false;\n }\n\n /**\n * Refreshes the data by running a view and loading the files.\n * @returns {Promise<void>} - A promise that resolves when the data is refreshed.\n */\n async Refresh() {\n this.isLoading = true;\n\n const rv = new RunView();\n const result = await rv.RunView({\n EntityName: 'MJ: Files',\n ResultType: 'entity_object',\n ...(this.CategoryID !== undefined && { ExtraFilter: `CategoryID='${this.CategoryID}'` }),\n });\n if (result.Success) {\n this.files = <MJFileEntity[]>result.Results ?? [];\n } else {\n throw new Error('Error loading files: ' + result.ErrorMessage);\n }\n this.isLoading = false;\n }\n\n /**\n * Builds AG Grid column definitions from the entity fields.\n */\n private buildColumnDefs(): ColDef[] {\n return [\n { field: 'ID', headerName: 'ID' },\n { field: 'Category', headerName: 'Category' },\n { field: 'Name', headerName: 'Name' },\n { field: 'Description', headerName: 'Description' },\n { field: 'Status', headerName: 'Status' },\n {\n headerName: 'Actions',\n sortable: false,\n resizable: false,\n filter: false,\n cellRenderer: (params: ICellRendererParams) => {\n const container = document.createElement('div');\n container.className = 'action-buttons';\n\n const downloadBtn = this.createActionButton('fa-download', params.data?.Status !== 'Uploaded');\n downloadBtn.addEventListener('click', () => this.downloadFile(params.data));\n\n const deleteBtn = this.createActionButton('fa-trash-can', !this.canBeDeleted(params.data));\n deleteBtn.addEventListener('click', () => this.deleteFile(params.data));\n\n const editBtn = this.createActionButton('fa-pen-to-square', params.data?.Status !== 'Uploaded');\n editBtn.addEventListener('click', () => { this.editFile = params.data; });\n\n container.appendChild(downloadBtn);\n container.appendChild(deleteBtn);\n container.appendChild(editBtn);\n\n return container;\n }\n }\n ];\n }\n\n /**\n * Creates a small action button element for the AG Grid cell renderer.\n */\n private createActionButton(iconClass: string, disabled: boolean): HTMLButtonElement {\n const btn = document.createElement('button');\n btn.className = 'mj-btn mj-btn-flat mj-btn-sm grid-action-btn';\n btn.disabled = disabled;\n const icon = document.createElement('span');\n icon.className = `fa-solid ${iconClass}`;\n btn.appendChild(icon);\n return btn;\n }\n}\n","<div class=\"container\">\n @if (isLoading) {\n <div class=\"grid-loading-overlay\">\n <mj-loading text=\"Loading files...\" size=\"medium\"></mj-loading>\n </div>\n }\n <ag-grid-angular\n class=\"files-grid\"\n [theme]=\"GridTheme\"\n [rowData]=\"files\"\n [columnDefs]=\"ColumnDefs\"\n [defaultColDef]=\"DefaultColDef\"\n [loading]=\"isLoading\"\n (gridReady)=\"OnGridReady($event)\">\n </ag-grid-angular>\n\n <mj-files-file-upload\n [CategoryID]=\"CategoryID\"\n [disabled]=\"isLoading\"\n (uploadStarted)=\"isLoading = true\"\n (fileUpload)=\"handleFileUpload($event)\"\n ></mj-files-file-upload>\n\n <mj-dialog\n [Visible]=\"!!editFile\"\n Title=\"Edit file\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"resetEditFile()\">\n @if (editFile) {\n <div class=\"edit-form-container\">\n <form #templateForm=\"ngForm\">\n <label class=\"mj-form-field\">\n <span class=\"mj-form-label\">Name</span>\n <input\n class=\"mj-input\"\n name=\"name\"\n [(ngModel)]=\"editFile.Name\"\n required\n [disabled]=\"isLoading\" />\n </label>\n <label class=\"mj-form-field\">\n <span class=\"mj-form-label\">Description</span>\n <input\n class=\"mj-input\"\n name=\"description\"\n [(ngModel)]=\"editFile.Description\"\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n }\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveEditFile()\" [disabled]=\"isLoading || !editFile?.Dirty\">Save</button>\n <button mjButton (click)=\"resetEditFile()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n</div>\n"]}
|
package/dist/lib/module.d.ts
CHANGED
|
@@ -9,25 +9,14 @@ import * as i7 from "./file-browser/storage-providers-list.component";
|
|
|
9
9
|
import * as i8 from "./file-browser/folder-tree.component";
|
|
10
10
|
import * as i9 from "./file-browser/file-grid.component";
|
|
11
11
|
import * as i10 from "@angular/common";
|
|
12
|
-
import * as i11 from "@
|
|
13
|
-
import * as i12 from "
|
|
14
|
-
import * as i13 from "@
|
|
15
|
-
import * as i14 from "@
|
|
16
|
-
import * as i15 from "@memberjunction/ng-
|
|
17
|
-
import * as i16 from "@memberjunction/ng-shared-generic";
|
|
18
|
-
import * as i17 from "@progress/kendo-angular-buttons";
|
|
19
|
-
import * as i18 from "@progress/kendo-angular-label";
|
|
20
|
-
import * as i19 from "@progress/kendo-angular-grid";
|
|
21
|
-
import * as i20 from "@progress/kendo-angular-dropdowns";
|
|
22
|
-
import * as i21 from "@angular/platform-browser";
|
|
23
|
-
import * as i22 from "@angular/platform-browser/animations";
|
|
24
|
-
import * as i23 from "@progress/kendo-angular-inputs";
|
|
25
|
-
import * as i24 from "@progress/kendo-angular-upload";
|
|
26
|
-
import * as i25 from "@progress/kendo-angular-menu";
|
|
27
|
-
import * as i26 from "@progress/kendo-angular-indicators";
|
|
12
|
+
import * as i11 from "@angular/forms";
|
|
13
|
+
import * as i12 from "ag-grid-angular";
|
|
14
|
+
import * as i13 from "@memberjunction/ng-container-directives";
|
|
15
|
+
import * as i14 from "@memberjunction/ng-shared-generic";
|
|
16
|
+
import * as i15 from "@memberjunction/ng-ui-components";
|
|
28
17
|
export declare class FileStorageModule {
|
|
29
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<FileStorageModule, never>;
|
|
30
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<FileStorageModule, [typeof i1.CategoryTreeComponent, typeof i2.FilesGridComponent, typeof i3.FileUploadComponent, typeof i4.FileBrowserComponent, typeof i5.FileBrowserDemoComponent, typeof i6.FileBrowserResource, typeof i7.StorageProvidersListComponent, typeof i8.FolderTreeComponent, typeof i9.FileGridComponent], [typeof i10.CommonModule, typeof i11.
|
|
19
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<FileStorageModule, [typeof i1.CategoryTreeComponent, typeof i2.FilesGridComponent, typeof i3.FileUploadComponent, typeof i4.FileBrowserComponent, typeof i5.FileBrowserDemoComponent, typeof i6.FileBrowserResource, typeof i7.StorageProvidersListComponent, typeof i8.FolderTreeComponent, typeof i9.FileGridComponent], [typeof i10.CommonModule, typeof i11.FormsModule, typeof i12.AgGridModule, typeof i13.ContainerDirectivesModule, typeof i14.SharedGenericModule, typeof i15.MJButtonDirective, typeof i15.MJDialogComponent, typeof i15.MJDialogActionsComponent], [typeof i1.CategoryTreeComponent, typeof i2.FilesGridComponent, typeof i3.FileUploadComponent, typeof i4.FileBrowserComponent, typeof i5.FileBrowserDemoComponent, typeof i6.FileBrowserResource]>;
|
|
31
20
|
static ɵinj: i0.ɵɵInjectorDeclaration<FileStorageModule>;
|
|
32
21
|
}
|
|
33
22
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/lib/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/lib/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/lib/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,qBA+Ba,iBAAiB;yCAAjB,iBAAiB;0CAAjB,iBAAiB;0CAAjB,iBAAiB;CAAG"}
|
package/dist/lib/module.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import { NgModule } from '@angular/core';
|
|
3
|
-
// Kendo UI Angular imports
|
|
4
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
5
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
6
|
-
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
7
|
-
import { DialogsModule } from '@progress/kendo-angular-dialog';
|
|
8
|
-
import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
|
|
9
|
-
import { GridModule } from '@progress/kendo-angular-grid';
|
|
10
|
-
import { IndicatorsModule } from '@progress/kendo-angular-indicators';
|
|
11
|
-
import { InputsModule } from '@progress/kendo-angular-inputs';
|
|
12
|
-
import { LabelModule } from '@progress/kendo-angular-label';
|
|
13
|
-
import { MenusModule } from '@progress/kendo-angular-menu';
|
|
14
|
-
import { TreeViewModule } from '@progress/kendo-angular-treeview';
|
|
15
3
|
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { AgGridModule } from 'ag-grid-angular';
|
|
5
|
+
import { MJButtonDirective, MJDialogComponent, MJDialogActionsComponent } from '@memberjunction/ng-ui-components';
|
|
16
6
|
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
17
7
|
import { SharedGenericModule } from '@memberjunction/ng-shared-generic';
|
|
18
|
-
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
|
|
19
|
-
import { UploadsModule } from '@progress/kendo-angular-upload';
|
|
20
8
|
import { CategoryTreeComponent } from './category-tree/category-tree';
|
|
21
9
|
import { FileUploadComponent } from './file-upload/file-upload';
|
|
22
10
|
import { FilesGridComponent } from './files-grid/files-grid';
|
|
@@ -31,22 +19,12 @@ export class FileStorageModule {
|
|
|
31
19
|
static ɵfac = function FileStorageModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FileStorageModule)(); };
|
|
32
20
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: FileStorageModule });
|
|
33
21
|
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
34
|
-
TreeViewModule,
|
|
35
22
|
FormsModule,
|
|
36
|
-
|
|
37
|
-
ExcelExportModule,
|
|
23
|
+
AgGridModule,
|
|
38
24
|
ContainerDirectivesModule,
|
|
39
25
|
SharedGenericModule,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
GridModule,
|
|
43
|
-
DropDownsModule,
|
|
44
|
-
BrowserModule,
|
|
45
|
-
BrowserAnimationsModule,
|
|
46
|
-
InputsModule,
|
|
47
|
-
UploadsModule,
|
|
48
|
-
MenusModule,
|
|
49
|
-
IndicatorsModule] });
|
|
26
|
+
MJDialogComponent,
|
|
27
|
+
MJDialogActionsComponent] });
|
|
50
28
|
}
|
|
51
29
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FileStorageModule, [{
|
|
52
30
|
type: NgModule,
|
|
@@ -64,22 +42,13 @@ export class FileStorageModule {
|
|
|
64
42
|
],
|
|
65
43
|
imports: [
|
|
66
44
|
CommonModule,
|
|
67
|
-
TreeViewModule,
|
|
68
45
|
FormsModule,
|
|
69
|
-
|
|
70
|
-
ExcelExportModule,
|
|
46
|
+
AgGridModule,
|
|
71
47
|
ContainerDirectivesModule,
|
|
72
48
|
SharedGenericModule,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
DropDownsModule,
|
|
77
|
-
BrowserModule,
|
|
78
|
-
BrowserAnimationsModule,
|
|
79
|
-
InputsModule,
|
|
80
|
-
UploadsModule,
|
|
81
|
-
MenusModule,
|
|
82
|
-
IndicatorsModule,
|
|
49
|
+
MJButtonDirective,
|
|
50
|
+
MJDialogComponent,
|
|
51
|
+
MJDialogActionsComponent,
|
|
83
52
|
],
|
|
84
53
|
exports: [
|
|
85
54
|
CategoryTreeComponent,
|
|
@@ -100,22 +69,13 @@ export class FileStorageModule {
|
|
|
100
69
|
StorageProvidersListComponent,
|
|
101
70
|
FolderTreeComponent,
|
|
102
71
|
FileGridComponent], imports: [CommonModule,
|
|
103
|
-
TreeViewModule,
|
|
104
72
|
FormsModule,
|
|
105
|
-
|
|
106
|
-
ExcelExportModule,
|
|
73
|
+
AgGridModule,
|
|
107
74
|
ContainerDirectivesModule,
|
|
108
75
|
SharedGenericModule,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
DropDownsModule,
|
|
113
|
-
BrowserModule,
|
|
114
|
-
BrowserAnimationsModule,
|
|
115
|
-
InputsModule,
|
|
116
|
-
UploadsModule,
|
|
117
|
-
MenusModule,
|
|
118
|
-
IndicatorsModule], exports: [CategoryTreeComponent,
|
|
76
|
+
MJButtonDirective,
|
|
77
|
+
MJDialogComponent,
|
|
78
|
+
MJDialogActionsComponent], exports: [CategoryTreeComponent,
|
|
119
79
|
FilesGridComponent,
|
|
120
80
|
FileUploadComponent,
|
|
121
81
|
FileBrowserComponent,
|
package/dist/lib/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/lib/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE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AkB;oBAClB,mBAAmB;oBACnB,oBAAoB;oBACpB,wBAAwB;oBACxB,mBAAmB;oBACnB,6BAA6B;oBAC7B,mBAAmB;oBACnB,iBAAiB;iBAClB;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,YAAY;oBACZ,yBAAyB;oBACzB,mBAAmB;oBACnB,iBAAiB;oBACjB,iBAAiB;oBACjB,wBAAwB;iBACzB;gBACD,OAAO,EAAE;oBACP,qBAAqB;oBACrB,kBAAkB;oBAClB,mBAAmB;oBACnB,oBAAoB;oBACpB,wBAAwB;oBACxB,mBAAmB;iBACpB;aACF;;wFACY,iBAAiB,mBA7B1B,qBAAqB;QACrB,kBAAkB;QAClB,mBAAmB;QACnB,oBAAoB;QACpB,wBAAwB;QACxB,mBAAmB;QACnB,6BAA6B;QAC7B,mBAAmB;QACnB,iBAAiB,aAGjB,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,yBAAyB;QACzB,mBAAmB;QACnB,iBAAiB;QACjB,iBAAiB;QACjB,wBAAwB,aAGxB,qBAAqB;QACrB,kBAAkB;QAClB,mBAAmB;QACnB,oBAAoB;QACpB,wBAAwB;QACxB,mBAAmB","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { FormsModule } from '@angular/forms';\nimport { AgGridModule } from 'ag-grid-angular';\nimport { MJButtonDirective, MJDialogComponent, MJDialogActionsComponent } from '@memberjunction/ng-ui-components';\nimport { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';\nimport { SharedGenericModule } from '@memberjunction/ng-shared-generic';\nimport { CategoryTreeComponent } from './category-tree/category-tree';\nimport { FileUploadComponent } from './file-upload/file-upload';\nimport { FilesGridComponent } from './files-grid/files-grid';\nimport { FileBrowserComponent } from './file-browser/file-browser.component';\nimport { FileBrowserDemoComponent } from './file-browser/file-browser-demo.component';\nimport { FileBrowserResource } from './file-browser/file-browser-resource.component';\nimport { StorageProvidersListComponent } from './file-browser/storage-providers-list.component';\nimport { FolderTreeComponent } from './file-browser/folder-tree.component';\nimport { FileGridComponent } from './file-browser/file-grid.component';\n\n@NgModule({\n declarations: [\n CategoryTreeComponent,\n FilesGridComponent,\n FileUploadComponent,\n FileBrowserComponent,\n FileBrowserDemoComponent,\n FileBrowserResource,\n StorageProvidersListComponent,\n FolderTreeComponent,\n FileGridComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n AgGridModule,\n ContainerDirectivesModule,\n SharedGenericModule,\n MJButtonDirective,\n MJDialogComponent,\n MJDialogActionsComponent,\n ],\n exports: [\n CategoryTreeComponent,\n FilesGridComponent,\n FileUploadComponent,\n FileBrowserComponent,\n FileBrowserDemoComponent,\n FileBrowserResource\n ],\n})\nexport class FileStorageModule {}\n"]}
|