@masterteam/components 0.0.342 → 0.0.344

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,9 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { InjectionToken, Type, ElementRef, NgZone, Signal } from '@angular/core';
2
+ import { InjectionToken, Type, Signal, OnInit, ElementRef, NgZone } from '@angular/core';
3
3
  import * as _masterteam_components_entities from '@masterteam/components/entities';
4
4
  import { MTDateFormatType } from '@masterteam/components';
5
5
  import { MTIcon } from '@masterteam/icons';
6
6
  import { HttpContext } from '@angular/common/http';
7
+ import { Observable } from 'rxjs';
7
8
  import { CdkDragDrop } from '@angular/cdk/drag-drop';
8
9
  import { TranslocoService } from '@jsverse/transloco';
9
10
 
@@ -95,6 +96,184 @@ declare class EntityRuntimeContextStore {
95
96
  */
96
97
  declare const ENTITY_LIST_TABLE_COMPONENT: InjectionToken<Type<unknown>>;
97
98
 
99
+ /**
100
+ * The record a calculated value was read from. Set on `EntityData` by a host
101
+ * that knows it (a record preview), so the value's calculated-value mark can
102
+ * explain how the saved value was calculated.
103
+ */
104
+ interface EntityCalculationSource {
105
+ /** The fetch context the record was read from: `level:12`, `level:12/module:5`. */
106
+ contextKey: string;
107
+ /** The level-data or module-data id. */
108
+ recordId: number;
109
+ }
110
+ /** What `mt-entity-calculated-indicator` needs to open an explanation. */
111
+ interface EntityCalculationExplanationTarget {
112
+ source: EntityCalculationSource;
113
+ /** The canonical property key. */
114
+ propertyKey: string;
115
+ /** The field label, shown as the explanation's title. */
116
+ label: string;
117
+ /** The raw value on screen, compared with the saved one. */
118
+ displayedValue: string | undefined;
119
+ /** How the value is shown, when the response does not say. */
120
+ viewType?: string;
121
+ /**
122
+ * Names of status keys the host already knows (the value on screen), so a
123
+ * status rule reads as its name rather than its key.
124
+ */
125
+ statusNames?: Record<string, string>;
126
+ }
127
+ /**
128
+ * `GET properties/calculation-explanation`. The backend returns these as
129
+ * camelCase strings; anything else is treated as unavailable.
130
+ */
131
+ type CalculationExplanationStatus = 'available' | 'notCaptured' | 'unsupported' | 'limitExceeded' | 'restricted' | 'valueChanged' | 'notCalculated';
132
+ /**
133
+ * What the explanation describes. `savedCalculation` is the calculation that
134
+ * produced the persisted value; `currentCalculation` evaluates current data
135
+ * read-only (native schedule fields) and claims no saved revision.
136
+ */
137
+ type CalculationExplanationBasis = 'savedCalculation' | 'currentCalculation';
138
+ /** A JSON value captured by the backend, shown as plain text. */
139
+ type CalculationExplanationValue = string | number | boolean | null | CalculationExplanationValue[] | {
140
+ [key: string]: CalculationExplanationValue;
141
+ };
142
+ /**
143
+ * Current, authorized display metadata of a property. Names are today's, not
144
+ * the ones at calculation time; the numbers always come from the calculation.
145
+ */
146
+ interface CalculationPropertyDisplay {
147
+ key: string;
148
+ name: string;
149
+ nameEn: string | null;
150
+ nameAr: string | null;
151
+ viewType: string;
152
+ }
153
+ /**
154
+ * The calculation of one value. Not wrapped in the usual response envelope:
155
+ * the endpoint returns this object as is.
156
+ */
157
+ interface CalculationExplanationResponse {
158
+ status: CalculationExplanationStatus | (string & {});
159
+ propertyKey: string;
160
+ /** Absent from responses before the backend added current calculations. */
161
+ basis?: CalculationExplanationBasis | (string & {});
162
+ valueVersion: string | null;
163
+ /** The formula was changed after this value was saved. */
164
+ definitionChanged: boolean;
165
+ /** Only with `available`. */
166
+ explanation?: CalculationExplanationDocument | null;
167
+ /** The persisted, normalized value the explanation belongs to (saved basis). */
168
+ savedValue?: string | null;
169
+ /** The explained property, as it is configured now. */
170
+ display?: CalculationPropertyDisplay | null;
171
+ }
172
+ type CalculationExplanationProvider = 'formula' | 'status' | 'nativeMethod' | 'codeBuilder' | 'schedule';
173
+ interface CalculationExplanationDocument {
174
+ schemaVersion: number;
175
+ calculationId: string;
176
+ provider: CalculationExplanationProvider | (string & {});
177
+ providerVersion: string;
178
+ engineVersion: string;
179
+ status: string;
180
+ /**
181
+ * The saved formula with internal property references; for a native method
182
+ * or a schedule field, a description of the calculation instead.
183
+ */
184
+ formula: string;
185
+ definitionHash: string;
186
+ calculatedAt: string;
187
+ /** The formula with every input replaced by its value: `(20 * 2)`. */
188
+ formulaWithValues: string | null;
189
+ /** The typed engine output, before the backend normalized it for saving. */
190
+ result: CalculationExplanationValue;
191
+ rootNodeId: number;
192
+ nodes: CalculationExplanationNode[];
193
+ sources: CalculationExplanationSourceRecords[];
194
+ /** Progress rollups behind `@Schedule::*_progress` references. */
195
+ schedule?: ScheduleCalculationExplanation[];
196
+ /** Status rules in configured order (status provider). */
197
+ statusRules?: CalculationStatusRuleExplanation[];
198
+ }
199
+ type CalculationExplanationNodeKind = 'literal' | 'input' | 'binary' | 'unary' | 'function' | 'conditional' | 'array' | 'table' | 'semantic' | 'selection' | 'method' | 'codeBlock';
200
+ interface CalculationExplanationNode {
201
+ id: number;
202
+ kind: CalculationExplanationNodeKind | (string & {});
203
+ operation: string | null;
204
+ expression: string;
205
+ children: number[];
206
+ argumentNames: (string | null)[];
207
+ /** `notEvaluated` (a branch never reached) is not an evaluated `null`. */
208
+ state: 'evaluated' | 'notEvaluated' | (string & {});
209
+ value?: CalculationExplanationValue;
210
+ reference: string | null;
211
+ /** The referenced property, for an input whose source was authorized. */
212
+ display?: CalculationPropertyDisplay | null;
213
+ /** The rows behind a vector input, aligned with its values. */
214
+ recordIds?: number[];
215
+ }
216
+ interface CalculationExplanationSourceRecords {
217
+ tablePath: string;
218
+ contextKey: string | null;
219
+ recordIds: number[];
220
+ propertyKeys: string[];
221
+ }
222
+ interface CalculationStatusRuleExplanation {
223
+ key: string;
224
+ order: number;
225
+ state: 'evaluated' | 'failed' | 'notEvaluated' | (string & {});
226
+ selected: boolean;
227
+ /** The rule's condition, explained like a formula. */
228
+ condition: CalculationExplanationDocument | null;
229
+ }
230
+ interface ScheduleCalculationExplanation {
231
+ /** The semantic node it belongs to: `Schedule::actual_progress`. */
232
+ reference: string;
233
+ asOfUtc: string;
234
+ weightMode: 'workingDays' | 'explicitWeight' | (string & {});
235
+ aggregation: 'weightedAverage' | 'arithmeticMean' | 'empty' | (string & {});
236
+ formulaWithValues: string;
237
+ result: number;
238
+ roundingDigits: number;
239
+ roundingMode: string;
240
+ includeMilestones: boolean;
241
+ excludeSameDayMilestones: boolean;
242
+ leafOnly: boolean;
243
+ excludedRowCount: number;
244
+ notes: string[];
245
+ contributors: ScheduleCalculationContributor[];
246
+ }
247
+ interface ScheduleCalculationContributor {
248
+ recordId: number;
249
+ moduleKey: string;
250
+ contextKey: string | null;
251
+ progress: number;
252
+ weight: number;
253
+ inputMissing: boolean;
254
+ includedInAggregation: boolean;
255
+ plannedStart: string | null;
256
+ plannedFinish: string | null;
257
+ plannedCalculation: PlannedProgressExplanation | null;
258
+ }
259
+ /** How one item's planned progress was derived from its dates and calendar. */
260
+ interface PlannedProgressExplanation {
261
+ result: number;
262
+ rule: 'missingDates' | 'invalidDateRange' | 'beforeStart' | 'afterFinish' | 'milestoneDueDate' | 'noWorkingTime' | 'elapsedWorkingMinutes' | (string & {});
263
+ elapsedWorkingMinutes: number | null;
264
+ totalWorkingMinutes: number | null;
265
+ asOfLocal: string;
266
+ timeZoneId: string;
267
+ calendarSource: string;
268
+ workDayStartMinute: number;
269
+ workDayEndMinute: number;
270
+ /** Sunday = 0. */
271
+ workingDays: number[];
272
+ holidays: string[];
273
+ plannedStart: string | null;
274
+ plannedFinish: string | null;
275
+ }
276
+
98
277
  /** A recalculation covering this value is running, or queued behind another. */
99
278
  type EntityCalculationStatus = 'running' | 'waiting' | 'delayed';
100
279
  /** How a calculated value moved between two reads of the same record. */
@@ -853,6 +1032,11 @@ interface EntityData {
853
1032
  calculationStatus?: EntityCalculationStatus | null;
854
1033
  /** The last change to this calculated value since the record was opened. */
855
1034
  calculationChange?: EntityCalculationChange | null;
1035
+ /**
1036
+ * The record a calculated value was read from. When set, clicking the
1037
+ * calculated-value icon shows how the saved value was calculated.
1038
+ */
1039
+ calculationSource?: EntityCalculationSource | null;
856
1040
  propertyConfiguration?: EntityPropertyConfiguration;
857
1041
  /**
858
1042
  * Catalog metadata for the properties captured inside `value`. The stored
@@ -975,6 +1159,8 @@ declare class EntityField {
975
1159
  readonly calculated: _angular_core.Signal<boolean>;
976
1160
  readonly calculationStatus: _angular_core.Signal<_masterteam_components_entities.EntityCalculationStatus | null | undefined>;
977
1161
  readonly calculationChange: _angular_core.Signal<_masterteam_components_entities.EntityCalculationChange | null | undefined>;
1162
+ /** What the calculated-value mark explains on click, if anything. */
1163
+ readonly calculationExplanation: _angular_core.Signal<_masterteam_components_entities.EntityCalculationExplanationTarget | null>;
978
1164
  readonly recentChange: _angular_core.Signal<_masterteam_components_entities.EntityCalculationChange | null>;
979
1165
  readonly label: _angular_core.InputSignal<string>;
980
1166
  readonly labelIconName: _angular_core.InputSignal<string | null>;
@@ -1143,6 +1329,8 @@ declare class EntityPercentage {
1143
1329
  readonly value: _angular_core.InputSignal<string | undefined>;
1144
1330
  readonly rawValue: _angular_core.InputSignal<string | undefined>;
1145
1331
  readonly displayName: _angular_core.Signal<string>;
1332
+ /** What the calculated-value mark explains on click, if anything. */
1333
+ readonly calculationExplanation: _angular_core.Signal<_masterteam_components_entities.EntityCalculationExplanationTarget | null>;
1146
1334
  readonly displayValue: _angular_core.Signal<string>;
1147
1335
  private readonly rawNumericValue;
1148
1336
  readonly hasNumericValue: _angular_core.Signal<boolean>;
@@ -1217,6 +1405,8 @@ declare class EntityCheckbox {
1217
1405
  readonly value: _angular_core.InputSignal<string | undefined>;
1218
1406
  readonly rawValue: _angular_core.InputSignal<string | undefined>;
1219
1407
  readonly displayName: _angular_core.Signal<string>;
1408
+ /** What the calculated-value mark explains on click, if anything. */
1409
+ readonly calculationExplanation: _angular_core.Signal<_masterteam_components_entities.EntityCalculationExplanationTarget | null>;
1220
1410
  readonly emptyLabel = "_";
1221
1411
  readonly hideName: _angular_core.Signal<boolean>;
1222
1412
  readonly checkboxState: _angular_core.Signal<boolean | null>;
@@ -1418,8 +1608,8 @@ type AttachmentReference = EntityAttachmentItemValue | string;
1418
1608
  declare class EntityAttachment {
1419
1609
  readonly data: _angular_core.InputSignal<EntityData | undefined>;
1420
1610
  readonly name: _angular_core.InputSignal<string | undefined>;
1421
- readonly shape: _angular_core.InputSignal<"compact" | "default">;
1422
- readonly value: _angular_core.InputSignal<string | EntityAttachmentItemValue | EntityAttachmentValue | null | undefined>;
1611
+ readonly shape: _angular_core.InputSignal<"default" | "compact">;
1612
+ readonly value: _angular_core.InputSignal<string | EntityAttachmentValue | EntityAttachmentItemValue | null | undefined>;
1423
1613
  readonly endPoint: _angular_core.InputSignal<string>;
1424
1614
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
1425
1615
  private readonly httpClient;
@@ -1972,7 +2162,8 @@ interface CalculatedPropertyMeta {
1972
2162
  * Whether a surface marks this property as calculated. `isCalculated` alone is
1973
2163
  * too broad: the backend also sets it, with no calculation method, on system
1974
2164
  * columns such as `created_at`, `id` and `team_members`. A status has no method
1975
- * but is recalculated, and an auto code is generated once.
2165
+ * but is recalculated. An auto code is generated rather than recalculated, but
2166
+ * the backend explains it like any calculated value, so it is marked too.
1976
2167
  */
1977
2168
  declare function isCalculatedProperty(meta: CalculatedPropertyMeta | null | undefined): boolean;
1978
2169
  /**
@@ -2017,22 +2208,356 @@ declare class EntityCalculatedGlyph {
2017
2208
  * Marks a property value the backend calculates. Rendered beside its label; it
2018
2209
  * pulses while a recalculation that covers the value is in progress, and stays
2019
2210
  * lit without pulsing once that is taking longer than expected.
2211
+ *
2212
+ * Given an `explanation` target it is a button: clicking it shows how the saved
2213
+ * value was calculated.
2020
2214
  */
2021
2215
  declare class EntityCalculatedIndicator {
2022
2216
  /** Set while the value is being recalculated. */
2023
2217
  readonly status: _angular_core.InputSignal<EntityCalculationStatus | null | undefined>;
2024
2218
  /** The value's last change, described in the tooltip when it is not busy. */
2025
2219
  readonly change: _angular_core.InputSignal<EntityCalculationChange | null | undefined>;
2220
+ /** The value to explain on click. Without it the mark only has a tooltip. */
2221
+ readonly explanation: _angular_core.InputSignal<EntityCalculationExplanationTarget | null>;
2222
+ private readonly popover;
2223
+ protected readonly opened: _angular_core.WritableSignal<boolean>;
2026
2224
  protected readonly pulsing: _angular_core.Signal<boolean>;
2027
2225
  protected readonly tooltipKey: _angular_core.Signal<string>;
2028
2226
  protected readonly tooltipParams: _angular_core.Signal<{
2029
2227
  previous: string;
2030
2228
  current: string;
2031
2229
  } | undefined>;
2230
+ protected toggle(event: MouseEvent): void;
2032
2231
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityCalculatedIndicator, never>;
2033
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityCalculatedIndicator, "mt-entity-calculated-indicator", never, { "status": { "alias": "status"; "required": false; "isSignal": true; }; "change": { "alias": "change"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2232
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityCalculatedIndicator, "mt-entity-calculated-indicator", never, { "status": { "alias": "status"; "required": false; "isSignal": true; }; "change": { "alias": "change"; "required": false; "isSignal": true; }; "explanation": { "alias": "explanation"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2233
+ }
2234
+
2235
+ /**
2236
+ * Reads the latest saved calculation of a value. The request never
2237
+ * recalculates anything; the response is marked `no-store`, so every open
2238
+ * asks again.
2239
+ */
2240
+ declare class CalculationExplanationApi {
2241
+ private readonly http;
2242
+ read(source: EntityCalculationSource, propertyKey: string): Observable<CalculationExplanationResponse>;
2243
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalculationExplanationApi, never>;
2244
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<CalculationExplanationApi>;
2245
+ }
2246
+ /**
2247
+ * The context key in the casing the endpoint accepts. Fetch contexts are
2248
+ * written `level:12/module:5`, but this endpoint validates `Level:12/Module:5`
2249
+ * case-sensitively and answers anything else with a 400. Null for a context it
2250
+ * does not explain.
2251
+ */
2252
+ declare function toCalculationContextKey(contextKey: string): string | null;
2253
+ /**
2254
+ * What a value's calculated-value mark explains on click: any calculated value
2255
+ * (a formula, a status, a generated code, a date or an amount) whose host
2256
+ * named the record it was read from.
2257
+ */
2258
+ declare function toCalculationExplanationTarget(entity: EntityData | null | undefined, label?: string | null): EntityCalculationExplanationTarget | null;
2259
+ /**
2260
+ * Lets an explanation ask the host that rendered a value to read it again,
2261
+ * when the saved value no longer matches the one on screen. Provided by
2262
+ * `mt-client-instance-preview`; without it the explanation only says so.
2263
+ */
2264
+ declare abstract class EntityCalculationRefresher {
2265
+ abstract refreshStaleCalculatedValue(): void;
2034
2266
  }
2035
2267
 
2268
+ /**
2269
+ * The application's currency unit (`SAR`), shown after captured amounts. The
2270
+ * explanation never guesses a currency: without this token, or with an empty
2271
+ * unit, amounts are shown as plain numbers.
2272
+ */
2273
+ declare const MT_CALCULATION_CURRENCY: InjectionToken<Signal<string>>;
2274
+ declare const CALCULATION_EXPLANATION_KEYS = "components.entitiesPreview.calculationExplanation";
2275
+ /** What formatting needs from the host: language, currency, dates, text. */
2276
+ interface ExplanationFormatContext {
2277
+ lang: string;
2278
+ currency: string;
2279
+ formatDate: (value: string, type: 'date' | 'dateTime' | 'time') => string;
2280
+ translate: (key: string, params?: Record<string, unknown>) => string;
2281
+ }
2282
+ /** One piece of the readable equation. Rendered as plain text, never HTML. */
2283
+ type ExplanationSegment = {
2284
+ kind: 'text';
2285
+ text: string;
2286
+ } | {
2287
+ kind: 'value';
2288
+ text: string;
2289
+ } | {
2290
+ kind: 'term';
2291
+ label: string;
2292
+ value: string | null;
2293
+ } | {
2294
+ kind: 'result';
2295
+ text: string;
2296
+ } | {
2297
+ kind: 'muted';
2298
+ text: string;
2299
+ };
2300
+ /** Captured JSON shown as labelled data. */
2301
+ type ExplanationData = {
2302
+ kind: 'text';
2303
+ text: string;
2304
+ } | {
2305
+ kind: 'list';
2306
+ items: string[];
2307
+ } | {
2308
+ kind: 'table';
2309
+ columns: string[];
2310
+ rows: string[][];
2311
+ } | {
2312
+ kind: 'fields';
2313
+ fields: {
2314
+ label: string;
2315
+ data: ExplanationData;
2316
+ }[];
2317
+ };
2318
+ /** A number as captured: grouped, never rounded, with a real minus sign. */
2319
+ declare function formatExplanationNumber(value: number): string;
2320
+ /** A captured value as plain text. Never formatted or rounded here. */
2321
+ declare function formatExplanationValue(value: CalculationExplanationValue | undefined): string;
2322
+ /**
2323
+ * A captured value the way its property shows values: grouped numbers, the
2324
+ * application currency, `%`, the configured date format.
2325
+ */
2326
+ declare function formatTypedValue(value: CalculationExplanationValue | undefined, viewType: string | null | undefined, ctx: ExplanationFormatContext): string;
2327
+ /** A property's current name in the active language. */
2328
+ declare function displayName(display: CalculationPropertyDisplay | null | undefined, lang: string): string | null;
2329
+ /** `Modules.LevelDataFinancial` → `LevelDataFinancial`. */
2330
+ declare function tableLabel(tablePath: string | null | undefined): string;
2331
+ /** `totalLevelWeight` / `is_cancelled` → `Total level weight` / `Is cancelled`. */
2332
+ declare function humanizeKey(key: string): string;
2333
+ /** Whether the document's root reads as an equation. */
2334
+ declare function isEquationDocument(document: CalculationExplanationDocument): boolean;
2335
+ /**
2336
+ * The calculation as a readable equation: every input by its property name
2337
+ * with the value it had, operators as symbols, nested function results shown
2338
+ * after the call. `null` when the document is not an equation (a native
2339
+ * method, a status selection, a generated code).
2340
+ */
2341
+ declare function buildExplanationSegments(document: CalculationExplanationDocument, ctx: ExplanationFormatContext): ExplanationSegment[] | null;
2342
+ /** Captured JSON (native method facts) as labelled fields, lists or tables. */
2343
+ declare function toExplanationData(value: CalculationExplanationValue | undefined, ctx: ExplanationFormatContext, depth?: number): ExplanationData;
2344
+ interface ExplanationInputView {
2345
+ label: string;
2346
+ value: string;
2347
+ /** A vector input: each value with the record it came from. */
2348
+ rows: {
2349
+ recordId: number | null;
2350
+ value: string;
2351
+ }[];
2352
+ }
2353
+ interface ExplanationFunctionView {
2354
+ name: string;
2355
+ result: string;
2356
+ notEvaluated: boolean;
2357
+ }
2358
+ interface ExplanationFactView {
2359
+ label: string;
2360
+ data: ExplanationData;
2361
+ }
2362
+ interface ExplanationCodeBlockView {
2363
+ type: string;
2364
+ value: string;
2365
+ /** The block's value before its transformations, when it differs. */
2366
+ raw: string | null;
2367
+ settings: ExplanationData | null;
2368
+ }
2369
+ interface ExplanationStatusRuleView {
2370
+ key: string;
2371
+ name: string;
2372
+ order: number;
2373
+ verdict: 'selected' | 'matched' | 'notMatched' | 'checked' | 'failed' | 'notEvaluated';
2374
+ segments: ExplanationSegment[] | null;
2375
+ }
2376
+ interface ExplanationPlannedView {
2377
+ recordId: number;
2378
+ rule: string;
2379
+ minutes: string | null;
2380
+ dates: string | null;
2381
+ }
2382
+ interface ExplanationCalendarView {
2383
+ timeZone: string;
2384
+ source: string;
2385
+ workingHours: string;
2386
+ workingDays: string;
2387
+ holidays: string;
2388
+ }
2389
+ interface ExplanationScheduleView {
2390
+ title: string;
2391
+ result: string;
2392
+ formulaWithValues: string;
2393
+ facts: string[];
2394
+ notes: string[];
2395
+ contributors: {
2396
+ recordId: number;
2397
+ progress: string;
2398
+ weight: string;
2399
+ included: boolean;
2400
+ inputMissing: boolean;
2401
+ }[];
2402
+ planned: ExplanationPlannedView[];
2403
+ calendar: ExplanationCalendarView | null;
2404
+ }
2405
+ interface ExplanationSourceView {
2406
+ label: string;
2407
+ count: number;
2408
+ ids: string;
2409
+ }
2410
+ interface ExplanationDetailsView {
2411
+ formula: string | null;
2412
+ formulaWithValues: string | null;
2413
+ inputs: ExplanationInputView[];
2414
+ functions: ExplanationFunctionView[];
2415
+ facts: ExplanationFactView[];
2416
+ codeBlocks: ExplanationCodeBlockView[];
2417
+ statusRules: ExplanationStatusRuleView[];
2418
+ schedule: ExplanationScheduleView[];
2419
+ sources: ExplanationSourceView[];
2420
+ }
2421
+ /** Everything the expandable details show, read from the document as is. */
2422
+ declare function buildExplanationDetails(document: CalculationExplanationDocument, ctx: ExplanationFormatContext, statusNames?: Record<string, string>): ExplanationDetailsView;
2423
+ /** Whether the details have anything to expand. */
2424
+ declare function hasExplanationDetails(view: ExplanationDetailsView): boolean;
2425
+ /** A generated code as its parts: `PRJ + - + 2026 + - + 0042`. */
2426
+ declare function buildCodeSegments(document: CalculationExplanationDocument, ctx: ExplanationFormatContext): ExplanationSegment[];
2427
+ /** The status a rule selects, by the name the host knows or its key. */
2428
+ declare function statusName(key: string, statusNames: Record<string, string>): string;
2429
+ /** The rule that chose the status, if one did. */
2430
+ declare function selectedStatusRule(document: CalculationExplanationDocument): CalculationStatusRuleExplanation | null;
2431
+
2432
+ /**
2433
+ * A readable equation: `Budget (12,000 SAR) − Spent (15,000 SAR) = −3,000 SAR`.
2434
+ * A left-to-right block in every language, like a formula in a spreadsheet:
2435
+ * inside a right-to-left page an inline left-to-right run breaks across lines
2436
+ * in the wrong order. Each term is isolated and kept whole, so an Arabic name
2437
+ * reads with its own value. Every piece is interpolated as text.
2438
+ */
2439
+ declare class CalculationExplanationEquation {
2440
+ readonly segments: _angular_core.InputSignal<ExplanationSegment[]>;
2441
+ /** Shown after the equation, behind `resultOperator`. */
2442
+ readonly result: _angular_core.InputSignal<string | null>;
2443
+ readonly resultOperator: _angular_core.InputSignal<string>;
2444
+ protected readonly pieces: _angular_core.Signal<{
2445
+ segment: ExplanationSegment;
2446
+ space: boolean;
2447
+ }[]>;
2448
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalculationExplanationEquation, never>;
2449
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CalculationExplanationEquation, "mt-calculation-explanation-equation", never, { "segments": { "alias": "segments"; "required": true; "isSignal": true; }; "result": { "alias": "result"; "required": false; "isSignal": true; }; "resultOperator": { "alias": "resultOperator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2450
+ }
2451
+
2452
+ /**
2453
+ * The expandable part of an explanation: the inputs with the rows they came
2454
+ * from, function results, status rules, schedule rollups, generated-code
2455
+ * parts and contributing records. Everything is the backend's captured data,
2456
+ * shown as text; nothing is recalculated here.
2457
+ */
2458
+ declare class CalculationExplanationDetails {
2459
+ readonly details: _angular_core.InputSignal<ExplanationDetailsView>;
2460
+ protected readonly prefix = "components.entitiesPreview.calculationExplanation";
2461
+ protected readonly scheduleKeys = "components.entitiesPreview.calculationExplanation.schedule";
2462
+ protected readonly verdictClass: Record<string, string>;
2463
+ protected hasMissingInput(rows: {
2464
+ inputMissing: boolean;
2465
+ }[]): boolean;
2466
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CalculationExplanationDetails, never>;
2467
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CalculationExplanationDetails, "mt-calculation-explanation-details", never, { "details": { "alias": "details"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
2468
+ }
2469
+
2470
+ type ExplanationState = {
2471
+ kind: 'loading';
2472
+ } | {
2473
+ kind: 'failed';
2474
+ } | {
2475
+ kind: 'unavailable';
2476
+ messageKey: string;
2477
+ } | {
2478
+ kind: 'available';
2479
+ basis: CalculationExplanationBasis;
2480
+ document: CalculationExplanationDocument;
2481
+ definitionChanged: boolean;
2482
+ /** The value on screen was older than the saved one and was re-read. */
2483
+ refreshed: boolean;
2484
+ viewType: string | undefined;
2485
+ };
2486
+ /** How the summary reads, by what the backend explained. */
2487
+ type SummaryView = {
2488
+ kind: 'equation';
2489
+ segments: ExplanationSegment[];
2490
+ operator: string;
2491
+ } | {
2492
+ kind: 'description';
2493
+ text: string;
2494
+ code: boolean;
2495
+ } | {
2496
+ kind: 'message';
2497
+ text: string;
2498
+ };
2499
+ /**
2500
+ * How a calculated value was calculated: a readable equation with each input
2501
+ * by name and the value it had, the result and when, with the captured
2502
+ * details behind a toggle. Fetched each time it opens; reading it never
2503
+ * recalculates anything, and nothing here is recalculated either.
2504
+ */
2505
+ declare class EntityCalculationExplanation implements OnInit {
2506
+ private readonly api;
2507
+ private readonly refresher;
2508
+ private readonly transloco;
2509
+ private readonly lang;
2510
+ private readonly currency;
2511
+ private readonly datePipe;
2512
+ readonly target: _angular_core.InputSignal<EntityCalculationExplanationTarget>;
2513
+ protected readonly prefix = "components.entitiesPreview.calculationExplanation";
2514
+ protected readonly state: _angular_core.WritableSignal<ExplanationState>;
2515
+ protected readonly expanded: _angular_core.WritableSignal<boolean>;
2516
+ protected readonly available: _angular_core.Signal<{
2517
+ kind: "available";
2518
+ basis: CalculationExplanationBasis;
2519
+ document: CalculationExplanationDocument;
2520
+ definitionChanged: boolean;
2521
+ /** The value on screen was older than the saved one and was re-read. */
2522
+ refreshed: boolean;
2523
+ viewType: string | undefined;
2524
+ } | null>;
2525
+ protected readonly unavailableKey: _angular_core.Signal<string | null>;
2526
+ private readonly formatContext;
2527
+ protected readonly view: _angular_core.Signal<{
2528
+ basis: CalculationExplanationBasis;
2529
+ calculatedAt: string;
2530
+ definitionChanged: boolean;
2531
+ refreshed: boolean;
2532
+ result: string;
2533
+ summary: SummaryView;
2534
+ equation: ExplanationSegment[];
2535
+ operator: string;
2536
+ description: string;
2537
+ descriptionIsCode: boolean;
2538
+ differs: {
2539
+ page: string;
2540
+ current: string;
2541
+ } | null;
2542
+ details: ExplanationDetailsView;
2543
+ hasDetails: boolean;
2544
+ } | null>;
2545
+ private request?;
2546
+ constructor();
2547
+ ngOnInit(): void;
2548
+ private load;
2549
+ private apply;
2550
+ private summarize;
2551
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityCalculationExplanation, never>;
2552
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityCalculationExplanation, "mt-entity-calculation-explanation", never, { "target": { "alias": "target"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
2553
+ }
2554
+ /**
2555
+ * Whether the saved value is the one on screen. Both are the persisted string,
2556
+ * but a number may be written either way (`40` and `40.0`), so numbers compare
2557
+ * as numbers.
2558
+ */
2559
+ declare function isSameSavedValue(saved: string | null | undefined, displayed: string | undefined): boolean;
2560
+
2036
2561
  /**
2037
2562
  * Says how a calculated number just moved: the signed difference, with the
2038
2563
  * exact values in its tooltip.
@@ -2188,7 +2713,7 @@ declare class EntityHeader {
2188
2713
  declare class EntityPreview {
2189
2714
  private readonly transloco;
2190
2715
  readonly data: _angular_core.InputSignal<EntityData>;
2191
- readonly attachmentShape: _angular_core.InputSignal<"compact" | "default">;
2716
+ readonly attachmentShape: _angular_core.InputSignal<"default" | "compact">;
2192
2717
  private readonly activeLang;
2193
2718
  /**
2194
2719
  * The admin-authored note for the active language, or `''` when the property
@@ -2198,7 +2723,7 @@ declare class EntityPreview {
2198
2723
  * `mt-entity-preview` usages in the app.
2199
2724
  */
2200
2725
  readonly infoText: _angular_core.Signal<string>;
2201
- readonly comparisonKind: _angular_core.Signal<"Value" | "EntityList" | null>;
2726
+ readonly comparisonKind: _angular_core.Signal<"EntityList" | "Value" | null>;
2202
2727
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityPreview, never>;
2203
2728
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityPreview, "mt-entity-preview", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "attachmentShape": { "alias": "attachmentShape"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2204
2729
  }
@@ -2211,7 +2736,7 @@ declare class EntityPreview {
2211
2736
  */
2212
2737
  declare class EntityPreviewBody {
2213
2738
  readonly data: _angular_core.InputSignal<EntityData>;
2214
- readonly attachmentShape: _angular_core.InputSignal<"compact" | "default">;
2739
+ readonly attachmentShape: _angular_core.InputSignal<"default" | "compact">;
2215
2740
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityPreviewBody, never>;
2216
2741
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityPreviewBody, "mt-entity-preview-body", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "attachmentShape": { "alias": "attachmentShape"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2217
2742
  }
@@ -2285,7 +2810,7 @@ declare class EntitiesPreview {
2285
2810
  private readonly transloco;
2286
2811
  /** Array of entity data to display */
2287
2812
  readonly entities: _angular_core.InputSignal<EntityData[]>;
2288
- readonly attachmentShape: _angular_core.InputSignal<"compact" | "default">;
2813
+ readonly attachmentShape: _angular_core.InputSignal<"default" | "compact">;
2289
2814
  /**
2290
2815
  * Soft "stack every field full-width when the host is narrower than the
2291
2816
  * 24-column grid reads well" behavior (the ≤400px container-query fallback,
@@ -2484,5 +3009,5 @@ declare class FitText {
2484
3009
 
2485
3010
  declare function sharedActiveLang(transloco: TranslocoService): Signal<string>;
2486
3011
 
2487
- export { CALCULATION_CHANGE_CHIP_MS, CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, CalculatedValueHistory, ComparisonEntityList, ComparisonValue, DEFAULT_PERFORMANCE_SCORE_CHART_SIZE, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, ENTITY_HEADER_VIEW_TYPES, ENTITY_LIST_TABLE_COMPONENT, ENTITY_ROW_SPANS, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCalculatedGlyph, EntityCalculatedIndicator, EntityCalculationChangeChip, EntityCheckbox, EntityColor, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityHeader, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPerformanceScore, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityRuntimeContextStore, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, PERFORMANCE_SCORE_CHART_SIZES, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, canEntityBeHeader, compactCurrencyDisplay, currencyUnitOf, describeCalculationChange, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, formatCalculationDelta, getEntitySectionTitle, getPerformanceScoreBands, groupEntitiesIntoSections, humanizeEntityListKey, isCalculatedProperty, isConnectionSyntheticKey, isEntityAlignEnd, isEntityHeader, isEntityLabelHidden, isEntityListLocalDocument, isEntityListSelectionDocument, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, localCellsByFieldId, matchesPercentageColorRule, mergeStakeholderNameColumns, mergeStakeholderNameEntities, mergeStakeholderNameRows, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, parsePerformanceScore, pinEntityHeaderFirst, readEntityHeaderDefaults, readEntityValueColor, resolveConnectionLevelName, resolveEntityGridRow, resolveEntityHeader, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalFieldConfiguration, resolveLocalFieldLabel, resolveLocalFieldViewType, resolveLocalizedLabel, resolvePercentageColor, resolvePerformanceScoreStatus, serializeEntityRawValue, sharedActiveLang, sortLocalRows, splitConnectionKey, splitLeafKey, summarizeEntityListRows, visibleLocalSchemaFields };
2488
- export type { CalculatedPropertyMeta, ComparisonValueSide, ConnectionCatalogConfiguration, ConnectionLevelSavedConfig, ConnectionSourceLevelConfig, EntityAttachmentItemValue, EntityAttachmentValue, EntityBaseConfig, EntityCalculationChange, EntityCalculationStatus, EntityClickEvent, EntityComparisonField, EntityComparisonOperation, EntityConfiguration, EntityConnectionConfig, EntityConnectionSourceValue, EntityConnectionValue, EntityData, EntityHeaderConfig, EntityLabelPosition, EntityLeafDetailsConfig, EntityListComparison, EntityListComparisonRow, EntityListEntityValue, EntityListInlineFieldMeta, EntityListLocalCell, EntityListLocalDocument, EntityListLocalFieldDefinition, EntityListLocalFieldWidth, EntityListLocalRow, EntityListLocalSchema, EntityListLocalSchemaField, EntityListRenderedRow, EntityListRowValue, EntityListSelectionDocument, EntityListSelectionRecord, EntityListSelectionRecordValue, EntityListTableHost, EntityListTranslatable, EntityListValueItem, EntityLocationValue, EntityLookupCheckListItem, EntityLookupCheckListPropValue, EntityLookupCheckListValue, EntityLookupValue, EntityMultiLookupValue, EntityMultiUserValue, EntityNestedPropertyMeta, EntityPercentageConfig, EntityPerformanceScoreChartSize, EntityPerformanceScoreConfig, EntityPerformanceScoreStatus, EntityPerformanceScoreValue, EntityPhaseGateValue, EntityPropertyConfiguration, EntityResizeEvent, EntityRowSpan, EntityRuntimeContext, EntityScheduleItemValue, EntitySectionConfig, EntitySectionGroup, EntitySectionLabel, EntitySize, EntityStatusValue, EntityTranslatableTextValue, EntityUserConfig, EntityUserValue, EntityViewType, LeafDetailsBadgeKind, LeafDetailsCatalogConfiguration, LeafDetailsCatalogLevelValue, LeafDetailsCatalogPhaseValue, LeafDetailsCatalogStatusValue, LeafDetailsEntityCollectionValue, LeafDetailsEntityValue, LeafDetailsPhaseSummary, LeafDetailsRuntimeChildSchema, LeafDetailsRuntimePhaseCount, LeafDetailsRuntimePhaseDetails, LeafDetailsRuntimeStatusCount, LeafDetailsRuntimeStatusDetails, LeafDetailsRuntimeValue, LeafDetailsStatusSummary, LeafLevelSavedConfig, LeafPhaseSavedConfig, PercentageColorMode, PercentageColorPropertyRef, PercentageColorRule, PercentageColorSource, PropertyValueComparison, ValueComparison };
3012
+ export { CALCULATION_CHANGE_CHIP_MS, CALCULATION_EXPLANATION_KEYS, CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, CalculatedValueHistory, CalculationExplanationApi, CalculationExplanationDetails, CalculationExplanationEquation, ComparisonEntityList, ComparisonValue, DEFAULT_PERFORMANCE_SCORE_CHART_SIZE, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, ENTITY_HEADER_VIEW_TYPES, ENTITY_LIST_TABLE_COMPONENT, ENTITY_ROW_SPANS, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCalculatedGlyph, EntityCalculatedIndicator, EntityCalculationChangeChip, EntityCalculationExplanation, EntityCalculationRefresher, EntityCheckbox, EntityColor, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityHeader, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPerformanceScore, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityRuntimeContextStore, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, MT_CALCULATION_CURRENCY, PERFORMANCE_SCORE_CHART_SIZES, SECTION_KEY_PREFIX, buildCodeSegments, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildExplanationDetails, buildExplanationSegments, buildSectionKey, canEntityBeHeader, compactCurrencyDisplay, currencyUnitOf, describeCalculationChange, displayName, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, formatCalculationDelta, formatExplanationNumber, formatExplanationValue, formatTypedValue, getEntitySectionTitle, getPerformanceScoreBands, groupEntitiesIntoSections, hasExplanationDetails, humanizeEntityListKey, humanizeKey, isCalculatedProperty, isConnectionSyntheticKey, isEntityAlignEnd, isEntityHeader, isEntityLabelHidden, isEntityListLocalDocument, isEntityListSelectionDocument, isEntitySection, isEquationDocument, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSameSavedValue, isSectionKey, isValueMissing, localCellsByFieldId, matchesPercentageColorRule, mergeStakeholderNameColumns, mergeStakeholderNameEntities, mergeStakeholderNameRows, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, parsePerformanceScore, pinEntityHeaderFirst, readEntityHeaderDefaults, readEntityValueColor, resolveConnectionLevelName, resolveEntityGridRow, resolveEntityHeader, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalFieldConfiguration, resolveLocalFieldLabel, resolveLocalFieldViewType, resolveLocalizedLabel, resolvePercentageColor, resolvePerformanceScoreStatus, selectedStatusRule, serializeEntityRawValue, sharedActiveLang, sortLocalRows, splitConnectionKey, splitLeafKey, statusName, summarizeEntityListRows, tableLabel, toCalculationContextKey, toCalculationExplanationTarget, toExplanationData, visibleLocalSchemaFields };
3013
+ export type { CalculatedPropertyMeta, CalculationExplanationBasis, CalculationExplanationDocument, CalculationExplanationNode, CalculationExplanationNodeKind, CalculationExplanationProvider, CalculationExplanationResponse, CalculationExplanationSourceRecords, CalculationExplanationStatus, CalculationExplanationValue, CalculationPropertyDisplay, CalculationStatusRuleExplanation, ComparisonValueSide, ConnectionCatalogConfiguration, ConnectionLevelSavedConfig, ConnectionSourceLevelConfig, EntityAttachmentItemValue, EntityAttachmentValue, EntityBaseConfig, EntityCalculationChange, EntityCalculationExplanationTarget, EntityCalculationSource, EntityCalculationStatus, EntityClickEvent, EntityComparisonField, EntityComparisonOperation, EntityConfiguration, EntityConnectionConfig, EntityConnectionSourceValue, EntityConnectionValue, EntityData, EntityHeaderConfig, EntityLabelPosition, EntityLeafDetailsConfig, EntityListComparison, EntityListComparisonRow, EntityListEntityValue, EntityListInlineFieldMeta, EntityListLocalCell, EntityListLocalDocument, EntityListLocalFieldDefinition, EntityListLocalFieldWidth, EntityListLocalRow, EntityListLocalSchema, EntityListLocalSchemaField, EntityListRenderedRow, EntityListRowValue, EntityListSelectionDocument, EntityListSelectionRecord, EntityListSelectionRecordValue, EntityListTableHost, EntityListTranslatable, EntityListValueItem, EntityLocationValue, EntityLookupCheckListItem, EntityLookupCheckListPropValue, EntityLookupCheckListValue, EntityLookupValue, EntityMultiLookupValue, EntityMultiUserValue, EntityNestedPropertyMeta, EntityPercentageConfig, EntityPerformanceScoreChartSize, EntityPerformanceScoreConfig, EntityPerformanceScoreStatus, EntityPerformanceScoreValue, EntityPhaseGateValue, EntityPropertyConfiguration, EntityResizeEvent, EntityRowSpan, EntityRuntimeContext, EntityScheduleItemValue, EntitySectionConfig, EntitySectionGroup, EntitySectionLabel, EntitySize, EntityStatusValue, EntityTranslatableTextValue, EntityUserConfig, EntityUserValue, EntityViewType, ExplanationCalendarView, ExplanationCodeBlockView, ExplanationData, ExplanationDetailsView, ExplanationFactView, ExplanationFormatContext, ExplanationFunctionView, ExplanationInputView, ExplanationPlannedView, ExplanationScheduleView, ExplanationSegment, ExplanationSourceView, ExplanationStatusRuleView, LeafDetailsBadgeKind, LeafDetailsCatalogConfiguration, LeafDetailsCatalogLevelValue, LeafDetailsCatalogPhaseValue, LeafDetailsCatalogStatusValue, LeafDetailsEntityCollectionValue, LeafDetailsEntityValue, LeafDetailsPhaseSummary, LeafDetailsRuntimeChildSchema, LeafDetailsRuntimePhaseCount, LeafDetailsRuntimePhaseDetails, LeafDetailsRuntimeStatusCount, LeafDetailsRuntimeStatusDetails, LeafDetailsRuntimeValue, LeafDetailsStatusSummary, LeafLevelSavedConfig, LeafPhaseSavedConfig, PercentageColorMode, PercentageColorPropertyRef, PercentageColorRule, PercentageColorSource, PlannedProgressExplanation, PropertyValueComparison, ScheduleCalculationContributor, ScheduleCalculationExplanation, ValueComparison };