@memberjunction/ng-dashboard-viewer 6.2.0-edge.3 → 6.2.0-edge.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -17
- package/dist/lib/config-dialogs/confirm-dialog.component.d.ts +3 -4
- package/dist/lib/config-dialogs/confirm-dialog.component.d.ts.map +1 -1
- package/dist/lib/config-dialogs/confirm-dialog.component.js +3 -2
- package/dist/lib/config-dialogs/confirm-dialog.component.js.map +1 -1
- package/dist/lib/config-panels/artifact-config-panel.component.d.ts.map +1 -1
- package/dist/lib/config-panels/artifact-config-panel.component.js +59 -50
- package/dist/lib/config-panels/artifact-config-panel.component.js.map +1 -1
- package/dist/lib/config-panels/base-config-panel.d.ts +8 -3
- package/dist/lib/config-panels/base-config-panel.d.ts.map +1 -1
- package/dist/lib/config-panels/base-config-panel.js +10 -3
- package/dist/lib/config-panels/base-config-panel.js.map +1 -1
- package/dist/lib/config-panels/query-config-panel.component.js +124 -99
- package/dist/lib/config-panels/query-config-panel.component.js.map +1 -1
- package/dist/lib/config-panels/view-config-panel.component.js +111 -103
- package/dist/lib/config-panels/view-config-panel.component.js.map +1 -1
- package/dist/lib/config-panels/weburl-config-panel.component.js +89 -80
- package/dist/lib/config-panels/weburl-config-panel.component.js.map +1 -1
- package/dist/lib/dashboard-browser/dashboard-browser.component.d.ts +79 -28
- package/dist/lib/dashboard-browser/dashboard-browser.component.d.ts.map +1 -1
- package/dist/lib/dashboard-browser/dashboard-browser.component.js +446 -447
- package/dist/lib/dashboard-browser/dashboard-browser.component.js.map +1 -1
- package/dist/lib/dashboard-card/dashboard-card.component.d.ts +69 -0
- package/dist/lib/dashboard-card/dashboard-card.component.d.ts.map +1 -0
- package/dist/lib/dashboard-card/dashboard-card.component.js +281 -0
- package/dist/lib/dashboard-card/dashboard-card.component.js.map +1 -0
- package/dist/lib/dashboard-card/dashboard-card.helpers.d.ts +18 -0
- package/dist/lib/dashboard-card/dashboard-card.helpers.d.ts.map +1 -0
- package/dist/lib/dashboard-card/dashboard-card.helpers.js +43 -0
- package/dist/lib/dashboard-card/dashboard-card.helpers.js.map +1 -0
- package/dist/lib/dashboard-card/layout-preview-cache.d.ts +15 -0
- package/dist/lib/dashboard-card/layout-preview-cache.d.ts.map +1 -0
- package/dist/lib/dashboard-card/layout-preview-cache.js +22 -0
- package/dist/lib/dashboard-card/layout-preview-cache.js.map +1 -0
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.d.ts +69 -12
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.d.ts.map +1 -1
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.js +173 -145
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.js.map +1 -1
- package/dist/lib/dashboard-viewer.module.d.ts +24 -20
- package/dist/lib/dashboard-viewer.module.d.ts.map +1 -1
- package/dist/lib/dashboard-viewer.module.js +42 -5
- package/dist/lib/dashboard-viewer.module.js.map +1 -1
- package/dist/lib/dialogs/add-panel-dialog/add-panel-dialog.component.d.ts +7 -12
- package/dist/lib/dialogs/add-panel-dialog/add-panel-dialog.component.d.ts.map +1 -1
- package/dist/lib/dialogs/add-panel-dialog/add-panel-dialog.component.js +3 -1
- package/dist/lib/dialogs/add-panel-dialog/add-panel-dialog.component.js.map +1 -1
- package/dist/lib/dialogs/dashboard-name-dialog/dashboard-name-dialog.component.d.ts +54 -0
- package/dist/lib/dialogs/dashboard-name-dialog/dashboard-name-dialog.component.d.ts.map +1 -0
- package/dist/lib/dialogs/dashboard-name-dialog/dashboard-name-dialog.component.js +156 -0
- package/dist/lib/dialogs/dashboard-name-dialog/dashboard-name-dialog.component.js.map +1 -0
- package/dist/lib/dialogs/edit-part-dialog/edit-part-dialog.component.d.ts +5 -11
- package/dist/lib/dialogs/edit-part-dialog/edit-part-dialog.component.d.ts.map +1 -1
- package/dist/lib/dialogs/edit-part-dialog/edit-part-dialog.component.js +3 -1
- package/dist/lib/dialogs/edit-part-dialog/edit-part-dialog.component.js.map +1 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.d.ts +147 -0
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.d.ts.map +1 -0
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.js +536 -0
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.js.map +1 -0
- package/dist/lib/layout-preview/dashboard-layout-preview-node.component.d.ts +20 -0
- package/dist/lib/layout-preview/dashboard-layout-preview-node.component.d.ts.map +1 -0
- package/dist/lib/layout-preview/dashboard-layout-preview-node.component.js +80 -0
- package/dist/lib/layout-preview/dashboard-layout-preview-node.component.js.map +1 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.component.d.ts +28 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.component.d.ts.map +1 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.component.js +62 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.component.js.map +1 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.d.ts +33 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.d.ts.map +1 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.js +138 -0
- package/dist/lib/layout-preview/dashboard-layout-preview.js.map +1 -0
- package/dist/lib/models/dashboard-layout-editor.d.ts +78 -0
- package/dist/lib/models/dashboard-layout-editor.d.ts.map +1 -0
- package/dist/lib/models/dashboard-layout-editor.js +374 -0
- package/dist/lib/models/dashboard-layout-editor.js.map +1 -0
- package/dist/lib/models/remove-part-confirm.d.ts +8 -0
- package/dist/lib/models/remove-part-confirm.d.ts.map +1 -0
- package/dist/lib/models/remove-part-confirm.js +23 -0
- package/dist/lib/models/remove-part-confirm.js.map +1 -0
- package/dist/lib/parts/artifact-part.component.js +2 -2
- package/dist/lib/parts/artifact-part.component.js.map +1 -1
- package/dist/lib/parts/query-part.component.js +2 -2
- package/dist/lib/parts/query-part.component.js.map +1 -1
- package/dist/lib/parts/view-part.component.js +2 -2
- package/dist/lib/parts/view-part.component.js.map +1 -1
- package/dist/lib/parts/weburl-part.component.js +2 -2
- package/dist/lib/parts/weburl-part.component.js.map +1 -1
- package/dist/lib/services/golden-layout-wrapper.service.d.ts +40 -0
- package/dist/lib/services/golden-layout-wrapper.service.d.ts.map +1 -1
- package/dist/lib/services/golden-layout-wrapper.service.js +117 -9
- package/dist/lib/services/golden-layout-wrapper.service.js.map +1 -1
- package/dist/lib/services/stack-part-actions.d.ts +11 -0
- package/dist/lib/services/stack-part-actions.d.ts.map +1 -0
- package/dist/lib/services/stack-part-actions.js +41 -0
- package/dist/lib/services/stack-part-actions.js.map +1 -0
- package/dist/public-api.d.ts +9 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +13 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-name-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/dialogs/dashboard-name-dialog/dashboard-name-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;;;;IA8C1F,uBAA8D;;AA5CtF,yGAAyG;AACzG,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AA4CH,MAAM,OAAO,4BAA4B;IAC7B,QAAQ,GAAG,KAAK,CAAC;IAEzB,yEAAyE;IACzE,IACI,OAAO,CAAC,KAAc;QACtB,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,KAAK,CA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,iBASmC,EAC/B;YAEJ,AADJ,yCAAmB,gBACiG;YAArB,yGAAS,cAAU,IAAC;YAC3G,4FAAkB;YAGlB,YACJ;YAAA,iBAAS;YACT,iCAAkH;YAArB,yGAAS,cAAU,IAAC;YAAC,uBAAM;YAEhI,AADI,AAD4H,iBAAS,EACjH,EACZ;;YAvB6C,AAA1B,AAApB,qCAAmB,oBAAgB,8BAAoC;YAQtE,eAA2B;YAE3B,AADA,AADA,6CAA2B,4BACJ,4BACA;YACvB,wCAAkB;YAI6C,eAAuB;YAAvB,yCAAuB;YACtF,cAEC;YAFD,yCAEC;YACD,cACJ;YADI,gDACJ;YACqE,cAAuB;YAAvB,yCAAuB;4BAvB9F,WAAW,kFAAE,iBAAiB,EAAE,wBAAwB,EAAE,iBAAiB;;iFAwC5E,4BAA4B;cA3CxC,SAAS;6BACM,IAAI,YACN,0BAA0B,WAC3B,CAAC,WAAW,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,iBAAiB,CAAC,YAC5E;;;;;;;;;;;;;;;;;;;;;;;;;KAyBT;;kBAkBA,KAAK;;kBAYL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,MAAM;;kBAGN,MAAM;;kFAlCE,4BAA4B","sourcesContent":["import { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MJButtonDirective, MJDialogActionsComponent, MJDialogComponent } from '@memberjunction/ng-ui-components';\n\n/** The longest dashboard name when the host gives no MaxLength: MJ: Dashboards.Name is nvarchar(255). */\nexport const DASHBOARD_NAME_MAX_LENGTH = 255;\n\n/**\n * mj-dashboard-name-dialog — asks for the name of a new dashboard before it is created.\n *\n * Create stays disabled until the trimmed name has 1 to MaxLength characters. Create, or Enter in the\n * field, emits `Confirmed` with the trimmed name and leaves the dialog open: the host creates the\n * dashboard, sets `Processing` meanwhile, and closes the dialog through `Visible`. Cancel, Esc, the\n * backdrop and the close button emit `Cancelled`; the host closes the dialog and creates nothing.\n *\n * @example\n * ```html\n * <mj-dashboard-name-dialog\n * [Visible]=\"ShowNewDashboardDialog\"\n * [MaxLength]=\"NewDashboardNameMaxLength\"\n * [Processing]=\"IsCreatingDashboard\"\n * (Confirmed)=\"OnNewDashboardNamed($event)\"\n * (Cancelled)=\"OnNewDashboardCancelled()\">\n * </mj-dashboard-name-dialog>\n * ```\n */\n@Component({\n standalone: true,\n selector: 'mj-dashboard-name-dialog',\n imports: [FormsModule, MJDialogComponent, MJDialogActionsComponent, MJButtonDirective],\n template: `\n <mj-dialog [Visible]=\"Visible\" [Title]=\"Title\" Size=\"sm\" [Closeable]=\"!Processing\" (Close)=\"OnCancel()\">\n <label class=\"dn-field\">\n <span class=\"dn-label\">Name</span>\n <input\n class=\"mj-input dn-name\"\n type=\"text\"\n autocomplete=\"off\"\n data-autofocus\n [placeholder]=\"Placeholder\"\n [maxlength]=\"MaxLength\"\n [disabled]=\"Processing\"\n [(ngModel)]=\"Name\"\n (keydown.enter)=\"OnCreate()\" />\n </label>\n <mj-dialog-actions>\n <button type=\"button\" mjButton Variant=\"primary\" class=\"dn-create\" [disabled]=\"!CanCreate\" (click)=\"OnCreate()\">\n @if (Processing) {\n <i class=\"fa-solid fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n {{ ConfirmText }}\n </button>\n <button type=\"button\" mjButton Variant=\"secondary\" class=\"dn-cancel\" [disabled]=\"Processing\" (click)=\"OnCancel()\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n `,\n styles: [`\n .dn-field {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-2);\n }\n .dn-label {\n font-size: var(--mj-text-sm);\n font-weight: var(--mj-font-semibold);\n color: var(--mj-text-secondary);\n }\n `],\n})\nexport class DashboardNameDialogComponent {\n private _visible = false;\n\n /** Shows the dialog. Each time it opens, the name field starts empty. */\n @Input()\n set Visible(value: boolean) {\n if (value && !this._visible) {\n this.Name = '';\n }\n this._visible = value;\n }\n get Visible(): boolean {\n return this._visible;\n }\n\n /** The dialog title. */\n @Input() Title = 'New dashboard';\n\n /** The label of the confirm button. */\n @Input() ConfirmText = 'Create';\n\n /** The placeholder of the name field. */\n @Input() Placeholder = 'Name this dashboard';\n\n /** The longest name accepted: the MaxLength of MJ: Dashboards.Name. */\n @Input() MaxLength = DASHBOARD_NAME_MAX_LENGTH;\n\n /** True while the host creates the dashboard: Create shows a spinner, and the dialog cannot be changed or closed. */\n @Input() Processing = false;\n\n /** The trimmed name, when the user clicks Create or presses Enter. The dialog stays open. */\n @Output() Confirmed = new EventEmitter<string>();\n\n /** The user cancelled: Cancel, Esc, the backdrop or the close button. */\n @Output() Cancelled = new EventEmitter<void>();\n\n /** The name in the field. */\n public Name = '';\n\n /** True when the trimmed name has 1 to MaxLength characters and nothing is being created. */\n public get CanCreate(): boolean {\n const length = this.Name.trim().length;\n return length > 0 && length <= this.MaxLength && !this.Processing;\n }\n\n /** Emits the trimmed name when it is valid. */\n public OnCreate(): void {\n if (this.CanCreate) {\n this.Confirmed.emit(this.Name.trim());\n }\n }\n\n /** Emits Cancelled, unless the host is creating the dashboard. */\n public OnCancel(): void {\n if (!this.Processing) {\n this.Cancelled.emit();\n }\n }\n}\n"]}
|
|
@@ -2,18 +2,10 @@ import { EventEmitter, ChangeDetectorRef, ViewContainerRef, OnDestroy, AfterView
|
|
|
2
2
|
import { MJDashboardPartTypeEntity } from '@memberjunction/core-entities';
|
|
3
3
|
import { PanelConfig, DashboardPanel } from '../../models/dashboard-types';
|
|
4
4
|
import { ConfigPanelResult } from '../../config-panels/base-config-panel';
|
|
5
|
+
import type { DashboardPartDialogResult } from '../part-dialog/dashboard-part-dialog.component';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export interface EditPartDialogResult {
|
|
10
|
-
/** The updated panel configuration */
|
|
11
|
-
Config: PanelConfig;
|
|
12
|
-
/** Updated title */
|
|
13
|
-
Title: string;
|
|
14
|
-
/** Updated icon (optional) */
|
|
15
|
-
Icon?: string;
|
|
16
|
-
}
|
|
7
|
+
/** @deprecated Use {@link DashboardPartDialogResult}. */
|
|
8
|
+
export type EditPartDialogResult = Omit<DashboardPartDialogResult, 'PartType'>;
|
|
17
9
|
/**
|
|
18
10
|
* Generic dialog for editing dashboard part configuration.
|
|
19
11
|
*
|
|
@@ -22,6 +14,8 @@ export interface EditPartDialogResult {
|
|
|
22
14
|
*
|
|
23
15
|
* This allows new part types to be added without modifying this dialog -
|
|
24
16
|
* just create a config panel, register it, and set the ConfigDialogClass.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use `DashboardPartDialogComponent` (`<mj-dashboard-part-dialog Mode="edit">`), which adds and edits parts on `mj-dialog`.
|
|
25
19
|
*/
|
|
26
20
|
export declare class EditPartDialogComponent implements OnDestroy, AfterViewInit {
|
|
27
21
|
private cdr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-part-dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EACZ,iBAAiB,EAEjB,gBAAgB,EAEhB,SAAS,EACT,aAAa,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAmB,iBAAiB,EAAE,MAAM,uCAAuC,CAAC
|
|
1
|
+
{"version":3,"file":"edit-part-dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EACZ,iBAAiB,EAEjB,gBAAgB,EAEhB,SAAS,EACT,aAAa,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,yBAAyB,EAAE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W,IAAI,IAAI;IAInB;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;YACW,eAAe;IA+E7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;OAEG;IACI,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAMvD,+CAA+C;IACxC,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAIvD;;OAEG;IACI,cAAc,IAAI,MAAM;IAK/B,8CAA8C;IACvC,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,OAAO,IAAI,MAAM;IAIxB;;OAEG;IACI,IAAI,IAAI,IAAI;IAYnB;;OAEG;IACI,MAAM,IAAI,IAAI;IAIrB;;OAEG;IACI,iBAAiB,IAAI,MAAM;IAIlC,iDAAiD;IAC1C,iBAAiB,IAAI,MAAM;yCAxRzB,uBAAuB;2CAAvB,uBAAuB;CA2RnC"}
|
|
@@ -74,6 +74,8 @@ function EditPartDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
74
74
|
*
|
|
75
75
|
* This allows new part types to be added without modifying this dialog -
|
|
76
76
|
* just create a config panel, register it, and set the ConfigDialogClass.
|
|
77
|
+
*
|
|
78
|
+
* @deprecated Use `DashboardPartDialogComponent` (`<mj-dashboard-part-dialog Mode="edit">`), which adds and edits parts on `mj-dialog`.
|
|
77
79
|
*/
|
|
78
80
|
export class EditPartDialogComponent {
|
|
79
81
|
cdr;
|
|
@@ -345,5 +347,5 @@ export class EditPartDialogComponent {
|
|
|
345
347
|
type: ViewChild,
|
|
346
348
|
args: ['configPanelContainer', { read: ViewContainerRef, static: false }]
|
|
347
349
|
}] }); })();
|
|
348
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EditPartDialogComponent, { className: "EditPartDialogComponent", filePath: "src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.ts", lineNumber:
|
|
350
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EditPartDialogComponent, { className: "EditPartDialogComponent", filePath: "src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.ts", lineNumber: 39 }); })();
|
|
349
351
|
//# sourceMappingURL=edit-part-dialog.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-part-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.ts","../../../../src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EAEZ,SAAS,EACT,gBAAgB,EAInB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAqB,MAAM,uCAAuC,CAAC;;;;ICGjF,8BAA2B;IACzB,wBAA2C;IAC3C,4BAAM;IAAA,8CAA8B;IACtC,AADsC,iBAAO,EACvC;;;IAIN,+BAAyB;IACvB,wBAAgD;IAChD,4BAAM;IAAA,YAAe;IACvB,AADuB,iBAAO,EACxB;;;IADE,eAAe;IAAf,sCAAe;;;;IAzB/B,8BAAyD;IAAnB,wLAAS,eAAQ,KAAC;IACtD,8BAAiE;IAAnC,qHAAS,wBAAwB,IAAC;IAG5D,AADF,8BAA2B,aACA;IACvB,oBAA2B;IAC7B,iBAAM;IACN,0BAAI;IAAA,YAAsB;IAAA,iBAAK;IAC/B,iCAAgD;IAAnB,2LAAS,eAAQ,KAAC;IAC7C,uBAAiC;IAErC,AADE,iBAAS,EACL;IAEN,8BAA4B;IAE1B,yGAAiB;IAOjB,0GAA+B;IAO/B,kCAAmD;IACrD,iBAAM;IAGJ,AADF,gCAA2B,kBAIyB;IADhD,4LAAS,aAAM,KAAC;IAEhB,yBAAiC;IACjC,aACF;IAAA,iBAAS;IACT,mCAAiD;IA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,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;SAC/B,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,MAAM;QACT,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC;IACpD,CAAC;IAED,iDAAiD;IAC1C,iBAAiB;QACtB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;iHA1RQ,uBAAuB;6DAAvB,uBAAuB;mCAoDW,gBAAgB;;;;;YC/F/D,0FAAe;;YAAf,sCA+CC;;;iFDJY,uBAAuB;cANnC,SAAS;6BACI,KAAK,YACL,qBAAqB;;kBAQ9B,KAAK;;kBAuBL,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAKL,MAAM;;kBAKN,MAAM;;kBAKN,SAAS;mBAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE;;kFApDnE,uBAAuB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n ChangeDetectorRef,\n ViewChild,\n ViewContainerRef,\n ComponentRef,\n OnDestroy,\n AfterViewInit\n} from '@angular/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { MJDashboardPartTypeEntity } from '@memberjunction/core-entities';\nimport { PanelConfig, DashboardPanel } from '../../models/dashboard-types';\nimport { BaseConfigPanel, ConfigPanelResult } from '../../config-panels/base-config-panel';\n\n/**\n * Result from the edit part dialog\n */\nexport interface EditPartDialogResult {\n /** The updated panel configuration */\n Config: PanelConfig;\n /** Updated title */\n Title: string;\n /** Updated icon (optional) */\n Icon?: string;\n}\n\n/**\n * Generic dialog for editing dashboard part configuration.\n *\n * This dialog dynamically loads the appropriate config panel based on the\n * DashboardPartType.ConfigDialogClass field, using MJGlobal.ClassFactory.\n *\n * This allows new part types to be added without modifying this dialog -\n * just create a config panel, register it, and set the ConfigDialogClass.\n */\n@Component({\n standalone: false,\n selector: 'mj-edit-part-dialog',\n templateUrl: './edit-part-dialog.component.html',\n styleUrls: ['./edit-part-dialog.component.css']\n})\nexport class EditPartDialogComponent implements OnDestroy, AfterViewInit {\n /**\n * Whether the dialog is visible\n */\n @Input()\n set Visible(value: boolean) {\n const previous = this._visible;\n this._visible = value;\n if (value && !previous) {\n this.onDialogOpened();\n // Delay loadConfigPanel to next tick to ensure all inputs are set\n // Angular doesn't guarantee input order, so PartType might not be set yet\n if (this.viewInitialized) {\n setTimeout(() => this.loadConfigPanel(), 0);\n }\n } else if (!value && previous) {\n this.onDialogClosed();\n }\n }\n get Visible(): boolean {\n return this._visible;\n }\n private _visible = false;\n\n /**\n * The part type being configured\n */\n @Input() PartType: MJDashboardPartTypeEntity | null = null;\n\n /**\n * The panel being edited\n */\n @Input() Panel: DashboardPanel | null = null;\n\n /**\n * The current configuration\n */\n @Input() Config: PanelConfig | null = null;\n\n /**\n * Emitted when configuration is saved\n */\n @Output() Saved = new EventEmitter<EditPartDialogResult>();\n\n /**\n * Emitted when dialog is cancelled\n */\n @Output() Cancelled = new EventEmitter<void>();\n\n /**\n * Container for dynamically loaded config panel\n */\n @ViewChild('configPanelContainer', { read: ViewContainerRef, static: false })\n ConfigPanelContainer!: ViewContainerRef;\n\n /** @deprecated Use {@link ConfigPanelContainer}. */\n get configPanelContainer(): ViewContainerRef {\n return this.ConfigPanelContainer;\n }\n /** @deprecated Use {@link ConfigPanelContainer}. */\n set configPanelContainer(value: ViewContainerRef) {\n this.ConfigPanelContainer = value;\n }\n\n /**\n * Reference to the dynamically created config panel component\n */\n private configPanelRef: ComponentRef<BaseConfigPanel> | null = null;\n\n /**\n * Track validity from the embedded panel\n */\n public IsValid = false;\n\n /**\n * Store the latest result from the panel\n */\n private latestResult: ConfigPanelResult | null = null;\n\n /**\n * Error message if panel failed to load\n */\n public LoadError: string | null = null;\n\n /**\n * Whether the panel is loading\n */\n public IsLoading = false;\n\n private viewInitialized = false;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngAfterViewInit(): void {\n this.viewInitialized = true;\n if (this.Visible) {\n this.loadConfigPanel();\n }\n }\n\n ngOnDestroy(): void {\n this.destroyConfigPanel();\n }\n\n /**\n * Called when dialog opens\n */\n private onDialogOpened(): void {\n this.IsValid = false;\n this.latestResult = null;\n this.LoadError = null;\n\n if (this.viewInitialized) {\n this.loadConfigPanel();\n }\n }\n\n /**\n * Called when dialog closes\n */\n private onDialogClosed(): void {\n this.destroyConfigPanel();\n }\n\n /**\n * Dynamically load the config panel component\n */\n private async loadConfigPanel(): Promise<void> {\n this.destroyConfigPanel();\n this.LoadError = null; // Clear any previous error\n\n console.log('[EditPartDialog] loadConfigPanel() called');\n console.log('[EditPartDialog] PartType:', this.PartType?.Name);\n console.log('[EditPartDialog] ConfigDialogClass:', this.PartType?.ConfigDialogClass);\n\n if (!this.PartType?.ConfigDialogClass) {\n // No config class specified - this is okay for simple part types\n // Just enable the save button with default config\n console.log('[EditPartDialog] No ConfigDialogClass specified, using default');\n this.IsValid = true;\n this.cdr.detectChanges();\n return;\n }\n\n if (!this.ConfigPanelContainer) {\n // Container not ready yet - will be called again from ngAfterViewInit\n console.log('[EditPartDialog] Container not ready yet');\n return;\n }\n\n this.IsLoading = true;\n this.cdr.detectChanges();\n\n try {\n // Use ClassFactory to create the config panel instance\n console.log('[EditPartDialog] Attempting to create instance via ClassFactory:', this.PartType.ConfigDialogClass);\n const panelInstance = await MJGlobal.Instance.ClassFactory.CreateInstanceAsync<BaseConfigPanel>(\n BaseConfigPanel,\n this.PartType.ConfigDialogClass\n );\n\n console.log('[EditPartDialog] ClassFactory returned:', panelInstance);\n\n if (!panelInstance) {\n this.LoadError = `Could not create config panel: ${this.PartType.ConfigDialogClass}`;\n console.error('[EditPartDialog]', this.LoadError);\n this.IsLoading = false;\n this.IsValid = true; // Allow saving with default config\n this.cdr.detectChanges();\n return;\n }\n\n // Get the component class from the instance\n // We need to find the Angular component class that was registered\n const componentClass = (panelInstance as object).constructor as typeof BaseConfigPanel;\n console.log('[EditPartDialog] Component class:', componentClass.name);\n\n // Clear the container and create the component\n this.ConfigPanelContainer.clear();\n this.configPanelRef = this.ConfigPanelContainer.createComponent(componentClass as never);\n console.log('[EditPartDialog] Component created successfully');\n\n // Set inputs on the component\n const panel = this.configPanelRef.instance;\n panel.partType = this.PartType;\n panel.panel = this.Panel;\n panel.config = this.Config;\n\n // Subscribe to config changes\n panel.configChanged.subscribe((result: ConfigPanelResult) => {\n this.OnConfigChanged(result);\n });\n\n this.IsLoading = false;\n this.LoadError = null; // Ensure error is cleared on success\n this.cdr.detectChanges();\n\n } catch (error) {\n this.LoadError = `Failed to load config panel: ${error instanceof Error ? error.message : String(error)}`;\n console.error('[EditPartDialog]', this.LoadError, error);\n this.IsLoading = false;\n this.IsValid = true; // Allow saving with default config\n this.cdr.detectChanges();\n }\n }\n\n /**\n * Destroy the dynamically created config panel\n */\n private destroyConfigPanel(): void {\n if (this.configPanelRef) {\n this.configPanelRef.destroy();\n this.configPanelRef = null;\n }\n }\n\n /**\n * Handle configuration changes from the embedded panel\n */\n public OnConfigChanged(result: ConfigPanelResult): void {\n this.latestResult = result;\n this.IsValid = result.isValid;\n this.cdr.detectChanges();\n }\n\n /** @deprecated Use {@link OnConfigChanged}. */\n public onConfigChanged(result: ConfigPanelResult): void {\n return this.OnConfigChanged(result);\n }\n\n /**\n * Get the dialog title based on part type\n */\n public GetDialogTitle(): string {\n const partName = this.PartType?.Name || 'Part';\n return this.Panel ? `Configure ${partName}` : `Add ${partName}`;\n }\n\n /** @deprecated Use {@link GetDialogTitle}. */\n public getDialogTitle(): string {\n return this.GetDialogTitle();\n }\n\n /**\n * Get the part type icon\n */\n public getIcon(): string {\n return this.PartType?.Icon || 'fa-solid fa-puzzle-piece';\n }\n\n /**\n * Save the configuration\n */\n public save(): void {\n if (!this.IsValid || !this.latestResult) {\n return;\n }\n\n this.Saved.emit({\n Config: this.latestResult.config,\n Title: this.latestResult.title,\n Icon: this.latestResult.icon\n });\n }\n\n /**\n * Cancel and close the dialog\n */\n public cancel(): void {\n this.Cancelled.emit();\n }\n\n /**\n * Get save button text\n */\n public GetSaveButtonText(): string {\n return this.Panel ? 'Save Changes' : 'Add Part';\n }\n\n /** @deprecated Use {@link GetSaveButtonText}. */\n public getSaveButtonText(): string {\n return this.GetSaveButtonText();\n }\n}\n","<!-- Generic Edit Part Dialog -->\n@if (Visible) {\n <div class=\"edit-part-dialog-overlay\" (click)=\"cancel()\">\n <div class=\"edit-part-dialog\" (click)=\"$event.stopPropagation()\">\n <!-- Header -->\n <div class=\"dialog-header\">\n <div class=\"header-icon\">\n <i [class]=\"getIcon()\"></i>\n </div>\n <h3>{{ getDialogTitle() }}</h3>\n <button class=\"close-button\" (click)=\"cancel()\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n <!-- Content -->\n <div class=\"dialog-content\">\n <!-- Loading state -->\n @if (IsLoading) {\n <div class=\"loading-state\">\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n <span>Loading configuration panel...</span>\n </div>\n }\n <!-- Error state -->\n @if (LoadError && !IsLoading) {\n <div class=\"error-state\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n <span>{{ LoadError }}</span>\n </div>\n }\n <!-- Dynamic config panel container -->\n <ng-container #configPanelContainer></ng-container>\n </div>\n <!-- Footer -->\n <div class=\"dialog-footer\">\n <button\n class=\"btn-primary\"\n (click)=\"save()\"\n [disabled]=\"!IsValid || IsLoading || LoadError\">\n <i class=\"fa-solid fa-check\"></i>\n {{ getSaveButtonText() }}\n </button>\n <button class=\"btn-secondary\" (click)=\"cancel()\">\n Cancel\n </button>\n </div>\n </div>\n </div>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"edit-part-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.ts","../../../../src/lib/dialogs/edit-part-dialog/edit-part-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EAEZ,SAAS,EACT,gBAAgB,EAInB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAqB,MAAM,uCAAuC,CAAC;;;;ICGjF,8BAA2B;IACzB,wBAA2C;IAC3C,4BAAM;IAAA,8CAA8B;IACtC,AADsC,iBAAO,EACvC;;;IAIN,+BAAyB;IACvB,wBAAgD;IAChD,4BAAM;IAAA,YAAe;IACvB,AADuB,iBAAO,EACxB;;;IADE,eAAe;IAAf,sCAAe;;;;IAzB/B,8BAAyD;IAAnB,wLAAS,eAAQ,KAAC;IACtD,8BAAiE;IAAnC,qHAAS,wBAAwB,IAAC;IAG5D,AADF,8BAA2B,aACA;IACvB,oBAA2B;IAC7B,iBAAM;IACN,0BAAI;IAAA,YAAsB;IAAA,iBAAK;IAC/B,iCAAgD;IAAnB,2LAAS,eAAQ,KAAC;IAC7C,uBAAiC;IAErC,AADE,iBAAS,EACL;IAEN,8BAA4B;IAE1B,yGAAiB;IAOjB,0GAA+B;IAO/B,kCAAmD;IACrD,iBAAM;IAGJ,AADF,gCAA2B,kBAIyB;IADhD,4LAAS,aAAM,KAAC;IAEhB,yBAAiC;IACjC,aACF;IAAA,iBAAS;IACT,mCAAiD;IAAnB,4LAAS,eAAQ,KAAC;IAC9C,yBACF;IAGN,AADE,AADE,AADE,iBAAS,EACL,EACF,EACF;;;IAxCK,eAAmB;IAAnB,+BAAmB;IAEpB,eAAsB;IAAtB,6CAAsB;IAQ1B,eAKC;IALD,4CAKC;IAED,cAKC;IALD,iEAKC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B,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,MAAM;QACT,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC;IACpD,CAAC;IAED,iDAAiD;IAC1C,iBAAiB;QACtB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;iHA1RQ,uBAAuB;6DAAvB,uBAAuB;mCAoDW,gBAAgB;;;;;YCzF/D,0FAAe;;YAAf,sCA+CC;;;iFDVY,uBAAuB;cANnC,SAAS;6BACI,KAAK,YACL,qBAAqB;;kBAQ9B,KAAK;;kBAuBL,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAKL,MAAM;;kBAKN,MAAM;;kBAKN,SAAS;mBAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE;;kFApDnE,uBAAuB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n ChangeDetectorRef,\n ViewChild,\n ViewContainerRef,\n ComponentRef,\n OnDestroy,\n AfterViewInit\n} from '@angular/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { MJDashboardPartTypeEntity } from '@memberjunction/core-entities';\nimport { PanelConfig, DashboardPanel } from '../../models/dashboard-types';\nimport { BaseConfigPanel, ConfigPanelResult } from '../../config-panels/base-config-panel';\nimport type { DashboardPartDialogResult } from '../part-dialog/dashboard-part-dialog.component';\n\n/** @deprecated Use {@link DashboardPartDialogResult}. */\nexport type EditPartDialogResult = Omit<DashboardPartDialogResult, 'PartType'>;\n\n/**\n * Generic dialog for editing dashboard part configuration.\n *\n * This dialog dynamically loads the appropriate config panel based on the\n * DashboardPartType.ConfigDialogClass field, using MJGlobal.ClassFactory.\n *\n * This allows new part types to be added without modifying this dialog -\n * just create a config panel, register it, and set the ConfigDialogClass.\n *\n * @deprecated Use `DashboardPartDialogComponent` (`<mj-dashboard-part-dialog Mode=\"edit\">`), which adds and edits parts on `mj-dialog`.\n */\n@Component({\n standalone: false,\n selector: 'mj-edit-part-dialog',\n templateUrl: './edit-part-dialog.component.html',\n styleUrls: ['./edit-part-dialog.component.css']\n})\nexport class EditPartDialogComponent implements OnDestroy, AfterViewInit {\n /**\n * Whether the dialog is visible\n */\n @Input()\n set Visible(value: boolean) {\n const previous = this._visible;\n this._visible = value;\n if (value && !previous) {\n this.onDialogOpened();\n // Delay loadConfigPanel to next tick to ensure all inputs are set\n // Angular doesn't guarantee input order, so PartType might not be set yet\n if (this.viewInitialized) {\n setTimeout(() => this.loadConfigPanel(), 0);\n }\n } else if (!value && previous) {\n this.onDialogClosed();\n }\n }\n get Visible(): boolean {\n return this._visible;\n }\n private _visible = false;\n\n /**\n * The part type being configured\n */\n @Input() PartType: MJDashboardPartTypeEntity | null = null;\n\n /**\n * The panel being edited\n */\n @Input() Panel: DashboardPanel | null = null;\n\n /**\n * The current configuration\n */\n @Input() Config: PanelConfig | null = null;\n\n /**\n * Emitted when configuration is saved\n */\n @Output() Saved = new EventEmitter<EditPartDialogResult>();\n\n /**\n * Emitted when dialog is cancelled\n */\n @Output() Cancelled = new EventEmitter<void>();\n\n /**\n * Container for dynamically loaded config panel\n */\n @ViewChild('configPanelContainer', { read: ViewContainerRef, static: false })\n ConfigPanelContainer!: ViewContainerRef;\n\n /** @deprecated Use {@link ConfigPanelContainer}. */\n get configPanelContainer(): ViewContainerRef {\n return this.ConfigPanelContainer;\n }\n /** @deprecated Use {@link ConfigPanelContainer}. */\n set configPanelContainer(value: ViewContainerRef) {\n this.ConfigPanelContainer = value;\n }\n\n /**\n * Reference to the dynamically created config panel component\n */\n private configPanelRef: ComponentRef<BaseConfigPanel> | null = null;\n\n /**\n * Track validity from the embedded panel\n */\n public IsValid = false;\n\n /**\n * Store the latest result from the panel\n */\n private latestResult: ConfigPanelResult | null = null;\n\n /**\n * Error message if panel failed to load\n */\n public LoadError: string | null = null;\n\n /**\n * Whether the panel is loading\n */\n public IsLoading = false;\n\n private viewInitialized = false;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngAfterViewInit(): void {\n this.viewInitialized = true;\n if (this.Visible) {\n this.loadConfigPanel();\n }\n }\n\n ngOnDestroy(): void {\n this.destroyConfigPanel();\n }\n\n /**\n * Called when dialog opens\n */\n private onDialogOpened(): void {\n this.IsValid = false;\n this.latestResult = null;\n this.LoadError = null;\n\n if (this.viewInitialized) {\n this.loadConfigPanel();\n }\n }\n\n /**\n * Called when dialog closes\n */\n private onDialogClosed(): void {\n this.destroyConfigPanel();\n }\n\n /**\n * Dynamically load the config panel component\n */\n private async loadConfigPanel(): Promise<void> {\n this.destroyConfigPanel();\n this.LoadError = null; // Clear any previous error\n\n console.log('[EditPartDialog] loadConfigPanel() called');\n console.log('[EditPartDialog] PartType:', this.PartType?.Name);\n console.log('[EditPartDialog] ConfigDialogClass:', this.PartType?.ConfigDialogClass);\n\n if (!this.PartType?.ConfigDialogClass) {\n // No config class specified - this is okay for simple part types\n // Just enable the save button with default config\n console.log('[EditPartDialog] No ConfigDialogClass specified, using default');\n this.IsValid = true;\n this.cdr.detectChanges();\n return;\n }\n\n if (!this.ConfigPanelContainer) {\n // Container not ready yet - will be called again from ngAfterViewInit\n console.log('[EditPartDialog] Container not ready yet');\n return;\n }\n\n this.IsLoading = true;\n this.cdr.detectChanges();\n\n try {\n // Use ClassFactory to create the config panel instance\n console.log('[EditPartDialog] Attempting to create instance via ClassFactory:', this.PartType.ConfigDialogClass);\n const panelInstance = await MJGlobal.Instance.ClassFactory.CreateInstanceAsync<BaseConfigPanel>(\n BaseConfigPanel,\n this.PartType.ConfigDialogClass\n );\n\n console.log('[EditPartDialog] ClassFactory returned:', panelInstance);\n\n if (!panelInstance) {\n this.LoadError = `Could not create config panel: ${this.PartType.ConfigDialogClass}`;\n console.error('[EditPartDialog]', this.LoadError);\n this.IsLoading = false;\n this.IsValid = true; // Allow saving with default config\n this.cdr.detectChanges();\n return;\n }\n\n // Get the component class from the instance\n // We need to find the Angular component class that was registered\n const componentClass = (panelInstance as object).constructor as typeof BaseConfigPanel;\n console.log('[EditPartDialog] Component class:', componentClass.name);\n\n // Clear the container and create the component\n this.ConfigPanelContainer.clear();\n this.configPanelRef = this.ConfigPanelContainer.createComponent(componentClass as never);\n console.log('[EditPartDialog] Component created successfully');\n\n // Set inputs on the component\n const panel = this.configPanelRef.instance;\n panel.partType = this.PartType;\n panel.panel = this.Panel;\n panel.config = this.Config;\n\n // Subscribe to config changes\n panel.configChanged.subscribe((result: ConfigPanelResult) => {\n this.OnConfigChanged(result);\n });\n\n this.IsLoading = false;\n this.LoadError = null; // Ensure error is cleared on success\n this.cdr.detectChanges();\n\n } catch (error) {\n this.LoadError = `Failed to load config panel: ${error instanceof Error ? error.message : String(error)}`;\n console.error('[EditPartDialog]', this.LoadError, error);\n this.IsLoading = false;\n this.IsValid = true; // Allow saving with default config\n this.cdr.detectChanges();\n }\n }\n\n /**\n * Destroy the dynamically created config panel\n */\n private destroyConfigPanel(): void {\n if (this.configPanelRef) {\n this.configPanelRef.destroy();\n this.configPanelRef = null;\n }\n }\n\n /**\n * Handle configuration changes from the embedded panel\n */\n public OnConfigChanged(result: ConfigPanelResult): void {\n this.latestResult = result;\n this.IsValid = result.isValid;\n this.cdr.detectChanges();\n }\n\n /** @deprecated Use {@link OnConfigChanged}. */\n public onConfigChanged(result: ConfigPanelResult): void {\n return this.OnConfigChanged(result);\n }\n\n /**\n * Get the dialog title based on part type\n */\n public GetDialogTitle(): string {\n const partName = this.PartType?.Name || 'Part';\n return this.Panel ? `Configure ${partName}` : `Add ${partName}`;\n }\n\n /** @deprecated Use {@link GetDialogTitle}. */\n public getDialogTitle(): string {\n return this.GetDialogTitle();\n }\n\n /**\n * Get the part type icon\n */\n public getIcon(): string {\n return this.PartType?.Icon || 'fa-solid fa-puzzle-piece';\n }\n\n /**\n * Save the configuration\n */\n public save(): void {\n if (!this.IsValid || !this.latestResult) {\n return;\n }\n\n this.Saved.emit({\n Config: this.latestResult.config,\n Title: this.latestResult.title,\n Icon: this.latestResult.icon\n });\n }\n\n /**\n * Cancel and close the dialog\n */\n public cancel(): void {\n this.Cancelled.emit();\n }\n\n /**\n * Get save button text\n */\n public GetSaveButtonText(): string {\n return this.Panel ? 'Save Changes' : 'Add Part';\n }\n\n /** @deprecated Use {@link GetSaveButtonText}. */\n public getSaveButtonText(): string {\n return this.GetSaveButtonText();\n }\n}\n","<!-- Generic Edit Part Dialog -->\n@if (Visible) {\n <div class=\"edit-part-dialog-overlay\" (click)=\"cancel()\">\n <div class=\"edit-part-dialog\" (click)=\"$event.stopPropagation()\">\n <!-- Header -->\n <div class=\"dialog-header\">\n <div class=\"header-icon\">\n <i [class]=\"getIcon()\"></i>\n </div>\n <h3>{{ getDialogTitle() }}</h3>\n <button class=\"close-button\" (click)=\"cancel()\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n <!-- Content -->\n <div class=\"dialog-content\">\n <!-- Loading state -->\n @if (IsLoading) {\n <div class=\"loading-state\">\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n <span>Loading configuration panel...</span>\n </div>\n }\n <!-- Error state -->\n @if (LoadError && !IsLoading) {\n <div class=\"error-state\">\n <i class=\"fa-solid fa-exclamation-triangle\"></i>\n <span>{{ LoadError }}</span>\n </div>\n }\n <!-- Dynamic config panel container -->\n <ng-container #configPanelContainer></ng-container>\n </div>\n <!-- Footer -->\n <div class=\"dialog-footer\">\n <button\n class=\"btn-primary\"\n (click)=\"save()\"\n [disabled]=\"!IsValid || IsLoading || LoadError\">\n <i class=\"fa-solid fa-check\"></i>\n {{ getSaveButtonText() }}\n </button>\n <button class=\"btn-secondary\" (click)=\"cancel()\">\n Cancel\n </button>\n </div>\n </div>\n </div>\n}\n"]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { EventEmitter, OnDestroy } from '@angular/core';
|
|
2
|
+
import { MJDashboardPartTypeEntity } from '@memberjunction/core-entities';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
4
|
+
import { PanelConfig, DashboardPanel } from '../../models/dashboard-types';
|
|
5
|
+
import { ConfigPanelResult } from '../../config-panels/base-config-panel';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/** Whether the part dialog adds a new part or edits an existing one. */
|
|
8
|
+
export type DashboardPartDialogMode = 'add' | 'edit';
|
|
9
|
+
/** What the part dialog gives back on Add part or Apply. */
|
|
10
|
+
export interface DashboardPartDialogResult {
|
|
11
|
+
PartType: MJDashboardPartTypeEntity;
|
|
12
|
+
Config: PanelConfig;
|
|
13
|
+
Title: string;
|
|
14
|
+
Icon?: string;
|
|
15
|
+
}
|
|
16
|
+
/** The refresh intervals a query part offers, in seconds; the dashboard assistant accepts the same ones. */
|
|
17
|
+
export declare const QUERY_REFRESH_SECONDS: readonly [30, 60, 300, 600];
|
|
18
|
+
/**
|
|
19
|
+
* The dialog that adds a part to a dashboard or edits one, on `mj-dialog`.
|
|
20
|
+
*
|
|
21
|
+
* It shows the part type tiles, the part type's settings panel as the Source section, the title
|
|
22
|
+
* and, for a query, the parameter-controls and auto refresh options. The settings panel is the
|
|
23
|
+
* `BaseConfigPanel` that ClassFactory registers under the part type's `ConfigDialogClass`; the
|
|
24
|
+
* dialog passes it `Provider` and hides the panel's own copies of the fields it shows itself.
|
|
25
|
+
* In edit mode the part's type cannot change, so the other tiles are disabled.
|
|
26
|
+
*
|
|
27
|
+
* The host opens and closes it, for example with `@if` around `[Visible]="true"`.
|
|
28
|
+
*/
|
|
29
|
+
export declare class DashboardPartDialogComponent extends BaseAngularComponent implements OnDestroy {
|
|
30
|
+
private readonly cdr;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the dialog shows. Opening reads Mode, Panel and PartTypes after the current input
|
|
33
|
+
* pass, because inputs arrive in no fixed order. Closing removes the settings panel.
|
|
34
|
+
*/
|
|
35
|
+
set Visible(value: boolean);
|
|
36
|
+
get Visible(): boolean;
|
|
37
|
+
private _visible;
|
|
38
|
+
/** Whether the dialog adds a new part or edits {@link Panel}. */
|
|
39
|
+
Mode: DashboardPartDialogMode;
|
|
40
|
+
/** The part types to offer. The tiles show the active ones, and the edited part's type, by SortOrder. */
|
|
41
|
+
PartTypes: MJDashboardPartTypeEntity[];
|
|
42
|
+
/** The part to edit in edit mode. Its part type is the one in {@link PartTypes} with its `partTypeId`. */
|
|
43
|
+
Panel: DashboardPanel | null;
|
|
44
|
+
/** Emitted on Add part or Apply with the part type, config, title and icon of the part. */
|
|
45
|
+
Saved: EventEmitter<DashboardPartDialogResult>;
|
|
46
|
+
/** Emitted on Cancel, and when the user closes the dialog with Escape, the backdrop or the close button. */
|
|
47
|
+
Cancelled: EventEmitter<void>;
|
|
48
|
+
/** Where the settings panel of the chosen part type renders. */
|
|
49
|
+
private configPanelContainer?;
|
|
50
|
+
/** The chosen part type. */
|
|
51
|
+
SelectedPartType: MJDashboardPartTypeEntity | null;
|
|
52
|
+
/** The part's title: empty for a new part, the part's title in edit mode. An empty title means the source name. */
|
|
53
|
+
Title: string;
|
|
54
|
+
/** The name of the chosen source, from the settings panel. A part type without one shows its tile label. */
|
|
55
|
+
SourceName: string;
|
|
56
|
+
/** Query option: show the query's parameter controls on the part. */
|
|
57
|
+
ShowParameterControls: boolean;
|
|
58
|
+
/** Query option: refresh the part on a timer. */
|
|
59
|
+
AutoRefreshEnabled: boolean;
|
|
60
|
+
/** Query option: the refresh interval, in seconds. */
|
|
61
|
+
AutoRefreshSeconds: number;
|
|
62
|
+
/** True while the settings panel of the chosen part type loads. */
|
|
63
|
+
IsLoadingPanel: boolean;
|
|
64
|
+
/** Why the settings panel could not load, when it could not. */
|
|
65
|
+
LoadError: string | null;
|
|
66
|
+
/** The settings panel's validation errors from the last Add part or Apply. */
|
|
67
|
+
Errors: string[];
|
|
68
|
+
private configPanelRef;
|
|
69
|
+
private configChangedSubscription;
|
|
70
|
+
/** The last result the settings panel reported. */
|
|
71
|
+
private latestResult;
|
|
72
|
+
private refreshChoices;
|
|
73
|
+
/** Counts opens, so an open that a close or a newer open overtook does nothing. */
|
|
74
|
+
private openCount;
|
|
75
|
+
/** Counts settings panel loads, so a load for a part type the user has left is dropped. */
|
|
76
|
+
private loadCount;
|
|
77
|
+
private destroyed;
|
|
78
|
+
/** The dialog title. */
|
|
79
|
+
get DialogTitle(): string;
|
|
80
|
+
/** The label of the confirm button. */
|
|
81
|
+
get SubmitLabel(): string;
|
|
82
|
+
/** The icon of the confirm button. */
|
|
83
|
+
get SubmitIcon(): string;
|
|
84
|
+
/** The placeholder of the title field: the title the part gets when the field is empty. */
|
|
85
|
+
get TitlePlaceholder(): string;
|
|
86
|
+
/** Whether the chosen part type is Query, which has the query options. */
|
|
87
|
+
get IsQuery(): boolean;
|
|
88
|
+
/** Whether the chosen part type has a settings panel, which fills the Source section. */
|
|
89
|
+
get HasSettingsPanel(): boolean;
|
|
90
|
+
/** The part type tiles: the active part types, and the edited part's type, by SortOrder. */
|
|
91
|
+
get TypeTiles(): MJDashboardPartTypeEntity[];
|
|
92
|
+
/** The refresh intervals to offer: {@link QUERY_REFRESH_SECONDS}, plus the edited part's interval when it is another one. */
|
|
93
|
+
get RefreshChoices(): readonly number[];
|
|
94
|
+
/**
|
|
95
|
+
* Whether Add part or Apply is enabled. Apply is enabled as soon as the part type is shown.
|
|
96
|
+
* Add part waits until the settings panel reports a valid source.
|
|
97
|
+
*/
|
|
98
|
+
get CanSubmit(): boolean;
|
|
99
|
+
/** Whether a tile's part type is the chosen one. */
|
|
100
|
+
IsSelected(partType: MJDashboardPartTypeEntity): boolean;
|
|
101
|
+
/** The label on a part type tile. */
|
|
102
|
+
TileLabel(partType: MJDashboardPartTypeEntity): string;
|
|
103
|
+
/** The description on a part type tile. */
|
|
104
|
+
TileDescription(partType: MJDashboardPartTypeEntity): string;
|
|
105
|
+
/** Chooses a part type in add mode and loads its settings panel. */
|
|
106
|
+
SelectPartType(partType: MJDashboardPartTypeEntity): void;
|
|
107
|
+
/** Takes a change from the settings panel: its latest result and the name of its source. */
|
|
108
|
+
OnConfigChanged(result: ConfigPanelResult): void;
|
|
109
|
+
/**
|
|
110
|
+
* Emits {@link Saved}, or shows the settings panel's errors when its source is not valid.
|
|
111
|
+
* The config is the settings panel's config. Without a panel it names only the part type
|
|
112
|
+
* (add mode) or is the part's current config (edit mode). A query part also gets the query options.
|
|
113
|
+
*/
|
|
114
|
+
Submit(): void;
|
|
115
|
+
/** Emits {@link Cancelled}. */
|
|
116
|
+
Cancel(): void;
|
|
117
|
+
ngOnDestroy(): void;
|
|
118
|
+
/** Starts from the inputs: a new part with the first tile chosen, or the edited part. */
|
|
119
|
+
private open;
|
|
120
|
+
/** Removes the settings panel and drops a load that is still running. */
|
|
121
|
+
private close;
|
|
122
|
+
/** The part type of the edited part, from {@link PartTypes}. */
|
|
123
|
+
private findEditedPartType;
|
|
124
|
+
/** Reads the query options from a part's config. A new part (no config) gets the defaults. */
|
|
125
|
+
private readQueryOptions;
|
|
126
|
+
/** Makes a part type the chosen one and starts to load its settings panel. */
|
|
127
|
+
private selectType;
|
|
128
|
+
/**
|
|
129
|
+
* Creates the part type's settings panel in the Source section. A load that a newer load or a
|
|
130
|
+
* close overtook is dropped. When the panel cannot be created, the dialog says why and still
|
|
131
|
+
* submits: with a config that names only the part type (add mode) or the part's current config (edit mode).
|
|
132
|
+
*/
|
|
133
|
+
private loadConfigPanel;
|
|
134
|
+
/** Shows why the settings panel could not load, and what Add part or Apply does without it. */
|
|
135
|
+
private failPanelLoad;
|
|
136
|
+
/**
|
|
137
|
+
* Takes a new source name. A title that is the old source name follows the new one, as the
|
|
138
|
+
* settings panels' own title fields do; a title the user changed stays.
|
|
139
|
+
*/
|
|
140
|
+
private setSourceName;
|
|
141
|
+
/** The registered class name of a part type's settings panel, if it has one. */
|
|
142
|
+
private configDialogClassOf;
|
|
143
|
+
private destroyConfigPanel;
|
|
144
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DashboardPartDialogComponent, never>;
|
|
145
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DashboardPartDialogComponent, "mj-dashboard-part-dialog", never, { "Visible": { "alias": "Visible"; "required": false; }; "Mode": { "alias": "Mode"; "required": false; }; "PartTypes": { "alias": "PartTypes"; "required": false; }; "Panel": { "alias": "Panel"; "required": false; }; }, { "Saved": "Saved"; "Cancelled": "Cancelled"; }, never, never, false, never>;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=dashboard-part-dialog.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-part-dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/dialogs/part-dialog/dashboard-part-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EAKZ,SAAS,EAEZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAmB,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;;AAE3F,wEAAwE;AACxE,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,MAAM,CAAC;AAErD,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACtC,QAAQ,EAAE,yBAAyB,CAAC;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,4GAA4G;AAC5G,eAAO,MAAM,qBAAqB,6BAA8B,CAAC;AAsBjE;;;;;;;;;;GAUG;AACH,qBAMa,4BAA6B,SAAQ,oBAAqB,YAAW,SAAS;IACvF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IAEjD;;;OAGG;I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