@memberjunction/ng-base-forms 6.2.0-edge.4 → 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 +195 -2
- package/dist/lib/base-form-component.d.ts +23 -1
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +54 -10
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/chrome/form-chrome-coordinator.service.d.ts +9 -0
- package/dist/lib/chrome/form-chrome-coordinator.service.d.ts.map +1 -1
- package/dist/lib/chrome/form-chrome-coordinator.service.js +11 -0
- package/dist/lib/chrome/form-chrome-coordinator.service.js.map +1 -1
- package/dist/lib/chrome/form-composition-snapshot.d.ts +52 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -1
- package/dist/lib/chrome/form-composition-snapshot.js +4 -0
- package/dist/lib/chrome/form-composition-snapshot.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +107 -1
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +1500 -316
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +167 -14
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +1374 -470
- package/dist/lib/field/form-field.component.js.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.d.ts +124 -0
- package/dist/lib/form-record-refresh.coordinator.d.ts.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.js +93 -13
- package/dist/lib/form-record-refresh.coordinator.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +104 -2
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +272 -34
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-card.component.js +7 -4
- package/dist/lib/isa-related-panel/isa-related-card.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.js +1 -2
- package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
- package/dist/lib/links/record-link-utils.d.ts +83 -0
- package/dist/lib/links/record-link-utils.d.ts.map +1 -0
- package/dist/lib/links/record-link-utils.js +232 -0
- package/dist/lib/links/record-link-utils.js.map +1 -0
- package/dist/lib/links/record-link.component.d.ts +50 -0
- package/dist/lib/links/record-link.component.d.ts.map +1 -0
- package/dist/lib/links/record-link.component.js +319 -0
- package/dist/lib/links/record-link.component.js.map +1 -0
- package/dist/lib/links/record-link.directive.d.ts +94 -0
- package/dist/lib/links/record-link.directive.d.ts.map +1 -0
- package/dist/lib/links/record-link.directive.js +277 -0
- package/dist/lib/links/record-link.directive.js.map +1 -0
- package/dist/lib/links/record-links-drawer.component.d.ts +21 -0
- package/dist/lib/links/record-links-drawer.component.d.ts.map +1 -0
- package/dist/lib/links/record-links-drawer.component.js +61 -0
- package/dist/lib/links/record-links-drawer.component.js.map +1 -0
- package/dist/lib/links/record-links.component.d.ts +249 -0
- package/dist/lib/links/record-links.component.d.ts.map +1 -0
- package/dist/lib/links/record-links.component.js +1523 -0
- package/dist/lib/links/record-links.component.js.map +1 -0
- package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.js +5 -0
- package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.js +3 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +6 -0
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/preview-popover/record-preview-popover.component.d.ts +187 -0
- package/dist/lib/preview-popover/record-preview-popover.component.d.ts.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.component.js +1060 -0
- package/dist/lib/preview-popover/record-preview-popover.component.js.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.service.d.ts +105 -0
- package/dist/lib/preview-popover/record-preview-popover.service.d.ts.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.service.js +278 -0
- package/dist/lib/preview-popover/record-preview-popover.service.js.map +1 -0
- package/dist/lib/resolver/form-resolver.service.d.ts +44 -1
- package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
- package/dist/lib/resolver/form-resolver.service.js +51 -3
- package/dist/lib/resolver/form-resolver.service.js.map +1 -1
- package/dist/lib/toolbar/actions/record-links-toolbar-action.d.ts +21 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.d.ts.map +1 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.js +90 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.js.map +1 -0
- package/dist/lib/toolbar/base-form-toolbar-action.d.ts +189 -0
- package/dist/lib/toolbar/base-form-toolbar-action.d.ts.map +1 -0
- package/dist/lib/toolbar/base-form-toolbar-action.js +274 -0
- package/dist/lib/toolbar/base-form-toolbar-action.js.map +1 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts +21 -1
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +295 -195
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts.map +1 -1
- package/dist/lib/types/form-toolbar-item.js.map +1 -1
- package/dist/lib/types/toolbar-config.d.ts +4 -0
- package/dist/lib/types/toolbar-config.d.ts.map +1 -1
- package/dist/lib/types/toolbar-config.js +6 -0
- package/dist/lib/types/toolbar-config.js.map +1 -1
- package/dist/module.d.ts +19 -14
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +39 -6
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +9 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +9 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1,1523 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef, inject } from '@angular/core';
|
|
2
|
+
import { CompositeKey, KeyValuePair, RunView } from '@memberjunction/core';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
const _forTrack0 = ($index, $item) => $item.EntityName ?? "__all__";
|
|
6
|
+
const _forTrack1 = ($index, $item) => $item.EntityName;
|
|
7
|
+
const _forTrack2 = ($index, $item) => $item.TrackKey;
|
|
8
|
+
function MjRecordLinksComponent_Conditional_0_Conditional_0_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
9
|
+
i0.ɵɵelementStart(0, "span", 10);
|
|
10
|
+
i0.ɵɵtext(1);
|
|
11
|
+
i0.ɵɵelementEnd();
|
|
12
|
+
} if (rf & 2) {
|
|
13
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
14
|
+
i0.ɵɵadvance();
|
|
15
|
+
i0.ɵɵtextInterpolate(ctx_r1.TotalLinkCount);
|
|
16
|
+
} }
|
|
17
|
+
function MjRecordLinksComponent_Conditional_0_Conditional_0_ng_container_18_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵelementContainer(0);
|
|
19
|
+
} }
|
|
20
|
+
function MjRecordLinksComponent_Conditional_0_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
21
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
22
|
+
i0.ɵɵelementStart(0, "div", 2);
|
|
23
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_Conditional_0_Conditional_0_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnClose()); });
|
|
24
|
+
i0.ɵɵelementEnd();
|
|
25
|
+
i0.ɵɵelementStart(1, "aside", 3)(2, "div", 4)(3, "div", 5)(4, "span", 6);
|
|
26
|
+
i0.ɵɵelement(5, "i", 7);
|
|
27
|
+
i0.ɵɵelementEnd();
|
|
28
|
+
i0.ɵɵelementStart(6, "div", 8)(7, "h3", 9);
|
|
29
|
+
i0.ɵɵtext(8, " Links ");
|
|
30
|
+
i0.ɵɵconditionalCreate(9, MjRecordLinksComponent_Conditional_0_Conditional_0_Conditional_9_Template, 2, 1, "span", 10);
|
|
31
|
+
i0.ɵɵelementEnd();
|
|
32
|
+
i0.ɵɵelementStart(10, "span", 11);
|
|
33
|
+
i0.ɵɵtext(11, "Connected records across your workspace");
|
|
34
|
+
i0.ɵɵelementEnd()()();
|
|
35
|
+
i0.ɵɵelementStart(12, "div", 12)(13, "button", 13);
|
|
36
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_Conditional_0_Conditional_0_Template_button_click_13_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.LoadLinks(true)); });
|
|
37
|
+
i0.ɵɵelement(14, "i", 14);
|
|
38
|
+
i0.ɵɵelementEnd();
|
|
39
|
+
i0.ɵɵelementStart(15, "button", 15);
|
|
40
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_Conditional_0_Conditional_0_Template_button_click_15_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnClose()); });
|
|
41
|
+
i0.ɵɵelement(16, "i", 16);
|
|
42
|
+
i0.ɵɵelementEnd()()();
|
|
43
|
+
i0.ɵɵelementStart(17, "div", 17);
|
|
44
|
+
i0.ɵɵtemplate(18, MjRecordLinksComponent_Conditional_0_Conditional_0_ng_container_18_Template, 1, 0, "ng-container", 18);
|
|
45
|
+
i0.ɵɵelementEnd()();
|
|
46
|
+
} if (rf & 2) {
|
|
47
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
48
|
+
const linksContentTpl_r3 = i0.ɵɵreference(3);
|
|
49
|
+
i0.ɵɵadvance(9);
|
|
50
|
+
i0.ɵɵconditional(ctx_r1.TotalLinkCount > 0 ? 9 : -1);
|
|
51
|
+
i0.ɵɵadvance(4);
|
|
52
|
+
i0.ɵɵproperty("disabled", ctx_r1.IsLoading);
|
|
53
|
+
i0.ɵɵadvance();
|
|
54
|
+
i0.ɵɵclassProp("fa-spin", ctx_r1.IsLoading);
|
|
55
|
+
i0.ɵɵadvance(4);
|
|
56
|
+
i0.ɵɵproperty("ngTemplateOutlet", linksContentTpl_r3);
|
|
57
|
+
} }
|
|
58
|
+
function MjRecordLinksComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
59
|
+
i0.ɵɵconditionalCreate(0, MjRecordLinksComponent_Conditional_0_Conditional_0_Template, 19, 5);
|
|
60
|
+
} if (rf & 2) {
|
|
61
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
62
|
+
i0.ɵɵconditional(ctx_r1.IsOpen ? 0 : -1);
|
|
63
|
+
} }
|
|
64
|
+
function MjRecordLinksComponent_Conditional_1_ng_container_1_Template(rf, ctx) { if (rf & 1) {
|
|
65
|
+
i0.ɵɵelementContainer(0);
|
|
66
|
+
} }
|
|
67
|
+
function MjRecordLinksComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
68
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
69
|
+
i0.ɵɵtemplate(1, MjRecordLinksComponent_Conditional_1_ng_container_1_Template, 1, 0, "ng-container", 18);
|
|
70
|
+
i0.ɵɵelementEnd();
|
|
71
|
+
} if (rf & 2) {
|
|
72
|
+
i0.ɵɵnextContext();
|
|
73
|
+
const linksContentTpl_r3 = i0.ɵɵreference(3);
|
|
74
|
+
i0.ɵɵadvance();
|
|
75
|
+
i0.ɵɵproperty("ngTemplateOutlet", linksContentTpl_r3);
|
|
76
|
+
} }
|
|
77
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
78
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
79
|
+
i0.ɵɵelementStart(0, "div", 20)(1, "button", 35);
|
|
80
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_1_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.SetDirectionFilter("all")); });
|
|
81
|
+
i0.ɵɵelementStart(2, "span");
|
|
82
|
+
i0.ɵɵtext(3, "All");
|
|
83
|
+
i0.ɵɵelementEnd();
|
|
84
|
+
i0.ɵɵelementStart(4, "span", 36);
|
|
85
|
+
i0.ɵɵtext(5);
|
|
86
|
+
i0.ɵɵelementEnd()();
|
|
87
|
+
i0.ɵɵelementStart(6, "button", 37);
|
|
88
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_1_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.SetDirectionFilter("outgoing")); });
|
|
89
|
+
i0.ɵɵelement(7, "i", 38);
|
|
90
|
+
i0.ɵɵelementStart(8, "span");
|
|
91
|
+
i0.ɵɵtext(9, "On This Record");
|
|
92
|
+
i0.ɵɵelementEnd();
|
|
93
|
+
i0.ɵɵelementStart(10, "span", 36);
|
|
94
|
+
i0.ɵɵtext(11);
|
|
95
|
+
i0.ɵɵelementEnd()();
|
|
96
|
+
i0.ɵɵelementStart(12, "button", 39);
|
|
97
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_1_Template_button_click_12_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.SetDirectionFilter("incoming")); });
|
|
98
|
+
i0.ɵɵelement(13, "i", 40);
|
|
99
|
+
i0.ɵɵelementStart(14, "span");
|
|
100
|
+
i0.ɵɵtext(15, "Linked To This");
|
|
101
|
+
i0.ɵɵelementEnd();
|
|
102
|
+
i0.ɵɵelementStart(16, "span", 36);
|
|
103
|
+
i0.ɵɵtext(17);
|
|
104
|
+
i0.ɵɵelementEnd()()();
|
|
105
|
+
} if (rf & 2) {
|
|
106
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
107
|
+
i0.ɵɵadvance();
|
|
108
|
+
i0.ɵɵclassProp("mj-links-direction-tab--active", ctx_r1.DirectionFilter === "all");
|
|
109
|
+
i0.ɵɵadvance(4);
|
|
110
|
+
i0.ɵɵtextInterpolate(ctx_r1.TotalLinkCount);
|
|
111
|
+
i0.ɵɵadvance();
|
|
112
|
+
i0.ɵɵclassProp("mj-links-direction-tab--active", ctx_r1.DirectionFilter === "outgoing");
|
|
113
|
+
i0.ɵɵadvance(5);
|
|
114
|
+
i0.ɵɵtextInterpolate(ctx_r1.OutgoingLinkCount);
|
|
115
|
+
i0.ɵɵadvance();
|
|
116
|
+
i0.ɵɵclassProp("mj-links-direction-tab--active", ctx_r1.DirectionFilter === "incoming");
|
|
117
|
+
i0.ɵɵadvance(5);
|
|
118
|
+
i0.ɵɵtextInterpolate(ctx_r1.IncomingLinkCount);
|
|
119
|
+
} }
|
|
120
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
121
|
+
const _r6 = i0.ɵɵgetCurrentView();
|
|
122
|
+
i0.ɵɵelementStart(0, "button", 41);
|
|
123
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r6); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.ClearSearch()); });
|
|
124
|
+
i0.ɵɵelement(1, "i", 16);
|
|
125
|
+
i0.ɵɵelementEnd();
|
|
126
|
+
} }
|
|
127
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_11_Template(rf, ctx) { if (rf & 1) {
|
|
128
|
+
i0.ɵɵelement(0, "span", 28);
|
|
129
|
+
} }
|
|
130
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_12_Template(rf, ctx) { if (rf & 1) {
|
|
131
|
+
const _r7 = i0.ɵɵgetCurrentView();
|
|
132
|
+
i0.ɵɵelementStart(0, "div", 29)(1, "div", 42);
|
|
133
|
+
i0.ɵɵtext(2, "Link Type");
|
|
134
|
+
i0.ɵɵelementEnd();
|
|
135
|
+
i0.ɵɵelementStart(3, "div", 43)(4, "button", 44);
|
|
136
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_12_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r7); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.SetLinkFilter("both")); });
|
|
137
|
+
i0.ɵɵelementStart(5, "span");
|
|
138
|
+
i0.ɵɵtext(6, "All Links");
|
|
139
|
+
i0.ɵɵelementEnd();
|
|
140
|
+
i0.ɵɵelementStart(7, "span", 45);
|
|
141
|
+
i0.ɵɵtext(8);
|
|
142
|
+
i0.ɵɵelementEnd()();
|
|
143
|
+
i0.ɵɵelementStart(9, "button", 44);
|
|
144
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_12_Template_button_click_9_listener() { i0.ɵɵrestoreView(_r7); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.SetLinkFilter("soft")); });
|
|
145
|
+
i0.ɵɵelement(10, "i", 46);
|
|
146
|
+
i0.ɵɵelementStart(11, "span");
|
|
147
|
+
i0.ɵɵtext(12, "Cross-App Links");
|
|
148
|
+
i0.ɵɵelementEnd();
|
|
149
|
+
i0.ɵɵelementStart(13, "span", 45);
|
|
150
|
+
i0.ɵɵtext(14);
|
|
151
|
+
i0.ɵɵelementEnd()();
|
|
152
|
+
i0.ɵɵelementStart(15, "button", 44);
|
|
153
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_12_Template_button_click_15_listener() { i0.ɵɵrestoreView(_r7); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.SetLinkFilter("hard")); });
|
|
154
|
+
i0.ɵɵelement(16, "i", 7);
|
|
155
|
+
i0.ɵɵelementStart(17, "span");
|
|
156
|
+
i0.ɵɵtext(18, "Direct Relationships");
|
|
157
|
+
i0.ɵɵelementEnd();
|
|
158
|
+
i0.ɵɵelementStart(19, "span", 45);
|
|
159
|
+
i0.ɵɵtext(20);
|
|
160
|
+
i0.ɵɵelementEnd()()()();
|
|
161
|
+
} if (rf & 2) {
|
|
162
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
163
|
+
i0.ɵɵadvance(4);
|
|
164
|
+
i0.ɵɵclassProp("mj-links-filter-option--active", ctx_r1.LinkFilter === "both");
|
|
165
|
+
i0.ɵɵadvance(4);
|
|
166
|
+
i0.ɵɵtextInterpolate(ctx_r1.TotalLinkCount);
|
|
167
|
+
i0.ɵɵadvance();
|
|
168
|
+
i0.ɵɵclassProp("mj-links-filter-option--active", ctx_r1.LinkFilter === "soft");
|
|
169
|
+
i0.ɵɵadvance(5);
|
|
170
|
+
i0.ɵɵtextInterpolate(ctx_r1.CrossAppLinkCount);
|
|
171
|
+
i0.ɵɵadvance();
|
|
172
|
+
i0.ɵɵclassProp("mj-links-filter-option--active", ctx_r1.LinkFilter === "hard");
|
|
173
|
+
i0.ɵɵadvance(5);
|
|
174
|
+
i0.ɵɵtextInterpolate(ctx_r1.DirectRelationshipCount);
|
|
175
|
+
} }
|
|
176
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_13_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
177
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
178
|
+
i0.ɵɵelementStart(0, "button", 48);
|
|
179
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_13_For_2_Template_button_click_0_listener() { const chip_r9 = i0.ɵɵrestoreView(_r8).$implicit; const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.SelectCategoryChip(chip_r9.EntityName)); });
|
|
180
|
+
i0.ɵɵelement(1, "i");
|
|
181
|
+
i0.ɵɵelementStart(2, "span", 49);
|
|
182
|
+
i0.ɵɵtext(3);
|
|
183
|
+
i0.ɵɵelementEnd();
|
|
184
|
+
i0.ɵɵelementStart(4, "span", 50);
|
|
185
|
+
i0.ɵɵtext(5);
|
|
186
|
+
i0.ɵɵelementEnd()();
|
|
187
|
+
} if (rf & 2) {
|
|
188
|
+
const chip_r9 = ctx.$implicit;
|
|
189
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
190
|
+
i0.ɵɵclassProp("mj-links-chip--active", ctx_r1.SelectedEntityName === chip_r9.EntityName);
|
|
191
|
+
i0.ɵɵadvance();
|
|
192
|
+
i0.ɵɵclassMap(chip_r9.Icon);
|
|
193
|
+
i0.ɵɵadvance(2);
|
|
194
|
+
i0.ɵɵtextInterpolate(chip_r9.Label);
|
|
195
|
+
i0.ɵɵadvance(2);
|
|
196
|
+
i0.ɵɵtextInterpolate1("(", chip_r9.Count, ")");
|
|
197
|
+
} }
|
|
198
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_13_Template(rf, ctx) { if (rf & 1) {
|
|
199
|
+
i0.ɵɵelementStart(0, "div", 30);
|
|
200
|
+
i0.ɵɵrepeaterCreate(1, MjRecordLinksComponent_ng_template_2_Conditional_13_For_2_Template, 6, 6, "button", 47, _forTrack0);
|
|
201
|
+
i0.ɵɵelementEnd();
|
|
202
|
+
} if (rf & 2) {
|
|
203
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
204
|
+
i0.ɵɵadvance();
|
|
205
|
+
i0.ɵɵrepeater(ctx_r1.CategoryChips);
|
|
206
|
+
} }
|
|
207
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_14_Template(rf, ctx) { if (rf & 1) {
|
|
208
|
+
i0.ɵɵelementStart(0, "div", 31);
|
|
209
|
+
i0.ɵɵelement(1, "i", 51);
|
|
210
|
+
i0.ɵɵelementStart(2, "span");
|
|
211
|
+
i0.ɵɵtext(3, "Loading linked records...");
|
|
212
|
+
i0.ɵɵelementEnd()();
|
|
213
|
+
} }
|
|
214
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_15_Template(rf, ctx) { if (rf & 1) {
|
|
215
|
+
i0.ɵɵelementStart(0, "div", 32);
|
|
216
|
+
i0.ɵɵelement(1, "i", 52);
|
|
217
|
+
i0.ɵɵelementStart(2, "span");
|
|
218
|
+
i0.ɵɵtext(3);
|
|
219
|
+
i0.ɵɵelementEnd()();
|
|
220
|
+
} if (rf & 2) {
|
|
221
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
222
|
+
i0.ɵɵadvance(3);
|
|
223
|
+
i0.ɵɵtextInterpolate(ctx_r1.ErrorMessage);
|
|
224
|
+
} }
|
|
225
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_16_Template(rf, ctx) { if (rf & 1) {
|
|
226
|
+
i0.ɵɵelementStart(0, "div", 33)(1, "div", 53);
|
|
227
|
+
i0.ɵɵelement(2, "i", 54);
|
|
228
|
+
i0.ɵɵelementEnd();
|
|
229
|
+
i0.ɵɵelementStart(3, "div", 55);
|
|
230
|
+
i0.ɵɵtext(4, "No linked records yet");
|
|
231
|
+
i0.ɵɵelementEnd();
|
|
232
|
+
i0.ɵɵelementStart(5, "div", 56);
|
|
233
|
+
i0.ɵɵtext(6, " Records across your workspace that reference this item or are linked on this record will appear here automatically. ");
|
|
234
|
+
i0.ɵɵelementEnd()();
|
|
235
|
+
} }
|
|
236
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_17_Template(rf, ctx) { if (rf & 1) {
|
|
237
|
+
const _r10 = i0.ɵɵgetCurrentView();
|
|
238
|
+
i0.ɵɵelementStart(0, "div", 33)(1, "div", 53);
|
|
239
|
+
i0.ɵɵelement(2, "i", 57);
|
|
240
|
+
i0.ɵɵelementEnd();
|
|
241
|
+
i0.ɵɵelementStart(3, "div", 55);
|
|
242
|
+
i0.ɵɵtext(4, "No matching links");
|
|
243
|
+
i0.ɵɵelementEnd();
|
|
244
|
+
i0.ɵɵelementStart(5, "div", 56);
|
|
245
|
+
i0.ɵɵtext(6);
|
|
246
|
+
i0.ɵɵelementEnd();
|
|
247
|
+
i0.ɵɵelementStart(7, "button", 58);
|
|
248
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_17_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r10); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.ResetFilters()); });
|
|
249
|
+
i0.ɵɵtext(8, " Reset filters ");
|
|
250
|
+
i0.ɵɵelementEnd()();
|
|
251
|
+
} if (rf & 2) {
|
|
252
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
253
|
+
i0.ɵɵadvance(6);
|
|
254
|
+
i0.ɵɵtextInterpolate1(" No linked records match \"", ctx_r1.SearchText || ctx_r1.ActiveLinkFilterLabel, "\". ");
|
|
255
|
+
} }
|
|
256
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
257
|
+
i0.ɵɵelementStart(0, "span", 69);
|
|
258
|
+
i0.ɵɵtext(1);
|
|
259
|
+
i0.ɵɵelementEnd();
|
|
260
|
+
} if (rf & 2) {
|
|
261
|
+
const item_r12 = i0.ɵɵnextContext().$implicit;
|
|
262
|
+
i0.ɵɵadvance();
|
|
263
|
+
i0.ɵɵtextInterpolate(item_r12.StatusLabel);
|
|
264
|
+
} }
|
|
265
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_16_Template(rf, ctx) { if (rf & 1) {
|
|
266
|
+
i0.ɵɵelementStart(0, "span", 75);
|
|
267
|
+
i0.ɵɵtext(1);
|
|
268
|
+
i0.ɵɵelementEnd();
|
|
269
|
+
} if (rf & 2) {
|
|
270
|
+
const item_r12 = i0.ɵɵnextContext().$implicit;
|
|
271
|
+
i0.ɵɵadvance();
|
|
272
|
+
i0.ɵɵtextInterpolate(item_r12.FormattedDate);
|
|
273
|
+
} }
|
|
274
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_18_Template(rf, ctx) { if (rf & 1) {
|
|
275
|
+
const _r13 = i0.ɵɵgetCurrentView();
|
|
276
|
+
i0.ɵɵelementStart(0, "button", 78);
|
|
277
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_18_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r13); const item_r12 = i0.ɵɵnextContext().$implicit; const ctx_r1 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r1.OnUnlinkItem(item_r12, $event)); });
|
|
278
|
+
i0.ɵɵelement(1, "i", 72);
|
|
279
|
+
i0.ɵɵelementEnd();
|
|
280
|
+
} if (rf & 2) {
|
|
281
|
+
const item_r12 = i0.ɵɵnextContext().$implicit;
|
|
282
|
+
const ctx_r1 = i0.ɵɵnextContext(4);
|
|
283
|
+
i0.ɵɵproperty("disabled", ctx_r1.UnlinkingTrackKey === item_r12.TrackKey);
|
|
284
|
+
i0.ɵɵattribute("aria-label", "Unlink " + item_r12.DisplayName);
|
|
285
|
+
i0.ɵɵadvance();
|
|
286
|
+
i0.ɵɵclassMap(ctx_r1.UnlinkingTrackKey === item_r12.TrackKey ? "fa-solid fa-circle-notch fa-spin" : "fa-solid fa-link-slash");
|
|
287
|
+
} }
|
|
288
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Template(rf, ctx) { if (rf & 1) {
|
|
289
|
+
const _r11 = i0.ɵɵgetCurrentView();
|
|
290
|
+
i0.ɵɵelementStart(0, "div", 64)(1, "button", 65);
|
|
291
|
+
i0.ɵɵlistener("Navigate", function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Template_button_Navigate_1_listener($event) { const item_r12 = i0.ɵɵrestoreView(_r11).$implicit; const ctx_r1 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r1.OnItemNavigate(item_r12, $event)); })("RecordUpdated", function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Template_button_RecordUpdated_1_listener($event) { const item_r12 = i0.ɵɵrestoreView(_r11).$implicit; const ctx_r1 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r1.OnItemQuickEdited(item_r12, $event)); });
|
|
292
|
+
i0.ɵɵelementStart(2, "div", 66)(3, "div", 67)(4, "span", 68);
|
|
293
|
+
i0.ɵɵtext(5);
|
|
294
|
+
i0.ɵɵelementEnd();
|
|
295
|
+
i0.ɵɵconditionalCreate(6, MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_6_Template, 2, 1, "span", 69);
|
|
296
|
+
i0.ɵɵelementEnd();
|
|
297
|
+
i0.ɵɵelementStart(7, "div", 70)(8, "span", 71);
|
|
298
|
+
i0.ɵɵelement(9, "i", 72);
|
|
299
|
+
i0.ɵɵtext(10);
|
|
300
|
+
i0.ɵɵelementEnd();
|
|
301
|
+
i0.ɵɵelementStart(11, "span", 73);
|
|
302
|
+
i0.ɵɵelement(12, "i");
|
|
303
|
+
i0.ɵɵtext(13);
|
|
304
|
+
i0.ɵɵelementEnd();
|
|
305
|
+
i0.ɵɵelementStart(14, "span", 74);
|
|
306
|
+
i0.ɵɵtext(15);
|
|
307
|
+
i0.ɵɵelementEnd();
|
|
308
|
+
i0.ɵɵconditionalCreate(16, MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_16_Template, 2, 1, "span", 75);
|
|
309
|
+
i0.ɵɵelementEnd()();
|
|
310
|
+
i0.ɵɵelement(17, "i", 76);
|
|
311
|
+
i0.ɵɵelementEnd();
|
|
312
|
+
i0.ɵɵconditionalCreate(18, MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Conditional_18_Template, 2, 4, "button", 77);
|
|
313
|
+
i0.ɵɵelementEnd();
|
|
314
|
+
} if (rf & 2) {
|
|
315
|
+
const item_r12 = ctx.$implicit;
|
|
316
|
+
const ctx_r1 = i0.ɵɵnextContext(4);
|
|
317
|
+
i0.ɵɵadvance();
|
|
318
|
+
i0.ɵɵproperty("mjRecordLink", ctx_r1.Record)("FieldName", item_r12.Direction === "outgoing" ? item_r12.SourceFieldName ?? null : null)("EntityName", item_r12.EntityName)("PrimaryKey", item_r12.PrimaryKey)("DisplayName", item_r12.DisplayName)("Provider", ctx_r1.ProviderToUse);
|
|
319
|
+
i0.ɵɵadvance(4);
|
|
320
|
+
i0.ɵɵtextInterpolate(item_r12.DisplayName);
|
|
321
|
+
i0.ɵɵadvance();
|
|
322
|
+
i0.ɵɵconditional(item_r12.StatusLabel ? 6 : -1);
|
|
323
|
+
i0.ɵɵadvance(2);
|
|
324
|
+
i0.ɵɵclassProp("mj-links-card__direction-pill--outgoing", item_r12.Direction === "outgoing");
|
|
325
|
+
i0.ɵɵadvance();
|
|
326
|
+
i0.ɵɵclassMap(item_r12.Direction === "outgoing" ? "fa-solid fa-arrow-up-right-from-square" : "fa-solid fa-arrow-turn-up");
|
|
327
|
+
i0.ɵɵadvance();
|
|
328
|
+
i0.ɵɵtextInterpolate1(" ", item_r12.DirectionLabel, " ");
|
|
329
|
+
i0.ɵɵadvance(2);
|
|
330
|
+
i0.ɵɵclassMap(item_r12.IsSoftLink ? "fa-solid fa-diagram-project" : "fa-solid fa-link");
|
|
331
|
+
i0.ɵɵadvance();
|
|
332
|
+
i0.ɵɵtextInterpolate1(" ", item_r12.RelationshipLabel, " ");
|
|
333
|
+
i0.ɵɵadvance();
|
|
334
|
+
i0.ɵɵclassProp("mj-links-card__type-pill--soft", item_r12.IsSoftLink);
|
|
335
|
+
i0.ɵɵadvance();
|
|
336
|
+
i0.ɵɵtextInterpolate1(" ", item_r12.LinkTypeLabel, " ");
|
|
337
|
+
i0.ɵɵadvance();
|
|
338
|
+
i0.ɵɵconditional(item_r12.FormattedDate ? 16 : -1);
|
|
339
|
+
i0.ɵɵadvance(2);
|
|
340
|
+
i0.ɵɵconditional(ctx_r1.AllowQuickUnlink && item_r12.CanUnlink ? 18 : -1);
|
|
341
|
+
} }
|
|
342
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
343
|
+
i0.ɵɵelementStart(0, "section", 59)(1, "header", 60)(2, "div", 61);
|
|
344
|
+
i0.ɵɵelement(3, "i");
|
|
345
|
+
i0.ɵɵelementStart(4, "span");
|
|
346
|
+
i0.ɵɵtext(5);
|
|
347
|
+
i0.ɵɵelementEnd()();
|
|
348
|
+
i0.ɵɵelementStart(6, "span", 62);
|
|
349
|
+
i0.ɵɵtext(7);
|
|
350
|
+
i0.ɵɵelementEnd()();
|
|
351
|
+
i0.ɵɵelementStart(8, "div", 63);
|
|
352
|
+
i0.ɵɵrepeaterCreate(9, MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_For_10_Template, 19, 21, "div", 64, _forTrack2);
|
|
353
|
+
i0.ɵɵelementEnd()();
|
|
354
|
+
} if (rf & 2) {
|
|
355
|
+
const group_r14 = ctx.$implicit;
|
|
356
|
+
i0.ɵɵadvance(3);
|
|
357
|
+
i0.ɵɵclassMap(group_r14.EntityIcon + " mj-links-group__icon");
|
|
358
|
+
i0.ɵɵadvance(2);
|
|
359
|
+
i0.ɵɵtextInterpolate(group_r14.EntityDisplayName);
|
|
360
|
+
i0.ɵɵadvance(2);
|
|
361
|
+
i0.ɵɵtextInterpolate(group_r14.Items.length);
|
|
362
|
+
i0.ɵɵadvance(2);
|
|
363
|
+
i0.ɵɵrepeater(group_r14.Items);
|
|
364
|
+
} }
|
|
365
|
+
function MjRecordLinksComponent_ng_template_2_Conditional_18_Template(rf, ctx) { if (rf & 1) {
|
|
366
|
+
i0.ɵɵelementStart(0, "div", 34);
|
|
367
|
+
i0.ɵɵrepeaterCreate(1, MjRecordLinksComponent_ng_template_2_Conditional_18_For_2_Template, 11, 4, "section", 59, _forTrack1);
|
|
368
|
+
i0.ɵɵelementEnd();
|
|
369
|
+
} if (rf & 2) {
|
|
370
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
371
|
+
i0.ɵɵadvance();
|
|
372
|
+
i0.ɵɵrepeater(ctx_r1.FilteredGroups);
|
|
373
|
+
} }
|
|
374
|
+
function MjRecordLinksComponent_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
375
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
376
|
+
i0.ɵɵelementStart(0, "div", 19);
|
|
377
|
+
i0.ɵɵconditionalCreate(1, MjRecordLinksComponent_ng_template_2_Conditional_1_Template, 18, 9, "div", 20);
|
|
378
|
+
i0.ɵɵelementStart(2, "div", 21)(3, "div", 22);
|
|
379
|
+
i0.ɵɵelement(4, "i", 23);
|
|
380
|
+
i0.ɵɵelementStart(5, "input", 24);
|
|
381
|
+
i0.ɵɵlistener("input", function MjRecordLinksComponent_ng_template_2_Template_input_input_5_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnSearchInput($event)); });
|
|
382
|
+
i0.ɵɵelementEnd();
|
|
383
|
+
i0.ɵɵconditionalCreate(6, MjRecordLinksComponent_ng_template_2_Conditional_6_Template, 2, 0, "button", 25);
|
|
384
|
+
i0.ɵɵelementEnd();
|
|
385
|
+
i0.ɵɵelementStart(7, "button", 26);
|
|
386
|
+
i0.ɵɵlistener("click", function MjRecordLinksComponent_ng_template_2_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.ToggleFilterPanel()); });
|
|
387
|
+
i0.ɵɵelement(8, "i", 27);
|
|
388
|
+
i0.ɵɵelementStart(9, "span");
|
|
389
|
+
i0.ɵɵtext(10, "Filter");
|
|
390
|
+
i0.ɵɵelementEnd();
|
|
391
|
+
i0.ɵɵconditionalCreate(11, MjRecordLinksComponent_ng_template_2_Conditional_11_Template, 1, 0, "span", 28);
|
|
392
|
+
i0.ɵɵelementEnd()();
|
|
393
|
+
i0.ɵɵconditionalCreate(12, MjRecordLinksComponent_ng_template_2_Conditional_12_Template, 21, 9, "div", 29);
|
|
394
|
+
i0.ɵɵconditionalCreate(13, MjRecordLinksComponent_ng_template_2_Conditional_13_Template, 3, 0, "div", 30);
|
|
395
|
+
i0.ɵɵelementEnd();
|
|
396
|
+
i0.ɵɵconditionalCreate(14, MjRecordLinksComponent_ng_template_2_Conditional_14_Template, 4, 0, "div", 31)(15, MjRecordLinksComponent_ng_template_2_Conditional_15_Template, 4, 1, "div", 32)(16, MjRecordLinksComponent_ng_template_2_Conditional_16_Template, 7, 0, "div", 33)(17, MjRecordLinksComponent_ng_template_2_Conditional_17_Template, 9, 1, "div", 33)(18, MjRecordLinksComponent_ng_template_2_Conditional_18_Template, 3, 0, "div", 34);
|
|
397
|
+
} if (rf & 2) {
|
|
398
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
399
|
+
i0.ɵɵadvance();
|
|
400
|
+
i0.ɵɵconditional(!ctx_r1.IsLoading && ctx_r1.TotalLinkCount > 0 ? 1 : -1);
|
|
401
|
+
i0.ɵɵadvance(4);
|
|
402
|
+
i0.ɵɵproperty("value", ctx_r1.SearchText);
|
|
403
|
+
i0.ɵɵadvance();
|
|
404
|
+
i0.ɵɵconditional(ctx_r1.SearchText ? 6 : -1);
|
|
405
|
+
i0.ɵɵadvance();
|
|
406
|
+
i0.ɵɵclassProp("mj-links-filter-toggle--active", ctx_r1.ShowFilterPanel || ctx_r1.LinkFilter !== "both");
|
|
407
|
+
i0.ɵɵattribute("aria-expanded", ctx_r1.ShowFilterPanel);
|
|
408
|
+
i0.ɵɵadvance(4);
|
|
409
|
+
i0.ɵɵconditional(ctx_r1.LinkFilter !== "both" ? 11 : -1);
|
|
410
|
+
i0.ɵɵadvance();
|
|
411
|
+
i0.ɵɵconditional(ctx_r1.ShowFilterPanel ? 12 : -1);
|
|
412
|
+
i0.ɵɵadvance();
|
|
413
|
+
i0.ɵɵconditional(!ctx_r1.IsLoading && ctx_r1.TotalLinkCount > 0 ? 13 : -1);
|
|
414
|
+
i0.ɵɵadvance();
|
|
415
|
+
i0.ɵɵconditional(ctx_r1.IsLoading ? 14 : ctx_r1.ErrorMessage ? 15 : ctx_r1.TotalLinkCount === 0 ? 16 : ctx_r1.FilteredGroups.length === 0 ? 17 : 18);
|
|
416
|
+
} }
|
|
417
|
+
/**
|
|
418
|
+
* System telemetry/audit entities that should never appear in the business-facing Links panel.
|
|
419
|
+
*/
|
|
420
|
+
const EXCLUDED_SYSTEM_ENTITIES = new Set([
|
|
421
|
+
'MJ: Record Changes',
|
|
422
|
+
'MJ: Audit Logs',
|
|
423
|
+
'MJ: User Record Logs',
|
|
424
|
+
'MJ: Entity Record Documents'
|
|
425
|
+
]);
|
|
426
|
+
/**
|
|
427
|
+
* Reusable `<mj-record-links>` widget that displays all records linked to the current `Record`
|
|
428
|
+
* in both directions:
|
|
429
|
+
* - **Outgoing ("On This Record")**: foreign-key (`RelatedEntity`) and polymorphic-FK (`EntityIDFieldName`) fields populated on this record.
|
|
430
|
+
* - **Incoming ("Linked To This")**: records across the workspace referencing this record via hard FKs or polymorphic/soft links (`GetRecordDependencies`).
|
|
431
|
+
*
|
|
432
|
+
* Can be embedded inline inside any form section/dashboard (`[Mode]="'inline'"`) or rendered as a
|
|
433
|
+
* slide-in drawer (`[Mode]="'drawer'"`).
|
|
434
|
+
*/
|
|
435
|
+
export class MjRecordLinksComponent extends BaseAngularComponent {
|
|
436
|
+
static DEP_CACHE_TTL_MS = 30_000;
|
|
437
|
+
static depCache = new Map();
|
|
438
|
+
cdr = inject(ChangeDetectorRef);
|
|
439
|
+
_record = null;
|
|
440
|
+
_lastRecordSignature = '';
|
|
441
|
+
set Record(value) {
|
|
442
|
+
const prev = this._record;
|
|
443
|
+
this._record = value;
|
|
444
|
+
const nextSig = this.computeRecordSignature(value);
|
|
445
|
+
if (nextSig !== this._lastRecordSignature || prev !== value) {
|
|
446
|
+
this._lastRecordSignature = nextSig;
|
|
447
|
+
if (this.isInitialized) {
|
|
448
|
+
void this.LoadLinks();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
get Record() {
|
|
453
|
+
return this._record;
|
|
454
|
+
}
|
|
455
|
+
_initialLinkFilter = 'both';
|
|
456
|
+
set InitialLinkFilter(value) {
|
|
457
|
+
this._initialLinkFilter = value || 'both';
|
|
458
|
+
this.LinkFilter = this._initialLinkFilter;
|
|
459
|
+
this.cdr.markForCheck();
|
|
460
|
+
}
|
|
461
|
+
get InitialLinkFilter() {
|
|
462
|
+
return this._initialLinkFilter;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Rendering mode:
|
|
466
|
+
* - `'inline'`: embedded widget for custom form sections or dashboards
|
|
467
|
+
* - `'drawer'`: slide-in drawer with backdrop and close header
|
|
468
|
+
*/
|
|
469
|
+
Mode = 'inline';
|
|
470
|
+
/** Whether the drawer is open when `Mode === 'drawer'`. */
|
|
471
|
+
IsOpen = true;
|
|
472
|
+
/** Whether nullable outgoing links can be unlinked directly from the card list. */
|
|
473
|
+
AllowQuickUnlink = true;
|
|
474
|
+
/** Emitted when the user clicks a linked record card to navigate to it. */
|
|
475
|
+
Navigate = new EventEmitter();
|
|
476
|
+
/** Emitted when the slide-in drawer requests to close. */
|
|
477
|
+
Close = new EventEmitter();
|
|
478
|
+
/** Emitted whenever the total loaded link count changes. */
|
|
479
|
+
LinkCountChange = new EventEmitter();
|
|
480
|
+
/** Emitted whenever the enriched links summary changes. */
|
|
481
|
+
LinksSummaryChange = new EventEmitter();
|
|
482
|
+
/** Emitted when an outgoing link is unlinked or a target record is updated via Quick Edit. */
|
|
483
|
+
RecordLinkModified = new EventEmitter();
|
|
484
|
+
/** Loading state */
|
|
485
|
+
IsLoading = false;
|
|
486
|
+
/** TrackKey of the outgoing link currently being unlinked */
|
|
487
|
+
UnlinkingTrackKey = null;
|
|
488
|
+
/** Error message if loading fails */
|
|
489
|
+
ErrorMessage = null;
|
|
490
|
+
/** Current search query */
|
|
491
|
+
SearchText = '';
|
|
492
|
+
/** Whether the collapsible Link Type filter panel is expanded */
|
|
493
|
+
ShowFilterPanel = false;
|
|
494
|
+
/** Active link type filter: 'both' (All Links), 'soft' (Cross-App Links), or 'hard' (Direct Relationships) */
|
|
495
|
+
LinkFilter = 'both';
|
|
496
|
+
/** Active direction filter: 'all', 'outgoing' (On This Record), or 'incoming' (Linked To This) */
|
|
497
|
+
DirectionFilter = 'all';
|
|
498
|
+
/** Currently selected entity filter chip (`null` means All) */
|
|
499
|
+
SelectedEntityName = null;
|
|
500
|
+
/** All loaded and enriched link items for the current record */
|
|
501
|
+
AllItems = [];
|
|
502
|
+
/** Hover preview card state */
|
|
503
|
+
HoveredItem = null;
|
|
504
|
+
HoverAnchorRect = null;
|
|
505
|
+
isInitialized = false;
|
|
506
|
+
isDestroyed = false;
|
|
507
|
+
loadVersion = 0;
|
|
508
|
+
hoverOpenTimer = null;
|
|
509
|
+
hoverCloseTimer = null;
|
|
510
|
+
/** Clear the static dependency cache (useful in unit tests). */
|
|
511
|
+
static ClearDependencyCache() {
|
|
512
|
+
MjRecordLinksComponent.depCache.clear();
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Synchronously computes the outgoing links summary from the record's in-memory FK and
|
|
516
|
+
* polymorphic-FK fields without making any network calls.
|
|
517
|
+
*/
|
|
518
|
+
static BuildOutgoingLinksSummary(record, provider) {
|
|
519
|
+
if (!record || !record.IsSaved || !record.EntityInfo) {
|
|
520
|
+
return { TotalCount: 0, OutgoingCount: 0, IncomingCount: 0, ByEntity: [] };
|
|
521
|
+
}
|
|
522
|
+
const entities = provider?.Entities ?? [];
|
|
523
|
+
const outgoing = MjRecordLinksComponent.extractOutgoingCandidates(record, provider, entities);
|
|
524
|
+
const byEntityMap = new Map();
|
|
525
|
+
for (const out of outgoing) {
|
|
526
|
+
const displayName = out.RelatedEntity?.DisplayNameOrName || out.EntityName;
|
|
527
|
+
let entry = byEntityMap.get(out.EntityName);
|
|
528
|
+
if (!entry) {
|
|
529
|
+
entry = {
|
|
530
|
+
EntityName: out.EntityName,
|
|
531
|
+
EntityDisplayName: displayName,
|
|
532
|
+
Count: 0,
|
|
533
|
+
SampleNames: []
|
|
534
|
+
};
|
|
535
|
+
byEntityMap.set(out.EntityName, entry);
|
|
536
|
+
}
|
|
537
|
+
entry.Count += 1;
|
|
538
|
+
if (out.PreResolvedDisplayName && entry.SampleNames.length < 3) {
|
|
539
|
+
entry.SampleNames.push(out.PreResolvedDisplayName);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return {
|
|
543
|
+
TotalCount: outgoing.length,
|
|
544
|
+
OutgoingCount: outgoing.length,
|
|
545
|
+
IncomingCount: 0,
|
|
546
|
+
ByEntity: Array.from(byEntityMap.values()).map(e => ({
|
|
547
|
+
EntityName: e.EntityName,
|
|
548
|
+
EntityDisplayName: e.EntityDisplayName,
|
|
549
|
+
Direction: 'outgoing',
|
|
550
|
+
Count: e.Count,
|
|
551
|
+
SampleNames: e.SampleNames
|
|
552
|
+
}))
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Pre-warms the total bidirectional link count (outgoing FK/polymorphic fields on the record
|
|
557
|
+
* + incoming `GetRecordDependencies`) and caches the incoming dependencies so opening the
|
|
558
|
+
* `<mj-record-links>` drawer reuses them without a duplicate network request.
|
|
559
|
+
*/
|
|
560
|
+
static async PrewarmRecordLinkCount(record, provider) {
|
|
561
|
+
if (!record || !record.IsSaved || !record.EntityInfo || !provider) {
|
|
562
|
+
return { TotalCount: 0, OutgoingCount: 0, IncomingCount: 0, ByEntity: [] };
|
|
563
|
+
}
|
|
564
|
+
const entities = provider.Entities ?? [];
|
|
565
|
+
const outgoing = MjRecordLinksComponent.extractOutgoingCandidates(record, provider, entities);
|
|
566
|
+
const rawDeps = await MjRecordLinksComponent.fetchDependenciesWithCache(record, provider, false);
|
|
567
|
+
const incoming = MjRecordLinksComponent.filterIncomingDependencies(rawDeps, entities);
|
|
568
|
+
const byEntityMap = new Map();
|
|
569
|
+
for (const out of outgoing) {
|
|
570
|
+
const displayName = out.RelatedEntity?.DisplayNameOrName || out.EntityName;
|
|
571
|
+
let entry = byEntityMap.get(out.EntityName);
|
|
572
|
+
if (!entry) {
|
|
573
|
+
entry = {
|
|
574
|
+
EntityName: out.EntityName,
|
|
575
|
+
EntityDisplayName: displayName,
|
|
576
|
+
HasOutgoing: true,
|
|
577
|
+
HasIncoming: false,
|
|
578
|
+
Count: 0,
|
|
579
|
+
SampleNames: []
|
|
580
|
+
};
|
|
581
|
+
byEntityMap.set(out.EntityName, entry);
|
|
582
|
+
}
|
|
583
|
+
entry.HasOutgoing = true;
|
|
584
|
+
entry.Count += 1;
|
|
585
|
+
if (out.PreResolvedDisplayName && entry.SampleNames.length < 3) {
|
|
586
|
+
entry.SampleNames.push(out.PreResolvedDisplayName);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
for (const dep of incoming) {
|
|
590
|
+
const entityInfo = MjRecordLinksComponent.findEntityInfoStatic(entities, dep.RelatedEntityName);
|
|
591
|
+
const displayName = entityInfo?.DisplayNameOrName || dep.RelatedEntityName;
|
|
592
|
+
let entry = byEntityMap.get(dep.RelatedEntityName);
|
|
593
|
+
if (!entry) {
|
|
594
|
+
entry = {
|
|
595
|
+
EntityName: dep.RelatedEntityName,
|
|
596
|
+
EntityDisplayName: displayName,
|
|
597
|
+
HasOutgoing: false,
|
|
598
|
+
HasIncoming: true,
|
|
599
|
+
Count: 0,
|
|
600
|
+
SampleNames: []
|
|
601
|
+
};
|
|
602
|
+
byEntityMap.set(dep.RelatedEntityName, entry);
|
|
603
|
+
}
|
|
604
|
+
entry.HasIncoming = true;
|
|
605
|
+
entry.Count += 1;
|
|
606
|
+
}
|
|
607
|
+
return {
|
|
608
|
+
TotalCount: outgoing.length + incoming.length,
|
|
609
|
+
OutgoingCount: outgoing.length,
|
|
610
|
+
IncomingCount: incoming.length,
|
|
611
|
+
ByEntity: Array.from(byEntityMap.values()).map(e => ({
|
|
612
|
+
EntityName: e.EntityName,
|
|
613
|
+
EntityDisplayName: e.EntityDisplayName,
|
|
614
|
+
Direction: e.HasOutgoing && e.HasIncoming ? 'both' : e.HasOutgoing ? 'outgoing' : 'incoming',
|
|
615
|
+
Count: e.Count,
|
|
616
|
+
SampleNames: e.SampleNames
|
|
617
|
+
}))
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
static async fetchDependenciesWithCache(record, provider, forceRefresh) {
|
|
621
|
+
const pkStr = MjRecordLinksComponent.getPrimaryKeyStringStatic(record.PrimaryKey);
|
|
622
|
+
const cacheKey = `${record.EntityInfo.Name}::${pkStr}`;
|
|
623
|
+
if (!forceRefresh) {
|
|
624
|
+
const cached = MjRecordLinksComponent.depCache.get(cacheKey);
|
|
625
|
+
if (cached && Date.now() - cached.LoadedAt < MjRecordLinksComponent.DEP_CACHE_TTL_MS) {
|
|
626
|
+
return cached.Deps;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const deps = await provider.GetRecordDependencies(record.EntityInfo.Name, record.PrimaryKey, {
|
|
630
|
+
IncludeSystemEntities: false
|
|
631
|
+
});
|
|
632
|
+
const safeDeps = deps ?? [];
|
|
633
|
+
MjRecordLinksComponent.depCache.set(cacheKey, {
|
|
634
|
+
LoadedAt: Date.now(),
|
|
635
|
+
Deps: safeDeps
|
|
636
|
+
});
|
|
637
|
+
return safeDeps;
|
|
638
|
+
}
|
|
639
|
+
static filterIncomingDependencies(deps, entities) {
|
|
640
|
+
return (deps ?? []).filter(dep => {
|
|
641
|
+
if (!dep || !dep.RelatedEntityName) {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
if (EXCLUDED_SYSTEM_ENTITIES.has(dep.RelatedEntityName.trim())) {
|
|
645
|
+
return false;
|
|
646
|
+
}
|
|
647
|
+
const entityInfo = MjRecordLinksComponent.findEntityInfoStatic(entities, dep.RelatedEntityName);
|
|
648
|
+
const entityWithPerm = entityInfo;
|
|
649
|
+
if (entityWithPerm && (entityWithPerm.CanRead === false || entityWithPerm.IncludeInAPI === false)) {
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
return true;
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
static extractOutgoingCandidates(record, provider, entities) {
|
|
656
|
+
const candidates = [];
|
|
657
|
+
const fields = record.EntityInfo?.Fields ?? [];
|
|
658
|
+
const seenKeys = new Set();
|
|
659
|
+
for (const field of fields) {
|
|
660
|
+
if (field.IsPrimaryKey || field.Name.startsWith('__mj_')) {
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
if (field.Status === 'Deprecated' || field.Status === 'Disabled') {
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
// 1. Polymorphic FK configured via EntityField.EntityIDFieldName (Rule 2e)
|
|
667
|
+
const entityIdFieldName = field.EntityIDFieldName?.trim();
|
|
668
|
+
if (entityIdFieldName) {
|
|
669
|
+
const rawRecordId = record.Get(field.Name);
|
|
670
|
+
const rawEntityRef = record.Get(entityIdFieldName);
|
|
671
|
+
if (rawRecordId == null || String(rawRecordId).trim() === '' || rawEntityRef == null || String(rawEntityRef).trim() === '') {
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
const entityRefStr = String(rawEntityRef).trim();
|
|
675
|
+
const targetEntity = provider?.EntityByID?.(entityRefStr) ?? MjRecordLinksComponent.findEntityInfoStatic(entities, entityRefStr);
|
|
676
|
+
if (!targetEntity || EXCLUDED_SYSTEM_ENTITIES.has(targetEntity.Name.trim())) {
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
const entityWithPerm = targetEntity;
|
|
680
|
+
if (entityWithPerm.CanRead === false || entityWithPerm.IncludeInAPI === false) {
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
const pk = CompositeKey.FromURLSegment(targetEntity, String(rawRecordId).trim());
|
|
684
|
+
const dedupeKey = `poly:${targetEntity.Name}:${field.Name}:${MjRecordLinksComponent.getPrimaryKeyStringStatic(pk)}`;
|
|
685
|
+
if (seenKeys.has(dedupeKey)) {
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
seenKeys.add(dedupeKey);
|
|
689
|
+
candidates.push({
|
|
690
|
+
EntityName: targetEntity.Name,
|
|
691
|
+
RelatedEntity: targetEntity,
|
|
692
|
+
FieldInfo: field,
|
|
693
|
+
PrimaryKey: pk,
|
|
694
|
+
PreResolvedDisplayName: null,
|
|
695
|
+
IsSoftLink: true
|
|
696
|
+
});
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
// 2. Standard hard Foreign Key via EntityField.RelatedEntity
|
|
700
|
+
const relatedEntityName = field.RelatedEntity?.trim();
|
|
701
|
+
if (!relatedEntityName || EXCLUDED_SYSTEM_ENTITIES.has(relatedEntityName)) {
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
const fkValue = record.Get(field.Name);
|
|
705
|
+
if (fkValue == null || String(fkValue).trim() === '') {
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
const targetEntity = MjRecordLinksComponent.findEntityInfoStatic(entities, relatedEntityName);
|
|
709
|
+
const entityWithPerm = targetEntity;
|
|
710
|
+
if (entityWithPerm && (entityWithPerm.CanRead === false || entityWithPerm.IncludeInAPI === false)) {
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
const pkFieldName = field.RelatedEntityFieldName || targetEntity?.FirstPrimaryKey?.Name || 'ID'; // first-pk-ok: a foreign key targets a single column
|
|
714
|
+
const pk = new CompositeKey([new KeyValuePair(pkFieldName, fkValue)]);
|
|
715
|
+
const dedupeKey = `fk:${relatedEntityName}:${field.Name}:${MjRecordLinksComponent.getPrimaryKeyStringStatic(pk)}`;
|
|
716
|
+
if (seenKeys.has(dedupeKey)) {
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
seenKeys.add(dedupeKey);
|
|
720
|
+
let preResolvedName = null;
|
|
721
|
+
if (field.RelatedEntityNameFieldMap) {
|
|
722
|
+
const joinedVal = record.Get(field.RelatedEntityNameFieldMap);
|
|
723
|
+
if (joinedVal != null && String(joinedVal).trim() !== '') {
|
|
724
|
+
preResolvedName = String(joinedVal).trim();
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
candidates.push({
|
|
728
|
+
EntityName: targetEntity?.Name || relatedEntityName,
|
|
729
|
+
RelatedEntity: targetEntity,
|
|
730
|
+
FieldInfo: field,
|
|
731
|
+
PrimaryKey: pk,
|
|
732
|
+
PreResolvedDisplayName: preResolvedName,
|
|
733
|
+
IsSoftLink: false
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
return candidates;
|
|
737
|
+
}
|
|
738
|
+
static findEntityInfoStatic(entities, entityName) {
|
|
739
|
+
const normalized = entityName.trim().toLowerCase();
|
|
740
|
+
return entities.find(e => e.Name.trim().toLowerCase() === normalized);
|
|
741
|
+
}
|
|
742
|
+
static getPrimaryKeyStringStatic(primaryKey) {
|
|
743
|
+
if (!primaryKey) {
|
|
744
|
+
return '';
|
|
745
|
+
}
|
|
746
|
+
if (typeof primaryKey.ToConcatenatedString === 'function') {
|
|
747
|
+
return primaryKey.ToConcatenatedString();
|
|
748
|
+
}
|
|
749
|
+
if (Array.isArray(primaryKey.KeyValuePairs)) {
|
|
750
|
+
return primaryKey.KeyValuePairs.map(kv => `${kv.FieldName}|${kv.Value}`).join('||');
|
|
751
|
+
}
|
|
752
|
+
return '';
|
|
753
|
+
}
|
|
754
|
+
ngOnInit() {
|
|
755
|
+
this.isInitialized = true;
|
|
756
|
+
this.LinkFilter = this._initialLinkFilter;
|
|
757
|
+
if (this._record) {
|
|
758
|
+
void this.LoadLinks();
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
ngOnDestroy() {
|
|
762
|
+
this.isDestroyed = true;
|
|
763
|
+
this.clearHoverTimers();
|
|
764
|
+
}
|
|
765
|
+
/** Total number of links loaded for this record */
|
|
766
|
+
get TotalLinkCount() {
|
|
767
|
+
return this.AllItems.length;
|
|
768
|
+
}
|
|
769
|
+
/** Count of Outgoing links ("On This Record") */
|
|
770
|
+
get OutgoingLinkCount() {
|
|
771
|
+
return this.AllItems.filter(i => i.Direction === 'outgoing').length;
|
|
772
|
+
}
|
|
773
|
+
/** Count of Incoming links ("Linked To This") */
|
|
774
|
+
get IncomingLinkCount() {
|
|
775
|
+
return this.AllItems.filter(i => i.Direction === 'incoming').length;
|
|
776
|
+
}
|
|
777
|
+
/** Count of Cross-App Links (`IsSoftLink === true`) */
|
|
778
|
+
get CrossAppLinkCount() {
|
|
779
|
+
return this.AllItems.filter(i => i.IsSoftLink).length;
|
|
780
|
+
}
|
|
781
|
+
/** Count of Direct Relationships (`IsSoftLink === false`) */
|
|
782
|
+
get DirectRelationshipCount() {
|
|
783
|
+
return this.AllItems.filter(i => !i.IsSoftLink).length;
|
|
784
|
+
}
|
|
785
|
+
/** Items matching the active Direction, Link Type, and Search filters (prior to entity chip selection) */
|
|
786
|
+
get ItemsMatchingTypeAndSearch() {
|
|
787
|
+
const search = this.SearchText.trim().toLowerCase();
|
|
788
|
+
return this.AllItems.filter(item => {
|
|
789
|
+
if (this.DirectionFilter !== 'all' && item.Direction !== this.DirectionFilter) {
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
if (this.LinkFilter === 'soft' && !item.IsSoftLink) {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
if (this.LinkFilter === 'hard' && item.IsSoftLink) {
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
if (search.length > 0) {
|
|
799
|
+
const matchesTitle = item.DisplayName.toLowerCase().includes(search);
|
|
800
|
+
const matchesEntity = item.EntityDisplayName.toLowerCase().includes(search);
|
|
801
|
+
const matchesRel = item.RelationshipLabel.toLowerCase().includes(search);
|
|
802
|
+
const matchesStatus = item.StatusLabel.toLowerCase().includes(search);
|
|
803
|
+
if (!matchesTitle && !matchesEntity && !matchesRel && !matchesStatus) {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return true;
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
/** Category chips for the top bar ("All (N)" + one chip per entity) */
|
|
811
|
+
get CategoryChips() {
|
|
812
|
+
const items = this.ItemsMatchingTypeAndSearch;
|
|
813
|
+
const chips = [
|
|
814
|
+
{
|
|
815
|
+
EntityName: null,
|
|
816
|
+
Label: 'All',
|
|
817
|
+
Icon: 'fa-solid fa-layer-group',
|
|
818
|
+
Count: items.length
|
|
819
|
+
}
|
|
820
|
+
];
|
|
821
|
+
const byEntity = new Map();
|
|
822
|
+
for (const item of items) {
|
|
823
|
+
const existing = byEntity.get(item.EntityName);
|
|
824
|
+
if (existing) {
|
|
825
|
+
existing.count += 1;
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
byEntity.set(item.EntityName, {
|
|
829
|
+
displayName: item.EntityDisplayName,
|
|
830
|
+
icon: item.EntityIcon,
|
|
831
|
+
count: 1
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
for (const [entityName, info] of byEntity.entries()) {
|
|
836
|
+
chips.push({
|
|
837
|
+
EntityName: entityName,
|
|
838
|
+
Label: info.displayName,
|
|
839
|
+
Icon: info.icon,
|
|
840
|
+
Count: info.count
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
return chips;
|
|
844
|
+
}
|
|
845
|
+
/** Final grouped items after applying DirectionFilter, LinkType, SearchText, and SelectedEntityName filters */
|
|
846
|
+
get FilteredGroups() {
|
|
847
|
+
const items = this.ItemsMatchingTypeAndSearch.filter(item => this.SelectedEntityName === null || item.EntityName === this.SelectedEntityName);
|
|
848
|
+
const groupMap = new Map();
|
|
849
|
+
for (const item of items) {
|
|
850
|
+
let group = groupMap.get(item.EntityName);
|
|
851
|
+
if (!group) {
|
|
852
|
+
group = {
|
|
853
|
+
EntityName: item.EntityName,
|
|
854
|
+
EntityDisplayName: item.EntityDisplayName,
|
|
855
|
+
EntityIcon: item.EntityIcon,
|
|
856
|
+
Items: []
|
|
857
|
+
};
|
|
858
|
+
groupMap.set(item.EntityName, group);
|
|
859
|
+
}
|
|
860
|
+
group.Items.push(item);
|
|
861
|
+
}
|
|
862
|
+
return Array.from(groupMap.values());
|
|
863
|
+
}
|
|
864
|
+
/** Total count of currently visible items */
|
|
865
|
+
get FilteredLinkCount() {
|
|
866
|
+
return this.FilteredGroups.reduce((sum, g) => sum + g.Items.length, 0);
|
|
867
|
+
}
|
|
868
|
+
/** Human-readable label for the active LinkFilter */
|
|
869
|
+
get ActiveLinkFilterLabel() {
|
|
870
|
+
switch (this.LinkFilter) {
|
|
871
|
+
case 'soft':
|
|
872
|
+
return 'Cross-App Links';
|
|
873
|
+
case 'hard':
|
|
874
|
+
return 'Direct Relationships';
|
|
875
|
+
default:
|
|
876
|
+
return 'All Links';
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
/** Toggle the collapsible filter panel */
|
|
880
|
+
ToggleFilterPanel() {
|
|
881
|
+
this.ShowFilterPanel = !this.ShowFilterPanel;
|
|
882
|
+
this.cdr.markForCheck();
|
|
883
|
+
}
|
|
884
|
+
/** Select a Direction filter ('all' | 'outgoing' | 'incoming') */
|
|
885
|
+
SetDirectionFilter(direction) {
|
|
886
|
+
this.DirectionFilter = direction;
|
|
887
|
+
this.pruneSelectedEntityChipIfNeeded();
|
|
888
|
+
this.cdr.markForCheck();
|
|
889
|
+
}
|
|
890
|
+
/** Select a Link Type filter ('both' | 'soft' | 'hard') */
|
|
891
|
+
SetLinkFilter(filter) {
|
|
892
|
+
this.LinkFilter = filter;
|
|
893
|
+
this.pruneSelectedEntityChipIfNeeded();
|
|
894
|
+
this.cdr.markForCheck();
|
|
895
|
+
}
|
|
896
|
+
pruneSelectedEntityChipIfNeeded() {
|
|
897
|
+
if (this.SelectedEntityName !== null) {
|
|
898
|
+
const stillHasEntity = this.ItemsMatchingTypeAndSearch.some(i => i.EntityName === this.SelectedEntityName);
|
|
899
|
+
if (!stillHasEntity) {
|
|
900
|
+
this.SelectedEntityName = null;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
/** Select a category chip by entity name (`null` for All) */
|
|
905
|
+
SelectCategoryChip(entityName) {
|
|
906
|
+
this.SelectedEntityName = entityName;
|
|
907
|
+
this.cdr.markForCheck();
|
|
908
|
+
}
|
|
909
|
+
/** Update search filter text from DOM input event */
|
|
910
|
+
OnSearchInput(event) {
|
|
911
|
+
const target = event.target;
|
|
912
|
+
this.OnSearchChange(target?.value ?? '');
|
|
913
|
+
}
|
|
914
|
+
/** Update search filter text */
|
|
915
|
+
OnSearchChange(value) {
|
|
916
|
+
this.SearchText = value;
|
|
917
|
+
this.cdr.markForCheck();
|
|
918
|
+
}
|
|
919
|
+
/** Clear search text */
|
|
920
|
+
ClearSearch() {
|
|
921
|
+
this.SearchText = '';
|
|
922
|
+
this.cdr.markForCheck();
|
|
923
|
+
}
|
|
924
|
+
/** Reset all active filters back to defaults */
|
|
925
|
+
ResetFilters() {
|
|
926
|
+
this.SearchText = '';
|
|
927
|
+
this.LinkFilter = 'both';
|
|
928
|
+
this.DirectionFilter = 'all';
|
|
929
|
+
this.SelectedEntityName = null;
|
|
930
|
+
this.cdr.markForCheck();
|
|
931
|
+
}
|
|
932
|
+
/** Handle navigation emitted by `[mjRecordLink]` on a linked record card */
|
|
933
|
+
OnItemNavigate(_item, navEvent) {
|
|
934
|
+
this.clearHoverTimers();
|
|
935
|
+
this.HoveredItem = null;
|
|
936
|
+
this.Navigate.emit(navEvent);
|
|
937
|
+
}
|
|
938
|
+
/** Handle inline Quick Edit save emitted by `[mjRecordLink]` on a linked record card */
|
|
939
|
+
OnItemQuickEdited(item, _event) {
|
|
940
|
+
this.RecordLinkModified.emit({ Action: 'updated', Item: item });
|
|
941
|
+
void this.LoadLinks(true);
|
|
942
|
+
}
|
|
943
|
+
/** Handle clicking a linked record card */
|
|
944
|
+
OnItemClick(item, event) {
|
|
945
|
+
this.clearHoverTimers();
|
|
946
|
+
this.HoveredItem = null;
|
|
947
|
+
const navEvent = event && (event.metaKey || event.ctrlKey)
|
|
948
|
+
? {
|
|
949
|
+
Kind: 'record',
|
|
950
|
+
EntityName: item.EntityName,
|
|
951
|
+
PrimaryKey: item.PrimaryKey,
|
|
952
|
+
OpenInNewTab: true
|
|
953
|
+
}
|
|
954
|
+
: {
|
|
955
|
+
Kind: 'record',
|
|
956
|
+
EntityName: item.EntityName,
|
|
957
|
+
PrimaryKey: item.PrimaryKey
|
|
958
|
+
};
|
|
959
|
+
this.Navigate.emit(navEvent);
|
|
960
|
+
}
|
|
961
|
+
/** Open `<mj-record-preview-popover>` when hovering over a link card */
|
|
962
|
+
OnCardMouseEnter(item, event) {
|
|
963
|
+
const anchorEl = event.currentTarget;
|
|
964
|
+
if (!anchorEl)
|
|
965
|
+
return;
|
|
966
|
+
if (this.hoverCloseTimer) {
|
|
967
|
+
clearTimeout(this.hoverCloseTimer);
|
|
968
|
+
this.hoverCloseTimer = null;
|
|
969
|
+
}
|
|
970
|
+
if (this.hoverOpenTimer) {
|
|
971
|
+
clearTimeout(this.hoverOpenTimer);
|
|
972
|
+
}
|
|
973
|
+
this.hoverOpenTimer = setTimeout(() => {
|
|
974
|
+
this.hoverOpenTimer = null;
|
|
975
|
+
if (this.isDestroyed)
|
|
976
|
+
return;
|
|
977
|
+
const r = anchorEl.getBoundingClientRect();
|
|
978
|
+
this.HoverAnchorRect = {
|
|
979
|
+
top: r.top,
|
|
980
|
+
bottom: r.bottom,
|
|
981
|
+
left: r.left,
|
|
982
|
+
right: r.right,
|
|
983
|
+
width: r.width,
|
|
984
|
+
height: r.height
|
|
985
|
+
};
|
|
986
|
+
this.HoveredItem = item;
|
|
987
|
+
this.cdr.markForCheck();
|
|
988
|
+
}, 280);
|
|
989
|
+
}
|
|
990
|
+
/** Schedule closing the hover preview popover when the pointer leaves a card */
|
|
991
|
+
OnCardMouseLeave() {
|
|
992
|
+
if (this.hoverOpenTimer) {
|
|
993
|
+
clearTimeout(this.hoverOpenTimer);
|
|
994
|
+
this.hoverOpenTimer = null;
|
|
995
|
+
}
|
|
996
|
+
if (this.hoverCloseTimer) {
|
|
997
|
+
clearTimeout(this.hoverCloseTimer);
|
|
998
|
+
}
|
|
999
|
+
this.hoverCloseTimer = setTimeout(() => {
|
|
1000
|
+
this.hoverCloseTimer = null;
|
|
1001
|
+
if (!this.isDestroyed) {
|
|
1002
|
+
this.HoveredItem = null;
|
|
1003
|
+
this.cdr.markForCheck();
|
|
1004
|
+
}
|
|
1005
|
+
}, 180);
|
|
1006
|
+
}
|
|
1007
|
+
OnPreviewCardMouseEnter() {
|
|
1008
|
+
if (this.hoverCloseTimer) {
|
|
1009
|
+
clearTimeout(this.hoverCloseTimer);
|
|
1010
|
+
this.hoverCloseTimer = null;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
OnPreviewCardMouseLeave() {
|
|
1014
|
+
this.OnCardMouseLeave();
|
|
1015
|
+
}
|
|
1016
|
+
OnPreviewCardNavigate(navEvent) {
|
|
1017
|
+
this.clearHoverTimers();
|
|
1018
|
+
this.HoveredItem = null;
|
|
1019
|
+
this.Navigate.emit(navEvent);
|
|
1020
|
+
this.cdr.markForCheck();
|
|
1021
|
+
}
|
|
1022
|
+
OnPreviewRecordUpdated(_event) {
|
|
1023
|
+
const currentHovered = this.HoveredItem;
|
|
1024
|
+
if (currentHovered) {
|
|
1025
|
+
this.RecordLinkModified.emit({ Action: 'updated', Item: currentHovered });
|
|
1026
|
+
}
|
|
1027
|
+
void this.LoadLinks(true);
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Unlinks a nullable outgoing foreign-key or polymorphic-FK field on `this.Record`
|
|
1031
|
+
* and saves the record if it was already saved.
|
|
1032
|
+
*/
|
|
1033
|
+
async OnUnlinkItem(item, event) {
|
|
1034
|
+
event.preventDefault();
|
|
1035
|
+
event.stopPropagation();
|
|
1036
|
+
const record = this._record;
|
|
1037
|
+
if (!record ||
|
|
1038
|
+
!this.AllowQuickUnlink ||
|
|
1039
|
+
item.Direction !== 'outgoing' ||
|
|
1040
|
+
!item.CanUnlink ||
|
|
1041
|
+
!item.SourceFieldName ||
|
|
1042
|
+
this.UnlinkingTrackKey) {
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
this.clearHoverTimers();
|
|
1046
|
+
if (this.HoveredItem?.TrackKey === item.TrackKey) {
|
|
1047
|
+
this.HoveredItem = null;
|
|
1048
|
+
}
|
|
1049
|
+
this.UnlinkingTrackKey = item.TrackKey;
|
|
1050
|
+
this.ErrorMessage = null;
|
|
1051
|
+
this.cdr.markForCheck();
|
|
1052
|
+
try {
|
|
1053
|
+
record.Set(item.SourceFieldName, null);
|
|
1054
|
+
if (item.SourceEntityIDFieldName) {
|
|
1055
|
+
const entityIdCol = item.SourceEntityIDFieldName;
|
|
1056
|
+
const sharedByAnotherActiveField = (record.EntityInfo?.Fields ?? []).some(f => {
|
|
1057
|
+
if (f.Name === item.SourceFieldName)
|
|
1058
|
+
return false;
|
|
1059
|
+
if (f.EntityIDFieldName?.trim() !== entityIdCol)
|
|
1060
|
+
return false;
|
|
1061
|
+
const val = record.Get(f.Name);
|
|
1062
|
+
return val != null && String(val).trim() !== '';
|
|
1063
|
+
});
|
|
1064
|
+
const entityIdFieldInfo = record.EntityInfo?.Fields?.find(f => f.Name === entityIdCol);
|
|
1065
|
+
if (!sharedByAnotherActiveField && entityIdFieldInfo?.AllowsNull) {
|
|
1066
|
+
record.Set(entityIdCol, null);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
if (record.IsSaved && typeof record.Save === 'function') {
|
|
1070
|
+
const saved = await record.Save();
|
|
1071
|
+
if (!saved) {
|
|
1072
|
+
const latestMsg = record.LatestResult?.Message;
|
|
1073
|
+
this.ErrorMessage = latestMsg || 'Unable to unlink record.';
|
|
1074
|
+
this.UnlinkingTrackKey = null;
|
|
1075
|
+
this.cdr.markForCheck();
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
this.AllItems = this.AllItems.filter(existing => existing.TrackKey !== item.TrackKey);
|
|
1080
|
+
this.UnlinkingTrackKey = null;
|
|
1081
|
+
this.emitCountAndSummary();
|
|
1082
|
+
this.RecordLinkModified.emit({ Action: 'unlinked', Item: item });
|
|
1083
|
+
this.cdr.markForCheck();
|
|
1084
|
+
}
|
|
1085
|
+
catch (err) {
|
|
1086
|
+
this.ErrorMessage = err instanceof Error ? err.message : 'Unable to unlink record.';
|
|
1087
|
+
this.UnlinkingTrackKey = null;
|
|
1088
|
+
this.cdr.markForCheck();
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
clearHoverTimers() {
|
|
1092
|
+
if (this.hoverOpenTimer) {
|
|
1093
|
+
clearTimeout(this.hoverOpenTimer);
|
|
1094
|
+
this.hoverOpenTimer = null;
|
|
1095
|
+
}
|
|
1096
|
+
if (this.hoverCloseTimer) {
|
|
1097
|
+
clearTimeout(this.hoverCloseTimer);
|
|
1098
|
+
this.hoverCloseTimer = null;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
/** Request to close the drawer */
|
|
1102
|
+
OnClose() {
|
|
1103
|
+
this.Close.emit();
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Load bidirectional links for `this.Record` (both outgoing FK / polymorphic FK fields on
|
|
1107
|
+
* this record and incoming dependencies via `GetRecordDependencies`), filter out system
|
|
1108
|
+
* telemetry entities and unreadable entities, and batch-enrich record names/dates via `RunViews`.
|
|
1109
|
+
*/
|
|
1110
|
+
async LoadLinks(forceRefresh = false) {
|
|
1111
|
+
const record = this._record;
|
|
1112
|
+
if (!record || !record.IsSaved || !record.EntityInfo) {
|
|
1113
|
+
this.AllItems = [];
|
|
1114
|
+
this.IsLoading = false;
|
|
1115
|
+
this.ErrorMessage = null;
|
|
1116
|
+
this.emitCountAndSummary();
|
|
1117
|
+
this.cdr.markForCheck();
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
const currentVersion = ++this.loadVersion;
|
|
1121
|
+
this.IsLoading = true;
|
|
1122
|
+
this.ErrorMessage = null;
|
|
1123
|
+
this.cdr.markForCheck();
|
|
1124
|
+
try {
|
|
1125
|
+
const provider = this.ProviderToUse;
|
|
1126
|
+
const entities = provider.Entities ?? [];
|
|
1127
|
+
// 1. Outgoing candidates from this record's own FK and polymorphic FK fields
|
|
1128
|
+
const outgoingCandidates = MjRecordLinksComponent.extractOutgoingCandidates(record, provider, entities);
|
|
1129
|
+
// 2. Incoming dependencies from GetRecordDependencies (reusing pre-warmed cache when fresh)
|
|
1130
|
+
const deps = await MjRecordLinksComponent.fetchDependenciesWithCache(record, provider, forceRefresh);
|
|
1131
|
+
if (this.isDestroyed || currentVersion !== this.loadVersion) {
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
const filteredDeps = MjRecordLinksComponent.filterIncomingDependencies(deps, entities);
|
|
1135
|
+
if (outgoingCandidates.length === 0 && filteredDeps.length === 0) {
|
|
1136
|
+
this.AllItems = [];
|
|
1137
|
+
this.IsLoading = false;
|
|
1138
|
+
this.emitCountAndSummary();
|
|
1139
|
+
this.cdr.markForCheck();
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
// Combine target primary keys per related entity so we batch-enrich both outgoing and incoming in a single RunViews call
|
|
1143
|
+
const keysByEntity = new Map();
|
|
1144
|
+
for (const out of outgoingCandidates) {
|
|
1145
|
+
const list = keysByEntity.get(out.EntityName) ?? [];
|
|
1146
|
+
list.push(out.PrimaryKey);
|
|
1147
|
+
keysByEntity.set(out.EntityName, list);
|
|
1148
|
+
}
|
|
1149
|
+
for (const dep of filteredDeps) {
|
|
1150
|
+
const list = keysByEntity.get(dep.RelatedEntityName) ?? [];
|
|
1151
|
+
list.push(dep.PrimaryKey);
|
|
1152
|
+
keysByEntity.set(dep.RelatedEntityName, list);
|
|
1153
|
+
}
|
|
1154
|
+
const groupEntries = Array.from(keysByEntity.entries());
|
|
1155
|
+
const viewParamsList = [];
|
|
1156
|
+
for (const [relatedEntityName, pks] of groupEntries) {
|
|
1157
|
+
const relatedEntity = this.findEntityInfo(entities, relatedEntityName);
|
|
1158
|
+
const fieldsToRequest = this.buildFieldsToRequestForKeys(relatedEntity, pks);
|
|
1159
|
+
const extraFilter = this.buildBatchWhereClauseForKeys(pks.slice(0, 50));
|
|
1160
|
+
viewParamsList.push({
|
|
1161
|
+
EntityName: relatedEntityName,
|
|
1162
|
+
ExtraFilter: extraFilter,
|
|
1163
|
+
Fields: fieldsToRequest,
|
|
1164
|
+
ResultType: 'simple',
|
|
1165
|
+
MaxRows: 50
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
const rowsByEntity = new Map();
|
|
1169
|
+
if (viewParamsList.length > 0) {
|
|
1170
|
+
try {
|
|
1171
|
+
const rv = RunView.FromMetadataProvider(provider);
|
|
1172
|
+
const viewResults = await rv.RunViews(viewParamsList);
|
|
1173
|
+
if (Array.isArray(viewResults)) {
|
|
1174
|
+
for (let i = 0; i < groupEntries.length; i++) {
|
|
1175
|
+
const [relatedEntityName] = groupEntries[i];
|
|
1176
|
+
const res = viewResults[i];
|
|
1177
|
+
if (res && res.Success && Array.isArray(res.Results)) {
|
|
1178
|
+
rowsByEntity.set(relatedEntityName, res.Results);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
catch {
|
|
1184
|
+
// Fallback gracefully to primary-key display labels if batch view enrichment fails
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
if (this.isDestroyed || currentVersion !== this.loadVersion) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
const enrichedItems = [];
|
|
1191
|
+
let index = 0;
|
|
1192
|
+
// Build Outgoing items first ("On This Record")
|
|
1193
|
+
for (const out of outgoingCandidates) {
|
|
1194
|
+
const relatedEntity = out.RelatedEntity ?? this.findEntityInfo(entities, out.EntityName);
|
|
1195
|
+
const entityDisplayName = relatedEntity?.DisplayNameOrName || out.EntityName;
|
|
1196
|
+
const entityIcon = relatedEntity?.Icon || 'fa-solid fa-link';
|
|
1197
|
+
const entityRows = rowsByEntity.get(out.EntityName) ?? [];
|
|
1198
|
+
const matchedRow = this.findMatchingRow(entityRows, out.PrimaryKey);
|
|
1199
|
+
const displayName = out.PreResolvedDisplayName || this.resolveRecordDisplayName(matchedRow, relatedEntity, entityDisplayName, out.PrimaryKey);
|
|
1200
|
+
const relationshipLabel = this.humanizeFieldName(out.FieldInfo.DisplayNameOrName || out.FieldInfo.Name);
|
|
1201
|
+
const statusLabel = this.resolveStatusLabel(matchedRow, relatedEntity);
|
|
1202
|
+
const formattedDate = this.resolveFormattedDate(matchedRow);
|
|
1203
|
+
const pkConcat = this.getPrimaryKeyString(out.PrimaryKey);
|
|
1204
|
+
const canUnlink = Boolean(out.FieldInfo.AllowsNull &&
|
|
1205
|
+
!out.FieldInfo.ReadOnly &&
|
|
1206
|
+
out.FieldInfo.AllowUpdateAPI !== false);
|
|
1207
|
+
enrichedItems.push({
|
|
1208
|
+
TrackKey: `out:${out.EntityName}:${out.FieldInfo.Name}:${pkConcat}:${index++}`,
|
|
1209
|
+
EntityName: out.EntityName,
|
|
1210
|
+
EntityDisplayName: entityDisplayName,
|
|
1211
|
+
EntityIcon: entityIcon,
|
|
1212
|
+
PrimaryKey: out.PrimaryKey,
|
|
1213
|
+
DisplayName: displayName,
|
|
1214
|
+
RelationshipLabel: relationshipLabel,
|
|
1215
|
+
StatusLabel: statusLabel,
|
|
1216
|
+
FormattedDate: formattedDate,
|
|
1217
|
+
IsSoftLink: out.IsSoftLink,
|
|
1218
|
+
LinkTypeLabel: out.IsSoftLink ? 'Cross-App Link' : 'Direct Relationship',
|
|
1219
|
+
Direction: 'outgoing',
|
|
1220
|
+
DirectionLabel: 'On This Record',
|
|
1221
|
+
SourceFieldName: out.FieldInfo.Name,
|
|
1222
|
+
SourceEntityIDFieldName: out.FieldInfo.EntityIDFieldName?.trim() || null,
|
|
1223
|
+
CanUnlink: canUnlink
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
// Build Incoming items ("Linked To This")
|
|
1227
|
+
for (const dep of filteredDeps) {
|
|
1228
|
+
const relatedEntity = this.findEntityInfo(entities, dep.RelatedEntityName);
|
|
1229
|
+
const entityDisplayName = relatedEntity?.DisplayNameOrName || dep.RelatedEntityName;
|
|
1230
|
+
const entityIcon = relatedEntity?.Icon || 'fa-solid fa-link';
|
|
1231
|
+
const entityRows = rowsByEntity.get(dep.RelatedEntityName) ?? [];
|
|
1232
|
+
const matchedRow = this.findMatchingRow(entityRows, dep.PrimaryKey);
|
|
1233
|
+
const displayName = this.resolveRecordDisplayName(matchedRow, relatedEntity, entityDisplayName, dep.PrimaryKey);
|
|
1234
|
+
const relationshipLabel = this.resolveRelationshipLabel(dep, relatedEntity);
|
|
1235
|
+
const statusLabel = this.resolveStatusLabel(matchedRow, relatedEntity);
|
|
1236
|
+
const formattedDate = this.resolveFormattedDate(matchedRow);
|
|
1237
|
+
const isSoft = Boolean(dep.IsSoftLink);
|
|
1238
|
+
const pkConcat = this.getPrimaryKeyString(dep.PrimaryKey);
|
|
1239
|
+
enrichedItems.push({
|
|
1240
|
+
TrackKey: `in:${dep.RelatedEntityName}:${dep.FieldName}:${pkConcat}:${index++}`,
|
|
1241
|
+
EntityName: dep.RelatedEntityName,
|
|
1242
|
+
EntityDisplayName: entityDisplayName,
|
|
1243
|
+
EntityIcon: entityIcon,
|
|
1244
|
+
PrimaryKey: dep.PrimaryKey,
|
|
1245
|
+
DisplayName: displayName,
|
|
1246
|
+
RelationshipLabel: relationshipLabel,
|
|
1247
|
+
StatusLabel: statusLabel,
|
|
1248
|
+
FormattedDate: formattedDate,
|
|
1249
|
+
IsSoftLink: isSoft,
|
|
1250
|
+
LinkTypeLabel: isSoft ? 'Cross-App Link' : 'Direct Relationship',
|
|
1251
|
+
Direction: 'incoming',
|
|
1252
|
+
DirectionLabel: 'Linked To This'
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
this.AllItems = enrichedItems;
|
|
1256
|
+
this.IsLoading = false;
|
|
1257
|
+
this.emitCountAndSummary();
|
|
1258
|
+
this.cdr.markForCheck();
|
|
1259
|
+
}
|
|
1260
|
+
catch (err) {
|
|
1261
|
+
if (this.isDestroyed || currentVersion !== this.loadVersion) {
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
this.AllItems = [];
|
|
1265
|
+
this.IsLoading = false;
|
|
1266
|
+
this.ErrorMessage = err instanceof Error ? err.message : 'Unable to load linked records.';
|
|
1267
|
+
this.emitCountAndSummary();
|
|
1268
|
+
this.cdr.markForCheck();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
emitCountAndSummary() {
|
|
1272
|
+
this.LinkCountChange.emit(this.AllItems.length);
|
|
1273
|
+
const byEntityMap = new Map();
|
|
1274
|
+
for (const item of this.AllItems) {
|
|
1275
|
+
let entry = byEntityMap.get(item.EntityName);
|
|
1276
|
+
if (!entry) {
|
|
1277
|
+
entry = {
|
|
1278
|
+
EntityName: item.EntityName,
|
|
1279
|
+
EntityDisplayName: item.EntityDisplayName,
|
|
1280
|
+
HasOutgoing: false,
|
|
1281
|
+
HasIncoming: false,
|
|
1282
|
+
Count: 0,
|
|
1283
|
+
SampleNames: []
|
|
1284
|
+
};
|
|
1285
|
+
byEntityMap.set(item.EntityName, entry);
|
|
1286
|
+
}
|
|
1287
|
+
if (item.Direction === 'outgoing')
|
|
1288
|
+
entry.HasOutgoing = true;
|
|
1289
|
+
if (item.Direction === 'incoming')
|
|
1290
|
+
entry.HasIncoming = true;
|
|
1291
|
+
entry.Count += 1;
|
|
1292
|
+
if (item.DisplayName && entry.SampleNames.length < 3) {
|
|
1293
|
+
entry.SampleNames.push(item.DisplayName);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
this.LinksSummaryChange.emit({
|
|
1297
|
+
TotalCount: this.AllItems.length,
|
|
1298
|
+
OutgoingCount: this.OutgoingLinkCount,
|
|
1299
|
+
IncomingCount: this.IncomingLinkCount,
|
|
1300
|
+
ByEntity: Array.from(byEntityMap.values()).map(e => ({
|
|
1301
|
+
EntityName: e.EntityName,
|
|
1302
|
+
EntityDisplayName: e.EntityDisplayName,
|
|
1303
|
+
Direction: e.HasOutgoing && e.HasIncoming ? 'both' : e.HasOutgoing ? 'outgoing' : 'incoming',
|
|
1304
|
+
Count: e.Count,
|
|
1305
|
+
SampleNames: e.SampleNames
|
|
1306
|
+
}))
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
computeRecordSignature(record) {
|
|
1310
|
+
if (!record || !record.EntityInfo) {
|
|
1311
|
+
return '';
|
|
1312
|
+
}
|
|
1313
|
+
const pk = this.getPrimaryKeyString(record.PrimaryKey);
|
|
1314
|
+
return `${record.EntityInfo.Name}:${pk}:${record.IsSaved}`;
|
|
1315
|
+
}
|
|
1316
|
+
findEntityInfo(entities, entityName) {
|
|
1317
|
+
return MjRecordLinksComponent.findEntityInfoStatic(entities, entityName);
|
|
1318
|
+
}
|
|
1319
|
+
buildFieldsToRequestForKeys(relatedEntity, pks) {
|
|
1320
|
+
const fieldSet = new Set();
|
|
1321
|
+
if (relatedEntity?.PrimaryKeys?.length) {
|
|
1322
|
+
for (const pk of relatedEntity.PrimaryKeys) {
|
|
1323
|
+
fieldSet.add(pk.Name);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
for (const pk of pks) {
|
|
1327
|
+
for (const kv of pk?.KeyValuePairs ?? []) {
|
|
1328
|
+
if (kv.FieldName) {
|
|
1329
|
+
fieldSet.add(kv.FieldName);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
if (fieldSet.size === 0) {
|
|
1334
|
+
fieldSet.add('ID');
|
|
1335
|
+
}
|
|
1336
|
+
if (relatedEntity?.NameField?.Name) {
|
|
1337
|
+
fieldSet.add(relatedEntity.NameField.Name);
|
|
1338
|
+
}
|
|
1339
|
+
else if (relatedEntity?.Fields?.length) {
|
|
1340
|
+
for (const candidate of ['Name', 'Title', 'Subject']) {
|
|
1341
|
+
const found = relatedEntity.Fields.find(f => f.Name.toLowerCase() === candidate.toLowerCase());
|
|
1342
|
+
if (found) {
|
|
1343
|
+
fieldSet.add(found.Name);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
if (!relatedEntity?.Fields?.length || relatedEntity.Fields.some(f => f.Name === '__mj_UpdatedAt')) {
|
|
1348
|
+
fieldSet.add('__mj_UpdatedAt');
|
|
1349
|
+
}
|
|
1350
|
+
if (relatedEntity?.Fields?.length) {
|
|
1351
|
+
for (const candidate of ['Status', 'Type', 'Role']) {
|
|
1352
|
+
const found = relatedEntity.Fields.find(f => f.Name.toLowerCase() === candidate.toLowerCase());
|
|
1353
|
+
if (found) {
|
|
1354
|
+
fieldSet.add(found.Name);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
return Array.from(fieldSet);
|
|
1359
|
+
}
|
|
1360
|
+
buildBatchWhereClauseForKeys(pks) {
|
|
1361
|
+
const clauses = [];
|
|
1362
|
+
for (const pkRaw of pks) {
|
|
1363
|
+
const pk = pkRaw;
|
|
1364
|
+
if (!pk) {
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
const wc = typeof pk.ToWhereClause === 'function'
|
|
1368
|
+
? pk.ToWhereClause()
|
|
1369
|
+
: typeof pk.WhereClause === 'function'
|
|
1370
|
+
? pk.WhereClause()
|
|
1371
|
+
: '';
|
|
1372
|
+
if (wc && wc.trim().length > 0) {
|
|
1373
|
+
clauses.push(`(${wc})`);
|
|
1374
|
+
continue;
|
|
1375
|
+
}
|
|
1376
|
+
if (Array.isArray(pk.KeyValuePairs) && pk.KeyValuePairs.length > 0) {
|
|
1377
|
+
const parts = pk.KeyValuePairs.map(kv => `[${kv.FieldName}] = '${String(kv.Value).replace(/'/g, "''")}'`);
|
|
1378
|
+
clauses.push(`(${parts.join(' AND ')})`);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
return clauses.join(' OR ');
|
|
1382
|
+
}
|
|
1383
|
+
findMatchingRow(rows, primaryKey) {
|
|
1384
|
+
const kvPairs = primaryKey?.KeyValuePairs ?? [];
|
|
1385
|
+
if (kvPairs.length === 0 || rows.length === 0) {
|
|
1386
|
+
return undefined;
|
|
1387
|
+
}
|
|
1388
|
+
return rows.find(row => kvPairs.every(kv => {
|
|
1389
|
+
const rowVal = row[kv.FieldName];
|
|
1390
|
+
if (rowVal === undefined || rowVal === null) {
|
|
1391
|
+
return false;
|
|
1392
|
+
}
|
|
1393
|
+
return String(rowVal).trim().toLowerCase() === String(kv.Value).trim().toLowerCase();
|
|
1394
|
+
}));
|
|
1395
|
+
}
|
|
1396
|
+
resolveRecordDisplayName(row, relatedEntity, entityDisplayName, primaryKey) {
|
|
1397
|
+
if (row) {
|
|
1398
|
+
const nameFieldName = relatedEntity?.NameField?.Name;
|
|
1399
|
+
if (nameFieldName && row[nameFieldName] !== undefined && row[nameFieldName] !== null && String(row[nameFieldName]).trim() !== '') {
|
|
1400
|
+
const candidateName = String(row[nameFieldName]).trim();
|
|
1401
|
+
if (!this.isRawUuid(candidateName)) {
|
|
1402
|
+
return candidateName;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
for (const candidate of ['Name', 'Title', 'Subject', 'DisplayName']) {
|
|
1406
|
+
const val = row[candidate];
|
|
1407
|
+
if (val !== undefined && val !== null && String(val).trim() !== '') {
|
|
1408
|
+
const candidateName = String(val).trim();
|
|
1409
|
+
if (!this.isRawUuid(candidateName)) {
|
|
1410
|
+
return candidateName;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
const pkValue = primaryKey?.KeyValuePairs?.[0]?.Value;
|
|
1416
|
+
if (pkValue !== undefined && pkValue !== null && String(pkValue).trim() !== '') {
|
|
1417
|
+
const rawPk = String(pkValue).trim();
|
|
1418
|
+
if (this.isRawUuid(rawPk)) {
|
|
1419
|
+
return `${entityDisplayName} · ${rawPk.slice(0, 6)}…${rawPk.slice(-4)}`;
|
|
1420
|
+
}
|
|
1421
|
+
return `${entityDisplayName} #${rawPk}`;
|
|
1422
|
+
}
|
|
1423
|
+
return entityDisplayName;
|
|
1424
|
+
}
|
|
1425
|
+
isRawUuid(value) {
|
|
1426
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value.trim());
|
|
1427
|
+
}
|
|
1428
|
+
resolveRelationshipLabel(dep, relatedEntity) {
|
|
1429
|
+
const depWithDisplay = dep;
|
|
1430
|
+
if (depWithDisplay.FieldDisplayName && depWithDisplay.FieldDisplayName.trim().length > 0) {
|
|
1431
|
+
return depWithDisplay.FieldDisplayName.trim();
|
|
1432
|
+
}
|
|
1433
|
+
const fieldInfo = relatedEntity?.Fields?.find(f => f.Name.trim().toLowerCase() === dep.FieldName.trim().toLowerCase());
|
|
1434
|
+
if (fieldInfo?.DisplayNameOrName && fieldInfo.DisplayNameOrName.trim().length > 0) {
|
|
1435
|
+
const label = fieldInfo.DisplayNameOrName.trim();
|
|
1436
|
+
if (label.toLowerCase() !== 'record id' && label.toLowerCase() !== 'recordid') {
|
|
1437
|
+
return label;
|
|
1438
|
+
}
|
|
1439
|
+
return 'Linked Record';
|
|
1440
|
+
}
|
|
1441
|
+
return this.humanizeFieldName(dep.FieldName);
|
|
1442
|
+
}
|
|
1443
|
+
humanizeFieldName(fieldName) {
|
|
1444
|
+
if (!fieldName) {
|
|
1445
|
+
return 'Linked Record';
|
|
1446
|
+
}
|
|
1447
|
+
const trimmed = fieldName.trim();
|
|
1448
|
+
if (trimmed.toLowerCase() === 'recordid' || trimmed.toLowerCase() === 'record id') {
|
|
1449
|
+
return 'Linked Record';
|
|
1450
|
+
}
|
|
1451
|
+
const withoutId = trimmed.replace(/\s*ID$/i, '');
|
|
1452
|
+
const spaced = withoutId.replace(/([a-z0-9])([A-Z])/g, '$1 $2').trim();
|
|
1453
|
+
return spaced.length > 0 ? spaced : 'Linked Record';
|
|
1454
|
+
}
|
|
1455
|
+
resolveStatusLabel(row, relatedEntity) {
|
|
1456
|
+
if (!row) {
|
|
1457
|
+
return '';
|
|
1458
|
+
}
|
|
1459
|
+
for (const candidate of ['Status', 'Type', 'Role']) {
|
|
1460
|
+
const fieldName = relatedEntity?.Fields?.find(f => f.Name.toLowerCase() === candidate.toLowerCase())?.Name ??
|
|
1461
|
+
candidate;
|
|
1462
|
+
const val = row[fieldName];
|
|
1463
|
+
if (val !== undefined && val !== null && String(val).trim() !== '') {
|
|
1464
|
+
return String(val).trim();
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
return '';
|
|
1468
|
+
}
|
|
1469
|
+
resolveFormattedDate(row) {
|
|
1470
|
+
if (!row) {
|
|
1471
|
+
return '';
|
|
1472
|
+
}
|
|
1473
|
+
const raw = row['__mj_UpdatedAt'];
|
|
1474
|
+
if (!raw) {
|
|
1475
|
+
return '';
|
|
1476
|
+
}
|
|
1477
|
+
const date = raw instanceof Date ? raw : new Date(String(raw));
|
|
1478
|
+
if (isNaN(date.getTime())) {
|
|
1479
|
+
return '';
|
|
1480
|
+
}
|
|
1481
|
+
return date.toLocaleDateString(undefined, {
|
|
1482
|
+
month: 'short',
|
|
1483
|
+
day: 'numeric',
|
|
1484
|
+
year: 'numeric'
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
getPrimaryKeyString(primaryKey) {
|
|
1488
|
+
return MjRecordLinksComponent.getPrimaryKeyStringStatic(primaryKey);
|
|
1489
|
+
}
|
|
1490
|
+
static ɵfac = /*@__PURE__*/ (() => { let ɵMjRecordLinksComponent_BaseFactory; return function MjRecordLinksComponent_Factory(__ngFactoryType__) { return (ɵMjRecordLinksComponent_BaseFactory || (ɵMjRecordLinksComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MjRecordLinksComponent)))(__ngFactoryType__ || MjRecordLinksComponent); }; })();
|
|
1491
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MjRecordLinksComponent, selectors: [["mj-record-links"]], inputs: { Record: "Record", InitialLinkFilter: "InitialLinkFilter", Mode: "Mode", IsOpen: "IsOpen", AllowQuickUnlink: "AllowQuickUnlink" }, outputs: { Navigate: "Navigate", Close: "Close", LinkCountChange: "LinkCountChange", LinksSummaryChange: "LinksSummaryChange", RecordLinkModified: "RecordLinkModified" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 1, consts: [["linksContentTpl", ""], [1, "mj-links-widget"], [1, "mj-links-backdrop", 3, "click"], ["role", "dialog", "aria-label", "Links", 1, "mj-links-drawer"], [1, "mj-links-drawer__header"], [1, "mj-links-drawer__title-group"], [1, "mj-links-drawer__icon"], [1, "fa-solid", "fa-link"], [1, "mj-links-drawer__titles"], [1, "mj-links-drawer__title"], [1, "mj-links-drawer__count"], [1, "mj-links-drawer__subtitle"], [1, "mj-links-drawer__header-actions"], ["type", "button", "title", "Refresh links", "aria-label", "Refresh links", 1, "mj-links-icon-btn", 3, "click", "disabled"], [1, "fa-solid", "fa-arrows-rotate"], ["type", "button", "title", "Close Links panel", "aria-label", "Close Links panel", 1, "mj-links-icon-btn", 3, "click"], [1, "fa-solid", "fa-xmark"], [1, "mj-links-drawer__body"], [4, "ngTemplateOutlet"], [1, "mj-links-controls"], ["role", "tablist", "aria-label", "Link direction filter", 1, "mj-links-direction-tabs"], [1, "mj-links-search-row"], [1, "mj-links-search"], [1, "fa-solid", "fa-magnifying-glass", "mj-links-search__icon"], ["type", "text", "placeholder", "Search linked records...", "aria-label", "Search linked records", 1, "mj-links-search__input", 3, "input", "value"], ["type", "button", "title", "Clear search", "aria-label", "Clear search", 1, "mj-links-search__clear"], ["type", "button", "title", "Filter by link type", 1, "mj-links-filter-toggle", 3, "click"], [1, "fa-solid", "fa-sliders"], [1, "mj-links-filter-toggle__dot"], [1, "mj-links-filter-panel"], ["role", "tablist", "aria-label", "Linked record categories", 1, "mj-links-chips"], [1, "mj-links-state"], [1, "mj-links-state", "mj-links-state--error"], [1, "mj-links-state", "mj-links-state--empty"], [1, "mj-links-groups"], ["type", "button", 1, "mj-links-direction-tab", 3, "click"], [1, "mj-links-direction-tab__count"], ["type", "button", "title", "Records referenced by fields on this record", 1, "mj-links-direction-tab", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-up-right-from-square"], ["type", "button", "title", "Other records that reference this record", 1, "mj-links-direction-tab", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-turn-up"], ["type", "button", "title", "Clear search", "aria-label", "Clear search", 1, "mj-links-search__clear", 3, "click"], [1, "mj-links-filter-panel__label"], ["role", "radiogroup", "aria-label", "Link Type", 1, "mj-links-filter-options"], ["type", "button", 1, "mj-links-filter-option", 3, "click"], [1, "mj-links-filter-option__count"], [1, "fa-solid", "fa-diagram-project"], ["type", "button", 1, "mj-links-chip", 3, "mj-links-chip--active"], ["type", "button", 1, "mj-links-chip", 3, "click"], [1, "mj-links-chip__label"], [1, "mj-links-chip__count"], [1, "fa-solid", "fa-spinner", "fa-spin", "mj-links-state__spinner"], [1, "fa-solid", "fa-circle-exclamation"], [1, "mj-links-state__icon"], [1, "fa-solid", "fa-link-slash"], [1, "mj-links-state__title"], [1, "mj-links-state__desc"], [1, "fa-solid", "fa-filter-circle-xmark"], ["type", "button", 1, "mj-links-reset-btn", 3, "click"], [1, "mj-links-group"], [1, "mj-links-group__header"], [1, "mj-links-group__title"], [1, "mj-links-group__badge"], [1, "mj-links-group__items"], [1, "mj-links-card-row"], ["type", "button", 1, "mj-links-card", 3, "Navigate", "RecordUpdated", "mjRecordLink", "FieldName", "EntityName", "PrimaryKey", "DisplayName", "Provider"], [1, "mj-links-card__main"], [1, "mj-links-card__title-row"], [1, "mj-links-card__title"], [1, "mj-links-card__status"], [1, "mj-links-card__meta"], [1, "mj-links-card__direction-pill"], ["aria-hidden", "true"], [1, "mj-links-card__relationship"], [1, "mj-links-card__type-pill"], [1, "mj-links-card__date"], [1, "fa-solid", "fa-chevron-right", "mj-links-card__chevron"], ["type", "button", 1, "mj-links-card__unlink-btn", 3, "disabled"], ["type", "button", 1, "mj-links-card__unlink-btn", 3, "click", "disabled"]], template: function MjRecordLinksComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1492
|
+
i0.ɵɵconditionalCreate(0, MjRecordLinksComponent_Conditional_0_Template, 1, 1)(1, MjRecordLinksComponent_Conditional_1_Template, 2, 1, "div", 1);
|
|
1493
|
+
i0.ɵɵtemplate(2, MjRecordLinksComponent_ng_template_2_Template, 19, 10, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
|
|
1494
|
+
} if (rf & 2) {
|
|
1495
|
+
i0.ɵɵconditional(ctx.Mode === "drawer" ? 0 : 1);
|
|
1496
|
+
} }, styles: ["\n.mj-links-backdrop[_ngcontent-%COMP%] {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.28);\n z-index: 999;\n animation: _ngcontent-%COMP%_mjLinksFadeIn 0.15s ease-out;\n}\n\n.mj-links-drawer[_ngcontent-%COMP%] {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n width: 420px;\n max-width: 92vw;\n background: var(--mj-bg-surface);\n border-left: 1px solid var(--mj-border-default);\n box-shadow: -8px 0 28px rgba(0, 0, 0, 0.14);\n z-index: 1000;\n display: flex;\n flex-direction: column;\n animation: _ngcontent-%COMP%_mjLinksSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n@keyframes _ngcontent-%COMP%_mjLinksFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes _ngcontent-%COMP%_mjLinksSlideIn {\n from { transform: translateX(100%); }\n to { transform: translateX(0); }\n}\n\n.mj-links-drawer__header[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 18px;\n border-bottom: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n}\n\n.mj-links-drawer__title-group[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.mj-links-drawer__icon[_ngcontent-%COMP%] {\n width: 34px;\n height: 34px;\n border-radius: 8px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent);\n color: var(--mj-brand-primary);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n}\n\n.mj-links-drawer__titles[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.mj-links-drawer__title[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-links-drawer__count[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 20px;\n padding: 0 6px;\n border-radius: 999px;\n font-size: 11px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-brand-primary) 14%, transparent);\n color: var(--mj-brand-primary);\n}\n\n.mj-links-drawer__subtitle[_ngcontent-%COMP%] {\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.mj-links-drawer__header-actions[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.mj-links-icon-btn[_ngcontent-%COMP%] {\n width: 30px;\n height: 30px;\n border: 1px solid transparent;\n border-radius: 6px;\n background: transparent;\n color: var(--mj-text-secondary);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: background 0.15s ease, color 0.15s ease;\n}\n\n.mj-links-icon-btn[_ngcontent-%COMP%]:hover:not(:disabled) {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n}\n\n.mj-links-drawer__body[_ngcontent-%COMP%] {\n flex: 1;\n overflow-y: auto;\n padding: 14px 16px;\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n\n.mj-links-widget[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n\n.mj-links-controls[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.mj-links-direction-tabs[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 4px;\n padding: 3px;\n border-radius: 8px;\n background: var(--mj-bg-surface-sunken);\n border: 1px solid var(--mj-border-subtle);\n}\n\n.mj-links-direction-tab[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n padding: 6px 8px;\n border-radius: 6px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--mj-text-secondary);\n font-size: 11px;\n font-weight: 600;\n font-family: inherit;\n cursor: pointer;\n transition: all 0.15s ease;\n white-space: nowrap;\n}\n\n.mj-links-direction-tab[_ngcontent-%COMP%]:hover {\n color: var(--mj-text-primary);\n}\n\n.mj-links-direction-tab--active[_ngcontent-%COMP%] {\n background: var(--mj-bg-surface);\n color: var(--mj-brand-primary);\n border-color: var(--mj-border-default);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);\n}\n\n.mj-links-direction-tab__count[_ngcontent-%COMP%] {\n font-size: 10px;\n padding: 1px 5px;\n border-radius: 999px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n\n.mj-links-search-row[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-links-search[_ngcontent-%COMP%] {\n position: relative;\n flex: 1;\n display: flex;\n align-items: center;\n}\n\n.mj-links-search__icon[_ngcontent-%COMP%] {\n position: absolute;\n left: 10px;\n font-size: 12px;\n color: var(--mj-text-muted);\n pointer-events: none;\n}\n\n.mj-links-search__input[_ngcontent-%COMP%] {\n width: 100%;\n padding: 7px 28px 7px 30px;\n font-size: 13px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: 7px;\n outline: none;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n\n.mj-links-search__input[_ngcontent-%COMP%]:focus {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n}\n\n.mj-links-search__clear[_ngcontent-%COMP%] {\n position: absolute;\n right: 6px;\n width: 20px;\n height: 20px;\n border: none;\n background: transparent;\n color: var(--mj-text-muted);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n}\n\n.mj-links-search__clear[_ngcontent-%COMP%]:hover {\n color: var(--mj-text-primary);\n}\n\n.mj-links-filter-toggle[_ngcontent-%COMP%] {\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 7px 11px;\n font-size: 12px;\n font-weight: 500;\n color: var(--mj-text-secondary);\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: 7px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.mj-links-filter-toggle[_ngcontent-%COMP%]:hover, \n.mj-links-filter-toggle--active[_ngcontent-%COMP%] {\n border-color: var(--mj-brand-primary);\n color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent);\n}\n\n.mj-links-filter-toggle__dot[_ngcontent-%COMP%] {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--mj-brand-primary);\n}\n\n.mj-links-filter-panel[_ngcontent-%COMP%] {\n padding: 10px 12px;\n border-radius: 8px;\n background: var(--mj-bg-surface-card);\n border: 1px solid var(--mj-border-default);\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.mj-links-filter-panel__label[_ngcontent-%COMP%] {\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-muted);\n}\n\n.mj-links-filter-options[_ngcontent-%COMP%] {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.mj-links-filter-option[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 5px 10px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 6px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.mj-links-filter-option--active[_ngcontent-%COMP%] {\n border-color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n color: var(--mj-brand-primary);\n font-weight: 600;\n}\n\n.mj-links-filter-option__count[_ngcontent-%COMP%] {\n font-size: 11px;\n opacity: 0.8;\n}\n\n\n.mj-links-chips[_ngcontent-%COMP%] {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.mj-links-chip[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n border-radius: 999px;\n font-size: 12px;\n font-weight: 500;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.mj-links-chip[_ngcontent-%COMP%]:hover {\n border-color: var(--mj-brand-primary);\n color: var(--mj-text-primary);\n}\n\n.mj-links-chip--active[_ngcontent-%COMP%] {\n background: var(--mj-brand-primary);\n border-color: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n}\n\n.mj-links-chip__count[_ngcontent-%COMP%] {\n font-size: 11px;\n opacity: 0.85;\n}\n\n\n.mj-links-groups[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n.mj-links-group[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.mj-links-group__header[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 2px 4px;\n}\n\n.mj-links-group__title[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 7px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.03em;\n color: var(--mj-text-secondary);\n}\n\n.mj-links-group__icon[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n font-size: 12px;\n}\n\n.mj-links-group__badge[_ngcontent-%COMP%] {\n font-size: 11px;\n font-weight: 600;\n padding: 1px 7px;\n border-radius: 999px;\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-muted);\n}\n\n.mj-links-group__items[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.mj-links-card[_ngcontent-%COMP%] {\n width: 100%;\n text-align: left;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n padding: 10px 12px;\n border-radius: 8px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n cursor: pointer;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;\n}\n\n.mj-links-card[_ngcontent-%COMP%]:hover {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n}\n\n.mj-links-card__main[_ngcontent-%COMP%] {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.mj-links-card__title-row[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-links-card__title[_ngcontent-%COMP%] {\n font-size: 13px;\n font-weight: 600;\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mj-links-card__status[_ngcontent-%COMP%] {\n font-size: 11px;\n font-weight: 500;\n padding: 1px 6px;\n border-radius: 4px;\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-secondary);\n flex-shrink: 0;\n}\n\n.mj-links-card__meta[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n font-size: 11px;\n color: var(--mj-text-muted);\n}\n\n.mj-links-card__direction-pill[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 1px 6px;\n border-radius: 4px;\n font-size: 10px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-status-info) 12%, var(--mj-bg-surface));\n color: var(--mj-status-info);\n}\n\n.mj-links-card__direction-pill--outgoing[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-status-success) 12%, var(--mj-bg-surface));\n color: var(--mj-status-success);\n}\n\n.mj-links-card__relationship[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n font-weight: 500;\n color: var(--mj-text-secondary);\n}\n\n.mj-links-card__type-pill[_ngcontent-%COMP%] {\n padding: 1px 6px;\n border-radius: 4px;\n font-size: 10px;\n font-weight: 600;\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-muted);\n}\n\n.mj-links-card__type-pill--soft[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n color: var(--mj-brand-primary);\n}\n\n.mj-links-card__chevron[_ngcontent-%COMP%] {\n font-size: 11px;\n color: var(--mj-text-muted);\n flex-shrink: 0;\n}\n\n.mj-links-card-row[_ngcontent-%COMP%] {\n display: flex;\n align-items: stretch;\n gap: 6px;\n}\n\n.mj-links-card__unlink-btn[_ngcontent-%COMP%] {\n flex-shrink: 0;\n width: 34px;\n border-radius: 8px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-text-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 12px;\n transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;\n}\n\n.mj-links-card__unlink-btn[_ngcontent-%COMP%]:hover:not(:disabled) {\n color: var(--mj-status-error);\n border-color: color-mix(in srgb, var(--mj-status-error) 45%, var(--mj-border-default));\n background: color-mix(in srgb, var(--mj-status-error) 10%, var(--mj-bg-surface));\n}\n\n.mj-links-card__unlink-btn[_ngcontent-%COMP%]:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n\n.mj-links-state[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 28px 16px;\n gap: 8px;\n color: var(--mj-text-muted);\n font-size: 13px;\n}\n\n.mj-links-state__icon[_ngcontent-%COMP%] {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: var(--mj-bg-surface-card);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n color: var(--mj-text-muted);\n}\n\n.mj-links-state__title[_ngcontent-%COMP%] {\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n}\n\n.mj-links-state__desc[_ngcontent-%COMP%] {\n font-size: 12px;\n color: var(--mj-text-muted);\n max-width: 280px;\n}\n\n.mj-links-reset-btn[_ngcontent-%COMP%] {\n margin-top: 4px;\n padding: 5px 12px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 6px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-brand-primary);\n cursor: pointer;\n}"], changeDetection: 0 });
|
|
1497
|
+
}
|
|
1498
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MjRecordLinksComponent, [{
|
|
1499
|
+
type: Component,
|
|
1500
|
+
args: [{ standalone: false, selector: 'mj-record-links', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (Mode === 'drawer') {\n @if (IsOpen) {\n <div class=\"mj-links-backdrop\" (click)=\"OnClose()\"></div>\n <aside class=\"mj-links-drawer\" role=\"dialog\" aria-label=\"Links\">\n <div class=\"mj-links-drawer__header\">\n <div class=\"mj-links-drawer__title-group\">\n <span class=\"mj-links-drawer__icon\">\n <i class=\"fa-solid fa-link\"></i>\n </span>\n <div class=\"mj-links-drawer__titles\">\n <h3 class=\"mj-links-drawer__title\">\n Links\n @if (TotalLinkCount > 0) {\n <span class=\"mj-links-drawer__count\">{{ TotalLinkCount }}</span>\n }\n </h3>\n <span class=\"mj-links-drawer__subtitle\">Connected records across your workspace</span>\n </div>\n </div>\n <div class=\"mj-links-drawer__header-actions\">\n <button\n type=\"button\"\n class=\"mj-links-icon-btn\"\n title=\"Refresh links\"\n aria-label=\"Refresh links\"\n [disabled]=\"IsLoading\"\n (click)=\"LoadLinks(true)\">\n <i class=\"fa-solid fa-arrows-rotate\" [class.fa-spin]=\"IsLoading\"></i>\n </button>\n <button\n type=\"button\"\n class=\"mj-links-icon-btn\"\n title=\"Close Links panel\"\n aria-label=\"Close Links panel\"\n (click)=\"OnClose()\">\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n </div>\n <div class=\"mj-links-drawer__body\">\n <ng-container *ngTemplateOutlet=\"linksContentTpl\"></ng-container>\n </div>\n </aside>\n }\n} @else {\n <div class=\"mj-links-widget\">\n <ng-container *ngTemplateOutlet=\"linksContentTpl\"></ng-container>\n </div>\n}\n\n<ng-template #linksContentTpl>\n <!-- Search, Direction Tabs & Collapsible Filter Bar -->\n <div class=\"mj-links-controls\">\n @if (!IsLoading && TotalLinkCount > 0) {\n <div class=\"mj-links-direction-tabs\" role=\"tablist\" aria-label=\"Link direction filter\">\n <button\n type=\"button\"\n class=\"mj-links-direction-tab\"\n [class.mj-links-direction-tab--active]=\"DirectionFilter === 'all'\"\n (click)=\"SetDirectionFilter('all')\">\n <span>All</span>\n <span class=\"mj-links-direction-tab__count\">{{ TotalLinkCount }}</span>\n </button>\n <button\n type=\"button\"\n class=\"mj-links-direction-tab\"\n [class.mj-links-direction-tab--active]=\"DirectionFilter === 'outgoing'\"\n (click)=\"SetDirectionFilter('outgoing')\"\n title=\"Records referenced by fields on this record\">\n <i class=\"fa-solid fa-arrow-up-right-from-square\" aria-hidden=\"true\"></i>\n <span>On This Record</span>\n <span class=\"mj-links-direction-tab__count\">{{ OutgoingLinkCount }}</span>\n </button>\n <button\n type=\"button\"\n class=\"mj-links-direction-tab\"\n [class.mj-links-direction-tab--active]=\"DirectionFilter === 'incoming'\"\n (click)=\"SetDirectionFilter('incoming')\"\n title=\"Other records that reference this record\">\n <i class=\"fa-solid fa-arrow-turn-up\" aria-hidden=\"true\"></i>\n <span>Linked To This</span>\n <span class=\"mj-links-direction-tab__count\">{{ IncomingLinkCount }}</span>\n </button>\n </div>\n }\n\n <div class=\"mj-links-search-row\">\n <div class=\"mj-links-search\">\n <i class=\"fa-solid fa-magnifying-glass mj-links-search__icon\"></i>\n <input\n type=\"text\"\n class=\"mj-links-search__input\"\n placeholder=\"Search linked records...\"\n aria-label=\"Search linked records\"\n [value]=\"SearchText\"\n (input)=\"OnSearchInput($event)\" />\n @if (SearchText) {\n <button\n type=\"button\"\n class=\"mj-links-search__clear\"\n title=\"Clear search\"\n aria-label=\"Clear search\"\n (click)=\"ClearSearch()\">\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n }\n </div>\n <button\n type=\"button\"\n class=\"mj-links-filter-toggle\"\n [class.mj-links-filter-toggle--active]=\"ShowFilterPanel || LinkFilter !== 'both'\"\n [attr.aria-expanded]=\"ShowFilterPanel\"\n title=\"Filter by link type\"\n (click)=\"ToggleFilterPanel()\">\n <i class=\"fa-solid fa-sliders\"></i>\n <span>Filter</span>\n @if (LinkFilter !== 'both') {\n <span class=\"mj-links-filter-toggle__dot\"></span>\n }\n </button>\n </div>\n\n <!-- Collapsible Link Type Filter Panel -->\n @if (ShowFilterPanel) {\n <div class=\"mj-links-filter-panel\">\n <div class=\"mj-links-filter-panel__label\">Link Type</div>\n <div class=\"mj-links-filter-options\" role=\"radiogroup\" aria-label=\"Link Type\">\n <button\n type=\"button\"\n class=\"mj-links-filter-option\"\n [class.mj-links-filter-option--active]=\"LinkFilter === 'both'\"\n (click)=\"SetLinkFilter('both')\">\n <span>All Links</span>\n <span class=\"mj-links-filter-option__count\">{{ TotalLinkCount }}</span>\n </button>\n <button\n type=\"button\"\n class=\"mj-links-filter-option\"\n [class.mj-links-filter-option--active]=\"LinkFilter === 'soft'\"\n (click)=\"SetLinkFilter('soft')\">\n <i class=\"fa-solid fa-diagram-project\"></i>\n <span>Cross-App Links</span>\n <span class=\"mj-links-filter-option__count\">{{ CrossAppLinkCount }}</span>\n </button>\n <button\n type=\"button\"\n class=\"mj-links-filter-option\"\n [class.mj-links-filter-option--active]=\"LinkFilter === 'hard'\"\n (click)=\"SetLinkFilter('hard')\">\n <i class=\"fa-solid fa-link\"></i>\n <span>Direct Relationships</span>\n <span class=\"mj-links-filter-option__count\">{{ DirectRelationshipCount }}</span>\n </button>\n </div>\n </div>\n }\n\n <!-- Top Category Chips -->\n @if (!IsLoading && TotalLinkCount > 0) {\n <div class=\"mj-links-chips\" role=\"tablist\" aria-label=\"Linked record categories\">\n @for (chip of CategoryChips; track chip.EntityName ?? '__all__') {\n <button\n type=\"button\"\n class=\"mj-links-chip\"\n [class.mj-links-chip--active]=\"SelectedEntityName === chip.EntityName\"\n (click)=\"SelectCategoryChip(chip.EntityName)\">\n <i [class]=\"chip.Icon\"></i>\n <span class=\"mj-links-chip__label\">{{ chip.Label }}</span>\n <span class=\"mj-links-chip__count\">({{ chip.Count }})</span>\n </button>\n }\n </div>\n }\n </div>\n\n <!-- Main Content States -->\n @if (IsLoading) {\n <div class=\"mj-links-state\">\n <i class=\"fa-solid fa-spinner fa-spin mj-links-state__spinner\"></i>\n <span>Loading linked records...</span>\n </div>\n } @else if (ErrorMessage) {\n <div class=\"mj-links-state mj-links-state--error\">\n <i class=\"fa-solid fa-circle-exclamation\"></i>\n <span>{{ ErrorMessage }}</span>\n </div>\n } @else if (TotalLinkCount === 0) {\n <div class=\"mj-links-state mj-links-state--empty\">\n <div class=\"mj-links-state__icon\">\n <i class=\"fa-solid fa-link-slash\"></i>\n </div>\n <div class=\"mj-links-state__title\">No linked records yet</div>\n <div class=\"mj-links-state__desc\">\n Records across your workspace that reference this item or are linked on this record will appear here automatically.\n </div>\n </div>\n } @else if (FilteredGroups.length === 0) {\n <div class=\"mj-links-state mj-links-state--empty\">\n <div class=\"mj-links-state__icon\">\n <i class=\"fa-solid fa-filter-circle-xmark\"></i>\n </div>\n <div class=\"mj-links-state__title\">No matching links</div>\n <div class=\"mj-links-state__desc\">\n No linked records match \"{{ SearchText || ActiveLinkFilterLabel }}\".\n </div>\n <button type=\"button\" class=\"mj-links-reset-btn\" (click)=\"ResetFilters()\">\n Reset filters\n </button>\n </div>\n } @else {\n <div class=\"mj-links-groups\">\n @for (group of FilteredGroups; track group.EntityName) {\n <section class=\"mj-links-group\">\n <header class=\"mj-links-group__header\">\n <div class=\"mj-links-group__title\">\n <i [class]=\"group.EntityIcon + ' mj-links-group__icon'\"></i>\n <span>{{ group.EntityDisplayName }}</span>\n </div>\n <span class=\"mj-links-group__badge\">{{ group.Items.length }}</span>\n </header>\n <div class=\"mj-links-group__items\">\n @for (item of group.Items; track item.TrackKey) {\n <div class=\"mj-links-card-row\">\n <button\n type=\"button\"\n class=\"mj-links-card\"\n [mjRecordLink]=\"Record\"\n [FieldName]=\"item.Direction === 'outgoing' ? (item.SourceFieldName ?? null) : null\"\n [EntityName]=\"item.EntityName\"\n [PrimaryKey]=\"item.PrimaryKey\"\n [DisplayName]=\"item.DisplayName\"\n [Provider]=\"ProviderToUse\"\n (Navigate)=\"OnItemNavigate(item, $event)\"\n (RecordUpdated)=\"OnItemQuickEdited(item, $event)\">\n <div class=\"mj-links-card__main\">\n <div class=\"mj-links-card__title-row\">\n <span class=\"mj-links-card__title\">{{ item.DisplayName }}</span>\n @if (item.StatusLabel) {\n <span class=\"mj-links-card__status\">{{ item.StatusLabel }}</span>\n }\n </div>\n <div class=\"mj-links-card__meta\">\n <span class=\"mj-links-card__direction-pill\" [class.mj-links-card__direction-pill--outgoing]=\"item.Direction === 'outgoing'\">\n <i [class]=\"item.Direction === 'outgoing' ? 'fa-solid fa-arrow-up-right-from-square' : 'fa-solid fa-arrow-turn-up'\" aria-hidden=\"true\"></i>\n {{ item.DirectionLabel }}\n </span>\n <span class=\"mj-links-card__relationship\">\n <i [class]=\"item.IsSoftLink ? 'fa-solid fa-diagram-project' : 'fa-solid fa-link'\"></i>\n {{ item.RelationshipLabel }}\n </span>\n <span class=\"mj-links-card__type-pill\" [class.mj-links-card__type-pill--soft]=\"item.IsSoftLink\">\n {{ item.LinkTypeLabel }}\n </span>\n @if (item.FormattedDate) {\n <span class=\"mj-links-card__date\">{{ item.FormattedDate }}</span>\n }\n </div>\n </div>\n <i class=\"fa-solid fa-chevron-right mj-links-card__chevron\"></i>\n </button>\n @if (AllowQuickUnlink && item.CanUnlink) {\n <button\n type=\"button\"\n class=\"mj-links-card__unlink-btn\"\n [disabled]=\"UnlinkingTrackKey === item.TrackKey\"\n [attr.aria-label]=\"'Unlink ' + item.DisplayName\"\n (click)=\"OnUnlinkItem(item, $event)\">\n <i [class]=\"UnlinkingTrackKey === item.TrackKey ? 'fa-solid fa-circle-notch fa-spin' : 'fa-solid fa-link-slash'\" aria-hidden=\"true\"></i>\n </button>\n }\n </div>\n }\n </div>\n </section>\n }\n </div>\n }\n</ng-template>\n", styles: ["/* Backdrop & Slide-In Drawer */\n.mj-links-backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.28);\n z-index: 999;\n animation: mjLinksFadeIn 0.15s ease-out;\n}\n\n.mj-links-drawer {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n width: 420px;\n max-width: 92vw;\n background: var(--mj-bg-surface);\n border-left: 1px solid var(--mj-border-default);\n box-shadow: -8px 0 28px rgba(0, 0, 0, 0.14);\n z-index: 1000;\n display: flex;\n flex-direction: column;\n animation: mjLinksSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n@keyframes mjLinksFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes mjLinksSlideIn {\n from { transform: translateX(100%); }\n to { transform: translateX(0); }\n}\n\n.mj-links-drawer__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 18px;\n border-bottom: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n}\n\n.mj-links-drawer__title-group {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n\n.mj-links-drawer__icon {\n width: 34px;\n height: 34px;\n border-radius: 8px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent);\n color: var(--mj-brand-primary);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n}\n\n.mj-links-drawer__titles {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.mj-links-drawer__title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--mj-text-primary);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-links-drawer__count {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 20px;\n padding: 0 6px;\n border-radius: 999px;\n font-size: 11px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-brand-primary) 14%, transparent);\n color: var(--mj-brand-primary);\n}\n\n.mj-links-drawer__subtitle {\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.mj-links-drawer__header-actions {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.mj-links-icon-btn {\n width: 30px;\n height: 30px;\n border: 1px solid transparent;\n border-radius: 6px;\n background: transparent;\n color: var(--mj-text-secondary);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: background 0.15s ease, color 0.15s ease;\n}\n\n.mj-links-icon-btn:hover:not(:disabled) {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n}\n\n.mj-links-drawer__body {\n flex: 1;\n overflow-y: auto;\n padding: 14px 16px;\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n/* Inline Widget Container */\n.mj-links-widget {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n/* Controls: Direction Tabs, Search, Filter Button, Collapsible Filter Panel, Category Chips */\n.mj-links-controls {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.mj-links-direction-tabs {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 4px;\n padding: 3px;\n border-radius: 8px;\n background: var(--mj-bg-surface-sunken);\n border: 1px solid var(--mj-border-subtle);\n}\n\n.mj-links-direction-tab {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n padding: 6px 8px;\n border-radius: 6px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--mj-text-secondary);\n font-size: 11px;\n font-weight: 600;\n font-family: inherit;\n cursor: pointer;\n transition: all 0.15s ease;\n white-space: nowrap;\n}\n\n.mj-links-direction-tab:hover {\n color: var(--mj-text-primary);\n}\n\n.mj-links-direction-tab--active {\n background: var(--mj-bg-surface);\n color: var(--mj-brand-primary);\n border-color: var(--mj-border-default);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);\n}\n\n.mj-links-direction-tab__count {\n font-size: 10px;\n padding: 1px 5px;\n border-radius: 999px;\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n}\n\n.mj-links-search-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-links-search {\n position: relative;\n flex: 1;\n display: flex;\n align-items: center;\n}\n\n.mj-links-search__icon {\n position: absolute;\n left: 10px;\n font-size: 12px;\n color: var(--mj-text-muted);\n pointer-events: none;\n}\n\n.mj-links-search__input {\n width: 100%;\n padding: 7px 28px 7px 30px;\n font-size: 13px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: 7px;\n outline: none;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n\n.mj-links-search__input:focus {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n}\n\n.mj-links-search__clear {\n position: absolute;\n right: 6px;\n width: 20px;\n height: 20px;\n border: none;\n background: transparent;\n color: var(--mj-text-muted);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n}\n\n.mj-links-search__clear:hover {\n color: var(--mj-text-primary);\n}\n\n.mj-links-filter-toggle {\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 7px 11px;\n font-size: 12px;\n font-weight: 500;\n color: var(--mj-text-secondary);\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-default);\n border-radius: 7px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.mj-links-filter-toggle:hover,\n.mj-links-filter-toggle--active {\n border-color: var(--mj-brand-primary);\n color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 8%, transparent);\n}\n\n.mj-links-filter-toggle__dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--mj-brand-primary);\n}\n\n.mj-links-filter-panel {\n padding: 10px 12px;\n border-radius: 8px;\n background: var(--mj-bg-surface-card);\n border: 1px solid var(--mj-border-default);\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.mj-links-filter-panel__label {\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-muted);\n}\n\n.mj-links-filter-options {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.mj-links-filter-option {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 5px 10px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 6px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.mj-links-filter-option--active {\n border-color: var(--mj-brand-primary);\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n color: var(--mj-brand-primary);\n font-weight: 600;\n}\n\n.mj-links-filter-option__count {\n font-size: 11px;\n opacity: 0.8;\n}\n\n/* Category Chips */\n.mj-links-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n\n.mj-links-chip {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n border-radius: 999px;\n font-size: 12px;\n font-weight: 500;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.mj-links-chip:hover {\n border-color: var(--mj-brand-primary);\n color: var(--mj-text-primary);\n}\n\n.mj-links-chip--active {\n background: var(--mj-brand-primary);\n border-color: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n}\n\n.mj-links-chip__count {\n font-size: 11px;\n opacity: 0.85;\n}\n\n/* Groups & Cards */\n.mj-links-groups {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n.mj-links-group {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.mj-links-group__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 2px 4px;\n}\n\n.mj-links-group__title {\n display: flex;\n align-items: center;\n gap: 7px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.03em;\n color: var(--mj-text-secondary);\n}\n\n.mj-links-group__icon {\n color: var(--mj-brand-primary);\n font-size: 12px;\n}\n\n.mj-links-group__badge {\n font-size: 11px;\n font-weight: 600;\n padding: 1px 7px;\n border-radius: 999px;\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-muted);\n}\n\n.mj-links-group__items {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.mj-links-card {\n width: 100%;\n text-align: left;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n padding: 10px 12px;\n border-radius: 8px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n cursor: pointer;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;\n}\n\n.mj-links-card:hover {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n}\n\n.mj-links-card__main {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.mj-links-card__title-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-links-card__title {\n font-size: 13px;\n font-weight: 600;\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mj-links-card__status {\n font-size: 11px;\n font-weight: 500;\n padding: 1px 6px;\n border-radius: 4px;\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-secondary);\n flex-shrink: 0;\n}\n\n.mj-links-card__meta {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n font-size: 11px;\n color: var(--mj-text-muted);\n}\n\n.mj-links-card__direction-pill {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 1px 6px;\n border-radius: 4px;\n font-size: 10px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-status-info) 12%, var(--mj-bg-surface));\n color: var(--mj-status-info);\n}\n\n.mj-links-card__direction-pill--outgoing {\n background: color-mix(in srgb, var(--mj-status-success) 12%, var(--mj-bg-surface));\n color: var(--mj-status-success);\n}\n\n.mj-links-card__relationship {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n font-weight: 500;\n color: var(--mj-text-secondary);\n}\n\n.mj-links-card__type-pill {\n padding: 1px 6px;\n border-radius: 4px;\n font-size: 10px;\n font-weight: 600;\n background: var(--mj-bg-surface-card);\n color: var(--mj-text-muted);\n}\n\n.mj-links-card__type-pill--soft {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n color: var(--mj-brand-primary);\n}\n\n.mj-links-card__chevron {\n font-size: 11px;\n color: var(--mj-text-muted);\n flex-shrink: 0;\n}\n\n.mj-links-card-row {\n display: flex;\n align-items: stretch;\n gap: 6px;\n}\n\n.mj-links-card__unlink-btn {\n flex-shrink: 0;\n width: 34px;\n border-radius: 8px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-text-muted);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 12px;\n transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;\n}\n\n.mj-links-card__unlink-btn:hover:not(:disabled) {\n color: var(--mj-status-error);\n border-color: color-mix(in srgb, var(--mj-status-error) 45%, var(--mj-border-default));\n background: color-mix(in srgb, var(--mj-status-error) 10%, var(--mj-bg-surface));\n}\n\n.mj-links-card__unlink-btn:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n/* Empty & Loading States */\n.mj-links-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 28px 16px;\n gap: 8px;\n color: var(--mj-text-muted);\n font-size: 13px;\n}\n\n.mj-links-state__icon {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: var(--mj-bg-surface-card);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n color: var(--mj-text-muted);\n}\n\n.mj-links-state__title {\n font-size: 14px;\n font-weight: 600;\n color: var(--mj-text-primary);\n}\n\n.mj-links-state__desc {\n font-size: 12px;\n color: var(--mj-text-muted);\n max-width: 280px;\n}\n\n.mj-links-reset-btn {\n margin-top: 4px;\n padding: 5px 12px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 6px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-brand-primary);\n cursor: pointer;\n}\n"] }]
|
|
1501
|
+
}], null, { Record: [{
|
|
1502
|
+
type: Input
|
|
1503
|
+
}], InitialLinkFilter: [{
|
|
1504
|
+
type: Input
|
|
1505
|
+
}], Mode: [{
|
|
1506
|
+
type: Input
|
|
1507
|
+
}], IsOpen: [{
|
|
1508
|
+
type: Input
|
|
1509
|
+
}], AllowQuickUnlink: [{
|
|
1510
|
+
type: Input
|
|
1511
|
+
}], Navigate: [{
|
|
1512
|
+
type: Output
|
|
1513
|
+
}], Close: [{
|
|
1514
|
+
type: Output
|
|
1515
|
+
}], LinkCountChange: [{
|
|
1516
|
+
type: Output
|
|
1517
|
+
}], LinksSummaryChange: [{
|
|
1518
|
+
type: Output
|
|
1519
|
+
}], RecordLinkModified: [{
|
|
1520
|
+
type: Output
|
|
1521
|
+
}] }); })();
|
|
1522
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MjRecordLinksComponent, { className: "MjRecordLinksComponent", filePath: "src/lib/links/record-links.component.ts", lineNumber: 142 }); })();
|
|
1523
|
+
//# sourceMappingURL=record-links.component.js.map
|