@memberjunction/ng-dashboard-viewer 6.2.0-edge.5 → 6.2.0-edge.6
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 +17 -3
- package/dist/lib/config-panels/artifact-config-panel.component.js +2 -2
- package/dist/lib/config-panels/component-config-panel.component.d.ts +51 -0
- package/dist/lib/config-panels/component-config-panel.component.d.ts.map +1 -0
- package/dist/lib/config-panels/component-config-panel.component.js +246 -0
- package/dist/lib/config-panels/component-config-panel.component.js.map +1 -0
- package/dist/lib/config-panels/index.d.ts +1 -0
- package/dist/lib/config-panels/index.d.ts.map +1 -1
- package/dist/lib/config-panels/index.js +1 -0
- package/dist/lib/config-panels/index.js.map +1 -1
- package/dist/lib/config-panels/query-config-panel.component.js +2 -2
- package/dist/lib/config-panels/view-config-panel.component.js +2 -2
- package/dist/lib/config-panels/weburl-config-panel.component.js +2 -2
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.d.ts +58 -1
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.d.ts.map +1 -1
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.js +186 -4
- package/dist/lib/dashboard-viewer/dashboard-viewer.component.js.map +1 -1
- package/dist/lib/dashboard-viewer.module.d.ts +22 -17
- package/dist/lib/dashboard-viewer.module.d.ts.map +1 -1
- package/dist/lib/dashboard-viewer.module.js +29 -4
- package/dist/lib/dashboard-viewer.module.js.map +1 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.d.ts +35 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.d.ts.map +1 -1
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.js +307 -34
- package/dist/lib/dialogs/part-dialog/dashboard-part-dialog.component.js.map +1 -1
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.d.ts +79 -0
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.d.ts.map +1 -0
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.js +461 -0
- package/dist/lib/dialogs/properties-dialog/dashboard-properties-dialog.component.js.map +1 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.d.ts +41 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.d.ts.map +1 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.js +248 -0
- package/dist/lib/dialogs/property-default-editor/property-default-editor.component.js.map +1 -0
- package/dist/lib/models/dashboard-config-validator.d.ts +30 -0
- package/dist/lib/models/dashboard-config-validator.d.ts.map +1 -0
- package/dist/lib/models/dashboard-config-validator.js +107 -0
- package/dist/lib/models/dashboard-config-validator.js.map +1 -0
- package/dist/lib/models/dashboard-part-interfaces.d.ts +42 -0
- package/dist/lib/models/dashboard-part-interfaces.d.ts.map +1 -0
- package/dist/lib/models/dashboard-part-interfaces.js +180 -0
- package/dist/lib/models/dashboard-part-interfaces.js.map +1 -0
- package/dist/lib/models/dashboard-properties.d.ts +182 -0
- package/dist/lib/models/dashboard-properties.d.ts.map +1 -0
- package/dist/lib/models/dashboard-properties.js +263 -0
- package/dist/lib/models/dashboard-properties.js.map +1 -0
- package/dist/lib/models/dashboard-types.d.ts +8 -0
- package/dist/lib/models/dashboard-types.d.ts.map +1 -1
- package/dist/lib/models/dashboard-types.js.map +1 -1
- package/dist/lib/models/part-inputs-editor.d.ts +36 -0
- package/dist/lib/models/part-inputs-editor.d.ts.map +1 -0
- package/dist/lib/models/part-inputs-editor.js +53 -0
- package/dist/lib/models/part-inputs-editor.js.map +1 -0
- package/dist/lib/parts/artifact-part.component.d.ts.map +1 -1
- package/dist/lib/parts/artifact-part.component.js +5 -4
- package/dist/lib/parts/artifact-part.component.js.map +1 -1
- package/dist/lib/parts/base-dashboard-part.d.ts +50 -1
- package/dist/lib/parts/base-dashboard-part.d.ts.map +1 -1
- package/dist/lib/parts/base-dashboard-part.js +108 -1
- package/dist/lib/parts/base-dashboard-part.js.map +1 -1
- package/dist/lib/parts/component-part.component.d.ts +54 -0
- package/dist/lib/parts/component-part.component.d.ts.map +1 -0
- package/dist/lib/parts/component-part.component.js +221 -0
- package/dist/lib/parts/component-part.component.js.map +1 -0
- package/dist/lib/parts/index.d.ts +1 -0
- package/dist/lib/parts/index.d.ts.map +1 -1
- package/dist/lib/parts/index.js +1 -0
- package/dist/lib/parts/index.js.map +1 -1
- package/dist/lib/parts/query-part.component.d.ts +25 -1
- package/dist/lib/parts/query-part.component.d.ts.map +1 -1
- package/dist/lib/parts/query-part.component.js +93 -10
- package/dist/lib/parts/query-part.component.js.map +1 -1
- package/dist/lib/parts/view-part.component.d.ts +18 -1
- package/dist/lib/parts/view-part.component.d.ts.map +1 -1
- package/dist/lib/parts/view-part.component.js +74 -10
- package/dist/lib/parts/view-part.component.js.map +1 -1
- package/dist/lib/parts/weburl-part.component.d.ts +8 -0
- package/dist/lib/parts/weburl-part.component.d.ts.map +1 -1
- package/dist/lib/parts/weburl-part.component.js +29 -2
- package/dist/lib/parts/weburl-part.component.js.map +1 -1
- package/dist/public-api.d.ts +8 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +8 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +15 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-part.component.js","sourceRoot":"","sources":["../../../src/lib/parts/query-part.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAqB,SAAS,EAA4B,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;;;;;;;IAiB9C,8BAA2B;IACzB,gCAAiD;IACnD,iBAAM;;;IAKN,oCAMmB;;;IADjB,6CAAwB;;;IAM1B,oCAKmB;;;;IAMjB,AADF,8BAA2B,4BASa;IAApC,AADA,yNAAmB,gCAAyB,KAAC,kMAC/B,2BAAoB,KAAC;IAEvC,AADE,iBA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CAAC,iBAAiB,EAAE,oBAAoB,CAAC;GA8F1C,kBAAkB,CA6K9B;;iFA7KY,kBAAkB;cA7F9B,SAAS;6BACI,KAAK,YACL,eAAe,YACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA8CL;;kBA6CJ,SAAS;mBAAC,aAAa;;kFADf,kBAAkB","sourcesContent":["import { Component, ChangeDetectorRef, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';\nimport { RegisterClass } from '@memberjunction/global';\nimport { BaseDashboardPart } from './base-dashboard-part';\nimport { PanelConfig } from '../models/dashboard-types';\nimport { MJQueryEntity } from '@memberjunction/core-entities';\nimport { QueryViewerComponent, QueryEntityLinkClickEvent } from '@memberjunction/ng-query-viewer';\n\n/**\n * Runtime renderer for Query dashboard parts.\n * Displays query results using mj-query-viewer with parameter controls and auto-refresh support.\n */\n@RegisterClass(BaseDashboardPart, 'QueryPanelRenderer')\n@Component({\n standalone: false,\n selector: 'mj-query-part',\n template: `\n <div class=\"query-part\" [class.loading]=\"IsLoading\" [class.error]=\"ErrorMessage\">\n <!-- Loading state -->\n @if (IsLoading) {\n <div class=\"loading-state\">\n <mj-loading text=\"Loading query...\"></mj-loading>\n </div>\n }\n \n <!-- Error state -->\n @if (ErrorMessage && !IsLoading) {\n <mj-empty-state\n class=\"part-placeholder\"\n Variant=\"error\"\n Icon=\"fa-solid fa-triangle-exclamation\"\n Title=\"Couldn't load query\"\n [Message]=\"ErrorMessage\"\n Size=\"compact\" />\n }\n\n <!-- No query configured -->\n @if (!IsLoading && !ErrorMessage && !hasQuery) {\n <mj-empty-state\n class=\"part-placeholder\"\n Icon=\"fa-solid fa-flask\"\n Title=\"No Query Selected\"\n Message=\"Use Edit part to choose a query.\"\n Size=\"compact\" />\n }\n \n <!-- Query Viewer -->\n @if (!IsLoading && !ErrorMessage && hasQuery && queryId) {\n <div class=\"query-content\">\n <mj-query-viewer\n #queryViewer\n [QueryId]=\"queryId\"\n [AutoRun]=\"true\"\n [ShowToolbar]=\"showToolbar\"\n [PersistState]=\"true\"\n [PersistParameters]=\"true\"\n (EntityLinkClick)=\"onEntityLinkClick($event)\"\n (QueryError)=\"onQueryError($event)\">\n </mj-query-viewer>\n </div>\n }\n </div>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .query-part {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder {\n height: 100%;\n }\n\n .query-content {\n flex: 1;\n min-height: 0;\n overflow: hidden;\n }\n\n mj-query-viewer {\n display: block;\n width: 100%;\n height: 100%;\n }\n `]\n})\nexport class QueryPartComponent extends BaseDashboardPart implements AfterViewInit, OnDestroy {\n @ViewChild('queryViewer') QueryViewer!: QueryViewerComponent;\n\n /** @deprecated Use {@link QueryViewer}. */\n get queryViewer(): QueryViewerComponent {\n return this.QueryViewer;\n }\n /** @deprecated Use {@link QueryViewer}. */\n set queryViewer(value: QueryViewerComponent) {\n this.QueryViewer = value;\n }\n\n public HasQuery = false;\n\n /** @deprecated Use {@link HasQuery}. */\n public get hasQuery() {\n return this.HasQuery;\n }\n /** @deprecated Use {@link HasQuery}. */\n public set hasQuery(value) {\n this.HasQuery = value;\n }\n public QueryId: string | null = null;\n\n /** @deprecated Use {@link QueryId}. */\n public get queryId(): string | null {\n return this.QueryId;\n }\n /** @deprecated Use {@link QueryId}. */\n public set queryId(value: string | null) {\n this.QueryId = value;\n }\n public ShowToolbar = true;\n\n /** @deprecated Use {@link ShowToolbar}. */\n public get showToolbar() {\n return this.ShowToolbar;\n }\n /** @deprecated Use {@link ShowToolbar}. */\n public set showToolbar(value) {\n this.ShowToolbar = value;\n }\n\n private queryEntity: MJQueryEntity | null = null;\n private autoRefreshTimer: ReturnType<typeof setInterval> | null = null;\n\n constructor(cdr: ChangeDetectorRef) {\n super(cdr);\n }\n\n ngAfterViewInit(): void {\n if (this.Panel) {\n this.loadContent();\n }\n }\n\n public async loadContent(): Promise<void> {\n const config = this.getConfig<PanelConfig>();\n const queryId = config?.['queryId'] as string | undefined;\n const queryName = config?.['queryName'] as string | undefined;\n\n if (!queryId && !queryName) {\n this.HasQuery = false;\n this.cdr.detectChanges();\n return;\n }\n\n this.setLoading(true);\n this.stopAutoRefresh();\n\n try {\n const p = this.ProviderToUse;\n\n if (queryId) {\n // Load query by ID to verify it exists\n this.queryEntity = await p.GetEntityObject<MJQueryEntity>('MJ: Queries', p.CurrentUser);\n const loaded = await this.queryEntity.Load(queryId);\n\n if (!loaded) {\n throw new Error('Query not found');\n }\n\n this.QueryId = queryId;\n } else if (queryName) {\n // Query by name - find the query ID from metadata\n const queryInfo = p.Queries.find(q => q.Name === queryName);\n if (queryInfo) {\n this.QueryId = queryInfo.ID;\n } else {\n throw new Error(`Query \"${queryName}\" not found`);\n }\n }\n\n this.HasQuery = true;\n this.ShowToolbar = (config?.['showParameterControls'] as boolean) !== false;\n\n // Set auto-refresh if configured\n const autoRefreshSeconds = (config?.['autoRefreshSeconds'] as number) || 0;\n if (autoRefreshSeconds > 0) {\n this.startAutoRefresh(autoRefreshSeconds);\n }\n\n this.setLoading(false);\n } catch (error) {\n this.setError(error instanceof Error ? error.message : 'Failed to load query');\n }\n }\n\n public OnEntityLinkClick(event: QueryEntityLinkClickEvent): void {\n // Emit data change event with clicked entity info (for any listeners that need it)\n this.emitDataChanged({\n type: 'entity-link-click',\n entityName: event.entityName,\n recordId: event.recordId\n });\n\n // Request navigation to open the record\n if (event.entityName && event.recordId) {\n this.RequestOpenEntityRecord(\n event.entityName,\n event.recordId,\n 'view',\n false\n );\n }\n }\n\n /** @deprecated Use {@link OnEntityLinkClick}. */\n public onEntityLinkClick(event: QueryEntityLinkClickEvent): void {\n return this.OnEntityLinkClick(event);\n }\n\n public OnQueryError(error: Error): void {\n console.error('[QueryPart] Query error:', error.message);\n }\n\n /** @deprecated Use {@link OnQueryError}. */\n public onQueryError(error: Error): void {\n return this.OnQueryError(error);\n }\n\n public RefreshQuery(): void {\n if (this.QueryViewer) {\n this.QueryViewer.Refresh();\n }\n }\n\n /** @deprecated Use {@link RefreshQuery}. */\n public refreshQuery(): void {\n return this.RefreshQuery();\n }\n\n private startAutoRefresh(seconds: number): void {\n this.stopAutoRefresh();\n if (seconds > 0) {\n this.autoRefreshTimer = setInterval(() => {\n this.RefreshQuery();\n }, seconds * 1000);\n }\n }\n\n private stopAutoRefresh(): void {\n if (this.autoRefreshTimer) {\n clearInterval(this.autoRefreshTimer);\n this.autoRefreshTimer = null;\n }\n }\n\n protected override cleanup(): void {\n this.stopAutoRefresh();\n this.queryEntity = null;\n this.QueryId = null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"query-part.component.js","sourceRoot":"","sources":["../../../src/lib/parts/query-part.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAqB,SAAS,EAA4B,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,EAAE,uBAAuB,EAAuB,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAClH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;;;;;;;IAc5D,8BAA2B;IACzB,gCAAiD;IACnD,iBAAM;;;IAKN,oCAMmB;;;IADjB,6CAAwB;;;IAM1B,oCAKmB;;;;IAKjB,AADF,8BAAgC,gBACgD;IAA3B,sLAAS,uBAAgB,KAAC;IAC3E,uBAAoD;IAAC,iCACvD;IACF,AADE,iBAAS,EACL;;;;IAMJ,AADF,8BAA2B,6BAYa;IAApC,AADA,AADA,yNAAmB,gCAAyB,KAAC,4MAC1B,gCAAyB,KAAC,kMAC/B,2BAAoB,KAAC;IAEvC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C,gBAAgB,GAAG,WAAW,CAAC,GAAG,EAAE;gBACrC,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAEO,eAAe;QACnB,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACrC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACjC,CAAC;IACL,CAAC;IAEkB,OAAO;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;4GA5OQ,kBAAkB;6DAAlB,kBAAkB;;;;;;YA7HvB,8BAAiF;YAE/E,oFAAiB;YAOjB,+FAAkC;YAWlC,+FAAgD;YAShD,oFAAyD;YASzD,oFAA0D;YAiB5D,iBAAM;;YAvD8C,AAA5B,wCAA2B,2BAA6B;YAE9E,cAIC;YAJD,wCAIC;YAGD,cAQC;YARD,6DAQC;YAGD,cAOC;YAPD,+EAOC;YAED,cAMC;YAND,wFAMC;YAGD,cAgBC;YAhBD,6FAgBC;;;AAuEE,kBAAkB;IAlI9B,aAAa,CAAC,iBAAiB,EAAE,oBAAoB,CAAC;GAkI1C,kBAAkB,CA6O9B;;iFA7OY,kBAAkB;cAjI9B,SAAS;6BACI,KAAK,YACL,eAAe,YACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAyDL;;kBAsEJ,SAAS;mBAAC,aAAa;;kFADf,kBAAkB","sourcesContent":["import { Component, ChangeDetectorRef, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';\nimport { RegisterClass } from '@memberjunction/global';\nimport { BaseDashboardPart } from './base-dashboard-part';\nimport { PanelConfig } from '../models/dashboard-types';\nimport { MJQueryEntity } from '@memberjunction/core-entities';\nimport { QueryViewerComponent, QueryEntityLinkClickEvent, QueryParameterValues, QuerySelectionChangedEvent } from '@memberjunction/ng-query-viewer';\nimport { PartInputProblemMessage, PartInputResolution, ROW_SELECTED_EVENT } from '../models/dashboard-properties';\nimport { LoadPartInterface } from '../models/dashboard-part-interfaces';\n\n/**\n * Runtime renderer for Query dashboard parts.\n * Displays query results using mj-query-viewer with parameter controls and auto-refresh support.\n */\n@RegisterClass(BaseDashboardPart, 'QueryPanelRenderer')\n@Component({\n standalone: false,\n selector: 'mj-query-part',\n template: `\n <div class=\"query-part\" [class.loading]=\"IsLoading\" [class.error]=\"ErrorMessage\">\n <!-- Loading state -->\n @if (IsLoading) {\n <div class=\"loading-state\">\n <mj-loading text=\"Loading query...\"></mj-loading>\n </div>\n }\n \n <!-- Error state -->\n @if (ErrorMessage && !IsLoading) {\n <mj-empty-state\n class=\"part-placeholder\"\n Variant=\"error\"\n Icon=\"fa-solid fa-triangle-exclamation\"\n Title=\"Couldn't load query\"\n [Message]=\"ErrorMessage\"\n Size=\"compact\" />\n }\n\n <!-- No query configured -->\n @if (!IsLoading && !ErrorMessage && !hasQuery) {\n <mj-empty-state\n class=\"part-placeholder\"\n Icon=\"fa-solid fa-flask\"\n Title=\"No Query Selected\"\n Message=\"Use Edit part to choose a query.\"\n Size=\"compact\" />\n }\n \n @if (HasActiveSelection && !IsLoading && !ErrorMessage) {\n <div class=\"part-selection-bar\">\n <button type=\"button\" class=\"part-clear-selection\" (click)=\"ClearSelection()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i> Clear selection\n </button>\n </div>\n }\n\n <!-- Query Viewer -->\n @if (!IsLoading && !ErrorMessage && hasQuery && queryId) {\n <div class=\"query-content\">\n <mj-query-viewer\n #queryViewer\n [Provider]=\"Provider\"\n [QueryId]=\"queryId\"\n [AutoRun]=\"true\"\n [ShowToolbar]=\"showToolbar\"\n [PersistState]=\"true\"\n [PersistParameters]=\"true\"\n [MappedParameters]=\"MappedParameters\"\n (EntityLinkClick)=\"onEntityLinkClick($event)\"\n (SelectionChange)=\"OnSelectionChange($event)\"\n (QueryError)=\"onQueryError($event)\">\n </mj-query-viewer>\n </div>\n }\n </div>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .query-part {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder {\n height: 100%;\n }\n\n .query-content {\n flex: 1;\n min-height: 0;\n overflow: hidden;\n }\n\n mj-query-viewer {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .part-selection-bar {\n display: flex;\n justify-content: flex-end;\n padding: 4px 8px;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n\n .part-clear-selection {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 2px 10px;\n border: 1px solid var(--mj-border-default);\n border-radius: 12px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n font-size: 12px;\n cursor: pointer;\n }\n\n .part-clear-selection:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n `]\n})\nexport class QueryPartComponent extends BaseDashboardPart implements AfterViewInit, OnDestroy {\n @ViewChild('queryViewer') QueryViewer!: QueryViewerComponent;\n\n /** @deprecated Use {@link QueryViewer}. */\n get queryViewer(): QueryViewerComponent {\n return this.QueryViewer;\n }\n /** @deprecated Use {@link QueryViewer}. */\n set queryViewer(value: QueryViewerComponent) {\n this.QueryViewer = value;\n }\n\n public HasQuery = false;\n\n /** @deprecated Use {@link HasQuery}. */\n public get hasQuery() {\n return this.HasQuery;\n }\n /** @deprecated Use {@link HasQuery}. */\n public set hasQuery(value) {\n this.HasQuery = value;\n }\n public QueryId: string | null = null;\n\n /** @deprecated Use {@link QueryId}. */\n public get queryId(): string | null {\n return this.QueryId;\n }\n /** @deprecated Use {@link QueryId}. */\n public set queryId(value: string | null) {\n this.QueryId = value;\n }\n public ShowToolbar = true;\n\n /** @deprecated Use {@link ShowToolbar}. */\n public get showToolbar() {\n return this.ShowToolbar;\n }\n /** @deprecated Use {@link ShowToolbar}. */\n public set showToolbar(value) {\n this.ShowToolbar = value;\n }\n\n /**\n * Parameter values from the part's input mappings. They override the user's saved values, are\n * never saved back into them, and show read-only. Null when the part has no mappings.\n */\n public MappedParameters: QueryParameterValues | null = null;\n\n /** True while the part shows a problem with its mappings rather than a load error. */\n private showingInputProblem = false;\n\n private queryEntity: MJQueryEntity | null = null;\n private autoRefreshTimer: ReturnType<typeof setInterval> | null = null;\n\n constructor(cdr: ChangeDetectorRef) {\n super(cdr);\n }\n\n ngAfterViewInit(): void {\n if (this.Panel) {\n this.loadContent();\n }\n }\n\n public async loadContent(): Promise<void> {\n const config = this.getConfig<PanelConfig>();\n const queryId = config?.['queryId'] as string | undefined;\n const queryName = config?.['queryName'] as string | undefined;\n\n if (!queryId && !queryName) {\n this.HasQuery = false;\n this.cdr.detectChanges();\n return;\n }\n\n this.setLoading(true);\n this.stopAutoRefresh();\n\n try {\n const p = this.ProviderToUse;\n\n if (queryId) {\n // Load query by ID to verify it exists\n this.queryEntity = await p.GetEntityObject<MJQueryEntity>('MJ: Queries', p.CurrentUser);\n const loaded = await this.queryEntity.Load(queryId);\n\n if (!loaded) {\n throw new Error('Query not found');\n }\n\n this.QueryId = queryId;\n } else if (queryName) {\n // Query by name - find the query ID from metadata\n const queryInfo = p.Queries.find(q => q.Name === queryName);\n if (queryInfo) {\n this.QueryId = queryInfo.ID;\n } else {\n throw new Error(`Query \"${queryName}\" not found`);\n }\n }\n\n if (!(await this.applyQueryInputs(config))) return;\n this.HasQuery = true;\n this.ShowToolbar = (config?.['showParameterControls'] as boolean) !== false;\n\n // Set auto-refresh if configured\n const autoRefreshSeconds = (config?.['autoRefreshSeconds'] as number) || 0;\n if (autoRefreshSeconds > 0) {\n this.startAutoRefresh(autoRefreshSeconds);\n }\n\n this.setLoading(false);\n } catch (error) {\n this.showingInputProblem = false;\n this.setError(error instanceof Error ? error.message : 'Failed to load query');\n }\n }\n\n /**\n * Works out the mapped parameter values. A part without mappings loads nothing more and runs as\n * before. Returns false, showing why, when a mapping is broken or a mapped input has no value.\n */\n private async applyQueryInputs(config: PanelConfig | null): Promise<boolean> {\n if (this.InputMappings.length === 0) {\n this.MappedParameters = null;\n return true;\n }\n const partInterface = await LoadPartInterface(config, this.ProviderToUse);\n return this.showInputs(this.UpdateInputs(partInterface.Inputs));\n }\n\n /** Shows the inputs' problem, or takes their values. Returns false when the part stops. */\n private showInputs(resolution: PartInputResolution | null): boolean {\n const problem = PartInputProblemMessage(resolution);\n this.showingInputProblem = problem !== null;\n if (problem) {\n this.setError(problem);\n return false;\n }\n this.MappedParameters = resolution ? this.mappedValues(resolution) : null;\n return true;\n }\n\n /**\n * Every mapped parameter with its value, or null when nothing set it, so the query viewer never\n * falls back to the user's saved value for a parameter the dashboard drives.\n */\n private mappedValues(resolution: PartInputResolution): QueryParameterValues {\n const values: QueryParameterValues = {};\n for (const mapping of this.InputMappings) {\n values[mapping.Input] = resolution.Values[mapping.Input] ?? null;\n }\n return values;\n }\n\n /** New input values: the query viewer reruns the query with them. */\n protected override ApplyInputs(resolution: PartInputResolution | null): void {\n if (this.ErrorMessage && !this.showingInputProblem) return; // a load error stays until the next load\n if (this.showInputs(resolution)) {\n this.ErrorMessage = null;\n this.HasQuery = !!this.QueryId;\n this.cdr.detectChanges();\n }\n }\n\n /** RowSelected: the selected row's columns; an empty selection clears it. */\n public OnSelectionChange(event: QuerySelectionChangedEvent): void {\n const row = event?.selectedRows?.[0];\n this.EmitPartEvent(ROW_SELECTED_EVENT, row ? { ...row } : null);\n }\n\n public OnEntityLinkClick(event: QueryEntityLinkClickEvent): void {\n // Emit data change event with clicked entity info (for any listeners that need it)\n this.emitDataChanged({\n type: 'entity-link-click',\n entityName: event.entityName,\n recordId: event.recordId\n });\n\n // Request navigation to open the record\n if (event.entityName && event.recordId) {\n this.RequestOpenEntityRecord(\n event.entityName,\n event.recordId,\n 'view',\n false\n );\n }\n }\n\n /** @deprecated Use {@link OnEntityLinkClick}. */\n public onEntityLinkClick(event: QueryEntityLinkClickEvent): void {\n return this.OnEntityLinkClick(event);\n }\n\n public OnQueryError(error: Error): void {\n console.error('[QueryPart] Query error:', error.message);\n }\n\n /** @deprecated Use {@link OnQueryError}. */\n public onQueryError(error: Error): void {\n return this.OnQueryError(error);\n }\n\n public RefreshQuery(): void {\n if (this.QueryViewer) {\n this.QueryViewer.Refresh();\n }\n }\n\n /** @deprecated Use {@link RefreshQuery}. */\n public refreshQuery(): void {\n return this.RefreshQuery();\n }\n\n private startAutoRefresh(seconds: number): void {\n this.stopAutoRefresh();\n if (seconds > 0) {\n this.autoRefreshTimer = setInterval(() => {\n this.RefreshQuery();\n }, seconds * 1000);\n }\n }\n\n private stopAutoRefresh(): void {\n if (this.autoRefreshTimer) {\n clearInterval(this.autoRefreshTimer);\n this.autoRefreshTimer = null;\n }\n }\n\n protected override cleanup(): void {\n this.stopAutoRefresh();\n this.queryEntity = null;\n this.QueryId = null;\n }\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ChangeDetectorRef, AfterViewInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { BaseDashboardPart } from './base-dashboard-part';
|
|
3
|
-
import { EntityInfo } from '@memberjunction/core';
|
|
3
|
+
import { EntityInfo, PropertyValue } from '@memberjunction/core';
|
|
4
4
|
import { MJUserViewEntityExtended } from '@memberjunction/core-entities';
|
|
5
5
|
import { RecordSelectedEvent, RecordOpenedEvent, ViewRelatedRecordNavigation } from '@memberjunction/ng-entity-viewer';
|
|
6
|
+
import { PartInputResolution } from '../models/dashboard-properties';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
/**
|
|
8
9
|
* Runtime renderer for View dashboard parts.
|
|
@@ -24,9 +25,25 @@ export declare class ViewPartComponent extends BaseDashboardPart implements Afte
|
|
|
24
25
|
get entityInfo(): EntityInfo | null;
|
|
25
26
|
/** @deprecated Use {@link EntityInfo}. */
|
|
26
27
|
set entityInfo(value: EntityInfo | null);
|
|
28
|
+
/**
|
|
29
|
+
* Values for the view's properties from the part's input mappings, passed to the entity viewer's
|
|
30
|
+
* `Properties`. Null when the part has no mappings: the view runs exactly as before.
|
|
31
|
+
*/
|
|
32
|
+
ViewPropertyValues: Record<string, PropertyValue> | null;
|
|
33
|
+
/** True while the part shows a problem with its mappings rather than a load error. */
|
|
34
|
+
private showingInputProblem;
|
|
27
35
|
constructor(cdr: ChangeDetectorRef);
|
|
28
36
|
ngAfterViewInit(): void;
|
|
29
37
|
loadContent(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Works out the view's property values from the part's mappings. Returns false, showing why, when a
|
|
40
|
+
* mapping is broken (a view property renamed since) or a required input has no value.
|
|
41
|
+
*/
|
|
42
|
+
private applyViewInputs;
|
|
43
|
+
/** Shows the inputs' problem, or takes their values. Returns false when the part stops. */
|
|
44
|
+
private showInputs;
|
|
45
|
+
/** New input values: the entity viewer reruns the view with them; no reload of the view itself. */
|
|
46
|
+
protected ApplyInputs(resolution: PartInputResolution | null): void;
|
|
30
47
|
OnRecordSelected(event: RecordSelectedEvent): void;
|
|
31
48
|
/** @deprecated Use {@link OnRecordSelected}. */
|
|
32
49
|
onRecordSelected(event: RecordSelectedEvent): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-part.component.d.ts","sourceRoot":"","sources":["../../../src/lib/parts/view-part.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,iBAAiB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"view-part.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,IAAI,CAAC;IA6DzC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB,2FAA2F;IAC3F,OAAO,CAAC,UAAU;IAWlB,mGAAmG;cAChF,WAAW,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI;IASrE,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAWzD,gDAAgD;IACzC,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAIlD,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAmBrD,8CAA8C;IACvC,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAIrD;;;;;;OAMG;IACI,4BAA4B,CAAC,GAAG,EAAE,2BAA2B,GAAG,IAAI;IAW3E,4DAA4D;IACrD,4BAA4B,CAAC,GAAG,EAAE,2BAA2B,GAAG,IAAI;cAIxD,OAAO,IAAI,IAAI;yCA9MzB,iBAAiB;2CAAjB,iBAAiB;CAmN7B"}
|
|
@@ -7,13 +7,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Component } from '@angular/core';
|
|
8
8
|
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
import { BaseDashboardPart } from './base-dashboard-part';
|
|
10
|
+
import { PartInputProblemMessage, RECORD_SELECTED_EVENT } from '../models/dashboard-properties';
|
|
11
|
+
import { ViewPartInterface } from '../models/dashboard-part-interfaces';
|
|
10
12
|
import * as i0 from "@angular/core";
|
|
11
13
|
import * as i1 from "@memberjunction/ng-shared-generic";
|
|
12
14
|
import * as i2 from "@memberjunction/ng-entity-viewer";
|
|
13
15
|
import * as i3 from "@memberjunction/ng-ui-components";
|
|
14
16
|
function ViewPartComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
15
17
|
i0.ɵɵelementStart(0, "div", 1);
|
|
16
|
-
i0.ɵɵelement(1, "mj-loading",
|
|
18
|
+
i0.ɵɵelement(1, "mj-loading", 6);
|
|
17
19
|
i0.ɵɵelementEnd();
|
|
18
20
|
} }
|
|
19
21
|
function ViewPartComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
@@ -27,12 +29,20 @@ function ViewPartComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
|
27
29
|
} }
|
|
28
30
|
function ViewPartComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
29
31
|
const _r2 = i0.ɵɵgetCurrentView();
|
|
30
|
-
i0.ɵɵelementStart(0, "
|
|
31
|
-
i0.ɵɵlistener("
|
|
32
|
+
i0.ɵɵelementStart(0, "div", 4)(1, "button", 7);
|
|
33
|
+
i0.ɵɵlistener("click", function ViewPartComponent_Conditional_4_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.ClearSelection()); });
|
|
34
|
+
i0.ɵɵelement(2, "i", 8);
|
|
35
|
+
i0.ɵɵtext(3, " Clear selection ");
|
|
36
|
+
i0.ɵɵelementEnd()();
|
|
37
|
+
} }
|
|
38
|
+
function ViewPartComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
39
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
40
|
+
i0.ɵɵelementStart(0, "mj-entity-viewer", 9);
|
|
41
|
+
i0.ɵɵlistener("RecordSelected", function ViewPartComponent_Conditional_5_Template_mj_entity_viewer_RecordSelected_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onRecordSelected($event)); })("RecordOpened", function ViewPartComponent_Conditional_5_Template_mj_entity_viewer_RecordOpened_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onRecordOpened($event)); })("OpenRelatedRecordRequested", function ViewPartComponent_Conditional_5_Template_mj_entity_viewer_OpenRelatedRecordRequested_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onOpenRelatedRecordRequested($event)); });
|
|
32
42
|
i0.ɵɵelementEnd();
|
|
33
43
|
} if (rf & 2) {
|
|
34
44
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
35
|
-
i0.ɵɵproperty("Entity", ctx_r0.entityInfo)("ViewEntity", ctx_r0.viewEntity);
|
|
45
|
+
i0.ɵɵproperty("Provider", ctx_r0.Provider)("Entity", ctx_r0.entityInfo)("ViewEntity", ctx_r0.viewEntity)("Properties", ctx_r0.ViewPropertyValues);
|
|
36
46
|
} }
|
|
37
47
|
/**
|
|
38
48
|
* Runtime renderer for View dashboard parts.
|
|
@@ -66,6 +76,13 @@ let ViewPartComponent = class ViewPartComponent extends BaseDashboardPart {
|
|
|
66
76
|
set entityInfo(value) {
|
|
67
77
|
this.EntityInfo = value;
|
|
68
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Values for the view's properties from the part's input mappings, passed to the entity viewer's
|
|
81
|
+
* `Properties`. Null when the part has no mappings: the view runs exactly as before.
|
|
82
|
+
*/
|
|
83
|
+
ViewPropertyValues = null;
|
|
84
|
+
/** True while the part shows a problem with its mappings rather than a load error. */
|
|
85
|
+
showingInputProblem = false;
|
|
69
86
|
constructor(cdr) {
|
|
70
87
|
super(cdr);
|
|
71
88
|
}
|
|
@@ -119,13 +136,45 @@ let ViewPartComponent = class ViewPartComponent extends BaseDashboardPart {
|
|
|
119
136
|
// No viewEntity means the entity-viewer will show all records
|
|
120
137
|
this.ViewEntity = null;
|
|
121
138
|
}
|
|
139
|
+
if (!this.applyViewInputs())
|
|
140
|
+
return;
|
|
122
141
|
this.HasView = true;
|
|
123
142
|
this.setLoading(false);
|
|
124
143
|
}
|
|
125
144
|
catch (error) {
|
|
145
|
+
this.showingInputProblem = false;
|
|
126
146
|
this.setError(error instanceof Error ? error.message : 'Failed to load view');
|
|
127
147
|
}
|
|
128
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Works out the view's property values from the part's mappings. Returns false, showing why, when a
|
|
151
|
+
* mapping is broken (a view property renamed since) or a required input has no value.
|
|
152
|
+
*/
|
|
153
|
+
applyViewInputs() {
|
|
154
|
+
const resolution = this.UpdateInputs(ViewPartInterface(this.ViewEntity, this.EntityInfo).Inputs);
|
|
155
|
+
return this.showInputs(resolution);
|
|
156
|
+
}
|
|
157
|
+
/** Shows the inputs' problem, or takes their values. Returns false when the part stops. */
|
|
158
|
+
showInputs(resolution) {
|
|
159
|
+
const problem = PartInputProblemMessage(resolution);
|
|
160
|
+
this.showingInputProblem = problem !== null;
|
|
161
|
+
if (problem) {
|
|
162
|
+
this.setError(problem);
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
this.ViewPropertyValues = resolution ? { ...resolution.Values } : null;
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
/** New input values: the entity viewer reruns the view with them; no reload of the view itself. */
|
|
169
|
+
ApplyInputs(resolution) {
|
|
170
|
+
if (this.ErrorMessage && !this.showingInputProblem)
|
|
171
|
+
return; // a load error stays until the next load
|
|
172
|
+
if (this.showInputs(resolution)) {
|
|
173
|
+
this.ErrorMessage = null;
|
|
174
|
+
this.HasView = !!this.EntityInfo;
|
|
175
|
+
this.cdr.detectChanges();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
129
178
|
OnRecordSelected(event) {
|
|
130
179
|
// Emit data change event with selected record
|
|
131
180
|
this.emitDataChanged({
|
|
@@ -133,6 +182,8 @@ let ViewPartComponent = class ViewPartComponent extends BaseDashboardPart {
|
|
|
133
182
|
record: event.record,
|
|
134
183
|
primaryKey: event.record?.PrimaryKey
|
|
135
184
|
});
|
|
185
|
+
// RecordSelected: the selected record's fields, for the dashboard's wires and the host
|
|
186
|
+
this.EmitPartEvent(RECORD_SELECTED_EVENT, event.record ? { ...event.record } : null);
|
|
136
187
|
}
|
|
137
188
|
/** @deprecated Use {@link OnRecordSelected}. */
|
|
138
189
|
onRecordSelected(event) {
|
|
@@ -176,12 +227,13 @@ let ViewPartComponent = class ViewPartComponent extends BaseDashboardPart {
|
|
|
176
227
|
this.EntityInfo = null;
|
|
177
228
|
}
|
|
178
229
|
static ɵfac = function ViewPartComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ViewPartComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
|
|
179
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ViewPartComponent, selectors: [["mj-view-part"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
230
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ViewPartComponent, selectors: [["mj-view-part"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 6, vars: 9, consts: [[1, "view-part"], [1, "loading-state"], ["Variant", "error", "Icon", "fa-solid fa-triangle-exclamation", "Title", "Couldn't load view", "Size", "compact", 1, "part-placeholder", 3, "Message"], ["Icon", "fa-solid fa-table", "Title", "No View Selected", "Message", "Use Edit part to choose a view.", "Size", "compact", 1, "part-placeholder"], [1, "part-selection-bar"], [3, "Provider", "Entity", "ViewEntity", "Properties"], ["text", "Loading view..."], ["type", "button", 1, "part-clear-selection", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-xmark"], [3, "RecordSelected", "RecordOpened", "OpenRelatedRecordRequested", "Provider", "Entity", "ViewEntity", "Properties"]], template: function ViewPartComponent_Template(rf, ctx) { if (rf & 1) {
|
|
180
231
|
i0.ɵɵelementStart(0, "div", 0);
|
|
181
232
|
i0.ɵɵconditionalCreate(1, ViewPartComponent_Conditional_1_Template, 2, 0, "div", 1);
|
|
182
233
|
i0.ɵɵconditionalCreate(2, ViewPartComponent_Conditional_2_Template, 1, 1, "mj-empty-state", 2);
|
|
183
234
|
i0.ɵɵconditionalCreate(3, ViewPartComponent_Conditional_3_Template, 1, 0, "mj-empty-state", 3);
|
|
184
|
-
i0.ɵɵconditionalCreate(4, ViewPartComponent_Conditional_4_Template,
|
|
235
|
+
i0.ɵɵconditionalCreate(4, ViewPartComponent_Conditional_4_Template, 4, 0, "div", 4);
|
|
236
|
+
i0.ɵɵconditionalCreate(5, ViewPartComponent_Conditional_5_Template, 1, 4, "mj-entity-viewer", 5);
|
|
185
237
|
i0.ɵɵelementEnd();
|
|
186
238
|
} if (rf & 2) {
|
|
187
239
|
i0.ɵɵclassProp("loading", ctx.IsLoading)("error", ctx.ErrorMessage);
|
|
@@ -192,8 +244,10 @@ let ViewPartComponent = class ViewPartComponent extends BaseDashboardPart {
|
|
|
192
244
|
i0.ɵɵadvance();
|
|
193
245
|
i0.ɵɵconditional(!ctx.IsLoading && !ctx.ErrorMessage && !ctx.hasView ? 3 : -1);
|
|
194
246
|
i0.ɵɵadvance();
|
|
195
|
-
i0.ɵɵconditional(
|
|
196
|
-
|
|
247
|
+
i0.ɵɵconditional(ctx.HasActiveSelection && !ctx.IsLoading && !ctx.ErrorMessage ? 4 : -1);
|
|
248
|
+
i0.ɵɵadvance();
|
|
249
|
+
i0.ɵɵconditional(!ctx.IsLoading && !ctx.ErrorMessage && ctx.hasView && ctx.entityInfo ? 5 : -1);
|
|
250
|
+
} }, dependencies: [i1.LoadingComponent, i2.EntityViewerComponent, i3.MJEmptyStateComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .view-part[_ngcontent-%COMP%] {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder[_ngcontent-%COMP%] {\n height: 100%;\n }\n\n mj-entity-viewer[_ngcontent-%COMP%] {\n flex: 1;\n min-height: 0;\n }\n\n .part-selection-bar[_ngcontent-%COMP%] {\n display: flex;\n justify-content: flex-end;\n padding: 4px 8px;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n\n .part-clear-selection[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 2px 10px;\n border: 1px solid var(--mj-border-default);\n border-radius: 12px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n font-size: 12px;\n cursor: pointer;\n }\n\n .part-clear-selection[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }"] });
|
|
197
251
|
};
|
|
198
252
|
ViewPartComponent = __decorate([
|
|
199
253
|
RegisterClass(BaseDashboardPart, 'ViewPanelRenderer')
|
|
@@ -231,18 +285,28 @@ export { ViewPartComponent };
|
|
|
231
285
|
Size="compact" />
|
|
232
286
|
}
|
|
233
287
|
|
|
288
|
+
@if (HasActiveSelection && !IsLoading && !ErrorMessage) {
|
|
289
|
+
<div class="part-selection-bar">
|
|
290
|
+
<button type="button" class="part-clear-selection" (click)="ClearSelection()">
|
|
291
|
+
<i class="fa-solid fa-xmark" aria-hidden="true"></i> Clear selection
|
|
292
|
+
</button>
|
|
293
|
+
</div>
|
|
294
|
+
}
|
|
295
|
+
|
|
234
296
|
<!-- Entity Viewer -->
|
|
235
297
|
@if (!IsLoading && !ErrorMessage && hasView && entityInfo) {
|
|
236
298
|
<mj-entity-viewer
|
|
299
|
+
[Provider]="Provider"
|
|
237
300
|
[Entity]="entityInfo"
|
|
238
301
|
[ViewEntity]="viewEntity"
|
|
302
|
+
[Properties]="ViewPropertyValues"
|
|
239
303
|
(RecordSelected)="onRecordSelected($event)"
|
|
240
304
|
(RecordOpened)="onRecordOpened($event)"
|
|
241
305
|
(OpenRelatedRecordRequested)="onOpenRelatedRecordRequested($event)">
|
|
242
306
|
</mj-entity-viewer>
|
|
243
307
|
}
|
|
244
308
|
</div>
|
|
245
|
-
`, styles: ["\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .view-part {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder {\n height: 100%;\n }\n\n mj-entity-viewer {\n flex: 1;\n min-height: 0;\n }\n "] }]
|
|
309
|
+
`, styles: ["\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .view-part {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder {\n height: 100%;\n }\n\n mj-entity-viewer {\n flex: 1;\n min-height: 0;\n }\n\n .part-selection-bar {\n display: flex;\n justify-content: flex-end;\n padding: 4px 8px;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n\n .part-clear-selection {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 2px 10px;\n border: 1px solid var(--mj-border-default);\n border-radius: 12px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n font-size: 12px;\n cursor: pointer;\n }\n\n .part-clear-selection:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n "] }]
|
|
246
310
|
}], () => [{ type: i0.ChangeDetectorRef }], null); })();
|
|
247
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ViewPartComponent, { className: "ViewPartComponent", filePath: "src/lib/parts/view-part.component.ts", lineNumber:
|
|
311
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ViewPartComponent, { className: "ViewPartComponent", filePath: "src/lib/parts/view-part.component.ts", lineNumber: 132 }); })();
|
|
248
312
|
//# sourceMappingURL=view-part.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-part.component.js","sourceRoot":"","sources":["../../../src/lib/parts/view-part.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAA+C,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;;;;;;IAkB9C,8BAA2B;IACzB,gCAAgD;IAClD,iBAAM;;;IAKN,oCAMmB;;;IADjB,6CAAwB;;;IAM1B,oCAKmB;;;;IAKnB,2CAKsE;IAApE,AADA,AADA,uNAAkB,+BAAwB,KAAC,sMAC3B,6BAAsB,KAAC,kOACT,2CAAoC,KAAC;IACrE,iBAAmB;;;IAJjB,AADA,0CAAqB,iCACI;;AA1CvC;;;GAGG;AAmFI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,iBAAiB;IAC7C,OAAO,GAAG,KAAK,CAAC;IAEvB,uCAAuC;IACvC,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,uCAAuC;IACvC,IAAW,OAAO,CAAC,KAAK;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IACM,UAAU,GAAoC,IAAI,CAAC;IAE1D,0CAA0C;IAC1C,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACD,0CAA0C;IAC1C,IAAW,UAAU,CAAC,KAAsC;QAC1D,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IACM,UAAU,GAAsB,IAAI,CAAC;IAE5C,0CAA0C;IAC1C,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IACD,0CAA0C;IAC1C,IAAW,UAAU,CAAC,KAAwB;QAC5C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,YAAY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AC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;2GAtKQ,iBAAiB;6DAAjB,iBAAiB;YA7EtB,8BAAgF;YAE9E,mFAAiB;YAOjB,8FAAkC;YAWlC,8FAA+C;YAU/C,gGAA4D;YAS9D,iBAAM;;YAvC6C,AAA5B,wCAA2B,2BAA6B;YAE7E,cAIC;YAJD,wCAIC;YAGD,cAQC;YARD,6DAQC;YAGD,cAOC;YAPD,8EAOC;YAGD,cAQC;YARD,+FAQC;;;AAuCE,iBAAiB;IAlF7B,aAAa,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;GAkFzC,iBAAiB,CAuK7B;;iFAvKY,iBAAiB;cAjF7B,SAAS;6BACI,KAAK,YACL,cAAc,YACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAyCL;;kFAqCI,iBAAiB","sourcesContent":["import { Component, ChangeDetectorRef, AfterViewInit, OnDestroy } from '@angular/core';\nimport { RegisterClass, UUIDsEqual } from '@memberjunction/global';\nimport { BaseDashboardPart } from './base-dashboard-part';\nimport { PanelConfig } from '../models/dashboard-types';\nimport { EntityInfo } from '@memberjunction/core';\nimport { MJUserViewEntityExtended } from '@memberjunction/core-entities';\nimport { RecordSelectedEvent, RecordOpenedEvent, ViewRelatedRecordNavigation } from '@memberjunction/ng-entity-viewer';\n\n/**\n * Runtime renderer for View dashboard parts.\n * Displays entity data using mj-entity-viewer with grid, cards, or timeline layout.\n */\n@RegisterClass(BaseDashboardPart, 'ViewPanelRenderer')\n@Component({\n standalone: false,\n selector: 'mj-view-part',\n template: `\n <div class=\"view-part\" [class.loading]=\"IsLoading\" [class.error]=\"ErrorMessage\">\n <!-- Loading state -->\n @if (IsLoading) {\n <div class=\"loading-state\">\n <mj-loading text=\"Loading view...\"></mj-loading>\n </div>\n }\n \n <!-- Error state -->\n @if (ErrorMessage && !IsLoading) {\n <mj-empty-state\n class=\"part-placeholder\"\n Variant=\"error\"\n Icon=\"fa-solid fa-triangle-exclamation\"\n Title=\"Couldn't load view\"\n [Message]=\"ErrorMessage\"\n Size=\"compact\" />\n }\n\n <!-- No view configured -->\n @if (!IsLoading && !ErrorMessage && !hasView) {\n <mj-empty-state\n class=\"part-placeholder\"\n Icon=\"fa-solid fa-table\"\n Title=\"No View Selected\"\n Message=\"Use Edit part to choose a view.\"\n Size=\"compact\" />\n }\n \n <!-- Entity Viewer -->\n @if (!IsLoading && !ErrorMessage && hasView && entityInfo) {\n <mj-entity-viewer\n [Entity]=\"entityInfo\"\n [ViewEntity]=\"viewEntity\"\n (RecordSelected)=\"onRecordSelected($event)\"\n (RecordOpened)=\"onRecordOpened($event)\"\n (OpenRelatedRecordRequested)=\"onOpenRelatedRecordRequested($event)\">\n </mj-entity-viewer>\n }\n </div>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .view-part {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder {\n height: 100%;\n }\n\n mj-entity-viewer {\n flex: 1;\n min-height: 0;\n }\n `]\n})\nexport class ViewPartComponent extends BaseDashboardPart implements AfterViewInit, OnDestroy {\n public HasView = false;\n\n /** @deprecated Use {@link HasView}. */\n public get hasView() {\n return this.HasView;\n }\n /** @deprecated Use {@link HasView}. */\n public set hasView(value) {\n this.HasView = value;\n }\n public ViewEntity: MJUserViewEntityExtended | null = null;\n\n /** @deprecated Use {@link ViewEntity}. */\n public get viewEntity(): MJUserViewEntityExtended | null {\n return this.ViewEntity;\n }\n /** @deprecated Use {@link ViewEntity}. */\n public set viewEntity(value: MJUserViewEntityExtended | null) {\n this.ViewEntity = value;\n }\n public EntityInfo: EntityInfo | null = null;\n\n /** @deprecated Use {@link EntityInfo}. */\n public get entityInfo(): EntityInfo | null {\n return this.EntityInfo;\n }\n /** @deprecated Use {@link EntityInfo}. */\n public set entityInfo(value: EntityInfo | null) {\n this.EntityInfo = value;\n }\n\n constructor(cdr: ChangeDetectorRef) {\n super(cdr);\n }\n\n ngAfterViewInit(): void {\n if (this.Panel) {\n this.loadContent();\n }\n }\n\n public async loadContent(): Promise<void> {\n const config = this.getConfig<PanelConfig>();\n const viewId = config?.['viewId'] as string | undefined;\n const entityName = config?.['entityName'] as string | undefined;\n\n if (!viewId && !entityName) {\n this.HasView = false;\n this.cdr.detectChanges();\n return;\n }\n\n this.setLoading(true);\n\n try {\n const p = this.ProviderToUse;\n\n if (viewId) {\n // Load saved view by ID\n const viewEntity = await p.GetEntityObject<MJUserViewEntityExtended>('MJ: User Views', p.CurrentUser);\n const loaded = await viewEntity.Load(viewId);\n this.ViewEntity = viewEntity; // IMPORTANT - only set this.viewEntity AFTER we have it loaded in the above\n\n if (!loaded) {\n throw new Error('View not found');\n }\n\n // Get entity info from the view - prefer ViewEntityInfo if available (set by MJUserViewEntityExtended.Load)\n // Fall back to looking up by Entity name (virtual field) or EntityID\n if (viewEntity.ViewEntityInfo) {\n this.EntityInfo = viewEntity.ViewEntityInfo;\n } else if (viewEntity.Entity) {\n this.EntityInfo = p.EntityByName(viewEntity!.Entity) || null;\n } else if (viewEntity.EntityID) {\n // Last resort: look up by EntityID\n this.EntityInfo = p.Entities.find(e => UUIDsEqual(e.ID, viewEntity!.EntityID)) || null;\n }\n\n if (!this.EntityInfo) {\n throw new Error(`Could not determine entity for view \"${this.ViewEntity.Name}\" (ID: ${viewId})`);\n }\n } else if (entityName) {\n // Create dynamic view for entity (no saved view)\n this.EntityInfo = p.EntityByName(entityName) || null;\n\n if (!this.EntityInfo) {\n throw new Error(`Entity \"${entityName}\" not found`);\n }\n\n // No viewEntity means the entity-viewer will show all records\n this.ViewEntity = null;\n }\n\n this.HasView = true;\n this.setLoading(false);\n } catch (error) {\n this.setError(error instanceof Error ? error.message : 'Failed to load view');\n }\n }\n\n public OnRecordSelected(event: RecordSelectedEvent): void {\n // Emit data change event with selected record\n this.emitDataChanged({\n type: 'record-selected',\n record: event.record,\n primaryKey: event.record?.PrimaryKey\n });\n }\n\n /** @deprecated Use {@link OnRecordSelected}. */\n public onRecordSelected(event: RecordSelectedEvent): void {\n return this.OnRecordSelected(event);\n }\n\n public OnRecordOpened(event: RecordOpenedEvent): void {\n // Emit data change event for record open (for any listeners that need it)\n this.emitDataChanged({\n type: 'record-opened',\n record: event.record,\n primaryKey: event.record?.PrimaryKey\n });\n\n // Request navigation to open the record\n if (event.entity && event.compositeKey) {\n this.RequestOpenEntityRecord(\n event.entity.Name,\n event.compositeKey.ToURLSegment(),\n 'view',\n false\n );\n }\n }\n\n /** @deprecated Use {@link OnRecordOpened}. */\n public onRecordOpened(event: RecordOpenedEvent): void {\n return this.OnRecordOpened(event);\n }\n\n /**\n * Handle a plug-in renderer's request (bubbled up via the inner entity-viewer) to open a\n * *related* record on a (possibly different) entity — e.g. a grid foreign-key drill-through.\n * Requests navigation through the dashboard-part routing contract.\n *\n * @param nav the related-record navigation payload: the target entity name and the record's key.\n */\n public OnOpenRelatedRecordRequested(nav: ViewRelatedRecordNavigation): void {\n if (nav?.entityName && nav.recordKey != null) {\n this.RequestOpenEntityRecord(\n nav.entityName,\n String(nav.recordKey),\n 'view',\n false\n );\n }\n }\n\n /** @deprecated Use {@link OnOpenRelatedRecordRequested}. */\n public onOpenRelatedRecordRequested(nav: ViewRelatedRecordNavigation): void {\n return this.OnOpenRelatedRecordRequested(nav);\n }\n\n protected override cleanup(): void {\n // EntityViewer handles its own cleanup\n this.ViewEntity = null;\n this.EntityInfo = null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"view-part.component.js","sourceRoot":"","sources":["../../../src/lib/parts/view-part.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAA+C,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,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IAED,4DAA4D;IACrD,4BAA4B,CAAC,GAAgC;QAClE,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAEkB,OAAO;QACtB,uCAAuC;QACvC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;2GAlNQ,iBAAiB;6DAAjB,iBAAiB;YAhHtB,8BAAgF;YAE9E,mFAAiB;YAOjB,8FAAkC;YAWlC,8FAA+C;YAS/C,mFAAyD;YASzD,gGAA4D;YAW9D,iBAAM;;YAjD6C,AAA5B,wCAA2B,2BAA6B;YAE7E,cAIC;YAJD,wCAIC;YAGD,cAQC;YARD,6DAQC;YAGD,cAOC;YAPD,8EAOC;YAED,cAMC;YAND,wFAMC;YAGD,cAUC;YAVD,+FAUC;;;AAgEE,iBAAiB;IArH7B,aAAa,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;GAqHzC,iBAAiB,CAmN7B;;iFAnNY,iBAAiB;cApH7B,SAAS;6BACI,KAAK,YACL,cAAc,YACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAmDL;;kFA8DI,iBAAiB","sourcesContent":["import { Component, ChangeDetectorRef, AfterViewInit, OnDestroy } from '@angular/core';\nimport { RegisterClass, UUIDsEqual } from '@memberjunction/global';\nimport { BaseDashboardPart } from './base-dashboard-part';\nimport { PanelConfig } from '../models/dashboard-types';\nimport { EntityInfo, PropertyValue } from '@memberjunction/core';\nimport { MJUserViewEntityExtended } from '@memberjunction/core-entities';\nimport { RecordSelectedEvent, RecordOpenedEvent, ViewRelatedRecordNavigation } from '@memberjunction/ng-entity-viewer';\nimport { PartInputProblemMessage, PartInputResolution, RECORD_SELECTED_EVENT } from '../models/dashboard-properties';\nimport { ViewPartInterface } from '../models/dashboard-part-interfaces';\n\n/**\n * Runtime renderer for View dashboard parts.\n * Displays entity data using mj-entity-viewer with grid, cards, or timeline layout.\n */\n@RegisterClass(BaseDashboardPart, 'ViewPanelRenderer')\n@Component({\n standalone: false,\n selector: 'mj-view-part',\n template: `\n <div class=\"view-part\" [class.loading]=\"IsLoading\" [class.error]=\"ErrorMessage\">\n <!-- Loading state -->\n @if (IsLoading) {\n <div class=\"loading-state\">\n <mj-loading text=\"Loading view...\"></mj-loading>\n </div>\n }\n \n <!-- Error state -->\n @if (ErrorMessage && !IsLoading) {\n <mj-empty-state\n class=\"part-placeholder\"\n Variant=\"error\"\n Icon=\"fa-solid fa-triangle-exclamation\"\n Title=\"Couldn't load view\"\n [Message]=\"ErrorMessage\"\n Size=\"compact\" />\n }\n\n <!-- No view configured -->\n @if (!IsLoading && !ErrorMessage && !hasView) {\n <mj-empty-state\n class=\"part-placeholder\"\n Icon=\"fa-solid fa-table\"\n Title=\"No View Selected\"\n Message=\"Use Edit part to choose a view.\"\n Size=\"compact\" />\n }\n \n @if (HasActiveSelection && !IsLoading && !ErrorMessage) {\n <div class=\"part-selection-bar\">\n <button type=\"button\" class=\"part-clear-selection\" (click)=\"ClearSelection()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i> Clear selection\n </button>\n </div>\n }\n\n <!-- Entity Viewer -->\n @if (!IsLoading && !ErrorMessage && hasView && entityInfo) {\n <mj-entity-viewer\n [Provider]=\"Provider\"\n [Entity]=\"entityInfo\"\n [ViewEntity]=\"viewEntity\"\n [Properties]=\"ViewPropertyValues\"\n (RecordSelected)=\"onRecordSelected($event)\"\n (RecordOpened)=\"onRecordOpened($event)\"\n (OpenRelatedRecordRequested)=\"onOpenRelatedRecordRequested($event)\">\n </mj-entity-viewer>\n }\n </div>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .view-part {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--mj-bg-surface);\n }\n\n .loading-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n color: var(--mj-text-secondary);\n text-align: center;\n padding: 24px;\n }\n\n .part-placeholder {\n height: 100%;\n }\n\n mj-entity-viewer {\n flex: 1;\n min-height: 0;\n }\n\n .part-selection-bar {\n display: flex;\n justify-content: flex-end;\n padding: 4px 8px;\n border-bottom: 1px solid var(--mj-border-subtle);\n }\n\n .part-clear-selection {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 2px 10px;\n border: 1px solid var(--mj-border-default);\n border-radius: 12px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n font-size: 12px;\n cursor: pointer;\n }\n\n .part-clear-selection:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n `]\n})\nexport class ViewPartComponent extends BaseDashboardPart implements AfterViewInit, OnDestroy {\n public HasView = false;\n\n /** @deprecated Use {@link HasView}. */\n public get hasView() {\n return this.HasView;\n }\n /** @deprecated Use {@link HasView}. */\n public set hasView(value) {\n this.HasView = value;\n }\n public ViewEntity: MJUserViewEntityExtended | null = null;\n\n /** @deprecated Use {@link ViewEntity}. */\n public get viewEntity(): MJUserViewEntityExtended | null {\n return this.ViewEntity;\n }\n /** @deprecated Use {@link ViewEntity}. */\n public set viewEntity(value: MJUserViewEntityExtended | null) {\n this.ViewEntity = value;\n }\n public EntityInfo: EntityInfo | null = null;\n\n /** @deprecated Use {@link EntityInfo}. */\n public get entityInfo(): EntityInfo | null {\n return this.EntityInfo;\n }\n /** @deprecated Use {@link EntityInfo}. */\n public set entityInfo(value: EntityInfo | null) {\n this.EntityInfo = value;\n }\n\n /**\n * Values for the view's properties from the part's input mappings, passed to the entity viewer's\n * `Properties`. Null when the part has no mappings: the view runs exactly as before.\n */\n public ViewPropertyValues: Record<string, PropertyValue> | null = null;\n\n /** True while the part shows a problem with its mappings rather than a load error. */\n private showingInputProblem = false;\n\n constructor(cdr: ChangeDetectorRef) {\n super(cdr);\n }\n\n ngAfterViewInit(): void {\n if (this.Panel) {\n this.loadContent();\n }\n }\n\n public async loadContent(): Promise<void> {\n const config = this.getConfig<PanelConfig>();\n const viewId = config?.['viewId'] as string | undefined;\n const entityName = config?.['entityName'] as string | undefined;\n\n if (!viewId && !entityName) {\n this.HasView = false;\n this.cdr.detectChanges();\n return;\n }\n\n this.setLoading(true);\n\n try {\n const p = this.ProviderToUse;\n\n if (viewId) {\n // Load saved view by ID\n const viewEntity = await p.GetEntityObject<MJUserViewEntityExtended>('MJ: User Views', p.CurrentUser);\n const loaded = await viewEntity.Load(viewId);\n this.ViewEntity = viewEntity; // IMPORTANT - only set this.viewEntity AFTER we have it loaded in the above\n\n if (!loaded) {\n throw new Error('View not found');\n }\n\n // Get entity info from the view - prefer ViewEntityInfo if available (set by MJUserViewEntityExtended.Load)\n // Fall back to looking up by Entity name (virtual field) or EntityID\n if (viewEntity.ViewEntityInfo) {\n this.EntityInfo = viewEntity.ViewEntityInfo;\n } else if (viewEntity.Entity) {\n this.EntityInfo = p.EntityByName(viewEntity!.Entity) || null;\n } else if (viewEntity.EntityID) {\n // Last resort: look up by EntityID\n this.EntityInfo = p.Entities.find(e => UUIDsEqual(e.ID, viewEntity!.EntityID)) || null;\n }\n\n if (!this.EntityInfo) {\n throw new Error(`Could not determine entity for view \"${this.ViewEntity.Name}\" (ID: ${viewId})`);\n }\n } else if (entityName) {\n // Create dynamic view for entity (no saved view)\n this.EntityInfo = p.EntityByName(entityName) || null;\n\n if (!this.EntityInfo) {\n throw new Error(`Entity \"${entityName}\" not found`);\n }\n\n // No viewEntity means the entity-viewer will show all records\n this.ViewEntity = null;\n }\n\n if (!this.applyViewInputs()) return;\n this.HasView = true;\n this.setLoading(false);\n } catch (error) {\n this.showingInputProblem = false;\n this.setError(error instanceof Error ? error.message : 'Failed to load view');\n }\n }\n\n /**\n * Works out the view's property values from the part's mappings. Returns false, showing why, when a\n * mapping is broken (a view property renamed since) or a required input has no value.\n */\n private applyViewInputs(): boolean {\n const resolution = this.UpdateInputs(ViewPartInterface(this.ViewEntity, this.EntityInfo).Inputs);\n return this.showInputs(resolution);\n }\n\n /** Shows the inputs' problem, or takes their values. Returns false when the part stops. */\n private showInputs(resolution: PartInputResolution | null): boolean {\n const problem = PartInputProblemMessage(resolution);\n this.showingInputProblem = problem !== null;\n if (problem) {\n this.setError(problem);\n return false;\n }\n this.ViewPropertyValues = resolution ? { ...resolution.Values } : null;\n return true;\n }\n\n /** New input values: the entity viewer reruns the view with them; no reload of the view itself. */\n protected override ApplyInputs(resolution: PartInputResolution | null): void {\n if (this.ErrorMessage && !this.showingInputProblem) return; // a load error stays until the next load\n if (this.showInputs(resolution)) {\n this.ErrorMessage = null;\n this.HasView = !!this.EntityInfo;\n this.cdr.detectChanges();\n }\n }\n\n public OnRecordSelected(event: RecordSelectedEvent): void {\n // Emit data change event with selected record\n this.emitDataChanged({\n type: 'record-selected',\n record: event.record,\n primaryKey: event.record?.PrimaryKey\n });\n // RecordSelected: the selected record's fields, for the dashboard's wires and the host\n this.EmitPartEvent(RECORD_SELECTED_EVENT, event.record ? { ...event.record } : null);\n }\n\n /** @deprecated Use {@link OnRecordSelected}. */\n public onRecordSelected(event: RecordSelectedEvent): void {\n return this.OnRecordSelected(event);\n }\n\n public OnRecordOpened(event: RecordOpenedEvent): void {\n // Emit data change event for record open (for any listeners that need it)\n this.emitDataChanged({\n type: 'record-opened',\n record: event.record,\n primaryKey: event.record?.PrimaryKey\n });\n\n // Request navigation to open the record\n if (event.entity && event.compositeKey) {\n this.RequestOpenEntityRecord(\n event.entity.Name,\n event.compositeKey.ToURLSegment(),\n 'view',\n false\n );\n }\n }\n\n /** @deprecated Use {@link OnRecordOpened}. */\n public onRecordOpened(event: RecordOpenedEvent): void {\n return this.OnRecordOpened(event);\n }\n\n /**\n * Handle a plug-in renderer's request (bubbled up via the inner entity-viewer) to open a\n * *related* record on a (possibly different) entity — e.g. a grid foreign-key drill-through.\n * Requests navigation through the dashboard-part routing contract.\n *\n * @param nav the related-record navigation payload: the target entity name and the record's key.\n */\n public OnOpenRelatedRecordRequested(nav: ViewRelatedRecordNavigation): void {\n if (nav?.entityName && nav.recordKey != null) {\n this.RequestOpenEntityRecord(\n nav.entityName,\n String(nav.recordKey),\n 'view',\n false\n );\n }\n }\n\n /** @deprecated Use {@link OnOpenRelatedRecordRequested}. */\n public onOpenRelatedRecordRequested(nav: ViewRelatedRecordNavigation): void {\n return this.OnOpenRelatedRecordRequested(nav);\n }\n\n protected override cleanup(): void {\n // EntityViewer handles its own cleanup\n this.ViewEntity = null;\n this.EntityInfo = null;\n }\n}\n"]}
|
|
@@ -34,12 +34,20 @@ export declare class WebURLPartComponent extends BaseDashboardPart implements Af
|
|
|
34
34
|
/** @deprecated Use {@link ShowFallbackLink}. */
|
|
35
35
|
set showFallbackLink(value: boolean);
|
|
36
36
|
private sanitizer;
|
|
37
|
+
/** True while the part shows a problem with its mappings. */
|
|
38
|
+
private showingInputProblem;
|
|
37
39
|
private loadCheckTimeout;
|
|
38
40
|
private iframeLoaded;
|
|
39
41
|
constructor(cdr: ChangeDetectorRef, sanitizer: DomSanitizer);
|
|
40
42
|
ngAfterViewInit(): void;
|
|
41
43
|
protected cleanup(): void;
|
|
42
44
|
loadContent(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* The URL with its `{Name}` placeholders filled, each value URL-encoded, from the part's input
|
|
47
|
+
* mappings. A part without mappings keeps its URL exactly as configured. Returns null, showing
|
|
48
|
+
* why, when a mapping is broken or a placeholder has no value.
|
|
49
|
+
*/
|
|
50
|
+
private fillPlaceholders;
|
|
43
51
|
/**
|
|
44
52
|
* True when the URL parses and uses a scheme that is safe to hand to
|
|
45
53
|
* bypassSecurityTrustResourceUrl for iframe embedding (http/https only).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weburl-part.component.d.ts","sourceRoot":"","sources":["../../../src/lib/parts/weburl-part.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,iBAAiB,EAAE,UAAU,EAAa,aAAa,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,Y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,EAAE,OAAO,CAAS;IAEzC,gDAAgD;IAChD,IAAW,gBAAgB,IAAI,OAAO,CAErC;IACD,gDAAgD;IAChD,IAAW,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAEzC;IAED,OAAO,CAAC,SAAS,CAAe;IAChC,6DAA6D;IAC7D,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,gBAAgB,CAA8C;IACtE,OAAO,CAAC,YAAY,CAAkB;gBAE1B,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY;IAK3D,eAAe,IAAI,IAAI;cAOJ,OAAO,IAAI,IAAI;IAQrB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA8DzC;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAexB;;;OAGG;IACH,OAAO,CAAC,eAAe;IASvB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACI,YAAY,IAAI,IAAI;IAgB3B,4CAA4C;IACrC,YAAY,IAAI,IAAI;IAI3B;;OAEG;IACI,aAAa,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI;IAKzC,6CAA6C;IACtC,aAAa,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI;yCA7NhC,mBAAmB;2CAAnB,mBAAmB;CAgO/B"}
|
|
@@ -7,6 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Component, ViewChild } from '@angular/core';
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { BaseDashboardPart } from './base-dashboard-part';
|
|
10
|
+
import { FillUrlPlaceholders, PartInputProblemMessage } from '../models/dashboard-properties';
|
|
11
|
+
import { WebUrlPartInterface } from '../models/dashboard-part-interfaces';
|
|
10
12
|
import * as i0 from "@angular/core";
|
|
11
13
|
import * as i1 from "@angular/platform-browser";
|
|
12
14
|
import * as i2 from "@memberjunction/ng-ui-components";
|
|
@@ -180,6 +182,8 @@ let WebURLPartComponent = class WebURLPartComponent extends BaseDashboardPart {
|
|
|
180
182
|
this.ShowFallbackLink = value;
|
|
181
183
|
} // Hidden by default, shown if content might be blocked
|
|
182
184
|
sanitizer;
|
|
185
|
+
/** True while the part shows a problem with its mappings. */
|
|
186
|
+
showingInputProblem = false;
|
|
183
187
|
loadCheckTimeout = null;
|
|
184
188
|
iframeLoaded = false;
|
|
185
189
|
constructor(cdr, sanitizer) {
|
|
@@ -201,7 +205,9 @@ let WebURLPartComponent = class WebURLPartComponent extends BaseDashboardPart {
|
|
|
201
205
|
}
|
|
202
206
|
async loadContent() {
|
|
203
207
|
const config = this.getConfig();
|
|
204
|
-
const url = config?.['url'];
|
|
208
|
+
const url = this.fillPlaceholders(config?.['url']);
|
|
209
|
+
if (url === null)
|
|
210
|
+
return; // a mapping problem is shown
|
|
205
211
|
// Clear any existing timeout
|
|
206
212
|
if (this.loadCheckTimeout) {
|
|
207
213
|
clearTimeout(this.loadCheckTimeout);
|
|
@@ -248,6 +254,27 @@ let WebURLPartComponent = class WebURLPartComponent extends BaseDashboardPart {
|
|
|
248
254
|
this.setError(error instanceof Error ? error.message : 'Failed to load URL');
|
|
249
255
|
}
|
|
250
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* The URL with its `{Name}` placeholders filled, each value URL-encoded, from the part's input
|
|
259
|
+
* mappings. A part without mappings keeps its URL exactly as configured. Returns null, showing
|
|
260
|
+
* why, when a mapping is broken or a placeholder has no value.
|
|
261
|
+
*/
|
|
262
|
+
fillPlaceholders(url) {
|
|
263
|
+
const resolution = this.UpdateInputs(WebUrlPartInterface(url).Inputs);
|
|
264
|
+
if (!resolution || !url)
|
|
265
|
+
return url;
|
|
266
|
+
const problem = PartInputProblemMessage(resolution);
|
|
267
|
+
if (this.showingInputProblem && !problem)
|
|
268
|
+
this.ErrorMessage = null; // the values arrived
|
|
269
|
+
this.showingInputProblem = problem !== null;
|
|
270
|
+
if (problem) {
|
|
271
|
+
this.SafeUrl = null;
|
|
272
|
+
this.RawUrl = '';
|
|
273
|
+
this.setError(problem);
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
return FillUrlPlaceholders(url, resolution.Values);
|
|
277
|
+
}
|
|
251
278
|
/**
|
|
252
279
|
* True when the URL parses and uses a scheme that is safe to hand to
|
|
253
280
|
* bypassSecurityTrustResourceUrl for iframe embedding (http/https only).
|
|
@@ -471,5 +498,5 @@ export { WebURLPartComponent };
|
|
|
471
498
|
type: ViewChild,
|
|
472
499
|
args: ['iframe']
|
|
473
500
|
}] }); })();
|
|
474
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WebURLPartComponent, { className: "WebURLPartComponent", filePath: "src/lib/parts/weburl-part.component.ts", lineNumber:
|
|
501
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WebURLPartComponent, { className: "WebURLPartComponent", filePath: "src/lib/parts/weburl-part.component.ts", lineNumber: 232 }); })();
|
|
475
502
|
//# sourceMappingURL=weburl-part.component.js.map
|