@memberjunction/ng-base-forms 6.1.0-edge.1 → 6.1.0-edge.3
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/LICENSE +180 -4
- package/README.md +4 -1
- package/dist/lib/base-form-component.d.ts +105 -3
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +254 -9
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/base-form-section-component.d.ts +33 -1
- package/dist/lib/base-form-section-component.d.ts.map +1 -1
- package/dist/lib/base-form-section-component.js +40 -0
- package/dist/lib/base-form-section-component.js.map +1 -1
- package/dist/lib/chrome/base-form-policy.d.ts +26 -0
- package/dist/lib/chrome/base-form-policy.d.ts.map +1 -0
- package/dist/lib/chrome/base-form-policy.js +9 -0
- package/dist/lib/chrome/base-form-policy.js.map +1 -0
- package/dist/lib/chrome/clipped-title.d.ts +8 -0
- package/dist/lib/chrome/clipped-title.d.ts.map +1 -0
- package/dist/lib/chrome/clipped-title.js +18 -0
- package/dist/lib/chrome/clipped-title.js.map +1 -0
- package/dist/lib/chrome/form-chrome-coordinator.service.d.ts +35 -0
- package/dist/lib/chrome/form-chrome-coordinator.service.d.ts.map +1 -0
- package/dist/lib/chrome/form-chrome-coordinator.service.js +96 -0
- package/dist/lib/chrome/form-chrome-coordinator.service.js.map +1 -0
- package/dist/lib/chrome/form-chrome-rail-pref.d.ts +24 -0
- package/dist/lib/chrome/form-chrome-rail-pref.d.ts.map +1 -0
- package/dist/lib/chrome/form-chrome-rail-pref.js +52 -0
- package/dist/lib/chrome/form-chrome-rail-pref.js.map +1 -0
- package/dist/lib/chrome/form-chrome.d.ts +59 -0
- package/dist/lib/chrome/form-chrome.d.ts.map +1 -0
- package/dist/lib/chrome/form-chrome.js +37 -0
- package/dist/lib/chrome/form-chrome.js.map +1 -0
- package/dist/lib/chrome/load-form-chrome-rules.d.ts +8 -0
- package/dist/lib/chrome/load-form-chrome-rules.d.ts.map +1 -0
- package/dist/lib/chrome/load-form-chrome-rules.js +70 -0
- package/dist/lib/chrome/load-form-chrome-rules.js.map +1 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts +114 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -0
- package/dist/lib/chrome/resolve-form-chrome.js +713 -0
- package/dist/lib/chrome/resolve-form-chrome.js.map +1 -0
- package/dist/lib/container/record-form-container.component.d.ts +170 -6
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +1198 -63
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/explorer-entity-data-grid.component.d.ts +54 -1
- package/dist/lib/explorer-entity-data-grid.component.d.ts.map +1 -1
- package/dist/lib/explorer-entity-data-grid.component.js +143 -7
- package/dist/lib/explorer-entity-data-grid.component.js.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.d.ts +27 -0
- package/dist/lib/form-record-refresh.coordinator.d.ts.map +1 -0
- package/dist/lib/form-record-refresh.coordinator.js +33 -0
- package/dist/lib/form-record-refresh.coordinator.js.map +1 -0
- package/dist/lib/form-state.interface.d.ts +4 -0
- package/dist/lib/form-state.interface.d.ts.map +1 -1
- package/dist/lib/form-state.interface.js.map +1 -1
- package/dist/lib/form-state.service.d.ts +5 -0
- package/dist/lib/form-state.service.d.ts.map +1 -1
- package/dist/lib/form-state.service.js +23 -2
- package/dist/lib/form-state.service.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +5 -1
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +16 -2
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts +6 -2
- package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.js +15 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts +24 -2
- package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.js +104 -10
- package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
- package/dist/lib/panel-slot/base-form-panel.d.ts +85 -1
- package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
- package/dist/lib/panel-slot/base-form-panel.js +72 -3
- package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +8 -0
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -0
- package/dist/lib/panel-slot/collect-form-panel-registrations.js +19 -0
- package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -0
- package/dist/lib/panel-slot/form-contribution.d.ts +79 -0
- package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -0
- package/dist/lib/panel-slot/form-contribution.js +253 -0
- package/dist/lib/panel-slot/form-contribution.js.map +1 -0
- package/dist/lib/panel-slot/form-contributions.component.d.ts +27 -0
- package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/form-contributions.component.js +83 -0
- package/dist/lib/panel-slot/form-contributions.component.js.map +1 -0
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts +2 -0
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +35 -4
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +22 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js +78 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -0
- package/dist/lib/related-grid-height.d.ts +20 -0
- package/dist/lib/related-grid-height.d.ts.map +1 -0
- package/dist/lib/related-grid-height.js +30 -0
- package/dist/lib/related-grid-height.js.map +1 -0
- package/dist/lib/section-manager/section-manager.component.d.ts +20 -1
- package/dist/lib/section-manager/section-manager.component.d.ts.map +1 -1
- package/dist/lib/section-manager/section-manager.component.js +204 -25
- package/dist/lib/section-manager/section-manager.component.js.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.d.ts +55 -4
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +734 -306
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/lib/types/form-events.d.ts +35 -0
- package/dist/lib/types/form-events.d.ts.map +1 -1
- package/dist/lib/types/form-events.js +45 -0
- package/dist/lib/types/form-events.js.map +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts +145 -0
- package/dist/lib/types/form-toolbar-item.d.ts.map +1 -0
- package/dist/lib/types/form-toolbar-item.js +2 -0
- package/dist/lib/types/form-toolbar-item.js.map +1 -0
- package/dist/lib/types/form-types.d.ts +8 -0
- package/dist/lib/types/form-types.d.ts.map +1 -1
- package/dist/lib/types/form-types.js.map +1 -1
- package/dist/lib/types/toolbar-config.d.ts +7 -2
- 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 +17 -14
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +14 -0
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +13 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +14 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +19 -18
|
@@ -7,6 +7,8 @@ import { BaseRecordComponent } from './base-record-component';
|
|
|
7
7
|
import { BaseFormSectionInfo } from './base-form-section-info';
|
|
8
8
|
import { MjCollapsiblePanelComponent } from './panel/collapsible-panel.component';
|
|
9
9
|
import { FormStateService } from './form-state.service';
|
|
10
|
+
import { CollectFormPanelRegistrations } from './panel-slot/collect-form-panel-registrations';
|
|
11
|
+
import { ContributionHiddenSectionKeys } from './panel-slot/form-contribution';
|
|
10
12
|
import * as i0 from "@angular/core";
|
|
11
13
|
/**
|
|
12
14
|
* Abstract base class for all entity record forms in MemberJunction.
|
|
@@ -26,6 +28,7 @@ import * as i0 from "@angular/core";
|
|
|
26
28
|
*/
|
|
27
29
|
export class BaseFormComponent extends BaseRecordComponent {
|
|
28
30
|
EditMode = false;
|
|
31
|
+
IsRefreshing = false;
|
|
29
32
|
FavoriteInitDone = false;
|
|
30
33
|
/**
|
|
31
34
|
* Per-instance presentation config (toolbar visibility, related-entity
|
|
@@ -90,6 +93,83 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
90
93
|
// No-op — host application can override
|
|
91
94
|
}
|
|
92
95
|
_pendingRecords = [];
|
|
96
|
+
_registeredToolbarItems = new Map();
|
|
97
|
+
_toolbarItemOverrides = new Map();
|
|
98
|
+
/**
|
|
99
|
+
* Registers a dynamic toolbar action item / button.
|
|
100
|
+
* Can be called during ngOnInit or at runtime.
|
|
101
|
+
*/
|
|
102
|
+
RegisterToolbarItem(item) {
|
|
103
|
+
this._registeredToolbarItems.set(item.Key, { ...item });
|
|
104
|
+
this.cdr?.markForCheck();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Unregisters a previously registered dynamic toolbar item by key.
|
|
108
|
+
*/
|
|
109
|
+
UnregisterToolbarItem(key) {
|
|
110
|
+
if (this._registeredToolbarItems.delete(key)) {
|
|
111
|
+
this.cdr?.markForCheck();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Configures overrides for any toolbar item (standard built-in items like 'edit',
|
|
116
|
+
* 'delete', 'favorite', 'history', etc., or custom items).
|
|
117
|
+
* Allows dynamically changing visibility, disabled state, tooltips, order, icon, etc.
|
|
118
|
+
*/
|
|
119
|
+
ConfigureToolbarItem(key, overrides) {
|
|
120
|
+
const existing = this._toolbarItemOverrides.get(key) || {};
|
|
121
|
+
this._toolbarItemOverrides.set(key, { ...existing, ...overrides });
|
|
122
|
+
this.cdr?.markForCheck();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Dynamically hides a toolbar item by key.
|
|
126
|
+
*/
|
|
127
|
+
HideToolbarItem(key) {
|
|
128
|
+
this.ConfigureToolbarItem(key, { Visible: false });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Dynamically shows a toolbar item by key.
|
|
132
|
+
*/
|
|
133
|
+
ShowToolbarItem(key) {
|
|
134
|
+
this.ConfigureToolbarItem(key, { Visible: true });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Dynamically disables a toolbar item by key, with an optional reason string for the tooltip.
|
|
138
|
+
*/
|
|
139
|
+
DisableToolbarItem(key, reason) {
|
|
140
|
+
this.ConfigureToolbarItem(key, { Disabled: reason ?? true });
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Dynamically enables a toolbar item by key.
|
|
144
|
+
*/
|
|
145
|
+
EnableToolbarItem(key) {
|
|
146
|
+
this.ConfigureToolbarItem(key, { Disabled: false });
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Sets the numeric display order for a toolbar item (lower numbers appear earlier).
|
|
150
|
+
*/
|
|
151
|
+
SetToolbarItemOrder(key, order) {
|
|
152
|
+
this.ConfigureToolbarItem(key, { Order: order });
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Returns all dynamically registered toolbar items.
|
|
156
|
+
*/
|
|
157
|
+
get RegisteredToolbarItems() {
|
|
158
|
+
return Array.from(this._registeredToolbarItems.values());
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Returns the map of toolbar item overrides.
|
|
162
|
+
*/
|
|
163
|
+
get ToolbarItemOverrides() {
|
|
164
|
+
return this._toolbarItemOverrides;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Hook invoked when a custom or dynamic toolbar item is clicked.
|
|
168
|
+
* Subclasses can override this method to handle custom button clicks.
|
|
169
|
+
*/
|
|
170
|
+
OnCustomToolbarButtonClick(event) {
|
|
171
|
+
// Subclasses can override
|
|
172
|
+
}
|
|
93
173
|
// #region Injected Dependencies (no constructor params)
|
|
94
174
|
elementRef = inject(ElementRef);
|
|
95
175
|
cdr = inject(ChangeDetectorRef);
|
|
@@ -102,6 +182,8 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
102
182
|
Notification = new EventEmitter();
|
|
103
183
|
/** Emitted after a record is saved successfully */
|
|
104
184
|
RecordSaved = new EventEmitter();
|
|
185
|
+
/** Emitted after a record is refreshed from the database successfully */
|
|
186
|
+
RecordRefreshed = new EventEmitter();
|
|
105
187
|
/** Emitted after a record is deleted successfully */
|
|
106
188
|
RecordDeleted = new EventEmitter();
|
|
107
189
|
/** Emitted when a record save fails */
|
|
@@ -171,6 +253,20 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
171
253
|
get PendingRecords() {
|
|
172
254
|
return this._pendingRecords;
|
|
173
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Unsaved changes a form holds OUTSIDE its record's fields and pending records.
|
|
258
|
+
*
|
|
259
|
+
* A form whose sections own editors — a flow canvas, a designer, a grid — accumulates edits that
|
|
260
|
+
* neither `record.Dirty` nor `PendingRecordsDirty()` can see, because nothing on the entity
|
|
261
|
+
* changed. Without this the toolbar reports "no changes" while the user is looking at their own
|
|
262
|
+
* work, and the navigate-away guard lets them lose it silently.
|
|
263
|
+
*
|
|
264
|
+
* Default `false`, so no existing form changes behaviour. Override to consult whatever holds the
|
|
265
|
+
* extra state.
|
|
266
|
+
*/
|
|
267
|
+
get HasAdditionalUnsavedChanges() {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
174
270
|
PendingRecordsDirty() {
|
|
175
271
|
this.PopulatePendingRecords();
|
|
176
272
|
const pendingRecords = this.PendingRecords;
|
|
@@ -340,6 +436,77 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
340
436
|
}
|
|
341
437
|
}
|
|
342
438
|
}
|
|
439
|
+
/**
|
|
440
|
+
* Re-fetches the current record from the database, updating field values
|
|
441
|
+
* in-place and resetting dirty flags. No-op in edit mode or on an unsaved
|
|
442
|
+
* record. Related-entity grids are notified via the form container's
|
|
443
|
+
* {@link FormRecordRefreshCoordinator} after this emits {@link RecordRefreshed}.
|
|
444
|
+
*
|
|
445
|
+
* @returns true if the record was reloaded from the database.
|
|
446
|
+
*/
|
|
447
|
+
async RefreshRecord() {
|
|
448
|
+
if (!this.canRefreshRecord()) {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
this.IsRefreshing = true;
|
|
452
|
+
this.cdr.markForCheck();
|
|
453
|
+
try {
|
|
454
|
+
return await this.executeRecordRefresh();
|
|
455
|
+
}
|
|
456
|
+
finally {
|
|
457
|
+
this.IsRefreshing = false;
|
|
458
|
+
this.cdr.markForCheck();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
canRefreshRecord() {
|
|
462
|
+
return !!this.record && this.record.IsSaved && !this.EditMode;
|
|
463
|
+
}
|
|
464
|
+
async executeRecordRefresh() {
|
|
465
|
+
const record = this.record;
|
|
466
|
+
if (!record) {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
const ok = await record.Refresh();
|
|
471
|
+
if (!ok) {
|
|
472
|
+
this.Notification.emit({
|
|
473
|
+
Message: 'Failed to refresh record from database',
|
|
474
|
+
Type: 'error',
|
|
475
|
+
Duration: 5000,
|
|
476
|
+
});
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
await this.reloadFavoriteStatusAfterRefresh(record);
|
|
480
|
+
this.Notification.emit({
|
|
481
|
+
Message: 'Record refreshed from database',
|
|
482
|
+
Type: 'info',
|
|
483
|
+
Duration: 2000,
|
|
484
|
+
});
|
|
485
|
+
this.RecordRefreshed.emit({
|
|
486
|
+
EntityName: record.EntityInfo.Name,
|
|
487
|
+
Record: record,
|
|
488
|
+
});
|
|
489
|
+
return true;
|
|
490
|
+
}
|
|
491
|
+
catch (e) {
|
|
492
|
+
const detail = e instanceof Error ? e.message : String(e);
|
|
493
|
+
this.Notification.emit({
|
|
494
|
+
Message: 'Error refreshing record: ' + detail,
|
|
495
|
+
Type: 'error',
|
|
496
|
+
Duration: 5000,
|
|
497
|
+
});
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
async reloadFavoriteStatusAfterRefresh(record) {
|
|
502
|
+
const md = this.ProviderToUse;
|
|
503
|
+
try {
|
|
504
|
+
this._isFavorite = await md.GetRecordFavoriteStatus(md.CurrentUser.ID, record.EntityInfo.Name, record.PrimaryKey);
|
|
505
|
+
}
|
|
506
|
+
catch {
|
|
507
|
+
// Non-critical — favorite status remains as is
|
|
508
|
+
}
|
|
509
|
+
}
|
|
343
510
|
async InternalSaveRecord() {
|
|
344
511
|
if (this.record) {
|
|
345
512
|
if (this._pendingRecords.length > 0) {
|
|
@@ -439,6 +606,14 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
439
606
|
else
|
|
440
607
|
return {};
|
|
441
608
|
}
|
|
609
|
+
/**
|
|
610
|
+
* One grid over several FKs to the same related entity (Bill-To OR Ship-To).
|
|
611
|
+
*/
|
|
612
|
+
BuildRelationshipViewParamsForJoinFields(relatedEntityName, joinFields) {
|
|
613
|
+
if (!this.record)
|
|
614
|
+
return {};
|
|
615
|
+
return EntityInfo.BuildRelationshipViewParamsForJoinFields(this.record, relatedEntityName, joinFields);
|
|
616
|
+
}
|
|
442
617
|
GetEntityRelationshipByRelatedEntityName(relatedEntityName, relatedEntityJoinField) {
|
|
443
618
|
if (this.record) {
|
|
444
619
|
const r = this.record;
|
|
@@ -457,12 +632,36 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
457
632
|
}
|
|
458
633
|
return undefined;
|
|
459
634
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
635
|
+
/**
|
|
636
|
+
* Default values for a new related-entity record so it links back here.
|
|
637
|
+
* Pass `relatedEntityJoinField` when more than one relationship targets the
|
|
638
|
+
* same entity (Bill-To vs Ship-To). When omitted and several matches exist,
|
|
639
|
+
* every matching FK is set — same fields the related grid is filtering on.
|
|
640
|
+
*/
|
|
641
|
+
NewRecordValues(relatedEntityName, relatedEntityJoinField) {
|
|
642
|
+
if (!this.record)
|
|
643
|
+
return {};
|
|
644
|
+
if (relatedEntityJoinField) {
|
|
645
|
+
const eri = this.GetEntityRelationshipByRelatedEntityName(relatedEntityName, relatedEntityJoinField);
|
|
646
|
+
if (eri)
|
|
647
|
+
return this.NewRecordValuesByEntityRelationship(eri);
|
|
648
|
+
return EntityInfo.BuildRelationshipNewRecordValuesForJoinFields(this.record, [relatedEntityJoinField]);
|
|
649
|
+
}
|
|
650
|
+
const matches = this.record.EntityInfo.RelatedEntities.filter((x) => x.RelatedEntity.trim().toLowerCase() === relatedEntityName.trim().toLowerCase());
|
|
651
|
+
if (matches.length === 0)
|
|
465
652
|
return {};
|
|
653
|
+
if (matches.length === 1)
|
|
654
|
+
return this.NewRecordValuesByEntityRelationship(matches[0]);
|
|
655
|
+
return EntityInfo.BuildRelationshipNewRecordValuesForJoinFields(this.record, matches.map((m) => m.RelatedEntityJoinField));
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Default values for a new related record, setting every listed join field
|
|
659
|
+
* to this record's key. Pair with {@link BuildRelationshipViewParamsForJoinFields}.
|
|
660
|
+
*/
|
|
661
|
+
NewRecordValuesForJoinFields(relatedEntityName, joinFields) {
|
|
662
|
+
if (!this.record || !relatedEntityName)
|
|
663
|
+
return {};
|
|
664
|
+
return EntityInfo.BuildRelationshipNewRecordValuesForJoinFields(this.record, joinFields);
|
|
466
665
|
}
|
|
467
666
|
NewRecordValuesByEntityRelationship(item) {
|
|
468
667
|
return EntityInfo.BuildRelationshipNewRecordValues(this.record, item);
|
|
@@ -607,11 +806,28 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
607
806
|
collapsibleSections: this.Config?.CollapsibleSections,
|
|
608
807
|
enableRecordLinks: this.Config?.EnableRecordLinks,
|
|
609
808
|
showRelatedEntities: this.Config?.ShowRelatedEntities,
|
|
610
|
-
hiddenSectionKeys: this.
|
|
809
|
+
hiddenSectionKeys: this.resolveHiddenSectionKeys(),
|
|
611
810
|
visibleSectionKeys: this.Config?.VisibleSectionKeys,
|
|
612
811
|
allowSectionReorder: this.resolveAllowSectionReorder()
|
|
613
812
|
};
|
|
614
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* Config HiddenSectionKeys plus section keys winning contributions asked
|
|
816
|
+
* to hide (related-entity claims and `replacesSectionKey` field panels).
|
|
817
|
+
*/
|
|
818
|
+
resolveHiddenSectionKeys() {
|
|
819
|
+
const claimed = this.contributionHiddenSectionKeys();
|
|
820
|
+
const configured = this.Config?.HiddenSectionKeys;
|
|
821
|
+
if (claimed.length === 0)
|
|
822
|
+
return configured;
|
|
823
|
+
return [...(configured ?? []), ...claimed];
|
|
824
|
+
}
|
|
825
|
+
contributionHiddenSectionKeys() {
|
|
826
|
+
const entity = this.record?.EntityInfo;
|
|
827
|
+
if (!entity)
|
|
828
|
+
return [];
|
|
829
|
+
return ContributionHiddenSectionKeys(entity.Name, entity.RelatedEntities, entity.ChildEntities.map((child) => child.ID), CollectFormPanelRegistrations());
|
|
830
|
+
}
|
|
615
831
|
/**
|
|
616
832
|
* Resolves whether section drag-reorder is allowed for the current Config.
|
|
617
833
|
* When no toolbar is rendered (dialog/slide-in, `Config.Toolbar === null`)
|
|
@@ -680,10 +896,19 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
680
896
|
return section?.rowCount;
|
|
681
897
|
}
|
|
682
898
|
SetSectionRowCount(sectionKey, rowCount) {
|
|
683
|
-
|
|
684
|
-
if (section) {
|
|
899
|
+
let section = this.sectionMap.get(sectionKey);
|
|
900
|
+
if (!section) {
|
|
901
|
+
// Contribution panels use their own SectionKey (e.g. 'orders') which
|
|
902
|
+
// is never seeded by generated initSections(). Upsert so the left-nav
|
|
903
|
+
// rail badge can read the count the same way baked grids do.
|
|
904
|
+
section = new BaseFormSectionInfo(sectionKey, sectionKey, false, rowCount);
|
|
905
|
+
this.sections.push(section);
|
|
906
|
+
this.sectionMap.set(sectionKey, section);
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
685
909
|
section.rowCount = rowCount;
|
|
686
910
|
}
|
|
911
|
+
this.cdr.markForCheck();
|
|
687
912
|
}
|
|
688
913
|
GetSectionPanelHeight(sectionKey) {
|
|
689
914
|
const entityName = this.getEntityName();
|
|
@@ -828,6 +1053,24 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
828
1053
|
}
|
|
829
1054
|
return false;
|
|
830
1055
|
}
|
|
1056
|
+
getMoreSectionKeys() {
|
|
1057
|
+
const entityName = this.getEntityName();
|
|
1058
|
+
if (!entityName)
|
|
1059
|
+
return [];
|
|
1060
|
+
return this.formStateService.getMoreSectionKeys(entityName) ?? [];
|
|
1061
|
+
}
|
|
1062
|
+
getFirstClassSectionKeys() {
|
|
1063
|
+
const entityName = this.getEntityName();
|
|
1064
|
+
if (!entityName)
|
|
1065
|
+
return [];
|
|
1066
|
+
return this.formStateService.getFirstClassSectionKeys(entityName) ?? [];
|
|
1067
|
+
}
|
|
1068
|
+
setChromeMembership(moreSectionKeys, firstClassSectionKeys) {
|
|
1069
|
+
const entityName = this.getEntityName();
|
|
1070
|
+
if (entityName) {
|
|
1071
|
+
this.formStateService.setChromeMembership(entityName, moreSectionKeys, firstClassSectionKeys);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
831
1074
|
getSectionDisplayOrder(sectionKey) {
|
|
832
1075
|
const order = this.getSectionOrder();
|
|
833
1076
|
const index = order.indexOf(sectionKey);
|
|
@@ -900,7 +1143,7 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
900
1143
|
} if (rf & 2) {
|
|
901
1144
|
let _t;
|
|
902
1145
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.collapsiblePanels = _t);
|
|
903
|
-
} }, outputs: { Navigate: "Navigate", Notification: "Notification", RecordSaved: "RecordSaved", RecordDeleted: "RecordDeleted", RecordSaveFailed: "RecordSaveFailed", RecordDeleteFailed: "RecordDeleteFailed", ValidationFailed: "ValidationFailed", RecordReady: "RecordReady" }, features: [i0.ɵɵInheritDefinitionFeature] });
|
|
1146
|
+
} }, outputs: { Navigate: "Navigate", Notification: "Notification", RecordSaved: "RecordSaved", RecordRefreshed: "RecordRefreshed", RecordDeleted: "RecordDeleted", RecordSaveFailed: "RecordSaveFailed", RecordDeleteFailed: "RecordDeleteFailed", ValidationFailed: "ValidationFailed", RecordReady: "RecordReady" }, features: [i0.ɵɵInheritDefinitionFeature] });
|
|
904
1147
|
}
|
|
905
1148
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseFormComponent, [{
|
|
906
1149
|
type: Directive
|
|
@@ -910,6 +1153,8 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
910
1153
|
type: Output
|
|
911
1154
|
}], RecordSaved: [{
|
|
912
1155
|
type: Output
|
|
1156
|
+
}], RecordRefreshed: [{
|
|
1157
|
+
type: Output
|
|
913
1158
|
}], RecordDeleted: [{
|
|
914
1159
|
type: Output
|
|
915
1160
|
}], RecordSaveFailed: [{
|