@masterteam/components 0.0.149 → 0.0.151

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.
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-components-business-fields.mjs","sources":["../../../../packages/masterteam/components/business-fields/lookup-matrix-field/lookup-matrix-field.ts","../../../../packages/masterteam/components/business-fields/lookup-matrix-field/lookup-matrix-field.html","../../../../packages/masterteam/components/business-fields/schema-connection-field/schema-connection-field.ts","../../../../packages/masterteam/components/business-fields/schema-connection-field/schema-connection-field.html","../../../../packages/masterteam/components/business-fields/schedule-predecessor-field/schedule-predecessor-field.ts","../../../../packages/masterteam/components/business-fields/schedule-predecessor-field/schedule-predecessor-field.html","../../../../packages/masterteam/components/business-fields/masterteam-components-business-fields.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n DestroyRef,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { ControlContainer } from '@angular/forms';\r\nimport { startWith } from 'rxjs';\r\nimport type {\r\n LookupMatrixCellConfig,\r\n LookupMatrixFieldConfig,\r\n LookupOptionItemConfig,\r\n} from '@masterteam/components';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\n\r\n@Component({\r\n selector: 'mt-lookup-matrix-field',\r\n standalone: true,\r\n imports: [CommonModule, Tooltip, Icon],\r\n templateUrl: './lookup-matrix-field.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-2',\r\n },\r\n})\r\nexport class LookupMatrixField {\r\n readonly config = input.required<LookupMatrixFieldConfig>();\r\n\r\n private readonly controlContainer = inject(ControlContainer, {\r\n optional: true,\r\n });\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly valueVersion = signal(0);\r\n\r\n readonly xOptions = computed(() => this.config().xOptions ?? []);\r\n readonly yOptions = computed(() => this.config().yOptions ?? []);\r\n readonly hasMatrix = computed(() => this.config().cells.length > 0);\r\n readonly cellMap = computed(\r\n () =>\r\n new Map(\r\n this.config().cells.map((cell) => [\r\n this.cellKey(cell.xLookupItemId, cell.yLookupItemId),\r\n cell,\r\n ]),\r\n ),\r\n );\r\n readonly selectedXOption = computed(() => {\r\n this.valueVersion();\r\n return this.resolveSelectedOption(\r\n this.xOptions(),\r\n this.getControlValue(this.config().xFieldKey),\r\n );\r\n });\r\n readonly selectedYOption = computed(() => {\r\n this.valueVersion();\r\n return this.resolveSelectedOption(\r\n this.yOptions(),\r\n this.getControlValue(this.config().yFieldKey),\r\n );\r\n });\r\n readonly activeCell = computed(() => {\r\n const selectedX = this.selectedXOption();\r\n const selectedY = this.selectedYOption();\r\n\r\n if (!selectedX || !selectedY) {\r\n return null;\r\n }\r\n\r\n return this.getCell(\r\n selectedX.id ?? selectedX.value,\r\n selectedY.id ?? selectedY.value,\r\n );\r\n });\r\n readonly selectionSummary = computed(() => {\r\n const parts: string[] = [];\r\n const xAxisLabel = this.config().xAxisLabel.trim() || 'X';\r\n const yAxisLabel = this.config().yAxisLabel.trim() || 'Y';\r\n const selectedX = this.selectedXOption();\r\n const selectedY = this.selectedYOption();\r\n\r\n if (selectedX) {\r\n parts.push(`${xAxisLabel}: ${selectedX.label}`);\r\n }\r\n\r\n if (selectedY) {\r\n parts.push(`${yAxisLabel}: ${selectedY.label}`);\r\n }\r\n\r\n return parts.join(' / ');\r\n });\r\n readonly pendingMessage = computed(() => {\r\n const xAxisLabel = this.config().xAxisLabel.trim() || 'the first value';\r\n const yAxisLabel = this.config().yAxisLabel.trim() || 'the second value';\r\n\r\n return `Select ${xAxisLabel} and ${yAxisLabel} first.`;\r\n });\r\n readonly missingResultMessage = computed(() => {\r\n if (!this.selectedXOption() || !this.selectedYOption()) {\r\n return this.pendingMessage();\r\n }\r\n\r\n return 'No matching value for the selected combination.';\r\n });\r\n\r\n constructor() {\r\n const control = this.controlContainer?.control;\r\n if (!control) return;\r\n\r\n control.valueChanges\r\n .pipe(\r\n startWith(control.getRawValue()),\r\n takeUntilDestroyed(this.destroyRef),\r\n )\r\n .subscribe(() => {\r\n this.valueVersion.update((value) => value + 1);\r\n });\r\n }\r\n\r\n getCell(\r\n xLookupItemId: number | string,\r\n yLookupItemId: number | string,\r\n ): LookupMatrixCellConfig | null {\r\n return (\r\n this.cellMap().get(this.cellKey(xLookupItemId, yLookupItemId)) ?? null\r\n );\r\n }\r\n\r\n getSwatchStyle(color?: string | null): Record<string, string> {\r\n const resolvedColor = this.resolveColor(color);\r\n if (!resolvedColor) return {};\r\n\r\n return {\r\n backgroundColor: resolvedColor,\r\n borderColor: resolvedColor,\r\n };\r\n }\r\n\r\n private getControlValue(path: string): unknown {\r\n if (!path) return null;\r\n return this.controlContainer?.control?.get(path)?.value ?? null;\r\n }\r\n\r\n private resolveSelectedOption(\r\n options: LookupOptionItemConfig[],\r\n rawValue: unknown,\r\n ): LookupOptionItemConfig | null {\r\n if (rawValue == null || rawValue === '') return null;\r\n\r\n return (\r\n options.find((option) => this.optionMatchesValue(option, rawValue)) ??\r\n null\r\n );\r\n }\r\n\r\n private optionMatchesValue(\r\n option: LookupOptionItemConfig,\r\n rawValue: unknown,\r\n ): boolean {\r\n return [option.value, option.key, option.id].some(\r\n (candidate) =>\r\n candidate != null && String(candidate) === String(rawValue),\r\n );\r\n }\r\n\r\n private cellKey(\r\n xLookupItemId: number | string,\r\n yLookupItemId: number | string,\r\n ): string {\r\n return `${String(xLookupItemId)}::${String(yLookupItemId)}`;\r\n }\r\n\r\n private resolveColor(color?: string | null): string | null {\r\n if (!color) return null;\r\n\r\n if (\r\n color.startsWith('#') ||\r\n color.startsWith('rgb') ||\r\n color.startsWith('hsl') ||\r\n color.startsWith('var(')\r\n ) {\r\n return color;\r\n }\r\n\r\n return `var(--p-${color}-500)`;\r\n }\r\n}\r\n","@if (config().label) {\r\n <label class=\"text-sm font-medium text-color\">\r\n {{ config().label }}\r\n </label>\r\n}\r\n\r\n<div\r\n class=\"rounded-lg border border-surface-200 bg-surface-50 px-3 flex items-center\"\r\n>\r\n @if (activeCell(); as cell) {\r\n <div class=\"flex flex-1 min-h-6 items-center gap-2 justify-between\">\r\n <span\r\n class=\"h-6 w-2 shrink-0 rounded-[2px] border border-surface-200\"\r\n [ngStyle]=\"getSwatchStyle(cell.color)\"\r\n ></span>\r\n\r\n <div class=\"min-w-0 flex-1 py-2 flex items-center justify-between\">\r\n <div class=\"truncate font-semibold text-gray-500\">\r\n {{ cell.label }}\r\n </div>\r\n\r\n @if (selectionSummary()) {\r\n <div class=\"font-bold text-gray-500\">\r\n <mt-icon\r\n [mtTooltip]=\"selectionSummary()\"\r\n icon=\"general.info-circle\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n } @else {\r\n <div class=\"flex min-h-6 items-center text-muted-color py-2\">\r\n {{ hasMatrix() ? missingResultMessage() : config().emptyMessage }}\r\n </div>\r\n }\r\n</div>\r\n","import {\r\n Component,\r\n signal,\r\n input,\r\n computed,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n untracked,\r\n DestroyRef,\r\n} from '@angular/core';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { SelectField } from '@masterteam/components/select-field';\r\nimport { MultiSelectField } from '@masterteam/components/multi-select-field';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { HttpClient, HttpContext } from '@angular/common/http';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { finalize, catchError, of } from 'rxjs';\r\n\r\n// ============================================================================\r\n// Types\r\n// ============================================================================\r\n\r\n/**\r\n * One source level inside connection configuration.\r\n * Comes from `field.propertyMetadata.configuration.sourceLevels[]`\r\n *\r\n * A source can be either a **level** (has `levelId`/`levelKey`) or a\r\n * **module** (has `moduleId`/`moduleKey`). Exactly one pair will be present.\r\n */\r\nexport interface ConnectionSourceLevel {\r\n /** Present for level-type sources */\r\n levelId?: number;\r\n /** Present for level-type sources */\r\n levelKey?: string;\r\n /** Present for module-type sources */\r\n moduleId?: number;\r\n /** Present for module-type sources */\r\n moduleKey?: string;\r\n name: { en?: string; ar?: string; [k: string]: string | undefined };\r\n connectionId: number;\r\n isOptional: boolean;\r\n allowManyToMany: boolean;\r\n supportWeights: boolean;\r\n optionsQuery: {\r\n path: string;\r\n method?: string;\r\n query?: Record<string, unknown>;\r\n };\r\n}\r\n\r\n/**\r\n * Full connection configuration from `field.propertyMetadata.configuration`.\r\n * This is passed as a single input to the component.\r\n */\r\nexport interface SchemaConnectionConfig {\r\n targetLevelId: number;\r\n sourceLevelId?: number;\r\n propertyKey?: string;\r\n valueMode?: string;\r\n sourceLevels: ConnectionSourceLevel[];\r\n payloadTemplate?: { levelId: number; sources: any[] };\r\n sourceItemShape?: Record<string, string>;\r\n}\r\n\r\n/** One selected source in the connection payload */\r\nexport interface ConnectionSource {\r\n sourceLevelId: number;\r\n sourceLevelDataId: number;\r\n}\r\n\r\n/** The value shape for a connection field */\r\nexport interface ConnectionPayload {\r\n levelId: number;\r\n sources: ConnectionSource[];\r\n}\r\n\r\n/**\r\n * Internal state tracked per source level dropdown.\r\n */\r\nexport interface SourceLevelState {\r\n source: ConnectionSourceLevel;\r\n options: any[];\r\n loading: boolean;\r\n}\r\n\r\n@Component({\r\n selector: 'mt-schema-connection-field',\r\n standalone: true,\r\n imports: [FormsModule, SelectField, MultiSelectField, FieldValidation],\r\n templateUrl: './schema-connection-field.html',\r\n styleUrls: ['./schema-connection-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class SchemaConnectionField implements ControlValueAccessor {\r\n // ============================================================================\r\n // Inputs\r\n // ============================================================================\r\n\r\n readonly label = input<string>('');\r\n readonly placeholder = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly required = input<boolean>(false);\r\n readonly filter = input<boolean>(true);\r\n\r\n /**\r\n * Full connection configuration object from the API.\r\n * Includes `targetLevelId`, `sourceLevels[]`, `payloadTemplate`, etc.\r\n */\r\n readonly configuration = input.required<SchemaConnectionConfig>();\r\n\r\n /**\r\n * Optional HttpContext for API requests (e.g. to set base URL behavior).\r\n */\r\n readonly context = input<HttpContext | undefined>(undefined);\r\n\r\n // ============================================================================\r\n // Internal State\r\n // ============================================================================\r\n\r\n /** The full ConnectionPayload value */\r\n value = signal<ConnectionPayload | null>(null);\r\n disabled = signal<boolean>(false);\r\n\r\n /** Per-source-level state: options + loading */\r\n sourceLevelStates = signal<SourceLevelState[]>([]);\r\n\r\n /** Mutable selections per source level: sourceLevelId -> selected value */\r\n selections: Record<number, any> = {};\r\n\r\n requiredValidator = Validators.required;\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: ConnectionPayload | null) => void = () => {};\r\n\r\n public ngControl: NgControl | null = null;\r\n private http = inject(HttpClient);\r\n private destroyRef = inject(DestroyRef);\r\n\r\n /**\r\n * Source levels from configuration.\r\n */\r\n readonly sourceLevels = computed<ConnectionSourceLevel[]>(() => {\r\n return this.configuration()?.sourceLevels ?? [];\r\n });\r\n\r\n /**\r\n * Percentage width for each dropdown, evenly divided.\r\n */\r\n readonly dropdownWidth = computed<string>(() => {\r\n const count = this.sourceLevels().length;\r\n if (count <= 0) return '100%';\r\n return `${100 / count}%`;\r\n });\r\n\r\n constructor() {\r\n this.ngControl = inject(NgControl, { self: true, optional: true });\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n\r\n effect(() => {\r\n if (this.ngControl?.control && this.required()) {\r\n this.ngControl.control.addValidators(Validators.required);\r\n this.ngControl.control.updateValueAndValidity();\r\n }\r\n });\r\n\r\n // Load options for each source level when configuration changes\r\n effect(() => {\r\n const levels = this.sourceLevels();\r\n if (!levels.length) return;\r\n\r\n // Everything below must NOT create signal dependencies,\r\n // only sourceLevels() (→ configuration) should trigger this effect.\r\n untracked(() => {\r\n // Initialize per-source states + selections\r\n this.sourceLevelStates.set(\r\n levels.map((source) => ({\r\n source,\r\n options: [],\r\n loading: false,\r\n })),\r\n );\r\n\r\n for (const source of levels) {\r\n const sourceId = this.getSourceId(source);\r\n if (!(sourceId in this.selections)) {\r\n this.selections[sourceId] = source.allowManyToMany ? [] : null;\r\n }\r\n }\r\n\r\n // Distribute existing value to selections\r\n this.distributeToSelections(this.value());\r\n\r\n // Load options for each source level\r\n for (const source of levels) {\r\n this.loadOptions(source);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // ============================================================================\r\n // Source Level Helpers\r\n // ============================================================================\r\n\r\n /**\r\n * Returns a stable numeric ID for a source regardless of whether it is a\r\n * level (`levelId`) or a module (`moduleId`). Used as the key in `selections`\r\n * and `sourceLevelStates`.\r\n */\r\n protected getSourceId(source: ConnectionSourceLevel): number {\r\n return (source.levelId ?? source.moduleId)!;\r\n }\r\n\r\n /**\r\n * Builds the `contextKey` for the `fetch/query` request based on source type.\r\n */\r\n private getContextKey(source: ConnectionSourceLevel): string {\r\n return source.levelId != null\r\n ? `level:${source.levelId}`\r\n : `module:${source.moduleId}`;\r\n }\r\n\r\n // ============================================================================\r\n // Option Loading (per source level)\r\n // ============================================================================\r\n\r\n private loadOptions(source: ConnectionSourceLevel): void {\r\n this.updateSourceState(this.getSourceId(source), { loading: true });\r\n\r\n const ctx = this.context();\r\n const payload = {\r\n contextKey: this.getContextKey(source),\r\n projection: 'Flat',\r\n propertyKeys: ['name'],\r\n };\r\n\r\n this.http\r\n .post<unknown>('fetch/query', payload, {\r\n ...(ctx ? { context: ctx } : {}),\r\n })\r\n .pipe(\r\n takeUntilDestroyed(this.destroyRef),\r\n finalize(() =>\r\n this.updateSourceState(this.getSourceId(source), { loading: false }),\r\n ),\r\n catchError((err) => {\r\n console.error(\r\n `Connection options load failed for ${source.levelKey ?? source.moduleKey}:`,\r\n err,\r\n );\r\n return of({ data: { records: [] } });\r\n }),\r\n )\r\n .subscribe((response: any) => {\r\n const options = (response?.data?.records ?? [])\r\n .filter((record: any) => record?.id != null)\r\n .map((record: any) => ({\r\n ...record,\r\n id: record.id,\r\n name: record.name,\r\n }));\r\n\r\n this.updateSourceState(this.getSourceId(source), {\r\n options,\r\n loading: false,\r\n });\r\n });\r\n }\r\n\r\n private updateSourceState(\r\n sourceId: number,\r\n patch: Partial<Pick<SourceLevelState, 'options' | 'loading'>>,\r\n ): void {\r\n this.sourceLevelStates.update((states) =>\r\n states.map((s) =>\r\n this.getSourceId(s.source) === sourceId ? { ...s, ...patch } : s,\r\n ),\r\n );\r\n }\r\n\r\n // ============================================================================\r\n // Value Handling\r\n // ============================================================================\r\n\r\n /**\r\n * Single handler — no params. Reads all selections, builds the combined payload.\r\n */\r\n syncValue(): void {\r\n const cfg = this.configuration();\r\n const states = this.sourceLevelStates();\r\n const sources: ConnectionSource[] = [];\r\n\r\n for (const state of states) {\r\n const val = this.selections[this.getSourceId(state.source)];\r\n if (val == null) continue;\r\n\r\n const effectiveId = this.getSourceId(state.source);\r\n if (state.source.allowManyToMany && Array.isArray(val)) {\r\n for (const id of val) {\r\n sources.push({\r\n sourceLevelId: effectiveId,\r\n sourceLevelDataId: id,\r\n });\r\n }\r\n } else if (typeof val === 'number') {\r\n sources.push({\r\n sourceLevelId: effectiveId,\r\n sourceLevelDataId: val,\r\n });\r\n }\r\n }\r\n\r\n const payload: ConnectionPayload | null =\r\n sources.length > 0 ? { levelId: cfg.targetLevelId, sources } : null;\r\n\r\n this.value.set(payload);\r\n this.onModelChange(payload);\r\n this.onTouched();\r\n }\r\n\r\n private distributeToSelections(payload: ConnectionPayload | null): void {\r\n const states = this.sourceLevelStates();\r\n for (const state of states) {\r\n const sourceId = this.getSourceId(state.source);\r\n const ids = (payload?.sources ?? [])\r\n .filter((s) => s.sourceLevelId === sourceId)\r\n .map((s) => s.sourceLevelDataId);\r\n\r\n this.selections[sourceId] = state.source.allowManyToMany\r\n ? ids\r\n : (ids[0] ?? null);\r\n }\r\n }\r\n\r\n // ============================================================================\r\n // ControlValueAccessor\r\n // ============================================================================\r\n\r\n writeValue(value: ConnectionPayload | string | null): void {\r\n if (typeof value === 'string') {\r\n try {\r\n value = JSON.parse(value) as ConnectionPayload;\r\n } catch {\r\n value = null;\r\n }\r\n }\r\n this.value.set(value ?? null);\r\n this.distributeToSelections(value ?? null);\r\n }\r\n\r\n registerOnChange(fn: (value: ConnectionPayload | null) => void): void {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean): void {\r\n this.disabled.set(disabled);\r\n }\r\n}\r\n","<!-- @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n} -->\r\n\r\n<div class=\"flex gap-4 w-full\">\r\n @for (state of sourceLevelStates(); track getSourceId(state.source)) {\r\n <div [style.width]=\"dropdownWidth()\" class=\"min-w-0\">\r\n @if (sourceLevelStates().length > 1) {\r\n <span class=\"text-sm text-muted-color mb-1 block truncate\">\r\n {{\r\n state.source.name?.en ||\r\n state.source.levelKey ||\r\n state.source.moduleKey\r\n }}\r\n </span>\r\n }\r\n\r\n @if (state.source.allowManyToMany) {\r\n <mt-multi-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[getSourceId(state.source)]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [showClear]=\"true\"\r\n display=\"chip\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[getSourceId(state.source)]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [loading]=\"state.loading\"\r\n [showClear]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","import { CommonModule } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n DestroyRef,\r\n effect,\r\n inject,\r\n input,\r\n linkedSignal,\r\n signal,\r\n TemplateRef,\r\n untracked,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { catchError, finalize, of } from 'rxjs';\r\nimport { TranslocoModule, TranslocoService } from '@jsverse/transloco';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { NumberField } from '@masterteam/components/number-field';\r\nimport { SelectField } from '@masterteam/components/select-field';\r\nimport {\r\n Table,\r\n type ColumnDef,\r\n type TableAction,\r\n} from '@masterteam/components/table';\r\nimport type { SchedulePredecessorFieldRuntimeContext } from '@masterteam/components';\r\n\r\ntype PredecessorType = 0 | 1 | 2 | 3;\r\ntype PredecessorTypeToken = 'FS' | 'SS' | 'FF' | 'SF';\r\n\r\ninterface ScheduleQueryRecord {\r\n id: number | string;\r\n name?: string | null;\r\n children?: ScheduleQueryRecord[] | null;\r\n}\r\n\r\ninterface ScheduleQueryData {\r\n records?: ScheduleQueryRecord[] | null;\r\n projectionMeta?: {\r\n rootIds?: Array<number | string> | null;\r\n } | null;\r\n}\r\n\r\ninterface ScheduleQueryResponse {\r\n data?: ScheduleQueryData | null;\r\n}\r\n\r\ninterface SchedulePredecessorValue {\r\n predecessorId: number | string;\r\n type: PredecessorType;\r\n lagDays: number;\r\n}\r\n\r\ninterface SchedulePredecessorRow extends SchedulePredecessorValue {\r\n key: string;\r\n}\r\n\r\ninterface SelectOption {\r\n label: string;\r\n value: number | string;\r\n}\r\n\r\nconst PREDECESSOR_TYPE_BY_TOKEN: Record<PredecessorTypeToken, PredecessorType> =\r\n {\r\n FS: 0,\r\n SS: 1,\r\n FF: 2,\r\n SF: 3,\r\n };\r\n\r\nconst PREDECESSOR_TOKEN_BY_TYPE: Record<PredecessorType, PredecessorTypeToken> =\r\n {\r\n 0: 'FS',\r\n 1: 'SS',\r\n 2: 'FF',\r\n 3: 'SF',\r\n };\r\n\r\n@Component({\r\n selector: 'mt-schedule-predecessor-field',\r\n standalone: true,\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n Button,\r\n FieldValidation,\r\n NumberField,\r\n SelectField,\r\n Table,\r\n TranslocoModule,\r\n ],\r\n templateUrl: './schedule-predecessor-field.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class SchedulePredecessorField implements ControlValueAccessor {\r\n private readonly predecessorCellTpl =\r\n viewChild.required<TemplateRef<any>>('predecessorCellTpl');\r\n private readonly typeCellTpl =\r\n viewChild.required<TemplateRef<any>>('typeCellTpl');\r\n private readonly lagCellTpl =\r\n viewChild.required<TemplateRef<any>>('lagCellTpl');\r\n\r\n readonly label = input<string>('');\r\n readonly placeholder = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly required = input<boolean>(false);\r\n readonly configuration = input<unknown>(null);\r\n readonly runtimeContext =\r\n input<SchedulePredecessorFieldRuntimeContext | null>(null);\r\n\r\n readonly loading = signal(false);\r\n readonly taskOptions = signal<SelectOption[]>([]);\r\n readonly rows = signal<SchedulePredecessorRow[]>([]);\r\n readonly disabled = signal(false);\r\n\r\n readonly typeOptions = computed<SelectOption[]>(() => [\r\n { label: 'FS', value: 0 },\r\n { label: 'SS', value: 1 },\r\n { label: 'FF', value: 2 },\r\n { label: 'SF', value: 3 },\r\n ]);\r\n\r\n readonly availableTaskOptions = computed(() => {\r\n const currentTaskId = this.runtimeContext()?.moduleDataId;\r\n return this.taskOptions().filter(\r\n (item) => String(item.value) !== String(currentTaskId ?? ''),\r\n );\r\n });\r\n\r\n readonly canAddRow = computed(\r\n () =>\r\n !!this.runtimeContext()?.levelId &&\r\n !!this.runtimeContext()?.levelDataId &&\r\n this.availableTaskOptions().length > 0,\r\n );\r\n\r\n readonly addTooltip = computed(() =>\r\n this.canAddRow() ? undefined : this.texts().noAvailable,\r\n );\r\n readonly pageSize = computed(() =>\r\n this.rows().length > 0 ? this.rows().length : 1,\r\n );\r\n\r\n readonly columns = linkedSignal<ColumnDef[]>(() => [\r\n {\r\n key: 'predecessorId',\r\n label: this.texts().predecessor,\r\n type: 'custom',\r\n customCellTpl: this.predecessorCellTpl(),\r\n },\r\n {\r\n key: 'type',\r\n label: this.texts().type,\r\n type: 'custom',\r\n customCellTpl: this.typeCellTpl(),\r\n },\r\n {\r\n key: 'lagDays',\r\n label: this.texts().lagDays,\r\n type: 'custom',\r\n customCellTpl: this.lagCellTpl(),\r\n },\r\n ]);\r\n\r\n readonly rowActions = computed<TableAction[]>(() => [\r\n {\r\n icon: 'general.trash-01',\r\n color: 'danger',\r\n variant: 'text',\r\n tooltip: this.texts().delete,\r\n hidden: () => this.disabled() || this.readonly(),\r\n action: (row) => this.removeRow(row.key),\r\n },\r\n ]);\r\n\r\n requiredValidator = Validators.required;\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: string | null) => void = () => {};\r\n\r\n public ngControl: NgControl | null = null;\r\n\r\n private readonly http = inject(HttpClient);\r\n private readonly transloco = inject(TranslocoService);\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly activeLang = toSignal(this.transloco.langChanges$, {\r\n initialValue: this.transloco.getActiveLang(),\r\n });\r\n private rowKey = 0;\r\n\r\n readonly texts = computed(() => {\r\n this.activeLang();\r\n\r\n return {\r\n noAvailable: this.transloco.translate(\r\n 'components.schedulePredecessorField.noAvailable',\r\n ),\r\n predecessor: this.transloco.translate(\r\n 'components.schedulePredecessorField.predecessor',\r\n ),\r\n type: this.transloco.translate(\r\n 'components.schedulePredecessorField.type',\r\n ),\r\n lagDays: this.transloco.translate(\r\n 'components.schedulePredecessorField.lagDays',\r\n ),\r\n delete: this.transloco.translate(\r\n 'components.schedulePredecessorField.delete',\r\n ),\r\n };\r\n });\r\n\r\n constructor() {\r\n this.ngControl = inject(NgControl, { self: true, optional: true });\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n\r\n effect(() => {\r\n if (this.ngControl?.control && this.required()) {\r\n this.ngControl.control.addValidators(Validators.required);\r\n this.ngControl.control.updateValueAndValidity();\r\n }\r\n });\r\n\r\n effect(() => {\r\n const context = this.runtimeContext();\r\n const levelId = context?.levelId;\r\n const levelDataId = context?.levelDataId;\r\n\r\n if (levelId == null || levelDataId == null) {\r\n this.taskOptions.set([]);\r\n return;\r\n }\r\n\r\n untracked(() => this.loadTaskOptions(levelId, levelDataId));\r\n });\r\n }\r\n\r\n addRow(): void {\r\n if (this.disabled() || this.readonly() || !this.canAddRow()) {\r\n return;\r\n }\r\n\r\n this.syncRows([\r\n ...this.rows(),\r\n {\r\n key: this.nextRowKey(),\r\n predecessorId: '',\r\n type: 0,\r\n lagDays: 0,\r\n },\r\n ]);\r\n }\r\n\r\n removeRow(key: string): void {\r\n if (this.disabled() || this.readonly()) {\r\n return;\r\n }\r\n\r\n this.syncRows(this.rows().filter((row) => row.key !== key));\r\n }\r\n\r\n updateRow(key: string, patch: Partial<SchedulePredecessorRow>): void {\r\n if (this.disabled() || this.readonly()) {\r\n return;\r\n }\r\n\r\n this.syncRows(\r\n this.rows().map((row) => (row.key === key ? { ...row, ...patch } : row)),\r\n );\r\n }\r\n\r\n writeValue(value: unknown): void {\r\n const rows =\r\n typeof value === 'string'\r\n ? value\r\n .split(',')\r\n .map((item) => item.trim())\r\n .filter(Boolean)\r\n .map((item) => this.parseCompactValue(item))\r\n .filter((item): item is SchedulePredecessorValue => item != null)\r\n .map((item) => ({\r\n key: this.nextRowKey(),\r\n ...item,\r\n }))\r\n : [];\r\n\r\n this.rows.set(rows);\r\n }\r\n\r\n registerOnChange(fn: (value: string | null) => void): void {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: () => void): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean): void {\r\n this.disabled.set(disabled);\r\n }\r\n\r\n private syncRows(rows: SchedulePredecessorRow[]): void {\r\n this.rows.set(rows);\r\n const value = rows\r\n .filter(\r\n (row) =>\r\n row.predecessorId !== null &&\r\n row.predecessorId !== undefined &&\r\n String(row.predecessorId).trim() !== '',\r\n )\r\n .map((row) => this.formatCompactValue(row))\r\n .join(',');\r\n\r\n this.onModelChange(value || null);\r\n this.onTouched();\r\n }\r\n\r\n private loadTaskOptions(\r\n levelId: number | string,\r\n levelDataId: number | string,\r\n ): void {\r\n this.loading.set(true);\r\n\r\n this.http\r\n .post<ScheduleQueryResponse>(\r\n `levels/${levelId}/${levelDataId}/schedule/query`,\r\n {\r\n projection: 'Tree',\r\n propertyKeys: ['name'],\r\n },\r\n )\r\n .pipe(\r\n takeUntilDestroyed(this.destroyRef),\r\n finalize(() => this.loading.set(false)),\r\n catchError(() => of({ data: { records: [] } })),\r\n )\r\n .subscribe((response) => {\r\n this.taskOptions.set(this.mapTaskOptions(response.data));\r\n });\r\n }\r\n\r\n private mapTaskOptions(\r\n data: ScheduleQueryData | null | undefined,\r\n ): SelectOption[] {\r\n return this.flattenRecords(\r\n this.resolveRootRecords(\r\n data?.records ?? [],\r\n data?.projectionMeta?.rootIds ?? [],\r\n ),\r\n ).map((record) => ({\r\n label: `${record.id} - ${record.name ?? record.id}`,\r\n value: String(record.id),\r\n }));\r\n }\r\n\r\n private resolveRootRecords(\r\n records: ScheduleQueryRecord[],\r\n rootIds: Array<number | string> | null | undefined,\r\n ): ScheduleQueryRecord[] {\r\n if (!rootIds?.length) {\r\n return records;\r\n }\r\n\r\n const recordsById = new Map(\r\n records.map((record) => [String(record.id), record]),\r\n );\r\n\r\n return rootIds\r\n .map((id) => recordsById.get(String(id)))\r\n .filter((record): record is ScheduleQueryRecord => record != null);\r\n }\r\n\r\n private flattenRecords(\r\n records: ScheduleQueryRecord[],\r\n ): ScheduleQueryRecord[] {\r\n const output: ScheduleQueryRecord[] = [];\r\n\r\n const walk = (items: ScheduleQueryRecord[]): void => {\r\n items.forEach((item) => {\r\n output.push(item);\r\n walk(item.children ?? []);\r\n });\r\n };\r\n\r\n walk(records);\r\n return output;\r\n }\r\n\r\n private nextRowKey(): string {\r\n this.rowKey += 1;\r\n return `predecessor-${this.rowKey}`;\r\n }\r\n\r\n private parseCompactValue(value: string): SchedulePredecessorValue | null {\r\n const match = value.match(/^(.+?)(FS|SS|FF|SF)([+-]\\d+)?$/);\r\n\r\n if (!match) {\r\n return null;\r\n }\r\n\r\n return {\r\n predecessorId: match[1],\r\n type: PREDECESSOR_TYPE_BY_TOKEN[match[2] as PredecessorTypeToken],\r\n lagDays: match[3] ? Number(match[3]) : 0,\r\n };\r\n }\r\n\r\n private formatCompactValue(row: SchedulePredecessorValue): string {\r\n const lag =\r\n row.lagDays > 0 ? `+${row.lagDays}` : row.lagDays < 0 ? row.lagDays : '';\r\n\r\n return `${row.predecessorId}${PREDECESSOR_TOKEN_BY_TYPE[row.type]}${lag}`;\r\n }\r\n}\r\n","@if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n<div class=\"grid gap-3\">\r\n <div class=\"flex items-center justify-end\">\r\n <mt-button\r\n icon=\"general.plus\"\r\n [label]=\"'components.schedulePredecessorField.add' | transloco\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [disabled]=\"disabled() || readonly() || !canAddRow()\"\r\n [tooltip]=\"addTooltip()\"\r\n (onClick)=\"addRow()\"\r\n />\r\n </div>\r\n\r\n <ng-template #predecessorCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"availableTaskOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [placeholder]=\"\r\n placeholder() ||\r\n ('components.schedulePredecessorField.selectPredecessor' | transloco)\r\n \"\r\n [filter]=\"true\"\r\n [showClear]=\"true\"\r\n [loading]=\"loading()\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.predecessorId || undefined\"\r\n (onChange)=\"updateRow(row.key, { predecessorId: $event ?? '' })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #typeCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"typeOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.type\"\r\n (onChange)=\"updateRow(row.key, { type: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #lagCellTpl let-row>\r\n <mt-number-field\r\n [field]=\"false\"\r\n [useGrouping]=\"false\"\r\n [placeholder]=\"'components.schedulePredecessorField.lagDays' | transloco\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.lagDays\"\r\n (ngModelChange)=\"updateRow(row.key, { lagDays: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"rowActions()\"\r\n [pageSize]=\"pageSize()\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [dataKey]=\"'key'\"\r\n storageKey=\"schedule-predecessor-field-table\"\r\n [loading]=\"loading()\"\r\n >\r\n <ng-template #empty>\r\n <div\r\n class=\"rounded-xl border border-dashed border-surface px-4 py-5 text-sm text-muted-color\"\r\n >\r\n {{ \"components.schedulePredecessorField.empty\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-table>\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;MA+Ba,iBAAiB,CAAA;AACnB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAA2B;AAE1C,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE;AAC3D,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;AACe,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,YAAY,GAAG,MAAM,CAAC,CAAC,mFAAC;AAEhC,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,IAAI,EAAE,+EAAC;AACvD,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,IAAI,EAAE,+EAAC;AACvD,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,gFAAC;IAC1D,OAAO,GAAG,QAAQ,CACzB,MACE,IAAI,GAAG,CACL,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK;QAChC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC;QACpD,IAAI;KACL,CAAC,CACH,8EACJ;AACQ,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAK;QACvC,IAAI,CAAC,YAAY,EAAE;QACnB,OAAO,IAAI,CAAC,qBAAqB,CAC/B,IAAI,CAAC,QAAQ,EAAE,EACf,IAAI,CAAC,eAAe,CAAC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,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,eAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEhHrD;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-components-business-fields.mjs","sources":["../../../../packages/masterteam/components/business-fields/lookup-matrix-field/lookup-matrix-field.ts","../../../../packages/masterteam/components/business-fields/lookup-matrix-field/lookup-matrix-field.html","../../../../packages/masterteam/components/business-fields/schema-connection-field/schema-connection-field.ts","../../../../packages/masterteam/components/business-fields/schema-connection-field/schema-connection-field.html","../../../../packages/masterteam/components/business-fields/schedule-predecessor-field/schedule-predecessor-field.ts","../../../../packages/masterteam/components/business-fields/schedule-predecessor-field/schedule-predecessor-field.html","../../../../packages/masterteam/components/business-fields/masterteam-components-business-fields.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n DestroyRef,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { ControlContainer } from '@angular/forms';\r\nimport { startWith } from 'rxjs';\r\nimport type {\r\n LookupMatrixCellConfig,\r\n LookupMatrixFieldConfig,\r\n LookupOptionItemConfig,\r\n} from '@masterteam/components';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\n\r\n@Component({\r\n selector: 'mt-lookup-matrix-field',\r\n standalone: true,\r\n imports: [CommonModule, Tooltip, Icon],\r\n templateUrl: './lookup-matrix-field.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-2',\r\n },\r\n})\r\nexport class LookupMatrixField {\r\n readonly config = input.required<LookupMatrixFieldConfig>();\r\n\r\n private readonly controlContainer = inject(ControlContainer, {\r\n optional: true,\r\n });\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly valueVersion = signal(0);\r\n\r\n readonly xOptions = computed(() => this.config().xOptions ?? []);\r\n readonly yOptions = computed(() => this.config().yOptions ?? []);\r\n readonly hasMatrix = computed(() => this.config().cells.length > 0);\r\n readonly cellMap = computed(\r\n () =>\r\n new Map(\r\n this.config().cells.map((cell) => [\r\n this.cellKey(cell.xLookupItemId, cell.yLookupItemId),\r\n cell,\r\n ]),\r\n ),\r\n );\r\n readonly selectedXOption = computed(() => {\r\n this.valueVersion();\r\n return this.resolveSelectedOption(\r\n this.xOptions(),\r\n this.getControlValue(this.config().xFieldKey),\r\n );\r\n });\r\n readonly selectedYOption = computed(() => {\r\n this.valueVersion();\r\n return this.resolveSelectedOption(\r\n this.yOptions(),\r\n this.getControlValue(this.config().yFieldKey),\r\n );\r\n });\r\n readonly activeCell = computed(() => {\r\n const selectedX = this.selectedXOption();\r\n const selectedY = this.selectedYOption();\r\n\r\n if (!selectedX || !selectedY) {\r\n return null;\r\n }\r\n\r\n return this.getCell(\r\n selectedX.id ?? selectedX.value,\r\n selectedY.id ?? selectedY.value,\r\n );\r\n });\r\n readonly selectionSummary = computed(() => {\r\n const parts: string[] = [];\r\n const xAxisLabel = this.config().xAxisLabel.trim() || 'X';\r\n const yAxisLabel = this.config().yAxisLabel.trim() || 'Y';\r\n const selectedX = this.selectedXOption();\r\n const selectedY = this.selectedYOption();\r\n\r\n if (selectedX) {\r\n parts.push(`${xAxisLabel}: ${selectedX.label}`);\r\n }\r\n\r\n if (selectedY) {\r\n parts.push(`${yAxisLabel}: ${selectedY.label}`);\r\n }\r\n\r\n return parts.join(' / ');\r\n });\r\n readonly pendingMessage = computed(() => {\r\n const xAxisLabel = this.config().xAxisLabel.trim() || 'the first value';\r\n const yAxisLabel = this.config().yAxisLabel.trim() || 'the second value';\r\n\r\n return `Select ${xAxisLabel} and ${yAxisLabel} first.`;\r\n });\r\n readonly missingResultMessage = computed(() => {\r\n if (!this.selectedXOption() || !this.selectedYOption()) {\r\n return this.pendingMessage();\r\n }\r\n\r\n return 'No matching value for the selected combination.';\r\n });\r\n\r\n constructor() {\r\n const control = this.controlContainer?.control;\r\n if (!control) return;\r\n\r\n control.valueChanges\r\n .pipe(\r\n startWith(control.getRawValue()),\r\n takeUntilDestroyed(this.destroyRef),\r\n )\r\n .subscribe(() => {\r\n this.valueVersion.update((value) => value + 1);\r\n });\r\n }\r\n\r\n getCell(\r\n xLookupItemId: number | string,\r\n yLookupItemId: number | string,\r\n ): LookupMatrixCellConfig | null {\r\n return (\r\n this.cellMap().get(this.cellKey(xLookupItemId, yLookupItemId)) ?? null\r\n );\r\n }\r\n\r\n getSwatchStyle(color?: string | null): Record<string, string> {\r\n const resolvedColor = this.resolveColor(color);\r\n if (!resolvedColor) return {};\r\n\r\n return {\r\n backgroundColor: resolvedColor,\r\n borderColor: resolvedColor,\r\n };\r\n }\r\n\r\n private getControlValue(path: string): unknown {\r\n if (!path) return null;\r\n return this.controlContainer?.control?.get(path)?.value ?? null;\r\n }\r\n\r\n private resolveSelectedOption(\r\n options: LookupOptionItemConfig[],\r\n rawValue: unknown,\r\n ): LookupOptionItemConfig | null {\r\n if (rawValue == null || rawValue === '') return null;\r\n\r\n return (\r\n options.find((option) => this.optionMatchesValue(option, rawValue)) ??\r\n null\r\n );\r\n }\r\n\r\n private optionMatchesValue(\r\n option: LookupOptionItemConfig,\r\n rawValue: unknown,\r\n ): boolean {\r\n return [option.value, option.key, option.id].some(\r\n (candidate) =>\r\n candidate != null && String(candidate) === String(rawValue),\r\n );\r\n }\r\n\r\n private cellKey(\r\n xLookupItemId: number | string,\r\n yLookupItemId: number | string,\r\n ): string {\r\n return `${String(xLookupItemId)}::${String(yLookupItemId)}`;\r\n }\r\n\r\n private resolveColor(color?: string | null): string | null {\r\n if (!color) return null;\r\n\r\n if (\r\n color.startsWith('#') ||\r\n color.startsWith('rgb') ||\r\n color.startsWith('hsl') ||\r\n color.startsWith('var(')\r\n ) {\r\n return color;\r\n }\r\n\r\n return `var(--p-${color}-500)`;\r\n }\r\n}\r\n","@if (config().label) {\r\n <label class=\"text-sm font-medium text-color\">\r\n {{ config().label }}\r\n </label>\r\n}\r\n\r\n<div\r\n class=\"rounded-lg border border-surface-200 bg-surface-50 px-3 flex items-center\"\r\n>\r\n @if (activeCell(); as cell) {\r\n <div class=\"flex flex-1 min-h-6 items-center gap-2 justify-between\">\r\n <span\r\n class=\"h-6 w-2 shrink-0 rounded-[2px] border border-surface-200\"\r\n [ngStyle]=\"getSwatchStyle(cell.color)\"\r\n ></span>\r\n\r\n <div class=\"min-w-0 flex-1 py-2 flex items-center justify-between\">\r\n <div class=\"truncate font-semibold text-gray-500\">\r\n {{ cell.label }}\r\n </div>\r\n\r\n @if (selectionSummary()) {\r\n <div class=\"font-bold text-gray-500\">\r\n <mt-icon\r\n [mtTooltip]=\"selectionSummary()\"\r\n icon=\"general.info-circle\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n } @else {\r\n <div class=\"flex min-h-6 items-center text-muted-color py-2\">\r\n {{ hasMatrix() ? missingResultMessage() : config().emptyMessage }}\r\n </div>\r\n }\r\n</div>\r\n","import {\r\n Component,\r\n signal,\r\n input,\r\n computed,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n untracked,\r\n DestroyRef,\r\n} from '@angular/core';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { SelectField } from '@masterteam/components/select-field';\r\nimport { MultiSelectField } from '@masterteam/components/multi-select-field';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { HttpClient, HttpContext } from '@angular/common/http';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { finalize, catchError, of } from 'rxjs';\r\n\r\n// ============================================================================\r\n// Types\r\n// ============================================================================\r\n\r\n/**\r\n * One source level inside connection configuration.\r\n * Comes from `field.propertyMetadata.configuration.sourceLevels[]`\r\n *\r\n * A source can be either a **level** (has `levelId`/`levelKey`) or a\r\n * **module** (has `moduleId`/`moduleKey`). Exactly one pair will be present.\r\n */\r\nexport interface ConnectionSourceLevel {\r\n /** Present for level-type sources */\r\n levelId?: number;\r\n /** Present for level-type sources */\r\n levelKey?: string;\r\n /** Present for module-type sources */\r\n moduleId?: number;\r\n /** Present for module-type sources */\r\n moduleKey?: string;\r\n name: { en?: string; ar?: string; [k: string]: string | undefined };\r\n connectionId: number;\r\n isOptional: boolean;\r\n allowManyToMany: boolean;\r\n supportWeights: boolean;\r\n optionsQuery: {\r\n path: string;\r\n method?: string;\r\n query?: Record<string, unknown>;\r\n };\r\n}\r\n\r\n/**\r\n * Full connection configuration from `field.propertyMetadata.configuration`.\r\n * This is passed as a single input to the component.\r\n */\r\nexport interface SchemaConnectionConfig {\r\n targetLevelId: number;\r\n sourceLevelId?: number;\r\n propertyKey?: string;\r\n valueMode?: string;\r\n sourceLevels: ConnectionSourceLevel[];\r\n payloadTemplate?: { levelId: number; sources: any[] };\r\n sourceItemShape?: Record<string, string>;\r\n}\r\n\r\n/** One selected source in the connection payload */\r\nexport interface ConnectionSource {\r\n sourceLevelId: number;\r\n sourceLevelDataId: number;\r\n}\r\n\r\n/** The value shape for a connection field */\r\nexport interface ConnectionPayload {\r\n levelId: number;\r\n sources: ConnectionSource[];\r\n}\r\n\r\n/**\r\n * Internal state tracked per source level dropdown.\r\n */\r\nexport interface SourceLevelState {\r\n source: ConnectionSourceLevel;\r\n options: any[];\r\n loading: boolean;\r\n}\r\n\r\n@Component({\r\n selector: 'mt-schema-connection-field',\r\n standalone: true,\r\n imports: [FormsModule, SelectField, MultiSelectField, FieldValidation],\r\n templateUrl: './schema-connection-field.html',\r\n styleUrls: ['./schema-connection-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class SchemaConnectionField implements ControlValueAccessor {\r\n // ============================================================================\r\n // Inputs\r\n // ============================================================================\r\n\r\n readonly label = input<string>('');\r\n readonly placeholder = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly required = input<boolean>(false);\r\n readonly filter = input<boolean>(true);\r\n\r\n /**\r\n * Full connection configuration object from the API.\r\n * Includes `targetLevelId`, `sourceLevels[]`, `payloadTemplate`, etc.\r\n */\r\n readonly configuration = input.required<SchemaConnectionConfig>();\r\n\r\n /**\r\n * Optional HttpContext for API requests (e.g. to set base URL behavior).\r\n */\r\n readonly context = input<HttpContext | undefined>(undefined);\r\n\r\n // ============================================================================\r\n // Internal State\r\n // ============================================================================\r\n\r\n /** The full ConnectionPayload value */\r\n value = signal<ConnectionPayload | null>(null);\r\n disabled = signal<boolean>(false);\r\n\r\n /** Per-source-level state: options + loading */\r\n sourceLevelStates = signal<SourceLevelState[]>([]);\r\n\r\n /** Mutable selections per source level: sourceLevelId -> selected value */\r\n selections: Record<number, any> = {};\r\n\r\n requiredValidator = Validators.required;\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: ConnectionPayload | null) => void = () => {};\r\n\r\n public ngControl: NgControl | null = null;\r\n private http = inject(HttpClient);\r\n private destroyRef = inject(DestroyRef);\r\n\r\n /**\r\n * Source levels from configuration.\r\n */\r\n readonly sourceLevels = computed<ConnectionSourceLevel[]>(() => {\r\n return this.configuration()?.sourceLevels ?? [];\r\n });\r\n\r\n /**\r\n * Percentage width for each dropdown, evenly divided.\r\n */\r\n readonly dropdownWidth = computed<string>(() => {\r\n const count = this.sourceLevels().length;\r\n if (count <= 0) return '100%';\r\n return `${100 / count}%`;\r\n });\r\n\r\n constructor() {\r\n this.ngControl = inject(NgControl, { self: true, optional: true });\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n\r\n effect(() => {\r\n if (this.ngControl?.control && this.required()) {\r\n this.ngControl.control.addValidators(Validators.required);\r\n this.ngControl.control.updateValueAndValidity();\r\n }\r\n });\r\n\r\n // Load options for each source level when configuration changes\r\n effect(() => {\r\n const levels = this.sourceLevels();\r\n if (!levels.length) return;\r\n\r\n // Everything below must NOT create signal dependencies,\r\n // only sourceLevels() (→ configuration) should trigger this effect.\r\n untracked(() => {\r\n // Initialize per-source states + selections\r\n this.sourceLevelStates.set(\r\n levels.map((source) => ({\r\n source,\r\n options: [],\r\n loading: false,\r\n })),\r\n );\r\n\r\n for (const source of levels) {\r\n const sourceId = this.getSourceId(source);\r\n if (!(sourceId in this.selections)) {\r\n this.selections[sourceId] = source.allowManyToMany ? [] : null;\r\n }\r\n }\r\n\r\n // Distribute existing value to selections\r\n this.distributeToSelections(this.value());\r\n\r\n // Load options for each source level\r\n for (const source of levels) {\r\n this.loadOptions(source);\r\n }\r\n });\r\n });\r\n }\r\n\r\n // ============================================================================\r\n // Source Level Helpers\r\n // ============================================================================\r\n\r\n /**\r\n * Returns a stable numeric ID for a source regardless of whether it is a\r\n * level (`levelId`) or a module (`moduleId`). Used as the key in `selections`\r\n * and `sourceLevelStates`.\r\n */\r\n protected getSourceId(source: ConnectionSourceLevel): number {\r\n return (source.levelId ?? source.moduleId)!;\r\n }\r\n\r\n /**\r\n * Builds the `contextKey` for the `fetch/query` request based on source type.\r\n */\r\n private getContextKey(source: ConnectionSourceLevel): string {\r\n return source.levelId != null\r\n ? `level:${source.levelId}`\r\n : `module:${source.moduleId}`;\r\n }\r\n\r\n // ============================================================================\r\n // Option Loading (per source level)\r\n // ============================================================================\r\n\r\n private loadOptions(source: ConnectionSourceLevel): void {\r\n this.updateSourceState(this.getSourceId(source), { loading: true });\r\n\r\n const ctx = this.context();\r\n const payload = {\r\n contextKey: this.getContextKey(source),\r\n projection: 'Flat',\r\n propertyKeys: ['name'],\r\n };\r\n\r\n this.http\r\n .post<unknown>('fetch/query', payload, {\r\n ...(ctx ? { context: ctx } : {}),\r\n })\r\n .pipe(\r\n takeUntilDestroyed(this.destroyRef),\r\n finalize(() =>\r\n this.updateSourceState(this.getSourceId(source), { loading: false }),\r\n ),\r\n catchError((err) => {\r\n console.error(\r\n `Connection options load failed for ${source.levelKey ?? source.moduleKey}:`,\r\n err,\r\n );\r\n return of({ data: { records: [] } });\r\n }),\r\n )\r\n .subscribe((response: any) => {\r\n const options = (response?.data?.records ?? [])\r\n .filter((record: any) => record?.id != null)\r\n .map((record: any) => ({\r\n ...record,\r\n id: record.id,\r\n name: record.name,\r\n }));\r\n\r\n this.updateSourceState(this.getSourceId(source), {\r\n options,\r\n loading: false,\r\n });\r\n });\r\n }\r\n\r\n private updateSourceState(\r\n sourceId: number,\r\n patch: Partial<Pick<SourceLevelState, 'options' | 'loading'>>,\r\n ): void {\r\n this.sourceLevelStates.update((states) =>\r\n states.map((s) =>\r\n this.getSourceId(s.source) === sourceId ? { ...s, ...patch } : s,\r\n ),\r\n );\r\n }\r\n\r\n // ============================================================================\r\n // Value Handling\r\n // ============================================================================\r\n\r\n /**\r\n * Single handler — no params. Reads all selections, builds the combined payload.\r\n */\r\n syncValue(): void {\r\n const cfg = this.configuration();\r\n const states = this.sourceLevelStates();\r\n const sources: ConnectionSource[] = [];\r\n\r\n for (const state of states) {\r\n const val = this.selections[this.getSourceId(state.source)];\r\n if (val == null) continue;\r\n\r\n const effectiveId = this.getSourceId(state.source);\r\n if (state.source.allowManyToMany && Array.isArray(val)) {\r\n for (const id of val) {\r\n sources.push({\r\n sourceLevelId: effectiveId,\r\n sourceLevelDataId: id,\r\n });\r\n }\r\n } else if (typeof val === 'number') {\r\n sources.push({\r\n sourceLevelId: effectiveId,\r\n sourceLevelDataId: val,\r\n });\r\n }\r\n }\r\n\r\n const payload: ConnectionPayload | null =\r\n sources.length > 0 ? { levelId: cfg.targetLevelId, sources } : null;\r\n\r\n this.value.set(payload);\r\n this.onModelChange(payload);\r\n this.onTouched();\r\n }\r\n\r\n private distributeToSelections(payload: ConnectionPayload | null): void {\r\n const states = this.sourceLevelStates();\r\n for (const state of states) {\r\n const sourceId = this.getSourceId(state.source);\r\n const ids = (payload?.sources ?? [])\r\n .filter((s) => s.sourceLevelId === sourceId)\r\n .map((s) => s.sourceLevelDataId);\r\n\r\n this.selections[sourceId] = state.source.allowManyToMany\r\n ? ids\r\n : (ids[0] ?? null);\r\n }\r\n }\r\n\r\n // ============================================================================\r\n // ControlValueAccessor\r\n // ============================================================================\r\n\r\n writeValue(value: ConnectionPayload | string | null): void {\r\n if (typeof value === 'string') {\r\n try {\r\n value = JSON.parse(value) as ConnectionPayload;\r\n } catch {\r\n value = null;\r\n }\r\n }\r\n this.value.set(value ?? null);\r\n this.distributeToSelections(value ?? null);\r\n }\r\n\r\n registerOnChange(fn: (value: ConnectionPayload | null) => void): void {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean): void {\r\n this.disabled.set(disabled);\r\n }\r\n}\r\n","<!-- @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n} -->\r\n\r\n<div class=\"flex gap-4 w-full\">\r\n @for (state of sourceLevelStates(); track getSourceId(state.source)) {\r\n <div [style.width]=\"dropdownWidth()\" class=\"min-w-0\">\r\n @if (sourceLevelStates().length > 1) {\r\n <span class=\"text-sm text-muted-color mb-1 block truncate\">\r\n {{\r\n state.source.name?.en ||\r\n state.source.levelKey ||\r\n state.source.moduleKey\r\n }}\r\n </span>\r\n }\r\n\r\n @if (state.source.allowManyToMany) {\r\n <mt-multi-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[getSourceId(state.source)]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [showClear]=\"true\"\r\n display=\"chip\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[getSourceId(state.source)]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [loading]=\"state.loading\"\r\n [showClear]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","import { CommonModule } from '@angular/common';\r\nimport {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n DestroyRef,\r\n effect,\r\n inject,\r\n input,\r\n linkedSignal,\r\n signal,\r\n TemplateRef,\r\n untracked,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n Validators,\r\n} from '@angular/forms';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { catchError, finalize, of } from 'rxjs';\r\nimport { TranslocoModule, TranslocoService } from '@jsverse/transloco';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { FieldValidation } from '@masterteam/components/field-validation';\r\nimport { NumberField } from '@masterteam/components/number-field';\r\nimport { SelectField } from '@masterteam/components/select-field';\r\nimport {\r\n Table,\r\n type ColumnDef,\r\n type TableAction,\r\n} from '@masterteam/components/table';\r\nimport type { SchedulePredecessorFieldRuntimeContext } from '@masterteam/components';\r\n\r\ntype PredecessorType = 0 | 1 | 2 | 3;\r\ntype PredecessorTypeToken = 'FS' | 'SS' | 'FF' | 'SF';\r\n\r\ninterface ScheduleQueryRecord {\r\n id: number | string;\r\n name?: string | null;\r\n children?: ScheduleQueryRecord[] | null;\r\n}\r\n\r\ninterface ScheduleQueryData {\r\n records?: ScheduleQueryRecord[] | null;\r\n projectionMeta?: {\r\n rootIds?: Array<number | string> | null;\r\n } | null;\r\n}\r\n\r\ninterface ScheduleQueryResponse {\r\n data?: ScheduleQueryData | null;\r\n}\r\n\r\ninterface SchedulePredecessorValue {\r\n predecessorId: number | string;\r\n type: PredecessorType;\r\n lagDays: number;\r\n}\r\n\r\ninterface SchedulePredecessorRow extends SchedulePredecessorValue {\r\n key: string;\r\n}\r\n\r\ninterface SelectOption {\r\n label: string;\r\n value: number | string;\r\n}\r\n\r\nconst PREDECESSOR_TYPE_BY_TOKEN: Record<PredecessorTypeToken, PredecessorType> =\r\n {\r\n FS: 0,\r\n SS: 1,\r\n FF: 2,\r\n SF: 3,\r\n };\r\n\r\nconst PREDECESSOR_TOKEN_BY_TYPE: Record<PredecessorType, PredecessorTypeToken> =\r\n {\r\n 0: 'FS',\r\n 1: 'SS',\r\n 2: 'FF',\r\n 3: 'SF',\r\n };\r\n\r\n@Component({\r\n selector: 'mt-schedule-predecessor-field',\r\n standalone: true,\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n Button,\r\n FieldValidation,\r\n NumberField,\r\n SelectField,\r\n Table,\r\n TranslocoModule,\r\n ],\r\n templateUrl: './schedule-predecessor-field.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class SchedulePredecessorField implements ControlValueAccessor {\r\n private readonly predecessorCellTpl =\r\n viewChild.required<TemplateRef<any>>('predecessorCellTpl');\r\n private readonly typeCellTpl =\r\n viewChild.required<TemplateRef<any>>('typeCellTpl');\r\n private readonly lagCellTpl =\r\n viewChild.required<TemplateRef<any>>('lagCellTpl');\r\n\r\n readonly label = input<string>('');\r\n readonly placeholder = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly required = input<boolean>(false);\r\n readonly configuration = input<unknown>(null);\r\n readonly runtimeContext =\r\n input<SchedulePredecessorFieldRuntimeContext | null>(null);\r\n\r\n readonly loading = signal(false);\r\n readonly taskOptions = signal<SelectOption[]>([]);\r\n readonly rows = signal<SchedulePredecessorRow[]>([]);\r\n readonly disabled = signal(false);\r\n\r\n readonly typeOptions = computed<SelectOption[]>(() => [\r\n { label: 'FS', value: 0 },\r\n { label: 'SS', value: 1 },\r\n { label: 'FF', value: 2 },\r\n { label: 'SF', value: 3 },\r\n ]);\r\n\r\n readonly availableTaskOptions = computed(() => {\r\n const currentTaskId = this.runtimeContext()?.moduleDataId;\r\n return this.taskOptions().filter(\r\n (item) => String(item.value) !== String(currentTaskId ?? ''),\r\n );\r\n });\r\n\r\n readonly canAddRow = computed(\r\n () =>\r\n !!this.runtimeContext()?.levelId &&\r\n !!this.runtimeContext()?.levelDataId &&\r\n this.availableTaskOptions().length > 0,\r\n );\r\n\r\n readonly addTooltip = computed(() =>\r\n this.canAddRow() ? undefined : this.texts().noAvailable,\r\n );\r\n readonly pageSize = computed(() =>\r\n this.rows().length > 0 ? this.rows().length : 1,\r\n );\r\n\r\n readonly columns = linkedSignal<ColumnDef[]>(() => [\r\n {\r\n key: 'predecessorId',\r\n label: this.texts().predecessor,\r\n type: 'custom',\r\n customCellTpl: this.predecessorCellTpl(),\r\n },\r\n {\r\n key: 'type',\r\n label: this.texts().type,\r\n type: 'custom',\r\n customCellTpl: this.typeCellTpl(),\r\n },\r\n {\r\n key: 'lagDays',\r\n label: this.texts().lagDays,\r\n type: 'custom',\r\n customCellTpl: this.lagCellTpl(),\r\n },\r\n ]);\r\n\r\n readonly rowActions = computed<TableAction[]>(() => [\r\n {\r\n icon: 'general.trash-01',\r\n color: 'danger',\r\n variant: 'text',\r\n tooltip: this.texts().delete,\r\n hidden: () => this.disabled() || this.readonly(),\r\n action: (row) => this.removeRow(row.key),\r\n },\r\n ]);\r\n\r\n requiredValidator = Validators.required;\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: string | null) => void = () => {};\r\n\r\n public ngControl: NgControl | null = null;\r\n\r\n private readonly http = inject(HttpClient);\r\n private readonly transloco = inject(TranslocoService);\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly activeLang = toSignal(this.transloco.langChanges$, {\r\n initialValue: this.transloco.getActiveLang(),\r\n });\r\n private rowKey = 0;\r\n\r\n readonly texts = computed(() => {\r\n this.activeLang();\r\n\r\n return {\r\n noAvailable: this.transloco.translate(\r\n 'components.schedulePredecessorField.noAvailable',\r\n ),\r\n predecessor: this.transloco.translate(\r\n 'components.schedulePredecessorField.predecessor',\r\n ),\r\n type: this.transloco.translate(\r\n 'components.schedulePredecessorField.type',\r\n ),\r\n lagDays: this.transloco.translate(\r\n 'components.schedulePredecessorField.lagDays',\r\n ),\r\n delete: this.transloco.translate(\r\n 'components.schedulePredecessorField.delete',\r\n ),\r\n };\r\n });\r\n\r\n constructor() {\r\n this.ngControl = inject(NgControl, { self: true, optional: true });\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n\r\n effect(() => {\r\n if (this.ngControl?.control && this.required()) {\r\n this.ngControl.control.addValidators(Validators.required);\r\n this.ngControl.control.updateValueAndValidity();\r\n }\r\n });\r\n\r\n effect(() => {\r\n const context = this.runtimeContext();\r\n const levelId = context?.levelId;\r\n const levelDataId = context?.levelDataId;\r\n\r\n if (levelId == null || levelDataId == null) {\r\n this.taskOptions.set([]);\r\n return;\r\n }\r\n\r\n untracked(() => this.loadTaskOptions(levelId, levelDataId));\r\n });\r\n }\r\n\r\n addRow(): void {\r\n if (this.disabled() || this.readonly() || !this.canAddRow()) {\r\n return;\r\n }\r\n\r\n this.syncRows([\r\n ...this.rows(),\r\n {\r\n key: this.nextRowKey(),\r\n predecessorId: '',\r\n type: 0,\r\n lagDays: 0,\r\n },\r\n ]);\r\n }\r\n\r\n removeRow(key: string): void {\r\n if (this.disabled() || this.readonly()) {\r\n return;\r\n }\r\n\r\n this.syncRows(this.rows().filter((row) => row.key !== key));\r\n }\r\n\r\n updateRow(key: string, patch: Partial<SchedulePredecessorRow>): void {\r\n if (this.disabled() || this.readonly()) {\r\n return;\r\n }\r\n\r\n this.syncRows(\r\n this.rows().map((row) => (row.key === key ? { ...row, ...patch } : row)),\r\n );\r\n }\r\n\r\n writeValue(value: unknown): void {\r\n const rows =\r\n typeof value === 'string'\r\n ? value\r\n .split(',')\r\n .map((item) => item.trim())\r\n .filter(Boolean)\r\n .map((item) => this.parseCompactValue(item))\r\n .filter((item): item is SchedulePredecessorValue => item != null)\r\n .map((item) => ({\r\n key: this.nextRowKey(),\r\n ...item,\r\n }))\r\n : [];\r\n\r\n this.rows.set(rows);\r\n }\r\n\r\n registerOnChange(fn: (value: string | null) => void): void {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: () => void): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean): void {\r\n this.disabled.set(disabled);\r\n }\r\n\r\n private syncRows(rows: SchedulePredecessorRow[]): void {\r\n this.rows.set(rows);\r\n const value = rows\r\n .filter(\r\n (row) =>\r\n row.predecessorId !== null &&\r\n row.predecessorId !== undefined &&\r\n String(row.predecessorId).trim() !== '',\r\n )\r\n .map((row) => this.formatCompactValue(row))\r\n .join(',');\r\n\r\n this.onModelChange(value || null);\r\n this.onTouched();\r\n }\r\n\r\n private loadTaskOptions(\r\n levelId: number | string,\r\n levelDataId: number | string,\r\n ): void {\r\n this.loading.set(true);\r\n\r\n this.http\r\n .post<ScheduleQueryResponse>(\r\n `levels/${levelId}/${levelDataId}/schedule/query`,\r\n {\r\n projection: 'Tree',\r\n propertyKeys: ['name'],\r\n },\r\n )\r\n .pipe(\r\n takeUntilDestroyed(this.destroyRef),\r\n finalize(() => this.loading.set(false)),\r\n catchError(() => of({ data: { records: [] } })),\r\n )\r\n .subscribe((response) => {\r\n this.taskOptions.set(this.mapTaskOptions(response.data));\r\n });\r\n }\r\n\r\n private mapTaskOptions(\r\n data: ScheduleQueryData | null | undefined,\r\n ): SelectOption[] {\r\n return this.flattenRecords(\r\n this.resolveRootRecords(\r\n data?.records ?? [],\r\n data?.projectionMeta?.rootIds ?? [],\r\n ),\r\n ).map((record) => ({\r\n label: `${record.id} - ${record.name ?? record.id}`,\r\n value: String(record.id),\r\n }));\r\n }\r\n\r\n private resolveRootRecords(\r\n records: ScheduleQueryRecord[],\r\n rootIds: Array<number | string> | null | undefined,\r\n ): ScheduleQueryRecord[] {\r\n if (!rootIds?.length) {\r\n return records;\r\n }\r\n\r\n const recordsById = new Map(\r\n records.map((record) => [String(record.id), record]),\r\n );\r\n\r\n return rootIds\r\n .map((id) => recordsById.get(String(id)))\r\n .filter((record): record is ScheduleQueryRecord => record != null);\r\n }\r\n\r\n private flattenRecords(\r\n records: ScheduleQueryRecord[],\r\n ): ScheduleQueryRecord[] {\r\n const output: ScheduleQueryRecord[] = [];\r\n\r\n const walk = (items: ScheduleQueryRecord[]): void => {\r\n items.forEach((item) => {\r\n output.push(item);\r\n walk(item.children ?? []);\r\n });\r\n };\r\n\r\n walk(records);\r\n return output;\r\n }\r\n\r\n private nextRowKey(): string {\r\n this.rowKey += 1;\r\n return `predecessor-${this.rowKey}`;\r\n }\r\n\r\n private parseCompactValue(value: string): SchedulePredecessorValue | null {\r\n const match = value.match(/^(.+?)(FS|SS|FF|SF)([+-]\\d+)?$/);\r\n\r\n if (!match) {\r\n return null;\r\n }\r\n\r\n return {\r\n predecessorId: match[1],\r\n type: PREDECESSOR_TYPE_BY_TOKEN[match[2] as PredecessorTypeToken],\r\n lagDays: match[3] ? Number(match[3]) : 0,\r\n };\r\n }\r\n\r\n private formatCompactValue(row: SchedulePredecessorValue): string {\r\n const lag =\r\n row.lagDays > 0 ? `+${row.lagDays}` : row.lagDays < 0 ? row.lagDays : '';\r\n\r\n return `${row.predecessorId}${PREDECESSOR_TOKEN_BY_TYPE[row.type]}${lag}`;\r\n }\r\n}\r\n","@if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n<div class=\"grid gap-3\">\r\n <div class=\"flex items-center justify-end\">\r\n <mt-button\r\n icon=\"general.plus\"\r\n [label]=\"'components.schedulePredecessorField.add' | transloco\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [disabled]=\"disabled() || readonly() || !canAddRow()\"\r\n [tooltip]=\"addTooltip()\"\r\n (onClick)=\"addRow()\"\r\n />\r\n </div>\r\n\r\n <ng-template #predecessorCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"availableTaskOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [placeholder]=\"\r\n placeholder() ||\r\n ('components.schedulePredecessorField.selectPredecessor' | transloco)\r\n \"\r\n [filter]=\"true\"\r\n [showClear]=\"true\"\r\n [loading]=\"loading()\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.predecessorId || undefined\"\r\n (onChange)=\"updateRow(row.key, { predecessorId: $event ?? '' })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #typeCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"typeOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.type\"\r\n (onChange)=\"updateRow(row.key, { type: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #lagCellTpl let-row>\r\n <mt-number-field\r\n [field]=\"false\"\r\n [useGrouping]=\"false\"\r\n [placeholder]=\"'components.schedulePredecessorField.lagDays' | transloco\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.lagDays\"\r\n (ngModelChange)=\"updateRow(row.key, { lagDays: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"rowActions()\"\r\n [pageSize]=\"pageSize()\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [dataKey]=\"'key'\"\r\n storageKey=\"schedule-predecessor-field-table\"\r\n [loading]=\"loading()\"\r\n >\r\n <ng-template #empty>\r\n <div\r\n class=\"rounded-xl border border-dashed border-surface px-4 py-5 text-sm text-muted-color\"\r\n >\r\n {{ \"components.schedulePredecessorField.empty\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-table>\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;MA+Ba,iBAAiB,CAAA;AACnB,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,4EAA2B;AAE1C,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE;AAC3D,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;AACe,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,YAAY,GAAG,MAAM,CAAC,CAAC,mFAAC;AAEhC,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,IAAI,EAAE,+EAAC;AACvD,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,IAAI,EAAE,+EAAC;AACvD,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,gFAAC;IAC1D,OAAO,GAAG,QAAQ,CACzB,MACE,IAAI,GAAG,CACL,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK;QAChC,IA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,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,eAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEhHrD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, computed, ChangeDetectionStrategy, Component, inject, signal, effect, ElementRef, NgZone, output, Directive, model } from '@angular/core';
2
+ import { input, computed, ChangeDetectionStrategy, Component, inject, signal, effect, output, ElementRef, NgZone, Directive, model } from '@angular/core';
3
3
  import { TruncateTooltip, Tooltip } from '@masterteam/components/tooltip';
4
4
  import { Icon } from '@masterteam/icons';
5
5
  import { MTDateFormatPipe, REQUEST_CONTEXT } from '@masterteam/components';
@@ -880,20 +880,19 @@ function buildDisplayEntities(entities) {
880
880
  .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
881
881
  }
882
882
 
883
- class EntityPreview {
884
- /** Single entity data to display */
883
+ class EntityPreviewBody {
885
884
  data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
886
885
  attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
887
886
  previewType = computed(() => {
888
887
  const viewType = this.data().viewType;
889
888
  return viewType === 'LookupMatrix' ? 'Lookup' : viewType;
890
889
  }, ...(ngDevMode ? [{ debugName: "previewType" }] : /* istanbul ignore next */ []));
891
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
892
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreview, isStandalone: true, selector: "mt-entity-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "w-full" }, ngImport: i0, template: "@switch (previewType()) {\r\n @case (\"Text\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"LongText\") {\r\n <mt-entity-long-text [data]=\"data()\" />\r\n }\r\n @case (\"Date\") {\r\n <mt-entity-date [data]=\"data()\" />\r\n }\r\n @case (\"DateTime\") {\r\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n }\r\n @case (\"User\") {\r\n <mt-entity-user [data]=\"data()\" />\r\n }\r\n @case (\"Percentage\") {\r\n <mt-entity-percentage [data]=\"data()\" />\r\n }\r\n @case (\"Currency\") {\r\n <mt-entity-currency [data]=\"data()\" />\r\n }\r\n @case (\"Checkbox\") {\r\n <mt-entity-checkbox [data]=\"data()\" />\r\n }\r\n @case (\"Lookup\") {\r\n <mt-entity-lookup [data]=\"data()\" />\r\n }\r\n @case (\"Status\") {\r\n <mt-entity-status [data]=\"data()\" />\r\n }\r\n @case (\"Attachment\") {\r\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n }\r\n @case (\"LeafDetails\") {\r\n <mt-entity-leaf-details [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n}\r\n", dependencies: [{ kind: "component", type: EntityText, selector: "mt-entity-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLongText, selector: "mt-entity-long-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityDate, selector: "mt-entity-date", inputs: ["data", "name", "value", "viewType"] }, { kind: "component", type: EntityUser, selector: "mt-entity-user", inputs: ["data"] }, { kind: "component", type: EntityPercentage, selector: "mt-entity-percentage", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityCurrency, selector: "mt-entity-currency", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityCheckbox, selector: "mt-entity-checkbox", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityLookup, selector: "mt-entity-lookup", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityAttachment, selector: "mt-entity-attachment", inputs: ["data", "name", "shape", "value", "endPoint", "context"] }, { kind: "component", type: EntityStatus, selector: "mt-entity-status", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLeafDetails, selector: "mt-entity-leaf-details", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
890
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreviewBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
891
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreviewBody, isStandalone: true, selector: "mt-entity-preview-body", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "w-full" }, ngImport: i0, template: "@switch (previewType()) {\n @case (\"Text\") {\n <mt-entity-text [data]=\"data()\" />\n }\n @case (\"LongText\") {\n <mt-entity-long-text [data]=\"data()\" />\n }\n @case (\"Date\") {\n <mt-entity-date [data]=\"data()\" />\n }\n @case (\"DateTime\") {\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\n }\n @case (\"User\") {\n <mt-entity-user [data]=\"data()\" />\n }\n @case (\"Percentage\") {\n <mt-entity-percentage [data]=\"data()\" />\n }\n @case (\"Currency\") {\n <mt-entity-currency [data]=\"data()\" />\n }\n @case (\"Checkbox\") {\n <mt-entity-checkbox [data]=\"data()\" />\n }\n @case (\"Lookup\") {\n <mt-entity-lookup [data]=\"data()\" />\n }\n @case (\"Status\") {\n <mt-entity-status [data]=\"data()\" />\n }\n @case (\"Attachment\") {\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\n }\n @case (\"LeafDetails\") {\n <mt-entity-leaf-details [data]=\"data()\" />\n }\n @default {\n <mt-entity-text [data]=\"data()\" />\n }\n}\n", dependencies: [{ kind: "component", type: EntityText, selector: "mt-entity-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLongText, selector: "mt-entity-long-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityDate, selector: "mt-entity-date", inputs: ["data", "name", "value", "viewType"] }, { kind: "component", type: EntityUser, selector: "mt-entity-user", inputs: ["data"] }, { kind: "component", type: EntityPercentage, selector: "mt-entity-percentage", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityCurrency, selector: "mt-entity-currency", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityCheckbox, selector: "mt-entity-checkbox", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityLookup, selector: "mt-entity-lookup", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityAttachment, selector: "mt-entity-attachment", inputs: ["data", "name", "shape", "value", "endPoint", "context"] }, { kind: "component", type: EntityStatus, selector: "mt-entity-status", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLeafDetails, selector: "mt-entity-leaf-details", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
893
892
  }
894
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, decorators: [{
893
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreviewBody, decorators: [{
895
894
  type: Component,
896
- args: [{ selector: 'mt-entity-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
895
+ args: [{ selector: 'mt-entity-preview-body', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
897
896
  EntityText,
898
897
  EntityLongText,
899
898
  EntityDate,
@@ -907,13 +906,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
907
906
  EntityLeafDetails,
908
907
  ], host: {
909
908
  class: 'w-full',
910
- }, template: "@switch (previewType()) {\r\n @case (\"Text\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"LongText\") {\r\n <mt-entity-long-text [data]=\"data()\" />\r\n }\r\n @case (\"Date\") {\r\n <mt-entity-date [data]=\"data()\" />\r\n }\r\n @case (\"DateTime\") {\r\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n }\r\n @case (\"User\") {\r\n <mt-entity-user [data]=\"data()\" />\r\n }\r\n @case (\"Percentage\") {\r\n <mt-entity-percentage [data]=\"data()\" />\r\n }\r\n @case (\"Currency\") {\r\n <mt-entity-currency [data]=\"data()\" />\r\n }\r\n @case (\"Checkbox\") {\r\n <mt-entity-checkbox [data]=\"data()\" />\r\n }\r\n @case (\"Lookup\") {\r\n <mt-entity-lookup [data]=\"data()\" />\r\n }\r\n @case (\"Status\") {\r\n <mt-entity-status [data]=\"data()\" />\r\n }\r\n @case (\"Attachment\") {\r\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n }\r\n @case (\"LeafDetails\") {\r\n <mt-entity-leaf-details [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n}\r\n" }]
909
+ }, template: "@switch (previewType()) {\n @case (\"Text\") {\n <mt-entity-text [data]=\"data()\" />\n }\n @case (\"LongText\") {\n <mt-entity-long-text [data]=\"data()\" />\n }\n @case (\"Date\") {\n <mt-entity-date [data]=\"data()\" />\n }\n @case (\"DateTime\") {\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\n }\n @case (\"User\") {\n <mt-entity-user [data]=\"data()\" />\n }\n @case (\"Percentage\") {\n <mt-entity-percentage [data]=\"data()\" />\n }\n @case (\"Currency\") {\n <mt-entity-currency [data]=\"data()\" />\n }\n @case (\"Checkbox\") {\n <mt-entity-checkbox [data]=\"data()\" />\n }\n @case (\"Lookup\") {\n <mt-entity-lookup [data]=\"data()\" />\n }\n @case (\"Status\") {\n <mt-entity-status [data]=\"data()\" />\n }\n @case (\"Attachment\") {\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\n }\n @case (\"LeafDetails\") {\n <mt-entity-leaf-details [data]=\"data()\" />\n }\n @default {\n <mt-entity-text [data]=\"data()\" />\n }\n}\n" }]
910
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
911
+
912
+ class ComparisonValue {
913
+ data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
914
+ comparison = computed(() => {
915
+ const c = this.data().comparison;
916
+ return c?.kind === 'Value' ? c : null;
917
+ }, ...(ngDevMode ? [{ debugName: "comparison" }] : /* istanbul ignore next */ []));
918
+ oldEntity = computed(() => this.buildSide(this.comparison()?.oldValue), ...(ngDevMode ? [{ debugName: "oldEntity" }] : /* istanbul ignore next */ []));
919
+ newEntity = computed(() => this.buildSide(this.comparison()?.newValue), ...(ngDevMode ? [{ debugName: "newEntity" }] : /* istanbul ignore next */ []));
920
+ buildSide(side) {
921
+ if (!side)
922
+ return null;
923
+ const base = this.data();
924
+ return {
925
+ ...base,
926
+ rawValue: side.raw === null || side.raw === undefined
927
+ ? undefined
928
+ : String(side.raw),
929
+ value: (side.display ?? side.value ?? ''),
930
+ comparison: undefined,
931
+ };
932
+ }
933
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ComparisonValue, deps: [], target: i0.ɵɵFactoryTarget.Component });
934
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: ComparisonValue, isStandalone: true, selector: "mt-comparison-value", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "block w-full" }, ngImport: i0, template: "@if (comparison(); as cmp) {\n <div class=\"flex w-full min-w-0 items-stretch gap-3\">\n <div\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\n >\n <span class=\"text-xs font-medium uppercase tracking-wide text-muted-color\"\n >Before</span\n >\n @if (oldEntity(); as old) {\n <mt-entity-preview-body [data]=\"old\" />\n } @else {\n <span class=\"text-sm text-muted-color\">_</span>\n }\n </div>\n <div class=\"flex shrink-0 items-center text-muted-color\" aria-hidden=\"true\">\n &rarr;\n </div>\n <div\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-primary-200 bg-primary-50 px-3 py-2\"\n >\n <span class=\"text-xs font-medium uppercase tracking-wide text-primary-600\"\n >After</span\n >\n @if (newEntity(); as next) {\n <mt-entity-preview-body [data]=\"next\" />\n } @else {\n <span class=\"text-sm text-muted-color\">_</span>\n }\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
935
+ }
936
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ComparisonValue, decorators: [{
937
+ type: Component,
938
+ args: [{ selector: 'mt-comparison-value', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityPreviewBody], host: {
939
+ class: 'block w-full',
940
+ }, template: "@if (comparison(); as cmp) {\n <div class=\"flex w-full min-w-0 items-stretch gap-3\">\n <div\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\n >\n <span class=\"text-xs font-medium uppercase tracking-wide text-muted-color\"\n >Before</span\n >\n @if (oldEntity(); as old) {\n <mt-entity-preview-body [data]=\"old\" />\n } @else {\n <span class=\"text-sm text-muted-color\">_</span>\n }\n </div>\n <div class=\"flex shrink-0 items-center text-muted-color\" aria-hidden=\"true\">\n &rarr;\n </div>\n <div\n class=\"flex min-w-0 flex-1 flex-col gap-1 rounded-md border border-primary-200 bg-primary-50 px-3 py-2\"\n >\n <span class=\"text-xs font-medium uppercase tracking-wide text-primary-600\"\n >After</span\n >\n @if (newEntity(); as next) {\n <mt-entity-preview-body [data]=\"next\" />\n } @else {\n <span class=\"text-sm text-muted-color\">_</span>\n }\n </div>\n </div>\n}\n" }]
941
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }] } });
942
+
943
+ const OPERATION_BADGES = {
944
+ CreateRecord: {
945
+ label: 'Added',
946
+ classes: 'bg-emerald-50 text-emerald-700 ring-1 ring-inset ring-emerald-200',
947
+ },
948
+ UpdateRecord: {
949
+ label: 'Updated',
950
+ classes: 'bg-amber-50 text-amber-700 ring-1 ring-inset ring-amber-200',
951
+ },
952
+ DeleteRecord: {
953
+ label: 'Removed',
954
+ classes: 'bg-rose-50 text-rose-700 ring-1 ring-inset ring-rose-200',
955
+ },
956
+ };
957
+ class ComparisonEntityList {
958
+ data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
959
+ comparison = computed(() => {
960
+ const c = this.data().comparison;
961
+ return c?.kind === 'EntityList' ? c : null;
962
+ }, ...(ngDevMode ? [{ debugName: "comparison" }] : /* istanbul ignore next */ []));
963
+ rows = computed(() => this.comparison()?.rows ?? [], ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
964
+ targetModuleKey = computed(() => this.comparison()?.targetModuleKey ?? '', ...(ngDevMode ? [{ debugName: "targetModuleKey" }] : /* istanbul ignore next */ []));
965
+ label = computed(() => this.data().name ?? '', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
966
+ badgeFor(op) {
967
+ return OPERATION_BADGES[op];
968
+ }
969
+ displayField(value, display) {
970
+ if (display && display.trim().length > 0)
971
+ return display;
972
+ return displayOrPlaceholder(value);
973
+ }
974
+ rowId(_i, row) {
975
+ return row.entityId ?? _i;
976
+ }
977
+ oldField(row, propertyKey) {
978
+ return row.oldValues.find((v) => v.propertyKey === propertyKey);
979
+ }
980
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ComparisonEntityList, deps: [], target: i0.ɵɵFactoryTarget.Component });
981
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: ComparisonEntityList, isStandalone: true, selector: "mt-comparison-entity-list", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "block w-full" }, ngImport: i0, template: "@if (comparison(); as cmp) {\n <div class=\"flex w-full min-w-0 flex-col gap-2\">\n @if (label()) {\n <div class=\"flex items-baseline justify-between\">\n <span class=\"text-sm font-medium text-color\">{{ label() }}</span>\n @if (targetModuleKey()) {\n <span class=\"text-xs text-muted-color\">{{ targetModuleKey() }}</span>\n }\n </div>\n }\n @if (rows().length === 0) {\n <div class=\"text-sm text-muted-color\">_</div>\n } @else {\n <ul class=\"flex flex-col gap-2\">\n @for (row of rows(); track rowId($index, row)) {\n <li\n class=\"flex flex-col gap-2 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\n >\n <div class=\"flex items-center justify-between gap-2\">\n <span\n class=\"inline-flex items-center rounded px-2 py-0.5 text-xs font-medium\"\n [class]=\"badgeFor(row.operation).classes\"\n >\n {{ badgeFor(row.operation).label }}\n </span>\n <span class=\"text-xs text-muted-color\">#{{ row.entityId }}</span>\n </div>\n\n @switch (row.operation) {\n @case (\"CreateRecord\") {\n <dl class=\"grid grid-cols-1 gap-1 sm:grid-cols-2\">\n @for (f of row.newValues; track f.propertyKey) {\n <div class=\"flex min-w-0 flex-col\">\n <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\n <dd class=\"truncate text-sm text-color\">\n {{ displayField(f.value, f.display) }}\n </dd>\n </div>\n }\n </dl>\n }\n @case (\"DeleteRecord\") {\n <dl class=\"grid grid-cols-1 gap-1 sm:grid-cols-2\">\n @for (f of row.oldValues; track f.propertyKey) {\n <div class=\"flex min-w-0 flex-col\">\n <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\n <dd class=\"truncate text-sm text-color line-through\">\n {{ displayField(f.value, f.display) }}\n </dd>\n </div>\n }\n </dl>\n }\n @default {\n <dl class=\"flex flex-col gap-1\">\n @for (f of row.newValues; track f.propertyKey) {\n <div class=\"flex min-w-0 flex-col\">\n <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\n <dd class=\"flex min-w-0 flex-wrap items-center gap-2\">\n <span\n class=\"max-w-[40%] truncate text-sm text-muted-color line-through\"\n >\n {{\n displayField(\n $any(oldField(row, f.propertyKey))?.value,\n $any(oldField(row, f.propertyKey))?.display\n )\n }}\n </span>\n <span class=\"text-muted-color\" aria-hidden=\"true\"\n >&rarr;</span\n >\n <span class=\"max-w-[40%] truncate text-sm text-color\">\n {{ displayField(f.value, f.display) }}\n </span>\n </dd>\n </div>\n }\n </dl>\n }\n }\n </li>\n }\n </ul>\n }\n </div>\n}\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
982
+ }
983
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ComparisonEntityList, decorators: [{
984
+ type: Component,
985
+ args: [{ selector: 'mt-comparison-entity-list', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [], host: {
986
+ class: 'block w-full',
987
+ }, template: "@if (comparison(); as cmp) {\n <div class=\"flex w-full min-w-0 flex-col gap-2\">\n @if (label()) {\n <div class=\"flex items-baseline justify-between\">\n <span class=\"text-sm font-medium text-color\">{{ label() }}</span>\n @if (targetModuleKey()) {\n <span class=\"text-xs text-muted-color\">{{ targetModuleKey() }}</span>\n }\n </div>\n }\n @if (rows().length === 0) {\n <div class=\"text-sm text-muted-color\">_</div>\n } @else {\n <ul class=\"flex flex-col gap-2\">\n @for (row of rows(); track rowId($index, row)) {\n <li\n class=\"flex flex-col gap-2 rounded-md border border-surface-200 bg-surface-50 px-3 py-2\"\n >\n <div class=\"flex items-center justify-between gap-2\">\n <span\n class=\"inline-flex items-center rounded px-2 py-0.5 text-xs font-medium\"\n [class]=\"badgeFor(row.operation).classes\"\n >\n {{ badgeFor(row.operation).label }}\n </span>\n <span class=\"text-xs text-muted-color\">#{{ row.entityId }}</span>\n </div>\n\n @switch (row.operation) {\n @case (\"CreateRecord\") {\n <dl class=\"grid grid-cols-1 gap-1 sm:grid-cols-2\">\n @for (f of row.newValues; track f.propertyKey) {\n <div class=\"flex min-w-0 flex-col\">\n <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\n <dd class=\"truncate text-sm text-color\">\n {{ displayField(f.value, f.display) }}\n </dd>\n </div>\n }\n </dl>\n }\n @case (\"DeleteRecord\") {\n <dl class=\"grid grid-cols-1 gap-1 sm:grid-cols-2\">\n @for (f of row.oldValues; track f.propertyKey) {\n <div class=\"flex min-w-0 flex-col\">\n <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\n <dd class=\"truncate text-sm text-color line-through\">\n {{ displayField(f.value, f.display) }}\n </dd>\n </div>\n }\n </dl>\n }\n @default {\n <dl class=\"flex flex-col gap-1\">\n @for (f of row.newValues; track f.propertyKey) {\n <div class=\"flex min-w-0 flex-col\">\n <dt class=\"text-xs text-muted-color\">{{ f.label }}</dt>\n <dd class=\"flex min-w-0 flex-wrap items-center gap-2\">\n <span\n class=\"max-w-[40%] truncate text-sm text-muted-color line-through\"\n >\n {{\n displayField(\n $any(oldField(row, f.propertyKey))?.value,\n $any(oldField(row, f.propertyKey))?.display\n )\n }}\n </span>\n <span class=\"text-muted-color\" aria-hidden=\"true\"\n >&rarr;</span\n >\n <span class=\"max-w-[40%] truncate text-sm text-color\">\n {{ displayField(f.value, f.display) }}\n </span>\n </dd>\n </div>\n }\n </dl>\n }\n }\n </li>\n }\n </ul>\n }\n </div>\n}\n" }]
988
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }] } });
989
+
990
+ class EntityPreview {
991
+ data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
992
+ attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
993
+ comparisonKind = computed(() => {
994
+ const c = this.data().comparison;
995
+ if (!c)
996
+ return null;
997
+ if (c.kind === 'Value')
998
+ return 'Value';
999
+ if (c.kind === 'EntityList')
1000
+ return 'EntityList';
1001
+ return null;
1002
+ }, ...(ngDevMode ? [{ debugName: "comparisonKind" }] : /* istanbul ignore next */ []));
1003
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
1004
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreview, isStandalone: true, selector: "mt-entity-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "w-full" }, ngImport: i0, template: "@switch (comparisonKind()) {\n @case (\"Value\") {\n <mt-comparison-value [data]=\"data()\" />\n }\n @case (\"EntityList\") {\n <mt-comparison-entity-list [data]=\"data()\" />\n }\n @default {\n <mt-entity-preview-body\n [data]=\"data()\"\n [attachmentShape]=\"attachmentShape()\"\n />\n }\n}\n", dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"] }, { kind: "component", type: ComparisonValue, selector: "mt-comparison-value", inputs: ["data"] }, { kind: "component", type: ComparisonEntityList, selector: "mt-comparison-entity-list", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1005
+ }
1006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, decorators: [{
1007
+ type: Component,
1008
+ args: [{ selector: 'mt-entity-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityPreviewBody, ComparisonValue, ComparisonEntityList], host: {
1009
+ class: 'w-full',
1010
+ }, template: "@switch (comparisonKind()) {\n @case (\"Value\") {\n <mt-comparison-value [data]=\"data()\" />\n }\n @case (\"EntityList\") {\n <mt-comparison-entity-list [data]=\"data()\" />\n }\n @default {\n <mt-entity-preview-body\n [data]=\"data()\"\n [attachmentShape]=\"attachmentShape()\"\n />\n }\n}\n" }]
911
1011
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
912
1012
 
1013
+ const EMPTY_KEY_SET = new Set();
913
1014
  class EntitiesPreview {
914
1015
  /** Array of entity data to display */
915
1016
  entities = input.required(...(ngDevMode ? [{ debugName: "entities" }] : /* istanbul ignore next */ []));
916
1017
  attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
1018
+ /**
1019
+ * Set of entity keys that should appear interactive (cursor pointer,
1020
+ * clicks emit). Pass `new Set([...])` from a computed signal in the host
1021
+ * for reactive enabling — when the host's set changes, Angular re-renders
1022
+ * via its normal change detection, no manual subscriptions required.
1023
+ */
1024
+ clickableKeys = input(EMPTY_KEY_SET, ...(ngDevMode ? [{ debugName: "clickableKeys" }] : /* istanbul ignore next */ []));
1025
+ /**
1026
+ * Set of entity keys that should render with the "active" treatment
1027
+ * (e.g. currently the filter source). Same reactive pattern as
1028
+ * `clickableKeys` — host owns a computed signal and passes the value.
1029
+ */
1030
+ activeKeys = input(EMPTY_KEY_SET, ...(ngDevMode ? [{ debugName: "activeKeys" }] : /* istanbul ignore next */ []));
1031
+ /**
1032
+ * Emits when an individual entity slot is clicked. Only fires when the
1033
+ * entity's key is present in `clickableKeys`.
1034
+ */
1035
+ entityClick = output();
917
1036
  /** Entities expanded and sorted by order */
918
1037
  displayEntities = computed(() => buildDisplayEntities(this.entities()), ...(ngDevMode ? [{ debugName: "displayEntities" }] : /* istanbul ignore next */ []));
919
1038
  /** Returns the grid-column span for a given entity size (1-24) */
@@ -921,13 +1040,37 @@ class EntitiesPreview {
921
1040
  const size = entity.configuration?.size ?? 8;
922
1041
  return `span ${size}`;
923
1042
  }
1043
+ /** Stable key resolution shared with the host — must agree on order. */
1044
+ resolveKey(entity) {
1045
+ const candidate = entity;
1046
+ const key = (typeof candidate['key'] === 'string' && candidate['key']) ||
1047
+ (typeof candidate['normalizedKey'] === 'string' &&
1048
+ candidate['normalizedKey']) ||
1049
+ entity.name;
1050
+ return key ? String(key) : '';
1051
+ }
1052
+ isClickable(entity) {
1053
+ const key = this.resolveKey(entity);
1054
+ return key.length > 0 && this.clickableKeys().has(key);
1055
+ }
1056
+ isActive(entity) {
1057
+ const key = this.resolveKey(entity);
1058
+ return key.length > 0 && this.activeKeys().has(key);
1059
+ }
1060
+ onEntityClick(source, entity) {
1061
+ const key = this.resolveKey(entity);
1062
+ if (!key || !this.clickableKeys().has(key))
1063
+ return;
1064
+ source.stopPropagation();
1065
+ this.entityClick.emit({ entity, key, source });
1066
+ }
924
1067
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
925
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesPreview, isStandalone: true, selector: "mt-entities-preview", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n <div\r\n class=\"min-w-0 flex items-center\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.p-3]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-200]=\"entity.configuration?.showBorder\"\r\n [class.rounded-lg]=\"entity.configuration?.showBorder\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }] });
1068
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntitiesPreview, isStandalone: true, selector: "mt-entities-preview", inputs: { entities: { classPropertyName: "entities", publicName: "entities", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null }, clickableKeys: { classPropertyName: "clickableKeys", publicName: "clickableKeys", isSignal: true, isRequired: false, transformFunction: null }, activeKeys: { classPropertyName: "activeKeys", publicName: "activeKeys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { entityClick: "entityClick" }, ngImport: i0, template: "<div class=\"grid grid-cols-24 gap-x-3 gap-y-5\">\n @for (\n entity of displayEntities();\n track entity.key ?? entity.order ?? $index\n ) {\n <div\n class=\"min-w-0 flex items-center rounded transition-colors\"\n [class.border]=\"entity.configuration?.showBorder\"\n [class.p-3]=\"entity.configuration?.showBorder\"\n [class.border-dashed]=\"entity.configuration?.showBorder\"\n [class.border-gray-200]=\"entity.configuration?.showBorder\"\n [class.rounded-lg]=\"entity.configuration?.showBorder\"\n [class.cursor-pointer]=\"isClickable(entity)\"\n [class.ring-2]=\"isActive(entity)\"\n [class.ring-primary-400]=\"isActive(entity)\"\n [attr.data-row-click-ignore]=\"isClickable(entity) ? 'true' : null\"\n [style.grid-column]=\"getColSpan(entity)\"\n (click)=\"onEntityClick($event, entity)\"\n >\n <mt-entity-preview\n [data]=\"entity\"\n [attachmentShape]=\"attachmentShape()\"\n />\n </div>\n }\n</div>\n", dependencies: [{ kind: "component", type: EntityPreview, selector: "mt-entity-preview", inputs: ["data", "attachmentShape"] }] });
926
1069
  }
927
1070
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntitiesPreview, decorators: [{
928
1071
  type: Component,
929
- args: [{ selector: 'mt-entities-preview', standalone: true, imports: [EntityPreview], template: "<div class=\"grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (\r\n entity of displayEntities();\r\n track entity.key ?? entity.order ?? $index\r\n ) {\r\n <div\r\n class=\"min-w-0 flex items-center\"\r\n [class.border]=\"entity.configuration?.showBorder\"\r\n [class.p-3]=\"entity.configuration?.showBorder\"\r\n [class.border-dashed]=\"entity.configuration?.showBorder\"\r\n [class.border-gray-200]=\"entity.configuration?.showBorder\"\r\n [class.rounded-lg]=\"entity.configuration?.showBorder\"\r\n [style.grid-column]=\"getColSpan(entity)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n</div>\r\n" }]
930
- }], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
1072
+ args: [{ selector: 'mt-entities-preview', standalone: true, imports: [EntityPreview], template: "<div class=\"grid grid-cols-24 gap-x-3 gap-y-5\">\n @for (\n entity of displayEntities();\n track entity.key ?? entity.order ?? $index\n ) {\n <div\n class=\"min-w-0 flex items-center rounded transition-colors\"\n [class.border]=\"entity.configuration?.showBorder\"\n [class.p-3]=\"entity.configuration?.showBorder\"\n [class.border-dashed]=\"entity.configuration?.showBorder\"\n [class.border-gray-200]=\"entity.configuration?.showBorder\"\n [class.rounded-lg]=\"entity.configuration?.showBorder\"\n [class.cursor-pointer]=\"isClickable(entity)\"\n [class.ring-2]=\"isActive(entity)\"\n [class.ring-primary-400]=\"isActive(entity)\"\n [attr.data-row-click-ignore]=\"isClickable(entity) ? 'true' : null\"\n [style.grid-column]=\"getColSpan(entity)\"\n (click)=\"onEntityClick($event, entity)\"\n >\n <mt-entity-preview\n [data]=\"entity\"\n [attachmentShape]=\"attachmentShape()\"\n />\n </div>\n }\n</div>\n" }]
1073
+ }], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }], clickableKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableKeys", required: false }] }], activeKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeKeys", required: false }] }], entityClick: [{ type: i0.Output, args: ["entityClick"] }] } });
931
1074
 
932
1075
  /**
933
1076
  * Base class that encapsulates all entity resize-via-drag logic.
@@ -1112,5 +1255,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1112
1255
  * Generated bundle index. Do not edit.
1113
1256
  */
1114
1257
 
1115
- export { EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLongText, EntityLookup, EntityPercentage, EntityPreview, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, buildDisplayEntities, expandLeafDetailsEntity, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue };
1258
+ export { ComparisonEntityList, ComparisonValue, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLongText, EntityLookup, EntityPercentage, EntityPreview, EntityPreviewBody, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, buildDisplayEntities, expandLeafDetailsEntity, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue };
1116
1259
  //# sourceMappingURL=masterteam-components-entities.mjs.map