@memberjunction/ng-file-storage 5.50.0 → 6.1.0-edge.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/LICENSE +7 -0
- package/dist/lib/category-tree/category-tree.d.ts +3 -3
- package/dist/lib/category-tree/category-tree.d.ts.map +1 -1
- package/dist/lib/category-tree/category-tree.js +7 -7
- package/dist/lib/category-tree/category-tree.js.map +1 -1
- package/dist/lib/file-browser/file-browser-resource.component.d.ts.map +1 -1
- package/dist/lib/file-browser/file-browser-resource.component.js +7 -1
- package/dist/lib/file-browser/file-browser-resource.component.js.map +1 -1
- package/dist/lib/files-grid/files-grid.d.ts +6 -5
- package/dist/lib/files-grid/files-grid.d.ts.map +1 -1
- package/dist/lib/files-grid/files-grid.js +20 -18
- package/dist/lib/files-grid/files-grid.js.map +1 -1
- package/package.json +22 -20
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 MemberJunction
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
2
3
|
import { MJFileCategoryEntity } from '@memberjunction/core-entities';
|
|
3
|
-
import { SharedService } from '@memberjunction/ng-shared';
|
|
4
4
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class CategoryTreeComponent extends BaseAngularComponent implements OnInit {
|
|
7
|
-
private
|
|
7
|
+
private notifications;
|
|
8
8
|
categorySelected: EventEmitter<string | undefined>;
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
showNew: boolean;
|
|
@@ -21,7 +21,7 @@ export declare class CategoryTreeComponent extends BaseAngularComponent implemen
|
|
|
21
21
|
contextMenuY: number;
|
|
22
22
|
private contextMenuNode;
|
|
23
23
|
private get md();
|
|
24
|
-
constructor(
|
|
24
|
+
constructor(notifications: MJNotificationService);
|
|
25
25
|
ngOnInit(): void;
|
|
26
26
|
/** Returns root-level nodes (no parent). */
|
|
27
27
|
get rootNodes(): MJFileCategoryEntity[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-tree.d.ts","sourceRoot":"","sources":["../../../src/lib/category-tree/category-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"category-tree.d.ts","sourceRoot":"","sources":["../../../src/lib/category-tree/category-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;;AAErE,qBAMa,qBAAsB,SAAQ,oBAAqB,YAAW,MAAM;IAwBnE,OAAO,CAAC,aAAa;IAvBvB,g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BvD,cAAc;IAKd,YAAY;IAKN,UAAU;IAOV,OAAO;yCA9JF,qBAAqB;2CAArB,qBAAqB;CA8KjC"}
|
|
@@ -3,7 +3,7 @@ import { RunView } from '@memberjunction/core';
|
|
|
3
3
|
import { UUIDsEqual } from '@memberjunction/global';
|
|
4
4
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "@memberjunction/ng-
|
|
6
|
+
import * as i1 from "@memberjunction/ng-notifications";
|
|
7
7
|
import * as i2 from "@angular/common";
|
|
8
8
|
import * as i3 from "@angular/forms";
|
|
9
9
|
import * as i4 from "@memberjunction/ng-ui-components";
|
|
@@ -128,7 +128,7 @@ function CategoryTreeComponent_Conditional_25_Template(rf, ctx) { if (rf & 1) {
|
|
|
128
128
|
i0.ɵɵproperty("disabled", ctx_r5.isLoading);
|
|
129
129
|
} }
|
|
130
130
|
export class CategoryTreeComponent extends BaseAngularComponent {
|
|
131
|
-
|
|
131
|
+
notifications;
|
|
132
132
|
categorySelected = new EventEmitter();
|
|
133
133
|
isLoading = false;
|
|
134
134
|
showNew = false;
|
|
@@ -145,9 +145,9 @@ export class CategoryTreeComponent extends BaseAngularComponent {
|
|
|
145
145
|
contextMenuY = 0;
|
|
146
146
|
contextMenuNode;
|
|
147
147
|
get md() { return this.ProviderToUse; }
|
|
148
|
-
constructor(
|
|
148
|
+
constructor(notifications) {
|
|
149
149
|
super();
|
|
150
|
-
this.
|
|
150
|
+
this.notifications = notifications;
|
|
151
151
|
}
|
|
152
152
|
ngOnInit() {
|
|
153
153
|
this.Refresh();
|
|
@@ -240,7 +240,7 @@ export class CategoryTreeComponent extends BaseAngularComponent {
|
|
|
240
240
|
const success = await fileCategory.Delete();
|
|
241
241
|
if (!success) {
|
|
242
242
|
console.error('Unable to delete file category:', fileCategory);
|
|
243
|
-
this.
|
|
243
|
+
this.notifications.CreateSimpleNotification(`Unable to delete category '${fileCategory.Name}'`, 'error');
|
|
244
244
|
this.isLoading = false;
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
@@ -277,7 +277,7 @@ export class CategoryTreeComponent extends BaseAngularComponent {
|
|
|
277
277
|
}
|
|
278
278
|
this.isLoading = false;
|
|
279
279
|
}
|
|
280
|
-
static ɵfac = function CategoryTreeComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CategoryTreeComponent)(i0.ɵɵdirectiveInject(i1.
|
|
280
|
+
static ɵfac = function CategoryTreeComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CategoryTreeComponent)(i0.ɵɵdirectiveInject(i1.MJNotificationService)); };
|
|
281
281
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CategoryTreeComponent, selectors: [["mj-files-category-tree"]], outputs: { categorySelected: "categorySelected" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 26, vars: 9, consts: [["treeNode", ""], ["newForm", "ngForm"], ["renameForm", "ngForm"], [1, "container"], [1, "tree-header"], ["mjButton", "", 3, "click"], ["mjButton", "", "variant", "primary", "size", "sm", 3, "click"], [1, "category-tree"], [1, "context-menu", 3, "top", "left"], ["Title", "New file category", 3, "Close", "Visible", "Width", "MinWidth"], [1, "dialog-form-container"], [1, "mj-form-field"], [1, "mj-form-label"], ["name", "name", "required", "", 1, "mj-input", 3, "ngModelChange", "ngModel", "disabled"], ["mjButton", "", "variant", "primary", 3, "click", "disabled"], ["mjButton", "", 3, "click", "disabled"], ["Title", "Rename file category", 3, "Visible", "Width", "MinWidth"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"], [1, "tree-node"], [1, "tree-node-row", 3, "click", "contextmenu"], [1, "tree-expand-btn"], [1, "tree-expand-placeholder"], [1, "fa-solid", "fa-folder", "tree-folder-icon"], [1, "tree-node-label"], [1, "tree-expand-btn", 3, "click"], [1, "fa-solid"], [1, "context-menu", 3, "click"], [1, "context-menu-item", 3, "click"], [1, "fa-solid", "fa-pen"], ["disabled", "", 1, "context-menu-item", 3, "click"], [1, "fa-solid", "fa-trash-can"], ["Title", "Rename file category", 3, "Close", "Visible", "Width", "MinWidth"], ["name", "Name", "required", "", 1, "mj-input", 3, "ngModelChange", "ngModel", "disabled"]], template: function CategoryTreeComponent_Template(rf, ctx) { if (rf & 1) {
|
|
282
282
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
283
283
|
i0.ɵɵelementStart(0, "div", 3)(1, "div", 4)(2, "button", 5);
|
|
@@ -332,7 +332,7 @@ export class CategoryTreeComponent extends BaseAngularComponent {
|
|
|
332
332
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CategoryTreeComponent, [{
|
|
333
333
|
type: Component,
|
|
334
334
|
args: [{ standalone: false, selector: 'mj-files-category-tree', template: "<div class=\"container\">\n <div class=\"tree-header\">\n <button mjButton (click)=\"clearSelection()\">All Files</button>\n <button mjButton variant=\"primary\" size=\"sm\" (click)=\"createNewCategory()\">Add category</button>\n </div>\n\n <div class=\"category-tree\">\n @for (node of rootNodes; track node.ID) {\n <ng-container *ngTemplateOutlet=\"treeNode; context: { $implicit: node, level: 0 }\"></ng-container>\n }\n </div>\n\n <ng-template #treeNode let-node let-level=\"level\">\n <div class=\"tree-node\" [style.padding-left.px]=\"level * 20\">\n <div class=\"tree-node-row\"\n [class.selected]=\"isSelected(node)\"\n (click)=\"selectNode(node)\"\n (contextmenu)=\"onContextMenu($event, node)\">\n @if (hasChildren(node)) {\n <button class=\"tree-expand-btn\" (click)=\"toggleExpand(node, $event)\">\n <i class=\"fa-solid\" [class.fa-chevron-right]=\"!isExpanded(node)\" [class.fa-chevron-down]=\"isExpanded(node)\"></i>\n </button>\n } @else {\n <span class=\"tree-expand-placeholder\"></span>\n }\n <i class=\"fa-solid fa-folder tree-folder-icon\"></i>\n <span class=\"tree-node-label\">{{ node.Name }}</span>\n </div>\n @if (isExpanded(node)) {\n @for (child of getChildren(node); track child.ID) {\n <ng-container *ngTemplateOutlet=\"treeNode; context: { $implicit: child, level: level + 1 }\"></ng-container>\n }\n }\n </div>\n </ng-template>\n\n <!-- Context Menu -->\n @if (contextMenuVisible) {\n <div class=\"context-menu\"\n [style.top.px]=\"contextMenuY\"\n [style.left.px]=\"contextMenuX\"\n (document:click)=\"closeContextMenu()\">\n <button class=\"context-menu-item\" (click)=\"onContextMenuAction('rename')\">\n <i class=\"fa-solid fa-pen\"></i> Rename\n </button>\n <button class=\"context-menu-item\" (click)=\"onContextMenuAction('delete')\" disabled>\n <i class=\"fa-solid fa-trash-can\"></i> Delete\n </button>\n </div>\n }\n\n <mj-dialog\n [Visible]=\"showNew\"\n Title=\"New file category\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"cancelNewCategory()\">\n <div class=\"dialog-form-container\">\n <form #newForm=\"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)]=\"newCategoryName\"\n required\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveNewCategory()\" [disabled]=\"isLoading\">Save</button>\n <button mjButton (click)=\"cancelNewCategory()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n\n @if (!!renameFileCategory) {\n <mj-dialog\n [Visible]=\"true\"\n Title=\"Rename file category\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"cancelRename()\">\n <div class=\"dialog-form-container\">\n <form #renameForm=\"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)]=\"renameFileCategory.Name\"\n required\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveRename()\" [disabled]=\"isLoading || !renameFileCategory.Dirty\">Save</button>\n <button mjButton (click)=\"cancelRename()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n }\n</div>\n", styles: ["/* Styles for category tree */\n.container {\n display: flex;\n flex-direction: column;\n}\n\n.category-tree {\n width: 250px;\n max-height: 500px;\n overflow-y: auto;\n border: 1px solid var(--mj-border-subtle);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n}\n\n.tree-header {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding-right: 4px;\n margin-bottom: 4px;\n}\n\n.tree-node-row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px 8px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.15s;\n user-select: none;\n}\n\n.tree-node-row:hover {\n background-color: var(--mj-bg-surface-hover);\n}\n\n.tree-node-row.selected {\n background-color: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n\n.tree-expand-btn {\n background: none;\n border: none;\n cursor: pointer;\n padding: 0;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-muted);\n font-size: 10px;\n}\n\n.tree-expand-placeholder {\n width: 16px;\n height: 16px;\n display: inline-block;\n}\n\n.tree-folder-icon {\n color: var(--mj-text-muted);\n font-size: 14px;\n}\n\n.tree-node-label {\n font-size: 13px;\n color: var(--mj-text-primary);\n}\n\n/* Context Menu */\n.context-menu {\n position: fixed;\n z-index: 10000;\n background: var(--mj-bg-surface-elevated);\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n box-shadow: 0 4px 12px var(--mj-bg-overlay);\n padding: 4px 0;\n min-width: 140px;\n}\n\n.context-menu-item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 8px 16px;\n border: none;\n background: none;\n color: var(--mj-text-primary);\n font-size: 13px;\n cursor: pointer;\n text-align: left;\n}\n\n.context-menu-item:hover:not(:disabled) {\n background: var(--mj-bg-surface-hover);\n}\n\n.context-menu-item:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n.dialog-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"] }]
|
|
335
|
-
}], () => [{ type: i1.
|
|
335
|
+
}], () => [{ type: i1.MJNotificationService }], { categorySelected: [{
|
|
336
336
|
type: Output
|
|
337
337
|
}] }); })();
|
|
338
338
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CategoryTreeComponent, { className: "CategoryTreeComponent", filePath: "src/lib/category-tree/category-tree.ts", lineNumber: 14 }); })();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-tree.js","sourceRoot":"","sources":["../../../src/lib/category-tree/category-tree.ts","../../../src/lib/category-tree/category-tree.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;ICG/D,wBAAkG;;;IAAlG,+FAAmF;;;;;IAAxC,AAA5B,8CAA4B,gEAAsC;;;;IAW7E,kCAAqE;IAArC,2PAAS,oCAA0B,KAAC;IAClE,wBAAgH;IAClH,iBAAS;;;;IADa,cAA4C;IAAC,AAA7C,+DAA4C,+CAA2C;;;IAG7G,2BAA6C;;;IAO7C,wBAA2G;;;IAA3G,2HAA4F;;;;;;IAAjD,AAA5B,8CAA4B,+EAA+C;;;IAD5F,gIAEC;;;;IAFD,cAAA,2BAAiB,CAEhB;;;;IAjBH,AADF,+BAA4D,cAIT;IAA5C,AAD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6BACI,KAAK,YACP,wBAAwB;;kBAKjC,MAAM;;kFADI,qBAAqB","sourcesContent":["import { Component, EventEmitter, OnInit, Output } from '@angular/core';\nimport { RunView } from '@memberjunction/core';\nimport { MJFileCategoryEntity } from '@memberjunction/core-entities';\nimport { SharedService } from '@memberjunction/ng-shared';\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n\n@Component({\n standalone: false,\n selector: 'mj-files-category-tree',\n templateUrl: './category-tree.html',\n styleUrls: ['./category-tree.css'],\n})\nexport class CategoryTreeComponent extends BaseAngularComponent implements OnInit {\n @Output() categorySelected = new EventEmitter<string | undefined>();\n\n public isLoading: boolean = false;\n public showNew: boolean = false;\n public newCategoryName = '';\n public renameFileCategory: MJFileCategoryEntity | undefined;\n\n public categoriesData: MJFileCategoryEntity[] = [];\n\n /** Expanded node IDs for the tree */\n public expandedIds = new Set<string>();\n\n /** Currently selected node ID */\n private selectedId: string | undefined;\n\n /** Context menu state */\n public contextMenuVisible = false;\n public contextMenuX = 0;\n public contextMenuY = 0;\n private contextMenuNode: MJFileCategoryEntity | undefined;\n\n private get md() { return this.ProviderToUse; }\n\n constructor(private sharedService: SharedService) { super(); }\n\n ngOnInit(): void {\n this.Refresh();\n }\n\n /** Returns root-level nodes (no parent). */\n get rootNodes(): MJFileCategoryEntity[] {\n return this.categoriesData.filter((c) => !c.ParentID);\n }\n\n /** Checks if a node has children. */\n hasChildren(node: MJFileCategoryEntity): boolean {\n return this.categoriesData.some((c) => UUIDsEqual(c.ParentID, node.ID));\n }\n\n /** Returns children of a node. */\n getChildren(node: MJFileCategoryEntity): MJFileCategoryEntity[] {\n return this.categoriesData.filter((c) => UUIDsEqual(c.ParentID, node.ID));\n }\n\n /** Checks if a node is expanded. */\n isExpanded(node: MJFileCategoryEntity): boolean {\n return this.expandedIds.has(node.ID);\n }\n\n /** Toggles expand/collapse on a node. */\n toggleExpand(node: MJFileCategoryEntity, event: Event): void {\n event.stopPropagation();\n if (this.expandedIds.has(node.ID)) {\n this.expandedIds.delete(node.ID);\n } else {\n this.expandedIds.add(node.ID);\n }\n }\n\n /** Checks if a node is the currently selected node. */\n isSelected(node: MJFileCategoryEntity): boolean {\n return this.selectedId != null && UUIDsEqual(this.selectedId, node.ID);\n }\n\n /** Selects a node and emits event. */\n selectNode(node: MJFileCategoryEntity): void {\n this.selectedId = node.ID;\n this.categorySelected.emit(node.ID);\n }\n\n /** Opens context menu on right-click. */\n onContextMenu(event: MouseEvent, node: MJFileCategoryEntity): void {\n event.preventDefault();\n event.stopPropagation();\n this.contextMenuNode = node;\n this.contextMenuX = event.clientX;\n this.contextMenuY = event.clientY;\n this.contextMenuVisible = true;\n }\n\n /** Closes the context menu. */\n closeContextMenu(): void {\n this.contextMenuVisible = false;\n this.contextMenuNode = undefined;\n }\n\n /** Handles context menu action selection. */\n onContextMenuAction(action: string): void {\n const node = this.contextMenuNode;\n this.closeContextMenu();\n if (!node) {\n return;\n }\n\n switch (action) {\n case 'rename':\n this.renameFileCategory = node;\n break;\n case 'delete':\n this.deleteCategory(node);\n break;\n }\n }\n\n async createNewCategory() {\n this.showNew = true;\n }\n\n cancelNewCategory() {\n this.showNew = false;\n }\n\n async saveNewCategory() {\n this.isLoading = true;\n const categoryEntity: MJFileCategoryEntity = await this.md.GetEntityObject('MJ: File Categories', this.md.CurrentUser);\n categoryEntity.NewRecord();\n categoryEntity.Name = this.newCategoryName;\n await categoryEntity?.Save();\n this.categoriesData = [...this.categoriesData, categoryEntity];\n this.showNew = false;\n this.newCategoryName = '';\n this.isLoading = false;\n }\n\n async deleteCategory(fileCategory: MJFileCategoryEntity) {\n this.isLoading = true;\n const { ID } = fileCategory;\n const success = await fileCategory.Delete();\n if (!success) {\n console.error('Unable to delete file category:', fileCategory);\n this.sharedService.CreateSimpleNotification(`Unable to delete category '${fileCategory.Name}'`, 'error');\n this.isLoading = false;\n return;\n }\n\n this.categoriesData = this.categoriesData.filter((c) => !UUIDsEqual(c.ID, ID));\n this.clearSelection();\n this.isLoading = false;\n }\n\n clearSelection() {\n this.selectedId = undefined;\n this.categorySelected.emit(undefined);\n }\n\n cancelRename() {\n this.renameFileCategory?.Revert();\n this.renameFileCategory = undefined;\n }\n\n async saveRename() {\n this.isLoading = true;\n await this.renameFileCategory?.Save();\n this.renameFileCategory = undefined;\n this.isLoading = false;\n }\n\n async Refresh() {\n this.isLoading = true;\n\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const result = await rv.RunView({\n EntityName: 'MJ: File Categories',\n ResultType: 'entity_object',\n });\n\n if (result.Success) {\n this.categoriesData = <MJFileCategoryEntity[]>result.Results;\n } else {\n throw new Error('Error loading file categories: ' + result.ErrorMessage);\n }\n this.isLoading = false;\n }\n}\n","<div class=\"container\">\n <div class=\"tree-header\">\n <button mjButton (click)=\"clearSelection()\">All Files</button>\n <button mjButton variant=\"primary\" size=\"sm\" (click)=\"createNewCategory()\">Add category</button>\n </div>\n\n <div class=\"category-tree\">\n @for (node of rootNodes; track node.ID) {\n <ng-container *ngTemplateOutlet=\"treeNode; context: { $implicit: node, level: 0 }\"></ng-container>\n }\n </div>\n\n <ng-template #treeNode let-node let-level=\"level\">\n <div class=\"tree-node\" [style.padding-left.px]=\"level * 20\">\n <div class=\"tree-node-row\"\n [class.selected]=\"isSelected(node)\"\n (click)=\"selectNode(node)\"\n (contextmenu)=\"onContextMenu($event, node)\">\n @if (hasChildren(node)) {\n <button class=\"tree-expand-btn\" (click)=\"toggleExpand(node, $event)\">\n <i class=\"fa-solid\" [class.fa-chevron-right]=\"!isExpanded(node)\" [class.fa-chevron-down]=\"isExpanded(node)\"></i>\n </button>\n } @else {\n <span class=\"tree-expand-placeholder\"></span>\n }\n <i class=\"fa-solid fa-folder tree-folder-icon\"></i>\n <span class=\"tree-node-label\">{{ node.Name }}</span>\n </div>\n @if (isExpanded(node)) {\n @for (child of getChildren(node); track child.ID) {\n <ng-container *ngTemplateOutlet=\"treeNode; context: { $implicit: child, level: level + 1 }\"></ng-container>\n }\n }\n </div>\n </ng-template>\n\n <!-- Context Menu -->\n @if (contextMenuVisible) {\n <div class=\"context-menu\"\n [style.top.px]=\"contextMenuY\"\n [style.left.px]=\"contextMenuX\"\n (document:click)=\"closeContextMenu()\">\n <button class=\"context-menu-item\" (click)=\"onContextMenuAction('rename')\">\n <i class=\"fa-solid fa-pen\"></i> Rename\n </button>\n <button class=\"context-menu-item\" (click)=\"onContextMenuAction('delete')\" disabled>\n <i class=\"fa-solid fa-trash-can\"></i> Delete\n </button>\n </div>\n }\n\n <mj-dialog\n [Visible]=\"showNew\"\n Title=\"New file category\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"cancelNewCategory()\">\n <div class=\"dialog-form-container\">\n <form #newForm=\"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)]=\"newCategoryName\"\n required\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveNewCategory()\" [disabled]=\"isLoading\">Save</button>\n <button mjButton (click)=\"cancelNewCategory()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n\n @if (!!renameFileCategory) {\n <mj-dialog\n [Visible]=\"true\"\n Title=\"Rename file category\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"cancelRename()\">\n <div class=\"dialog-form-container\">\n <form #renameForm=\"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)]=\"renameFileCategory.Name\"\n required\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveRename()\" [disabled]=\"isLoading || !renameFileCategory.Dirty\">Save</button>\n <button mjButton (click)=\"cancelRename()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n }\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"category-tree.js","sourceRoot":"","sources":["../../../src/lib/category-tree/category-tree.ts","../../../src/lib/category-tree/category-tree.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;ICG/D,wBAAkG;;;IAAlG,+FAAmF;;;;;IAAxC,AAA5B,8CAA4B,gEAAsC;;;;IAW7E,kCAAqE;IAArC,2PAAS,oCAA0B,KAAC;IAClE,wBAAgH;IAClH,iBAAS;;;;IADa,cAA4C;IAAC,AAA7C,+DAA4C,+CAA2C;;;IAG7G,2BAA6C;;;IAO7C,wBAA2G;;;IAA3G,2HAA4F;;;;;;IAAjD,AAA5B,8CAA4B,+EAA+C;;;IAD5F,gIAEC;;;;IAFD,cAAA,2BAAiB,CAEhB;;;;IAjBH,AADF,+BAA4D,cAIT;IAA5C,AADA,gNAAS,0BAAgB,KAAC,qNACX,qCAA2B,KAAC;IAK5C,AAJF,yGAAyB,iFAIhB;IAGT,wBAAmD;IACnD,gCAA8B;IAAA,YAAe;IAC/C,AAD+C,iBAAO,EAChD;IACN,2FAAwB;IAK1B,iBAAM;;;;;IApBiB,mDAAoC;IAEpD,cAAmC;IAAnC,sDAAmC;IAGtC,cAMC;IAND,qDAMC;IAE6B,eAAe;IAAf,kCAAe;IAE/C,cAIC;IAJD,qDAIC;;;;IAMH,+BAG2C;IAAtC,wLAAkB,yBAAkB,2BAAC;IACxC,kCAA0E;IAAxC,2LAAS,2BAAoB,QAAQ,CAAC,KAAC;IACvE,wBAA+B;IAAC,wBAClC;IAAA,iBAAS;IACT,kCAAmF;IAAj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zF,AADyF,iBAAS,EAC5F;YAEN,8BAA2B;YACzB,oGAEC;YACH,iBAAM;YAEN,uHAAkD;YAyBlD,yFAA0B;YAc1B,qCAKgC;YAA9B,4IAAS,uBAAmB,KAAC;YAIvB,AADF,AADF,AADF,gCAAmC,qBACT,iBACO,gBACC;YAAA,qBAAI;YAAA,iBAAO;YACvC,kCAK2B;YAFzB,qQAA6B;YAKrC,AADE,AADE,AANE,iBAK2B,EACrB,EACH,EACH;YAEJ,AADF,0CAAmB,kBACqE;YAAnD,yIAAS,qBAAiB,KAAC;YAAwB,qBAAI;YAAA,iBAAS;YACnG,mCAAsE;YAArD,yIAAS,uBAAmB,KAAC;YAAwB,uBAAM;YAEhF,AADE,AAD8E,iBAAS,EACnE,EACV;YAEZ,iGAA4B;YA0B9B,iBAAM;;YA/FF,eAEC;YAFD,4BAEC;YA4BH,eAYC;YAZD,kDAYC;YAGC,cAAmB;YAGnB,AADA,AAFA,qCAAmB,cAEN,iBACG;YASR,eAA6B;YAA7B,mDAA6B;YAE7B,wCAAsB;YAKmC,eAAsB;YAAtB,wCAAsB;YACtC,eAAsB;YAAtB,wCAAsB;YAIzE,eAyBC;YAzBD,oDAyBC;;;iFDxFU,qBAAqB;cANjC,SAAS;6BACI,KAAK,YACP,wBAAwB;;kBAKjC,MAAM;;kFADI,qBAAqB","sourcesContent":["import { Component, EventEmitter, OnInit, Output } from '@angular/core';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { RunView } from '@memberjunction/core';\nimport { MJFileCategoryEntity } from '@memberjunction/core-entities';\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n\n@Component({\n standalone: false,\n selector: 'mj-files-category-tree',\n templateUrl: './category-tree.html',\n styleUrls: ['./category-tree.css'],\n})\nexport class CategoryTreeComponent extends BaseAngularComponent implements OnInit {\n @Output() categorySelected = new EventEmitter<string | undefined>();\n\n public isLoading: boolean = false;\n public showNew: boolean = false;\n public newCategoryName = '';\n public renameFileCategory: MJFileCategoryEntity | undefined;\n\n public categoriesData: MJFileCategoryEntity[] = [];\n\n /** Expanded node IDs for the tree */\n public expandedIds = new Set<string>();\n\n /** Currently selected node ID */\n private selectedId: string | undefined;\n\n /** Context menu state */\n public contextMenuVisible = false;\n public contextMenuX = 0;\n public contextMenuY = 0;\n private contextMenuNode: MJFileCategoryEntity | undefined;\n\n private get md() { return this.ProviderToUse; }\n\n constructor(private notifications: MJNotificationService) { super(); }\n\n ngOnInit(): void {\n this.Refresh();\n }\n\n /** Returns root-level nodes (no parent). */\n get rootNodes(): MJFileCategoryEntity[] {\n return this.categoriesData.filter((c) => !c.ParentID);\n }\n\n /** Checks if a node has children. */\n hasChildren(node: MJFileCategoryEntity): boolean {\n return this.categoriesData.some((c) => UUIDsEqual(c.ParentID, node.ID));\n }\n\n /** Returns children of a node. */\n getChildren(node: MJFileCategoryEntity): MJFileCategoryEntity[] {\n return this.categoriesData.filter((c) => UUIDsEqual(c.ParentID, node.ID));\n }\n\n /** Checks if a node is expanded. */\n isExpanded(node: MJFileCategoryEntity): boolean {\n return this.expandedIds.has(node.ID);\n }\n\n /** Toggles expand/collapse on a node. */\n toggleExpand(node: MJFileCategoryEntity, event: Event): void {\n event.stopPropagation();\n if (this.expandedIds.has(node.ID)) {\n this.expandedIds.delete(node.ID);\n } else {\n this.expandedIds.add(node.ID);\n }\n }\n\n /** Checks if a node is the currently selected node. */\n isSelected(node: MJFileCategoryEntity): boolean {\n return this.selectedId != null && UUIDsEqual(this.selectedId, node.ID);\n }\n\n /** Selects a node and emits event. */\n selectNode(node: MJFileCategoryEntity): void {\n this.selectedId = node.ID;\n this.categorySelected.emit(node.ID);\n }\n\n /** Opens context menu on right-click. */\n onContextMenu(event: MouseEvent, node: MJFileCategoryEntity): void {\n event.preventDefault();\n event.stopPropagation();\n this.contextMenuNode = node;\n this.contextMenuX = event.clientX;\n this.contextMenuY = event.clientY;\n this.contextMenuVisible = true;\n }\n\n /** Closes the context menu. */\n closeContextMenu(): void {\n this.contextMenuVisible = false;\n this.contextMenuNode = undefined;\n }\n\n /** Handles context menu action selection. */\n onContextMenuAction(action: string): void {\n const node = this.contextMenuNode;\n this.closeContextMenu();\n if (!node) {\n return;\n }\n\n switch (action) {\n case 'rename':\n this.renameFileCategory = node;\n break;\n case 'delete':\n this.deleteCategory(node);\n break;\n }\n }\n\n async createNewCategory() {\n this.showNew = true;\n }\n\n cancelNewCategory() {\n this.showNew = false;\n }\n\n async saveNewCategory() {\n this.isLoading = true;\n const categoryEntity: MJFileCategoryEntity = await this.md.GetEntityObject('MJ: File Categories', this.md.CurrentUser);\n categoryEntity.NewRecord();\n categoryEntity.Name = this.newCategoryName;\n await categoryEntity?.Save();\n this.categoriesData = [...this.categoriesData, categoryEntity];\n this.showNew = false;\n this.newCategoryName = '';\n this.isLoading = false;\n }\n\n async deleteCategory(fileCategory: MJFileCategoryEntity) {\n this.isLoading = true;\n const { ID } = fileCategory;\n const success = await fileCategory.Delete();\n if (!success) {\n console.error('Unable to delete file category:', fileCategory);\n this.notifications.CreateSimpleNotification(`Unable to delete category '${fileCategory.Name}'`, 'error');\n this.isLoading = false;\n return;\n }\n\n this.categoriesData = this.categoriesData.filter((c) => !UUIDsEqual(c.ID, ID));\n this.clearSelection();\n this.isLoading = false;\n }\n\n clearSelection() {\n this.selectedId = undefined;\n this.categorySelected.emit(undefined);\n }\n\n cancelRename() {\n this.renameFileCategory?.Revert();\n this.renameFileCategory = undefined;\n }\n\n async saveRename() {\n this.isLoading = true;\n await this.renameFileCategory?.Save();\n this.renameFileCategory = undefined;\n this.isLoading = false;\n }\n\n async Refresh() {\n this.isLoading = true;\n\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const result = await rv.RunView({\n EntityName: 'MJ: File Categories',\n ResultType: 'entity_object',\n });\n\n if (result.Success) {\n this.categoriesData = <MJFileCategoryEntity[]>result.Results;\n } else {\n throw new Error('Error loading file categories: ' + result.ErrorMessage);\n }\n this.isLoading = false;\n }\n}\n","<div class=\"container\">\n <div class=\"tree-header\">\n <button mjButton (click)=\"clearSelection()\">All Files</button>\n <button mjButton variant=\"primary\" size=\"sm\" (click)=\"createNewCategory()\">Add category</button>\n </div>\n\n <div class=\"category-tree\">\n @for (node of rootNodes; track node.ID) {\n <ng-container *ngTemplateOutlet=\"treeNode; context: { $implicit: node, level: 0 }\"></ng-container>\n }\n </div>\n\n <ng-template #treeNode let-node let-level=\"level\">\n <div class=\"tree-node\" [style.padding-left.px]=\"level * 20\">\n <div class=\"tree-node-row\"\n [class.selected]=\"isSelected(node)\"\n (click)=\"selectNode(node)\"\n (contextmenu)=\"onContextMenu($event, node)\">\n @if (hasChildren(node)) {\n <button class=\"tree-expand-btn\" (click)=\"toggleExpand(node, $event)\">\n <i class=\"fa-solid\" [class.fa-chevron-right]=\"!isExpanded(node)\" [class.fa-chevron-down]=\"isExpanded(node)\"></i>\n </button>\n } @else {\n <span class=\"tree-expand-placeholder\"></span>\n }\n <i class=\"fa-solid fa-folder tree-folder-icon\"></i>\n <span class=\"tree-node-label\">{{ node.Name }}</span>\n </div>\n @if (isExpanded(node)) {\n @for (child of getChildren(node); track child.ID) {\n <ng-container *ngTemplateOutlet=\"treeNode; context: { $implicit: child, level: level + 1 }\"></ng-container>\n }\n }\n </div>\n </ng-template>\n\n <!-- Context Menu -->\n @if (contextMenuVisible) {\n <div class=\"context-menu\"\n [style.top.px]=\"contextMenuY\"\n [style.left.px]=\"contextMenuX\"\n (document:click)=\"closeContextMenu()\">\n <button class=\"context-menu-item\" (click)=\"onContextMenuAction('rename')\">\n <i class=\"fa-solid fa-pen\"></i> Rename\n </button>\n <button class=\"context-menu-item\" (click)=\"onContextMenuAction('delete')\" disabled>\n <i class=\"fa-solid fa-trash-can\"></i> Delete\n </button>\n </div>\n }\n\n <mj-dialog\n [Visible]=\"showNew\"\n Title=\"New file category\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"cancelNewCategory()\">\n <div class=\"dialog-form-container\">\n <form #newForm=\"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)]=\"newCategoryName\"\n required\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveNewCategory()\" [disabled]=\"isLoading\">Save</button>\n <button mjButton (click)=\"cancelNewCategory()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n\n @if (!!renameFileCategory) {\n <mj-dialog\n [Visible]=\"true\"\n Title=\"Rename file category\"\n [Width]=\"450\"\n [MinWidth]=\"250\"\n (Close)=\"cancelRename()\">\n <div class=\"dialog-form-container\">\n <form #renameForm=\"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)]=\"renameFileCategory.Name\"\n required\n [disabled]=\"isLoading\" />\n </label>\n </form>\n </div>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"saveRename()\" [disabled]=\"isLoading || !renameFileCategory.Dirty\">Save</button>\n <button mjButton (click)=\"cancelRename()\" [disabled]=\"isLoading\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n }\n</div>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-browser-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/file-browser/file-browser-resource.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-browser-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/file-browser/file-browser-resource.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;;AAG7D;;;GAGG;AACH,qBAqCa,mBAAoB,SAAQ,qBAAqB;IAC5D,OAAO,CAAC,UAAU,CAAS;;IAM3B,IAAa,IAAI,CAAC,KAAK,EAAE,YAAY,EAMpC;IAED,IAAa,IAAI,IAAI,YAAY,CAEhC;IAED;;;OAGG;YACW,eAAe;IAO7B;;OAEG;IACY,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1E;;OAEG;IACY,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;yCAxC7D,mBAAmB;2CAAnB,mBAAmB;CA2C/B"}
|
|
@@ -5,6 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Component } from '@angular/core';
|
|
8
|
+
// This component is an Explorer surface (layer 3), which is why the package declares
|
|
9
|
+
// "mjUILayer": "surface" rather than "widgets" — a package holding a BaseResourceComponent
|
|
10
|
+
// subclass cannot be widgets by the gate's own table, and ng-shared is legal at L3.
|
|
11
|
+
// Splitting the surface out from the widgets in this package is still worth doing (MJ#3404);
|
|
12
|
+
// it is registered in three CodeGen-generated manifests, so it needs a CodeGen run, not a
|
|
13
|
+
// hand edit.
|
|
8
14
|
import { BaseResourceComponent } from '@memberjunction/ng-shared';
|
|
9
15
|
import { RegisterClass } from '@memberjunction/global';
|
|
10
16
|
import * as i0 from "@angular/core";
|
|
@@ -79,5 +85,5 @@ export { FileBrowserResource };
|
|
|
79
85
|
</mj-page-layout>
|
|
80
86
|
`, styles: ["\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n .file-browser-body {\n flex: 1;\n min-height: 0;\n padding: 0 24px 24px;\n display: flex;\n }\n /* The inner mj-file-browser needs to fill the body container. */\n .file-browser-body :is(mj-file-browser) {\n flex: 1;\n min-height: 0;\n min-width: 0;\n display: flex;\n }\n "] }]
|
|
81
87
|
}], () => [], null); })();
|
|
82
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FileBrowserResource, { className: "FileBrowserResource", filePath: "src/lib/file-browser/file-browser-resource.component.ts", lineNumber:
|
|
88
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FileBrowserResource, { className: "FileBrowserResource", filePath: "src/lib/file-browser/file-browser-resource.component.ts", lineNumber: 53 }); })();
|
|
83
89
|
//# sourceMappingURL=file-browser-resource.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-browser-resource.component.js","sourceRoot":"","sources":["../../../src/lib/file-browser/file-browser-resource.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;;;;AAEvD;;;GAGG;AAsCI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,qBAAqB;IACpD,UAAU,GAAG,KAAK,CAAC;IAE3B;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,IAAa,IAAI,CAAC,KAAmB;QACnC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAa,IAAI;QACf,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,eAAe;QAC3B,oEAAoE;QACpE,6CAA6C;QAC7C,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACM,KAAK,CAAC,sBAAsB,CAAC,IAAkB;QACtD,OAAO,IAAI,CAAC,IAAI,IAAI,cAAc,CAAC;IACrC,CAAC;IAED;;OAEG;IACM,KAAK,CAAC,oBAAoB,CAAC,IAAkB;QACpD,OAAO,yBAAyB,CAAC;IACnC,CAAC;6GA1CU,mBAAmB;6DAAnB,mBAAmB;YAhC5B,sCAAgB;YACd,oCAIiB;YACjB,8BAA+B;YAC7B,kCAAmC;YAEvC,AADE,iBAAM,EACS;;;AAuBR,mBAAmB;IArC/B,aAAa,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;GAqC/C,mBAAmB,CA2C/B;;iFA3CY,mBAAmB;cApC/B,SAAS;6BACI,KAAK,YACP,0BAA0B,YAC1B;;;;;;;;;;;GAWT;;kFAsBU,mBAAmB","sourcesContent":["import { Component } from '@angular/core';\nimport { BaseResourceComponent } from '@memberjunction/ng-shared';\nimport { ResourceData } from '@memberjunction/core-entities';\nimport { RegisterClass } from '@memberjunction/global';\n\n/**\n * File Browser Resource Wrapper - displays the file browser in a tab\n * Extends BaseResourceComponent to work with the MJ resource type system\n */\n@RegisterClass(BaseResourceComponent, 'FileBrowserResource')\n@Component({\n standalone: false,\n selector: 'mj-file-browser-resource',\n template: `\n <mj-page-layout>\n <mj-page-header\n Title=\"File Browser\"\n Icon=\"fa-solid fa-folder-tree\"\n Subtitle=\"Browse and manage files across storage providers\">\n </mj-page-header>\n <div class=\"file-browser-body\">\n <mj-file-browser></mj-file-browser>\n </div>\n </mj-page-layout>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n .file-browser-body {\n flex: 1;\n min-height: 0;\n padding: 0 24px 24px;\n display: flex;\n }\n /* The inner mj-file-browser needs to fill the body container. */\n .file-browser-body :is(mj-file-browser) {\n flex: 1;\n min-height: 0;\n min-width: 0;\n display: flex;\n }\n `]\n})\nexport class FileBrowserResource extends BaseResourceComponent {\n private dataLoaded = false;\n\n constructor() {\n super();\n }\n\n override set Data(value: ResourceData) {\n super.Data = value;\n if (!this.dataLoaded) {\n this.dataLoaded = true;\n this.loadFileBrowser();\n }\n }\n\n override get Data(): ResourceData {\n return super.Data;\n }\n\n /**\n * Load the file browser (currently just notifies load complete)\n * In future phases, this could pass configuration from ResourceData\n */\n private async loadFileBrowser(): Promise<void> {\n // Defer to next microtask so the shell's LoadCompleteEvent callback\n // is wired before we fire NotifyLoadComplete\n await Promise.resolve();\n this.NotifyLoadComplete();\n }\n\n /**\n * Get the display name for the file browser resource\n */\n override async GetResourceDisplayName(data: ResourceData): Promise<string> {\n return data.Name || 'File Browser';\n }\n\n /**\n * Get the icon class for file browser resources\n */\n override async GetResourceIconClass(data: ResourceData): Promise<string> {\n return 'fa-solid fa-folder-tree';\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"file-browser-resource.component.js","sourceRoot":"","sources":["../../../src/lib/file-browser/file-browser-resource.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,qFAAqF;AACrF,2FAA2F;AAC3F,oFAAoF;AACpF,6FAA6F;AAC7F,0FAA0F;AAC1F,aAAa;AACb,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;;;;AAEvD;;;GAGG;AAsCI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,qBAAqB;IACpD,UAAU,GAAG,KAAK,CAAC;IAE3B;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,IAAa,IAAI,CAAC,KAAmB;QACnC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAa,IAAI;QACf,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,eAAe;QAC3B,oEAAoE;QACpE,6CAA6C;QAC7C,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACM,KAAK,CAAC,sBAAsB,CAAC,IAAkB;QACtD,OAAO,IAAI,CAAC,IAAI,IAAI,cAAc,CAAC;IACrC,CAAC;IAED;;OAEG;IACM,KAAK,CAAC,oBAAoB,CAAC,IAAkB;QACpD,OAAO,yBAAyB,CAAC;IACnC,CAAC;6GA1CU,mBAAmB;6DAAnB,mBAAmB;YAhC5B,sCAAgB;YACd,oCAIiB;YACjB,8BAA+B;YAC7B,kCAAmC;YAEvC,AADE,iBAAM,EACS;;;AAuBR,mBAAmB;IArC/B,aAAa,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;GAqC/C,mBAAmB,CA2C/B;;iFA3CY,mBAAmB;cApC/B,SAAS;6BACI,KAAK,YACP,0BAA0B,YAC1B;;;;;;;;;;;GAWT;;kFAsBU,mBAAmB","sourcesContent":["import { Component } from '@angular/core';\n// This component is an Explorer surface (layer 3), which is why the package declares\n// \"mjUILayer\": \"surface\" rather than \"widgets\" — a package holding a BaseResourceComponent\n// subclass cannot be widgets by the gate's own table, and ng-shared is legal at L3.\n// Splitting the surface out from the widgets in this package is still worth doing (MJ#3404);\n// it is registered in three CodeGen-generated manifests, so it needs a CodeGen run, not a\n// hand edit.\nimport { BaseResourceComponent } from '@memberjunction/ng-shared';\nimport { ResourceData } from '@memberjunction/core-entities';\nimport { RegisterClass } from '@memberjunction/global';\n\n/**\n * File Browser Resource Wrapper - displays the file browser in a tab\n * Extends BaseResourceComponent to work with the MJ resource type system\n */\n@RegisterClass(BaseResourceComponent, 'FileBrowserResource')\n@Component({\n standalone: false,\n selector: 'mj-file-browser-resource',\n template: `\n <mj-page-layout>\n <mj-page-header\n Title=\"File Browser\"\n Icon=\"fa-solid fa-folder-tree\"\n Subtitle=\"Browse and manage files across storage providers\">\n </mj-page-header>\n <div class=\"file-browser-body\">\n <mj-file-browser></mj-file-browser>\n </div>\n </mj-page-layout>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n .file-browser-body {\n flex: 1;\n min-height: 0;\n padding: 0 24px 24px;\n display: flex;\n }\n /* The inner mj-file-browser needs to fill the body container. */\n .file-browser-body :is(mj-file-browser) {\n flex: 1;\n min-height: 0;\n min-width: 0;\n display: flex;\n }\n `]\n})\nexport class FileBrowserResource extends BaseResourceComponent {\n private dataLoaded = false;\n\n constructor() {\n super();\n }\n\n override set Data(value: ResourceData) {\n super.Data = value;\n if (!this.dataLoaded) {\n this.dataLoaded = true;\n this.loadFileBrowser();\n }\n }\n\n override get Data(): ResourceData {\n return super.Data;\n }\n\n /**\n * Load the file browser (currently just notifies load complete)\n * In future phases, this could pass configuration from ResourceData\n */\n private async loadFileBrowser(): Promise<void> {\n // Defer to next microtask so the shell's LoadCompleteEvent callback\n // is wired before we fire NotifyLoadComplete\n await Promise.resolve();\n this.NotifyLoadComplete();\n }\n\n /**\n * Get the display name for the file browser resource\n */\n override async GetResourceDisplayName(data: ResourceData): Promise<string> {\n return data.Name || 'File Browser';\n }\n\n /**\n * Get the icon class for file browser resources\n */\n override async GetResourceIconClass(data: ResourceData): Promise<string> {\n return 'fa-solid fa-folder-tree';\n }\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
2
4
|
import { MJFileEntity } from '@memberjunction/core-entities';
|
|
3
|
-
import { SharedService } from '@memberjunction/ng-shared';
|
|
4
5
|
import { ColDef, GridReadyEvent, type Theme } from 'ag-grid-community';
|
|
5
6
|
import { FileUploadEvent } from '../file-upload/file-upload';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class FilesGridComponent implements OnInit, OnChanges {
|
|
8
|
-
private
|
|
8
|
+
export declare class FilesGridComponent extends BaseAngularComponent implements OnInit, OnChanges {
|
|
9
|
+
private notifications;
|
|
9
10
|
files: MJFileEntity[];
|
|
10
11
|
isLoading: boolean;
|
|
11
12
|
editFile: MJFileEntity | undefined;
|
|
@@ -13,7 +14,7 @@ export declare class FilesGridComponent implements OnInit, OnChanges {
|
|
|
13
14
|
ColumnDefs: ColDef[];
|
|
14
15
|
DefaultColDef: ColDef;
|
|
15
16
|
private gridApi;
|
|
16
|
-
constructor(
|
|
17
|
+
constructor(notifications: MJNotificationService);
|
|
17
18
|
CategoryID: string | undefined;
|
|
18
19
|
ngOnInit(): void;
|
|
19
20
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -29,7 +30,7 @@ export declare class FilesGridComponent implements OnInit, OnChanges {
|
|
|
29
30
|
/**
|
|
30
31
|
* Saves the edited file.
|
|
31
32
|
*
|
|
32
|
-
* 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
|
|
33
|
+
* 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 MJNotificationService.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.
|
|
33
34
|
*
|
|
34
35
|
* @returns Promise<void> - A promise that resolves when the save operation is complete.
|
|
35
36
|
* @throws Error - If there is an error during the save operation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files-grid.d.ts","sourceRoot":"","sources":["../../../src/lib/files-grid/files-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"files-grid.d.ts","sour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EAAE,eAAe;IAW1C;;;OAGG;IACG,OAAO;IAiBb;;OAEG;IACH,OAAO,CAAC,eAAe;IAmCvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;yCAxNf,kBAAkB;2CAAlB,kBAAkB;CAiO9B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
2
3
|
import { RunView } from '@memberjunction/core';
|
|
3
4
|
import { GraphQLDataProvider, gql } from '@memberjunction/graphql-dataprovider';
|
|
4
5
|
import { MJ_AG_GRID_THEME_PARAMS } from '@memberjunction/ng-shared-generic';
|
|
5
6
|
import { ModuleRegistry, AllCommunityModule, themeAlpine } from 'ag-grid-community';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "@memberjunction/ng-
|
|
9
|
+
import * as i1 from "@memberjunction/ng-notifications";
|
|
9
10
|
import * as i2 from "@angular/forms";
|
|
10
11
|
import * as i3 from "ag-grid-angular";
|
|
11
12
|
import * as i4 from "@memberjunction/ng-shared-generic";
|
|
@@ -82,8 +83,8 @@ const FileDownloadQuerySchema = z.object({
|
|
|
82
83
|
DownloadUrl: z.string(),
|
|
83
84
|
}),
|
|
84
85
|
});
|
|
85
|
-
export class FilesGridComponent {
|
|
86
|
-
|
|
86
|
+
export class FilesGridComponent extends BaseAngularComponent {
|
|
87
|
+
notifications;
|
|
87
88
|
files = [];
|
|
88
89
|
isLoading = false;
|
|
89
90
|
editFile;
|
|
@@ -98,8 +99,9 @@ export class FilesGridComponent {
|
|
|
98
99
|
filter: false,
|
|
99
100
|
};
|
|
100
101
|
gridApi = null;
|
|
101
|
-
constructor(
|
|
102
|
-
|
|
102
|
+
constructor(notifications) {
|
|
103
|
+
super();
|
|
104
|
+
this.notifications = notifications;
|
|
103
105
|
this.ColumnDefs = this.buildColumnDefs();
|
|
104
106
|
}
|
|
105
107
|
CategoryID = undefined;
|
|
@@ -128,7 +130,7 @@ export class FilesGridComponent {
|
|
|
128
130
|
/**
|
|
129
131
|
* Saves the edited file.
|
|
130
132
|
*
|
|
131
|
-
* 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
|
|
133
|
+
* 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 MJNotificationService.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.
|
|
132
134
|
*
|
|
133
135
|
* @returns Promise<void> - A promise that resolves when the save operation is complete.
|
|
134
136
|
* @throws Error - If there is an error during the save operation.
|
|
@@ -139,7 +141,7 @@ export class FilesGridComponent {
|
|
|
139
141
|
//
|
|
140
142
|
const success = await this.editFile.Save();
|
|
141
143
|
if (success) {
|
|
142
|
-
this.
|
|
144
|
+
this.notifications.CreateSimpleNotification(`Successfully saved file ${this.editFile.ID} ${this.editFile.Name}`, 'success');
|
|
143
145
|
this.editFile = undefined;
|
|
144
146
|
// Refresh the grid to show the updated data
|
|
145
147
|
if (this.gridApi) {
|
|
@@ -147,7 +149,7 @@ export class FilesGridComponent {
|
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
else {
|
|
150
|
-
this.
|
|
152
|
+
this.notifications.CreateSimpleNotification(`Unable to save file ${this.editFile.ID} ${this.editFile.Name}`, 'error');
|
|
151
153
|
}
|
|
152
154
|
this.isLoading = false;
|
|
153
155
|
}
|
|
@@ -169,12 +171,12 @@ export class FilesGridComponent {
|
|
|
169
171
|
const downloadUrl = parsedResult.data.MJFile.DownloadUrl;
|
|
170
172
|
const success = downloadFromUrl(downloadUrl, file.Name, file.ContentType);
|
|
171
173
|
if (!success) {
|
|
172
|
-
this.
|
|
174
|
+
this.notifications.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
else {
|
|
176
178
|
console.error(parsedResult.error);
|
|
177
|
-
this.
|
|
179
|
+
this.notifications.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');
|
|
178
180
|
}
|
|
179
181
|
this.isLoading = false;
|
|
180
182
|
};
|
|
@@ -202,11 +204,11 @@ export class FilesGridComponent {
|
|
|
202
204
|
const Name = file.Name;
|
|
203
205
|
const deleteResult = await file.Delete();
|
|
204
206
|
if (deleteResult) {
|
|
205
|
-
this.
|
|
207
|
+
this.notifications.CreateSimpleNotification(`Successfully deleted file ${ID} ${Name}`, 'info');
|
|
206
208
|
this.files = this.files.filter((f) => typeof f.ID === 'string' && f.ID !== ID);
|
|
207
209
|
}
|
|
208
210
|
else {
|
|
209
|
-
this.
|
|
211
|
+
this.notifications.CreateSimpleNotification(`Unable to delete file ${ID} ${Name}`, 'error');
|
|
210
212
|
}
|
|
211
213
|
this.isLoading = false;
|
|
212
214
|
};
|
|
@@ -218,7 +220,7 @@ export class FilesGridComponent {
|
|
|
218
220
|
*/
|
|
219
221
|
handleFileUpload(e) {
|
|
220
222
|
if (!e.success) {
|
|
221
|
-
this.
|
|
223
|
+
this.notifications.CreateSimpleNotification(`Unable to upload file '${e.file.name}'`, 'error');
|
|
222
224
|
return;
|
|
223
225
|
}
|
|
224
226
|
this.files.push(e.file);
|
|
@@ -231,7 +233,7 @@ export class FilesGridComponent {
|
|
|
231
233
|
*/
|
|
232
234
|
async Refresh() {
|
|
233
235
|
this.isLoading = true;
|
|
234
|
-
const rv =
|
|
236
|
+
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
235
237
|
const result = await rv.RunView({
|
|
236
238
|
EntityName: 'MJ: Files',
|
|
237
239
|
ResultType: 'entity_object',
|
|
@@ -289,8 +291,8 @@ export class FilesGridComponent {
|
|
|
289
291
|
btn.appendChild(icon);
|
|
290
292
|
return btn;
|
|
291
293
|
}
|
|
292
|
-
static ɵfac = function FilesGridComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FilesGridComponent)(i0.ɵɵdirectiveInject(i1.
|
|
293
|
-
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) {
|
|
294
|
+
static ɵfac = function FilesGridComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FilesGridComponent)(i0.ɵɵdirectiveInject(i1.MJNotificationService)); };
|
|
295
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FilesGridComponent, selectors: [["mj-files-grid"]], inputs: { CategoryID: "CategoryID" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature, 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) {
|
|
294
296
|
i0.ɵɵelementStart(0, "div", 1);
|
|
295
297
|
i0.ɵɵconditionalCreate(1, FilesGridComponent_Conditional_1_Template, 2, 0, "div", 2);
|
|
296
298
|
i0.ɵɵelementStart(2, "ag-grid-angular", 3);
|
|
@@ -330,8 +332,8 @@ export class FilesGridComponent {
|
|
|
330
332
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FilesGridComponent, [{
|
|
331
333
|
type: Component,
|
|
332
334
|
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"] }]
|
|
333
|
-
}], () => [{ type: i1.
|
|
335
|
+
}], () => [{ type: i1.MJNotificationService }], { CategoryID: [{
|
|
334
336
|
type: Input
|
|
335
337
|
}] }); })();
|
|
336
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FilesGridComponent, { className: "FilesGridComponent", filePath: "src/lib/files-grid/files-grid.ts", lineNumber:
|
|
338
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FilesGridComponent, { className: "FilesGridComponent", filePath: "src/lib/files-grid/files-grid.ts", lineNumber: 77 }); })();
|
|
337
339
|
//# 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,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAIL,cAAc,EACd,kBAAkB,EAClB,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;ICfpB,8BAAkC;IAChC,gCAA+D;IACjE,iBAAM;;;;IA6BE,AADF,AADF,AADF,8BAAiC,oBACF,gBACE,eACC;IAAA,oBAAI;IAAA,iBAAO;IACvC,iCAK2B;IAFzB,oTAA2B;IAG/B,AANE,iBAK2B,EACrB;IAEN,AADF,iCAA6B,eACC;IAAA,2BAAW;IAAA,iBAAO;IAC9C,kCAI2B;IADzB,mUAAkC;IAI1C,AADE,AADE,AALE,iBAI2B,EACrB,EACH,EACH;;;IAbE,eAA2B;IAA3B,oDAA2B;IAE3B,2CAAsB;IAOtB,eAAkC;IAAlC,2DAAkC;IAClC,2CAAsB;;AD3BpC,2BAA2B;AAC3B,cAAc,CAAC,eAAe,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,KAAK,EAAE,GAAW,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F,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;;kBAyBxB,KAAK;;kFArBK,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 { MJ_AG_GRID_THEME_PARAMS } from '@memberjunction/ng-shared-generic';\nimport {\n ColDef,\n GridReadyEvent,\n GridApi,\n ModuleRegistry,\n AllCommunityModule,\n themeAlpine,\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 // Themed from the shared --mj-* token params so this grid follows light/dark and\n // the org brand overlay, matching the main entity/query grids.\n public GridTheme: Theme = themeAlpine.withParams(MJ_AG_GRID_THEME_PARAMS);\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"]}
|
|
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,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAIL,cAAc,EACd,kBAAkB,EAClB,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;IChBpB,8BAAkC;IAChC,gCAA+D;IACjE,iBAAM;;;;IA6BE,AADF,AADF,AADF,8BAAiC,oBACF,gBACE,eACC;IAAA,oBAAI;IAAA,iBAAO;IACvC,iCAK2B;IAFzB,oTAA2B;IAG/B,AANE,iBAK2B,EACrB;IAEN,AADF,iCAA6B,eACC;IAAA,2BAAW;IAAA,iBAAO;IAC9C,kCAI2B;IADzB,mUAAkC;IAI1C,AADE,AADE,AALE,iBAI2B,EACrB,EACH,EACH;;;IAbE,eAA2B;IAA3B,oDAA2B;IAE3B,2CAAsB;IAOtB,eAAkC;IAAlC,2DAAkC;IAClC,2CAAsB;;AD1B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A4C,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;;;iFDsB1D,kBAAkB;cAN9B,SAAS;6BACI,KAAK,YACP,eAAe;;kBA0BxB,KAAK;;kFAtBK,kBAAkB","sourcesContent":["import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n\nimport { RunView } from '@memberjunction/core';\nimport { MJFileEntity } from '@memberjunction/core-entities';\nimport { GraphQLDataProvider, gql } from '@memberjunction/graphql-dataprovider';\nimport { MJ_AG_GRID_THEME_PARAMS } from '@memberjunction/ng-shared-generic';\nimport {\n ColDef,\n GridReadyEvent,\n GridApi,\n ModuleRegistry,\n AllCommunityModule,\n themeAlpine,\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 extends BaseAngularComponent implements OnInit, OnChanges {\n public files: MJFileEntity[] = [];\n public isLoading: boolean = false;\n public editFile: MJFileEntity | undefined;\n\n // AG Grid configuration\n // Themed from the shared --mj-* token params so this grid follows light/dark and\n // the org brand overlay, matching the main entity/query grids.\n public GridTheme: Theme = themeAlpine.withParams(MJ_AG_GRID_THEME_PARAMS);\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 notifications: MJNotificationService) {\n super();\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 MJNotificationService.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.notifications.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.notifications.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.notifications.CreateSimpleNotification(`Unable to download file ${file.ID} ${file.Name}`, 'error');\n }\n } else {\n console.error(parsedResult.error);\n this.notifications.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.notifications.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.notifications.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.notifications.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 = RunView.FromMetadataProvider(this.ProviderToUse);\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-file-storage",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0-edge.0",
|
|
4
4
|
"description": "MemberJunction: Angular components for managing files, and related components.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -17,38 +17,32 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"/dist"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "vitest run",
|
|
22
|
-
"build": "ngc",
|
|
23
|
-
"watch": "ngc -w",
|
|
24
|
-
"test:watch": "vitest"
|
|
25
|
-
},
|
|
26
20
|
"keywords": [],
|
|
27
21
|
"author": "",
|
|
28
22
|
"license": "ISC",
|
|
29
23
|
"devDependencies": {
|
|
30
24
|
"@angular/compiler": "21.1.3",
|
|
31
25
|
"@angular/compiler-cli": "21.1.3",
|
|
32
|
-
"@memberjunction/ng-test-utils": "
|
|
26
|
+
"@memberjunction/ng-test-utils": "6.1.0-edge.0",
|
|
33
27
|
"vitest": "^4.0.18"
|
|
34
28
|
},
|
|
35
29
|
"peerDependencies": {
|
|
36
30
|
"@angular/common": "21.1.3",
|
|
37
31
|
"@angular/core": "21.1.3",
|
|
38
|
-
"@angular/forms": "21.1.3"
|
|
39
|
-
"@angular/router": "21.1.3"
|
|
32
|
+
"@angular/forms": "21.1.3"
|
|
40
33
|
},
|
|
41
34
|
"dependencies": {
|
|
42
|
-
"@memberjunction/ng-ui-components": "5.50.0",
|
|
43
35
|
"@angular/platform-browser": "21.1.3",
|
|
44
|
-
"@memberjunction/core": "
|
|
45
|
-
"@memberjunction/
|
|
46
|
-
"@memberjunction/
|
|
47
|
-
"@memberjunction/
|
|
48
|
-
"@memberjunction/
|
|
49
|
-
"@memberjunction/ng-container-directives": "
|
|
50
|
-
"@memberjunction/ng-
|
|
51
|
-
"@memberjunction/ng-shared
|
|
36
|
+
"@memberjunction/core": "6.1.0-edge.0",
|
|
37
|
+
"@memberjunction/core-entities": "6.1.0-edge.0",
|
|
38
|
+
"@memberjunction/global": "6.1.0-edge.0",
|
|
39
|
+
"@memberjunction/graphql-dataprovider": "6.1.0-edge.0",
|
|
40
|
+
"@memberjunction/ng-base-types": "6.1.0-edge.0",
|
|
41
|
+
"@memberjunction/ng-container-directives": "6.1.0-edge.0",
|
|
42
|
+
"@memberjunction/ng-notifications": "6.1.0-edge.0",
|
|
43
|
+
"@memberjunction/ng-shared": "6.1.0-edge.0",
|
|
44
|
+
"@memberjunction/ng-shared-generic": "6.1.0-edge.0",
|
|
45
|
+
"@memberjunction/ng-ui-components": "6.1.0-edge.0",
|
|
52
46
|
"ag-grid-angular": "^35.0.1",
|
|
53
47
|
"ag-grid-community": "^35.0.1",
|
|
54
48
|
"tslib": "^2.8.1",
|
|
@@ -58,5 +52,13 @@
|
|
|
58
52
|
"repository": {
|
|
59
53
|
"type": "git",
|
|
60
54
|
"url": "https://github.com/MemberJunction/MJ"
|
|
55
|
+
},
|
|
56
|
+
"mjUILayer": "surface",
|
|
57
|
+
"scripts": {
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"test:types": "tsc --noEmit -p tsconfig.spec.json",
|
|
60
|
+
"build": "ngc",
|
|
61
|
+
"watch": "ngc -w",
|
|
62
|
+
"test:watch": "vitest"
|
|
61
63
|
}
|
|
62
|
-
}
|
|
64
|
+
}
|