@memberjunction/ng-entity-viewer 6.2.0-edge.6 → 6.2.0-edge.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts +99 -2
- package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts.map +1 -1
- package/dist/lib/entity-data-grid/entity-data-grid.component.js +619 -272
- package/dist/lib/entity-data-grid/entity-data-grid.component.js.map +1 -1
- package/dist/lib/entity-data-grid/open-in-excel.d.ts +40 -0
- package/dist/lib/entity-data-grid/open-in-excel.d.ts.map +1 -0
- package/dist/lib/entity-data-grid/open-in-excel.js +60 -0
- package/dist/lib/entity-data-grid/open-in-excel.js.map +1 -0
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.d.ts +40 -0
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.d.ts.map +1 -1
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.js +72 -8
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.js.map +1 -1
- package/dist/lib/entity-viewer/entity-viewer.component.d.ts +13 -1
- package/dist/lib/entity-viewer/entity-viewer.component.d.ts.map +1 -1
- package/dist/lib/entity-viewer/entity-viewer.component.js +35 -5
- package/dist/lib/entity-viewer/entity-viewer.component.js.map +1 -1
- package/dist/lib/utils/record.util.d.ts +23 -0
- package/dist/lib/utils/record.util.d.ts.map +1 -1
- package/dist/lib/utils/record.util.js +34 -0
- package/dist/lib/utils/record.util.js.map +1 -1
- package/dist/lib/view-config-panel/view-config-panel.component.d.ts +34 -5
- package/dist/lib/view-config-panel/view-config-panel.component.d.ts.map +1 -1
- package/dist/lib/view-config-panel/view-config-panel.component.js +158 -56
- package/dist/lib/view-config-panel/view-config-panel.component.js.map +1 -1
- package/dist/lib/view-selector/view-selector.component.d.ts +7 -1
- package/dist/lib/view-selector/view-selector.component.d.ts.map +1 -1
- package/dist/lib/view-selector/view-selector.component.js +134 -119
- package/dist/lib/view-selector/view-selector.component.js.map +1 -1
- package/dist/lib/view-types/renderers/grid-view-renderer.component.d.ts +7 -1
- package/dist/lib/view-types/renderers/grid-view-renderer.component.d.ts.map +1 -1
- package/dist/lib/view-types/renderers/grid-view-renderer.component.js +13 -3
- package/dist/lib/view-types/renderers/grid-view-renderer.component.js.map +1 -1
- package/dist/lib/view-types/view-type.contracts.d.ts +6 -0
- package/dist/lib/view-types/view-type.contracts.d.ts.map +1 -1
- package/dist/lib/view-types/view-type.contracts.js.map +1 -1
- package/dist/lib/view-workspace/view-workspace.component.d.ts +20 -0
- package/dist/lib/view-workspace/view-workspace.component.d.ts.map +1 -1
- package/dist/lib/view-workspace/view-workspace.component.js +104 -19
- package/dist/lib/view-workspace/view-workspace.component.js.map +1 -1
- package/package.json +23 -22
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resolves when `<mj-entity-data-grid>` offers Open in Excel and which workbook source
|
|
3
|
+
* (`View` or `Entity`) it sends to `ExcelAddinClient`.
|
|
4
|
+
*
|
|
5
|
+
* Kept out of the component so the rule is unit-testable in isolation:
|
|
6
|
+
* - When a saved `MJ: User Views` record backs the grid, the workbook opens `{ Kind: 'View', ID }`.
|
|
7
|
+
* - When the grid shows an unscoped entity (such as Data Explorer's `(Default)` view, with no parent
|
|
8
|
+
* `ExtraFilter` and no ad-hoc `AlternateBaseView`), the workbook opens `{ Kind: 'Entity', ID }`.
|
|
9
|
+
* - Scoped subgrids (for example a related-records grid on a form with `ExtraFilter`) have no standalone
|
|
10
|
+
* saved view or unscoped entity to bind, so they keep the static snapshot export only.
|
|
11
|
+
*/
|
|
12
|
+
import type { RunViewParams } from '@memberjunction/core';
|
|
13
|
+
import type { ExcelWorkbookSourceRequest } from '@memberjunction/excel-addin';
|
|
14
|
+
/** Inputs that decide whether an entity grid can open a live workbook in Excel. */
|
|
15
|
+
export interface GridExcelSourceOptions {
|
|
16
|
+
ShowButton: boolean;
|
|
17
|
+
AddinEnabled: boolean;
|
|
18
|
+
SavedViewID?: string | null;
|
|
19
|
+
EntityID?: string | null;
|
|
20
|
+
ExtraFilter?: RunViewParams['ExtraFilter'] | null;
|
|
21
|
+
AlternateBaseView?: string | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the workbook source request for the current grid state, or `null` when Open in Excel does
|
|
25
|
+
* not apply.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ResolveGridExcelSource(options: GridExcelSourceOptions): ExcelWorkbookSourceRequest | null;
|
|
28
|
+
/**
|
|
29
|
+
* True when the grid should offer Open in Excel for a saved view ID specifically.
|
|
30
|
+
*/
|
|
31
|
+
export declare function CanOpenViewInExcel(showButton: boolean, savedViewID: string | null | undefined, addinEnabled: boolean): boolean;
|
|
32
|
+
/** Tooltip when opening a saved view in Excel. */
|
|
33
|
+
export declare const OPEN_VIEW_IN_EXCEL_TOOLTIP: string;
|
|
34
|
+
/** Tooltip when opening an unscoped entity's default dataset in Excel. */
|
|
35
|
+
export declare const OPEN_ENTITY_IN_EXCEL_TOOLTIP = "Download a workbook that connects to this entity in Excel and refreshes its records live from MemberJunction.";
|
|
36
|
+
/** Returns the tooltip matching the resolved workbook source (`View` vs `Entity`). */
|
|
37
|
+
export declare function ExcelSourceTooltip(source: ExcelWorkbookSourceRequest | null): string;
|
|
38
|
+
/** Returns the concise subtitle shown under "Open in Excel" inside the unified toolbar menu. */
|
|
39
|
+
export declare function ExcelSourceMenuDescription(source: ExcelWorkbookSourceRequest | null): string;
|
|
40
|
+
//# sourceMappingURL=open-in-excel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-in-excel.d.ts","sourceRoot":"","sources":["../../../src/lib/entity-data-grid/open-in-excel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAE9E,mFAAmF;AACnF,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAClD,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,0BAA0B,GAAG,IAAI,CAkBzG;AAgBD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAE9H;AAED,kDAAkD;AAClD,eAAO,MAAM,0BAA0B,QAEY,CAAC;AAEpD,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,kHAC0E,CAAC;AAEpH,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI,GAAG,MAAM,CAKpF;AAED,gGAAgG;AAChG,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI,GAAG,MAAM,CAK5F"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the workbook source request for the current grid state, or `null` when Open in Excel does
|
|
3
|
+
* not apply.
|
|
4
|
+
*/
|
|
5
|
+
export function ResolveGridExcelSource(options) {
|
|
6
|
+
if (!options.ShowButton || !options.AddinEnabled) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const savedViewID = options.SavedViewID?.trim() ?? '';
|
|
10
|
+
if (savedViewID.length > 0) {
|
|
11
|
+
return { Kind: 'View', ID: savedViewID };
|
|
12
|
+
}
|
|
13
|
+
const hasExtraFilter = hasNonEmptyExtraFilter(options.ExtraFilter);
|
|
14
|
+
const hasAlternateBaseView = (options.AlternateBaseView?.trim().length ?? 0) > 0;
|
|
15
|
+
if (hasExtraFilter || hasAlternateBaseView) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const entityID = options.EntityID?.trim() ?? '';
|
|
19
|
+
if (entityID.length > 0) {
|
|
20
|
+
return { Kind: 'Entity', ID: entityID };
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function hasNonEmptyExtraFilter(extraFilter) {
|
|
25
|
+
if (!extraFilter) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (typeof extraFilter === 'string') {
|
|
29
|
+
return extraFilter.trim().length > 0;
|
|
30
|
+
}
|
|
31
|
+
return ((extraFilter.default?.trim().length ?? 0) > 0 ||
|
|
32
|
+
(extraFilter.sqlserver?.trim().length ?? 0) > 0 ||
|
|
33
|
+
(extraFilter.postgresql?.trim().length ?? 0) > 0);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* True when the grid should offer Open in Excel for a saved view ID specifically.
|
|
37
|
+
*/
|
|
38
|
+
export function CanOpenViewInExcel(showButton, savedViewID, addinEnabled) {
|
|
39
|
+
return ResolveGridExcelSource({ ShowButton: showButton, SavedViewID: savedViewID, AddinEnabled: addinEnabled }) !== null;
|
|
40
|
+
}
|
|
41
|
+
/** Tooltip when opening a saved view in Excel. */
|
|
42
|
+
export const OPEN_VIEW_IN_EXCEL_TOOLTIP = 'Download a workbook that loads this saved view in Excel and refreshes it live from MemberJunction. ' +
|
|
43
|
+
'Unsaved changes to the view aren\'t included.';
|
|
44
|
+
/** Tooltip when opening an unscoped entity's default dataset in Excel. */
|
|
45
|
+
export const OPEN_ENTITY_IN_EXCEL_TOOLTIP = 'Download a workbook that connects to this entity in Excel and refreshes its records live from MemberJunction.';
|
|
46
|
+
/** Returns the tooltip matching the resolved workbook source (`View` vs `Entity`). */
|
|
47
|
+
export function ExcelSourceTooltip(source) {
|
|
48
|
+
if (source?.Kind === 'Entity') {
|
|
49
|
+
return OPEN_ENTITY_IN_EXCEL_TOOLTIP;
|
|
50
|
+
}
|
|
51
|
+
return OPEN_VIEW_IN_EXCEL_TOOLTIP;
|
|
52
|
+
}
|
|
53
|
+
/** Returns the concise subtitle shown under "Open in Excel" inside the unified toolbar menu. */
|
|
54
|
+
export function ExcelSourceMenuDescription(source) {
|
|
55
|
+
if (source?.Kind === 'Entity') {
|
|
56
|
+
return 'Connected workbook — sign in & refresh entity records live';
|
|
57
|
+
}
|
|
58
|
+
return 'Connected workbook — sign in & refresh this saved view live';
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=open-in-excel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-in-excel.js","sourceRoot":"","sources":["../../../src/lib/entity-data-grid/open-in-excel.ts"],"names":[],"mappings":"AAwBA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA+B;IAClE,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACtD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;IAC7C,CAAC;IACD,MAAM,cAAc,GAAG,sBAAsB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnE,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjF,IAAI,cAAc,IAAI,oBAAoB,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MAAM,UAAU,kBAAkB,CAAC,MAAyC;IACxE,IAAI,MAAM,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,4BAA4B,CAAC;IACxC,CAAC;IACD,OAAO,0BAA0B,CAAC;AACtC,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,0BAA0B,CAAC,MAAyC;IAChF,IAAI,MAAM,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,4DAA4D,CAAC;IACxE,CAAC;IACD,OAAO,6DAA6D,CAAC;AACzE,CAAC","sourcesContent":["/**\n * @fileoverview Resolves when `<mj-entity-data-grid>` offers Open in Excel and which workbook source\n * (`View` or `Entity`) it sends to `ExcelAddinClient`.\n *\n * Kept out of the component so the rule is unit-testable in isolation:\n * - When a saved `MJ: User Views` record backs the grid, the workbook opens `{ Kind: 'View', ID }`.\n * - When the grid shows an unscoped entity (such as Data Explorer's `(Default)` view, with no parent\n * `ExtraFilter` and no ad-hoc `AlternateBaseView`), the workbook opens `{ Kind: 'Entity', ID }`.\n * - Scoped subgrids (for example a related-records grid on a form with `ExtraFilter`) have no standalone\n * saved view or unscoped entity to bind, so they keep the static snapshot export only.\n */\nimport type { RunViewParams } from '@memberjunction/core';\nimport type { ExcelWorkbookSourceRequest } from '@memberjunction/excel-addin';\n\n/** Inputs that decide whether an entity grid can open a live workbook in Excel. */\nexport interface GridExcelSourceOptions {\n ShowButton: boolean;\n AddinEnabled: boolean;\n SavedViewID?: string | null;\n EntityID?: string | null;\n ExtraFilter?: RunViewParams['ExtraFilter'] | null;\n AlternateBaseView?: string | null;\n}\n\n/**\n * Resolves the workbook source request for the current grid state, or `null` when Open in Excel does\n * not apply.\n */\nexport function ResolveGridExcelSource(options: GridExcelSourceOptions): ExcelWorkbookSourceRequest | null {\n if (!options.ShowButton || !options.AddinEnabled) {\n return null;\n }\n const savedViewID = options.SavedViewID?.trim() ?? '';\n if (savedViewID.length > 0) {\n return { Kind: 'View', ID: savedViewID };\n }\n const hasExtraFilter = hasNonEmptyExtraFilter(options.ExtraFilter);\n const hasAlternateBaseView = (options.AlternateBaseView?.trim().length ?? 0) > 0;\n if (hasExtraFilter || hasAlternateBaseView) {\n return null;\n }\n const entityID = options.EntityID?.trim() ?? '';\n if (entityID.length > 0) {\n return { Kind: 'Entity', ID: entityID };\n }\n return null;\n}\n\nfunction hasNonEmptyExtraFilter(extraFilter: RunViewParams['ExtraFilter'] | null | undefined): boolean {\n if (!extraFilter) {\n return false;\n }\n if (typeof extraFilter === 'string') {\n return extraFilter.trim().length > 0;\n }\n return (\n (extraFilter.default?.trim().length ?? 0) > 0 ||\n (extraFilter.sqlserver?.trim().length ?? 0) > 0 ||\n (extraFilter.postgresql?.trim().length ?? 0) > 0\n );\n}\n\n/**\n * True when the grid should offer Open in Excel for a saved view ID specifically.\n */\nexport function CanOpenViewInExcel(showButton: boolean, savedViewID: string | null | undefined, addinEnabled: boolean): boolean {\n return ResolveGridExcelSource({ ShowButton: showButton, SavedViewID: savedViewID, AddinEnabled: addinEnabled }) !== null;\n}\n\n/** Tooltip when opening a saved view in Excel. */\nexport const OPEN_VIEW_IN_EXCEL_TOOLTIP =\n 'Download a workbook that loads this saved view in Excel and refreshes it live from MemberJunction. ' +\n 'Unsaved changes to the view aren\\'t included.';\n\n/** Tooltip when opening an unscoped entity's default dataset in Excel. */\nexport const OPEN_ENTITY_IN_EXCEL_TOOLTIP =\n 'Download a workbook that connects to this entity in Excel and refreshes its records live from MemberJunction.';\n\n/** Returns the tooltip matching the resolved workbook source (`View` vs `Entity`). */\nexport function ExcelSourceTooltip(source: ExcelWorkbookSourceRequest | null): string {\n if (source?.Kind === 'Entity') {\n return OPEN_ENTITY_IN_EXCEL_TOOLTIP;\n }\n return OPEN_VIEW_IN_EXCEL_TOOLTIP;\n}\n\n/** Returns the concise subtitle shown under \"Open in Excel\" inside the unified toolbar menu. */\nexport function ExcelSourceMenuDescription(source: ExcelWorkbookSourceRequest | null): string {\n if (source?.Kind === 'Entity') {\n return 'Connected workbook — sign in & refresh entity records live';\n }\n return 'Connected workbook — sign in & refresh this saved view live';\n}\n"]}
|
|
@@ -4,7 +4,23 @@ import { EntityInfo, EntityRelationshipInfo, EntityOrganicKeyInfo, EntityOrganic
|
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
interface RelatedEntityData {
|
|
6
6
|
relationship: EntityRelationshipInfo;
|
|
7
|
+
/**
|
|
8
|
+
* The related entity's technical NAME. Used to address data — metadata lookups, the
|
|
9
|
+
* `navigateToRelated` / `openRelatedRecord` payloads — and therefore NOT unique across this
|
|
10
|
+
* list: two foreign keys pointing at the same entity produce two rows with the same value.
|
|
11
|
+
*/
|
|
7
12
|
relatedEntityName: string;
|
|
13
|
+
/**
|
|
14
|
+
* What the user reads. Disambiguated by the foreign-key field when more than one
|
|
15
|
+
* relationship targets the same entity — see {@link buildRelatedEntityDisplayNames}.
|
|
16
|
+
*/
|
|
17
|
+
displayName: string;
|
|
18
|
+
/**
|
|
19
|
+
* Stable, unique identity for this ROW (the relationship's own ID). The template tracks on
|
|
20
|
+
* this; tracking on {@link relatedEntityName} gave Angular a duplicate key for two FKs to
|
|
21
|
+
* one entity (NG0955) and let it reuse the wrong DOM node between them.
|
|
22
|
+
*/
|
|
23
|
+
key: string;
|
|
8
24
|
count: number;
|
|
9
25
|
isExpanded: boolean;
|
|
10
26
|
records: Record<string, unknown>[];
|
|
@@ -159,6 +175,30 @@ export declare class EntityRecordDetailPanelComponent extends BaseAngularCompone
|
|
|
159
175
|
private _polymorphicRecordNames;
|
|
160
176
|
ngOnChanges(changes: SimpleChanges): void;
|
|
161
177
|
private resolvePolymorphicNamesForRecord;
|
|
178
|
+
/**
|
|
179
|
+
* Label for each related-records grid, in the same order as `relationships`.
|
|
180
|
+
*
|
|
181
|
+
* Two foreign keys from one entity to another are two genuinely different record sets — an
|
|
182
|
+
* Invoice's `BillToContactID` rows are not its `ShipToContactID` rows — but both were
|
|
183
|
+
* labelled with the bare related-entity name, so the panel showed two identically titled
|
|
184
|
+
* grids with different counts and nothing to tell them apart. (Collapsing them into one
|
|
185
|
+
* grid, which the bare label implies, would be data loss.)
|
|
186
|
+
*
|
|
187
|
+
* The disambiguation rule is CodeGen's, reused rather than reinvented: an explicit
|
|
188
|
+
* `DisplayName` on the relationship wins; otherwise use the entity's display name, and when
|
|
189
|
+
* more than one relationship targets that same entity, append the foreign-key field's own
|
|
190
|
+
* display name — `Contacts (Bill To Contact)` / `Contacts (Ship To Contact)`. See
|
|
191
|
+
* `generateRelatedEntityTabName` in `packages/CodeGenLib/src/Angular/angular-codegen.ts`.
|
|
192
|
+
*/
|
|
193
|
+
private buildRelatedEntityDisplayNames;
|
|
194
|
+
/**
|
|
195
|
+
* Unique row identity for a related-records grid.
|
|
196
|
+
*
|
|
197
|
+
* The relationship's own ID, which is unique by construction. Falls back to
|
|
198
|
+
* entity + join field for a relationship whose ID is somehow absent, because the one thing
|
|
199
|
+
* this must never do is return the same key for two rows — that is the NG0955 it fixes.
|
|
200
|
+
*/
|
|
201
|
+
private relationshipRowKey;
|
|
162
202
|
/**
|
|
163
203
|
* Load counts for related entities using batch RunViews call
|
|
164
204
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-record-detail-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/entity-record-detail-panel/entity-record-detail-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iCAAiC,EAAgI,MAAM,sBAAsB,CAAC;;
|
|
1
|
+
{"version":3,"file":"entity-record-detail-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/entity-record-detail-panel/entity-record-detail-panel.component.ts"],"names":[],"mapp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kBAAkB,IAAI,MAAM;IAI5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;yCAjhCb,gCAAgC;2CAAhC,gCAAgC;CAmiC5C"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
2
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
3
3
|
import { EntityInfo, RunView, EntityFieldValueListType, IsDateOnlySQLType, FormatDateOnly } from '@memberjunction/core';
|
|
4
|
+
import { IndexByUUID } from '@memberjunction/global';
|
|
4
5
|
import { BuildCompositeKey, BuildPkString, ResolvePolymorphicTargetEntity, BuildPolymorphicCompositeKey, PolymorphicCacheKey, BatchResolvePolymorphicRecordNames } from '../utils/record.util';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
import * as i1 from "@memberjunction/ng-shared-generic";
|
|
7
8
|
import * as i2 from "@memberjunction/ng-ui-components";
|
|
8
9
|
import * as i3 from "../pill/pill.component";
|
|
9
10
|
const _forTrack0 = ($index, $item) => $item.name;
|
|
10
|
-
const _forTrack1 = ($index, $item) => $item.
|
|
11
|
+
const _forTrack1 = ($index, $item) => $item.key;
|
|
12
|
+
const _forTrack2 = ($index, $item) => $item.relatedEntityName;
|
|
11
13
|
function EntityRecordDetailPanelComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
12
14
|
i0.ɵɵelement(0, "i", 17);
|
|
13
15
|
} if (rf & 2) {
|
|
@@ -224,7 +226,7 @@ function EntityRecordDetailPanelComponent_Conditional_18_For_1_Template(rf, ctx)
|
|
|
224
226
|
i0.ɵɵadvance();
|
|
225
227
|
i0.ɵɵclassMap(ctx_r0.getRelatedEntityIcon(relEntity_r6));
|
|
226
228
|
i0.ɵɵadvance(2);
|
|
227
|
-
i0.ɵɵtextInterpolate(relEntity_r6.
|
|
229
|
+
i0.ɵɵtextInterpolate(relEntity_r6.displayName);
|
|
228
230
|
i0.ɵɵadvance(2);
|
|
229
231
|
i0.ɵɵtextInterpolate(relEntity_r6.count);
|
|
230
232
|
i0.ɵɵadvance();
|
|
@@ -347,7 +349,7 @@ function EntityRecordDetailPanelComponent_Conditional_19_Conditional_4_For_1_Tem
|
|
|
347
349
|
i0.ɵɵconditional(match_r12.isExpanded ? 8 : -1);
|
|
348
350
|
} }
|
|
349
351
|
function EntityRecordDetailPanelComponent_Conditional_19_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
350
|
-
i0.ɵɵrepeaterCreate(0, EntityRecordDetailPanelComponent_Conditional_19_Conditional_4_For_1_Template, 9, 13, "div", 36,
|
|
352
|
+
i0.ɵɵrepeaterCreate(0, EntityRecordDetailPanelComponent_Conditional_19_Conditional_4_For_1_Template, 9, 13, "div", 36, _forTrack2);
|
|
351
353
|
} if (rf & 2) {
|
|
352
354
|
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
353
355
|
i0.ɵɵrepeater(ctx_r0.organicKeyMatchesWithRecords);
|
|
@@ -518,6 +520,62 @@ export class EntityRecordDetailPanelComponent extends BaseAngularComponent {
|
|
|
518
520
|
this.ngZone.run(() => this.cdr.detectChanges());
|
|
519
521
|
}
|
|
520
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* Label for each related-records grid, in the same order as `relationships`.
|
|
525
|
+
*
|
|
526
|
+
* Two foreign keys from one entity to another are two genuinely different record sets — an
|
|
527
|
+
* Invoice's `BillToContactID` rows are not its `ShipToContactID` rows — but both were
|
|
528
|
+
* labelled with the bare related-entity name, so the panel showed two identically titled
|
|
529
|
+
* grids with different counts and nothing to tell them apart. (Collapsing them into one
|
|
530
|
+
* grid, which the bare label implies, would be data loss.)
|
|
531
|
+
*
|
|
532
|
+
* The disambiguation rule is CodeGen's, reused rather than reinvented: an explicit
|
|
533
|
+
* `DisplayName` on the relationship wins; otherwise use the entity's display name, and when
|
|
534
|
+
* more than one relationship targets that same entity, append the foreign-key field's own
|
|
535
|
+
* display name — `Contacts (Bill To Contact)` / `Contacts (Ship To Contact)`. See
|
|
536
|
+
* `generateRelatedEntityTabName` in `packages/CodeGenLib/src/Angular/angular-codegen.ts`.
|
|
537
|
+
*/
|
|
538
|
+
buildRelatedEntityDisplayNames(relationships) {
|
|
539
|
+
// How many relationships in THIS list point at each related entity. Only a collision
|
|
540
|
+
// needs the suffix; a single relationship reads better without it.
|
|
541
|
+
// Keyed case-insensitively: UUIDs reach the client in whatever case the provider wrote,
|
|
542
|
+
// and two spellings of one id would each look like a single, unambiguous relationship.
|
|
543
|
+
const perTarget = new Map();
|
|
544
|
+
for (const rel of relationships) {
|
|
545
|
+
const id = (rel.RelatedEntityID ?? '').toLowerCase();
|
|
546
|
+
perTarget.set(id, (perTarget.get(id) ?? 0) + 1);
|
|
547
|
+
}
|
|
548
|
+
// One index, built once per call: a per-relationship scan over every entity is the nested UUID
|
|
549
|
+
// comparison the compliance gate (MJGlobal UUIDCompliance) rejects, and it is quadratic for no reason.
|
|
550
|
+
const entitiesByID = IndexByUUID(this.metadata.Entities);
|
|
551
|
+
return relationships.map(rel => {
|
|
552
|
+
if (rel.DisplayName && rel.DisplayName.trim().length > 0) {
|
|
553
|
+
return rel.DisplayName;
|
|
554
|
+
}
|
|
555
|
+
const relatedEntity = entitiesByID.Get(rel.RelatedEntityID);
|
|
556
|
+
let label = relatedEntity?.DisplayNameOrName ?? rel.RelatedEntity;
|
|
557
|
+
if ((perTarget.get((rel.RelatedEntityID ?? '').toLowerCase()) ?? 0) > 1) {
|
|
558
|
+
// Strip the SQL brackets CodeGen also strips — `[ContactID]` is how some
|
|
559
|
+
// schemas spell the join field.
|
|
560
|
+
const joinField = rel.RelatedEntityJoinField?.trim().replace(/[[\]]/g, '');
|
|
561
|
+
if (joinField) {
|
|
562
|
+
const field = relatedEntity?.Fields.find(f => f.Name.trim().toLowerCase() === joinField.toLowerCase());
|
|
563
|
+
label += ` (${field?.DisplayNameOrName ?? joinField})`;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return label;
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Unique row identity for a related-records grid.
|
|
571
|
+
*
|
|
572
|
+
* The relationship's own ID, which is unique by construction. Falls back to
|
|
573
|
+
* entity + join field for a relationship whose ID is somehow absent, because the one thing
|
|
574
|
+
* this must never do is return the same key for two rows — that is the NG0955 it fixes.
|
|
575
|
+
*/
|
|
576
|
+
relationshipRowKey(rel) {
|
|
577
|
+
return rel.ID ?? `${rel.RelatedEntityID}|${rel.RelatedEntityJoinField ?? ''}`;
|
|
578
|
+
}
|
|
521
579
|
/**
|
|
522
580
|
* Load counts for related entities using batch RunViews call
|
|
523
581
|
*/
|
|
@@ -550,12 +608,15 @@ export class EntityRecordDetailPanelComponent extends BaseAngularComponent {
|
|
|
550
608
|
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
551
609
|
const results = await rv.RunViews(viewParams);
|
|
552
610
|
// Map results back to relationship data
|
|
611
|
+
const displayNames = this.buildRelatedEntityDisplayNames(relationships);
|
|
553
612
|
this.RelatedEntities = relationships.map((rel, index) => {
|
|
554
613
|
const result = results[index];
|
|
555
614
|
return {
|
|
556
615
|
relationship: rel,
|
|
557
616
|
relatedEntityName: rel.RelatedEntity,
|
|
558
|
-
|
|
617
|
+
displayName: displayNames[index],
|
|
618
|
+
key: this.relationshipRowKey(rel),
|
|
619
|
+
count: result.Success ? result.TotalRowCount ?? 0 : 0,
|
|
559
620
|
isExpanded: false,
|
|
560
621
|
records: [],
|
|
561
622
|
isLoadingRecords: false
|
|
@@ -565,9 +626,12 @@ export class EntityRecordDetailPanelComponent extends BaseAngularComponent {
|
|
|
565
626
|
catch (error) {
|
|
566
627
|
console.warn('Failed to load relationship counts:', error);
|
|
567
628
|
// Initialize with zero counts on error
|
|
568
|
-
|
|
629
|
+
const displayNames = this.buildRelatedEntityDisplayNames(relationships);
|
|
630
|
+
this.RelatedEntities = relationships.map((rel, index) => ({
|
|
569
631
|
relationship: rel,
|
|
570
632
|
relatedEntityName: rel.RelatedEntity,
|
|
633
|
+
displayName: displayNames[index],
|
|
634
|
+
key: this.relationshipRowKey(rel),
|
|
571
635
|
count: 0,
|
|
572
636
|
isExpanded: false,
|
|
573
637
|
records: [],
|
|
@@ -627,7 +691,7 @@ export class EntityRecordDetailPanelComponent extends BaseAngularComponent {
|
|
|
627
691
|
organicKey: pair.organicKey,
|
|
628
692
|
relatedEntity: pair.relatedEntity,
|
|
629
693
|
relatedEntityName: pair.relatedEntity.DisplayName || pair.relatedEntity.RelatedEntity,
|
|
630
|
-
count: result.Success ? result.TotalRowCount : 0,
|
|
694
|
+
count: result.Success ? result.TotalRowCount ?? 0 : 0,
|
|
631
695
|
isExpanded: false,
|
|
632
696
|
records: [],
|
|
633
697
|
isLoadingRecords: false,
|
|
@@ -1312,7 +1376,7 @@ export class EntityRecordDetailPanelComponent extends BaseAngularComponent {
|
|
|
1312
1376
|
}
|
|
1313
1377
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityRecordDetailPanelComponent, [{
|
|
1314
1378
|
type: Component,
|
|
1315
|
-
args: [{ standalone: false, selector: 'mj-entity-record-detail-panel', template: "<div class=\"entity-record-card-container\">\n <!-- Header -->\n <div class=\"panel-header\">\n <div class=\"panel-title-row\">\n @if (entity?.Icon) {\n <i [class]=\"getEntityIconClass()\" class=\"entity-icon\"></i>\n }\n <h3 class=\"panel-title\">{{ recordTitle }}</h3>\n </div>\n <button class=\"close-btn\" (click)=\"onClose()\" title=\"Close\" aria-label=\"Close panel\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n\n <!-- Content -->\n <div class=\"panel-content\">\n <!-- Details Section -->\n <mj-accordion-panel [(Expanded)]=\"detailsSectionExpanded\" [TitleIconMuted]=\"true\">\n <ng-template mjAccordionTitle>\n <i class=\"fa-solid fa-info-circle\"></i>\n <span>Details</span>\n </ng-template>\n\n @for (field of displayFields; track field.name) {\n <!-- Primary Key Field - Compact with copy button -->\n @if (field.type === 'primary-key') {\n <div class=\"field-row field-row-pk\">\n <div class=\"pk-row\">\n <i class=\"fa-solid fa-key pk-icon\"></i>\n <span class=\"field-label\">{{ field.label }}</span>\n <button class=\"copy-btn\" (click)=\"copyToClipboard(field.value, $event)\" title=\"Copy ID\">\n <i class=\"fa-solid fa-copy\"></i>\n </button>\n </div>\n </div>\n }\n <!-- Foreign Key Field - Show friendly name with open button -->\n @else if (field.type === 'foreign-key') {\n <div class=\"field-row field-row-fk\">\n <span class=\"field-label\">{{ field.label }}</span>\n <div class=\"fk-value-row\" [class.fk-id-only]=\"!hasFriendlyName(field)\">\n @if (hasFriendlyName(field)) {\n <span class=\"field-value fk-display-value\">{{ field.displayValue }}</span>\n } @else {\n <!-- No friendly name available, show ID in muted style -->\n <span class=\"field-value fk-id-value\">{{ field.value }}</span>\n }\n <!-- Always show open button for FK fields that have a related entity -->\n @if (field.relatedEntityName) {\n <button class=\"fk-link-btn\" (click)=\"onForeignKeyClick(field, $event)\" title=\"Open {{ field.relatedEntityName }} record\">\n <i class=\"fa-solid fa-external-link-alt\"></i>\n </button>\n }\n </div>\n </div>\n }\n <!-- Enum Field - Show as pill -->\n @else if (field.type === 'enum') {\n <div class=\"field-row\">\n <span class=\"field-label\">{{ field.label }}</span>\n <mj-pill [value]=\"field.value\"></mj-pill>\n </div>\n }\n <!-- Regular Field -->\n @else {\n <div class=\"field-row\">\n <span class=\"field-label\">{{ field.label }}</span>\n <span class=\"field-value\">{{ field.value }}</span>\n </div>\n }\n }\n\n @if (displayFields.length === 0) {\n <mj-empty-state\n Size=\"compact\"\n Icon=\"fa-solid fa-circle-info\"\n Title=\"No details available\" />\n }\n </mj-accordion-panel>\n\n <!-- Relationships Section -->\n <mj-accordion-panel [(Expanded)]=\"relationshipsSectionExpanded\" [TitleIconMuted]=\"true\">\n <ng-template mjAccordionTitle>\n <i class=\"fa-solid fa-project-diagram\"></i>\n <span>Related Records</span>\n </ng-template>\n\n @if (isLoadingRelationships) {\n <div class=\"relationships-loading\">\n <mj-loading text=\"Loading related records...\" size=\"small\"></mj-loading>\n </div>\n } @else if (relatedEntitiesWithRecords.length === 0) {\n <mj-empty-state\n Size=\"compact\"\n Icon=\"fa-solid fa-diagram-project\"\n Title=\"No related records\" />\n } @else {\n @for (relEntity of relatedEntitiesWithRecords; track relEntity.relatedEntityName) {\n <div class=\"related-entity-group\" [class.expanded]=\"relEntity.isExpanded\">\n <!-- Header row - click to expand -->\n <div\n class=\"related-entity-header\"\n [class.clickable]=\"relEntity.count > 0\"\n (click)=\"toggleRelatedEntityExpansion(relEntity, $event)\">\n <i class=\"fa-solid expand-chevron\"\n [class.fa-chevron-down]=\"relEntity.isExpanded\"\n [class.fa-chevron-right]=\"!relEntity.isExpanded\"></i>\n <i [class]=\"getRelatedEntityIcon(relEntity)\"></i>\n <span class=\"related-entity-name\">{{ relEntity.relatedEntityName }}</span>\n <span class=\"related-entity-count\">{{ relEntity.count }}</span>\n </div>\n\n <!-- Expanded records list -->\n @if (relEntity.isExpanded) {\n <div class=\"related-records-list\">\n @if (relEntity.isLoadingRecords) {\n <div class=\"records-loading\">\n <mj-loading text=\"Loading...\" size=\"small\"></mj-loading>\n </div>\n } @else {\n @for (rec of relEntity.records; track $index) {\n <div class=\"related-record-item\" (click)=\"onRelatedRecordClick(relEntity, rec, $event)\">\n <div class=\"record-info\">\n <span class=\"record-name\">{{ getRelatedRecordDisplayName(relEntity, rec) }}</span>\n @if (getRelatedRecordSubtitle(relEntity, rec); as subtitle) {\n <span class=\"record-subtitle\">{{ subtitle }}</span>\n }\n </div>\n <i class=\"fa-solid fa-external-link-alt record-open-icon\"></i>\n </div>\n }\n\n <!-- View All link if there are more records -->\n @if (relEntity.count > 10) {\n <div class=\"view-all-link\" (click)=\"onViewAllRelated(relEntity, $event)\">\n <span>View all {{ relEntity.count }} records</span>\n <i class=\"fa-solid fa-arrow-right\"></i>\n </div>\n }\n }\n </div>\n }\n </div>\n }\n }\n </mj-accordion-panel>\n\n <!-- Organic Key Matches Section -->\n @if (organicKeyMatches.length > 0 || isLoadingOrganicKeys) {\n <mj-accordion-panel [(Expanded)]=\"organicKeysSectionExpanded\" [TitleIconMuted]=\"true\">\n <ng-template mjAccordionTitle>\n <i class=\"fa-solid fa-link\"></i>\n <span>Organic Key Matches</span>\n </ng-template>\n\n @if (isLoadingOrganicKeys) {\n <div class=\"relationships-loading\">\n <mj-loading text=\"Loading organic key matches...\" size=\"small\"></mj-loading>\n </div>\n } @else if (organicKeyMatchesWithRecords.length === 0) {\n <mj-empty-state\n Size=\"compact\"\n Icon=\"fa-solid fa-link\"\n Title=\"No organic key matches\" />\n } @else {\n @for (match of organicKeyMatchesWithRecords; track match.relatedEntityName) {\n <div class=\"related-entity-group\" [class.expanded]=\"match.isExpanded\">\n <div\n class=\"related-entity-header\"\n [class.clickable]=\"match.count > 0\"\n (click)=\"toggleOrganicKeyExpansion(match, $event)\">\n <i class=\"fa-solid expand-chevron\"\n [class.fa-chevron-down]=\"match.isExpanded\"\n [class.fa-chevron-right]=\"!match.isExpanded\"></i>\n <i [class]=\"getOrganicKeyEntityIcon(match)\"></i>\n <span class=\"related-entity-name\">{{ match.relatedEntityName }}</span>\n <span class=\"related-entity-count\">{{ match.count }}</span>\n </div>\n\n @if (match.isExpanded) {\n <div class=\"related-records-list\">\n @if (match.isLoadingRecords) {\n <div class=\"records-loading\">\n <mj-loading text=\"Loading...\" size=\"small\"></mj-loading>\n </div>\n } @else {\n @for (rec of match.records; track $index) {\n <div class=\"related-record-item\" (click)=\"onOrganicKeyRecordClick(match, rec, $event)\">\n <div class=\"record-info\">\n <span class=\"record-name\">{{ getOrganicKeyRecordDisplayName(match, rec) }}</span>\n @if (getOrganicKeyRecordSubtitle(match, rec); as subtitle) {\n <span class=\"record-subtitle\">{{ subtitle }}</span>\n }\n </div>\n <i class=\"fa-solid fa-external-link-alt record-open-icon\"></i>\n </div>\n }\n\n @if (match.count > 10) {\n <div class=\"view-all-link\" (click)=\"onViewAllOrganicKey(match, $event)\">\n <span>View all {{ match.count }} records</span>\n <i class=\"fa-solid fa-arrow-right\"></i>\n </div>\n }\n }\n </div>\n }\n </div>\n }\n }\n </mj-accordion-panel>\n }\n </div>\n\n <!-- Footer -->\n <div class=\"panel-footer\">\n <button class=\"open-record-btn\" (click)=\"onOpenRecord()\">\n <i class=\"fa-solid fa-external-link-alt\"></i>\n Open Full Record\n </button>\n </div>\n</div>\n", styles: [".entity-record-card-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--mj-bg-surface);\n}\n\n.panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n}\n\n.panel-title-row {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n flex: 1;\n}\n\n.entity-icon {\n font-size: 18px;\n color: var(--mj-text-muted);\n flex-shrink: 0;\n}\n\n.panel-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.close-btn {\n width: 32px;\n height: 32px;\n border: none;\n background: transparent;\n border-radius: 6px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-muted);\n transition: all 0.15s ease;\n flex-shrink: 0;\n}\n.close-btn:hover {\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-secondary);\n}\n\n.panel-content {\n flex: 1;\n overflow-y: auto;\n padding: 8px 0;\n}\n\n/* Section header / chevron / title / icon / body chrome is fully provided by\n <mj-accordion-panel> (muted icons via [TitleIconMuted]). No bespoke chrome here. */\n.loading-icon {\n margin-right: 8px;\n font-size: 12px;\n color: var(--mj-text-disabled);\n}\n\n.relationships-loading {\n padding: 20px 0;\n display: flex;\n justify-content: center;\n}\n\n.field-row {\n display: flex;\n flex-direction: column;\n padding: 8px 0;\n border-bottom: 1px solid var(--mj-bg-surface-card);\n}\n.field-row:last-child {\n border-bottom: none;\n}\n\n.field-label {\n font-size: 11px;\n font-weight: 500;\n color: var(--mj-text-disabled);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 2px;\n}\n\n.field-value {\n font-size: 14px;\n color: var(--mj-text-secondary);\n word-break: break-word;\n}\n\n/* Primary Key Field - Compact row with key icon and copy button */\n.field-row-pk {\n flex-direction: row;\n padding: 6px 0;\n}\n\n.pk-row {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n}\n\n.pk-icon {\n font-size: 12px;\n color: var(--mj-text-disabled);\n}\n\n.pk-row .field-label {\n margin-bottom: 0;\n flex: 1;\n}\n\n.copy-btn {\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-disabled);\n transition: all 0.15s ease;\n flex-shrink: 0;\n}\n.copy-btn:hover {\n background: var(--mj-bg-surface-sunken);\n color: var(--mj-brand-primary);\n}\n.copy-btn i {\n font-size: 12px;\n}\n\n/* Foreign Key Field - Display name with link button */\n.field-row-fk {\n padding: 8px 0;\n}\n\n.fk-value-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.fk-display-value {\n flex: 1;\n color: var(--mj-text-primary);\n font-weight: 500;\n}\n\n.fk-link-btn {\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-disabled);\n transition: all 0.15s ease;\n flex-shrink: 0;\n}\n.fk-link-btn:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n.fk-link-btn i {\n font-size: 11px;\n}\n\n/* FK without friendly name - show ID in muted style */\n.fk-id-only {\n background: var(--mj-bg-surface-card);\n border-radius: 4px;\n padding: 4px 8px;\n}\n\n.fk-id-value {\n font-size: 12px;\n font-family: monospace;\n color: var(--mj-text-muted);\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Related Entity Group - expandable container */\n.related-entity-group {\n margin-bottom: 4px;\n border-radius: 6px;\n overflow: hidden;\n}\n.related-entity-group.expanded {\n background: var(--mj-bg-surface-card);\n margin-bottom: 8px;\n}\n\n/* Header row */\n.related-entity-header {\n display: flex;\n align-items: center;\n padding: 10px 12px;\n border-radius: 6px;\n gap: 8px;\n transition: background 0.15s ease;\n}\n.related-entity-header.clickable {\n cursor: pointer;\n}\n.related-entity-header.clickable:hover {\n background: var(--mj-bg-surface-sunken);\n}\n.related-entity-header.loading {\n opacity: 0.7;\n}\n\n.expand-chevron {\n width: 12px;\n font-size: 10px;\n color: var(--mj-text-disabled);\n transition: transform 0.15s ease;\n}\n\n.related-entity-header i:nth-child(2) {\n width: 16px;\n font-size: 13px;\n color: var(--mj-text-muted);\n}\n\n.related-entity-name {\n flex: 1;\n font-size: 13px;\n color: var(--mj-text-secondary);\n}\n\n.related-entity-count {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-muted);\n min-width: 24px;\n text-align: right;\n}\n\n/* Expanded records list */\n.related-records-list {\n padding: 4px 8px 8px 32px;\n}\n\n.records-loading {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 0;\n color: var(--mj-text-disabled);\n font-size: 12px;\n}\n\n.related-record-item {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n margin-bottom: 2px;\n background: var(--mj-bg-surface);\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid var(--mj-border-default);\n}\n.related-record-item:hover {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 1px 4px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n}\n.related-record-item:hover .record-open-icon {\n color: var(--mj-brand-primary);\n}\n\n.record-info {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.record-name {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.record-subtitle {\n font-size: 11px;\n color: var(--mj-text-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.record-open-icon {\n font-size: 11px;\n color: var(--mj-text-disabled);\n margin-left: 8px;\n flex-shrink: 0;\n transition: color 0.15s ease;\n}\n\n.view-all-link {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 10px;\n margin-top: 4px;\n font-size: 12px;\n font-weight: 500;\n color: var(--mj-brand-primary);\n cursor: pointer;\n border-radius: 6px;\n transition: background 0.15s ease;\n}\n.view-all-link:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n}\n\n.panel-footer {\n padding: 16px 20px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n}\n\n.open-record-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n transition: all 0.15s ease;\n}\n.open-record-btn:hover {\n background: var(--mj-brand-primary-hover);\n}\n.open-record-btn:active {\n transform: scale(0.98);\n}\n"] }]
|
|
1379
|
+
args: [{ standalone: false, selector: 'mj-entity-record-detail-panel', template: "<div class=\"entity-record-card-container\">\n <!-- Header -->\n <div class=\"panel-header\">\n <div class=\"panel-title-row\">\n @if (entity?.Icon) {\n <i [class]=\"getEntityIconClass()\" class=\"entity-icon\"></i>\n }\n <h3 class=\"panel-title\">{{ recordTitle }}</h3>\n </div>\n <button class=\"close-btn\" (click)=\"onClose()\" title=\"Close\" aria-label=\"Close panel\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n\n <!-- Content -->\n <div class=\"panel-content\">\n <!-- Details Section -->\n <mj-accordion-panel [(Expanded)]=\"detailsSectionExpanded\" [TitleIconMuted]=\"true\">\n <ng-template mjAccordionTitle>\n <i class=\"fa-solid fa-info-circle\"></i>\n <span>Details</span>\n </ng-template>\n\n @for (field of displayFields; track field.name) {\n <!-- Primary Key Field - Compact with copy button -->\n @if (field.type === 'primary-key') {\n <div class=\"field-row field-row-pk\">\n <div class=\"pk-row\">\n <i class=\"fa-solid fa-key pk-icon\"></i>\n <span class=\"field-label\">{{ field.label }}</span>\n <button class=\"copy-btn\" (click)=\"copyToClipboard(field.value, $event)\" title=\"Copy ID\">\n <i class=\"fa-solid fa-copy\"></i>\n </button>\n </div>\n </div>\n }\n <!-- Foreign Key Field - Show friendly name with open button -->\n @else if (field.type === 'foreign-key') {\n <div class=\"field-row field-row-fk\">\n <span class=\"field-label\">{{ field.label }}</span>\n <div class=\"fk-value-row\" [class.fk-id-only]=\"!hasFriendlyName(field)\">\n @if (hasFriendlyName(field)) {\n <span class=\"field-value fk-display-value\">{{ field.displayValue }}</span>\n } @else {\n <!-- No friendly name available, show ID in muted style -->\n <span class=\"field-value fk-id-value\">{{ field.value }}</span>\n }\n <!-- Always show open button for FK fields that have a related entity -->\n @if (field.relatedEntityName) {\n <button class=\"fk-link-btn\" (click)=\"onForeignKeyClick(field, $event)\" title=\"Open {{ field.relatedEntityName }} record\">\n <i class=\"fa-solid fa-external-link-alt\"></i>\n </button>\n }\n </div>\n </div>\n }\n <!-- Enum Field - Show as pill -->\n @else if (field.type === 'enum') {\n <div class=\"field-row\">\n <span class=\"field-label\">{{ field.label }}</span>\n <mj-pill [value]=\"field.value\"></mj-pill>\n </div>\n }\n <!-- Regular Field -->\n @else {\n <div class=\"field-row\">\n <span class=\"field-label\">{{ field.label }}</span>\n <span class=\"field-value\">{{ field.value }}</span>\n </div>\n }\n }\n\n @if (displayFields.length === 0) {\n <mj-empty-state\n Size=\"compact\"\n Icon=\"fa-solid fa-circle-info\"\n Title=\"No details available\" />\n }\n </mj-accordion-panel>\n\n <!-- Relationships Section -->\n <mj-accordion-panel [(Expanded)]=\"relationshipsSectionExpanded\" [TitleIconMuted]=\"true\">\n <ng-template mjAccordionTitle>\n <i class=\"fa-solid fa-project-diagram\"></i>\n <span>Related Records</span>\n </ng-template>\n\n @if (isLoadingRelationships) {\n <div class=\"relationships-loading\">\n <mj-loading text=\"Loading related records...\" size=\"small\"></mj-loading>\n </div>\n } @else if (relatedEntitiesWithRecords.length === 0) {\n <mj-empty-state\n Size=\"compact\"\n Icon=\"fa-solid fa-diagram-project\"\n Title=\"No related records\" />\n } @else {\n <!-- track on `key` (the relationship id), NOT the entity name: two foreign keys to\n one entity share a name, which is a duplicate @for key (NG0955) and lets Angular\n reuse the wrong node between the two grids. -->\n @for (relEntity of relatedEntitiesWithRecords; track relEntity.key) {\n <div class=\"related-entity-group\" [class.expanded]=\"relEntity.isExpanded\">\n <!-- Header row - click to expand -->\n <div\n class=\"related-entity-header\"\n [class.clickable]=\"relEntity.count > 0\"\n (click)=\"toggleRelatedEntityExpansion(relEntity, $event)\">\n <i class=\"fa-solid expand-chevron\"\n [class.fa-chevron-down]=\"relEntity.isExpanded\"\n [class.fa-chevron-right]=\"!relEntity.isExpanded\"></i>\n <i [class]=\"getRelatedEntityIcon(relEntity)\"></i>\n <span class=\"related-entity-name\">{{ relEntity.displayName }}</span>\n <span class=\"related-entity-count\">{{ relEntity.count }}</span>\n </div>\n\n <!-- Expanded records list -->\n @if (relEntity.isExpanded) {\n <div class=\"related-records-list\">\n @if (relEntity.isLoadingRecords) {\n <div class=\"records-loading\">\n <mj-loading text=\"Loading...\" size=\"small\"></mj-loading>\n </div>\n } @else {\n @for (rec of relEntity.records; track $index) {\n <div class=\"related-record-item\" (click)=\"onRelatedRecordClick(relEntity, rec, $event)\">\n <div class=\"record-info\">\n <span class=\"record-name\">{{ getRelatedRecordDisplayName(relEntity, rec) }}</span>\n @if (getRelatedRecordSubtitle(relEntity, rec); as subtitle) {\n <span class=\"record-subtitle\">{{ subtitle }}</span>\n }\n </div>\n <i class=\"fa-solid fa-external-link-alt record-open-icon\"></i>\n </div>\n }\n\n <!-- View All link if there are more records -->\n @if (relEntity.count > 10) {\n <div class=\"view-all-link\" (click)=\"onViewAllRelated(relEntity, $event)\">\n <span>View all {{ relEntity.count }} records</span>\n <i class=\"fa-solid fa-arrow-right\"></i>\n </div>\n }\n }\n </div>\n }\n </div>\n }\n }\n </mj-accordion-panel>\n\n <!-- Organic Key Matches Section -->\n @if (organicKeyMatches.length > 0 || isLoadingOrganicKeys) {\n <mj-accordion-panel [(Expanded)]=\"organicKeysSectionExpanded\" [TitleIconMuted]=\"true\">\n <ng-template mjAccordionTitle>\n <i class=\"fa-solid fa-link\"></i>\n <span>Organic Key Matches</span>\n </ng-template>\n\n @if (isLoadingOrganicKeys) {\n <div class=\"relationships-loading\">\n <mj-loading text=\"Loading organic key matches...\" size=\"small\"></mj-loading>\n </div>\n } @else if (organicKeyMatchesWithRecords.length === 0) {\n <mj-empty-state\n Size=\"compact\"\n Icon=\"fa-solid fa-link\"\n Title=\"No organic key matches\" />\n } @else {\n @for (match of organicKeyMatchesWithRecords; track match.relatedEntityName) {\n <div class=\"related-entity-group\" [class.expanded]=\"match.isExpanded\">\n <div\n class=\"related-entity-header\"\n [class.clickable]=\"match.count > 0\"\n (click)=\"toggleOrganicKeyExpansion(match, $event)\">\n <i class=\"fa-solid expand-chevron\"\n [class.fa-chevron-down]=\"match.isExpanded\"\n [class.fa-chevron-right]=\"!match.isExpanded\"></i>\n <i [class]=\"getOrganicKeyEntityIcon(match)\"></i>\n <span class=\"related-entity-name\">{{ match.relatedEntityName }}</span>\n <span class=\"related-entity-count\">{{ match.count }}</span>\n </div>\n\n @if (match.isExpanded) {\n <div class=\"related-records-list\">\n @if (match.isLoadingRecords) {\n <div class=\"records-loading\">\n <mj-loading text=\"Loading...\" size=\"small\"></mj-loading>\n </div>\n } @else {\n @for (rec of match.records; track $index) {\n <div class=\"related-record-item\" (click)=\"onOrganicKeyRecordClick(match, rec, $event)\">\n <div class=\"record-info\">\n <span class=\"record-name\">{{ getOrganicKeyRecordDisplayName(match, rec) }}</span>\n @if (getOrganicKeyRecordSubtitle(match, rec); as subtitle) {\n <span class=\"record-subtitle\">{{ subtitle }}</span>\n }\n </div>\n <i class=\"fa-solid fa-external-link-alt record-open-icon\"></i>\n </div>\n }\n\n @if (match.count > 10) {\n <div class=\"view-all-link\" (click)=\"onViewAllOrganicKey(match, $event)\">\n <span>View all {{ match.count }} records</span>\n <i class=\"fa-solid fa-arrow-right\"></i>\n </div>\n }\n }\n </div>\n }\n </div>\n }\n }\n </mj-accordion-panel>\n }\n </div>\n\n <!-- Footer -->\n <div class=\"panel-footer\">\n <button class=\"open-record-btn\" (click)=\"onOpenRecord()\">\n <i class=\"fa-solid fa-external-link-alt\"></i>\n Open Full Record\n </button>\n </div>\n</div>\n", styles: [".entity-record-card-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--mj-bg-surface);\n}\n\n.panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px;\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n}\n\n.panel-title-row {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n flex: 1;\n}\n\n.entity-icon {\n font-size: 18px;\n color: var(--mj-text-muted);\n flex-shrink: 0;\n}\n\n.panel-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.close-btn {\n width: 32px;\n height: 32px;\n border: none;\n background: transparent;\n border-radius: 6px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-muted);\n transition: all 0.15s ease;\n flex-shrink: 0;\n}\n.close-btn:hover {\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-secondary);\n}\n\n.panel-content {\n flex: 1;\n overflow-y: auto;\n padding: 8px 0;\n}\n\n/* Section header / chevron / title / icon / body chrome is fully provided by\n <mj-accordion-panel> (muted icons via [TitleIconMuted]). No bespoke chrome here. */\n.loading-icon {\n margin-right: 8px;\n font-size: 12px;\n color: var(--mj-text-disabled);\n}\n\n.relationships-loading {\n padding: 20px 0;\n display: flex;\n justify-content: center;\n}\n\n.field-row {\n display: flex;\n flex-direction: column;\n padding: 8px 0;\n border-bottom: 1px solid var(--mj-bg-surface-card);\n}\n.field-row:last-child {\n border-bottom: none;\n}\n\n.field-label {\n font-size: 11px;\n font-weight: 500;\n color: var(--mj-text-disabled);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 2px;\n}\n\n.field-value {\n font-size: 14px;\n color: var(--mj-text-secondary);\n word-break: break-word;\n}\n\n/* Primary Key Field - Compact row with key icon and copy button */\n.field-row-pk {\n flex-direction: row;\n padding: 6px 0;\n}\n\n.pk-row {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n}\n\n.pk-icon {\n font-size: 12px;\n color: var(--mj-text-disabled);\n}\n\n.pk-row .field-label {\n margin-bottom: 0;\n flex: 1;\n}\n\n.copy-btn {\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-disabled);\n transition: all 0.15s ease;\n flex-shrink: 0;\n}\n.copy-btn:hover {\n background: var(--mj-bg-surface-sunken);\n color: var(--mj-brand-primary);\n}\n.copy-btn i {\n font-size: 12px;\n}\n\n/* Foreign Key Field - Display name with link button */\n.field-row-fk {\n padding: 8px 0;\n}\n\n.fk-value-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.fk-display-value {\n flex: 1;\n color: var(--mj-text-primary);\n font-weight: 500;\n}\n\n.fk-link-btn {\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mj-text-disabled);\n transition: all 0.15s ease;\n flex-shrink: 0;\n}\n.fk-link-btn:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n.fk-link-btn i {\n font-size: 11px;\n}\n\n/* FK without friendly name - show ID in muted style */\n.fk-id-only {\n background: var(--mj-bg-surface-card);\n border-radius: 4px;\n padding: 4px 8px;\n}\n\n.fk-id-value {\n font-size: 12px;\n font-family: monospace;\n color: var(--mj-text-muted);\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Related Entity Group - expandable container */\n.related-entity-group {\n margin-bottom: 4px;\n border-radius: 6px;\n overflow: hidden;\n}\n.related-entity-group.expanded {\n background: var(--mj-bg-surface-card);\n margin-bottom: 8px;\n}\n\n/* Header row */\n.related-entity-header {\n display: flex;\n align-items: center;\n padding: 10px 12px;\n border-radius: 6px;\n gap: 8px;\n transition: background 0.15s ease;\n}\n.related-entity-header.clickable {\n cursor: pointer;\n}\n.related-entity-header.clickable:hover {\n background: var(--mj-bg-surface-sunken);\n}\n.related-entity-header.loading {\n opacity: 0.7;\n}\n\n.expand-chevron {\n width: 12px;\n font-size: 10px;\n color: var(--mj-text-disabled);\n transition: transform 0.15s ease;\n}\n\n.related-entity-header i:nth-child(2) {\n width: 16px;\n font-size: 13px;\n color: var(--mj-text-muted);\n}\n\n.related-entity-name {\n flex: 1;\n font-size: 13px;\n color: var(--mj-text-secondary);\n}\n\n.related-entity-count {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-muted);\n min-width: 24px;\n text-align: right;\n}\n\n/* Expanded records list */\n.related-records-list {\n padding: 4px 8px 8px 32px;\n}\n\n.records-loading {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 0;\n color: var(--mj-text-disabled);\n font-size: 12px;\n}\n\n.related-record-item {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n margin-bottom: 2px;\n background: var(--mj-bg-surface);\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid var(--mj-border-default);\n}\n.related-record-item:hover {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 1px 4px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n}\n.related-record-item:hover .record-open-icon {\n color: var(--mj-brand-primary);\n}\n\n.record-info {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.record-name {\n font-size: 13px;\n font-weight: 500;\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.record-subtitle {\n font-size: 11px;\n color: var(--mj-text-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.record-open-icon {\n font-size: 11px;\n color: var(--mj-text-disabled);\n margin-left: 8px;\n flex-shrink: 0;\n transition: color 0.15s ease;\n}\n\n.view-all-link {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 10px;\n margin-top: 4px;\n font-size: 12px;\n font-weight: 500;\n color: var(--mj-brand-primary);\n cursor: pointer;\n border-radius: 6px;\n transition: background 0.15s ease;\n}\n.view-all-link:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n}\n\n.panel-footer {\n padding: 16px 20px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n}\n\n.open-record-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n transition: all 0.15s ease;\n}\n.open-record-btn:hover {\n background: var(--mj-brand-primary-hover);\n}\n.open-record-btn:active {\n transform: scale(0.98);\n}\n"] }]
|
|
1316
1380
|
}], () => [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }], { entity: [{
|
|
1317
1381
|
type: Input
|
|
1318
1382
|
}], record: [{
|
|
@@ -1336,5 +1400,5 @@ export class EntityRecordDetailPanelComponent extends BaseAngularComponent {
|
|
|
1336
1400
|
}], openForeignKeyRecord: [{
|
|
1337
1401
|
type: Output
|
|
1338
1402
|
}] }); })();
|
|
1339
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityRecordDetailPanelComponent, { className: "EntityRecordDetailPanelComponent", filePath: "src/lib/entity-record-detail-panel/entity-record-detail-panel.component.ts", lineNumber:
|
|
1403
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityRecordDetailPanelComponent, { className: "EntityRecordDetailPanelComponent", filePath: "src/lib/entity-record-detail-panel/entity-record-detail-panel.component.ts", lineNumber: 120 }); })();
|
|
1340
1404
|
//# sourceMappingURL=entity-record-detail-panel.component.js.map
|