@memberjunction/ng-base-forms 6.2.0-edge.2 → 6.2.0-edge.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/apply/form-placement-dialog.component.d.ts +266 -0
- package/dist/lib/apply/form-placement-dialog.component.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-dialog.component.js +1522 -0
- package/dist/lib/apply/form-placement-dialog.component.js.map +1 -0
- package/dist/lib/apply/form-placement-order.d.ts +37 -0
- package/dist/lib/apply/form-placement-order.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-order.js +111 -0
- package/dist/lib/apply/form-placement-order.js.map +1 -0
- package/dist/lib/apply/form-placement-preview.component.d.ts +112 -0
- package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-preview.component.js +346 -0
- package/dist/lib/apply/form-placement-preview.component.js.map +1 -0
- package/dist/lib/apply/form-placement-text.d.ts +61 -0
- package/dist/lib/apply/form-placement-text.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-text.js +279 -0
- package/dist/lib/apply/form-placement-text.js.map +1 -0
- package/dist/lib/apply/form-placement.d.ts +320 -0
- package/dist/lib/apply/form-placement.d.ts.map +1 -0
- package/dist/lib/apply/form-placement.js +432 -0
- package/dist/lib/apply/form-placement.js.map +1 -0
- package/dist/lib/apply/form-slot-probe.service.d.ts +121 -0
- package/dist/lib/apply/form-slot-probe.service.d.ts.map +1 -0
- package/dist/lib/apply/form-slot-probe.service.js +264 -0
- package/dist/lib/apply/form-slot-probe.service.js.map +1 -0
- package/dist/lib/base-form-component-internals.d.ts +11 -0
- package/dist/lib/base-form-component-internals.d.ts.map +1 -0
- package/dist/lib/base-form-component-internals.js +33 -0
- package/dist/lib/base-form-component-internals.js.map +1 -0
- package/dist/lib/base-form-component.d.ts +132 -1
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +228 -19
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/chrome/form-chrome.d.ts +90 -0
- package/dist/lib/chrome/form-chrome.d.ts.map +1 -1
- package/dist/lib/chrome/form-chrome.js +142 -2
- package/dist/lib/chrome/form-chrome.js.map +1 -1
- package/dist/lib/chrome/form-composition-registry.d.ts +34 -0
- package/dist/lib/chrome/form-composition-registry.d.ts.map +1 -0
- package/dist/lib/chrome/form-composition-registry.js +56 -0
- package/dist/lib/chrome/form-composition-registry.js.map +1 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts +151 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -0
- package/dist/lib/chrome/form-composition-snapshot.js +137 -0
- package/dist/lib/chrome/form-composition-snapshot.js.map +1 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts +15 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
- package/dist/lib/chrome/resolve-form-chrome.js +31 -2
- package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +241 -5
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +977 -249
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +17 -0
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +41 -5
- package/dist/lib/field/form-field.component.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 +6 -1
- package/dist/lib/form-state.service.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +16 -1
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +27 -6
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts +24 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts.map +1 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.js +99 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.js.map +1 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.d.ts +109 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.d.ts.map +1 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.js +424 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.js.map +1 -0
- package/dist/lib/interactive-form/interactive-form.component.d.ts +2 -0
- package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.js +4 -5
- package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts +69 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.js +148 -12
- package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
- package/dist/lib/panel-manager/form-audience.d.ts +46 -0
- package/dist/lib/panel-manager/form-audience.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-audience.js +34 -0
- package/dist/lib/panel-manager/form-audience.js.map +1 -0
- package/dist/lib/panel-manager/form-panel-admin.service.d.ts +150 -0
- package/dist/lib/panel-manager/form-panel-admin.service.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-panel-admin.service.js +433 -0
- package/dist/lib/panel-manager/form-panel-admin.service.js.map +1 -0
- package/dist/lib/panel-manager/form-panel-inventory.d.ts +255 -0
- package/dist/lib/panel-manager/form-panel-inventory.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-panel-inventory.js +293 -0
- package/dist/lib/panel-manager/form-panel-inventory.js.map +1 -0
- package/dist/lib/panel-manager/panel-manager.component.d.ts +232 -0
- package/dist/lib/panel-manager/panel-manager.component.d.ts.map +1 -0
- package/dist/lib/panel-manager/panel-manager.component.js +1112 -0
- package/dist/lib/panel-manager/panel-manager.component.js.map +1 -0
- package/dist/lib/panel-slot/base-contribution-panel.d.ts +40 -0
- package/dist/lib/panel-slot/base-contribution-panel.d.ts.map +1 -0
- package/dist/lib/panel-slot/base-contribution-panel.js +55 -0
- package/dist/lib/panel-slot/base-contribution-panel.js.map +1 -0
- package/dist/lib/panel-slot/base-form-panel.d.ts +116 -8
- package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
- package/dist/lib/panel-slot/base-form-panel.js +76 -5
- package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
- package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts +29 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts.map +1 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js +214 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -0
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +6 -3
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -1
- package/dist/lib/panel-slot/collect-form-panel-registrations.js +8 -14
- package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -1
- package/dist/lib/panel-slot/form-contribution.d.ts +170 -7
- package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-contribution.js +245 -71
- package/dist/lib/panel-slot/form-contribution.js.map +1 -1
- package/dist/lib/panel-slot/form-contributions.component.d.ts +16 -5
- package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-contributions.component.js +43 -7
- package/dist/lib/panel-slot/form-contributions.component.js.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts +66 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.js +190 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -0
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts +52 -16
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +190 -66
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +11 -0
- package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-slot-coordinator.service.js +17 -0
- package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
- package/dist/lib/panel-slot/merge-panel-validation.d.ts +7 -0
- package/dist/lib/panel-slot/merge-panel-validation.d.ts.map +1 -0
- package/dist/lib/panel-slot/merge-panel-validation.js +16 -0
- package/dist/lib/panel-slot/merge-panel-validation.js.map +1 -0
- package/dist/lib/panel-slot/mount-form-contribution.d.ts +15 -0
- package/dist/lib/panel-slot/mount-form-contribution.d.ts.map +1 -0
- package/dist/lib/panel-slot/mount-form-contribution.js +37 -0
- package/dist/lib/panel-slot/mount-form-contribution.js.map +1 -0
- package/dist/lib/panel-slot/panel-hides.d.ts +35 -0
- package/dist/lib/panel-slot/panel-hides.d.ts.map +1 -0
- package/dist/lib/panel-slot/panel-hides.js +111 -0
- package/dist/lib/panel-slot/panel-hides.js.map +1 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.d.ts +16 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.js +112 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.js.map +1 -0
- package/dist/lib/panel-slot/placement-preview.d.ts +57 -0
- package/dist/lib/panel-slot/placement-preview.d.ts.map +1 -0
- package/dist/lib/panel-slot/placement-preview.js +86 -0
- package/dist/lib/panel-slot/placement-preview.js.map +1 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js +10 -3
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
- package/dist/lib/panel-slot/slot-order.d.ts +19 -0
- package/dist/lib/panel-slot/slot-order.d.ts.map +1 -0
- package/dist/lib/panel-slot/slot-order.js +53 -0
- package/dist/lib/panel-slot/slot-order.js.map +1 -0
- package/dist/lib/resolver/form-resolver.service.d.ts +4 -2
- package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
- package/dist/lib/resolver/form-resolver.service.js +18 -8
- package/dist/lib/resolver/form-resolver.service.js.map +1 -1
- package/dist/lib/resolver/form-variants.d.ts +28 -0
- package/dist/lib/resolver/form-variants.d.ts.map +1 -0
- package/dist/lib/resolver/form-variants.js +40 -0
- package/dist/lib/resolver/form-variants.js.map +1 -0
- package/dist/lib/section-counts/form-section-counts.d.ts +99 -0
- package/dist/lib/section-counts/form-section-counts.d.ts.map +1 -0
- package/dist/lib/section-counts/form-section-counts.js +223 -0
- package/dist/lib/section-counts/form-section-counts.js.map +1 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts +7 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +194 -128
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- 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/module.d.ts +29 -23
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +43 -5
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +20 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +21 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-contribution.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAqDnE,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,SAAoC;IACvE,OAAO,CAAC,SAAS,IAAI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BAAsB,CAAC,GAAG,CAAC,sBAAsB,CAAC,KAAK,MAAM,CAAC,gBAAgB,CAAC;QAC1F,CAAC,CAAC,CAAC;QACH,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,yBAAyB,CACrC,UAAkB,EAClB,eAAwD,EACxD,iBAAoC,EACpC,aAAsD;IAEtD,OAAO,6BAA6B,CAAC,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AACxG,CAAC","sourcesContent":["/**\n * Form contributions — pure resolve of what should appear on an entity form.\n *\n * A contribution is either a registered BaseFormPanel or the stock related-entity\n * grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory\n * — the host queries registrations and feeds this.\n *\n * Section keys for related panels MUST match CodeGen's camelCase\n * (`angular-codegen.ts` `camelCase` + related-entity sectionKey). If they drift,\n * hide-baked and skip-baked miss and the user sees a double grid.\n */\nimport { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';\nimport { FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';\n\n/** Minimum relationship shape the composer reads. Satisfied by EntityRelationshipInfo. */\nexport interface FormContributionRelationship {\n RelatedEntity: string;\n RelatedEntityID: string;\n RelatedEntityJoinField: string;\n DisplayInForm: boolean;\n DisplayName?: string | null;\n Sequence?: number | null;\n}\n\nexport interface FormContributionRegistration {\n Priority: number;\n Metadata: FormPanelRegistrationMetadata;\n}\n\nexport interface ResolveFormContributionsInput {\n EntityName: string;\n RelatedEntities: readonly FormContributionRelationship[];\n /** IS-A child entity IDs — CodeGen skips these (shown in the ISA side panel). */\n IsaChildEntityIDs: readonly string[];\n Registrations: readonly FormContributionRegistration[];\n /** SectionKeys already projected as Variant=\"related-entity\" in the form template. */\n BakedSectionKeys: readonly string[];\n ShowRelatedEntities: boolean;\n}\n\nexport type FormContributionKind = 'registered' | 'stock-grid';\n\nexport interface FormContributionWinner {\n ContributionKey: string;\n Slot: FormPanelSlot;\n SortKey: number;\n Priority: number;\n Kind: FormContributionKind;\n RelatedEntity?: string;\n RelatedJoinField?: string;\n /** Field/other section this registered winner asked to hide. */\n ReplacesSectionKey?: string;\n BakedSectionKey: string;\n DisplayName: string;\n}\n\nexport interface ResolveFormContributionsResult {\n Winners: FormContributionWinner[];\n /** CodeGen section keys to hide because a registered panel claimed them. */\n HiddenBakedSectionKeys: string[];\n /** Stock grids the host should mount (unclaimed and not already baked). */\n StockGrids: FormContributionWinner[];\n}\n\n/** Strip wrapping [] from a join field, matching CodeGen's tab-name helper. */\nexport function StripJoinFieldBrackets(joinField: string | null | undefined): string {\n return (joinField ?? '').trim().replace(/^\\[/, '').replace(/\\]$/, '');\n}\n\n/**\n * camelCase + identifier sanitize. Byte-compatible with\n * `CodeGenLib` `angular-codegen.ts` `camelCase` — do not \"improve\".\n */\nexport function FormSectionCamelCase(str: string): string {\n const sanitized = str.replace(/[^a-zA-Z0-9\\s]/g, ' ');\n let result = sanitized\n .replace(/\\s(.)/g, (_match, char: string) => char.toUpperCase())\n .replace(/\\s/g, '')\n .replace(/^(.)/, (_match, char: string) => char.toLowerCase());\n if (/^\\d/.test(result)) {\n result = '_' + result;\n }\n return result.length === 0 ? 'section' : result;\n}\n\nexport function RelatedContributionKey(relatedEntity: string, joinField?: string | null): string {\n return `related:${relatedEntity.trim()}:${StripJoinFieldBrackets(joinField)}`;\n}\n\nexport function ResolveContributionKey(meta: FormPanelRegistrationMetadata): string {\n if (meta.contributionKey && meta.contributionKey.trim().length > 0) {\n return meta.contributionKey.trim();\n }\n if (meta.relatedEntity && meta.relatedEntity.trim().length > 0) {\n return RelatedContributionKey(meta.relatedEntity, meta.relatedJoinField);\n }\n return '';\n}\n\n/**\n * SectionKey CodeGen emits for a related-entity panel. When more than one\n * DisplayInForm relationship points at the same entity, the join field is\n * appended so BillTo / ShipTo do not collide.\n */\nexport function RelatedEntitySectionKey(\n relationship: FormContributionRelationship,\n displayInFormPeers: readonly FormContributionRelationship[],\n): string {\n // Normalize the target once and stop at the second match. UUIDsEqual's `===` fast path\n // misses on every peer that points elsewhere, so a filter over UUIDsEqual lowercases both\n // sides of every comparison. To key many relationships against the same peers, use\n // CreateRelatedEntitySectionKeyResolver instead.\n const target = NormalizeUUID(relationship.RelatedEntityID);\n let sameEntityCount = 0;\n for (const peer of displayInFormPeers) {\n if (NormalizeUUID(peer.RelatedEntityID) === target && ++sameEntityCount > 1) break;\n }\n return relatedSectionKey(relationship, sameEntityCount > 1);\n}\n\nfunction relatedSectionKey(relationship: FormContributionRelationship, sharesRelatedEntity: boolean): string {\n if (sharesRelatedEntity) {\n return FormSectionCamelCase(\n `${relationship.RelatedEntity} ${StripJoinFieldBrackets(relationship.RelatedEntityJoinField)}`,\n );\n }\n return FormSectionCamelCase(relationship.RelatedEntity);\n}\n\n/**\n * Builds a function that returns {@link RelatedEntitySectionKey}`(relationship, displayInFormPeers)`\n * for any relationship, against the ONE peer set passed here. Build it once per peer set, then\n * call it once per relationship. The relationship does not have to be in the peer set; it is keyed\n * by how many peers share its related entity.\n *\n * Building counts each related entity once, so keying all n peers is O(n). Calling\n * RelatedEntitySectionKey per peer is O(n²), which on an entity with ~150 DisplayInForm\n * relationships (MJ: Users), resolved on every change-detection pass, pegged a CPU core.\n * The returned function reflects the peers as they were when it was built.\n */\nexport function CreateRelatedEntitySectionKeyResolver(\n displayInFormPeers: readonly FormContributionRelationship[],\n): (relationship: FormContributionRelationship) => string {\n const countByEntityID = new Map<string, number>();\n for (const peer of displayInFormPeers) {\n const id = NormalizeUUID(peer.RelatedEntityID);\n countByEntityID.set(id, (countByEntityID.get(id) ?? 0) + 1);\n }\n return (relationship) =>\n relatedSectionKey(relationship, (countByEntityID.get(NormalizeUUID(relationship.RelatedEntityID)) ?? 0) > 1);\n}\n\nexport function RelationshipDisplayName(relationship: FormContributionRelationship): string {\n const named = relationship.DisplayName?.trim();\n const raw = named && named.length > 0 ? named : relationship.RelatedEntity;\n return raw.replace(/^[A-Za-z][A-Za-z0-9_]*:\\s+/, '').trim() || raw;\n}\n\nfunction isIsaChild(relationship: FormContributionRelationship, isaChildIds: readonly string[]): boolean {\n return isaChildIds.some((id) => UUIDsEqual(id, relationship.RelatedEntityID));\n}\n\nfunction visibleRelationships(\n related: readonly FormContributionRelationship[],\n isaChildIds: readonly string[],\n): FormContributionRelationship[] {\n const visible = related.filter((rel) => rel.DisplayInForm && !isIsaChild(rel, isaChildIds));\n return [...visible].sort((a, b) => {\n const aSeq = a.Sequence ?? 999999;\n const bSeq = b.Sequence ?? 999999;\n if (aSeq !== bSeq) return aSeq - bSeq;\n return a.RelatedEntity.localeCompare(b.RelatedEntity);\n });\n}\n\nfunction entityMatches(registeredEntity: string, formEntity: string): boolean {\n return registeredEntity === '*' || registeredEntity === formEntity;\n}\n\nfunction applicableRegistrations(\n entityName: string,\n registrations: readonly FormContributionRegistration[],\n): FormContributionRegistration[] {\n return registrations.filter((reg) => {\n const entity = reg.Metadata.entity;\n if (!entity || !entityMatches(entity, entityName)) return false;\n // A related claim on entity:'*' would hide that grid on every form.\n // Claims must name the form entity.\n // Related / field-section claims on entity:'*' would hide panels on every\n // form. Those claims must name the form entity.\n if ((reg.Metadata.relatedEntity || reg.Metadata.replacesSectionKey) && entity === '*') {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Last-wins collapse by contributionKey (or derived related key).\n * Highest Priority keeps the slot. Registrations without a key never collapse.\n */\nexport function CollapseFormPanelRegistrations<T extends { Priority: number; Metadata: FormPanelRegistrationMetadata }>(\n registrations: readonly T[],\n): T[] {\n const winners = new Map<string, T>();\n let uniqueIndex = 0;\n for (const reg of registrations) {\n const key = ResolveContributionKey(reg.Metadata) || `__unique:${uniqueIndex++}`;\n const incumbent = winners.get(key);\n if (!incumbent || reg.Priority > incumbent.Priority) {\n winners.set(key, reg);\n }\n }\n return [...winners.values()];\n}\n\nfunction collapseRegistrations(\n registrations: readonly FormContributionRegistration[],\n): Map<string, FormContributionRegistration> {\n const winners = new Map<string, FormContributionRegistration>();\n for (const reg of CollapseFormPanelRegistrations(registrations)) {\n const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;\n winners.set(key, reg);\n }\n return winners;\n}\n\nfunction stockWinner(relationship: FormContributionRelationship, sectionKey: string): FormContributionWinner {\n const join = StripJoinFieldBrackets(relationship.RelatedEntityJoinField);\n return {\n ContributionKey: RelatedContributionKey(relationship.RelatedEntity, join),\n Slot: 'after-related',\n SortKey: -(relationship.Sequence ?? 0),\n Priority: 0,\n Kind: 'stock-grid',\n RelatedEntity: relationship.RelatedEntity,\n RelatedJoinField: join,\n BakedSectionKey: sectionKey,\n DisplayName: RelationshipDisplayName(relationship),\n };\n}\n\nfunction registeredWinner(\n key: string,\n reg: FormContributionRegistration,\n sectionKey: string,\n displayName: string,\n): FormContributionWinner {\n const meta = reg.Metadata;\n return {\n ContributionKey: key,\n Slot: meta.slot,\n SortKey: meta.sortKey ?? 0,\n Priority: reg.Priority,\n Kind: 'registered',\n RelatedEntity: meta.relatedEntity,\n RelatedJoinField: meta.relatedJoinField ? StripJoinFieldBrackets(meta.relatedJoinField) : undefined,\n ReplacesSectionKey: meta.replacesSectionKey?.trim() || undefined,\n BakedSectionKey: sectionKey,\n DisplayName: displayName,\n };\n}\n\nfunction sortWinners(winners: FormContributionWinner[]): FormContributionWinner[] {\n return [...winners].sort((a, b) => {\n if (a.SortKey !== b.SortKey) return b.SortKey - a.SortKey;\n if (a.Priority !== b.Priority) return b.Priority - a.Priority;\n return a.ContributionKey.localeCompare(b.ContributionKey);\n });\n}\n\n/**\n * Resolve what belongs on the form. Stock grids are only those the template\n * did not already bake and that no panel claimed.\n */\nexport function ResolveFormContributions(input: ResolveFormContributionsInput): ResolveFormContributionsResult {\n const peers = visibleRelationships(input.RelatedEntities, input.IsaChildEntityIDs);\n const collapsed = collapseRegistrations(applicableRegistrations(input.EntityName, input.Registrations));\n const baked = new Set(input.BakedSectionKeys);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);\n\n const claimedKeys = new Set<string>();\n const registered: FormContributionWinner[] = [];\n for (const [key, reg] of collapsed) {\n const related = reg.Metadata.relatedEntity?.trim();\n const peer = related\n ? peers.find((rel) => {\n if (rel.RelatedEntity !== related) return false;\n const wantJoin = StripJoinFieldBrackets(reg.Metadata.relatedJoinField);\n if (!wantJoin) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === wantJoin;\n })\n : undefined;\n const sectionKey = peer ? sectionKeyOf(peer) : '';\n if (related) {\n claimedKeys.add(key);\n // A claim that omits the join field covers every FK to that entity.\n if (!StripJoinFieldBrackets(reg.Metadata.relatedJoinField)) {\n for (const match of peers.filter((rel) => rel.RelatedEntity === related)) {\n claimedKeys.add(RelatedContributionKey(match.RelatedEntity, match.RelatedEntityJoinField));\n }\n }\n }\n registered.push(\n registeredWinner(key, reg, sectionKey, peer ? RelationshipDisplayName(peer) : related ?? key),\n );\n }\n\n const hiddenBaked: string[] = [];\n const stock: FormContributionWinner[] = [];\n if (input.ShowRelatedEntities) {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = sectionKeyOf(rel);\n if (claimedKeys.has(key)) {\n if (baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n continue;\n }\n if (baked.has(sectionKey)) continue;\n stock.push(stockWinner(rel, sectionKey));\n }\n } else {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = sectionKeyOf(rel);\n if (claimedKeys.has(key) && baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n }\n }\n\n return {\n Winners: sortWinners([...registered, ...stock]),\n HiddenBakedSectionKeys: hiddenBaked,\n StockGrids: sortWinners(stock),\n };\n}\n\n/** Section keys a form should hide because a winning contribution claimed them. */\nexport function ContributionHiddenSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n const resolved = ResolveFormContributions({\n EntityName: entityName,\n RelatedEntities: relatedEntities,\n IsaChildEntityIDs: isaChildEntityIDs,\n Registrations: registrations,\n BakedSectionKeys: [],\n ShowRelatedEntities: true,\n });\n const peers = visibleRelationships(relatedEntities, isaChildEntityIDs);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);\n const keys: string[] = [];\n for (const winner of resolved.Winners) {\n if (winner.Kind !== 'registered') continue;\n if (winner.ReplacesSectionKey) keys.push(winner.ReplacesSectionKey);\n if (!winner.RelatedEntity) continue;\n const peer = peers.find((rel) => {\n if (rel.RelatedEntity !== winner.RelatedEntity) return false;\n if (!winner.RelatedJoinField) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === winner.RelatedJoinField;\n });\n if (peer) keys.push(sectionKeyOf(peer));\n }\n return keys;\n}\n\n/** @deprecated Use {@link ContributionHiddenSectionKeys}. */\nexport function ClaimedRelatedSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n return ContributionHiddenSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form-contribution.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"AAcA,OAAO,EACH,8BAA8B,EAC9B,oBAAoB,IAAI,0BAA0B,EAClD,sBAAsB,IAAI,4BAA4B,EACtD,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,IAAI,4BAA4B,GAEzD,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAuC,MA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ACtB,eAAe,EAAE,eAAe;QAChC,iBAAiB,EAAE,iBAAiB;QACpC,aAAa,EAAE,aAAa;QAC5B,gBAAgB,EAAE,EAAE;QACpB,mBAAmB,EAAE,IAAI;KAC5B,CAAC,CAAC;IACH,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY;YAAE,SAAS;QAC3C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,kBAAkB,IAAI,EAAE,EAAE,CAAC;YACjD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACpC,OAAqB,EACrB,WAA8B;IAE9B,OAAO,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAQ,CAAC;AAC7D,CAAC","sourcesContent":["/**\n * Form contributions — pure resolve of what should appear on an entity form.\n *\n * A contribution is either a registered BaseFormPanel or the stock related-entity\n * grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory\n * — the host queries registrations and feeds this.\n *\n * Contribution keys and section keys come from the shared key module in\n * `@memberjunction/interactive-component-types/forms`, which the server actions use too.\n * Section keys for related panels match CodeGen's camelCase (`angular-codegen.ts`), so\n * hide-baked and skip-baked find the grid CodeGen emitted.\n */\nimport type { ClassRegistration } from '@memberjunction/global';\nimport type { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport {\n DEFAULT_FORM_CONTRIBUTION_SLOT,\n FormSectionCamelCase as SharedFormSectionCamelCase,\n RelatedContributionKey as SharedRelatedContributionKey,\n RelatedGridSectionKey,\n ResolveContributionWriteKey,\n StripJoinFieldBrackets as SharedStripJoinFieldBrackets,\n type FormContributionSpec,\n} from '@memberjunction/interactive-component-types/forms';\nimport { CountByUUID, NormalizeUUID, UUIDsEqual } from '@memberjunction/global';\nimport { FormContributionOutranks, type MJEntityFormContributionEntity } from '@memberjunction/core-entities';\nimport { FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';\n\n/** Minimum relationship shape the composer reads. Satisfied by EntityRelationshipInfo. */\nexport interface FormContributionRelationship {\n RelatedEntity: string;\n RelatedEntityID: string;\n RelatedEntityJoinField: string;\n DisplayInForm: boolean;\n DisplayName?: string | null;\n Sequence?: number | null;\n}\n\n/** Which of the two registration sources produced a contribution. */\nexport type FormContributionRegistrationSource = 'class' | 'metadata';\n\nexport interface FormContributionRegistration {\n /**\n * Rank within a `contributionKey` group, higher wins. For `'class'` registrations this\n * is the ClassFactory registration priority; for `'metadata'` rows it is the row's\n * `Precedence` column. Both mean the same thing here — higher wins — which is why one\n * field carries both.\n */\n Priority: number;\n Metadata: FormPanelRegistrationMetadata;\n\n /** Omitted on legacy call sites, which are all compiled registrations. */\n Source?: FormContributionRegistrationSource;\n\n /** `MJ: Components.ID` the panel renders — metadata rows only. */\n ComponentID?: string;\n\n /** Parsed `Configuration` JSON for metadata rows. */\n Configuration?: Record<string, unknown>;\n\n Title?: string;\n Icon?: string;\n Presentation?: 'panel' | 'bare';\n\n /** `MJ: Entity Form Contributions.ID` for metadata rows. */\n RowID?: string;\n\n /**\n * Who a metadata row is for. Absent on compiled registrations, which apply to everyone the\n * code puts them in front of. A `User` row a user can see is necessarily their own — the\n * collector only returns personal rows for the current user.\n */\n Scope?: MJEntityFormContributionEntity['Scope'];\n\n /** The ClassFactory registration for compiled panels — carries the component constructor. */\n Registration?: ClassRegistration;\n\n /**\n * A panel the placement dialog is showing before it is saved. It draws its component when\n * it carries one, else a placeholder. Only a form inside the dialog's preview sees one.\n */\n IsPreview?: boolean;\n\n /**\n * The component to render when it has not been saved yet, so there is no `ComponentID` to\n * load. Only the placement preview sets it.\n */\n ComponentSpec?: ComponentSpec;\n}\n\nexport interface ResolveFormContributionsInput {\n EntityName: string;\n RelatedEntities: readonly FormContributionRelationship[];\n /** IS-A child entity IDs — CodeGen skips these (shown in the ISA side panel). */\n IsaChildEntityIDs: readonly string[];\n Registrations: readonly FormContributionRegistration[];\n /** SectionKeys already projected as Variant=\"related-entity\" in the form template. */\n BakedSectionKeys: readonly string[];\n ShowRelatedEntities: boolean;\n}\n\nexport type FormContributionKind = 'registered' | 'stock-grid';\n\nexport interface FormContributionWinner {\n ContributionKey: string;\n Slot: FormPanelSlot;\n SortKey: number;\n Priority: number;\n Kind: FormContributionKind;\n RelatedEntity?: string;\n RelatedJoinField?: string;\n /** Field/other section this registered winner asked to hide. */\n ReplacesSectionKey?: string;\n /** Fields this registered winner stands in for, so they are not drawn. */\n ReplacesFieldNames?: readonly string[];\n /** Further sections this registered winner stands in for, beyond `ReplacesSectionKey`. */\n ReplacesSectionKeys?: readonly string[];\n BakedSectionKey: string;\n DisplayName: string;\n\n /** Carried through from the registration so consumers can tell the two sources apart. */\n Source?: FormContributionRegistrationSource;\n ComponentID?: string;\n Title?: string;\n Presentation?: 'panel' | 'bare';\n}\n\nexport interface ResolveFormContributionsResult {\n Winners: FormContributionWinner[];\n /** CodeGen section keys to hide because a registered panel claimed them. */\n HiddenBakedSectionKeys: string[];\n /** Stock grids the host should mount (unclaimed and not already baked). */\n StockGrids: FormContributionWinner[];\n}\n\n/** Strip wrapping [] from a join field. Uses the shared `StripJoinFieldBrackets`. */\nexport function StripJoinFieldBrackets(joinField: string | null | undefined): string {\n return SharedStripJoinFieldBrackets(joinField);\n}\n\n/** camelCase + identifier sanitize, as CodeGen names sections. Uses the shared `FormSectionCamelCase`. */\nexport function FormSectionCamelCase(str: string): string {\n return SharedFormSectionCamelCase(str);\n}\n\n/** `related:<entity>:<join>`. Uses the shared `RelatedContributionKey`. */\nexport function RelatedContributionKey(relatedEntity: string, joinField?: string | null): string {\n return SharedRelatedContributionKey(relatedEntity, joinField);\n}\n\n/**\n * The key a registration collapses by: its own key, else the derived related key. Empty for a\n * registration with neither, which never collapses. Uses the shared `ResolveContributionWriteKey`.\n */\nexport function ResolveContributionKey(meta: FormPanelRegistrationMetadata): string {\n return ResolveContributionWriteKey(meta, meta.relatedEntity ?? null) ?? '';\n}\n\n/**\n * The section key a registration's panel draws under, which the rail, the counts and the chrome\n * group file it by.\n *\n * A row's panel draws under its contribution key ({@link ResolveContributionKey}), or\n * `contribution:<row id>` when it has none. A compiled panel's template names its own section; by\n * convention that is its `contributionKey`, or for a grid claim with no key, the related entity's\n * name after its schema prefix, in camelCase. Empty for a compiled panel with neither.\n */\nexport function ContributionSectionKey(registration: FormContributionRegistration): string {\n const meta = registration.Metadata;\n if (registration.Source === 'metadata') {\n return ResolveContributionKey(meta) || `contribution:${registration.RowID ?? registration.ComponentID ?? 'unknown'}`;\n }\n const own = meta.contributionKey?.trim();\n if (own) return own;\n // The key compiled panel templates use (`contactMethods`), not the generated-form grid key.\n const entityName = meta.relatedEntity?.split(':').pop()?.trim();\n return entityName ? FormSectionCamelCase(entityName) : '';\n}\n\n/**\n * A contribution spec as a registration: the one mapping for a saved row, the placement preview\n * and the artifact viewer's preview. Ranked 0 and keyed only by the spec's own key; a caller that\n * knows more (a row's precedence, a preview's derived key) sets it on the result.\n */\nexport function ContributionSpecToRegistration(\n entityName: string,\n spec: FormContributionSpec,\n componentID?: string,\n): FormContributionRegistration {\n const metadata: FormPanelRegistrationMetadata = {\n entity: entityName,\n slot: spec.slot ?? DEFAULT_FORM_CONTRIBUTION_SLOT,\n sortKey: spec.sortKey ?? 0,\n presentation: spec.presentation,\n };\n if (spec.contributionKey) metadata.contributionKey = spec.contributionKey;\n if (spec.relatedEntity) metadata.relatedEntity = spec.relatedEntity;\n if (spec.relatedJoinField) metadata.relatedJoinField = spec.relatedJoinField;\n if (spec.replacesSectionKey) metadata.replacesSectionKey = spec.replacesSectionKey;\n if (spec.replacesFieldNames?.length) metadata.replacesFieldNames = [...spec.replacesFieldNames];\n if (spec.replacesSectionKeys?.length) metadata.replacesSectionKeys = [...spec.replacesSectionKeys];\n if (spec.inSectionKey) metadata.inSectionKey = spec.inSectionKey;\n if (spec.sectionPosition) metadata.sectionPosition = spec.sectionPosition;\n if (spec.inclusion) metadata.inclusion = spec.inclusion;\n if (spec.chromeGroup) metadata.chromeGroup = spec.chromeGroup;\n const registration: FormContributionRegistration = {\n Priority: 0,\n Metadata: metadata,\n Source: 'metadata',\n Title: spec.title,\n Icon: spec.icon,\n Presentation: spec.presentation,\n Configuration: spec.configuration ?? {},\n };\n if (componentID) registration.ComponentID = componentID;\n return registration;\n}\n\n/**\n * SectionKey CodeGen emits for a related-entity panel. When more than one\n * DisplayInForm relationship points at the same entity, the join field is\n * appended so BillTo / ShipTo do not collide.\n */\nexport function RelatedEntitySectionKey(\n relationship: FormContributionRelationship,\n displayInFormPeers: readonly FormContributionRelationship[],\n): string {\n // Normalize the target once and stop at the second match. UUIDsEqual's `===` fast path\n // misses on every peer that points elsewhere, so a filter over UUIDsEqual lowercases both\n // sides of every comparison. To key many relationships against the same peers, use\n // CreateRelatedEntitySectionKeyResolver instead.\n const target = NormalizeUUID(relationship.RelatedEntityID);\n let sameEntityCount = 0;\n for (const peer of displayInFormPeers) {\n if (NormalizeUUID(peer.RelatedEntityID) === target && ++sameEntityCount > 1) break;\n }\n return relatedSectionKey(relationship, sameEntityCount > 1);\n}\n\nfunction relatedSectionKey(relationship: FormContributionRelationship, sharesRelatedEntity: boolean): string {\n return RelatedGridSectionKey(relationship.RelatedEntity, relationship.RelatedEntityJoinField, sharesRelatedEntity);\n}\n\n/**\n * Builds a function that returns {@link RelatedEntitySectionKey}`(relationship, displayInFormPeers)`\n * for any relationship, against the ONE peer set passed here. Build it once per peer set, then\n * call it once per relationship. The relationship does not have to be in the peer set; it is keyed\n * by how many peers share its related entity.\n *\n * Building counts each related entity once, so keying all n peers is O(n). Calling\n * RelatedEntitySectionKey per peer is O(n²), which on an entity with ~150 DisplayInForm\n * relationships (MJ: Users), resolved on every change-detection pass, pegged a CPU core.\n * The returned function reflects the peers as they were when it was built.\n */\nexport function CreateRelatedEntitySectionKeyResolver(\n displayInFormPeers: readonly FormContributionRelationship[],\n): (relationship: FormContributionRelationship) => string {\n const countByEntityID = CountByUUID(displayInFormPeers, (peer) => peer.RelatedEntityID);\n return (relationship) => relatedSectionKey(relationship, (countByEntityID.Get(relationship.RelatedEntityID) ?? 0) > 1);\n}\n\nexport function RelationshipDisplayName(relationship: FormContributionRelationship): string {\n const named = relationship.DisplayName?.trim();\n const raw = named && named.length > 0 ? named : relationship.RelatedEntity;\n return raw.replace(/^[A-Za-z][A-Za-z0-9_]*:\\s+/, '').trim() || raw;\n}\n\nfunction isIsaChild(relationship: FormContributionRelationship, isaChildIds: readonly string[]): boolean {\n return isaChildIds.some((id) => UUIDsEqual(id, relationship.RelatedEntityID));\n}\n\nfunction visibleRelationships(\n related: readonly FormContributionRelationship[],\n isaChildIds: readonly string[],\n): FormContributionRelationship[] {\n const visible = related.filter((rel) => rel.DisplayInForm && !isIsaChild(rel, isaChildIds));\n return [...visible].sort((a, b) => {\n const aSeq = a.Sequence ?? 999999;\n const bSeq = b.Sequence ?? 999999;\n if (aSeq !== bSeq) return aSeq - bSeq;\n return a.RelatedEntity.localeCompare(b.RelatedEntity);\n });\n}\n\n/**\n * Strict entity match shared by the composer and the slot host. `'*'` matches every form.\n *\n * Exported because the slot host used to run its own prefix-insensitive variant, which\n * mounted panels the composer then ignored — the two sides disagreed about which panels\n * existed. One predicate, used by both.\n */\nexport function FormContributionEntityMatches(registeredEntity: string | null | undefined, formEntity: string): boolean {\n if (!registeredEntity) return false;\n return registeredEntity === '*' || registeredEntity === formEntity;\n}\n\n/**\n * A wildcard registration that claims a grid, a section or a rail tab, or names a section to draw\n * in. It still mounts, but its claim is ignored: it would take that place from every form.\n */\nexport function IsWildcardPlaceClaim(meta: FormPanelRegistrationMetadata): boolean {\n return meta.entity === '*'\n && (!!meta.relatedEntity || ReplacedSectionKeys(meta).length > 0 || !!meta.inSectionKey?.trim());\n}\n\n/** The fields the collapse ranks a registration by. */\ntype RankedRegistration = Pick<FormContributionRegistration, 'Priority' | 'Source' | 'Scope'>;\n\n/**\n * Whether `reg` beats `incumbent`, by the rule the server's composition answer also uses\n * ({@link FormContributionOutranks}): higher Priority; on a tie a compiled registration beats any\n * row, and between rows the narrower audience wins.\n */\nfunction outranks(reg: RankedRegistration, incumbent: RankedRegistration): boolean {\n return FormContributionOutranks(rankOf(reg), rankOf(incumbent));\n}\n\nfunction rankOf(reg: RankedRegistration) {\n return { Precedence: reg.Priority, Scope: reg.Scope, Compiled: reg.Source !== 'metadata' };\n}\n\n/**\n * Collapse by key ({@link ResolveContributionKey}, compared exactly). Highest Priority wins; on a\n * tie the compiled registration wins, and between rows the narrower scope. Registrations without\n * a key never collapse.\n *\n * The tie-break is an explicit comparator rather than input ordering, so the result does not\n * depend on which source the caller concatenated first.\n */\nexport function CollapseFormPanelRegistrations<T extends {\n Priority: number;\n Metadata: FormPanelRegistrationMetadata;\n Source?: FormContributionRegistrationSource;\n Scope?: FormContributionRegistration['Scope'];\n}>(\n registrations: readonly T[],\n): T[] {\n const winners = new Map<string, T>();\n let uniqueIndex = 0;\n for (const reg of registrations) {\n const key = ResolveContributionKey(reg.Metadata) || `__unique:${uniqueIndex++}`;\n const incumbent = winners.get(key);\n if (!incumbent || outranks(reg, incumbent)) {\n winners.set(key, reg);\n }\n }\n return [...winners.values()];\n}\n\n/** One form's contributions after the collapse. */\nexport interface ResolvedFormContributions {\n /**\n * The winners among the registrations for this entity or for every entity (`'*'`): one per\n * key, and each registration that has no key.\n */\n readonly Winners: readonly FormContributionRegistration[];\n /**\n * The winners the rail files, by {@link ContributionSectionKey}: they name the entity rather\n * than the wildcard, draw a section rather than a bare strip, and have a section key. Two\n * winners filed under one section key keep the one that ranks higher in the collapse.\n */\n readonly RailItems: ReadonlyMap<string, FormContributionRegistration>;\n}\n\nconst resolvedMemo = new WeakMap<readonly FormContributionRegistration[], Map<string, ResolvedFormContributions>>();\n\n/**\n * The winning registrations on one entity's form, resolved once for the whole form.\n *\n * Every host that draws contributions filters these winners by its own slot or section, so a row\n * that takes a key from a compiled panel draws where the row says, and the compiled panel draws\n * nowhere. Memoized per input list, which the collector returns as a stable reference until\n * something changes, so a caller must not change a list after passing it. The result is shared:\n * callers must not mutate it.\n */\nexport function ResolveFormContributionWinners(\n entityName: string,\n registrations: readonly FormContributionRegistration[],\n): ResolvedFormContributions {\n let byEntity = resolvedMemo.get(registrations);\n const hit = byEntity?.get(entityName);\n if (hit) return hit;\n const applicable = registrations.filter((reg) => FormContributionEntityMatches(reg.Metadata?.entity, entityName));\n const winners = CollapseFormPanelRegistrations(applicable);\n const railItems = new Map<string, FormContributionRegistration>();\n for (const reg of winners) {\n const meta = reg.Metadata;\n if (meta.entity !== entityName || reg.Presentation === 'bare' || meta.presentation === 'bare') continue;\n const key = ContributionSectionKey(reg);\n const filed = key ? railItems.get(key) : undefined;\n if (key && (!filed || outranks(reg, filed))) railItems.set(key, reg);\n }\n const resolved: ResolvedFormContributions = { Winners: winners, RailItems: railItems };\n if (!byEntity) {\n byEntity = new Map();\n resolvedMemo.set(registrations, byEntity);\n }\n byEntity.set(entityName, resolved);\n return resolved;\n}\n\nfunction stockWinner(relationship: FormContributionRelationship, sectionKey: string): FormContributionWinner {\n const join = StripJoinFieldBrackets(relationship.RelatedEntityJoinField);\n return {\n ContributionKey: RelatedContributionKey(relationship.RelatedEntity, join),\n Slot: 'after-related',\n SortKey: -(relationship.Sequence ?? 0),\n Priority: 0,\n Kind: 'stock-grid',\n RelatedEntity: relationship.RelatedEntity,\n RelatedJoinField: join,\n BakedSectionKey: sectionKey,\n DisplayName: RelationshipDisplayName(relationship),\n };\n}\n\nfunction registeredWinner(\n key: string,\n reg: FormContributionRegistration,\n sectionKey: string,\n displayName: string,\n): FormContributionWinner {\n const meta = reg.Metadata;\n return {\n ContributionKey: key,\n Slot: meta.slot,\n SortKey: meta.sortKey ?? 0,\n Priority: reg.Priority,\n Kind: 'registered',\n RelatedEntity: meta.relatedEntity,\n RelatedJoinField: meta.relatedJoinField ? StripJoinFieldBrackets(meta.relatedJoinField) : undefined,\n ReplacesSectionKey: meta.replacesSectionKey?.trim() || undefined,\n ReplacesFieldNames: meta.replacesFieldNames?.length ? [...meta.replacesFieldNames] : undefined,\n ReplacesSectionKeys: meta.replacesSectionKeys?.length ? [...meta.replacesSectionKeys] : undefined,\n BakedSectionKey: sectionKey,\n DisplayName: displayName,\n Source: reg.Source,\n ComponentID: reg.ComponentID,\n Title: reg.Title,\n Presentation: reg.Presentation ?? meta.presentation,\n };\n}\n\nfunction sortWinners(winners: FormContributionWinner[]): FormContributionWinner[] {\n return [...winners].sort((a, b) => {\n if (a.SortKey !== b.SortKey) return b.SortKey - a.SortKey;\n if (a.Priority !== b.Priority) return b.Priority - a.Priority;\n return a.ContributionKey.localeCompare(b.ContributionKey);\n });\n}\n\n/**\n * Resolve what belongs on the form. Stock grids are only those the template\n * did not already bake and that no panel claimed.\n */\nexport function ResolveFormContributions(input: ResolveFormContributionsInput): ResolveFormContributionsResult {\n const peers = visibleRelationships(input.RelatedEntities, input.IsaChildEntityIDs);\n const winners = ResolveFormContributionWinners(input.EntityName, input.Registrations).Winners;\n const baked = new Set(input.BakedSectionKeys);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);\n\n const claimedKeys = new Set<string>();\n const registered: FormContributionWinner[] = [];\n for (const reg of winners) {\n // One winner per key per form: a wildcard place claim that won key K hides the entity's own K too.\n if (IsWildcardPlaceClaim(reg.Metadata)) continue;\n const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;\n const related = reg.Metadata.relatedEntity?.trim();\n const peer = related\n ? peers.find((rel) => {\n if (rel.RelatedEntity !== related) return false;\n const wantJoin = StripJoinFieldBrackets(reg.Metadata.relatedJoinField);\n if (!wantJoin) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === wantJoin;\n })\n : undefined;\n const sectionKey = peer ? sectionKeyOf(peer) : '';\n if (related) {\n claimedKeys.add(RelatedContributionKey(related, reg.Metadata.relatedJoinField));\n // A claim that omits the join field covers every FK to that entity.\n if (!StripJoinFieldBrackets(reg.Metadata.relatedJoinField)) {\n for (const match of peers.filter((rel) => rel.RelatedEntity === related)) {\n claimedKeys.add(RelatedContributionKey(match.RelatedEntity, match.RelatedEntityJoinField));\n }\n }\n }\n registered.push(\n registeredWinner(key, reg, sectionKey, peer ? RelationshipDisplayName(peer) : related ?? key),\n );\n }\n\n const hiddenBaked: string[] = [];\n const stock: FormContributionWinner[] = [];\n if (input.ShowRelatedEntities) {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = sectionKeyOf(rel);\n if (claimedKeys.has(key)) {\n if (baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n continue;\n }\n if (baked.has(sectionKey)) continue;\n stock.push(stockWinner(rel, sectionKey));\n }\n } else {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = sectionKeyOf(rel);\n if (claimedKeys.has(key) && baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n }\n }\n\n return {\n Winners: sortWinners([...registered, ...stock]),\n HiddenBakedSectionKeys: hiddenBaked,\n StockGrids: sortWinners(stock),\n };\n}\n\n/** Section keys a form should hide because a winning contribution claimed them. */\nexport function ContributionHiddenSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n const resolved = ResolveFormContributions({\n EntityName: entityName,\n RelatedEntities: relatedEntities,\n IsaChildEntityIDs: isaChildEntityIDs,\n Registrations: registrations,\n BakedSectionKeys: [],\n ShowRelatedEntities: true,\n });\n const peers = visibleRelationships(relatedEntities, isaChildEntityIDs);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);\n const keys: string[] = [];\n for (const winner of resolved.Winners) {\n if (winner.Kind !== 'registered') continue;\n if (winner.ReplacesSectionKey) keys.push(winner.ReplacesSectionKey);\n for (const key of winner.ReplacesSectionKeys ?? []) if (key.trim()) keys.push(key.trim());\n if (!winner.RelatedEntity) continue;\n const peer = peers.find((rel) => {\n if (rel.RelatedEntity !== winner.RelatedEntity) return false;\n if (!winner.RelatedJoinField) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === winner.RelatedJoinField;\n });\n if (peer) keys.push(sectionKeyOf(peer));\n }\n return keys;\n}\n\n/** @deprecated Use {@link ContributionHiddenSectionKeys}. */\nexport function ClaimedRelatedSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n return ContributionHiddenSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations);\n}\n\n/**\n * Whether this registration is hosted by a section rather than by a slot.\n *\n * A contribution that names fields renders at the top of the section drawing them, which\n * `<mj-form-field-panel-slot>` mounts. It still carries a `slot`, because every row does,\n * so a slot host that went by slot alone would mount it a second time at the bottom of the\n * form — the same panel twice, once in the group and once as a section of its own.\n */\nexport function ContributionClaimsFields(\n metadata: Pick<FormPanelRegistrationMetadata, 'replacesFieldNames'> | null | undefined,\n): boolean {\n return (metadata?.replacesFieldNames ?? []).some((name) => name.trim().length > 0);\n}\n\n/**\n * The section a registration names to draw in, or '' when it names none. A wildcard\n * (`entity: '*'`) registration's section is ignored, because it would take that place on every\n * form, so the panel draws at its slot.\n */\nexport function PlacedInSectionKey(\n metadata: Partial<Pick<FormPanelRegistrationMetadata, 'entity' | 'inSectionKey'>> | null | undefined,\n): string {\n if (!metadata || metadata.entity === '*') return '';\n return metadata.inSectionKey?.trim() ?? '';\n}\n\n/**\n * Whether this registration is drawn inside a section rather than by a slot: it stands in for\n * fields, or it names a section to draw in ({@link PlacedInSectionKey}). The section's own host\n * mounts it, so a slot host must not mount it a second time.\n */\nexport function ContributionDrawsInSection(\n metadata: Partial<Pick<FormPanelRegistrationMetadata, 'entity' | 'replacesFieldNames' | 'inSectionKey'>> | null | undefined,\n): boolean {\n return ContributionClaimsFields(metadata) || !!PlacedInSectionKey(metadata);\n}\n\n/** Where inside its section a section-hosted contribution draws. */\nexport function ContributionSectionPosition(\n metadata: Pick<FormPanelRegistrationMetadata, 'sectionPosition'> | null | undefined,\n): 'start' | 'end' {\n return metadata?.sectionPosition === 'end' ? 'end' : 'start';\n}\n\n/** Every section a contribution stands in for: the single key, then the list, without repeats. */\nexport function ReplacedSectionKeys(\n metadata: Pick<FormPanelRegistrationMetadata, 'replacesSectionKey' | 'replacesSectionKeys'> | null | undefined,\n): string[] {\n const out: string[] = [];\n for (const raw of [metadata?.replacesSectionKey, ...(metadata?.replacesSectionKeys ?? [])]) {\n const key = raw?.trim();\n if (key && !out.includes(key)) out.push(key);\n }\n return out;\n}\n\n/**\n * Field names the winning contributions stand in for, so the form stops drawing them.\n *\n * Separate from {@link ContributionHiddenSectionKeys} because the two hide different\n * things: a section key removes a whole card, a field name removes one input from inside\n * one. The panel that made the claim renders at the top of the section that held those\n * fields, which is the collapsible panel's job — this only says which fields are spoken for.\n */\nexport function ContributionClaimedFieldNames(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n const resolved = ResolveFormContributions({\n EntityName: entityName,\n RelatedEntities: relatedEntities,\n IsaChildEntityIDs: isaChildEntityIDs,\n Registrations: registrations,\n BakedSectionKeys: [],\n ShowRelatedEntities: true,\n });\n const names: string[] = [];\n for (const winner of resolved.Winners) {\n if (winner.Kind !== 'registered') continue;\n for (const name of winner.ReplacesFieldNames ?? []) {\n if (!names.includes(name)) names.push(name);\n }\n }\n return names;\n}\n\n/**\n * `DisplayInForm` relationships that can appear on the parent form (IS-A\n * children excluded), in Sequence order — the same peer set\n * {@link ResolveFormContributions} and {@link CreateRelatedEntitySectionKeyResolver} use.\n */\nexport function VisibleFormRelationships<T extends FormContributionRelationship>(\n related: readonly T[],\n isaChildIds: readonly string[],\n): T[] {\n return visibleRelationships(related, isaChildIds) as T[];\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnChanges, SimpleChanges } from '@angular/core';
|
|
1
|
+
import { OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
2
|
import { BaseEntity } from '@memberjunction/core';
|
|
3
3
|
import { BaseFormComponent } from '../base-form-component';
|
|
4
4
|
import { FormContext } from '../types/form-types';
|
|
@@ -6,20 +6,31 @@ import { type FormContributionWinner } from './form-contribution';
|
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Fills in related-entity grids that the form template did not bake and that
|
|
9
|
-
* no
|
|
9
|
+
* no contribution claimed. Lives in `<mj-record-form-container>` so every
|
|
10
10
|
* generated and custom form that uses the container picks it up.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Reads the same contributions the slots do (compiled panels and rows, less the
|
|
13
|
+
* ones this user hid) and resolves again when rows change or the user hides or
|
|
14
|
+
* shows a panel. Claimed / extra panels still mount via `<mj-form-panel-slot>` —
|
|
15
|
+
* this host does not remount those.
|
|
14
16
|
*/
|
|
15
|
-
export declare class FormContributionsComponent implements OnChanges {
|
|
17
|
+
export declare class FormContributionsComponent implements OnChanges, OnInit, OnDestroy {
|
|
16
18
|
Record: BaseEntity;
|
|
17
19
|
FormComponent: BaseFormComponent;
|
|
18
20
|
FormContext?: FormContext;
|
|
19
21
|
BakedSectionKeys: string[];
|
|
20
22
|
ShowRelatedEntities: boolean;
|
|
21
23
|
StockGrids: FormContributionWinner[];
|
|
24
|
+
private readonly destroy$;
|
|
25
|
+
private readonly cdr;
|
|
26
|
+
/** The placement dialog's unsaved panel, when this is the dialog's preview form. */
|
|
27
|
+
private readonly preview;
|
|
28
|
+
/** The form's slot coordinator, which says when the user hid or showed a panel. */
|
|
29
|
+
private readonly slots;
|
|
22
30
|
ngOnChanges(changes: SimpleChanges): void;
|
|
31
|
+
ngOnInit(): void;
|
|
32
|
+
ngOnDestroy(): void;
|
|
33
|
+
private refreshAndMark;
|
|
23
34
|
private refresh;
|
|
24
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormContributionsComponent, never>;
|
|
25
36
|
static ɵcmp: i0.ɵɵComponentDeclaration<FormContributionsComponent, "mj-form-contributions", never, { "Record": { "alias": "Record"; "required": false; }; "FormComponent": { "alias": "FormComponent"; "required": false; }; "FormContext": { "alias": "FormContext"; "required": false; }; "BakedSectionKeys": { "alias": "BakedSectionKeys"; "required": false; }; "ShowRelatedEntities": { "alias": "ShowRelatedEntities"; "required": false; }; }, {}, never, never, false, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-contributions.component.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contributions.component.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"form-contributions.component.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contributions.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAU,MAAM,eAAe,CAAC;AAEzH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAEH,KAAK,sBAAsB,EAC9B,MAAM,qBAAqB,CAAC;;AAI7B;;;;;;;;;GASG;AACH,qBAea,0BAA2B,YAAW,SAAS,EAAE,MAAM,EAAE,SAAS;IAClE,MAAM,EAAG,UAAU,CAAC;IACpB,aAAa,EAAG,iBAAiB,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAM;IAChC,mBAAmB,UAAQ;IAE7B,UAAU,EAAE,sBAAsB,EAAE,CAAM;IAEjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IACjD,oFAAoF;IACpF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsD;IAC9E,mFAAmF;IACnF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmD;IAElE,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAOzC,QAAQ,IAAI,IAAI;IAchB,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,OAAO;yCA/CN,0BAA0B;2CAA1B,0BAA0B;CAiEtC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import {
|
|
1
|
+
import { ChangeDetectorRef, Component, Input, inject } from '@angular/core';
|
|
2
|
+
import { Subject, skip, takeUntil } from 'rxjs';
|
|
3
|
+
import { InteractiveFormsEngine } from '@memberjunction/core-entities';
|
|
4
|
+
import { CollectFormContributionRegistrations } from './collect-form-contribution-registrations';
|
|
3
5
|
import { ResolveFormContributions, } from './form-contribution';
|
|
6
|
+
import { FORM_PLACEMENT_PREVIEW } from './placement-preview';
|
|
7
|
+
import { FormSlotCoordinator } from './form-slot-coordinator.service';
|
|
4
8
|
import * as i0 from "@angular/core";
|
|
5
9
|
import * as i1 from "./related-entity-grid-panel.component";
|
|
6
10
|
const _forTrack0 = ($index, $item) => $item.ContributionKey;
|
|
@@ -13,11 +17,13 @@ function FormContributionsComponent_For_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
13
17
|
} }
|
|
14
18
|
/**
|
|
15
19
|
* Fills in related-entity grids that the form template did not bake and that
|
|
16
|
-
* no
|
|
20
|
+
* no contribution claimed. Lives in `<mj-record-form-container>` so every
|
|
17
21
|
* generated and custom form that uses the container picks it up.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
23
|
+
* Reads the same contributions the slots do (compiled panels and rows, less the
|
|
24
|
+
* ones this user hid) and resolves again when rows change or the user hides or
|
|
25
|
+
* shows a panel. Claimed / extra panels still mount via `<mj-form-panel-slot>` —
|
|
26
|
+
* this host does not remount those.
|
|
21
27
|
*/
|
|
22
28
|
export class FormContributionsComponent {
|
|
23
29
|
Record;
|
|
@@ -26,6 +32,12 @@ export class FormContributionsComponent {
|
|
|
26
32
|
BakedSectionKeys = [];
|
|
27
33
|
ShowRelatedEntities = true;
|
|
28
34
|
StockGrids = [];
|
|
35
|
+
destroy$ = new Subject();
|
|
36
|
+
cdr = inject(ChangeDetectorRef);
|
|
37
|
+
/** The placement dialog's unsaved panel, when this is the dialog's preview form. */
|
|
38
|
+
preview = inject(FORM_PLACEMENT_PREVIEW, { optional: true });
|
|
39
|
+
/** The form's slot coordinator, which says when the user hid or showed a panel. */
|
|
40
|
+
slots = inject(FormSlotCoordinator, { optional: true });
|
|
29
41
|
ngOnChanges(changes) {
|
|
30
42
|
const keys = ['Record', 'FormComponent', 'BakedSectionKeys', 'ShowRelatedEntities'];
|
|
31
43
|
const meaningful = keys.some((k) => changes[k] && changes[k].currentValue !== changes[k].previousValue);
|
|
@@ -33,6 +45,28 @@ export class FormContributionsComponent {
|
|
|
33
45
|
return;
|
|
34
46
|
this.refresh();
|
|
35
47
|
}
|
|
48
|
+
ngOnInit() {
|
|
49
|
+
// The engine's subject replays the current rows on subscribe, which ngOnChanges has
|
|
50
|
+
// already resolved.
|
|
51
|
+
try {
|
|
52
|
+
InteractiveFormsEngine.Instance.Contributions$
|
|
53
|
+
.pipe(skip(1), takeUntil(this.destroy$))
|
|
54
|
+
.subscribe(() => this.refreshAndMark());
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// No engine here — compiled registrations are the only source.
|
|
58
|
+
}
|
|
59
|
+
this.preview?.Changed$.pipe(takeUntil(this.destroy$)).subscribe(() => this.refreshAndMark());
|
|
60
|
+
this.slots?.PanelsChanged.pipe(takeUntil(this.destroy$)).subscribe(() => this.refreshAndMark());
|
|
61
|
+
}
|
|
62
|
+
ngOnDestroy() {
|
|
63
|
+
this.destroy$.next();
|
|
64
|
+
this.destroy$.complete();
|
|
65
|
+
}
|
|
66
|
+
refreshAndMark() {
|
|
67
|
+
this.refresh();
|
|
68
|
+
this.cdr.markForCheck();
|
|
69
|
+
}
|
|
36
70
|
refresh() {
|
|
37
71
|
if (!this.Record?.EntityInfo || !this.FormComponent) {
|
|
38
72
|
this.StockGrids = [];
|
|
@@ -43,7 +77,9 @@ export class FormContributionsComponent {
|
|
|
43
77
|
EntityName: entity.Name,
|
|
44
78
|
RelatedEntities: entity.RelatedEntities,
|
|
45
79
|
IsaChildEntityIDs: entity.ChildEntities.map((child) => child.ID),
|
|
46
|
-
Registrations:
|
|
80
|
+
Registrations: this.FormComponent.OwnsEntireFormBody
|
|
81
|
+
? []
|
|
82
|
+
: CollectFormContributionRegistrations(entity, this.FormComponent.ProviderToUse, { Preview: this.preview }),
|
|
47
83
|
BakedSectionKeys: this.BakedSectionKeys,
|
|
48
84
|
ShowRelatedEntities: this.ShowRelatedEntities,
|
|
49
85
|
});
|
|
@@ -79,5 +115,5 @@ export class FormContributionsComponent {
|
|
|
79
115
|
}], ShowRelatedEntities: [{
|
|
80
116
|
type: Input
|
|
81
117
|
}] }); })();
|
|
82
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormContributionsComponent, { className: "FormContributionsComponent", filePath: "src/lib/panel-slot/form-contributions.component.ts", lineNumber:
|
|
118
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormContributionsComponent, { className: "FormContributionsComponent", filePath: "src/lib/panel-slot/form-contributions.component.ts", lineNumber: 40 }); })();
|
|
83
119
|
//# sourceMappingURL=form-contributions.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-contributions.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contributions.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"form-contributions.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contributions.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,EAA+C,MAAM,EAAE,MAAM,eAAe,CAAC;AACzH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC;AACjG,OAAO,EACH,wBAAwB,GAE3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;;;;;IAiB1D,kDAK+B;;;;IAD3B,AADA,AADA,AADA,sCAAqB,yBACJ,uCACc,mCACJ;;AAnB3C;;;;;;;;;GASG;AAgBH,MAAM,OAAO,0BAA0B;IAC1B,MAAM,CAAc;IACpB,aAAa,CAAqB;IAClC,WAAW,CAAe;IAC1B,gBAAgB,GAAa,EAAE,CAAC;IAChC,mBAAmB,GAAG,IAAI,CAAC;IAE7B,UAAU,GAA6B,EAAE,CAAC;IAEhC,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;IAC/B,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACjD,oFAAoF;IACnE,OAAO,GAAG,MAAM,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9E,mFAAmF;IAClE,KAAK,GAAG,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC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inject } from '@angular/core';\nimport { Subject, skip, takeUntil } from 'rxjs';\nimport { BaseEntity } from '@memberjunction/core';\nimport { InteractiveFormsEngine } from '@memberjunction/core-entities';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport { CollectFormContributionRegistrations } from './collect-form-contribution-registrations';\nimport {\n ResolveFormContributions,\n type FormContributionWinner,\n} from './form-contribution';\nimport { FORM_PLACEMENT_PREVIEW } from './placement-preview';\nimport { FormSlotCoordinator } from './form-slot-coordinator.service';\n\n/**\n * Fills in related-entity grids that the form template did not bake and that\n * no contribution claimed. Lives in `<mj-record-form-container>` so every\n * generated and custom form that uses the container picks it up.\n *\n * Reads the same contributions the slots do (compiled panels and rows, less the\n * ones this user hid) and resolves again when rows change or the user hides or\n * shows a panel. Claimed / extra panels still mount via `<mj-form-panel-slot>` —\n * this host does not remount those.\n */\n@Component({\n standalone: false,\n selector: 'mj-form-contributions',\n template: `\n @for (grid of StockGrids; track grid.ContributionKey) {\n <mj-related-entity-grid-panel\n [Contribution]=\"grid\"\n [Record]=\"Record\"\n [FormComponent]=\"FormComponent\"\n [FormContext]=\"FormContext\">\n </mj-related-entity-grid-panel>\n }\n `,\n styles: [`:host { display: contents; }`],\n})\nexport class FormContributionsComponent implements OnChanges, OnInit, OnDestroy {\n @Input() Record!: BaseEntity;\n @Input() FormComponent!: BaseFormComponent;\n @Input() FormContext?: FormContext;\n @Input() BakedSectionKeys: string[] = [];\n @Input() ShowRelatedEntities = true;\n\n public StockGrids: FormContributionWinner[] = [];\n\n private readonly destroy$ = new Subject<void>();\n private readonly cdr = inject(ChangeDetectorRef);\n /** The placement dialog's unsaved panel, when this is the dialog's preview form. */\n private readonly preview = inject(FORM_PLACEMENT_PREVIEW, { optional: true });\n /** The form's slot coordinator, which says when the user hid or showed a panel. */\n private readonly slots = inject(FormSlotCoordinator, { optional: true });\n\n public ngOnChanges(changes: SimpleChanges): void {\n const keys = ['Record', 'FormComponent', 'BakedSectionKeys', 'ShowRelatedEntities'];\n const meaningful = keys.some((k) => changes[k] && changes[k].currentValue !== changes[k].previousValue);\n if (!meaningful && this.StockGrids.length > 0) return;\n this.refresh();\n }\n\n public ngOnInit(): void {\n // The engine's subject replays the current rows on subscribe, which ngOnChanges has\n // already resolved.\n try {\n InteractiveFormsEngine.Instance.Contributions$\n .pipe(skip(1), takeUntil(this.destroy$))\n .subscribe(() => this.refreshAndMark());\n } catch {\n // No engine here — compiled registrations are the only source.\n }\n this.preview?.Changed$.pipe(takeUntil(this.destroy$)).subscribe(() => this.refreshAndMark());\n this.slots?.PanelsChanged.pipe(takeUntil(this.destroy$)).subscribe(() => this.refreshAndMark());\n }\n\n public ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n private refreshAndMark(): void {\n this.refresh();\n this.cdr.markForCheck();\n }\n\n private refresh(): void {\n if (!this.Record?.EntityInfo || !this.FormComponent) {\n this.StockGrids = [];\n return;\n }\n const entity = this.Record.EntityInfo;\n const resolved = ResolveFormContributions({\n EntityName: entity.Name,\n RelatedEntities: entity.RelatedEntities,\n IsaChildEntityIDs: entity.ChildEntities.map((child) => child.ID),\n Registrations: this.FormComponent.OwnsEntireFormBody\n ? []\n : CollectFormContributionRegistrations(entity, this.FormComponent.ProviderToUse, { Preview: this.preview }),\n BakedSectionKeys: this.BakedSectionKeys,\n ShowRelatedEntities: this.ShowRelatedEntities,\n });\n this.StockGrids = resolved.StockGrids;\n }\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { BaseEntity } from '@memberjunction/core';
|
|
3
|
+
import { BaseFormComponent } from '../base-form-component';
|
|
4
|
+
import { FormContext } from '../types/form-types';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* `<mj-form-field-panel-slot>` — mounts the contributions drawn inside a section.
|
|
8
|
+
*
|
|
9
|
+
* Two kinds: a contribution that stands in for some of the section's fields, and one placed in
|
|
10
|
+
* the section by its key without replacing anything. Either belongs inside the section, so it
|
|
11
|
+
* reads as part of it rather than as a separate card elsewhere on the form.
|
|
12
|
+
* `<mj-collapsible-panel>` renders two of these, one above its projected content and one below,
|
|
13
|
+
* and each mounts the contributions whose `sectionPosition` matches it. A claimed field stops
|
|
14
|
+
* drawing, which `FormContext.claimedFieldNames` handles.
|
|
15
|
+
*
|
|
16
|
+
* Distinct from `<mj-form-panel-slot>`, which selects by slot position. This one selects by
|
|
17
|
+
* field, and its position is wherever the section is — there is no slot involved and no
|
|
18
|
+
* fallback chain, because a claim on a field the form does not draw is simply not matched
|
|
19
|
+
* by any section.
|
|
20
|
+
*/
|
|
21
|
+
export declare class FormFieldPanelSlotComponent implements OnInit, OnChanges, OnDestroy {
|
|
22
|
+
/** The entity name being edited. */
|
|
23
|
+
Entity: string;
|
|
24
|
+
/** The fields this section draws — the set a contribution may claim from. */
|
|
25
|
+
FieldNames: readonly string[];
|
|
26
|
+
/** The section's key, which a contribution placed in the section names. */
|
|
27
|
+
SectionKey: string;
|
|
28
|
+
/** Which end of the section this host draws at. */
|
|
29
|
+
Position: 'start' | 'end';
|
|
30
|
+
/** The record being edited, threaded through to every mounted panel. */
|
|
31
|
+
Record: BaseEntity;
|
|
32
|
+
/** The host form component. */
|
|
33
|
+
FormComponent: BaseFormComponent;
|
|
34
|
+
/** Optional form context. */
|
|
35
|
+
FormContext?: FormContext;
|
|
36
|
+
private anchor;
|
|
37
|
+
private mounted;
|
|
38
|
+
private readonly destroy$;
|
|
39
|
+
private readonly recordRefresh;
|
|
40
|
+
/** The placement dialog's unsaved panel, when this slot is on the dialog's preview form. */
|
|
41
|
+
private readonly preview;
|
|
42
|
+
/** The form's slot coordinator, which says when the user hid or showed a panel. */
|
|
43
|
+
private readonly slots;
|
|
44
|
+
ngOnInit(): void;
|
|
45
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
46
|
+
ngOnDestroy(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Registrations claiming one of this section's fields, mounted in place.
|
|
49
|
+
*
|
|
50
|
+
* A form that renders its own body composes nothing, so the check the slot host makes
|
|
51
|
+
* applies here for the same reason.
|
|
52
|
+
*/
|
|
53
|
+
private remount;
|
|
54
|
+
/**
|
|
55
|
+
* The form's winning registrations drawn at this end of this section, highest sort first:
|
|
56
|
+
* those standing in for a field the section draws, and those placed in the section by its
|
|
57
|
+
* key ({@link PlacedInSectionKey}, which ignores a wildcard's place). The collapse runs once
|
|
58
|
+
* over every registration on the form, so a key a row took from a compiled panel draws where
|
|
59
|
+
* the row says.
|
|
60
|
+
*/
|
|
61
|
+
private claimsForFields;
|
|
62
|
+
private unmountAll;
|
|
63
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormFieldPanelSlotComponent, never>;
|
|
64
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldPanelSlotComponent, "mj-form-field-panel-slot", never, { "Entity": { "alias": "Entity"; "required": false; }; "FieldNames": { "alias": "FieldNames"; "required": false; }; "SectionKey": { "alias": "SectionKey"; "required": false; }; "Position": { "alias": "Position"; "required": false; }; "Record": { "alias": "Record"; "required": false; }; "FormComponent": { "alias": "FormComponent"; "required": false; }; "FormContext": { "alias": "FormContext"; "required": false; }; }, {}, never, never, false, never>;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=form-field-panel-slot.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field-panel-slot.component.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-field-panel-slot.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,SAAS,EACT,SAAS,EACT,MAAM,EACN,aAAa,EAIhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;;AAclD;;;;;;;;;;;;;;GAcG;AACH,qBAMa,2BAA4B,YAAW,MAAM,EAAE,SAAS,EAAE,SAAS;IAC5E,oCAAoC;IAC3B,MAAM,EAAG,MAAM,CAAC;IACzB,6EAA6E;IACpE,UAAU,EAAE,SAAS,MAAM,EAAE,CAAM;IAC5C,2EAA2E;IAClE,UAAU,SAAM;IACzB,mDAAmD;IAC1C,QAAQ,EAAE,OAAO,GAAG,KAAK,CAAW;IAC7C,wEAAwE;IAC/D,MAAM,EAAG,UAAU,CAAC;IAC7B,+BAA+B;IACtB,aAAa,EAAG,iBAAiB,CAAC;IAC3C,6BAA6B;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAGnC,OAAO,CAAC,MAAM,CAAoB;IAElC,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4D;IAC1F,4FAA4F;IAC5F,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsD;IAC9E,mFAAmF;IACnF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmD;IAElE,QAAQ,IAAI,IAAI;IAiBhB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAazC,WAAW,IAAI,IAAI;IAM1B;;;;;OAKG;IACH,OAAO,CAAC,OAAO;IAsBf;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAwBvB,OAAO,CAAC,UAAU;yCA1HT,2BAA2B;2CAA3B,2BAA2B;CA+HvC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Component, Input, ViewChild, ViewContainerRef, inject, } from '@angular/core';
|
|
2
|
+
import { Subject, skip, takeUntil } from 'rxjs';
|
|
3
|
+
import { LogError } from '@memberjunction/core';
|
|
4
|
+
import { InteractiveFormsEngine } from '@memberjunction/core-entities';
|
|
5
|
+
import { ContributionSectionPosition, PlacedInSectionKey, ResolveFormContributionWinners, } from './form-contribution';
|
|
6
|
+
import { CollectFormContributionRegistrations } from './collect-form-contribution-registrations';
|
|
7
|
+
import { FORM_PLACEMENT_PREVIEW } from './placement-preview';
|
|
8
|
+
import { MountFormContribution } from './mount-form-contribution';
|
|
9
|
+
import { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';
|
|
10
|
+
import { FormSlotCoordinator } from './form-slot-coordinator.service';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
const _c0 = ["anchor"];
|
|
13
|
+
/**
|
|
14
|
+
* `<mj-form-field-panel-slot>` — mounts the contributions drawn inside a section.
|
|
15
|
+
*
|
|
16
|
+
* Two kinds: a contribution that stands in for some of the section's fields, and one placed in
|
|
17
|
+
* the section by its key without replacing anything. Either belongs inside the section, so it
|
|
18
|
+
* reads as part of it rather than as a separate card elsewhere on the form.
|
|
19
|
+
* `<mj-collapsible-panel>` renders two of these, one above its projected content and one below,
|
|
20
|
+
* and each mounts the contributions whose `sectionPosition` matches it. A claimed field stops
|
|
21
|
+
* drawing, which `FormContext.claimedFieldNames` handles.
|
|
22
|
+
*
|
|
23
|
+
* Distinct from `<mj-form-panel-slot>`, which selects by slot position. This one selects by
|
|
24
|
+
* field, and its position is wherever the section is — there is no slot involved and no
|
|
25
|
+
* fallback chain, because a claim on a field the form does not draw is simply not matched
|
|
26
|
+
* by any section.
|
|
27
|
+
*/
|
|
28
|
+
export class FormFieldPanelSlotComponent {
|
|
29
|
+
/** The entity name being edited. */
|
|
30
|
+
Entity;
|
|
31
|
+
/** The fields this section draws — the set a contribution may claim from. */
|
|
32
|
+
FieldNames = [];
|
|
33
|
+
/** The section's key, which a contribution placed in the section names. */
|
|
34
|
+
SectionKey = '';
|
|
35
|
+
/** Which end of the section this host draws at. */
|
|
36
|
+
Position = 'start';
|
|
37
|
+
/** The record being edited, threaded through to every mounted panel. */
|
|
38
|
+
Record;
|
|
39
|
+
/** The host form component. */
|
|
40
|
+
FormComponent;
|
|
41
|
+
/** Optional form context. */
|
|
42
|
+
FormContext;
|
|
43
|
+
anchor;
|
|
44
|
+
mounted = [];
|
|
45
|
+
destroy$ = new Subject();
|
|
46
|
+
recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });
|
|
47
|
+
/** The placement dialog's unsaved panel, when this slot is on the dialog's preview form. */
|
|
48
|
+
preview = inject(FORM_PLACEMENT_PREVIEW, { optional: true });
|
|
49
|
+
/** The form's slot coordinator, which says when the user hid or showed a panel. */
|
|
50
|
+
slots = inject(FormSlotCoordinator, { optional: true });
|
|
51
|
+
ngOnInit() {
|
|
52
|
+
this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe((record) => {
|
|
53
|
+
for (const ref of this.mounted)
|
|
54
|
+
ref.instance.OnRecordRefreshed(record);
|
|
55
|
+
});
|
|
56
|
+
// The engine's subject replays the current rows on subscribe, which ngOnChanges has
|
|
57
|
+
// already mounted.
|
|
58
|
+
try {
|
|
59
|
+
InteractiveFormsEngine.Instance.Contributions$
|
|
60
|
+
.pipe(skip(1), takeUntil(this.destroy$))
|
|
61
|
+
.subscribe(() => this.remount());
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// No engine here — compiled registrations are the only source.
|
|
65
|
+
}
|
|
66
|
+
this.preview?.Changed$.pipe(takeUntil(this.destroy$)).subscribe(() => this.remount());
|
|
67
|
+
this.slots?.PanelsChanged.pipe(takeUntil(this.destroy$)).subscribe(() => this.remount());
|
|
68
|
+
}
|
|
69
|
+
ngOnChanges(changes) {
|
|
70
|
+
if (!this.Entity || !this.Record || !this.FormComponent)
|
|
71
|
+
return;
|
|
72
|
+
const structural = ['Entity', 'FieldNames', 'SectionKey', 'Position', 'Record', 'FormComponent'];
|
|
73
|
+
const changed = structural.some((k) => changes[k] && changes[k].currentValue !== changes[k].previousValue);
|
|
74
|
+
if (!changed && this.mounted.length > 0) {
|
|
75
|
+
if (changes['FormContext']) {
|
|
76
|
+
for (const ref of this.mounted)
|
|
77
|
+
ref.instance.FormContext = this.FormContext;
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.remount();
|
|
82
|
+
}
|
|
83
|
+
ngOnDestroy() {
|
|
84
|
+
this.destroy$.next();
|
|
85
|
+
this.destroy$.complete();
|
|
86
|
+
this.unmountAll();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Registrations claiming one of this section's fields, mounted in place.
|
|
90
|
+
*
|
|
91
|
+
* A form that renders its own body composes nothing, so the check the slot host makes
|
|
92
|
+
* applies here for the same reason.
|
|
93
|
+
*/
|
|
94
|
+
remount() {
|
|
95
|
+
this.unmountAll();
|
|
96
|
+
if (this.FormComponent?.OwnsEntireFormBody)
|
|
97
|
+
return;
|
|
98
|
+
const claims = this.claimsForFields();
|
|
99
|
+
if (claims.length === 0)
|
|
100
|
+
return;
|
|
101
|
+
for (const reg of claims) {
|
|
102
|
+
try {
|
|
103
|
+
const ref = MountFormContribution(this.anchor, reg);
|
|
104
|
+
if (!ref)
|
|
105
|
+
continue;
|
|
106
|
+
ref.instance.Record = this.Record;
|
|
107
|
+
ref.instance.FormComponent = this.FormComponent;
|
|
108
|
+
ref.instance.RegistrationMetadata = reg.Metadata;
|
|
109
|
+
if (this.FormContext)
|
|
110
|
+
ref.instance.FormContext = this.FormContext;
|
|
111
|
+
this.FormComponent?.RegisterFormPanel?.(ref.instance);
|
|
112
|
+
this.mounted.push(ref);
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
LogError(`[mj-form-field-panel-slot] Failed to mount a panel on ${this.Entity}: ${e instanceof Error ? e.message : String(e)}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The form's winning registrations drawn at this end of this section, highest sort first:
|
|
121
|
+
* those standing in for a field the section draws, and those placed in the section by its
|
|
122
|
+
* key ({@link PlacedInSectionKey}, which ignores a wildcard's place). The collapse runs once
|
|
123
|
+
* over every registration on the form, so a key a row took from a compiled panel draws where
|
|
124
|
+
* the row says.
|
|
125
|
+
*/
|
|
126
|
+
claimsForFields() {
|
|
127
|
+
const fields = new Set(this.FieldNames.filter((name) => !!name));
|
|
128
|
+
const sectionKey = this.SectionKey.trim();
|
|
129
|
+
if (fields.size === 0 && !sectionKey)
|
|
130
|
+
return [];
|
|
131
|
+
const all = CollectFormContributionRegistrations(this.Record?.EntityInfo ?? null, this.FormComponent?.ProviderToUse ?? null, { Preview: this.preview });
|
|
132
|
+
// A field claim belongs to this section when any of its fields is one this section draws.
|
|
133
|
+
// Any, not every: a claim naming a field the form stopped drawing still belongs where its
|
|
134
|
+
// remaining fields are, and dropping it there would leave the panel nowhere while its
|
|
135
|
+
// other fields stayed hidden.
|
|
136
|
+
const matching = ResolveFormContributionWinners(this.Entity, all).Winners.filter((reg) => {
|
|
137
|
+
if (ContributionSectionPosition(reg.Metadata) !== this.Position)
|
|
138
|
+
return false;
|
|
139
|
+
if (sectionKey && PlacedInSectionKey(reg.Metadata) === sectionKey)
|
|
140
|
+
return true;
|
|
141
|
+
const claimed = reg.Metadata.replacesFieldNames ?? [];
|
|
142
|
+
return claimed.some((name) => fields.has(name.trim()));
|
|
143
|
+
});
|
|
144
|
+
return matching.sort((a, b) => {
|
|
145
|
+
const aSort = a.Metadata.sortKey ?? 0;
|
|
146
|
+
const bSort = b.Metadata.sortKey ?? 0;
|
|
147
|
+
if (aSort !== bSort)
|
|
148
|
+
return bSort - aSort;
|
|
149
|
+
return b.Priority - a.Priority;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
unmountAll() {
|
|
153
|
+
for (const ref of this.mounted)
|
|
154
|
+
this.FormComponent?.UnregisterFormPanel?.(ref.instance);
|
|
155
|
+
this.anchor.clear();
|
|
156
|
+
this.mounted = [];
|
|
157
|
+
}
|
|
158
|
+
static ɵfac = function FormFieldPanelSlotComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FormFieldPanelSlotComponent)(); };
|
|
159
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormFieldPanelSlotComponent, selectors: [["mj-form-field-panel-slot"]], viewQuery: function FormFieldPanelSlotComponent_Query(rf, ctx) { if (rf & 1) {
|
|
160
|
+
i0.ɵɵviewQuery(_c0, 7, ViewContainerRef);
|
|
161
|
+
} if (rf & 2) {
|
|
162
|
+
let _t;
|
|
163
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.anchor = _t.first);
|
|
164
|
+
} }, inputs: { Entity: "Entity", FieldNames: "FieldNames", SectionKey: "SectionKey", Position: "Position", Record: "Record", FormComponent: "FormComponent", FormContext: "FormContext" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["anchor", ""]], template: function FormFieldPanelSlotComponent_Template(rf, ctx) { if (rf & 1) {
|
|
165
|
+
i0.ɵɵelementContainer(0, null, 0);
|
|
166
|
+
} }, styles: ["[_nghost-%COMP%] { display: contents; }"] });
|
|
167
|
+
}
|
|
168
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormFieldPanelSlotComponent, [{
|
|
169
|
+
type: Component,
|
|
170
|
+
args: [{ standalone: false, selector: 'mj-form-field-panel-slot', template: `<ng-container #anchor></ng-container>`, styles: [":host { display: contents; }"] }]
|
|
171
|
+
}], null, { Entity: [{
|
|
172
|
+
type: Input
|
|
173
|
+
}], FieldNames: [{
|
|
174
|
+
type: Input
|
|
175
|
+
}], SectionKey: [{
|
|
176
|
+
type: Input
|
|
177
|
+
}], Position: [{
|
|
178
|
+
type: Input
|
|
179
|
+
}], Record: [{
|
|
180
|
+
type: Input
|
|
181
|
+
}], FormComponent: [{
|
|
182
|
+
type: Input
|
|
183
|
+
}], FormContext: [{
|
|
184
|
+
type: Input
|
|
185
|
+
}], anchor: [{
|
|
186
|
+
type: ViewChild,
|
|
187
|
+
args: ['anchor', { read: ViewContainerRef, static: true }]
|
|
188
|
+
}] }); })();
|
|
189
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormFieldPanelSlotComponent, { className: "FormFieldPanelSlotComponent", filePath: "src/lib/panel-slot/form-field-panel-slot.component.ts", lineNumber: 52 }); })();
|
|
190
|
+
//# sourceMappingURL=form-field-panel-slot.component.js.map
|