@memberjunction/ng-base-forms 6.2.0-edge.5 → 6.2.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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-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 +1494 -316
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +159 -14
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +1360 -469
- 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-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,1060 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var MjRecordPreviewPopoverComponent_1;
|
|
8
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
|
9
|
+
import { CompositeKey, EntityFieldTSType, RunView } from '@memberjunction/core';
|
|
10
|
+
import { MJGlobal, OptionalKeyedSpecialization } from '@memberjunction/global';
|
|
11
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
12
|
+
import { CancellableFormEvent } from '../types/form-events';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@angular/common";
|
|
15
|
+
import * as i2 from "@angular/forms";
|
|
16
|
+
const _c0 = () => [];
|
|
17
|
+
const _forTrack0 = ($index, $item) => $item.FieldName;
|
|
18
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
i0.ɵɵelementStart(0, "span", 7);
|
|
20
|
+
i0.ɵɵtext(1);
|
|
21
|
+
i0.ɵɵelementEnd();
|
|
22
|
+
} if (rf & 2) {
|
|
23
|
+
const summary_r3 = i0.ɵɵnextContext();
|
|
24
|
+
i0.ɵɵadvance();
|
|
25
|
+
i0.ɵɵtextInterpolate(summary_r3.StatusValue);
|
|
26
|
+
} }
|
|
27
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
28
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
29
|
+
i0.ɵɵelementStart(0, "button", 21);
|
|
30
|
+
i0.ɵɵlistener("click", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_9_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnCopyRecordID($event)); });
|
|
31
|
+
i0.ɵɵelementStart(1, "span");
|
|
32
|
+
i0.ɵɵtext(2);
|
|
33
|
+
i0.ɵɵelementEnd();
|
|
34
|
+
i0.ɵɵelement(3, "i", 5);
|
|
35
|
+
i0.ɵɵelementEnd();
|
|
36
|
+
} if (rf & 2) {
|
|
37
|
+
const summary_r3 = i0.ɵɵnextContext();
|
|
38
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
39
|
+
i0.ɵɵclassProp("is-copied", ctx_r1.CopiedID);
|
|
40
|
+
i0.ɵɵproperty("title", "Copy Record ID: " + summary_r3.RecordID);
|
|
41
|
+
i0.ɵɵadvance(2);
|
|
42
|
+
i0.ɵɵtextInterpolate(ctx_r1.CopiedID ? "Copied!" : ctx_r1.CompactRecordID);
|
|
43
|
+
i0.ɵɵadvance();
|
|
44
|
+
i0.ɵɵclassMap(ctx_r1.CopiedID ? "fa-solid fa-check" : "fa-regular fa-copy");
|
|
45
|
+
} }
|
|
46
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
47
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
48
|
+
i0.ɵɵelementStart(0, "button", 22);
|
|
49
|
+
i0.ɵɵlistener("click", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_10_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.IsEditing ? ctx_r1.OnCancelEdit($event) : ctx_r1.OnStartEdit($event)); });
|
|
50
|
+
i0.ɵɵelement(1, "i", 23);
|
|
51
|
+
i0.ɵɵelementEnd();
|
|
52
|
+
} if (rf & 2) {
|
|
53
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
54
|
+
i0.ɵɵclassProp("is-active", ctx_r1.IsEditing);
|
|
55
|
+
i0.ɵɵproperty("title", ctx_r1.IsEditing ? "Cancel quick edit" : "Quick edit fields");
|
|
56
|
+
} }
|
|
57
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_13_Template(rf, ctx) { if (rf & 1) {
|
|
58
|
+
const _r6 = i0.ɵɵgetCurrentView();
|
|
59
|
+
i0.ɵɵelementStart(0, "input", 24);
|
|
60
|
+
i0.ɵɵlistener("input", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_13_Template_input_input_0_listener($event) { const nameField_r7 = i0.ɵɵrestoreView(_r6); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnEditDraftInput(nameField_r7, $event)); });
|
|
61
|
+
i0.ɵɵelementEnd();
|
|
62
|
+
} if (rf & 2) {
|
|
63
|
+
const summary_r3 = i0.ɵɵnextContext();
|
|
64
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
65
|
+
i0.ɵɵproperty("value", ctx_r1.EditDrafts[ctx] ?? summary_r3.Title)("disabled", ctx_r1.IsSavingEdit);
|
|
66
|
+
i0.ɵɵattribute("aria-label", "Edit " + summary_r3.EntityDisplayName + " name");
|
|
67
|
+
} }
|
|
68
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_14_Template(rf, ctx) { if (rf & 1) {
|
|
69
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
70
|
+
i0.ɵɵelementStart(0, "button", 25);
|
|
71
|
+
i0.ɵɵlistener("click", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_14_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnTitleClick($event)); })("auxclick", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_14_Template_button_auxclick_0_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnTitleAuxClick($event)); });
|
|
72
|
+
i0.ɵɵelementStart(1, "span", 26);
|
|
73
|
+
i0.ɵɵtext(2);
|
|
74
|
+
i0.ɵɵelementEnd();
|
|
75
|
+
i0.ɵɵelement(3, "i", 27);
|
|
76
|
+
i0.ɵɵelementEnd();
|
|
77
|
+
} if (rf & 2) {
|
|
78
|
+
const summary_r3 = i0.ɵɵnextContext();
|
|
79
|
+
i0.ɵɵproperty("title", "Open " + summary_r3.Title);
|
|
80
|
+
i0.ɵɵadvance(2);
|
|
81
|
+
i0.ɵɵtextInterpolate(summary_r3.Title);
|
|
82
|
+
} }
|
|
83
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_16_Template(rf, ctx) { if (rf & 1) {
|
|
84
|
+
i0.ɵɵelementStart(0, "div", 16);
|
|
85
|
+
i0.ɵɵelement(1, "i", 28);
|
|
86
|
+
i0.ɵɵelementStart(2, "span");
|
|
87
|
+
i0.ɵɵtext(3, "Loading preview\u2026");
|
|
88
|
+
i0.ɵɵelementEnd()();
|
|
89
|
+
} }
|
|
90
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
91
|
+
i0.ɵɵelementStart(0, "option", 36);
|
|
92
|
+
i0.ɵɵtext(1);
|
|
93
|
+
i0.ɵɵelementEnd();
|
|
94
|
+
} if (rf & 2) {
|
|
95
|
+
const opt_r11 = ctx.$implicit;
|
|
96
|
+
const item_r10 = i0.ɵɵnextContext(3).$implicit;
|
|
97
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
98
|
+
i0.ɵɵproperty("value", opt_r11)("selected", (ctx_r1.EditDrafts[item_r10.FieldName] ?? "") === opt_r11);
|
|
99
|
+
i0.ɵɵadvance();
|
|
100
|
+
i0.ɵɵtextInterpolate1(" ", item_r10.InputType === "boolean" ? opt_r11 === "true" ? "Yes" : "No" : opt_r11, " ");
|
|
101
|
+
} }
|
|
102
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
103
|
+
const _r9 = i0.ɵɵgetCurrentView();
|
|
104
|
+
i0.ɵɵelementStart(0, "select", 35);
|
|
105
|
+
i0.ɵɵlistener("change", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_0_Template_select_change_0_listener($event) { i0.ɵɵrestoreView(_r9); const item_r10 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.OnEditDraftInput(item_r10.FieldName, $event)); });
|
|
106
|
+
i0.ɵɵrepeaterCreate(1, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_0_For_2_Template, 2, 3, "option", 36, i0.ɵɵrepeaterTrackByIdentity);
|
|
107
|
+
i0.ɵɵelementEnd();
|
|
108
|
+
} if (rf & 2) {
|
|
109
|
+
const item_r10 = i0.ɵɵnextContext(2).$implicit;
|
|
110
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
111
|
+
i0.ɵɵproperty("value", ctx_r1.EditDrafts[item_r10.FieldName] ?? "")("disabled", ctx_r1.IsSavingEdit);
|
|
112
|
+
i0.ɵɵattribute("aria-label", "Edit " + item_r10.Label);
|
|
113
|
+
i0.ɵɵadvance();
|
|
114
|
+
i0.ɵɵrepeater(item_r10.PossibleValues ?? i0.ɵɵpureFunction0(3, _c0));
|
|
115
|
+
} }
|
|
116
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
117
|
+
const _r12 = i0.ɵɵgetCurrentView();
|
|
118
|
+
i0.ɵɵelementStart(0, "input", 37);
|
|
119
|
+
i0.ɵɵlistener("input", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_1_Template_input_input_0_listener($event) { i0.ɵɵrestoreView(_r12); const item_r10 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.OnEditDraftInput(item_r10.FieldName, $event)); });
|
|
120
|
+
i0.ɵɵelementEnd();
|
|
121
|
+
} if (rf & 2) {
|
|
122
|
+
const item_r10 = i0.ɵɵnextContext(2).$implicit;
|
|
123
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
124
|
+
i0.ɵɵproperty("type", item_r10.InputType === "number" ? "number" : "text")("value", ctx_r1.EditDrafts[item_r10.FieldName] ?? item_r10.Value)("disabled", ctx_r1.IsSavingEdit);
|
|
125
|
+
i0.ɵɵattribute("aria-label", "Edit " + item_r10.Label);
|
|
126
|
+
} }
|
|
127
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
128
|
+
i0.ɵɵconditionalCreate(0, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_0_Template, 3, 4, "select", 33)(1, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Conditional_1_Template, 1, 4, "input", 34);
|
|
129
|
+
} if (rf & 2) {
|
|
130
|
+
const item_r10 = i0.ɵɵnextContext().$implicit;
|
|
131
|
+
i0.ɵɵconditional(item_r10.InputType === "select" || item_r10.InputType === "boolean" ? 0 : 1);
|
|
132
|
+
} }
|
|
133
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
134
|
+
i0.ɵɵelementStart(0, "span", 32);
|
|
135
|
+
i0.ɵɵtext(1);
|
|
136
|
+
i0.ɵɵelementEnd();
|
|
137
|
+
} if (rf & 2) {
|
|
138
|
+
const item_r10 = i0.ɵɵnextContext().$implicit;
|
|
139
|
+
i0.ɵɵproperty("title", item_r10.Value);
|
|
140
|
+
i0.ɵɵadvance();
|
|
141
|
+
i0.ɵɵtextInterpolate(item_r10.Value);
|
|
142
|
+
} }
|
|
143
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
144
|
+
i0.ɵɵelementStart(0, "div", 30)(1, "span", 31);
|
|
145
|
+
i0.ɵɵtext(2);
|
|
146
|
+
i0.ɵɵelementEnd();
|
|
147
|
+
i0.ɵɵconditionalCreate(3, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_3_Template, 2, 1)(4, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Conditional_4_Template, 2, 2, "span", 32);
|
|
148
|
+
i0.ɵɵelementEnd();
|
|
149
|
+
} if (rf & 2) {
|
|
150
|
+
const item_r10 = ctx.$implicit;
|
|
151
|
+
const ctx_r1 = i0.ɵɵnextContext(3);
|
|
152
|
+
i0.ɵɵclassProp("mj-record-preview-field--wide", item_r10.IsWide);
|
|
153
|
+
i0.ɵɵadvance(2);
|
|
154
|
+
i0.ɵɵtextInterpolate(item_r10.Label);
|
|
155
|
+
i0.ɵɵadvance();
|
|
156
|
+
i0.ɵɵconditional(ctx_r1.IsEditing && item_r10.IsEditable ? 3 : 4);
|
|
157
|
+
} }
|
|
158
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_Template(rf, ctx) { if (rf & 1) {
|
|
159
|
+
i0.ɵɵelementStart(0, "div", 17);
|
|
160
|
+
i0.ɵɵrepeaterCreate(1, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_For_2_Template, 5, 4, "div", 29, _forTrack0);
|
|
161
|
+
i0.ɵɵelementEnd();
|
|
162
|
+
} if (rf & 2) {
|
|
163
|
+
const summary_r3 = i0.ɵɵnextContext();
|
|
164
|
+
i0.ɵɵadvance();
|
|
165
|
+
i0.ɵɵrepeater(summary_r3.Fields);
|
|
166
|
+
} }
|
|
167
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_18_Template(rf, ctx) { if (rf & 1) {
|
|
168
|
+
i0.ɵɵelementStart(0, "div", 18)(1, "span", 31);
|
|
169
|
+
i0.ɵɵtext(2, "Record ID");
|
|
170
|
+
i0.ɵɵelementEnd();
|
|
171
|
+
i0.ɵɵelementStart(3, "span", 38);
|
|
172
|
+
i0.ɵɵtext(4);
|
|
173
|
+
i0.ɵɵelementEnd()();
|
|
174
|
+
} if (rf & 2) {
|
|
175
|
+
const summary_r3 = i0.ɵɵnextContext();
|
|
176
|
+
i0.ɵɵadvance(4);
|
|
177
|
+
i0.ɵɵtextInterpolate(summary_r3.RecordID);
|
|
178
|
+
} }
|
|
179
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_19_Template(rf, ctx) { if (rf & 1) {
|
|
180
|
+
i0.ɵɵelementStart(0, "div", 19);
|
|
181
|
+
i0.ɵɵelement(1, "i", 39);
|
|
182
|
+
i0.ɵɵelementStart(2, "span");
|
|
183
|
+
i0.ɵɵtext(3);
|
|
184
|
+
i0.ɵɵelementEnd()();
|
|
185
|
+
} if (rf & 2) {
|
|
186
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
187
|
+
i0.ɵɵadvance(3);
|
|
188
|
+
i0.ɵɵtextInterpolate(ctx_r1.EditErrorMessage);
|
|
189
|
+
} }
|
|
190
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_20_Template(rf, ctx) { if (rf & 1) {
|
|
191
|
+
const _r13 = i0.ɵɵgetCurrentView();
|
|
192
|
+
i0.ɵɵelementStart(0, "div", 20)(1, "button", 40);
|
|
193
|
+
i0.ɵɵlistener("click", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_20_Template_button_click_1_listener($event) { i0.ɵɵrestoreView(_r13); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnCancelEdit($event)); });
|
|
194
|
+
i0.ɵɵelementStart(2, "span");
|
|
195
|
+
i0.ɵɵtext(3, "Cancel");
|
|
196
|
+
i0.ɵɵelementEnd()();
|
|
197
|
+
i0.ɵɵelementStart(4, "button", 41);
|
|
198
|
+
i0.ɵɵlistener("click", function MjRecordPreviewPopoverComponent_Conditional_0_Conditional_20_Template_button_click_4_listener($event) { i0.ɵɵrestoreView(_r13); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnSaveEdit($event)); });
|
|
199
|
+
i0.ɵɵelement(5, "i", 5);
|
|
200
|
+
i0.ɵɵelementStart(6, "span");
|
|
201
|
+
i0.ɵɵtext(7);
|
|
202
|
+
i0.ɵɵelementEnd()()();
|
|
203
|
+
} if (rf & 2) {
|
|
204
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
205
|
+
i0.ɵɵadvance();
|
|
206
|
+
i0.ɵɵproperty("disabled", ctx_r1.IsSavingEdit);
|
|
207
|
+
i0.ɵɵadvance(3);
|
|
208
|
+
i0.ɵɵproperty("disabled", ctx_r1.IsSavingEdit);
|
|
209
|
+
i0.ɵɵadvance();
|
|
210
|
+
i0.ɵɵclassMap(ctx_r1.IsSavingEdit ? "fa-solid fa-circle-notch fa-spin" : "fa-solid fa-check");
|
|
211
|
+
i0.ɵɵadvance(2);
|
|
212
|
+
i0.ɵɵtextInterpolate(ctx_r1.IsSavingEdit ? "Saving\u2026" : "Save");
|
|
213
|
+
} }
|
|
214
|
+
function MjRecordPreviewPopoverComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
215
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
216
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
217
|
+
i0.ɵɵlistener("mouseenter", function MjRecordPreviewPopoverComponent_Conditional_0_Template_div_mouseenter_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCardMouseEnter()); })("mouseleave", function MjRecordPreviewPopoverComponent_Conditional_0_Template_div_mouseleave_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCardMouseLeave()); });
|
|
218
|
+
i0.ɵɵelementStart(1, "div", 2)(2, "div", 3)(3, "span", 4);
|
|
219
|
+
i0.ɵɵelement(4, "i", 5);
|
|
220
|
+
i0.ɵɵelementEnd();
|
|
221
|
+
i0.ɵɵelementStart(5, "span", 6);
|
|
222
|
+
i0.ɵɵtext(6);
|
|
223
|
+
i0.ɵɵelementEnd();
|
|
224
|
+
i0.ɵɵconditionalCreate(7, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_7_Template, 2, 1, "span", 7);
|
|
225
|
+
i0.ɵɵelementStart(8, "div", 8);
|
|
226
|
+
i0.ɵɵconditionalCreate(9, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_9_Template, 4, 6, "button", 9);
|
|
227
|
+
i0.ɵɵconditionalCreate(10, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_10_Template, 2, 3, "button", 10);
|
|
228
|
+
i0.ɵɵelementStart(11, "button", 11);
|
|
229
|
+
i0.ɵɵlistener("click", function MjRecordPreviewPopoverComponent_Conditional_0_Template_button_click_11_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnOpenRecord(true, $event)); });
|
|
230
|
+
i0.ɵɵelement(12, "i", 12);
|
|
231
|
+
i0.ɵɵelementEnd()()();
|
|
232
|
+
i0.ɵɵconditionalCreate(13, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_13_Template, 1, 3, "input", 13)(14, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_14_Template, 4, 2, "button", 14);
|
|
233
|
+
i0.ɵɵelementEnd();
|
|
234
|
+
i0.ɵɵelementStart(15, "div", 15);
|
|
235
|
+
i0.ɵɵconditionalCreate(16, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_16_Template, 4, 0, "div", 16)(17, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_17_Template, 3, 0, "div", 17)(18, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_18_Template, 5, 1, "div", 18);
|
|
236
|
+
i0.ɵɵconditionalCreate(19, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_19_Template, 4, 1, "div", 19);
|
|
237
|
+
i0.ɵɵelementEnd();
|
|
238
|
+
i0.ɵɵconditionalCreate(20, MjRecordPreviewPopoverComponent_Conditional_0_Conditional_20_Template, 8, 5, "div", 20);
|
|
239
|
+
i0.ɵɵelementEnd();
|
|
240
|
+
} if (rf & 2) {
|
|
241
|
+
let tmp_10_0;
|
|
242
|
+
const summary_r3 = ctx;
|
|
243
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
244
|
+
i0.ɵɵclassProp("mj-record-preview-popover--editing", ctx_r1.IsEditing);
|
|
245
|
+
i0.ɵɵproperty("ngStyle", ctx_r1.PopoverPositionStyle);
|
|
246
|
+
i0.ɵɵattribute("aria-label", summary_r3.EntityDisplayName + " preview: " + summary_r3.Title);
|
|
247
|
+
i0.ɵɵadvance(4);
|
|
248
|
+
i0.ɵɵclassMap(summary_r3.EntityIcon);
|
|
249
|
+
i0.ɵɵadvance(2);
|
|
250
|
+
i0.ɵɵtextInterpolate(summary_r3.EntityDisplayName);
|
|
251
|
+
i0.ɵɵadvance();
|
|
252
|
+
i0.ɵɵconditional(summary_r3.StatusValue ? 7 : -1);
|
|
253
|
+
i0.ɵɵadvance(2);
|
|
254
|
+
i0.ɵɵconditional(summary_r3.RecordID ? 9 : -1);
|
|
255
|
+
i0.ɵɵadvance();
|
|
256
|
+
i0.ɵɵconditional(ctx_r1.AllowQuickEdit && summary_r3.CanEditRecord ? 10 : -1);
|
|
257
|
+
i0.ɵɵadvance(3);
|
|
258
|
+
i0.ɵɵconditional((tmp_10_0 = ctx_r1.IsEditing && summary_r3.NameFieldEditable && summary_r3.NameFieldName) ? 13 : 14, tmp_10_0);
|
|
259
|
+
i0.ɵɵadvance(3);
|
|
260
|
+
i0.ɵɵconditional(ctx_r1.IsLoading ? 16 : summary_r3.Fields.length > 0 ? 17 : 18);
|
|
261
|
+
i0.ɵɵadvance(3);
|
|
262
|
+
i0.ɵɵconditional(ctx_r1.EditErrorMessage ? 19 : -1);
|
|
263
|
+
i0.ɵɵadvance();
|
|
264
|
+
i0.ɵɵconditional(ctx_r1.IsEditing ? 20 : -1);
|
|
265
|
+
} }
|
|
266
|
+
/**
|
|
267
|
+
* Cancellable event args emitted before inline Quick Edit saves changes to the target entity record.
|
|
268
|
+
* Set `Cancel = true` to prevent the save operation.
|
|
269
|
+
*/
|
|
270
|
+
export class BeforeRecordPreviewSaveEventArgs extends CancellableFormEvent {
|
|
271
|
+
EntityName;
|
|
272
|
+
PrimaryKey;
|
|
273
|
+
Summary;
|
|
274
|
+
Drafts;
|
|
275
|
+
constructor(entityName, primaryKey, summary, drafts) {
|
|
276
|
+
super();
|
|
277
|
+
this.EntityName = entityName;
|
|
278
|
+
this.PrimaryKey = primaryKey;
|
|
279
|
+
this.Summary = summary;
|
|
280
|
+
this.Drafts = drafts;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Lightweight hover preview card (`<mj-record-preview-popover>`) that displays key metadata
|
|
285
|
+
* and summary fields (`DefaultInView`) for any foreign-key or polymorphic-FK linked record.
|
|
286
|
+
*
|
|
287
|
+
* ### Pluggable via `@RegisterClass` and `MJGlobal.Instance.ClassFactory`
|
|
288
|
+
* Applications and domain packages can subclass `MjRecordPreviewPopoverComponent` and register
|
|
289
|
+
* their custom hover card with `@RegisterClass`:
|
|
290
|
+
* - **Global replacement (all entities)**:
|
|
291
|
+
* `@RegisterClass(MjRecordPreviewPopoverComponent)` or `@RegisterClass(MjRecordPreviewPopoverComponent, '*')`
|
|
292
|
+
* - **Schema or wildcard replacement**:
|
|
293
|
+
* `@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common:*')` or
|
|
294
|
+
* `@RegisterClass(MjRecordPreviewPopoverComponent, 'schema:mj_bizapps_common')`
|
|
295
|
+
* - **Entity-specific replacement**:
|
|
296
|
+
* `@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common: People')`
|
|
297
|
+
*
|
|
298
|
+
* {@link MjRecordPreviewPopoverService} calls {@link ResolveRecordPreviewPopoverType} at runtime
|
|
299
|
+
* to instantiate the highest-priority matching subclass via Angular's `createComponent()`.
|
|
300
|
+
*/
|
|
301
|
+
let MjRecordPreviewPopoverComponent = class MjRecordPreviewPopoverComponent extends BaseAngularComponent {
|
|
302
|
+
static { MjRecordPreviewPopoverComponent_1 = this; }
|
|
303
|
+
static CACHE_TTL_MS = 60_000;
|
|
304
|
+
static summaryCache = new Map();
|
|
305
|
+
cdr = inject(ChangeDetectorRef);
|
|
306
|
+
_destroyed = false;
|
|
307
|
+
_visible = false;
|
|
308
|
+
_entityName = null;
|
|
309
|
+
_recordID = null;
|
|
310
|
+
_primaryKey = null;
|
|
311
|
+
_displayName = null;
|
|
312
|
+
_anchorRect = null;
|
|
313
|
+
_loadSeq = 0;
|
|
314
|
+
get EntityName() {
|
|
315
|
+
return this._entityName;
|
|
316
|
+
}
|
|
317
|
+
set EntityName(value) {
|
|
318
|
+
if (value !== this._entityName) {
|
|
319
|
+
this._entityName = value;
|
|
320
|
+
this.resetEditState();
|
|
321
|
+
if (this._visible) {
|
|
322
|
+
void this.loadSummary();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
get RecordID() {
|
|
327
|
+
return this._recordID;
|
|
328
|
+
}
|
|
329
|
+
set RecordID(value) {
|
|
330
|
+
if (value !== this._recordID) {
|
|
331
|
+
this._recordID = value;
|
|
332
|
+
this.resetEditState();
|
|
333
|
+
if (this._visible) {
|
|
334
|
+
void this.loadSummary();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
get PrimaryKey() {
|
|
339
|
+
return this._primaryKey;
|
|
340
|
+
}
|
|
341
|
+
set PrimaryKey(value) {
|
|
342
|
+
if (value !== this._primaryKey) {
|
|
343
|
+
this._primaryKey = value;
|
|
344
|
+
this.resetEditState();
|
|
345
|
+
if (this._visible) {
|
|
346
|
+
void this.loadSummary();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
get DisplayName() {
|
|
351
|
+
return this._displayName;
|
|
352
|
+
}
|
|
353
|
+
set DisplayName(value) {
|
|
354
|
+
this._displayName = value;
|
|
355
|
+
}
|
|
356
|
+
get AnchorRect() {
|
|
357
|
+
return this._anchorRect;
|
|
358
|
+
}
|
|
359
|
+
set AnchorRect(value) {
|
|
360
|
+
this._anchorRect = value;
|
|
361
|
+
this.cdr.markForCheck();
|
|
362
|
+
}
|
|
363
|
+
get Visible() {
|
|
364
|
+
return this._visible;
|
|
365
|
+
}
|
|
366
|
+
set Visible(value) {
|
|
367
|
+
if (value !== this._visible) {
|
|
368
|
+
this._visible = value;
|
|
369
|
+
if (value) {
|
|
370
|
+
void this.loadSummary();
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
this.resetEditState();
|
|
374
|
+
}
|
|
375
|
+
this.cdr.markForCheck();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/** Whether inline quick-edit of summary fields is allowed inside the popover. */
|
|
379
|
+
AllowQuickEdit = true;
|
|
380
|
+
Navigate = new EventEmitter();
|
|
381
|
+
MouseEnterCard = new EventEmitter();
|
|
382
|
+
MouseLeaveCard = new EventEmitter();
|
|
383
|
+
/** Cancellable event emitted before Quick Edit saves field changes to the target entity. */
|
|
384
|
+
BeforeQuickEditSave = new EventEmitter();
|
|
385
|
+
/** Emitted after Quick Edit successfully saves field changes to the target entity. */
|
|
386
|
+
AfterQuickEditSaved = new EventEmitter();
|
|
387
|
+
/** Emitted after Quick Edit saves field changes (alias/companion to `AfterQuickEditSaved`). */
|
|
388
|
+
RecordUpdated = new EventEmitter();
|
|
389
|
+
IsLoading = false;
|
|
390
|
+
Summary = null;
|
|
391
|
+
CopiedID = false;
|
|
392
|
+
IsEditing = false;
|
|
393
|
+
IsSavingEdit = false;
|
|
394
|
+
EditErrorMessage = null;
|
|
395
|
+
EditDrafts = {};
|
|
396
|
+
_copyTimer = null;
|
|
397
|
+
/** Clear the static summary cache (useful in unit tests). */
|
|
398
|
+
static ClearCache() {
|
|
399
|
+
MjRecordPreviewPopoverComponent_1.summaryCache.clear();
|
|
400
|
+
}
|
|
401
|
+
ngOnDestroy() {
|
|
402
|
+
this._destroyed = true;
|
|
403
|
+
if (this._copyTimer) {
|
|
404
|
+
clearTimeout(this._copyTimer);
|
|
405
|
+
this._copyTimer = null;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
resetEditState() {
|
|
409
|
+
this.IsEditing = false;
|
|
410
|
+
this.IsSavingEdit = false;
|
|
411
|
+
this.EditErrorMessage = null;
|
|
412
|
+
this.EditDrafts = {};
|
|
413
|
+
}
|
|
414
|
+
get CompactRecordID() {
|
|
415
|
+
const raw = (this.Summary?.RecordID ?? this._recordID ?? '').trim();
|
|
416
|
+
if (!raw)
|
|
417
|
+
return '';
|
|
418
|
+
if (raw.length <= 12)
|
|
419
|
+
return raw;
|
|
420
|
+
return `${raw.slice(0, 6)}…${raw.slice(-4)}`;
|
|
421
|
+
}
|
|
422
|
+
OnCopyRecordID(event) {
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
event.stopPropagation();
|
|
425
|
+
const raw = (this.Summary?.RecordID ?? this._recordID ?? '').trim();
|
|
426
|
+
if (!raw)
|
|
427
|
+
return;
|
|
428
|
+
try {
|
|
429
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {
|
|
430
|
+
void navigator.clipboard.writeText(raw);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
catch {
|
|
434
|
+
// Ignore clipboard errors in restricted environments
|
|
435
|
+
}
|
|
436
|
+
this.CopiedID = true;
|
|
437
|
+
this.cdr.markForCheck();
|
|
438
|
+
if (this._copyTimer) {
|
|
439
|
+
clearTimeout(this._copyTimer);
|
|
440
|
+
}
|
|
441
|
+
this._copyTimer = setTimeout(() => {
|
|
442
|
+
this._copyTimer = null;
|
|
443
|
+
if (!this._destroyed) {
|
|
444
|
+
this.CopiedID = false;
|
|
445
|
+
this.cdr.markForCheck();
|
|
446
|
+
}
|
|
447
|
+
}, 1500);
|
|
448
|
+
}
|
|
449
|
+
get PopoverPositionStyle() {
|
|
450
|
+
const rect = this._anchorRect;
|
|
451
|
+
if (!rect || typeof window === 'undefined') {
|
|
452
|
+
return { display: 'none' };
|
|
453
|
+
}
|
|
454
|
+
const cardWidth = 328;
|
|
455
|
+
const estimatedHeight = 200;
|
|
456
|
+
const gap = 8;
|
|
457
|
+
const viewportW = window.innerWidth || 1024;
|
|
458
|
+
const viewportH = window.innerHeight || 768;
|
|
459
|
+
const left = Math.max(12, Math.min(rect.left, viewportW - cardWidth - 12));
|
|
460
|
+
const spaceBelow = viewportH - rect.bottom;
|
|
461
|
+
const openAbove = spaceBelow < estimatedHeight && rect.top > spaceBelow;
|
|
462
|
+
if (openAbove) {
|
|
463
|
+
return {
|
|
464
|
+
position: 'fixed',
|
|
465
|
+
left: `${left}px`,
|
|
466
|
+
bottom: `${Math.max(12, viewportH - rect.top + gap)}px`,
|
|
467
|
+
top: 'auto',
|
|
468
|
+
width: `${cardWidth}px`,
|
|
469
|
+
'z-index': '10050'
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
return {
|
|
473
|
+
position: 'fixed',
|
|
474
|
+
left: `${left}px`,
|
|
475
|
+
top: `${rect.bottom + gap}px`,
|
|
476
|
+
bottom: 'auto',
|
|
477
|
+
width: `${cardWidth}px`,
|
|
478
|
+
'z-index': '10050'
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
OnCardMouseEnter() {
|
|
482
|
+
this.MouseEnterCard.emit();
|
|
483
|
+
}
|
|
484
|
+
OnCardMouseLeave() {
|
|
485
|
+
if (this.IsEditing || this.IsSavingEdit) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
this.MouseLeaveCard.emit();
|
|
489
|
+
}
|
|
490
|
+
OnStartEdit(event) {
|
|
491
|
+
event.preventDefault();
|
|
492
|
+
event.stopPropagation();
|
|
493
|
+
const summary = this.Summary;
|
|
494
|
+
if (!summary || !summary.CanEditRecord || !this.AllowQuickEdit) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
const drafts = {};
|
|
498
|
+
if (summary.NameFieldEditable && summary.NameFieldName) {
|
|
499
|
+
drafts[summary.NameFieldName] = summary.Title;
|
|
500
|
+
}
|
|
501
|
+
for (const item of summary.Fields) {
|
|
502
|
+
if (!item.IsEditable)
|
|
503
|
+
continue;
|
|
504
|
+
if (item.InputType === 'boolean') {
|
|
505
|
+
drafts[item.FieldName] =
|
|
506
|
+
item.RawValue === true || item.RawValue === 1 || item.RawValue === 'true' || item.Value === 'Yes'
|
|
507
|
+
? 'true'
|
|
508
|
+
: 'false';
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
drafts[item.FieldName] = item.RawValue != null ? String(item.RawValue) : item.Value;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
this.EditDrafts = drafts;
|
|
515
|
+
this.EditErrorMessage = null;
|
|
516
|
+
this.IsEditing = true;
|
|
517
|
+
this.cdr.markForCheck();
|
|
518
|
+
}
|
|
519
|
+
OnCancelEdit(event) {
|
|
520
|
+
event?.preventDefault();
|
|
521
|
+
event?.stopPropagation();
|
|
522
|
+
this.resetEditState();
|
|
523
|
+
this.cdr.markForCheck();
|
|
524
|
+
}
|
|
525
|
+
OnEditDraftInput(fieldName, eventOrValue) {
|
|
526
|
+
if (typeof eventOrValue === 'string') {
|
|
527
|
+
this.EditDrafts[fieldName] = eventOrValue;
|
|
528
|
+
this.cdr.markForCheck();
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
const target = eventOrValue.target;
|
|
532
|
+
if (!target)
|
|
533
|
+
return;
|
|
534
|
+
this.EditDrafts[fieldName] = target.value;
|
|
535
|
+
this.cdr.markForCheck();
|
|
536
|
+
}
|
|
537
|
+
async OnSaveEdit(event) {
|
|
538
|
+
event?.preventDefault();
|
|
539
|
+
event?.stopPropagation();
|
|
540
|
+
const summary = this.Summary;
|
|
541
|
+
if (!summary || this.IsSavingEdit) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
const beforeArgs = new BeforeRecordPreviewSaveEventArgs(summary.EntityName, summary.PrimaryKey, summary, this.EditDrafts);
|
|
545
|
+
this.BeforeQuickEditSave.emit(beforeArgs);
|
|
546
|
+
if (beforeArgs.Cancel) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const md = this.ProviderToUse;
|
|
550
|
+
const entityInfo = md?.EntityByName(summary.EntityName);
|
|
551
|
+
if (!md || !entityInfo) {
|
|
552
|
+
this.EditErrorMessage = 'Entity metadata is unavailable.';
|
|
553
|
+
this.cdr.markForCheck();
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
this.IsSavingEdit = true;
|
|
557
|
+
this.EditErrorMessage = null;
|
|
558
|
+
this.cdr.markForCheck();
|
|
559
|
+
try {
|
|
560
|
+
const record = await md.GetEntityObject(summary.EntityName, md.CurrentUser);
|
|
561
|
+
const loaded = await record.InnerLoad(summary.PrimaryKey);
|
|
562
|
+
if (!loaded) {
|
|
563
|
+
this.EditErrorMessage = record.LatestResult?.Message || 'Could not load target record for editing.';
|
|
564
|
+
this.IsSavingEdit = false;
|
|
565
|
+
this.cdr.markForCheck();
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
const updatedFields = {};
|
|
569
|
+
for (const [fieldName, draftValue] of Object.entries(this.EditDrafts)) {
|
|
570
|
+
if (draftValue === undefined)
|
|
571
|
+
continue;
|
|
572
|
+
const fieldInfo = entityInfo.Fields.find(f => f.Name === fieldName);
|
|
573
|
+
const coerced = this.coerceDraftValue(draftValue, fieldInfo);
|
|
574
|
+
const currentVal = record.Get(fieldName);
|
|
575
|
+
if (String(currentVal ?? '') !== String(coerced ?? '')) {
|
|
576
|
+
record.Set(fieldName, coerced);
|
|
577
|
+
updatedFields[fieldName] = coerced;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const saved = await record.Save();
|
|
581
|
+
if (this._destroyed)
|
|
582
|
+
return;
|
|
583
|
+
if (!saved) {
|
|
584
|
+
this.EditErrorMessage = record.LatestResult?.Message || 'Failed to save changes.';
|
|
585
|
+
this.IsSavingEdit = false;
|
|
586
|
+
this.cdr.markForCheck();
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
const cacheKey = `${summary.EntityName.toLowerCase()}::${summary.RecordID.toLowerCase()}`;
|
|
590
|
+
MjRecordPreviewPopoverComponent_1.summaryCache.delete(cacheKey);
|
|
591
|
+
this.resetEditState();
|
|
592
|
+
await this.loadSummary(true);
|
|
593
|
+
const updatedEvent = {
|
|
594
|
+
EntityName: summary.EntityName,
|
|
595
|
+
PrimaryKey: summary.PrimaryKey,
|
|
596
|
+
UpdatedFields: updatedFields
|
|
597
|
+
};
|
|
598
|
+
this.AfterQuickEditSaved.emit(updatedEvent);
|
|
599
|
+
this.RecordUpdated.emit(updatedEvent);
|
|
600
|
+
this.cdr.markForCheck();
|
|
601
|
+
}
|
|
602
|
+
catch (err) {
|
|
603
|
+
if (!this._destroyed) {
|
|
604
|
+
this.EditErrorMessage = err instanceof Error ? err.message : 'Unexpected error while saving.';
|
|
605
|
+
this.IsSavingEdit = false;
|
|
606
|
+
this.cdr.markForCheck();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
coerceDraftValue(draft, field) {
|
|
611
|
+
if (!field) {
|
|
612
|
+
return draft;
|
|
613
|
+
}
|
|
614
|
+
if (field.TSType === EntityFieldTSType.Boolean) {
|
|
615
|
+
const norm = draft.trim().toLowerCase();
|
|
616
|
+
return norm === 'true' || norm === '1' || norm === 'yes';
|
|
617
|
+
}
|
|
618
|
+
if (field.TSType === EntityFieldTSType.Number) {
|
|
619
|
+
const trimmed = draft.trim();
|
|
620
|
+
if (trimmed === '')
|
|
621
|
+
return null;
|
|
622
|
+
const parsed = Number(trimmed);
|
|
623
|
+
return Number.isNaN(parsed) ? draft : parsed;
|
|
624
|
+
}
|
|
625
|
+
return draft;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Handles primary click on the record title link in the Option A header.
|
|
629
|
+
* Supports Ctrl/Cmd/Shift-click to open in a new tab.
|
|
630
|
+
*/
|
|
631
|
+
OnTitleClick(event) {
|
|
632
|
+
const openInNewTab = Boolean(event.ctrlKey || event.metaKey || event.shiftKey);
|
|
633
|
+
this.OnOpenRecord(openInNewTab, event);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Handles middle-click (`auxclick` button 1) on the record title link to open in a new tab.
|
|
637
|
+
*/
|
|
638
|
+
OnTitleAuxClick(event) {
|
|
639
|
+
if (event.button === 1) {
|
|
640
|
+
this.OnOpenRecord(true, event);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
OnOpenRecord(openInNewTab, event) {
|
|
644
|
+
event.preventDefault();
|
|
645
|
+
event.stopPropagation();
|
|
646
|
+
const summary = this.Summary;
|
|
647
|
+
const entityName = summary?.EntityName || this._entityName;
|
|
648
|
+
if (!entityName) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const pk = summary?.PrimaryKey || this.resolveCompositeKey();
|
|
652
|
+
if (!pk) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
this.Navigate.emit({
|
|
656
|
+
Kind: 'record',
|
|
657
|
+
EntityName: entityName,
|
|
658
|
+
PrimaryKey: pk,
|
|
659
|
+
OpenInNewTab: openInNewTab
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
resolveCompositeKey(entityInfo) {
|
|
663
|
+
if (this._primaryKey && this._primaryKey.KeyValuePairs?.length > 0) {
|
|
664
|
+
return this._primaryKey;
|
|
665
|
+
}
|
|
666
|
+
const rawId = this._recordID?.trim();
|
|
667
|
+
if (!rawId) {
|
|
668
|
+
return null;
|
|
669
|
+
}
|
|
670
|
+
return CompositeKey.FromURLSegment(entityInfo, rawId);
|
|
671
|
+
}
|
|
672
|
+
async loadSummary(forceRefresh = false) {
|
|
673
|
+
const entityName = this._entityName?.trim();
|
|
674
|
+
if (!entityName) {
|
|
675
|
+
this.Summary = null;
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const entityInfo = this.ProviderToUse?.EntityByName(entityName);
|
|
679
|
+
const pk = this.resolveCompositeKey(entityInfo);
|
|
680
|
+
if (!pk) {
|
|
681
|
+
this.Summary = null;
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
const recordIdStr = this._recordID?.trim() || pk.Values();
|
|
685
|
+
const cacheKey = `${entityName.toLowerCase()}::${recordIdStr.toLowerCase()}`;
|
|
686
|
+
if (!forceRefresh) {
|
|
687
|
+
const cached = MjRecordPreviewPopoverComponent_1.summaryCache.get(cacheKey);
|
|
688
|
+
if (cached && Date.now() - cached.LoadedAt < MjRecordPreviewPopoverComponent_1.CACHE_TTL_MS) {
|
|
689
|
+
this.Summary = cached.Summary;
|
|
690
|
+
this.IsLoading = false;
|
|
691
|
+
this.cdr.markForCheck();
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const seq = ++this._loadSeq;
|
|
696
|
+
this.IsLoading = true;
|
|
697
|
+
this.Summary = {
|
|
698
|
+
EntityName: entityInfo?.Name || entityName,
|
|
699
|
+
EntityDisplayName: entityInfo?.DisplayNameOrName || entityName,
|
|
700
|
+
EntityIcon: entityInfo?.Icon || 'fa-solid fa-table',
|
|
701
|
+
RecordID: recordIdStr,
|
|
702
|
+
PrimaryKey: pk,
|
|
703
|
+
Title: this._displayName || recordIdStr,
|
|
704
|
+
StatusValue: null,
|
|
705
|
+
Fields: [],
|
|
706
|
+
CanEditRecord: false,
|
|
707
|
+
NameFieldName: null,
|
|
708
|
+
NameFieldEditable: false
|
|
709
|
+
};
|
|
710
|
+
this.cdr.markForCheck();
|
|
711
|
+
if (!entityInfo) {
|
|
712
|
+
this.IsLoading = false;
|
|
713
|
+
this.cdr.markForCheck();
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
try {
|
|
717
|
+
const candidateFields = this.selectPreviewFields(entityInfo);
|
|
718
|
+
const fieldNamesToFetch = new Set();
|
|
719
|
+
for (const pkKey of entityInfo.PrimaryKeys) {
|
|
720
|
+
fieldNamesToFetch.add(pkKey.Name);
|
|
721
|
+
}
|
|
722
|
+
if (entityInfo.NameField) {
|
|
723
|
+
fieldNamesToFetch.add(entityInfo.NameField.Name);
|
|
724
|
+
}
|
|
725
|
+
for (const f of candidateFields) {
|
|
726
|
+
fieldNamesToFetch.add(f.Name);
|
|
727
|
+
if (f.RelatedEntityNameFieldMap) {
|
|
728
|
+
fieldNamesToFetch.add(f.RelatedEntityNameFieldMap);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
732
|
+
const result = await rv.RunView({
|
|
733
|
+
EntityName: entityInfo.Name,
|
|
734
|
+
ExtraFilter: pk.ToWhereClause(),
|
|
735
|
+
Fields: Array.from(fieldNamesToFetch),
|
|
736
|
+
MaxRows: 1,
|
|
737
|
+
ResultType: 'simple'
|
|
738
|
+
});
|
|
739
|
+
if (this._destroyed || seq !== this._loadSeq) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
const row = result.Success && result.Results?.length > 0 ? result.Results[0] : null;
|
|
743
|
+
const summary = this.buildSummaryFromRow(entityInfo, pk, recordIdStr, candidateFields, row);
|
|
744
|
+
MjRecordPreviewPopoverComponent_1.summaryCache.set(cacheKey, {
|
|
745
|
+
LoadedAt: Date.now(),
|
|
746
|
+
Summary: summary
|
|
747
|
+
});
|
|
748
|
+
this.Summary = summary;
|
|
749
|
+
}
|
|
750
|
+
catch {
|
|
751
|
+
// Keep fallback summary populated from inputs on error
|
|
752
|
+
}
|
|
753
|
+
finally {
|
|
754
|
+
if (!this._destroyed && seq === this._loadSeq) {
|
|
755
|
+
this.IsLoading = false;
|
|
756
|
+
this.cdr.markForCheck();
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
selectPreviewFields(entityInfo) {
|
|
761
|
+
const nameFieldLower = entityInfo.NameField?.Name?.toLowerCase() ?? '';
|
|
762
|
+
const eligible = entityInfo.Fields.filter(f => {
|
|
763
|
+
if (f.IsPrimaryKey)
|
|
764
|
+
return false;
|
|
765
|
+
if (f.Name.startsWith('__mj_'))
|
|
766
|
+
return false;
|
|
767
|
+
if (f.Name.toLowerCase() === nameFieldLower)
|
|
768
|
+
return false;
|
|
769
|
+
if (f.Status === 'Deprecated' || f.Status === 'Disabled')
|
|
770
|
+
return false;
|
|
771
|
+
if (f.MaxLength < 0 || f.MaxLength > 500)
|
|
772
|
+
return false;
|
|
773
|
+
return true;
|
|
774
|
+
});
|
|
775
|
+
const defaultInView = eligible.filter(f => f.DefaultInView);
|
|
776
|
+
const pool = defaultInView.length >= 2 ? defaultInView : eligible;
|
|
777
|
+
return pool.slice(0, 5);
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Determines whether a summary field should span the full 2-column width (`grid-column: 1 / -1`)
|
|
781
|
+
* so long values like emails, URLs, titles, or addresses never truncate unnecessarily.
|
|
782
|
+
* Subclasses can override this hook to customize column spanning.
|
|
783
|
+
*/
|
|
784
|
+
isFieldWide(field, formattedValue) {
|
|
785
|
+
if (/(email|url|website|uri|address|street|description|notes|summary|title|subject|headline|path)/i.test(field.Name)) {
|
|
786
|
+
return true;
|
|
787
|
+
}
|
|
788
|
+
if (formattedValue.includes('@') || formattedValue.startsWith('http://') || formattedValue.startsWith('https://')) {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
return formattedValue.length > 22;
|
|
792
|
+
}
|
|
793
|
+
isFieldQuickEditable(field, canEditEntity) {
|
|
794
|
+
if (!field || !canEditEntity)
|
|
795
|
+
return false;
|
|
796
|
+
if (field.IsPrimaryKey || field.ReadOnly || field.IsVirtual || field.AllowUpdateAPI === false) {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
if (field.RelatedEntity || field.EntityIDFieldName) {
|
|
800
|
+
return false;
|
|
801
|
+
}
|
|
802
|
+
return (field.TSType === EntityFieldTSType.String ||
|
|
803
|
+
field.TSType === EntityFieldTSType.Number ||
|
|
804
|
+
field.TSType === EntityFieldTSType.Boolean);
|
|
805
|
+
}
|
|
806
|
+
resolveFieldInputType(field) {
|
|
807
|
+
if (field.TSType === EntityFieldTSType.Boolean) {
|
|
808
|
+
return { InputType: 'boolean', PossibleValues: ['true', 'false'] };
|
|
809
|
+
}
|
|
810
|
+
const values = field.EntityFieldValues;
|
|
811
|
+
if (Array.isArray(values) && values.length > 0) {
|
|
812
|
+
return {
|
|
813
|
+
InputType: 'select',
|
|
814
|
+
PossibleValues: values.map(v => v.Value)
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
if (field.TSType === EntityFieldTSType.Number) {
|
|
818
|
+
return { InputType: 'number' };
|
|
819
|
+
}
|
|
820
|
+
return { InputType: 'text' };
|
|
821
|
+
}
|
|
822
|
+
buildSummaryFromRow(entityInfo, pk, recordIdStr, candidateFields, row) {
|
|
823
|
+
const entityWithPerm = entityInfo;
|
|
824
|
+
const canEditEntity = entityWithPerm.AllowUpdateAPI !== false &&
|
|
825
|
+
(entityWithPerm.UserPermissions?.CanUpdate ?? true);
|
|
826
|
+
let title = this._displayName || recordIdStr;
|
|
827
|
+
if (row && entityInfo.NameField) {
|
|
828
|
+
const rawTitle = row[entityInfo.NameField.Name];
|
|
829
|
+
if (rawTitle != null && String(rawTitle).trim().length > 0) {
|
|
830
|
+
title = String(rawTitle).trim();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
const isUuidTitle = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(title.trim());
|
|
834
|
+
if (isUuidTitle) {
|
|
835
|
+
const rawUuid = recordIdStr && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(recordIdStr.trim())
|
|
836
|
+
? recordIdStr.trim()
|
|
837
|
+
: title.trim();
|
|
838
|
+
title = `${entityInfo.DisplayNameOrName} · ${rawUuid.slice(0, 6)}…${rawUuid.slice(-4)}`;
|
|
839
|
+
}
|
|
840
|
+
const nameField = (entityInfo.NameField
|
|
841
|
+
? entityInfo.Fields.find(f => f.Name === entityInfo.NameField?.Name)
|
|
842
|
+
: undefined) ?? entityInfo.NameField;
|
|
843
|
+
const nameFieldEditable = Boolean(row && !isUuidTitle && this.isFieldQuickEditable(nameField, canEditEntity));
|
|
844
|
+
let statusValue = null;
|
|
845
|
+
const fields = [];
|
|
846
|
+
if (row) {
|
|
847
|
+
for (const f of candidateFields) {
|
|
848
|
+
const rawVal = f.RelatedEntityNameFieldMap && row[f.RelatedEntityNameFieldMap] != null
|
|
849
|
+
? row[f.RelatedEntityNameFieldMap]
|
|
850
|
+
: row[f.Name];
|
|
851
|
+
const formatted = this.formatPreviewValue(rawVal, f);
|
|
852
|
+
if (!formatted) {
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
const isStatus = /^(status|state|stage|priority|health)$/i.test(f.Name);
|
|
856
|
+
if (isStatus && !statusValue) {
|
|
857
|
+
statusValue = formatted;
|
|
858
|
+
}
|
|
859
|
+
if (fields.length < 4) {
|
|
860
|
+
const editable = this.isFieldQuickEditable(f, canEditEntity);
|
|
861
|
+
const inputMeta = editable ? this.resolveFieldInputType(f) : undefined;
|
|
862
|
+
fields.push({
|
|
863
|
+
FieldName: f.Name,
|
|
864
|
+
Label: f.DisplayNameOrName,
|
|
865
|
+
Value: formatted,
|
|
866
|
+
RawValue: row[f.Name],
|
|
867
|
+
IsStatusField: isStatus,
|
|
868
|
+
IsWide: this.isFieldWide(f, formatted),
|
|
869
|
+
IsEditable: editable,
|
|
870
|
+
InputType: inputMeta?.InputType,
|
|
871
|
+
PossibleValues: inputMeta?.PossibleValues
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
// Balance 2-column grid layout so a narrow field followed by a wide field (or at the end of an odd row) spans cleanly
|
|
877
|
+
let colCursor = 0;
|
|
878
|
+
for (let i = 0; i < fields.length; i++) {
|
|
879
|
+
const item = fields[i];
|
|
880
|
+
const next = i + 1 < fields.length ? fields[i + 1] : null;
|
|
881
|
+
if (item.IsWide) {
|
|
882
|
+
colCursor = 0;
|
|
883
|
+
}
|
|
884
|
+
else if (colCursor === 0 && (!next || next.IsWide)) {
|
|
885
|
+
item.IsWide = true;
|
|
886
|
+
colCursor = 0;
|
|
887
|
+
}
|
|
888
|
+
else {
|
|
889
|
+
colCursor = (colCursor + 1) % 2;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
const canEditRecord = Boolean(row) &&
|
|
893
|
+
canEditEntity &&
|
|
894
|
+
(nameFieldEditable || fields.some(item => item.IsEditable));
|
|
895
|
+
return {
|
|
896
|
+
EntityName: entityInfo.Name,
|
|
897
|
+
EntityDisplayName: entityInfo.DisplayNameOrName,
|
|
898
|
+
EntityIcon: entityInfo.Icon || 'fa-solid fa-table',
|
|
899
|
+
RecordID: recordIdStr,
|
|
900
|
+
PrimaryKey: pk,
|
|
901
|
+
Title: title,
|
|
902
|
+
StatusValue: statusValue,
|
|
903
|
+
Fields: fields,
|
|
904
|
+
CanEditRecord: canEditRecord,
|
|
905
|
+
NameFieldName: nameField?.Name ?? null,
|
|
906
|
+
NameFieldEditable: nameFieldEditable
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
formatPreviewValue(val, field) {
|
|
910
|
+
if (val === null || val === undefined || val === '') {
|
|
911
|
+
return '';
|
|
912
|
+
}
|
|
913
|
+
if (field.TSType === EntityFieldTSType.Boolean) {
|
|
914
|
+
return val === true || val === 1 || val === 'true' ? 'Yes' : 'No';
|
|
915
|
+
}
|
|
916
|
+
if (val instanceof Date) {
|
|
917
|
+
return isNaN(val.getTime()) ? '' : val.toLocaleDateString();
|
|
918
|
+
}
|
|
919
|
+
if (field.TSType === EntityFieldTSType.Date && typeof val === 'string') {
|
|
920
|
+
const d = new Date(val);
|
|
921
|
+
if (!isNaN(d.getTime())) {
|
|
922
|
+
return d.toLocaleDateString();
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
const str = String(val).trim();
|
|
926
|
+
return str.length > 80 ? `${str.slice(0, 77)}…` : str;
|
|
927
|
+
}
|
|
928
|
+
static ɵfac = /*@__PURE__*/ (() => { let ɵMjRecordPreviewPopoverComponent_BaseFactory; return function MjRecordPreviewPopoverComponent_Factory(__ngFactoryType__) { return (ɵMjRecordPreviewPopoverComponent_BaseFactory || (ɵMjRecordPreviewPopoverComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MjRecordPreviewPopoverComponent)))(__ngFactoryType__ || MjRecordPreviewPopoverComponent); }; })();
|
|
929
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MjRecordPreviewPopoverComponent, selectors: [["mj-record-preview-popover"]], inputs: { EntityName: "EntityName", RecordID: "RecordID", PrimaryKey: "PrimaryKey", DisplayName: "DisplayName", AnchorRect: "AnchorRect", Visible: "Visible", AllowQuickEdit: "AllowQuickEdit" }, outputs: { Navigate: "Navigate", MouseEnterCard: "MouseEnterCard", MouseLeaveCard: "MouseLeaveCard", BeforeQuickEditSave: "BeforeQuickEditSave", AfterQuickEditSaved: "AfterQuickEditSaved", RecordUpdated: "RecordUpdated" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["role", "dialog", 1, "mj-record-preview-popover", 3, "mj-record-preview-popover--editing", "ngStyle"], ["role", "dialog", 1, "mj-record-preview-popover", 3, "mouseenter", "mouseleave", "ngStyle"], [1, "mj-record-preview-header"], [1, "mj-record-preview-entity-row"], [1, "mj-record-preview-icon-wrap"], ["aria-hidden", "true"], [1, "mj-record-preview-entity-badge"], [1, "mj-record-preview-status-chip"], [1, "mj-record-preview-header-actions"], ["type", "button", "aria-label", "Copy Record ID", 1, "mj-record-preview-copy-id", 3, "is-copied", "title"], ["type", "button", "aria-label", "Quick edit summary fields", 1, "mj-record-preview-icon-btn", "mj-record-preview-quick-edit-btn", 3, "is-active", "title"], ["type", "button", "title", "Open in new tab", "aria-label", "Open in new tab", 1, "mj-record-preview-icon-btn", "mj-record-preview-new-tab-btn", 3, "click"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-up-right-from-square"], ["type", "text", 1, "mj-record-preview-title-input", 3, "value", "disabled"], ["type", "button", 1, "mj-record-preview-title", "mj-record-preview-title-link", 3, "title"], [1, "mj-record-preview-body"], [1, "mj-record-preview-loading"], [1, "mj-record-preview-grid"], [1, "mj-record-preview-id-row"], ["role", "alert", 1, "mj-record-preview-error"], [1, "mj-record-preview-footer"], ["type", "button", "aria-label", "Copy Record ID", 1, "mj-record-preview-copy-id", 3, "click", "title"], ["type", "button", "aria-label", "Quick edit summary fields", 1, "mj-record-preview-icon-btn", "mj-record-preview-quick-edit-btn", 3, "click", "title"], ["aria-hidden", "true", 1, "fa-solid", "fa-pen"], ["type", "text", 1, "mj-record-preview-title-input", 3, "input", "value", "disabled"], ["type", "button", 1, "mj-record-preview-title", "mj-record-preview-title-link", 3, "click", "auxclick", "title"], [1, "mj-record-preview-title-text"], ["aria-hidden", "true", 1, "fa-solid", "fa-arrow-right", "mj-record-preview-title-arrow"], ["aria-hidden", "true", 1, "fa-solid", "fa-circle-notch", "fa-spin"], [1, "mj-record-preview-field", 3, "mj-record-preview-field--wide"], [1, "mj-record-preview-field"], [1, "mj-record-preview-field-label"], [1, "mj-record-preview-field-value", 3, "title"], [1, "mj-record-preview-input", 3, "value", "disabled"], [1, "mj-record-preview-input", 3, "type", "value", "disabled"], [1, "mj-record-preview-input", 3, "change", "value", "disabled"], [3, "value", "selected"], [1, "mj-record-preview-input", 3, "input", "type", "value", "disabled"], [1, "mj-record-preview-field-value", "mj-record-preview-field-value--mono"], ["aria-hidden", "true", 1, "fa-solid", "fa-circle-exclamation"], ["type", "button", 1, "mj-record-preview-btn", "mj-record-preview-btn--secondary", 3, "click", "disabled"], ["type", "button", 1, "mj-record-preview-btn", "mj-record-preview-btn--primary", 3, "click", "disabled"]], template: function MjRecordPreviewPopoverComponent_Template(rf, ctx) { if (rf & 1) {
|
|
930
|
+
i0.ɵɵconditionalCreate(0, MjRecordPreviewPopoverComponent_Conditional_0_Template, 21, 14, "div", 0);
|
|
931
|
+
} if (rf & 2) {
|
|
932
|
+
let tmp_0_0;
|
|
933
|
+
i0.ɵɵconditional((tmp_0_0 = ctx.Visible && ctx.Summary) ? 0 : -1, tmp_0_0);
|
|
934
|
+
} }, dependencies: [i1.NgStyle, i2.NgSelectOption, i2.ɵNgSelectMultipleOption], styles: [".mj-record-preview-popover[_ngcontent-%COMP%] {\n background: var(--mj-bg-surface-elevated);\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-lg, 11px);\n box-shadow: var(--mj-shadow-lg, 0 14px 32px rgba(15, 23, 42, 0.16));\n overflow: hidden;\n font-family: inherit;\n color: var(--mj-text-primary);\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .mj-record-preview-popover[_ngcontent-%COMP%] {\n animation: _ngcontent-%COMP%_mj-preview-popover-in 120ms ease-out;\n }\n}\n\n@keyframes _ngcontent-%COMP%_mj-preview-popover-in {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.mj-record-preview-header[_ngcontent-%COMP%] {\n padding: 11px 13px 10px;\n background: color-mix(in srgb, var(--mj-brand-primary) 5%, var(--mj-bg-surface));\n border-bottom: 1px solid var(--mj-border-subtle);\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\n.mj-record-preview-entity-row[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n}\n\n.mj-record-preview-icon-wrap[_ngcontent-%COMP%] {\n width: 22px;\n height: 22px;\n border-radius: 6px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--mj-brand-primary) 14%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-size: 11px;\n flex-shrink: 0;\n}\n\n.mj-record-preview-entity-badge[_ngcontent-%COMP%] {\n font-size: 10.5px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-secondary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mj-record-preview-status-chip[_ngcontent-%COMP%] {\n padding: 1.5px 7px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-status-info) 14%, var(--mj-bg-surface));\n color: var(--mj-status-info);\n border: 1px solid color-mix(in srgb, var(--mj-status-info) 28%, transparent);\n flex-shrink: 0;\n}\n\n.mj-record-preview-header-actions[_ngcontent-%COMP%] {\n margin-left: auto;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n}\n\n.mj-record-preview-copy-id[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 2px 6px;\n border-radius: 5px;\n border: 1px solid var(--mj-border-subtle);\n background: var(--mj-bg-surface-sunken);\n color: var(--mj-text-muted);\n font-family: monospace;\n font-size: 10px;\n cursor: pointer;\n transition: background 120ms ease, color 120ms ease, border-color 120ms ease;\n}\n\n.mj-record-preview-copy-id[_ngcontent-%COMP%]:hover {\n color: var(--mj-text-primary);\n border-color: var(--mj-border-default);\n background: var(--mj-bg-surface-hover);\n}\n\n.mj-record-preview-copy-id.is-copied[_ngcontent-%COMP%] {\n color: var(--mj-status-success);\n border-color: color-mix(in srgb, var(--mj-status-success) 40%, var(--mj-border-subtle));\n background: color-mix(in srgb, var(--mj-status-success) 10%, var(--mj-bg-surface));\n}\n\n.mj-record-preview-icon-btn[_ngcontent-%COMP%] {\n width: 24px;\n height: 24px;\n border-radius: 6px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--mj-text-secondary);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 11px;\n cursor: pointer;\n padding: 0;\n transition: background 120ms ease, color 120ms ease, border-color 120ms ease;\n}\n\n.mj-record-preview-icon-btn[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface);\n border-color: var(--mj-border-default);\n color: var(--mj-brand-primary);\n}\n\n.mj-record-preview-icon-btn.is-active[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n border-color: color-mix(in srgb, var(--mj-brand-primary) 32%, var(--mj-border-default));\n color: var(--mj-brand-primary);\n}\n\n.mj-record-preview-icon-btn[_ngcontent-%COMP%]:focus-visible, \n.mj-record-preview-copy-id[_ngcontent-%COMP%]:focus-visible, \n.mj-record-preview-title-link[_ngcontent-%COMP%]:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: 1px;\n}\n\n.mj-record-preview-title[_ngcontent-%COMP%] {\n font-size: 14.5px;\n font-weight: 700;\n color: var(--mj-text-primary);\n line-height: 1.3;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-record-preview-title-link[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n width: fit-content;\n max-width: 100%;\n padding: 0;\n border: none;\n background: transparent;\n font-family: inherit;\n text-align: left;\n cursor: pointer;\n border-radius: 4px;\n transition: color 120ms ease;\n}\n\n.mj-record-preview-title-text[_ngcontent-%COMP%] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-record-preview-title-arrow[_ngcontent-%COMP%] {\n font-size: 11px;\n color: var(--mj-text-muted);\n opacity: 0.7;\n flex-shrink: 0;\n transition: transform 140ms ease, color 140ms ease, opacity 140ms ease;\n}\n\n.mj-record-preview-title-link[_ngcontent-%COMP%]:hover {\n color: var(--mj-brand-primary);\n}\n\n.mj-record-preview-title-link[_ngcontent-%COMP%]:hover .mj-record-preview-title-arrow[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n opacity: 1;\n transform: translateX(2px);\n}\n\n.mj-record-preview-body[_ngcontent-%COMP%] {\n padding: 10px 13px 12px;\n}\n\n.mj-record-preview-loading[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 12px;\n color: var(--mj-text-muted);\n padding: 6px 0;\n}\n\n.mj-record-preview-grid[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 9px 12px;\n}\n\n.mj-record-preview-field[_ngcontent-%COMP%], \n.mj-record-preview-id-row[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n}\n\n.mj-record-preview-field--wide[_ngcontent-%COMP%] {\n grid-column: 1 / -1;\n}\n\n.mj-record-preview-field-label[_ngcontent-%COMP%] {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.03em;\n color: var(--mj-text-muted);\n}\n\n.mj-record-preview-field-value[_ngcontent-%COMP%] {\n font-size: 12px;\n font-weight: 500;\n color: var(--mj-text-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-record-preview-field-value--mono[_ngcontent-%COMP%] {\n font-family: monospace;\n font-size: 11px;\n color: var(--mj-text-secondary);\n}\n\n.mj-record-preview-footer[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 6px;\n padding: 6px 13px;\n background: var(--mj-bg-surface-sunken);\n border-top: 1px solid var(--mj-border-subtle);\n}\n\n.mj-record-preview-btn[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n padding: 4px 10px;\n font-size: 11px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n font-family: inherit;\n transition: background 120ms ease, border-color 120ms ease, color 120ms ease;\n}\n\n.mj-record-preview-btn[_ngcontent-%COMP%]:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: 1px;\n}\n\n.mj-record-preview-btn--primary[_ngcontent-%COMP%] {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border: 1px solid var(--mj-brand-primary);\n}\n\n.mj-record-preview-btn--primary[_ngcontent-%COMP%]:hover {\n background: var(--mj-brand-primary-hover);\n}\n\n.mj-record-preview-btn--secondary[_ngcontent-%COMP%] {\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n border: 1px solid var(--mj-border-default);\n}\n\n.mj-record-preview-btn--secondary[_ngcontent-%COMP%]:hover {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-hover);\n border-color: var(--mj-border-strong);\n}\n\n.mj-record-preview-btn[_ngcontent-%COMP%]:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n.mj-record-preview-title-input[_ngcontent-%COMP%], \n.mj-record-preview-input[_ngcontent-%COMP%] {\n width: 100%;\n box-sizing: border-box;\n padding: 4px 7px;\n border-radius: 5px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-text-primary);\n font-family: inherit;\n font-size: 12px;\n outline: none;\n transition: border-color 120ms ease, box-shadow 120ms ease;\n}\n\n.mj-record-preview-title-input[_ngcontent-%COMP%] {\n font-size: 13px;\n font-weight: 600;\n}\n\n.mj-record-preview-title-input[_ngcontent-%COMP%]:focus, \n.mj-record-preview-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) 16%, transparent);\n}\n\n.mj-record-preview-error[_ngcontent-%COMP%] {\n margin-top: 8px;\n padding: 6px 8px;\n border-radius: 6px;\n font-size: 11px;\n display: flex;\n align-items: center;\n gap: 6px;\n color: var(--mj-status-error);\n background: color-mix(in srgb, var(--mj-status-error) 10%, var(--mj-bg-surface));\n border: 1px solid color-mix(in srgb, var(--mj-status-error) 28%, transparent);\n}"], changeDetection: 0 });
|
|
935
|
+
};
|
|
936
|
+
MjRecordPreviewPopoverComponent = MjRecordPreviewPopoverComponent_1 = __decorate([
|
|
937
|
+
OptionalKeyedSpecialization()
|
|
938
|
+
], MjRecordPreviewPopoverComponent);
|
|
939
|
+
export { MjRecordPreviewPopoverComponent };
|
|
940
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MjRecordPreviewPopoverComponent, [{
|
|
941
|
+
type: Component,
|
|
942
|
+
args: [{ standalone: false, selector: 'mj-record-preview-popover', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (Visible && Summary; as summary) {\n <div\n class=\"mj-record-preview-popover\"\n [class.mj-record-preview-popover--editing]=\"IsEditing\"\n [ngStyle]=\"PopoverPositionStyle\"\n role=\"dialog\"\n [attr.aria-label]=\"summary.EntityDisplayName + ' preview: ' + summary.Title\"\n (mouseenter)=\"OnCardMouseEnter()\"\n (mouseleave)=\"OnCardMouseLeave()\">\n <div class=\"mj-record-preview-header\">\n <div class=\"mj-record-preview-entity-row\">\n <span class=\"mj-record-preview-icon-wrap\">\n <i [class]=\"summary.EntityIcon\" aria-hidden=\"true\"></i>\n </span>\n <span class=\"mj-record-preview-entity-badge\">{{ summary.EntityDisplayName }}</span>\n @if (summary.StatusValue) {\n <span class=\"mj-record-preview-status-chip\">{{ summary.StatusValue }}</span>\n }\n\n <div class=\"mj-record-preview-header-actions\">\n @if (summary.RecordID) {\n <button\n type=\"button\"\n class=\"mj-record-preview-copy-id\"\n [class.is-copied]=\"CopiedID\"\n (click)=\"OnCopyRecordID($event)\"\n [title]=\"'Copy Record ID: ' + summary.RecordID\"\n aria-label=\"Copy Record ID\">\n <span>{{ CopiedID ? 'Copied!' : CompactRecordID }}</span>\n <i [class]=\"CopiedID ? 'fa-solid fa-check' : 'fa-regular fa-copy'\" aria-hidden=\"true\"></i>\n </button>\n }\n @if (AllowQuickEdit && summary.CanEditRecord) {\n <button\n type=\"button\"\n class=\"mj-record-preview-icon-btn mj-record-preview-quick-edit-btn\"\n [class.is-active]=\"IsEditing\"\n (click)=\"IsEditing ? OnCancelEdit($event) : OnStartEdit($event)\"\n [title]=\"IsEditing ? 'Cancel quick edit' : 'Quick edit fields'\"\n aria-label=\"Quick edit summary fields\">\n <i class=\"fa-solid fa-pen\" aria-hidden=\"true\"></i>\n </button>\n }\n <button\n type=\"button\"\n class=\"mj-record-preview-icon-btn mj-record-preview-new-tab-btn\"\n (click)=\"OnOpenRecord(true, $event)\"\n title=\"Open in new tab\"\n aria-label=\"Open in new tab\">\n <i class=\"fa-solid fa-arrow-up-right-from-square\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n\n @if (IsEditing && summary.NameFieldEditable && summary.NameFieldName; as nameField) {\n <input\n type=\"text\"\n class=\"mj-record-preview-title-input\"\n [attr.aria-label]=\"'Edit ' + summary.EntityDisplayName + ' name'\"\n [value]=\"EditDrafts[nameField] ?? summary.Title\"\n [disabled]=\"IsSavingEdit\"\n (input)=\"OnEditDraftInput(nameField, $event)\" />\n } @else {\n <button\n type=\"button\"\n class=\"mj-record-preview-title mj-record-preview-title-link\"\n (click)=\"OnTitleClick($event)\"\n (auxclick)=\"OnTitleAuxClick($event)\"\n [title]=\"'Open ' + summary.Title\">\n <span class=\"mj-record-preview-title-text\">{{ summary.Title }}</span>\n <i class=\"fa-solid fa-arrow-right mj-record-preview-title-arrow\" aria-hidden=\"true\"></i>\n </button>\n }\n </div>\n\n <div class=\"mj-record-preview-body\">\n @if (IsLoading) {\n <div class=\"mj-record-preview-loading\">\n <i class=\"fa-solid fa-circle-notch fa-spin\" aria-hidden=\"true\"></i>\n <span>Loading preview\u2026</span>\n </div>\n } @else if (summary.Fields.length > 0) {\n <div class=\"mj-record-preview-grid\">\n @for (item of summary.Fields; track item.FieldName) {\n <div\n class=\"mj-record-preview-field\"\n [class.mj-record-preview-field--wide]=\"item.IsWide\">\n <span class=\"mj-record-preview-field-label\">{{ item.Label }}</span>\n @if (IsEditing && item.IsEditable) {\n @if (item.InputType === 'select' || item.InputType === 'boolean') {\n <select\n class=\"mj-record-preview-input\"\n [attr.aria-label]=\"'Edit ' + item.Label\"\n [value]=\"EditDrafts[item.FieldName] ?? ''\"\n [disabled]=\"IsSavingEdit\"\n (change)=\"OnEditDraftInput(item.FieldName, $event)\">\n @for (opt of item.PossibleValues ?? []; track opt) {\n <option [value]=\"opt\" [selected]=\"(EditDrafts[item.FieldName] ?? '') === opt\">\n {{ item.InputType === 'boolean' ? (opt === 'true' ? 'Yes' : 'No') : opt }}\n </option>\n }\n </select>\n } @else {\n <input\n [type]=\"item.InputType === 'number' ? 'number' : 'text'\"\n class=\"mj-record-preview-input\"\n [attr.aria-label]=\"'Edit ' + item.Label\"\n [value]=\"EditDrafts[item.FieldName] ?? item.Value\"\n [disabled]=\"IsSavingEdit\"\n (input)=\"OnEditDraftInput(item.FieldName, $event)\" />\n }\n } @else {\n <span class=\"mj-record-preview-field-value\" [title]=\"item.Value\">{{ item.Value }}</span>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"mj-record-preview-id-row\">\n <span class=\"mj-record-preview-field-label\">Record ID</span>\n <span class=\"mj-record-preview-field-value mj-record-preview-field-value--mono\">{{ summary.RecordID }}</span>\n </div>\n }\n\n @if (EditErrorMessage) {\n <div class=\"mj-record-preview-error\" role=\"alert\">\n <i class=\"fa-solid fa-circle-exclamation\" aria-hidden=\"true\"></i>\n <span>{{ EditErrorMessage }}</span>\n </div>\n }\n </div>\n\n @if (IsEditing) {\n <div class=\"mj-record-preview-footer\">\n <button\n type=\"button\"\n class=\"mj-record-preview-btn mj-record-preview-btn--secondary\"\n [disabled]=\"IsSavingEdit\"\n (click)=\"OnCancelEdit($event)\">\n <span>Cancel</span>\n </button>\n <button\n type=\"button\"\n class=\"mj-record-preview-btn mj-record-preview-btn--primary\"\n [disabled]=\"IsSavingEdit\"\n (click)=\"OnSaveEdit($event)\">\n <i [class]=\"IsSavingEdit ? 'fa-solid fa-circle-notch fa-spin' : 'fa-solid fa-check'\" aria-hidden=\"true\"></i>\n <span>{{ IsSavingEdit ? 'Saving\u2026' : 'Save' }}</span>\n </button>\n </div>\n }\n </div>\n}\n", styles: [".mj-record-preview-popover {\n background: var(--mj-bg-surface-elevated);\n border: 1px solid var(--mj-border-default);\n border-radius: var(--mj-radius-lg, 11px);\n box-shadow: var(--mj-shadow-lg, 0 14px 32px rgba(15, 23, 42, 0.16));\n overflow: hidden;\n font-family: inherit;\n color: var(--mj-text-primary);\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .mj-record-preview-popover {\n animation: mj-preview-popover-in 120ms ease-out;\n }\n}\n\n@keyframes mj-preview-popover-in {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.mj-record-preview-header {\n padding: 11px 13px 10px;\n background: color-mix(in srgb, var(--mj-brand-primary) 5%, var(--mj-bg-surface));\n border-bottom: 1px solid var(--mj-border-subtle);\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\n.mj-record-preview-entity-row {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n}\n\n.mj-record-preview-icon-wrap {\n width: 22px;\n height: 22px;\n border-radius: 6px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: color-mix(in srgb, var(--mj-brand-primary) 14%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-size: 11px;\n flex-shrink: 0;\n}\n\n.mj-record-preview-entity-badge {\n font-size: 10.5px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-secondary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.mj-record-preview-status-chip {\n padding: 1.5px 7px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 600;\n background: color-mix(in srgb, var(--mj-status-info) 14%, var(--mj-bg-surface));\n color: var(--mj-status-info);\n border: 1px solid color-mix(in srgb, var(--mj-status-info) 28%, transparent);\n flex-shrink: 0;\n}\n\n.mj-record-preview-header-actions {\n margin-left: auto;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n}\n\n.mj-record-preview-copy-id {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 2px 6px;\n border-radius: 5px;\n border: 1px solid var(--mj-border-subtle);\n background: var(--mj-bg-surface-sunken);\n color: var(--mj-text-muted);\n font-family: monospace;\n font-size: 10px;\n cursor: pointer;\n transition: background 120ms ease, color 120ms ease, border-color 120ms ease;\n}\n\n.mj-record-preview-copy-id:hover {\n color: var(--mj-text-primary);\n border-color: var(--mj-border-default);\n background: var(--mj-bg-surface-hover);\n}\n\n.mj-record-preview-copy-id.is-copied {\n color: var(--mj-status-success);\n border-color: color-mix(in srgb, var(--mj-status-success) 40%, var(--mj-border-subtle));\n background: color-mix(in srgb, var(--mj-status-success) 10%, var(--mj-bg-surface));\n}\n\n.mj-record-preview-icon-btn {\n width: 24px;\n height: 24px;\n border-radius: 6px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--mj-text-secondary);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 11px;\n cursor: pointer;\n padding: 0;\n transition: background 120ms ease, color 120ms ease, border-color 120ms ease;\n}\n\n.mj-record-preview-icon-btn:hover {\n background: var(--mj-bg-surface);\n border-color: var(--mj-border-default);\n color: var(--mj-brand-primary);\n}\n\n.mj-record-preview-icon-btn.is-active {\n background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n border-color: color-mix(in srgb, var(--mj-brand-primary) 32%, var(--mj-border-default));\n color: var(--mj-brand-primary);\n}\n\n.mj-record-preview-icon-btn:focus-visible,\n.mj-record-preview-copy-id:focus-visible,\n.mj-record-preview-title-link:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: 1px;\n}\n\n.mj-record-preview-title {\n font-size: 14.5px;\n font-weight: 700;\n color: var(--mj-text-primary);\n line-height: 1.3;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-record-preview-title-link {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n width: fit-content;\n max-width: 100%;\n padding: 0;\n border: none;\n background: transparent;\n font-family: inherit;\n text-align: left;\n cursor: pointer;\n border-radius: 4px;\n transition: color 120ms ease;\n}\n\n.mj-record-preview-title-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-record-preview-title-arrow {\n font-size: 11px;\n color: var(--mj-text-muted);\n opacity: 0.7;\n flex-shrink: 0;\n transition: transform 140ms ease, color 140ms ease, opacity 140ms ease;\n}\n\n.mj-record-preview-title-link:hover {\n color: var(--mj-brand-primary);\n}\n\n.mj-record-preview-title-link:hover .mj-record-preview-title-arrow {\n color: var(--mj-brand-primary);\n opacity: 1;\n transform: translateX(2px);\n}\n\n.mj-record-preview-body {\n padding: 10px 13px 12px;\n}\n\n.mj-record-preview-loading {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 12px;\n color: var(--mj-text-muted);\n padding: 6px 0;\n}\n\n.mj-record-preview-grid {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 9px 12px;\n}\n\n.mj-record-preview-field,\n.mj-record-preview-id-row {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n}\n\n.mj-record-preview-field--wide {\n grid-column: 1 / -1;\n}\n\n.mj-record-preview-field-label {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.03em;\n color: var(--mj-text-muted);\n}\n\n.mj-record-preview-field-value {\n font-size: 12px;\n font-weight: 500;\n color: var(--mj-text-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-record-preview-field-value--mono {\n font-family: monospace;\n font-size: 11px;\n color: var(--mj-text-secondary);\n}\n\n.mj-record-preview-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 6px;\n padding: 6px 13px;\n background: var(--mj-bg-surface-sunken);\n border-top: 1px solid var(--mj-border-subtle);\n}\n\n.mj-record-preview-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n padding: 4px 10px;\n font-size: 11px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n font-family: inherit;\n transition: background 120ms ease, border-color 120ms ease, color 120ms ease;\n}\n\n.mj-record-preview-btn:focus-visible {\n outline: 2px solid var(--mj-border-focus);\n outline-offset: 1px;\n}\n\n.mj-record-preview-btn--primary {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border: 1px solid var(--mj-brand-primary);\n}\n\n.mj-record-preview-btn--primary:hover {\n background: var(--mj-brand-primary-hover);\n}\n\n.mj-record-preview-btn--secondary {\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n border: 1px solid var(--mj-border-default);\n}\n\n.mj-record-preview-btn--secondary:hover {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-hover);\n border-color: var(--mj-border-strong);\n}\n\n.mj-record-preview-btn:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n.mj-record-preview-title-input,\n.mj-record-preview-input {\n width: 100%;\n box-sizing: border-box;\n padding: 4px 7px;\n border-radius: 5px;\n border: 1px solid var(--mj-border-default);\n background: var(--mj-bg-surface);\n color: var(--mj-text-primary);\n font-family: inherit;\n font-size: 12px;\n outline: none;\n transition: border-color 120ms ease, box-shadow 120ms ease;\n}\n\n.mj-record-preview-title-input {\n font-size: 13px;\n font-weight: 600;\n}\n\n.mj-record-preview-title-input:focus,\n.mj-record-preview-input:focus {\n border-color: var(--mj-brand-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 16%, transparent);\n}\n\n.mj-record-preview-error {\n margin-top: 8px;\n padding: 6px 8px;\n border-radius: 6px;\n font-size: 11px;\n display: flex;\n align-items: center;\n gap: 6px;\n color: var(--mj-status-error);\n background: color-mix(in srgb, var(--mj-status-error) 10%, var(--mj-bg-surface));\n border: 1px solid color-mix(in srgb, var(--mj-status-error) 28%, transparent);\n}\n"] }]
|
|
943
|
+
}], null, { EntityName: [{
|
|
944
|
+
type: Input
|
|
945
|
+
}], RecordID: [{
|
|
946
|
+
type: Input
|
|
947
|
+
}], PrimaryKey: [{
|
|
948
|
+
type: Input
|
|
949
|
+
}], DisplayName: [{
|
|
950
|
+
type: Input
|
|
951
|
+
}], AnchorRect: [{
|
|
952
|
+
type: Input
|
|
953
|
+
}], Visible: [{
|
|
954
|
+
type: Input
|
|
955
|
+
}], AllowQuickEdit: [{
|
|
956
|
+
type: Input
|
|
957
|
+
}], Navigate: [{
|
|
958
|
+
type: Output
|
|
959
|
+
}], MouseEnterCard: [{
|
|
960
|
+
type: Output
|
|
961
|
+
}], MouseLeaveCard: [{
|
|
962
|
+
type: Output
|
|
963
|
+
}], BeforeQuickEditSave: [{
|
|
964
|
+
type: Output
|
|
965
|
+
}], AfterQuickEditSaved: [{
|
|
966
|
+
type: Output
|
|
967
|
+
}], RecordUpdated: [{
|
|
968
|
+
type: Output
|
|
969
|
+
}] }); })();
|
|
970
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MjRecordPreviewPopoverComponent, { className: "MjRecordPreviewPopoverComponent", filePath: "src/lib/preview-popover/record-preview-popover.component.ts", lineNumber: 129 }); })();
|
|
971
|
+
function isStrictSubclassOf(subCtor, superCtor) {
|
|
972
|
+
if (typeof subCtor !== 'function' || typeof superCtor !== 'function' || subCtor === superCtor) {
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
return Boolean(subCtor.prototype &&
|
|
976
|
+
superCtor.prototype &&
|
|
977
|
+
subCtor.prototype instanceof superCtor);
|
|
978
|
+
}
|
|
979
|
+
function selectWinningRegistration(candidates) {
|
|
980
|
+
if (candidates.length === 0) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
let winner = candidates[0];
|
|
984
|
+
for (let i = 1; i < candidates.length; i++) {
|
|
985
|
+
const candidate = candidates[i];
|
|
986
|
+
if (isStrictSubclassOf(candidate.SubClass, winner.SubClass)) {
|
|
987
|
+
winner = candidate;
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
if (isStrictSubclassOf(winner.SubClass, candidate.SubClass)) {
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
if (candidate.Priority >= winner.Priority) {
|
|
994
|
+
winner = candidate;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return winner;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Resolves the concrete {@link MjRecordPreviewPopoverComponent} class to instantiate for a given
|
|
1001
|
+
* entity via `MJGlobal.Instance.ClassFactory`.
|
|
1002
|
+
*
|
|
1003
|
+
* Resolution precedence:
|
|
1004
|
+
* 1. **Exact entity key match** — e.g. `@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common: People')`
|
|
1005
|
+
* 2. **Wildcard or schema pattern key match** — e.g. `@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common:*')`
|
|
1006
|
+
* or `@RegisterClass(MjRecordPreviewPopoverComponent, 'schema:mj_bizapps_common')`
|
|
1007
|
+
* 3. **Global unkeyed or `'*'` registration** — e.g. `@RegisterClass(MjRecordPreviewPopoverComponent)`
|
|
1008
|
+
* 4. **Default built-in component** — {@link MjRecordPreviewPopoverComponent}
|
|
1009
|
+
*/
|
|
1010
|
+
export function ResolveRecordPreviewPopoverType(entityName, schemaName) {
|
|
1011
|
+
const cf = MJGlobal.Instance?.ClassFactory;
|
|
1012
|
+
if (!cf) {
|
|
1013
|
+
return MjRecordPreviewPopoverComponent;
|
|
1014
|
+
}
|
|
1015
|
+
const byRoot = cf.GetRegistrationsByRootClass(MjRecordPreviewPopoverComponent);
|
|
1016
|
+
const byBase = cf.GetAllRegistrations(MjRecordPreviewPopoverComponent);
|
|
1017
|
+
const allRegs = Array.from(new Set([...byRoot, ...byBase])).filter(r => typeof r.SubClass === 'function' && r.SubClass !== MjRecordPreviewPopoverComponent);
|
|
1018
|
+
if (allRegs.length === 0) {
|
|
1019
|
+
return MjRecordPreviewPopoverComponent;
|
|
1020
|
+
}
|
|
1021
|
+
const normEntity = (entityName ?? '').trim().toLowerCase();
|
|
1022
|
+
const normSchema = (schemaName ?? '').trim().toLowerCase();
|
|
1023
|
+
if (normEntity) {
|
|
1024
|
+
// 1. Exact entity name match
|
|
1025
|
+
const exactMatches = allRegs.filter(r => typeof r.Key === 'string' && r.Key.trim().toLowerCase() === normEntity);
|
|
1026
|
+
const exactWinner = selectWinningRegistration(exactMatches);
|
|
1027
|
+
if (exactWinner) {
|
|
1028
|
+
return exactWinner.SubClass;
|
|
1029
|
+
}
|
|
1030
|
+
// 2. Wildcard / schema pattern match
|
|
1031
|
+
const patternMatches = allRegs.filter(r => {
|
|
1032
|
+
if (typeof r.Key !== 'string')
|
|
1033
|
+
return false;
|
|
1034
|
+
const key = r.Key.trim().toLowerCase();
|
|
1035
|
+
if (!key || key === '*')
|
|
1036
|
+
return false;
|
|
1037
|
+
if (key.startsWith('schema:')) {
|
|
1038
|
+
const targetSchema = key.slice('schema:'.length).trim();
|
|
1039
|
+
return Boolean(targetSchema && normSchema && normSchema === targetSchema);
|
|
1040
|
+
}
|
|
1041
|
+
if (key.includes('*')) {
|
|
1042
|
+
const escaped = key.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
1043
|
+
return new RegExp(`^${escaped}$`, 'i').test(normEntity);
|
|
1044
|
+
}
|
|
1045
|
+
return false;
|
|
1046
|
+
});
|
|
1047
|
+
const patternWinner = selectWinningRegistration(patternMatches);
|
|
1048
|
+
if (patternWinner) {
|
|
1049
|
+
return patternWinner.SubClass;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
// 3. Global unkeyed or '*' registration
|
|
1053
|
+
const globalMatches = allRegs.filter(r => r.Key === null || r.Key === undefined || r.Key.trim() === '' || r.Key.trim() === '*');
|
|
1054
|
+
const globalWinner = selectWinningRegistration(globalMatches);
|
|
1055
|
+
if (globalWinner) {
|
|
1056
|
+
return globalWinner.SubClass;
|
|
1057
|
+
}
|
|
1058
|
+
return MjRecordPreviewPopoverComponent;
|
|
1059
|
+
}
|
|
1060
|
+
//# sourceMappingURL=record-preview-popover.component.js.map
|