@memberjunction/ng-base-forms 6.2.0-edge.2 → 6.2.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.
Files changed (188) hide show
  1. package/dist/lib/apply/form-placement-dialog.component.d.ts +266 -0
  2. package/dist/lib/apply/form-placement-dialog.component.d.ts.map +1 -0
  3. package/dist/lib/apply/form-placement-dialog.component.js +1522 -0
  4. package/dist/lib/apply/form-placement-dialog.component.js.map +1 -0
  5. package/dist/lib/apply/form-placement-order.d.ts +37 -0
  6. package/dist/lib/apply/form-placement-order.d.ts.map +1 -0
  7. package/dist/lib/apply/form-placement-order.js +111 -0
  8. package/dist/lib/apply/form-placement-order.js.map +1 -0
  9. package/dist/lib/apply/form-placement-preview.component.d.ts +112 -0
  10. package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -0
  11. package/dist/lib/apply/form-placement-preview.component.js +346 -0
  12. package/dist/lib/apply/form-placement-preview.component.js.map +1 -0
  13. package/dist/lib/apply/form-placement-text.d.ts +61 -0
  14. package/dist/lib/apply/form-placement-text.d.ts.map +1 -0
  15. package/dist/lib/apply/form-placement-text.js +279 -0
  16. package/dist/lib/apply/form-placement-text.js.map +1 -0
  17. package/dist/lib/apply/form-placement.d.ts +320 -0
  18. package/dist/lib/apply/form-placement.d.ts.map +1 -0
  19. package/dist/lib/apply/form-placement.js +432 -0
  20. package/dist/lib/apply/form-placement.js.map +1 -0
  21. package/dist/lib/apply/form-slot-probe.service.d.ts +121 -0
  22. package/dist/lib/apply/form-slot-probe.service.d.ts.map +1 -0
  23. package/dist/lib/apply/form-slot-probe.service.js +264 -0
  24. package/dist/lib/apply/form-slot-probe.service.js.map +1 -0
  25. package/dist/lib/base-form-component-internals.d.ts +11 -0
  26. package/dist/lib/base-form-component-internals.d.ts.map +1 -0
  27. package/dist/lib/base-form-component-internals.js +33 -0
  28. package/dist/lib/base-form-component-internals.js.map +1 -0
  29. package/dist/lib/base-form-component.d.ts +132 -1
  30. package/dist/lib/base-form-component.d.ts.map +1 -1
  31. package/dist/lib/base-form-component.js +228 -19
  32. package/dist/lib/base-form-component.js.map +1 -1
  33. package/dist/lib/chrome/form-chrome.d.ts +78 -0
  34. package/dist/lib/chrome/form-chrome.d.ts.map +1 -1
  35. package/dist/lib/chrome/form-chrome.js +128 -2
  36. package/dist/lib/chrome/form-chrome.js.map +1 -1
  37. package/dist/lib/chrome/form-composition-registry.d.ts +34 -0
  38. package/dist/lib/chrome/form-composition-registry.d.ts.map +1 -0
  39. package/dist/lib/chrome/form-composition-registry.js +56 -0
  40. package/dist/lib/chrome/form-composition-registry.js.map +1 -0
  41. package/dist/lib/chrome/form-composition-snapshot.d.ts +151 -0
  42. package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -0
  43. package/dist/lib/chrome/form-composition-snapshot.js +137 -0
  44. package/dist/lib/chrome/form-composition-snapshot.js.map +1 -0
  45. package/dist/lib/chrome/resolve-form-chrome.d.ts +15 -0
  46. package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
  47. package/dist/lib/chrome/resolve-form-chrome.js +31 -2
  48. package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
  49. package/dist/lib/container/record-form-container.component.d.ts +240 -5
  50. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  51. package/dist/lib/container/record-form-container.component.js +976 -249
  52. package/dist/lib/container/record-form-container.component.js.map +1 -1
  53. package/dist/lib/field/form-field.component.d.ts +17 -0
  54. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  55. package/dist/lib/field/form-field.component.js +41 -5
  56. package/dist/lib/field/form-field.component.js.map +1 -1
  57. package/dist/lib/form-state.service.d.ts +5 -0
  58. package/dist/lib/form-state.service.d.ts.map +1 -1
  59. package/dist/lib/form-state.service.js +6 -1
  60. package/dist/lib/form-state.service.js.map +1 -1
  61. package/dist/lib/host/entity-form-host.component.d.ts +16 -1
  62. package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
  63. package/dist/lib/host/entity-form-host.component.js +27 -6
  64. package/dist/lib/host/entity-form-host.component.js.map +1 -1
  65. package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts +24 -0
  66. package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts.map +1 -0
  67. package/dist/lib/interactive-form/form-panel-host-props.builder.js +99 -0
  68. package/dist/lib/interactive-form/form-panel-host-props.builder.js.map +1 -0
  69. package/dist/lib/interactive-form/interactive-form-panel.component.d.ts +109 -0
  70. package/dist/lib/interactive-form/interactive-form-panel.component.d.ts.map +1 -0
  71. package/dist/lib/interactive-form/interactive-form-panel.component.js +424 -0
  72. package/dist/lib/interactive-form/interactive-form-panel.component.js.map +1 -0
  73. package/dist/lib/interactive-form/interactive-form.component.d.ts +2 -0
  74. package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
  75. package/dist/lib/interactive-form/interactive-form.component.js +4 -5
  76. package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
  77. package/dist/lib/panel/collapsible-panel.component.d.ts +69 -1
  78. package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
  79. package/dist/lib/panel/collapsible-panel.component.js +148 -12
  80. package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
  81. package/dist/lib/panel-manager/form-audience.d.ts +46 -0
  82. package/dist/lib/panel-manager/form-audience.d.ts.map +1 -0
  83. package/dist/lib/panel-manager/form-audience.js +34 -0
  84. package/dist/lib/panel-manager/form-audience.js.map +1 -0
  85. package/dist/lib/panel-manager/form-panel-admin.service.d.ts +150 -0
  86. package/dist/lib/panel-manager/form-panel-admin.service.d.ts.map +1 -0
  87. package/dist/lib/panel-manager/form-panel-admin.service.js +433 -0
  88. package/dist/lib/panel-manager/form-panel-admin.service.js.map +1 -0
  89. package/dist/lib/panel-manager/form-panel-inventory.d.ts +255 -0
  90. package/dist/lib/panel-manager/form-panel-inventory.d.ts.map +1 -0
  91. package/dist/lib/panel-manager/form-panel-inventory.js +293 -0
  92. package/dist/lib/panel-manager/form-panel-inventory.js.map +1 -0
  93. package/dist/lib/panel-manager/panel-manager.component.d.ts +232 -0
  94. package/dist/lib/panel-manager/panel-manager.component.d.ts.map +1 -0
  95. package/dist/lib/panel-manager/panel-manager.component.js +1112 -0
  96. package/dist/lib/panel-manager/panel-manager.component.js.map +1 -0
  97. package/dist/lib/panel-slot/base-contribution-panel.d.ts +40 -0
  98. package/dist/lib/panel-slot/base-contribution-panel.d.ts.map +1 -0
  99. package/dist/lib/panel-slot/base-contribution-panel.js +55 -0
  100. package/dist/lib/panel-slot/base-contribution-panel.js.map +1 -0
  101. package/dist/lib/panel-slot/base-form-panel.d.ts +116 -8
  102. package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
  103. package/dist/lib/panel-slot/base-form-panel.js +76 -5
  104. package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
  105. package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts +29 -0
  106. package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts.map +1 -0
  107. package/dist/lib/panel-slot/collect-form-contribution-registrations.js +214 -0
  108. package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -0
  109. package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +6 -3
  110. package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -1
  111. package/dist/lib/panel-slot/collect-form-panel-registrations.js +8 -14
  112. package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -1
  113. package/dist/lib/panel-slot/form-contribution.d.ts +170 -7
  114. package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
  115. package/dist/lib/panel-slot/form-contribution.js +242 -64
  116. package/dist/lib/panel-slot/form-contribution.js.map +1 -1
  117. package/dist/lib/panel-slot/form-contributions.component.d.ts +16 -5
  118. package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -1
  119. package/dist/lib/panel-slot/form-contributions.component.js +43 -7
  120. package/dist/lib/panel-slot/form-contributions.component.js.map +1 -1
  121. package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts +66 -0
  122. package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -0
  123. package/dist/lib/panel-slot/form-field-panel-slot.component.js +190 -0
  124. package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -0
  125. package/dist/lib/panel-slot/form-panel-slot.component.d.ts +52 -16
  126. package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
  127. package/dist/lib/panel-slot/form-panel-slot.component.js +190 -66
  128. package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
  129. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +11 -0
  130. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
  131. package/dist/lib/panel-slot/form-slot-coordinator.service.js +17 -0
  132. package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
  133. package/dist/lib/panel-slot/merge-panel-validation.d.ts +7 -0
  134. package/dist/lib/panel-slot/merge-panel-validation.d.ts.map +1 -0
  135. package/dist/lib/panel-slot/merge-panel-validation.js +16 -0
  136. package/dist/lib/panel-slot/merge-panel-validation.js.map +1 -0
  137. package/dist/lib/panel-slot/mount-form-contribution.d.ts +15 -0
  138. package/dist/lib/panel-slot/mount-form-contribution.d.ts.map +1 -0
  139. package/dist/lib/panel-slot/mount-form-contribution.js +37 -0
  140. package/dist/lib/panel-slot/mount-form-contribution.js.map +1 -0
  141. package/dist/lib/panel-slot/panel-hides.d.ts +35 -0
  142. package/dist/lib/panel-slot/panel-hides.d.ts.map +1 -0
  143. package/dist/lib/panel-slot/panel-hides.js +111 -0
  144. package/dist/lib/panel-slot/panel-hides.js.map +1 -0
  145. package/dist/lib/panel-slot/placement-preview-panel.component.d.ts +16 -0
  146. package/dist/lib/panel-slot/placement-preview-panel.component.d.ts.map +1 -0
  147. package/dist/lib/panel-slot/placement-preview-panel.component.js +112 -0
  148. package/dist/lib/panel-slot/placement-preview-panel.component.js.map +1 -0
  149. package/dist/lib/panel-slot/placement-preview.d.ts +57 -0
  150. package/dist/lib/panel-slot/placement-preview.d.ts.map +1 -0
  151. package/dist/lib/panel-slot/placement-preview.js +86 -0
  152. package/dist/lib/panel-slot/placement-preview.js.map +1 -0
  153. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
  154. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
  155. package/dist/lib/panel-slot/related-entity-grid-panel.component.js +10 -3
  156. package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
  157. package/dist/lib/panel-slot/slot-order.d.ts +19 -0
  158. package/dist/lib/panel-slot/slot-order.d.ts.map +1 -0
  159. package/dist/lib/panel-slot/slot-order.js +53 -0
  160. package/dist/lib/panel-slot/slot-order.js.map +1 -0
  161. package/dist/lib/resolver/form-resolver.service.d.ts +4 -2
  162. package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
  163. package/dist/lib/resolver/form-resolver.service.js +18 -8
  164. package/dist/lib/resolver/form-resolver.service.js.map +1 -1
  165. package/dist/lib/resolver/form-variants.d.ts +28 -0
  166. package/dist/lib/resolver/form-variants.d.ts.map +1 -0
  167. package/dist/lib/resolver/form-variants.js +40 -0
  168. package/dist/lib/resolver/form-variants.js.map +1 -0
  169. package/dist/lib/section-counts/form-section-counts.d.ts +99 -0
  170. package/dist/lib/section-counts/form-section-counts.d.ts.map +1 -0
  171. package/dist/lib/section-counts/form-section-counts.js +223 -0
  172. package/dist/lib/section-counts/form-section-counts.js.map +1 -0
  173. package/dist/lib/toolbar/form-toolbar.component.d.ts +7 -0
  174. package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
  175. package/dist/lib/toolbar/form-toolbar.component.js +194 -128
  176. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  177. package/dist/lib/types/form-types.d.ts +8 -0
  178. package/dist/lib/types/form-types.d.ts.map +1 -1
  179. package/dist/lib/types/form-types.js.map +1 -1
  180. package/dist/module.d.ts +29 -23
  181. package/dist/module.d.ts.map +1 -1
  182. package/dist/module.js +43 -5
  183. package/dist/module.js.map +1 -1
  184. package/dist/public-api.d.ts +20 -0
  185. package/dist/public-api.d.ts.map +1 -1
  186. package/dist/public-api.js +21 -0
  187. package/dist/public-api.js.map +1 -1
  188. package/package.json +20 -20
@@ -0,0 +1,24 @@
1
+ import { type BaseEntity } from '@memberjunction/core';
2
+ import type { FormPanelHostProps } from '@memberjunction/interactive-component-types/forms';
3
+ import type { BaseFormComponent } from '../base-form-component';
4
+ import type { FormContributionRegistration } from '../panel-slot/form-contribution';
5
+ export interface BuildFormPanelHostPropsInput {
6
+ Record: BaseEntity;
7
+ /**
8
+ * Null when previewing outside a form (artifact viewer). Permissions then read false; a
9
+ * related claim still gets its view params, which come from the record.
10
+ */
11
+ FormComponent: BaseFormComponent | null;
12
+ Contribution: FormContributionRegistration;
13
+ SectionKey: string;
14
+ Layout: 'accordion' | 'left-nav';
15
+ IsExpanded: boolean;
16
+ }
17
+ /**
18
+ * Build `FormPanelHostProps` for a metadata contribution. Same record snapshot the
19
+ * whole-form host builds, plus the contribution context and — for related claims —
20
+ * prebuilt view params so the panel never hand-writes an FK filter. The view params come
21
+ * from the record and its relationships, so a preview with no form gets them too.
22
+ */
23
+ export declare function BuildFormPanelHostProps(input: BuildFormPanelHostPropsInput): FormPanelHostProps;
24
+ //# sourceMappingURL=form-panel-host-props.builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-panel-host-props.builder.d.ts","sourceRoot":"","sources":["../../../src/lib/interactive-form/form-panel-host-props.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,UAAU,EAAuC,MAAM,sBAAsB,CAAC;AAExG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAGpF,MAAM,WAAW,4BAA4B;IACzC,MAAM,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,4BAA4B,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;CACvB;AASD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,kBAAkB,CAkC/F"}
@@ -0,0 +1,99 @@
1
+ import { EntityInfo } from '@memberjunction/core';
2
+ import { SimpleEntityFieldInfo } from '@memberjunction/interactive-component-types';
3
+ import { StripJoinFieldBrackets } from '../panel-slot/form-contribution';
4
+ function primaryKeyToPlain(pk) {
5
+ if (!pk || !pk.HasValue)
6
+ return null;
7
+ const out = {};
8
+ for (const kvp of pk.KeyValuePairs ?? [])
9
+ out[kvp.FieldName] = kvp.Value;
10
+ return out;
11
+ }
12
+ /**
13
+ * Build `FormPanelHostProps` for a metadata contribution. Same record snapshot the
14
+ * whole-form host builds, plus the contribution context and — for related claims —
15
+ * prebuilt view params so the panel never hand-writes an FK filter. The view params come
16
+ * from the record and its relationships, so a preview with no form gets them too.
17
+ */
18
+ export function BuildFormPanelHostProps(input) {
19
+ const { Record: record, FormComponent: form, Contribution: contribution } = input;
20
+ const meta = contribution.Metadata;
21
+ const pk = record.PrimaryKey;
22
+ const primaryKey = primaryKeyToPlain(pk);
23
+ const mode = form?.EditMode ? 'edit' : (primaryKey ? 'view' : 'create');
24
+ const props = {
25
+ entityName: record.EntityInfo.Name,
26
+ primaryKey,
27
+ record: record.GetAll(),
28
+ entityMetadata: {
29
+ fields: record.Fields.map((f) => SimpleEntityFieldInfo.FromEntityFieldInfo(f.EntityFieldInfo)),
30
+ displayName: record.EntityInfo.DisplayName ?? record.EntityInfo.Name,
31
+ nameField: record.EntityInfo.NameField?.Name,
32
+ },
33
+ mode,
34
+ canEdit: form?.UserCanEdit ?? false,
35
+ canDelete: form?.UserCanDelete ?? false,
36
+ canCreate: form?.UserCanCreate ?? false,
37
+ contribution: {
38
+ key: input.SectionKey,
39
+ slot: meta.slot,
40
+ title: contribution.Title ?? meta.contributionKey ?? input.SectionKey,
41
+ presentation: contribution.Presentation ?? meta.presentation ?? 'panel',
42
+ configuration: contribution.Configuration ?? {},
43
+ },
44
+ isExpanded: input.IsExpanded,
45
+ layout: input.Layout,
46
+ };
47
+ const related = meta.relatedEntity?.trim();
48
+ if (related)
49
+ props.related = relatedPanelProps(record, related, StripJoinFieldBrackets(meta.relatedJoinField) || undefined);
50
+ return props;
51
+ }
52
+ /**
53
+ * The related-grid props of a claim on `relatedEntity`, from the record alone.
54
+ *
55
+ * The rows are those whose join field holds this record's key: the named join field, or with
56
+ * none named, every relationship to that entity (Bill-To OR Ship-To). New rows get the same
57
+ * fields set to the record's key. A record not saved yet has no key, so its filter matches
58
+ * nothing.
59
+ */
60
+ function relatedPanelProps(record, relatedEntity, joinField) {
61
+ const target = relatedEntity.toLowerCase();
62
+ const relationships = (record.EntityInfo.RelatedEntities ?? []).filter((r) => r.RelatedEntity.trim().toLowerCase() === target);
63
+ const joinFields = joinField ? [joinField] : relationships.map((r) => r.RelatedEntityJoinField);
64
+ const relationship = joinFields.length === 1
65
+ ? relationships.find((r) => r.RelatedEntityJoinField.trim().toLowerCase() === joinFields[0].trim().toLowerCase())
66
+ : undefined;
67
+ const viewParams = EntityInfo.BuildRelationshipViewParamsForJoinFields(record, relatedEntity, joinFields);
68
+ return {
69
+ entityName: relatedEntity,
70
+ joinField,
71
+ viewParams: {
72
+ EntityName: viewParams.EntityName ?? relatedEntity,
73
+ // RunView accepts `string | PlatformSQL`; the panel contract carries plain
74
+ // strings because these cross into React as JSON, so the fragment is flattened.
75
+ ExtraFilter: plainSQL(viewParams.ExtraFilter) ?? '',
76
+ OrderBy: plainSQL(viewParams.OrderBy),
77
+ },
78
+ newRecordValues: relationship
79
+ ? EntityInfo.BuildRelationshipNewRecordValues(record, relationship)
80
+ : EntityInfo.BuildRelationshipNewRecordValuesForJoinFields(record, joinFields),
81
+ };
82
+ }
83
+ /**
84
+ * Flatten a `string | PlatformSQL` fragment to the string the panel receives.
85
+ *
86
+ * A plain string passes through. For a `PlatformSQL` value the `sqlserver` variant is taken when
87
+ * present, else `default`: the same choice a browser-side provider makes, since it does not know
88
+ * the server's platform and `ProviderBase.PlatformKey` defaults to SQL Server. On a PostgreSQL
89
+ * server a fragment with a different `postgresql` variant would therefore be the wrong one. The
90
+ * relationship filters built here are plain strings.
91
+ */
92
+ function plainSQL(value) {
93
+ if (value === undefined || value === null)
94
+ return undefined;
95
+ if (typeof value === 'string')
96
+ return value;
97
+ return value.sqlserver ?? value.default;
98
+ }
99
+ //# sourceMappingURL=form-panel-host-props.builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-panel-host-props.builder.js","sourceRoot":"","sources":["../../../src/lib/interactive-form/form-panel-host-props.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwD,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAIpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAezE,SAAS,iBAAiB,CAAC,EAAmC;IAC1D,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,aAAa,IAAI,EAAE;QAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;IACzE,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAmC;IACvE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,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UAAU,CAAC,CAAC;IAC1G,OAAO;QACH,UAAU,EAAE,aAAa;QACzB,SAAS;QACT,UAAU,EAAE;YACR,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,aAAa;YAClD,2EAA2E;YAC3E,gFAAgF;YAChF,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE;YACnD,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;SACxC;QACD,eAAe,EAAE,YAAY;YACzB,CAAC,CAAC,UAAU,CAAC,gCAAgC,CAAC,MAAM,EAAE,YAAY,CAAC;YACnE,CAAC,CAAC,UAAU,CAAC,6CAA6C,CAAC,MAAM,EAAE,UAAU,CAAC;KACrF,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,QAAQ,CAAC,KAAuC;IACrD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC;AAC5C,CAAC","sourcesContent":["import { EntityInfo, type BaseEntity, type CompositeKey, type PlatformSQL } from '@memberjunction/core';\nimport { SimpleEntityFieldInfo } from '@memberjunction/interactive-component-types';\nimport type { FormPanelHostProps } from '@memberjunction/interactive-component-types/forms';\nimport type { BaseFormComponent } from '../base-form-component';\nimport type { FormContributionRegistration } from '../panel-slot/form-contribution';\nimport { StripJoinFieldBrackets } from '../panel-slot/form-contribution';\n\nexport interface BuildFormPanelHostPropsInput {\n Record: BaseEntity;\n /**\n * Null when previewing outside a form (artifact viewer). Permissions then read false; a\n * related claim still gets its view params, which come from the record.\n */\n FormComponent: BaseFormComponent | null;\n Contribution: FormContributionRegistration;\n SectionKey: string;\n Layout: 'accordion' | 'left-nav';\n IsExpanded: boolean;\n}\n\nfunction primaryKeyToPlain(pk: CompositeKey | null | undefined): Record<string, unknown> | null {\n if (!pk || !pk.HasValue) return null;\n const out: Record<string, unknown> = {};\n for (const kvp of pk.KeyValuePairs ?? []) out[kvp.FieldName] = kvp.Value;\n return out;\n}\n\n/**\n * Build `FormPanelHostProps` for a metadata contribution. Same record snapshot the\n * whole-form host builds, plus the contribution context and — for related claims —\n * prebuilt view params so the panel never hand-writes an FK filter. The view params come\n * from the record and its relationships, so a preview with no form gets them too.\n */\nexport function BuildFormPanelHostProps(input: BuildFormPanelHostPropsInput): FormPanelHostProps {\n const { Record: record, FormComponent: form, Contribution: contribution } = input;\n const meta = contribution.Metadata;\n const pk = record.PrimaryKey;\n const primaryKey = primaryKeyToPlain(pk);\n const mode: FormPanelHostProps['mode'] = form?.EditMode ? 'edit' : (primaryKey ? 'view' : 'create');\n\n const props: FormPanelHostProps = {\n entityName: record.EntityInfo.Name,\n primaryKey,\n record: record.GetAll(),\n entityMetadata: {\n fields: record.Fields.map((f) => SimpleEntityFieldInfo.FromEntityFieldInfo(f.EntityFieldInfo)),\n displayName: record.EntityInfo.DisplayName ?? record.EntityInfo.Name,\n nameField: record.EntityInfo.NameField?.Name,\n },\n mode,\n canEdit: form?.UserCanEdit ?? false,\n canDelete: form?.UserCanDelete ?? false,\n canCreate: form?.UserCanCreate ?? false,\n contribution: {\n key: input.SectionKey,\n slot: meta.slot,\n title: contribution.Title ?? meta.contributionKey ?? input.SectionKey,\n presentation: contribution.Presentation ?? meta.presentation ?? 'panel',\n configuration: contribution.Configuration ?? {},\n },\n isExpanded: input.IsExpanded,\n layout: input.Layout,\n };\n\n const related = meta.relatedEntity?.trim();\n if (related) props.related = relatedPanelProps(record, related, StripJoinFieldBrackets(meta.relatedJoinField) || undefined);\n return props;\n}\n\n/**\n * The related-grid props of a claim on `relatedEntity`, from the record alone.\n *\n * The rows are those whose join field holds this record's key: the named join field, or with\n * none named, every relationship to that entity (Bill-To OR Ship-To). New rows get the same\n * fields set to the record's key. A record not saved yet has no key, so its filter matches\n * nothing.\n */\nfunction relatedPanelProps(record: BaseEntity, relatedEntity: string, joinField: string | undefined): FormPanelHostProps['related'] {\n const target = relatedEntity.toLowerCase();\n const relationships = (record.EntityInfo.RelatedEntities ?? []).filter((r) => r.RelatedEntity.trim().toLowerCase() === target);\n const joinFields = joinField ? [joinField] : relationships.map((r) => r.RelatedEntityJoinField);\n const relationship = joinFields.length === 1\n ? relationships.find((r) => r.RelatedEntityJoinField.trim().toLowerCase() === joinFields[0].trim().toLowerCase())\n : undefined;\n const viewParams = EntityInfo.BuildRelationshipViewParamsForJoinFields(record, relatedEntity, joinFields);\n return {\n entityName: relatedEntity,\n joinField,\n viewParams: {\n EntityName: viewParams.EntityName ?? relatedEntity,\n // RunView accepts `string | PlatformSQL`; the panel contract carries plain\n // strings because these cross into React as JSON, so the fragment is flattened.\n ExtraFilter: plainSQL(viewParams.ExtraFilter) ?? '',\n OrderBy: plainSQL(viewParams.OrderBy),\n },\n newRecordValues: relationship\n ? EntityInfo.BuildRelationshipNewRecordValues(record, relationship)\n : EntityInfo.BuildRelationshipNewRecordValuesForJoinFields(record, joinFields),\n };\n}\n\n/**\n * Flatten a `string | PlatformSQL` fragment to the string the panel receives.\n *\n * A plain string passes through. For a `PlatformSQL` value the `sqlserver` variant is taken when\n * present, else `default`: the same choice a browser-side provider makes, since it does not know\n * the server's platform and `ProviderBase.PlatformKey` defaults to SQL Server. On a PostgreSQL\n * server a fragment with a different `postgresql` variant would therefore be the wrong one. The\n * relationship filters built here are plain strings.\n */\nfunction plainSQL(value: string | PlatformSQL | undefined): string | undefined {\n if (value === undefined || value === null) return undefined;\n if (typeof value === 'string') return value;\n return value.sqlserver ?? value.default;\n}\n"]}
@@ -0,0 +1,109 @@
1
+ import { DoCheck, OnDestroy, OnInit } from '@angular/core';
2
+ import { ValidationResult, type BaseEntity, type CompositeKey } from '@memberjunction/core';
3
+ import type { ComponentSpec } from '@memberjunction/interactive-component-types';
4
+ import { type FormPanelHostProps } from '@memberjunction/interactive-component-types/forms';
5
+ import { MJReactComponent, type ReactComponentEvent } from '@memberjunction/ng-react';
6
+ import { BaseContributionPanel } from '../panel-slot/base-contribution-panel';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Generic host for a metadata form contribution (`MJ: Entity Form Contributions` row →
10
+ * `componentRole: 'form-panel'` React component). Mounted by `<mj-form-panel-slot>` for
11
+ * `Source: 'metadata'` winners exactly where a compiled BaseFormPanel would mount.
12
+ *
13
+ * Layering: the React component never touches BaseEntity. This host owns the
14
+ * `FormPanelHostProps` snapshot and rebuilds it when the parent record's values change,
15
+ * applies `FieldChanged` to the PARENT record (only for the fields the contribution
16
+ * claims, and only in edit mode; the parent form's Save persists it), forwards
17
+ * `RowCountChanged` to the rail badge, and surfaces `Validate` through
18
+ * `BaseFormPanel.Validate()`.
19
+ */
20
+ export declare class InteractiveFormPanelComponent extends BaseContributionPanel implements OnInit, DoCheck, OnDestroy {
21
+ ReactComponent?: MJReactComponent;
22
+ componentSpec: ComponentSpec | null;
23
+ HostProps: FormPanelHostProps | null;
24
+ /**
25
+ * Load-time failure only: missing ComponentID, component not found, bad Specification
26
+ * JSON, wrong role. Shown in place of the React component.
27
+ */
28
+ loadError: string | null;
29
+ /**
30
+ * A failure after the React component loaded, shown above it: an `error` event from
31
+ * `<mj-react-component>` (initialization, render timeout, a throw its error boundary
32
+ * caught, or an `error` event the panel raises), or a `Validate` that threw. A throw during
33
+ * render stays inside this panel's subtree, so the rest of the form renders and saves
34
+ * normally.
35
+ *
36
+ * An `error` event stays until the panel is mounted again, and a `Validate` that throws
37
+ * does not replace it. A `Validate` failure clears when a later `Validate` answers.
38
+ */
39
+ RenderError: string | null;
40
+ /** Where {@link RenderError} came from, or null when it is empty. */
41
+ private renderErrorSource;
42
+ private lastValidation;
43
+ private lastEditMode;
44
+ private lastExpanded;
45
+ /** The record's field values when {@link HostProps} was last built, by field position. */
46
+ private shownValues;
47
+ private readonly cdr;
48
+ private readonly reactBridge;
49
+ /** The form's field-edit broadcast, which starts the entry-time duplicate check on a new record. */
50
+ private readonly fieldEdits;
51
+ /** Section identity — {@link ContributionSectionKey}, the key the rail files this panel by. */
52
+ get SectionKey(): string;
53
+ get Title(): string;
54
+ ngOnInit(): Promise<void>;
55
+ /**
56
+ * Edit mode, expanded state and the parent record's values are not inputs; detect their
57
+ * changes cheaply. A field the user edits elsewhere on the form reaches the panel this way.
58
+ */
59
+ ngDoCheck(): void;
60
+ ngOnDestroy(): void;
61
+ RebuildHostProps(): void;
62
+ OnReactComponentEvent(event: ReactComponentEvent): Promise<void>;
63
+ OnOpenEntityRecord(event: {
64
+ entityName: string;
65
+ key: CompositeKey;
66
+ }): void;
67
+ OnRecordRefreshed(record: BaseEntity): void;
68
+ /**
69
+ * Surface the panel's validity to the parent form's save.
70
+ *
71
+ * The React method may be `async` — any validator that checks something
72
+ * server-side will be — and `invokeMethod` returns whatever the method
73
+ * returned. Awaiting is therefore load-bearing: a synchronous `'isValid' in
74
+ * live` test sees a Promise, fails, silently falls back to the last cached
75
+ * `ValidationChanged` payload, and the form saves an invalid record with no
76
+ * error and no log. Resolving a non-Promise is a no-op, so one code path
77
+ * covers both shapes.
78
+ *
79
+ * A validator that throws or rejects does not block the save by itself. It is logged and
80
+ * shown in the panel ({@link RenderError}) unless the panel already shows an `error` event,
81
+ * and the result falls back to the last `ValidationChanged` state, so a failure the panel
82
+ * reported before still blocks.
83
+ */
84
+ Validate(): Promise<ValidationResult>;
85
+ /** The last state the panel reported through `ValidationChanged`; valid when it has reported none. */
86
+ LastKnownValidation(): ValidationResult;
87
+ private toValidationResult;
88
+ private setRenderError;
89
+ private isExpanded;
90
+ /** True when a field of the record no longer holds the value {@link HostProps} was built from. */
91
+ private recordValuesChanged;
92
+ /**
93
+ * Writes a panel's `FieldChanged` to the parent record: only a field the contribution claims
94
+ * (`replacesFieldNames`), and only while the form is in edit mode. Anything else is ignored
95
+ * and logged, so a panel cannot change a field the user did not hand it or edit a record the
96
+ * user is only viewing.
97
+ *
98
+ * A write the record refuses (a disabled or unreadable field) is logged and dropped. A write
99
+ * that succeeds is reported to {@link FormFieldEditCoordinator}, as an edit in
100
+ * `mj-form-field` is. Field validation and the `ValueChange` output of `mj-form-field` do not
101
+ * apply, because a claimed field is not drawn.
102
+ */
103
+ private applyFieldChange;
104
+ private invokeIfRegistered;
105
+ private loadSpec;
106
+ static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveFormPanelComponent, never>;
107
+ static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveFormPanelComponent, "mj-interactive-form-panel", never, {}, {}, never, never, false, never>;
108
+ }
109
+ //# sourceMappingURL=interactive-form-panel.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-form-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/interactive-form/interactive-form-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAY,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGtG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAIH,KAAK,kBAAkB,EAK1B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAsB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;;AAQ9E;;;;;;;;;;;GAWG;AACH,qBAKa,6BAA8B,SAAQ,qBAAsB,YAAW,MAAM,EAAE,OAAO,EAAE,SAAS;IACtE,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAE/D,aAAa,EAAE,aAAa,GAAG,IAAI,CAAQ;IAC3C,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAQ;IAEnD;;;OAGG;IACI,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEvC;;;;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