@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.
- package/assets/common.css +1 -1
- package/assets/i18n/ar.json +104 -1
- package/assets/i18n/en.json +104 -1
- package/fesm2022/masterteam-components-business-fields.mjs +4 -4
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +2470 -77
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-treeselect-field.mjs +2 -2
- package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-entities.d.ts +536 -11
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, Injectable, InjectionToken,
|
|
2
|
+
import { signal, Injectable, InjectionToken, inject, input, computed, ChangeDetectionStrategy, Component, DestroyRef, viewChild, ElementRef, afterNextRender, Directive, effect, untracked, ViewEncapsulation, output, NgZone, model } from '@angular/core';
|
|
3
3
|
import { Tooltip, TruncateTooltip } from '@masterteam/components/tooltip';
|
|
4
4
|
import { Icon } from '@masterteam/icons';
|
|
5
|
-
import { TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
|
6
|
-
import { toSignal } from '@angular/core/rxjs-interop';
|
|
7
5
|
import { NgTemplateOutlet, NgComponentOutlet, DOCUMENT } from '@angular/common';
|
|
6
|
+
import { TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
|
7
|
+
import { Popover } from 'primeng/popover';
|
|
8
8
|
import { MTDateFormatPipe, REQUEST_CONTEXT, coerceCheckboxValue, readableTextOn, getLightColor } from '@masterteam/components';
|
|
9
|
-
import {
|
|
9
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
10
|
+
import { HttpClient, HttpContext } from '@angular/common/http';
|
|
10
11
|
import { Avatar } from '@masterteam/components/avatar';
|
|
11
12
|
import { SecureImagePipe, UploadField } from '@masterteam/components/upload-field';
|
|
12
13
|
import { Progress } from '@masterteam/components/progress';
|
|
@@ -345,6 +346,2326 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
345
346
|
*/
|
|
346
347
|
const ENTITY_LIST_TABLE_COMPONENT = new InjectionToken('ENTITY_LIST_TABLE_COMPONENT');
|
|
347
348
|
|
|
349
|
+
/**
|
|
350
|
+
* One shared active-language signal per `TranslocoService`.
|
|
351
|
+
*
|
|
352
|
+
* `mt-entity-preview` renders once per property per record — a client-list card
|
|
353
|
+
* grid mounts thousands of them — so a `toSignal(langChanges$)` inside each
|
|
354
|
+
* instance would open thousands of subscriptions to the same Subject just to
|
|
355
|
+
* read one global value. The language is global, so the signal is too: created
|
|
356
|
+
* once, cached against the service, and shared by every entity that needs it.
|
|
357
|
+
*
|
|
358
|
+
* `manualCleanup` is deliberate. The cached signal outlives any single
|
|
359
|
+
* component by design, and the service it hangs off is the root injector's —
|
|
360
|
+
* tying its subscription to whichever entity happened to ask first would tear
|
|
361
|
+
* it down the moment that entity scrolled out of view.
|
|
362
|
+
*/
|
|
363
|
+
const langSignals = new WeakMap();
|
|
364
|
+
function sharedActiveLang(transloco) {
|
|
365
|
+
const cached = langSignals.get(transloco);
|
|
366
|
+
if (cached) {
|
|
367
|
+
return cached;
|
|
368
|
+
}
|
|
369
|
+
const lang = toSignal(transloco.langChanges$, {
|
|
370
|
+
initialValue: transloco.getActiveLang(),
|
|
371
|
+
manualCleanup: true,
|
|
372
|
+
});
|
|
373
|
+
langSignals.set(transloco, lang);
|
|
374
|
+
return lang;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Reads the latest saved calculation of a value. The request never
|
|
379
|
+
* recalculates anything; the response is marked `no-store`, so every open
|
|
380
|
+
* asks again.
|
|
381
|
+
*/
|
|
382
|
+
class CalculationExplanationApi {
|
|
383
|
+
http = inject(HttpClient);
|
|
384
|
+
read(source, propertyKey) {
|
|
385
|
+
return this.http.get('properties/calculation-explanation', {
|
|
386
|
+
params: {
|
|
387
|
+
contextKey: toCalculationContextKey(source.contextKey) ?? '',
|
|
388
|
+
recordId: source.recordId,
|
|
389
|
+
propertyKey,
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationApi, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
394
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationApi, providedIn: 'root' });
|
|
395
|
+
}
|
|
396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationApi, decorators: [{
|
|
397
|
+
type: Injectable,
|
|
398
|
+
args: [{ providedIn: 'root' }]
|
|
399
|
+
}] });
|
|
400
|
+
/**
|
|
401
|
+
* The context key in the casing the endpoint accepts. Fetch contexts are
|
|
402
|
+
* written `level:12/module:5`, but this endpoint validates `Level:12/Module:5`
|
|
403
|
+
* case-sensitively and answers anything else with a 400. Null for a context it
|
|
404
|
+
* does not explain.
|
|
405
|
+
*/
|
|
406
|
+
function toCalculationContextKey(contextKey) {
|
|
407
|
+
const key = contextKey.trim();
|
|
408
|
+
const level = /^level:([1-9]\d*)(?:\/module:([1-9]\d*))?$/i.exec(key);
|
|
409
|
+
if (level) {
|
|
410
|
+
return level[2]
|
|
411
|
+
? `Level:${level[1]}/Module:${level[2]}`
|
|
412
|
+
: `Level:${level[1]}`;
|
|
413
|
+
}
|
|
414
|
+
const moduleOnly = /^module:([1-9]\d*)$/i.exec(key);
|
|
415
|
+
return moduleOnly ? `Module:${moduleOnly[1]}` : null;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* What a value's calculated-value mark explains on click: any calculated value
|
|
419
|
+
* (a formula, a status, a generated code, a date or an amount) whose host
|
|
420
|
+
* named the record it was read from.
|
|
421
|
+
*/
|
|
422
|
+
function toCalculationExplanationTarget(entity, label) {
|
|
423
|
+
const source = entity?.calculationSource;
|
|
424
|
+
if (!entity?.calculated ||
|
|
425
|
+
!source ||
|
|
426
|
+
!entity.key ||
|
|
427
|
+
!(source.recordId > 0) ||
|
|
428
|
+
!toCalculationContextKey(source.contextKey)) {
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
source,
|
|
433
|
+
propertyKey: entity.key,
|
|
434
|
+
label: label || entity.name || entity.key,
|
|
435
|
+
displayedValue: entity.rawValue,
|
|
436
|
+
viewType: entity.viewType,
|
|
437
|
+
statusNames: statusNamesOf(entity.value),
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/** The name of the status on screen, keyed by its status key. */
|
|
441
|
+
function statusNamesOf(value) {
|
|
442
|
+
if (!value || typeof value !== 'object') {
|
|
443
|
+
return undefined;
|
|
444
|
+
}
|
|
445
|
+
const { key, display } = value;
|
|
446
|
+
return typeof key === 'string' && typeof display === 'string' && display
|
|
447
|
+
? { [key]: display }
|
|
448
|
+
: undefined;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Lets an explanation ask the host that rendered a value to read it again,
|
|
452
|
+
* when the saved value no longer matches the one on screen. Provided by
|
|
453
|
+
* `mt-client-instance-preview`; without it the explanation only says so.
|
|
454
|
+
*/
|
|
455
|
+
class EntityCalculationRefresher {
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* The application's currency unit (`SAR`), shown after captured amounts. The
|
|
460
|
+
* explanation never guesses a currency: without this token, or with an empty
|
|
461
|
+
* unit, amounts are shown as plain numbers.
|
|
462
|
+
*/
|
|
463
|
+
const MT_CALCULATION_CURRENCY = new InjectionToken('MT_CALCULATION_CURRENCY', { providedIn: 'root', factory: () => signal('').asReadonly() });
|
|
464
|
+
const CALCULATION_EXPLANATION_KEYS = 'components.entitiesPreview.calculationExplanation';
|
|
465
|
+
const K = CALCULATION_EXPLANATION_KEYS;
|
|
466
|
+
const NUMERIC_VIEW_TYPES$1 = new Set(['Number', 'Currency', 'Percentage']);
|
|
467
|
+
const DATE_VIEW_TYPES = {
|
|
468
|
+
Date: 'date',
|
|
469
|
+
DateTime: 'dateTime',
|
|
470
|
+
Time: 'time',
|
|
471
|
+
};
|
|
472
|
+
const EQUATION_KINDS = new Set([
|
|
473
|
+
'literal',
|
|
474
|
+
'input',
|
|
475
|
+
'semantic',
|
|
476
|
+
'table',
|
|
477
|
+
'binary',
|
|
478
|
+
'unary',
|
|
479
|
+
'function',
|
|
480
|
+
'conditional',
|
|
481
|
+
'array',
|
|
482
|
+
]);
|
|
483
|
+
const OPERATORS = {
|
|
484
|
+
'+': '+',
|
|
485
|
+
'-': '−',
|
|
486
|
+
'*': '×',
|
|
487
|
+
'/': '÷',
|
|
488
|
+
'%': 'mod',
|
|
489
|
+
'==': '=',
|
|
490
|
+
'!=': '≠',
|
|
491
|
+
'<': '<',
|
|
492
|
+
'<=': '≤',
|
|
493
|
+
'>': '>',
|
|
494
|
+
'>=': '≥',
|
|
495
|
+
'&&': 'AND',
|
|
496
|
+
'||': 'OR',
|
|
497
|
+
};
|
|
498
|
+
const SEMANTIC_KEYS = new Set([
|
|
499
|
+
'actual_progress',
|
|
500
|
+
'planned_progress',
|
|
501
|
+
'baseline_progress',
|
|
502
|
+
]);
|
|
503
|
+
const CODE_BLOCK_TYPES = new Set([
|
|
504
|
+
'Source',
|
|
505
|
+
'StaticText',
|
|
506
|
+
'Counter',
|
|
507
|
+
'CurrentDatePart',
|
|
508
|
+
]);
|
|
509
|
+
const SCHEDULE_NOTES = new Set([
|
|
510
|
+
'noEligibleScheduleItems',
|
|
511
|
+
'allWeightsZeroUsingArithmeticMean',
|
|
512
|
+
'zeroWeightItemsExcluded',
|
|
513
|
+
'missingInputsTreatedAsZero',
|
|
514
|
+
'noBaselineProgressInputs',
|
|
515
|
+
]);
|
|
516
|
+
const PLANNED_RULES = new Set([
|
|
517
|
+
'missingDates',
|
|
518
|
+
'invalidDateRange',
|
|
519
|
+
'beforeStart',
|
|
520
|
+
'afterFinish',
|
|
521
|
+
'milestoneDueDate',
|
|
522
|
+
'noWorkingTime',
|
|
523
|
+
'elapsedWorkingMinutes',
|
|
524
|
+
]);
|
|
525
|
+
/** Vector inputs list their values inline up to this many. */
|
|
526
|
+
const INLINE_VALUES = 3;
|
|
527
|
+
/** Source record ids listed before "+n". */
|
|
528
|
+
const LISTED_IDS = 20;
|
|
529
|
+
/** Nested captured data rendered as fields up to this depth, then as JSON. */
|
|
530
|
+
const DATA_DEPTH = 3;
|
|
531
|
+
/** A number as captured: grouped, never rounded, with a real minus sign. */
|
|
532
|
+
function formatExplanationNumber(value) {
|
|
533
|
+
if (!Number.isFinite(value)) {
|
|
534
|
+
return String(value);
|
|
535
|
+
}
|
|
536
|
+
return new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 })
|
|
537
|
+
.format(value)
|
|
538
|
+
.replace(/^-/, '−');
|
|
539
|
+
}
|
|
540
|
+
/** A captured value as plain text. Never formatted or rounded here. */
|
|
541
|
+
function formatExplanationValue(value) {
|
|
542
|
+
if (value === null || value === undefined) {
|
|
543
|
+
return '—';
|
|
544
|
+
}
|
|
545
|
+
return typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* A captured value the way its property shows values: grouped numbers, the
|
|
549
|
+
* application currency, `%`, the configured date format.
|
|
550
|
+
*/
|
|
551
|
+
function formatTypedValue(value, viewType, ctx) {
|
|
552
|
+
if (value === null || value === undefined || value === '') {
|
|
553
|
+
return '—';
|
|
554
|
+
}
|
|
555
|
+
if (Array.isArray(value)) {
|
|
556
|
+
return value
|
|
557
|
+
.map((item) => formatTypedValue(item, viewType, ctx))
|
|
558
|
+
.join(', ');
|
|
559
|
+
}
|
|
560
|
+
if (typeof value === 'object') {
|
|
561
|
+
return JSON.stringify(value);
|
|
562
|
+
}
|
|
563
|
+
if (typeof value === 'boolean') {
|
|
564
|
+
return ctx.translate(`${K}.${value ? 'yes' : 'no'}`);
|
|
565
|
+
}
|
|
566
|
+
const type = viewType ?? '';
|
|
567
|
+
if (typeof value === 'number') {
|
|
568
|
+
return formatTypedNumber(value, type, ctx);
|
|
569
|
+
}
|
|
570
|
+
if (NUMERIC_VIEW_TYPES$1.has(type) && isNumericText(value)) {
|
|
571
|
+
return formatTypedNumber(Number(value), type, ctx);
|
|
572
|
+
}
|
|
573
|
+
const dateType = DATE_VIEW_TYPES[type];
|
|
574
|
+
if (dateType) {
|
|
575
|
+
return ctx.formatDate(value, dateType) || value;
|
|
576
|
+
}
|
|
577
|
+
if (type === 'Checkbox' && (value === 'true' || value === 'false')) {
|
|
578
|
+
return ctx.translate(`${K}.${value === 'true' ? 'yes' : 'no'}`);
|
|
579
|
+
}
|
|
580
|
+
return value;
|
|
581
|
+
}
|
|
582
|
+
function formatTypedNumber(value, viewType, ctx) {
|
|
583
|
+
const text = formatExplanationNumber(value);
|
|
584
|
+
if (viewType === 'Currency') {
|
|
585
|
+
return ctx.currency ? `${text} ${ctx.currency}` : text;
|
|
586
|
+
}
|
|
587
|
+
return viewType === 'Percentage' ? `${text}%` : text;
|
|
588
|
+
}
|
|
589
|
+
function isNumericText(value) {
|
|
590
|
+
return value.trim() !== '' && Number.isFinite(Number(value));
|
|
591
|
+
}
|
|
592
|
+
/** A property's current name in the active language. */
|
|
593
|
+
function displayName(display, lang) {
|
|
594
|
+
if (!display) {
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
597
|
+
const preferred = lang.startsWith('ar')
|
|
598
|
+
? [display.nameAr, display.name, display.nameEn]
|
|
599
|
+
: [display.nameEn, display.name, display.nameAr];
|
|
600
|
+
return preferred.find((name) => !!name?.trim()) ?? null;
|
|
601
|
+
}
|
|
602
|
+
/** `Current::project_budget` → `project_budget`, for an unnamed input. */
|
|
603
|
+
function referenceColumn(reference) {
|
|
604
|
+
if (!reference) {
|
|
605
|
+
return null;
|
|
606
|
+
}
|
|
607
|
+
const at = reference.lastIndexOf('::');
|
|
608
|
+
return at >= 0 ? reference.slice(at + 2) : reference;
|
|
609
|
+
}
|
|
610
|
+
/** `Modules.LevelDataFinancial` → `LevelDataFinancial`. */
|
|
611
|
+
function tableLabel(tablePath) {
|
|
612
|
+
return (tablePath ?? '').replace(/^Modules\./, '') || '—';
|
|
613
|
+
}
|
|
614
|
+
/** `totalLevelWeight` / `is_cancelled` → `Total level weight` / `Is cancelled`. */
|
|
615
|
+
function humanizeKey$1(key) {
|
|
616
|
+
const words = key
|
|
617
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
618
|
+
.replace(/[_.-]+/g, ' ')
|
|
619
|
+
.trim()
|
|
620
|
+
.toLowerCase();
|
|
621
|
+
return words ? words[0].toUpperCase() + words.slice(1) : key;
|
|
622
|
+
}
|
|
623
|
+
function semanticLabel(reference, ctx) {
|
|
624
|
+
const column = referenceColumn(reference);
|
|
625
|
+
return column && SEMANTIC_KEYS.has(column)
|
|
626
|
+
? ctx.translate(`${K}.semantic.${column}`)
|
|
627
|
+
: null;
|
|
628
|
+
}
|
|
629
|
+
function nodeLabel(node, ctx) {
|
|
630
|
+
return (displayName(node.display, ctx.lang) ??
|
|
631
|
+
(node.kind === 'semantic' ? semanticLabel(node.reference, ctx) : null) ??
|
|
632
|
+
referenceColumn(node.reference) ??
|
|
633
|
+
(node.expression || node.kind));
|
|
634
|
+
}
|
|
635
|
+
function nodeValueText(node, ctx) {
|
|
636
|
+
if (node.state === 'notEvaluated') {
|
|
637
|
+
return ctx.translate(`${K}.notEvaluated`);
|
|
638
|
+
}
|
|
639
|
+
const value = node.value;
|
|
640
|
+
const viewType = node.display?.viewType;
|
|
641
|
+
if (Array.isArray(value)) {
|
|
642
|
+
return value.length <= INLINE_VALUES
|
|
643
|
+
? value.map((item) => formatTypedValue(item, viewType, ctx)).join(', ')
|
|
644
|
+
: ctx.translate(`${K}.valueCount`, { count: value.length });
|
|
645
|
+
}
|
|
646
|
+
return formatTypedValue(value, viewType, ctx);
|
|
647
|
+
}
|
|
648
|
+
function scheduleDetailOf(document, reference) {
|
|
649
|
+
return ((reference &&
|
|
650
|
+
document.schedule?.find((detail) => detail.reference === reference)) ||
|
|
651
|
+
null);
|
|
652
|
+
}
|
|
653
|
+
/** `Weighted average of 4 items`. */
|
|
654
|
+
function describeRollup(detail, ctx) {
|
|
655
|
+
if (!['weightedAverage', 'arithmeticMean'].includes(detail.aggregation)) {
|
|
656
|
+
return ctx.translate(`${K}.schedule.aggregation.empty`);
|
|
657
|
+
}
|
|
658
|
+
return ctx.translate(`${K}.schedule.rollup`, {
|
|
659
|
+
aggregation: ctx.translate(`${K}.schedule.aggregation.${detail.aggregation}`),
|
|
660
|
+
count: (detail.contributors ?? []).filter((row) => row.includedInAggregation).length,
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
/** `__central_planned_start` → `Planned start`. */
|
|
664
|
+
function columnLabel(reference) {
|
|
665
|
+
const column = referenceColumn(reference) ?? '';
|
|
666
|
+
return humanizeKey$1(column.replace(/^_+/, '').replace(/^central_/, ''));
|
|
667
|
+
}
|
|
668
|
+
/** Whether the document's root reads as an equation. */
|
|
669
|
+
function isEquationDocument(document) {
|
|
670
|
+
const root = document.nodes?.find((node) => node.id === document.rootNodeId);
|
|
671
|
+
return !!root && EQUATION_KINDS.has(root.kind);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* The calculation as a readable equation: every input by its property name
|
|
675
|
+
* with the value it had, operators as symbols, nested function results shown
|
|
676
|
+
* after the call. `null` when the document is not an equation (a native
|
|
677
|
+
* method, a status selection, a generated code).
|
|
678
|
+
*/
|
|
679
|
+
function buildExplanationSegments(document, ctx) {
|
|
680
|
+
if (!isEquationDocument(document)) {
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
const byId = new Map(document.nodes.map((node) => [node.id, node]));
|
|
684
|
+
const out = [];
|
|
685
|
+
const visited = new Set();
|
|
686
|
+
const render = (id, nested) => {
|
|
687
|
+
const node = byId.get(id);
|
|
688
|
+
if (!node || visited.has(id)) {
|
|
689
|
+
out.push({ kind: 'muted', text: '…' });
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
visited.add(id);
|
|
693
|
+
const notEvaluated = node.state === 'notEvaluated';
|
|
694
|
+
switch (node.kind) {
|
|
695
|
+
case 'literal':
|
|
696
|
+
// Written the way the formula wrote it: `"Paid"`, `true`, `1,000`.
|
|
697
|
+
out.push({
|
|
698
|
+
kind: 'value',
|
|
699
|
+
text: typeof node.value === 'string'
|
|
700
|
+
? `"${node.value}"`
|
|
701
|
+
: typeof node.value === 'number'
|
|
702
|
+
? formatExplanationNumber(node.value)
|
|
703
|
+
: node.expression || formatExplanationValue(node.value),
|
|
704
|
+
});
|
|
705
|
+
return;
|
|
706
|
+
case 'input':
|
|
707
|
+
out.push({
|
|
708
|
+
kind: 'term',
|
|
709
|
+
label: nodeLabel(node, ctx),
|
|
710
|
+
value: nodeValueText(node, ctx),
|
|
711
|
+
});
|
|
712
|
+
return;
|
|
713
|
+
case 'semantic': {
|
|
714
|
+
// A schedule rollup reads as how it was aggregated; its numbers are in
|
|
715
|
+
// the details, and its value follows when it is part of a larger
|
|
716
|
+
// formula.
|
|
717
|
+
const rollup = scheduleDetailOf(document, node.reference);
|
|
718
|
+
out.push({
|
|
719
|
+
kind: 'term',
|
|
720
|
+
label: nodeLabel(node, ctx),
|
|
721
|
+
value: rollup
|
|
722
|
+
? describeRollup(rollup, ctx)
|
|
723
|
+
: nodeValueText(node, ctx),
|
|
724
|
+
});
|
|
725
|
+
if (rollup && nested && node.value !== undefined) {
|
|
726
|
+
out.push({
|
|
727
|
+
kind: 'result',
|
|
728
|
+
text: formatTypedValue(node.value, null, ctx),
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
case 'table': {
|
|
734
|
+
const rows = Math.max(0, ...node.children.map((child) => byId.get(child)?.recordIds?.length ?? 0));
|
|
735
|
+
out.push({
|
|
736
|
+
kind: 'term',
|
|
737
|
+
label: tableLabel(node.reference),
|
|
738
|
+
value: ctx.translate(`${K}.recordCount`, { count: rows }),
|
|
739
|
+
});
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
case 'binary': {
|
|
743
|
+
if (notEvaluated) {
|
|
744
|
+
out.push({ kind: 'muted', text: ctx.translate(`${K}.notEvaluated`) });
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
if (nested)
|
|
748
|
+
out.push({ kind: 'text', text: '(' });
|
|
749
|
+
render(node.children[0], true);
|
|
750
|
+
out.push({
|
|
751
|
+
kind: 'text',
|
|
752
|
+
text: OPERATORS[node.operation ?? ''] ?? node.operation ?? '?',
|
|
753
|
+
});
|
|
754
|
+
render(node.children[1], true);
|
|
755
|
+
if (nested)
|
|
756
|
+
out.push({ kind: 'text', text: ')' });
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
case 'unary':
|
|
760
|
+
out.push({
|
|
761
|
+
kind: 'text',
|
|
762
|
+
text: node.operation === 'Negate'
|
|
763
|
+
? '−'
|
|
764
|
+
: node.operation === 'Not'
|
|
765
|
+
? 'NOT'
|
|
766
|
+
: '+',
|
|
767
|
+
});
|
|
768
|
+
render(node.children[0], true);
|
|
769
|
+
return;
|
|
770
|
+
case 'function':
|
|
771
|
+
case 'conditional':
|
|
772
|
+
case 'array': {
|
|
773
|
+
if (notEvaluated) {
|
|
774
|
+
out.push({ kind: 'muted', text: ctx.translate(`${K}.notEvaluated`) });
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
const array = node.kind === 'array';
|
|
778
|
+
out.push({
|
|
779
|
+
kind: 'text',
|
|
780
|
+
text: array ? '[' : `${node.operation ?? node.kind}(`,
|
|
781
|
+
});
|
|
782
|
+
node.children.forEach((child, index) => {
|
|
783
|
+
if (index > 0)
|
|
784
|
+
out.push({ kind: 'text', text: ',' });
|
|
785
|
+
const name = node.argumentNames?.[index];
|
|
786
|
+
if (name)
|
|
787
|
+
out.push({ kind: 'text', text: `${name}:` });
|
|
788
|
+
render(child, false);
|
|
789
|
+
});
|
|
790
|
+
out.push({ kind: 'text', text: array ? ']' : ')' });
|
|
791
|
+
if (nested && !array && node.value !== undefined) {
|
|
792
|
+
out.push({
|
|
793
|
+
kind: 'result',
|
|
794
|
+
text: formatTypedValue(node.value, null, ctx),
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
default:
|
|
800
|
+
// A kind this version does not know: shown as labelled data.
|
|
801
|
+
out.push({
|
|
802
|
+
kind: 'term',
|
|
803
|
+
label: node.expression || node.kind,
|
|
804
|
+
value: formatTypedValue(node.value, null, ctx),
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
render(document.rootNodeId, false);
|
|
809
|
+
return out;
|
|
810
|
+
}
|
|
811
|
+
/** Captured JSON (native method facts) as labelled fields, lists or tables. */
|
|
812
|
+
function toExplanationData(value, ctx, depth = 0) {
|
|
813
|
+
if (value === null || value === undefined || typeof value !== 'object') {
|
|
814
|
+
return { kind: 'text', text: formatTypedValue(value, null, ctx) };
|
|
815
|
+
}
|
|
816
|
+
if (depth >= DATA_DEPTH) {
|
|
817
|
+
return { kind: 'text', text: JSON.stringify(value) };
|
|
818
|
+
}
|
|
819
|
+
if (Array.isArray(value)) {
|
|
820
|
+
if (value.length === 0) {
|
|
821
|
+
return { kind: 'text', text: '—' };
|
|
822
|
+
}
|
|
823
|
+
if (value.every((item) => item === null || typeof item !== 'object')) {
|
|
824
|
+
return {
|
|
825
|
+
kind: 'list',
|
|
826
|
+
items: value.map((item) => formatTypedValue(item, null, ctx)),
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
if (value.every((item) => isPlainObject(item))) {
|
|
830
|
+
const records = value;
|
|
831
|
+
const columns = [...new Set(records.flatMap((row) => Object.keys(row)))];
|
|
832
|
+
return {
|
|
833
|
+
kind: 'table',
|
|
834
|
+
columns: columns.map(humanizeKey$1),
|
|
835
|
+
rows: records.map((row) => columns.map((column) => formatTypedValue(row[column], null, ctx))),
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
return {
|
|
839
|
+
kind: 'list',
|
|
840
|
+
items: value.map((item) => formatTypedValue(item, null, ctx)),
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
return {
|
|
844
|
+
kind: 'fields',
|
|
845
|
+
fields: Object.entries(value).map(([key, item]) => ({
|
|
846
|
+
label: humanizeKey$1(key),
|
|
847
|
+
data: toExplanationData(item, ctx, depth + 1),
|
|
848
|
+
})),
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function isPlainObject(value) {
|
|
852
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
853
|
+
}
|
|
854
|
+
/** Everything the expandable details show, read from the document as is. */
|
|
855
|
+
function buildExplanationDetails(document, ctx, statusNames = {}) {
|
|
856
|
+
const equation = isEquationDocument(document);
|
|
857
|
+
const nodes = document.nodes ?? [];
|
|
858
|
+
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
859
|
+
const inputs = [];
|
|
860
|
+
const functions = [];
|
|
861
|
+
const facts = [];
|
|
862
|
+
const codeBlocks = [];
|
|
863
|
+
const seenInputs = new Set();
|
|
864
|
+
// A schedule rollup's own columns (`__central_progress`, …) are internal:
|
|
865
|
+
// the schedule section shows them as contributors, or else one table does.
|
|
866
|
+
const rollupColumns = new Set();
|
|
867
|
+
for (const node of nodes) {
|
|
868
|
+
if (node.kind !== 'semantic' || !node.children.length)
|
|
869
|
+
continue;
|
|
870
|
+
node.children.forEach((child) => rollupColumns.add(child));
|
|
871
|
+
if (!scheduleDetailOf(document, node.reference)) {
|
|
872
|
+
facts.push({
|
|
873
|
+
label: nodeLabel(node, ctx),
|
|
874
|
+
data: rollupTable(node, byId, ctx),
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
for (const node of nodes) {
|
|
879
|
+
if ((node.id === document.rootNodeId && !equation) ||
|
|
880
|
+
rollupColumns.has(node.id)) {
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
switch (node.kind) {
|
|
884
|
+
case 'input':
|
|
885
|
+
case 'semantic': {
|
|
886
|
+
if (!equation) {
|
|
887
|
+
// A native method's observed facts: a label and any JSON.
|
|
888
|
+
facts.push({
|
|
889
|
+
label: node.expression || node.kind,
|
|
890
|
+
data: toExplanationData(node.value, ctx),
|
|
891
|
+
});
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
// A rollup the schedule section explains is not repeated here.
|
|
895
|
+
if (node.kind === 'semantic' &&
|
|
896
|
+
scheduleDetailOf(document, node.reference)) {
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
const id = `${node.reference}|${(node.recordIds ?? []).join(',')}`;
|
|
900
|
+
if (seenInputs.has(id))
|
|
901
|
+
break;
|
|
902
|
+
seenInputs.add(id);
|
|
903
|
+
inputs.push(toInputView(node, ctx));
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
case 'function':
|
|
907
|
+
case 'conditional':
|
|
908
|
+
if (document.provider === 'codeBuilder')
|
|
909
|
+
break;
|
|
910
|
+
functions.push({
|
|
911
|
+
name: node.operation ?? node.kind,
|
|
912
|
+
result: node.state === 'notEvaluated'
|
|
913
|
+
? ctx.translate(`${K}.notEvaluated`)
|
|
914
|
+
: formatTypedValue(node.value, null, ctx),
|
|
915
|
+
notEvaluated: node.state === 'notEvaluated',
|
|
916
|
+
});
|
|
917
|
+
break;
|
|
918
|
+
case 'codeBlock': {
|
|
919
|
+
const raw = byId.get(node.children[0]);
|
|
920
|
+
const value = formatTypedValue(node.value, null, ctx);
|
|
921
|
+
const rawText = raw && raw.value !== undefined
|
|
922
|
+
? formatTypedValue(raw.value, null, ctx)
|
|
923
|
+
: null;
|
|
924
|
+
codeBlocks.push({
|
|
925
|
+
type: CODE_BLOCK_TYPES.has(node.operation ?? '')
|
|
926
|
+
? ctx.translate(`${K}.codeBlock.${node.operation}`)
|
|
927
|
+
: (node.operation ?? node.kind),
|
|
928
|
+
value,
|
|
929
|
+
raw: rawText !== null && rawText !== value ? rawText : null,
|
|
930
|
+
settings: parseSettings(node.expression, ctx),
|
|
931
|
+
});
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
case 'literal':
|
|
935
|
+
case 'binary':
|
|
936
|
+
case 'unary':
|
|
937
|
+
case 'array':
|
|
938
|
+
case 'table':
|
|
939
|
+
case 'selection':
|
|
940
|
+
case 'method':
|
|
941
|
+
break;
|
|
942
|
+
default:
|
|
943
|
+
facts.push({
|
|
944
|
+
label: node.expression || node.kind,
|
|
945
|
+
data: toExplanationData(node.value, ctx),
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
// A status, a generated code and a native method carry a description or
|
|
950
|
+
// their configuration in `formula`; only a formula is shown as one.
|
|
951
|
+
const showFormula = equation && document.provider === 'formula';
|
|
952
|
+
return {
|
|
953
|
+
formula: showFormula ? document.formula?.trim() || null : null,
|
|
954
|
+
// A formula that is only a schedule rollup has its substitution there.
|
|
955
|
+
formulaWithValues: showFormula &&
|
|
956
|
+
!(document.schedule ?? []).some((detail) => detail.formulaWithValues === document.formulaWithValues)
|
|
957
|
+
? document.formulaWithValues
|
|
958
|
+
: null,
|
|
959
|
+
inputs,
|
|
960
|
+
functions,
|
|
961
|
+
facts,
|
|
962
|
+
codeBlocks,
|
|
963
|
+
statusRules: (document.statusRules ?? [])
|
|
964
|
+
.slice()
|
|
965
|
+
.sort((a, b) => a.order - b.order)
|
|
966
|
+
.map((rule) => toStatusRuleView(rule, ctx, statusNames)),
|
|
967
|
+
schedule: (document.schedule ?? []).map((detail) => toScheduleView(detail, ctx)),
|
|
968
|
+
sources: mergeSources(document),
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
/** Records per source table; one table read in several contexts is one row. */
|
|
972
|
+
function mergeSources(document) {
|
|
973
|
+
const byLabel = new Map();
|
|
974
|
+
for (const source of document.sources ?? []) {
|
|
975
|
+
if (!source.recordIds?.length)
|
|
976
|
+
continue;
|
|
977
|
+
const label = tableLabel(source.tablePath);
|
|
978
|
+
const ids = byLabel.get(label) ?? [];
|
|
979
|
+
for (const id of source.recordIds)
|
|
980
|
+
if (!ids.includes(id))
|
|
981
|
+
ids.push(id);
|
|
982
|
+
byLabel.set(label, ids);
|
|
983
|
+
}
|
|
984
|
+
return [...byLabel].map(([label, ids]) => ({
|
|
985
|
+
label,
|
|
986
|
+
count: ids.length,
|
|
987
|
+
ids: listIds(ids),
|
|
988
|
+
}));
|
|
989
|
+
}
|
|
990
|
+
/** A rollup's columns side by side, one row per record. */
|
|
991
|
+
function rollupTable(node, byId, ctx) {
|
|
992
|
+
const columns = node.children
|
|
993
|
+
.map((id) => byId.get(id))
|
|
994
|
+
.filter((column) => !!column);
|
|
995
|
+
const recordIds = columns.find((column) => column.recordIds?.length)?.recordIds;
|
|
996
|
+
if (!recordIds?.length) {
|
|
997
|
+
return { kind: 'text', text: nodeValueText(node, ctx) };
|
|
998
|
+
}
|
|
999
|
+
return {
|
|
1000
|
+
kind: 'table',
|
|
1001
|
+
columns: ['#', ...columns.map((column) => columnLabel(column.reference))],
|
|
1002
|
+
rows: recordIds.map((recordId, index) => [
|
|
1003
|
+
String(recordId),
|
|
1004
|
+
...columns.map((column) => formatTypedValue(Array.isArray(column.value) ? column.value[index] : null, null, ctx)),
|
|
1005
|
+
]),
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
/** Whether the details have anything to expand. */
|
|
1009
|
+
function hasExplanationDetails(view) {
|
|
1010
|
+
return (!!view.formula ||
|
|
1011
|
+
view.inputs.length > 0 ||
|
|
1012
|
+
view.functions.length > 0 ||
|
|
1013
|
+
view.facts.length > 0 ||
|
|
1014
|
+
view.codeBlocks.length > 0 ||
|
|
1015
|
+
view.statusRules.length > 0 ||
|
|
1016
|
+
view.schedule.length > 0 ||
|
|
1017
|
+
view.sources.length > 0);
|
|
1018
|
+
}
|
|
1019
|
+
/** A generated code as its parts: `PRJ + - + 2026 + - + 0042`. */
|
|
1020
|
+
function buildCodeSegments(document, ctx) {
|
|
1021
|
+
const blocks = (document.nodes ?? []).filter((node) => node.kind === 'codeBlock');
|
|
1022
|
+
return blocks.flatMap((node, index) => [
|
|
1023
|
+
...(index > 0 ? [{ kind: 'text', text: '+' }] : []),
|
|
1024
|
+
{
|
|
1025
|
+
kind: 'value',
|
|
1026
|
+
text: JSON.stringify(formatTypedValue(node.value, null, ctx)),
|
|
1027
|
+
},
|
|
1028
|
+
]);
|
|
1029
|
+
}
|
|
1030
|
+
function toInputView(node, ctx) {
|
|
1031
|
+
const viewType = node.display?.viewType;
|
|
1032
|
+
const values = Array.isArray(node.value) ? node.value : null;
|
|
1033
|
+
return {
|
|
1034
|
+
label: nodeLabel(node, ctx),
|
|
1035
|
+
value: values
|
|
1036
|
+
? ctx.translate(`${K}.valueCount`, { count: values.length })
|
|
1037
|
+
: nodeValueText(node, ctx),
|
|
1038
|
+
rows: values
|
|
1039
|
+
? values.map((value, index) => ({
|
|
1040
|
+
recordId: node.recordIds?.[index] ?? null,
|
|
1041
|
+
value: formatTypedValue(value, viewType, ctx),
|
|
1042
|
+
}))
|
|
1043
|
+
: [],
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
function parseSettings(expression, ctx) {
|
|
1047
|
+
try {
|
|
1048
|
+
const parsed = JSON.parse(expression);
|
|
1049
|
+
if (!isPlainObject(parsed)) {
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
// The block type is already the part's title.
|
|
1053
|
+
const settings = Object.fromEntries(Object.entries(parsed).filter(([key]) => key.toLowerCase() !== 'blocktype'));
|
|
1054
|
+
return Object.keys(settings).length
|
|
1055
|
+
? toExplanationData(settings, ctx)
|
|
1056
|
+
: null;
|
|
1057
|
+
}
|
|
1058
|
+
catch {
|
|
1059
|
+
return null;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
/** The status a rule selects, by the name the host knows or its key. */
|
|
1063
|
+
function statusName(key, statusNames) {
|
|
1064
|
+
return statusNames[key] || key;
|
|
1065
|
+
}
|
|
1066
|
+
function toStatusRuleView(rule, ctx, statusNames) {
|
|
1067
|
+
const result = rule.condition?.result;
|
|
1068
|
+
const verdict = rule.selected
|
|
1069
|
+
? 'selected'
|
|
1070
|
+
: rule.state === 'failed'
|
|
1071
|
+
? 'failed'
|
|
1072
|
+
: rule.state === 'notEvaluated'
|
|
1073
|
+
? 'notEvaluated'
|
|
1074
|
+
: result === true
|
|
1075
|
+
? 'matched'
|
|
1076
|
+
: result === false
|
|
1077
|
+
? 'notMatched'
|
|
1078
|
+
: 'checked';
|
|
1079
|
+
return {
|
|
1080
|
+
key: rule.key,
|
|
1081
|
+
name: statusName(rule.key, statusNames),
|
|
1082
|
+
order: rule.order,
|
|
1083
|
+
verdict,
|
|
1084
|
+
segments: rule.condition
|
|
1085
|
+
? buildExplanationSegments(rule.condition, ctx)
|
|
1086
|
+
: null,
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
/** The rule that chose the status, if one did. */
|
|
1090
|
+
function selectedStatusRule(document) {
|
|
1091
|
+
return document.statusRules?.find((rule) => rule.selected) ?? null;
|
|
1092
|
+
}
|
|
1093
|
+
function toScheduleView(detail, ctx) {
|
|
1094
|
+
const t = (key, params) => ctx.translate(`${K}.schedule.${key}`, params);
|
|
1095
|
+
const known = (set, prefix, code) => set.has(code) ? t(`${prefix}.${code}`) : code;
|
|
1096
|
+
const percent = (value) => `${formatExplanationNumber(value)}%`;
|
|
1097
|
+
const facts = [
|
|
1098
|
+
t('asOf', { time: ctx.formatDate(detail.asOfUtc, 'dateTime') }),
|
|
1099
|
+
detail.weightMode === 'workingDays' ||
|
|
1100
|
+
detail.weightMode === 'explicitWeight'
|
|
1101
|
+
? t(`weightMode.${detail.weightMode}`)
|
|
1102
|
+
: detail.weightMode,
|
|
1103
|
+
['weightedAverage', 'arithmeticMean', 'empty'].includes(detail.aggregation)
|
|
1104
|
+
? t(`aggregation.${detail.aggregation}`)
|
|
1105
|
+
: detail.aggregation,
|
|
1106
|
+
t('rounding', { digits: detail.roundingDigits }),
|
|
1107
|
+
t(detail.includeMilestones ? 'milestonesIncluded' : 'milestonesExcluded'),
|
|
1108
|
+
...(detail.excludeSameDayMilestones
|
|
1109
|
+
? [t('sameDayMilestonesExcluded')]
|
|
1110
|
+
: []),
|
|
1111
|
+
...(detail.leafOnly ? [t('leafOnly')] : []),
|
|
1112
|
+
...(detail.excludedRowCount > 0
|
|
1113
|
+
? [t('excludedRows', { count: detail.excludedRowCount })]
|
|
1114
|
+
: []),
|
|
1115
|
+
].filter((fact) => !!fact);
|
|
1116
|
+
const contributors = detail.contributors ?? [];
|
|
1117
|
+
const planned = contributors
|
|
1118
|
+
.filter((row) => !!row.plannedCalculation)
|
|
1119
|
+
.map((row) => {
|
|
1120
|
+
const plan = row.plannedCalculation;
|
|
1121
|
+
const start = plan.plannedStart ?? row.plannedStart;
|
|
1122
|
+
const finish = plan.plannedFinish ?? row.plannedFinish;
|
|
1123
|
+
return {
|
|
1124
|
+
recordId: row.recordId,
|
|
1125
|
+
rule: known(PLANNED_RULES, 'plannedRule', plan.rule),
|
|
1126
|
+
minutes: plan.elapsedWorkingMinutes !== null &&
|
|
1127
|
+
plan.totalWorkingMinutes !== null
|
|
1128
|
+
? t('workingMinutes', {
|
|
1129
|
+
elapsed: formatExplanationNumber(plan.elapsedWorkingMinutes),
|
|
1130
|
+
total: formatExplanationNumber(plan.totalWorkingMinutes),
|
|
1131
|
+
})
|
|
1132
|
+
: null,
|
|
1133
|
+
dates: start || finish
|
|
1134
|
+
? `${start ? ctx.formatDate(start, 'date') : '—'} → ${finish ? ctx.formatDate(finish, 'date') : '—'}`
|
|
1135
|
+
: null,
|
|
1136
|
+
};
|
|
1137
|
+
});
|
|
1138
|
+
const calendarSource = contributors.find((row) => !!row.plannedCalculation)?.plannedCalculation;
|
|
1139
|
+
return {
|
|
1140
|
+
title: semanticLabel(detail.reference, ctx) ??
|
|
1141
|
+
referenceColumn(detail.reference) ??
|
|
1142
|
+
detail.reference,
|
|
1143
|
+
result: percent(detail.result),
|
|
1144
|
+
formulaWithValues: detail.formulaWithValues,
|
|
1145
|
+
facts,
|
|
1146
|
+
notes: (detail.notes ?? []).map((note) => known(SCHEDULE_NOTES, 'note', note)),
|
|
1147
|
+
contributors: contributors.map((row) => ({
|
|
1148
|
+
recordId: row.recordId,
|
|
1149
|
+
progress: percent(row.progress),
|
|
1150
|
+
weight: formatExplanationNumber(row.weight),
|
|
1151
|
+
included: row.includedInAggregation,
|
|
1152
|
+
inputMissing: row.inputMissing,
|
|
1153
|
+
})),
|
|
1154
|
+
planned,
|
|
1155
|
+
calendar: calendarSource
|
|
1156
|
+
? {
|
|
1157
|
+
timeZone: calendarSource.timeZoneId,
|
|
1158
|
+
source: calendarSource.calendarSource,
|
|
1159
|
+
workingHours: `${clock(calendarSource.workDayStartMinute)}–${clock(calendarSource.workDayEndMinute)}`,
|
|
1160
|
+
workingDays: (calendarSource.workingDays ?? [])
|
|
1161
|
+
.map((day) => weekdayName(day, ctx.lang))
|
|
1162
|
+
.join(', '),
|
|
1163
|
+
holidays: (calendarSource.holidays ?? [])
|
|
1164
|
+
.map((day) => ctx.formatDate(day, 'date') || day)
|
|
1165
|
+
.join(', '),
|
|
1166
|
+
}
|
|
1167
|
+
: null,
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
/** Minutes after midnight as `08:30`. */
|
|
1171
|
+
function clock(minutes) {
|
|
1172
|
+
const h = Math.floor(minutes / 60);
|
|
1173
|
+
const m = minutes % 60;
|
|
1174
|
+
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
|
|
1175
|
+
}
|
|
1176
|
+
/** Sunday = 0, named in the active language. */
|
|
1177
|
+
function weekdayName(day, lang) {
|
|
1178
|
+
// 2023-01-01 was a Sunday.
|
|
1179
|
+
const date = new Date(Date.UTC(2023, 0, 1 + day));
|
|
1180
|
+
try {
|
|
1181
|
+
return new Intl.DateTimeFormat(lang, {
|
|
1182
|
+
weekday: 'short',
|
|
1183
|
+
timeZone: 'UTC',
|
|
1184
|
+
}).format(date);
|
|
1185
|
+
}
|
|
1186
|
+
catch {
|
|
1187
|
+
return String(day);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function listIds(ids) {
|
|
1191
|
+
const shown = ids.slice(0, LISTED_IDS).map((id) => `#${id}`);
|
|
1192
|
+
return ids.length > LISTED_IDS
|
|
1193
|
+
? `${shown.join(', ')} +${ids.length - LISTED_IDS}`
|
|
1194
|
+
: shown.join(', ');
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/** Pieces that hug their neighbour: `(a`, `a)`, `a,`, `f(a`. */
|
|
1198
|
+
const OPENERS = /[([]$/;
|
|
1199
|
+
const CLOSERS = /^[)\],]$/;
|
|
1200
|
+
/**
|
|
1201
|
+
* A readable equation: `Budget (12,000 SAR) − Spent (15,000 SAR) = −3,000 SAR`.
|
|
1202
|
+
* A left-to-right block in every language, like a formula in a spreadsheet:
|
|
1203
|
+
* inside a right-to-left page an inline left-to-right run breaks across lines
|
|
1204
|
+
* in the wrong order. Each term is isolated and kept whole, so an Arabic name
|
|
1205
|
+
* reads with its own value. Every piece is interpolated as text.
|
|
1206
|
+
*/
|
|
1207
|
+
class CalculationExplanationEquation {
|
|
1208
|
+
segments = input.required(...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
1209
|
+
/** Shown after the equation, behind `resultOperator`. */
|
|
1210
|
+
result = input(null, ...(ngDevMode ? [{ debugName: "result" }] : /* istanbul ignore next */ []));
|
|
1211
|
+
resultOperator = input('=', ...(ngDevMode ? [{ debugName: "resultOperator" }] : /* istanbul ignore next */ []));
|
|
1212
|
+
pieces = computed(() => {
|
|
1213
|
+
const segments = this.segments();
|
|
1214
|
+
return segments.map((segment, index) => {
|
|
1215
|
+
const next = segments[index + 1];
|
|
1216
|
+
const text = segment.kind === 'text' ? segment.text : '';
|
|
1217
|
+
const nextText = next?.kind === 'text' ? next.text : '';
|
|
1218
|
+
return {
|
|
1219
|
+
segment,
|
|
1220
|
+
space: !!next && !OPENERS.test(text) && !CLOSERS.test(nextText),
|
|
1221
|
+
};
|
|
1222
|
+
});
|
|
1223
|
+
}, ...(ngDevMode ? [{ debugName: "pieces" }] : /* istanbul ignore next */ []));
|
|
1224
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationEquation, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1225
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CalculationExplanationEquation, isStandalone: true, selector: "mt-calculation-explanation-equation", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: true, transformFunction: null }, result: { classPropertyName: "result", publicName: "result", isSignal: true, isRequired: false, transformFunction: null }, resultOperator: { classPropertyName: "resultOperator", publicName: "resultOperator", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1226
|
+
<div dir="ltr" class="text-left break-words">
|
|
1227
|
+
@for (piece of pieces(); track $index) {
|
|
1228
|
+
@switch (piece.segment.kind) {
|
|
1229
|
+
@case ('term') {
|
|
1230
|
+
<bdi class="inline-block max-w-full"
|
|
1231
|
+
><span class="font-medium text-surface-900 dark:text-surface-0">{{
|
|
1232
|
+
piece.segment.label
|
|
1233
|
+
}}</span>
|
|
1234
|
+
@if (piece.segment.value !== null) {
|
|
1235
|
+
<!-- The leading space lives inside the text node: Angular
|
|
1236
|
+
drops whitespace-only nodes between elements. -->
|
|
1237
|
+
<span class="text-surface-500 dark:text-surface-400">
|
|
1238
|
+
({{ piece.segment.value }})</span
|
|
1239
|
+
>
|
|
1240
|
+
}
|
|
1241
|
+
</bdi>
|
|
1242
|
+
}
|
|
1243
|
+
@case ('value') {
|
|
1244
|
+
<bdi class="font-mono text-surface-800 dark:text-surface-100">{{
|
|
1245
|
+
piece.segment.text
|
|
1246
|
+
}}</bdi>
|
|
1247
|
+
}
|
|
1248
|
+
@case ('result') {
|
|
1249
|
+
<bdi class="text-surface-500 dark:text-surface-400"
|
|
1250
|
+
>→ {{ piece.segment.text }}</bdi
|
|
1251
|
+
>
|
|
1252
|
+
}
|
|
1253
|
+
@case ('muted') {
|
|
1254
|
+
<span class="text-surface-400 italic">{{
|
|
1255
|
+
piece.segment.text
|
|
1256
|
+
}}</span>
|
|
1257
|
+
}
|
|
1258
|
+
@default {
|
|
1259
|
+
<span class="text-surface-500 dark:text-surface-400">{{
|
|
1260
|
+
piece.segment.text
|
|
1261
|
+
}}</span>
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
@if (piece.space) {
|
|
1265
|
+
{{ ' ' }}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
@if (result(); as value) {
|
|
1269
|
+
<span class="text-surface-400"> {{ resultOperator() }} </span>
|
|
1270
|
+
<bdi class="font-semibold text-surface-900 dark:text-surface-0">{{
|
|
1271
|
+
value
|
|
1272
|
+
}}</bdi>
|
|
1273
|
+
}
|
|
1274
|
+
</div>
|
|
1275
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1276
|
+
}
|
|
1277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationEquation, decorators: [{
|
|
1278
|
+
type: Component,
|
|
1279
|
+
args: [{
|
|
1280
|
+
selector: 'mt-calculation-explanation-equation',
|
|
1281
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1282
|
+
template: `
|
|
1283
|
+
<div dir="ltr" class="text-left break-words">
|
|
1284
|
+
@for (piece of pieces(); track $index) {
|
|
1285
|
+
@switch (piece.segment.kind) {
|
|
1286
|
+
@case ('term') {
|
|
1287
|
+
<bdi class="inline-block max-w-full"
|
|
1288
|
+
><span class="font-medium text-surface-900 dark:text-surface-0">{{
|
|
1289
|
+
piece.segment.label
|
|
1290
|
+
}}</span>
|
|
1291
|
+
@if (piece.segment.value !== null) {
|
|
1292
|
+
<!-- The leading space lives inside the text node: Angular
|
|
1293
|
+
drops whitespace-only nodes between elements. -->
|
|
1294
|
+
<span class="text-surface-500 dark:text-surface-400">
|
|
1295
|
+
({{ piece.segment.value }})</span
|
|
1296
|
+
>
|
|
1297
|
+
}
|
|
1298
|
+
</bdi>
|
|
1299
|
+
}
|
|
1300
|
+
@case ('value') {
|
|
1301
|
+
<bdi class="font-mono text-surface-800 dark:text-surface-100">{{
|
|
1302
|
+
piece.segment.text
|
|
1303
|
+
}}</bdi>
|
|
1304
|
+
}
|
|
1305
|
+
@case ('result') {
|
|
1306
|
+
<bdi class="text-surface-500 dark:text-surface-400"
|
|
1307
|
+
>→ {{ piece.segment.text }}</bdi
|
|
1308
|
+
>
|
|
1309
|
+
}
|
|
1310
|
+
@case ('muted') {
|
|
1311
|
+
<span class="text-surface-400 italic">{{
|
|
1312
|
+
piece.segment.text
|
|
1313
|
+
}}</span>
|
|
1314
|
+
}
|
|
1315
|
+
@default {
|
|
1316
|
+
<span class="text-surface-500 dark:text-surface-400">{{
|
|
1317
|
+
piece.segment.text
|
|
1318
|
+
}}</span>
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
@if (piece.space) {
|
|
1322
|
+
{{ ' ' }}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
@if (result(); as value) {
|
|
1326
|
+
<span class="text-surface-400"> {{ resultOperator() }} </span>
|
|
1327
|
+
<bdi class="font-semibold text-surface-900 dark:text-surface-0">{{
|
|
1328
|
+
value
|
|
1329
|
+
}}</bdi>
|
|
1330
|
+
}
|
|
1331
|
+
</div>
|
|
1332
|
+
`,
|
|
1333
|
+
}]
|
|
1334
|
+
}], propDecorators: { segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: true }] }], result: [{ type: i0.Input, args: [{ isSignal: true, alias: "result", required: false }] }], resultOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "resultOperator", required: false }] }] } });
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* The expandable part of an explanation: the inputs with the rows they came
|
|
1338
|
+
* from, function results, status rules, schedule rollups, generated-code
|
|
1339
|
+
* parts and contributing records. Everything is the backend's captured data,
|
|
1340
|
+
* shown as text; nothing is recalculated here.
|
|
1341
|
+
*/
|
|
1342
|
+
class CalculationExplanationDetails {
|
|
1343
|
+
details = input.required(...(ngDevMode ? [{ debugName: "details" }] : /* istanbul ignore next */ []));
|
|
1344
|
+
prefix = CALCULATION_EXPLANATION_KEYS;
|
|
1345
|
+
scheduleKeys = `${CALCULATION_EXPLANATION_KEYS}.schedule`;
|
|
1346
|
+
verdictClass = {
|
|
1347
|
+
selected: 'bg-primary-100 text-primary-700',
|
|
1348
|
+
matched: 'bg-green-50 text-green-700',
|
|
1349
|
+
notMatched: 'bg-surface-100 text-surface-600',
|
|
1350
|
+
checked: 'bg-surface-100 text-surface-600',
|
|
1351
|
+
failed: 'bg-red-50 text-red-700',
|
|
1352
|
+
notEvaluated: 'bg-surface-100 text-surface-400',
|
|
1353
|
+
};
|
|
1354
|
+
hasMissingInput(rows) {
|
|
1355
|
+
return rows.some((row) => row.inputMissing);
|
|
1356
|
+
}
|
|
1357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationDetails, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1358
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CalculationExplanationDetails, isStandalone: true, selector: "mt-calculation-explanation-details", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
1359
|
+
<ng-template #section let-title>
|
|
1360
|
+
<div class="text-xs font-semibold text-surface-500 dark:text-surface-400">
|
|
1361
|
+
{{ prefix + '.' + title | transloco }}
|
|
1362
|
+
</div>
|
|
1363
|
+
</ng-template>
|
|
1364
|
+
|
|
1365
|
+
<ng-template #dataTpl let-data>
|
|
1366
|
+
@switch (data.kind) {
|
|
1367
|
+
@case ('text') {
|
|
1368
|
+
<span class="break-words">{{ data.text }}</span>
|
|
1369
|
+
}
|
|
1370
|
+
@case ('list') {
|
|
1371
|
+
<span class="break-words">{{ data.items.join(', ') }}</span>
|
|
1372
|
+
}
|
|
1373
|
+
@case ('table') {
|
|
1374
|
+
<div class="overflow-x-auto">
|
|
1375
|
+
<table class="w-full text-xs">
|
|
1376
|
+
<thead>
|
|
1377
|
+
<tr class="text-surface-500 dark:text-surface-400">
|
|
1378
|
+
@for (column of data.columns; track $index) {
|
|
1379
|
+
<th class="px-1 py-0.5 text-start font-medium">
|
|
1380
|
+
{{ column }}
|
|
1381
|
+
</th>
|
|
1382
|
+
}
|
|
1383
|
+
</tr>
|
|
1384
|
+
</thead>
|
|
1385
|
+
<tbody>
|
|
1386
|
+
@for (row of data.rows; track $index) {
|
|
1387
|
+
<tr
|
|
1388
|
+
class="border-t border-surface-100 dark:border-surface-700"
|
|
1389
|
+
>
|
|
1390
|
+
@for (cell of row; track $index) {
|
|
1391
|
+
<td class="px-1 py-0.5 align-top break-words">
|
|
1392
|
+
{{ cell }}
|
|
1393
|
+
</td>
|
|
1394
|
+
}
|
|
1395
|
+
</tr>
|
|
1396
|
+
}
|
|
1397
|
+
</tbody>
|
|
1398
|
+
</table>
|
|
1399
|
+
</div>
|
|
1400
|
+
}
|
|
1401
|
+
@case ('fields') {
|
|
1402
|
+
<dl class="flex flex-col gap-1">
|
|
1403
|
+
@for (field of data.fields; track $index) {
|
|
1404
|
+
<div class="flex flex-col">
|
|
1405
|
+
<dt class="text-xs text-surface-500 dark:text-surface-400">
|
|
1406
|
+
{{ field.label }}
|
|
1407
|
+
</dt>
|
|
1408
|
+
<dd class="ms-0">
|
|
1409
|
+
<ng-container
|
|
1410
|
+
[ngTemplateOutlet]="dataTpl"
|
|
1411
|
+
[ngTemplateOutletContext]="{ $implicit: field.data }"
|
|
1412
|
+
/>
|
|
1413
|
+
</dd>
|
|
1414
|
+
</div>
|
|
1415
|
+
}
|
|
1416
|
+
</dl>
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
</ng-template>
|
|
1420
|
+
|
|
1421
|
+
@let view = details();
|
|
1422
|
+
<div
|
|
1423
|
+
class="flex flex-col gap-3 text-xs text-surface-700 dark:text-surface-200"
|
|
1424
|
+
>
|
|
1425
|
+
@if (view.formula) {
|
|
1426
|
+
<div class="flex flex-col gap-1">
|
|
1427
|
+
<ng-container
|
|
1428
|
+
[ngTemplateOutlet]="section"
|
|
1429
|
+
[ngTemplateOutletContext]="{ $implicit: 'formula' }"
|
|
1430
|
+
/>
|
|
1431
|
+
<code
|
|
1432
|
+
dir="ltr"
|
|
1433
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-2 py-1 font-mono break-all dark:border-surface-700 dark:bg-surface-800"
|
|
1434
|
+
>{{ view.formula }}</code
|
|
1435
|
+
>
|
|
1436
|
+
@if (view.formulaWithValues) {
|
|
1437
|
+
<span class="text-surface-500 dark:text-surface-400">
|
|
1438
|
+
{{ prefix + '.withValues' | transloco }}
|
|
1439
|
+
</span>
|
|
1440
|
+
<code
|
|
1441
|
+
dir="ltr"
|
|
1442
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-2 py-1 font-mono break-all dark:border-surface-700 dark:bg-surface-800"
|
|
1443
|
+
>{{ view.formulaWithValues }}</code
|
|
1444
|
+
>
|
|
1445
|
+
}
|
|
1446
|
+
</div>
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
@if (view.inputs.length) {
|
|
1450
|
+
<div class="flex flex-col gap-1">
|
|
1451
|
+
<ng-container
|
|
1452
|
+
[ngTemplateOutlet]="section"
|
|
1453
|
+
[ngTemplateOutletContext]="{ $implicit: 'inputs' }"
|
|
1454
|
+
/>
|
|
1455
|
+
<ul class="flex flex-col gap-1">
|
|
1456
|
+
@for (item of view.inputs; track $index) {
|
|
1457
|
+
<li class="flex flex-col gap-0.5">
|
|
1458
|
+
<div class="flex items-baseline justify-between gap-2">
|
|
1459
|
+
<bdi class="min-w-0 break-words">{{ item.label }}</bdi>
|
|
1460
|
+
<bdi class="shrink-0 font-medium tabular-nums">{{
|
|
1461
|
+
item.value
|
|
1462
|
+
}}</bdi>
|
|
1463
|
+
</div>
|
|
1464
|
+
@if (item.rows.length) {
|
|
1465
|
+
<ul
|
|
1466
|
+
class="flex flex-col gap-0.5 rounded-md border border-surface-200 px-2 py-1 dark:border-surface-700"
|
|
1467
|
+
>
|
|
1468
|
+
@for (row of item.rows; track $index) {
|
|
1469
|
+
<li class="flex justify-between gap-2 tabular-nums">
|
|
1470
|
+
@if (row.recordId !== null) {
|
|
1471
|
+
<span class="text-surface-500 dark:text-surface-400"
|
|
1472
|
+
>#{{ row.recordId }}</span
|
|
1473
|
+
>
|
|
1474
|
+
}
|
|
1475
|
+
<bdi>{{ row.value }}</bdi>
|
|
1476
|
+
</li>
|
|
1477
|
+
}
|
|
1478
|
+
</ul>
|
|
1479
|
+
}
|
|
1480
|
+
</li>
|
|
1481
|
+
}
|
|
1482
|
+
</ul>
|
|
1483
|
+
</div>
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
@if (view.functions.length) {
|
|
1487
|
+
<div class="flex flex-col gap-1">
|
|
1488
|
+
<ng-container
|
|
1489
|
+
[ngTemplateOutlet]="section"
|
|
1490
|
+
[ngTemplateOutletContext]="{ $implicit: 'functions' }"
|
|
1491
|
+
/>
|
|
1492
|
+
<ul class="flex flex-col gap-0.5">
|
|
1493
|
+
@for (fn of view.functions; track $index) {
|
|
1494
|
+
<li class="flex items-baseline justify-between gap-2">
|
|
1495
|
+
<span dir="ltr" class="font-mono">{{ fn.name }}</span>
|
|
1496
|
+
<bdi
|
|
1497
|
+
class="shrink-0 tabular-nums"
|
|
1498
|
+
[class.italic]="fn.notEvaluated"
|
|
1499
|
+
[class.text-surface-400]="fn.notEvaluated"
|
|
1500
|
+
>{{ fn.result }}</bdi
|
|
1501
|
+
>
|
|
1502
|
+
</li>
|
|
1503
|
+
}
|
|
1504
|
+
</ul>
|
|
1505
|
+
</div>
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
@if (view.statusRules.length) {
|
|
1509
|
+
<div class="flex flex-col gap-1">
|
|
1510
|
+
<ng-container
|
|
1511
|
+
[ngTemplateOutlet]="section"
|
|
1512
|
+
[ngTemplateOutletContext]="{ $implicit: 'statusRules' }"
|
|
1513
|
+
/>
|
|
1514
|
+
<p class="text-surface-500 dark:text-surface-400">
|
|
1515
|
+
{{ prefix + '.firstMatchWins' | transloco }}
|
|
1516
|
+
</p>
|
|
1517
|
+
<ol class="flex flex-col gap-1.5">
|
|
1518
|
+
@for (rule of view.statusRules; track rule.key) {
|
|
1519
|
+
<li
|
|
1520
|
+
class="flex flex-col gap-1 rounded-md border px-2 py-1.5"
|
|
1521
|
+
[class]="
|
|
1522
|
+
rule.verdict === 'selected'
|
|
1523
|
+
? 'border-primary-200 bg-primary-50 dark:border-primary-800 dark:bg-primary-950'
|
|
1524
|
+
: 'border-surface-200 dark:border-surface-700'
|
|
1525
|
+
"
|
|
1526
|
+
>
|
|
1527
|
+
<div class="flex items-center justify-between gap-2">
|
|
1528
|
+
<bdi class="font-medium">{{ rule.name }}</bdi>
|
|
1529
|
+
<span
|
|
1530
|
+
class="shrink-0 rounded-md px-1.5 py-0.5 text-[11px]"
|
|
1531
|
+
[class]="verdictClass[rule.verdict]"
|
|
1532
|
+
>
|
|
1533
|
+
{{ prefix + '.verdict.' + rule.verdict | transloco }}
|
|
1534
|
+
</span>
|
|
1535
|
+
</div>
|
|
1536
|
+
@if (rule.segments; as segments) {
|
|
1537
|
+
<mt-calculation-explanation-equation [segments]="segments" />
|
|
1538
|
+
}
|
|
1539
|
+
</li>
|
|
1540
|
+
}
|
|
1541
|
+
</ol>
|
|
1542
|
+
</div>
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
@for (detail of view.schedule; track $index) {
|
|
1546
|
+
<div class="flex flex-col gap-1.5">
|
|
1547
|
+
<div class="flex items-baseline justify-between gap-2">
|
|
1548
|
+
<span
|
|
1549
|
+
class="text-xs font-semibold text-surface-500 dark:text-surface-400"
|
|
1550
|
+
>{{ detail.title }}</span
|
|
1551
|
+
>
|
|
1552
|
+
<span class="font-semibold tabular-nums">{{ detail.result }}</span>
|
|
1553
|
+
</div>
|
|
1554
|
+
<code
|
|
1555
|
+
dir="ltr"
|
|
1556
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-2 py-1 font-mono break-all dark:border-surface-700 dark:bg-surface-800"
|
|
1557
|
+
>{{ detail.formulaWithValues }}</code
|
|
1558
|
+
>
|
|
1559
|
+
<div class="flex flex-wrap gap-1">
|
|
1560
|
+
@for (fact of detail.facts; track $index) {
|
|
1561
|
+
<span
|
|
1562
|
+
class="rounded-md bg-surface-100 px-1.5 py-0.5 dark:bg-surface-800"
|
|
1563
|
+
>{{ fact }}</span
|
|
1564
|
+
>
|
|
1565
|
+
}
|
|
1566
|
+
</div>
|
|
1567
|
+
@for (note of detail.notes; track $index) {
|
|
1568
|
+
<div
|
|
1569
|
+
class="rounded-md border border-amber-200 bg-amber-50 px-2 py-1 text-amber-700"
|
|
1570
|
+
>
|
|
1571
|
+
{{ note }}
|
|
1572
|
+
</div>
|
|
1573
|
+
}
|
|
1574
|
+
@if (detail.contributors.length) {
|
|
1575
|
+
<div class="overflow-x-auto">
|
|
1576
|
+
<table class="w-full tabular-nums">
|
|
1577
|
+
<thead>
|
|
1578
|
+
<tr class="text-surface-500 dark:text-surface-400">
|
|
1579
|
+
<th class="px-1 py-0.5 text-start font-medium">
|
|
1580
|
+
{{ scheduleKeys + '.item' | transloco }}
|
|
1581
|
+
</th>
|
|
1582
|
+
<th class="px-1 py-0.5 text-end font-medium">
|
|
1583
|
+
{{ scheduleKeys + '.progress' | transloco }}
|
|
1584
|
+
</th>
|
|
1585
|
+
<th class="px-1 py-0.5 text-end font-medium">
|
|
1586
|
+
{{ scheduleKeys + '.weight' | transloco }}
|
|
1587
|
+
</th>
|
|
1588
|
+
<th class="px-1 py-0.5 text-end font-medium">
|
|
1589
|
+
{{ scheduleKeys + '.included' | transloco }}
|
|
1590
|
+
</th>
|
|
1591
|
+
</tr>
|
|
1592
|
+
</thead>
|
|
1593
|
+
<tbody>
|
|
1594
|
+
@for (row of detail.contributors; track row.recordId) {
|
|
1595
|
+
<tr
|
|
1596
|
+
class="border-t border-surface-100 dark:border-surface-700"
|
|
1597
|
+
[class.text-surface-400]="!row.included"
|
|
1598
|
+
>
|
|
1599
|
+
<td class="px-1 py-0.5">#{{ row.recordId }}</td>
|
|
1600
|
+
<td
|
|
1601
|
+
class="px-1 py-0.5 text-end"
|
|
1602
|
+
[class.italic]="row.inputMissing"
|
|
1603
|
+
[attr.title]="
|
|
1604
|
+
row.inputMissing
|
|
1605
|
+
? (scheduleKeys + '.inputMissing' | transloco)
|
|
1606
|
+
: null
|
|
1607
|
+
"
|
|
1608
|
+
>
|
|
1609
|
+
{{ row.progress }}{{ row.inputMissing ? ' *' : '' }}
|
|
1610
|
+
</td>
|
|
1611
|
+
<td class="px-1 py-0.5 text-end">{{ row.weight }}</td>
|
|
1612
|
+
<td class="px-1 py-0.5 text-end">
|
|
1613
|
+
{{
|
|
1614
|
+
prefix + (row.included ? '.yes' : '.no') | transloco
|
|
1615
|
+
}}
|
|
1616
|
+
</td>
|
|
1617
|
+
</tr>
|
|
1618
|
+
}
|
|
1619
|
+
</tbody>
|
|
1620
|
+
</table>
|
|
1621
|
+
@if (hasMissingInput(detail.contributors)) {
|
|
1622
|
+
<p class="mt-1 text-surface-500 dark:text-surface-400">
|
|
1623
|
+
* {{ scheduleKeys + '.inputMissing' | transloco }}
|
|
1624
|
+
</p>
|
|
1625
|
+
}
|
|
1626
|
+
</div>
|
|
1627
|
+
}
|
|
1628
|
+
@if (detail.planned.length) {
|
|
1629
|
+
<div class="flex flex-col gap-1">
|
|
1630
|
+
<span class="text-surface-500 dark:text-surface-400">{{
|
|
1631
|
+
scheduleKeys + '.planned' | transloco
|
|
1632
|
+
}}</span>
|
|
1633
|
+
<ul class="flex flex-col gap-0.5">
|
|
1634
|
+
@for (item of detail.planned; track item.recordId) {
|
|
1635
|
+
<li class="flex flex-col">
|
|
1636
|
+
<div class="flex justify-between gap-2">
|
|
1637
|
+
<span class="tabular-nums">#{{ item.recordId }}</span>
|
|
1638
|
+
<span class="text-end">{{ item.rule }}</span>
|
|
1639
|
+
</div>
|
|
1640
|
+
@if (item.dates || item.minutes) {
|
|
1641
|
+
<div
|
|
1642
|
+
class="flex justify-between gap-2 text-surface-500 tabular-nums dark:text-surface-400"
|
|
1643
|
+
>
|
|
1644
|
+
<bdi>{{ item.dates }}</bdi>
|
|
1645
|
+
<bdi>{{ item.minutes }}</bdi>
|
|
1646
|
+
</div>
|
|
1647
|
+
}
|
|
1648
|
+
</li>
|
|
1649
|
+
}
|
|
1650
|
+
</ul>
|
|
1651
|
+
</div>
|
|
1652
|
+
}
|
|
1653
|
+
@if (detail.calendar; as calendar) {
|
|
1654
|
+
<dl
|
|
1655
|
+
class="grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 rounded-md border border-surface-200 px-2 py-1 dark:border-surface-700"
|
|
1656
|
+
>
|
|
1657
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
1658
|
+
{{ scheduleKeys + '.timeZone' | transloco }}
|
|
1659
|
+
</dt>
|
|
1660
|
+
<dd class="ms-0 break-words">{{ calendar.timeZone }}</dd>
|
|
1661
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
1662
|
+
{{ scheduleKeys + '.calendarSource' | transloco }}
|
|
1663
|
+
</dt>
|
|
1664
|
+
<dd class="ms-0 break-words">{{ calendar.source }}</dd>
|
|
1665
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
1666
|
+
{{ scheduleKeys + '.workingHours' | transloco }}
|
|
1667
|
+
</dt>
|
|
1668
|
+
<dd class="ms-0 tabular-nums" dir="ltr">
|
|
1669
|
+
{{ calendar.workingHours }}
|
|
1670
|
+
</dd>
|
|
1671
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
1672
|
+
{{ scheduleKeys + '.workingDays' | transloco }}
|
|
1673
|
+
</dt>
|
|
1674
|
+
<dd class="ms-0">{{ calendar.workingDays || '—' }}</dd>
|
|
1675
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
1676
|
+
{{ scheduleKeys + '.holidays' | transloco }}
|
|
1677
|
+
</dt>
|
|
1678
|
+
<dd class="ms-0 break-words">{{ calendar.holidays || '—' }}</dd>
|
|
1679
|
+
</dl>
|
|
1680
|
+
}
|
|
1681
|
+
</div>
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
@if (view.codeBlocks.length) {
|
|
1685
|
+
<div class="flex flex-col gap-1">
|
|
1686
|
+
<ng-container
|
|
1687
|
+
[ngTemplateOutlet]="section"
|
|
1688
|
+
[ngTemplateOutletContext]="{ $implicit: 'codeBlocks' }"
|
|
1689
|
+
/>
|
|
1690
|
+
<ol class="flex flex-col gap-1.5">
|
|
1691
|
+
@for (block of view.codeBlocks; track $index) {
|
|
1692
|
+
<li
|
|
1693
|
+
class="flex flex-col gap-1 rounded-md border border-surface-200 px-2 py-1.5 dark:border-surface-700"
|
|
1694
|
+
>
|
|
1695
|
+
<div class="flex items-baseline justify-between gap-2">
|
|
1696
|
+
<span class="text-surface-500 dark:text-surface-400">{{
|
|
1697
|
+
block.type
|
|
1698
|
+
}}</span>
|
|
1699
|
+
<bdi class="font-mono font-medium">{{ block.value }}</bdi>
|
|
1700
|
+
</div>
|
|
1701
|
+
@if (block.raw !== null) {
|
|
1702
|
+
<span class="text-surface-500 dark:text-surface-400">
|
|
1703
|
+
{{
|
|
1704
|
+
prefix + '.codeBlockBefore'
|
|
1705
|
+
| transloco: { value: block.raw }
|
|
1706
|
+
}}
|
|
1707
|
+
</span>
|
|
1708
|
+
}
|
|
1709
|
+
@if (block.settings; as settings) {
|
|
1710
|
+
<ng-container
|
|
1711
|
+
[ngTemplateOutlet]="dataTpl"
|
|
1712
|
+
[ngTemplateOutletContext]="{ $implicit: settings }"
|
|
1713
|
+
/>
|
|
1714
|
+
}
|
|
1715
|
+
</li>
|
|
1716
|
+
}
|
|
1717
|
+
</ol>
|
|
1718
|
+
</div>
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
@if (view.facts.length) {
|
|
1722
|
+
<div class="flex flex-col gap-1.5">
|
|
1723
|
+
<ng-container
|
|
1724
|
+
[ngTemplateOutlet]="section"
|
|
1725
|
+
[ngTemplateOutletContext]="{ $implicit: 'facts' }"
|
|
1726
|
+
/>
|
|
1727
|
+
@for (fact of view.facts; track $index) {
|
|
1728
|
+
<div class="flex flex-col gap-0.5">
|
|
1729
|
+
<bdi class="font-medium">{{ fact.label }}</bdi>
|
|
1730
|
+
<ng-container
|
|
1731
|
+
[ngTemplateOutlet]="dataTpl"
|
|
1732
|
+
[ngTemplateOutletContext]="{ $implicit: fact.data }"
|
|
1733
|
+
/>
|
|
1734
|
+
</div>
|
|
1735
|
+
}
|
|
1736
|
+
</div>
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
@if (view.sources.length) {
|
|
1740
|
+
<div class="flex flex-col gap-1">
|
|
1741
|
+
<ng-container
|
|
1742
|
+
[ngTemplateOutlet]="section"
|
|
1743
|
+
[ngTemplateOutletContext]="{ $implicit: 'sources' }"
|
|
1744
|
+
/>
|
|
1745
|
+
<ul class="flex flex-col gap-1">
|
|
1746
|
+
@for (source of view.sources; track $index) {
|
|
1747
|
+
<li class="flex flex-col">
|
|
1748
|
+
<span>{{
|
|
1749
|
+
prefix + '.sourceRecords'
|
|
1750
|
+
| transloco: { count: source.count, source: source.label }
|
|
1751
|
+
}}</span>
|
|
1752
|
+
<span
|
|
1753
|
+
class="break-words text-surface-500 tabular-nums dark:text-surface-400"
|
|
1754
|
+
dir="ltr"
|
|
1755
|
+
>{{ source.ids }}</span
|
|
1756
|
+
>
|
|
1757
|
+
</li>
|
|
1758
|
+
}
|
|
1759
|
+
</ul>
|
|
1760
|
+
</div>
|
|
1761
|
+
}
|
|
1762
|
+
</div>
|
|
1763
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CalculationExplanationEquation, selector: "mt-calculation-explanation-equation", inputs: ["segments", "result", "resultOperator"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1764
|
+
}
|
|
1765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CalculationExplanationDetails, decorators: [{
|
|
1766
|
+
type: Component,
|
|
1767
|
+
args: [{
|
|
1768
|
+
selector: 'mt-calculation-explanation-details',
|
|
1769
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1770
|
+
imports: [CalculationExplanationEquation, NgTemplateOutlet, TranslocoPipe],
|
|
1771
|
+
template: `
|
|
1772
|
+
<ng-template #section let-title>
|
|
1773
|
+
<div class="text-xs font-semibold text-surface-500 dark:text-surface-400">
|
|
1774
|
+
{{ prefix + '.' + title | transloco }}
|
|
1775
|
+
</div>
|
|
1776
|
+
</ng-template>
|
|
1777
|
+
|
|
1778
|
+
<ng-template #dataTpl let-data>
|
|
1779
|
+
@switch (data.kind) {
|
|
1780
|
+
@case ('text') {
|
|
1781
|
+
<span class="break-words">{{ data.text }}</span>
|
|
1782
|
+
}
|
|
1783
|
+
@case ('list') {
|
|
1784
|
+
<span class="break-words">{{ data.items.join(', ') }}</span>
|
|
1785
|
+
}
|
|
1786
|
+
@case ('table') {
|
|
1787
|
+
<div class="overflow-x-auto">
|
|
1788
|
+
<table class="w-full text-xs">
|
|
1789
|
+
<thead>
|
|
1790
|
+
<tr class="text-surface-500 dark:text-surface-400">
|
|
1791
|
+
@for (column of data.columns; track $index) {
|
|
1792
|
+
<th class="px-1 py-0.5 text-start font-medium">
|
|
1793
|
+
{{ column }}
|
|
1794
|
+
</th>
|
|
1795
|
+
}
|
|
1796
|
+
</tr>
|
|
1797
|
+
</thead>
|
|
1798
|
+
<tbody>
|
|
1799
|
+
@for (row of data.rows; track $index) {
|
|
1800
|
+
<tr
|
|
1801
|
+
class="border-t border-surface-100 dark:border-surface-700"
|
|
1802
|
+
>
|
|
1803
|
+
@for (cell of row; track $index) {
|
|
1804
|
+
<td class="px-1 py-0.5 align-top break-words">
|
|
1805
|
+
{{ cell }}
|
|
1806
|
+
</td>
|
|
1807
|
+
}
|
|
1808
|
+
</tr>
|
|
1809
|
+
}
|
|
1810
|
+
</tbody>
|
|
1811
|
+
</table>
|
|
1812
|
+
</div>
|
|
1813
|
+
}
|
|
1814
|
+
@case ('fields') {
|
|
1815
|
+
<dl class="flex flex-col gap-1">
|
|
1816
|
+
@for (field of data.fields; track $index) {
|
|
1817
|
+
<div class="flex flex-col">
|
|
1818
|
+
<dt class="text-xs text-surface-500 dark:text-surface-400">
|
|
1819
|
+
{{ field.label }}
|
|
1820
|
+
</dt>
|
|
1821
|
+
<dd class="ms-0">
|
|
1822
|
+
<ng-container
|
|
1823
|
+
[ngTemplateOutlet]="dataTpl"
|
|
1824
|
+
[ngTemplateOutletContext]="{ $implicit: field.data }"
|
|
1825
|
+
/>
|
|
1826
|
+
</dd>
|
|
1827
|
+
</div>
|
|
1828
|
+
}
|
|
1829
|
+
</dl>
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
</ng-template>
|
|
1833
|
+
|
|
1834
|
+
@let view = details();
|
|
1835
|
+
<div
|
|
1836
|
+
class="flex flex-col gap-3 text-xs text-surface-700 dark:text-surface-200"
|
|
1837
|
+
>
|
|
1838
|
+
@if (view.formula) {
|
|
1839
|
+
<div class="flex flex-col gap-1">
|
|
1840
|
+
<ng-container
|
|
1841
|
+
[ngTemplateOutlet]="section"
|
|
1842
|
+
[ngTemplateOutletContext]="{ $implicit: 'formula' }"
|
|
1843
|
+
/>
|
|
1844
|
+
<code
|
|
1845
|
+
dir="ltr"
|
|
1846
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-2 py-1 font-mono break-all dark:border-surface-700 dark:bg-surface-800"
|
|
1847
|
+
>{{ view.formula }}</code
|
|
1848
|
+
>
|
|
1849
|
+
@if (view.formulaWithValues) {
|
|
1850
|
+
<span class="text-surface-500 dark:text-surface-400">
|
|
1851
|
+
{{ prefix + '.withValues' | transloco }}
|
|
1852
|
+
</span>
|
|
1853
|
+
<code
|
|
1854
|
+
dir="ltr"
|
|
1855
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-2 py-1 font-mono break-all dark:border-surface-700 dark:bg-surface-800"
|
|
1856
|
+
>{{ view.formulaWithValues }}</code
|
|
1857
|
+
>
|
|
1858
|
+
}
|
|
1859
|
+
</div>
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
@if (view.inputs.length) {
|
|
1863
|
+
<div class="flex flex-col gap-1">
|
|
1864
|
+
<ng-container
|
|
1865
|
+
[ngTemplateOutlet]="section"
|
|
1866
|
+
[ngTemplateOutletContext]="{ $implicit: 'inputs' }"
|
|
1867
|
+
/>
|
|
1868
|
+
<ul class="flex flex-col gap-1">
|
|
1869
|
+
@for (item of view.inputs; track $index) {
|
|
1870
|
+
<li class="flex flex-col gap-0.5">
|
|
1871
|
+
<div class="flex items-baseline justify-between gap-2">
|
|
1872
|
+
<bdi class="min-w-0 break-words">{{ item.label }}</bdi>
|
|
1873
|
+
<bdi class="shrink-0 font-medium tabular-nums">{{
|
|
1874
|
+
item.value
|
|
1875
|
+
}}</bdi>
|
|
1876
|
+
</div>
|
|
1877
|
+
@if (item.rows.length) {
|
|
1878
|
+
<ul
|
|
1879
|
+
class="flex flex-col gap-0.5 rounded-md border border-surface-200 px-2 py-1 dark:border-surface-700"
|
|
1880
|
+
>
|
|
1881
|
+
@for (row of item.rows; track $index) {
|
|
1882
|
+
<li class="flex justify-between gap-2 tabular-nums">
|
|
1883
|
+
@if (row.recordId !== null) {
|
|
1884
|
+
<span class="text-surface-500 dark:text-surface-400"
|
|
1885
|
+
>#{{ row.recordId }}</span
|
|
1886
|
+
>
|
|
1887
|
+
}
|
|
1888
|
+
<bdi>{{ row.value }}</bdi>
|
|
1889
|
+
</li>
|
|
1890
|
+
}
|
|
1891
|
+
</ul>
|
|
1892
|
+
}
|
|
1893
|
+
</li>
|
|
1894
|
+
}
|
|
1895
|
+
</ul>
|
|
1896
|
+
</div>
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
@if (view.functions.length) {
|
|
1900
|
+
<div class="flex flex-col gap-1">
|
|
1901
|
+
<ng-container
|
|
1902
|
+
[ngTemplateOutlet]="section"
|
|
1903
|
+
[ngTemplateOutletContext]="{ $implicit: 'functions' }"
|
|
1904
|
+
/>
|
|
1905
|
+
<ul class="flex flex-col gap-0.5">
|
|
1906
|
+
@for (fn of view.functions; track $index) {
|
|
1907
|
+
<li class="flex items-baseline justify-between gap-2">
|
|
1908
|
+
<span dir="ltr" class="font-mono">{{ fn.name }}</span>
|
|
1909
|
+
<bdi
|
|
1910
|
+
class="shrink-0 tabular-nums"
|
|
1911
|
+
[class.italic]="fn.notEvaluated"
|
|
1912
|
+
[class.text-surface-400]="fn.notEvaluated"
|
|
1913
|
+
>{{ fn.result }}</bdi
|
|
1914
|
+
>
|
|
1915
|
+
</li>
|
|
1916
|
+
}
|
|
1917
|
+
</ul>
|
|
1918
|
+
</div>
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
@if (view.statusRules.length) {
|
|
1922
|
+
<div class="flex flex-col gap-1">
|
|
1923
|
+
<ng-container
|
|
1924
|
+
[ngTemplateOutlet]="section"
|
|
1925
|
+
[ngTemplateOutletContext]="{ $implicit: 'statusRules' }"
|
|
1926
|
+
/>
|
|
1927
|
+
<p class="text-surface-500 dark:text-surface-400">
|
|
1928
|
+
{{ prefix + '.firstMatchWins' | transloco }}
|
|
1929
|
+
</p>
|
|
1930
|
+
<ol class="flex flex-col gap-1.5">
|
|
1931
|
+
@for (rule of view.statusRules; track rule.key) {
|
|
1932
|
+
<li
|
|
1933
|
+
class="flex flex-col gap-1 rounded-md border px-2 py-1.5"
|
|
1934
|
+
[class]="
|
|
1935
|
+
rule.verdict === 'selected'
|
|
1936
|
+
? 'border-primary-200 bg-primary-50 dark:border-primary-800 dark:bg-primary-950'
|
|
1937
|
+
: 'border-surface-200 dark:border-surface-700'
|
|
1938
|
+
"
|
|
1939
|
+
>
|
|
1940
|
+
<div class="flex items-center justify-between gap-2">
|
|
1941
|
+
<bdi class="font-medium">{{ rule.name }}</bdi>
|
|
1942
|
+
<span
|
|
1943
|
+
class="shrink-0 rounded-md px-1.5 py-0.5 text-[11px]"
|
|
1944
|
+
[class]="verdictClass[rule.verdict]"
|
|
1945
|
+
>
|
|
1946
|
+
{{ prefix + '.verdict.' + rule.verdict | transloco }}
|
|
1947
|
+
</span>
|
|
1948
|
+
</div>
|
|
1949
|
+
@if (rule.segments; as segments) {
|
|
1950
|
+
<mt-calculation-explanation-equation [segments]="segments" />
|
|
1951
|
+
}
|
|
1952
|
+
</li>
|
|
1953
|
+
}
|
|
1954
|
+
</ol>
|
|
1955
|
+
</div>
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
@for (detail of view.schedule; track $index) {
|
|
1959
|
+
<div class="flex flex-col gap-1.5">
|
|
1960
|
+
<div class="flex items-baseline justify-between gap-2">
|
|
1961
|
+
<span
|
|
1962
|
+
class="text-xs font-semibold text-surface-500 dark:text-surface-400"
|
|
1963
|
+
>{{ detail.title }}</span
|
|
1964
|
+
>
|
|
1965
|
+
<span class="font-semibold tabular-nums">{{ detail.result }}</span>
|
|
1966
|
+
</div>
|
|
1967
|
+
<code
|
|
1968
|
+
dir="ltr"
|
|
1969
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-2 py-1 font-mono break-all dark:border-surface-700 dark:bg-surface-800"
|
|
1970
|
+
>{{ detail.formulaWithValues }}</code
|
|
1971
|
+
>
|
|
1972
|
+
<div class="flex flex-wrap gap-1">
|
|
1973
|
+
@for (fact of detail.facts; track $index) {
|
|
1974
|
+
<span
|
|
1975
|
+
class="rounded-md bg-surface-100 px-1.5 py-0.5 dark:bg-surface-800"
|
|
1976
|
+
>{{ fact }}</span
|
|
1977
|
+
>
|
|
1978
|
+
}
|
|
1979
|
+
</div>
|
|
1980
|
+
@for (note of detail.notes; track $index) {
|
|
1981
|
+
<div
|
|
1982
|
+
class="rounded-md border border-amber-200 bg-amber-50 px-2 py-1 text-amber-700"
|
|
1983
|
+
>
|
|
1984
|
+
{{ note }}
|
|
1985
|
+
</div>
|
|
1986
|
+
}
|
|
1987
|
+
@if (detail.contributors.length) {
|
|
1988
|
+
<div class="overflow-x-auto">
|
|
1989
|
+
<table class="w-full tabular-nums">
|
|
1990
|
+
<thead>
|
|
1991
|
+
<tr class="text-surface-500 dark:text-surface-400">
|
|
1992
|
+
<th class="px-1 py-0.5 text-start font-medium">
|
|
1993
|
+
{{ scheduleKeys + '.item' | transloco }}
|
|
1994
|
+
</th>
|
|
1995
|
+
<th class="px-1 py-0.5 text-end font-medium">
|
|
1996
|
+
{{ scheduleKeys + '.progress' | transloco }}
|
|
1997
|
+
</th>
|
|
1998
|
+
<th class="px-1 py-0.5 text-end font-medium">
|
|
1999
|
+
{{ scheduleKeys + '.weight' | transloco }}
|
|
2000
|
+
</th>
|
|
2001
|
+
<th class="px-1 py-0.5 text-end font-medium">
|
|
2002
|
+
{{ scheduleKeys + '.included' | transloco }}
|
|
2003
|
+
</th>
|
|
2004
|
+
</tr>
|
|
2005
|
+
</thead>
|
|
2006
|
+
<tbody>
|
|
2007
|
+
@for (row of detail.contributors; track row.recordId) {
|
|
2008
|
+
<tr
|
|
2009
|
+
class="border-t border-surface-100 dark:border-surface-700"
|
|
2010
|
+
[class.text-surface-400]="!row.included"
|
|
2011
|
+
>
|
|
2012
|
+
<td class="px-1 py-0.5">#{{ row.recordId }}</td>
|
|
2013
|
+
<td
|
|
2014
|
+
class="px-1 py-0.5 text-end"
|
|
2015
|
+
[class.italic]="row.inputMissing"
|
|
2016
|
+
[attr.title]="
|
|
2017
|
+
row.inputMissing
|
|
2018
|
+
? (scheduleKeys + '.inputMissing' | transloco)
|
|
2019
|
+
: null
|
|
2020
|
+
"
|
|
2021
|
+
>
|
|
2022
|
+
{{ row.progress }}{{ row.inputMissing ? ' *' : '' }}
|
|
2023
|
+
</td>
|
|
2024
|
+
<td class="px-1 py-0.5 text-end">{{ row.weight }}</td>
|
|
2025
|
+
<td class="px-1 py-0.5 text-end">
|
|
2026
|
+
{{
|
|
2027
|
+
prefix + (row.included ? '.yes' : '.no') | transloco
|
|
2028
|
+
}}
|
|
2029
|
+
</td>
|
|
2030
|
+
</tr>
|
|
2031
|
+
}
|
|
2032
|
+
</tbody>
|
|
2033
|
+
</table>
|
|
2034
|
+
@if (hasMissingInput(detail.contributors)) {
|
|
2035
|
+
<p class="mt-1 text-surface-500 dark:text-surface-400">
|
|
2036
|
+
* {{ scheduleKeys + '.inputMissing' | transloco }}
|
|
2037
|
+
</p>
|
|
2038
|
+
}
|
|
2039
|
+
</div>
|
|
2040
|
+
}
|
|
2041
|
+
@if (detail.planned.length) {
|
|
2042
|
+
<div class="flex flex-col gap-1">
|
|
2043
|
+
<span class="text-surface-500 dark:text-surface-400">{{
|
|
2044
|
+
scheduleKeys + '.planned' | transloco
|
|
2045
|
+
}}</span>
|
|
2046
|
+
<ul class="flex flex-col gap-0.5">
|
|
2047
|
+
@for (item of detail.planned; track item.recordId) {
|
|
2048
|
+
<li class="flex flex-col">
|
|
2049
|
+
<div class="flex justify-between gap-2">
|
|
2050
|
+
<span class="tabular-nums">#{{ item.recordId }}</span>
|
|
2051
|
+
<span class="text-end">{{ item.rule }}</span>
|
|
2052
|
+
</div>
|
|
2053
|
+
@if (item.dates || item.minutes) {
|
|
2054
|
+
<div
|
|
2055
|
+
class="flex justify-between gap-2 text-surface-500 tabular-nums dark:text-surface-400"
|
|
2056
|
+
>
|
|
2057
|
+
<bdi>{{ item.dates }}</bdi>
|
|
2058
|
+
<bdi>{{ item.minutes }}</bdi>
|
|
2059
|
+
</div>
|
|
2060
|
+
}
|
|
2061
|
+
</li>
|
|
2062
|
+
}
|
|
2063
|
+
</ul>
|
|
2064
|
+
</div>
|
|
2065
|
+
}
|
|
2066
|
+
@if (detail.calendar; as calendar) {
|
|
2067
|
+
<dl
|
|
2068
|
+
class="grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 rounded-md border border-surface-200 px-2 py-1 dark:border-surface-700"
|
|
2069
|
+
>
|
|
2070
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
2071
|
+
{{ scheduleKeys + '.timeZone' | transloco }}
|
|
2072
|
+
</dt>
|
|
2073
|
+
<dd class="ms-0 break-words">{{ calendar.timeZone }}</dd>
|
|
2074
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
2075
|
+
{{ scheduleKeys + '.calendarSource' | transloco }}
|
|
2076
|
+
</dt>
|
|
2077
|
+
<dd class="ms-0 break-words">{{ calendar.source }}</dd>
|
|
2078
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
2079
|
+
{{ scheduleKeys + '.workingHours' | transloco }}
|
|
2080
|
+
</dt>
|
|
2081
|
+
<dd class="ms-0 tabular-nums" dir="ltr">
|
|
2082
|
+
{{ calendar.workingHours }}
|
|
2083
|
+
</dd>
|
|
2084
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
2085
|
+
{{ scheduleKeys + '.workingDays' | transloco }}
|
|
2086
|
+
</dt>
|
|
2087
|
+
<dd class="ms-0">{{ calendar.workingDays || '—' }}</dd>
|
|
2088
|
+
<dt class="text-surface-500 dark:text-surface-400">
|
|
2089
|
+
{{ scheduleKeys + '.holidays' | transloco }}
|
|
2090
|
+
</dt>
|
|
2091
|
+
<dd class="ms-0 break-words">{{ calendar.holidays || '—' }}</dd>
|
|
2092
|
+
</dl>
|
|
2093
|
+
}
|
|
2094
|
+
</div>
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
@if (view.codeBlocks.length) {
|
|
2098
|
+
<div class="flex flex-col gap-1">
|
|
2099
|
+
<ng-container
|
|
2100
|
+
[ngTemplateOutlet]="section"
|
|
2101
|
+
[ngTemplateOutletContext]="{ $implicit: 'codeBlocks' }"
|
|
2102
|
+
/>
|
|
2103
|
+
<ol class="flex flex-col gap-1.5">
|
|
2104
|
+
@for (block of view.codeBlocks; track $index) {
|
|
2105
|
+
<li
|
|
2106
|
+
class="flex flex-col gap-1 rounded-md border border-surface-200 px-2 py-1.5 dark:border-surface-700"
|
|
2107
|
+
>
|
|
2108
|
+
<div class="flex items-baseline justify-between gap-2">
|
|
2109
|
+
<span class="text-surface-500 dark:text-surface-400">{{
|
|
2110
|
+
block.type
|
|
2111
|
+
}}</span>
|
|
2112
|
+
<bdi class="font-mono font-medium">{{ block.value }}</bdi>
|
|
2113
|
+
</div>
|
|
2114
|
+
@if (block.raw !== null) {
|
|
2115
|
+
<span class="text-surface-500 dark:text-surface-400">
|
|
2116
|
+
{{
|
|
2117
|
+
prefix + '.codeBlockBefore'
|
|
2118
|
+
| transloco: { value: block.raw }
|
|
2119
|
+
}}
|
|
2120
|
+
</span>
|
|
2121
|
+
}
|
|
2122
|
+
@if (block.settings; as settings) {
|
|
2123
|
+
<ng-container
|
|
2124
|
+
[ngTemplateOutlet]="dataTpl"
|
|
2125
|
+
[ngTemplateOutletContext]="{ $implicit: settings }"
|
|
2126
|
+
/>
|
|
2127
|
+
}
|
|
2128
|
+
</li>
|
|
2129
|
+
}
|
|
2130
|
+
</ol>
|
|
2131
|
+
</div>
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
@if (view.facts.length) {
|
|
2135
|
+
<div class="flex flex-col gap-1.5">
|
|
2136
|
+
<ng-container
|
|
2137
|
+
[ngTemplateOutlet]="section"
|
|
2138
|
+
[ngTemplateOutletContext]="{ $implicit: 'facts' }"
|
|
2139
|
+
/>
|
|
2140
|
+
@for (fact of view.facts; track $index) {
|
|
2141
|
+
<div class="flex flex-col gap-0.5">
|
|
2142
|
+
<bdi class="font-medium">{{ fact.label }}</bdi>
|
|
2143
|
+
<ng-container
|
|
2144
|
+
[ngTemplateOutlet]="dataTpl"
|
|
2145
|
+
[ngTemplateOutletContext]="{ $implicit: fact.data }"
|
|
2146
|
+
/>
|
|
2147
|
+
</div>
|
|
2148
|
+
}
|
|
2149
|
+
</div>
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
@if (view.sources.length) {
|
|
2153
|
+
<div class="flex flex-col gap-1">
|
|
2154
|
+
<ng-container
|
|
2155
|
+
[ngTemplateOutlet]="section"
|
|
2156
|
+
[ngTemplateOutletContext]="{ $implicit: 'sources' }"
|
|
2157
|
+
/>
|
|
2158
|
+
<ul class="flex flex-col gap-1">
|
|
2159
|
+
@for (source of view.sources; track $index) {
|
|
2160
|
+
<li class="flex flex-col">
|
|
2161
|
+
<span>{{
|
|
2162
|
+
prefix + '.sourceRecords'
|
|
2163
|
+
| transloco: { count: source.count, source: source.label }
|
|
2164
|
+
}}</span>
|
|
2165
|
+
<span
|
|
2166
|
+
class="break-words text-surface-500 tabular-nums dark:text-surface-400"
|
|
2167
|
+
dir="ltr"
|
|
2168
|
+
>{{ source.ids }}</span
|
|
2169
|
+
>
|
|
2170
|
+
</li>
|
|
2171
|
+
}
|
|
2172
|
+
</ul>
|
|
2173
|
+
</div>
|
|
2174
|
+
}
|
|
2175
|
+
</div>
|
|
2176
|
+
`,
|
|
2177
|
+
}]
|
|
2178
|
+
}], propDecorators: { details: [{ type: i0.Input, args: [{ isSignal: true, alias: "details", required: true }] }] } });
|
|
2179
|
+
|
|
2180
|
+
const KEY_PREFIX = CALCULATION_EXPLANATION_KEYS;
|
|
2181
|
+
/** Unavailable outcomes with their own message; anything else is generic. */
|
|
2182
|
+
const UNAVAILABLE_KEYS = {
|
|
2183
|
+
notCaptured: `${KEY_PREFIX}.notCaptured`,
|
|
2184
|
+
unsupported: `${KEY_PREFIX}.unsupported`,
|
|
2185
|
+
limitExceeded: `${KEY_PREFIX}.limitExceeded`,
|
|
2186
|
+
restricted: `${KEY_PREFIX}.restricted`,
|
|
2187
|
+
valueChanged: `${KEY_PREFIX}.valueChanged`,
|
|
2188
|
+
notCalculated: `${KEY_PREFIX}.notCalculated`,
|
|
2189
|
+
};
|
|
2190
|
+
const PROVIDERS = new Set([
|
|
2191
|
+
'formula',
|
|
2192
|
+
'status',
|
|
2193
|
+
'nativeMethod',
|
|
2194
|
+
'codeBuilder',
|
|
2195
|
+
'schedule',
|
|
2196
|
+
]);
|
|
2197
|
+
const BASES = new Set(['savedCalculation', 'currentCalculation']);
|
|
2198
|
+
/**
|
|
2199
|
+
* How a calculated value was calculated: a readable equation with each input
|
|
2200
|
+
* by name and the value it had, the result and when, with the captured
|
|
2201
|
+
* details behind a toggle. Fetched each time it opens; reading it never
|
|
2202
|
+
* recalculates anything, and nothing here is recalculated either.
|
|
2203
|
+
*/
|
|
2204
|
+
class EntityCalculationExplanation {
|
|
2205
|
+
api = inject(CalculationExplanationApi);
|
|
2206
|
+
refresher = inject(EntityCalculationRefresher, {
|
|
2207
|
+
optional: true,
|
|
2208
|
+
});
|
|
2209
|
+
transloco = inject(TranslocoService);
|
|
2210
|
+
lang = sharedActiveLang(this.transloco);
|
|
2211
|
+
currency = inject(MT_CALCULATION_CURRENCY);
|
|
2212
|
+
datePipe = inject(MTDateFormatPipe);
|
|
2213
|
+
target = input.required(...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
2214
|
+
prefix = KEY_PREFIX;
|
|
2215
|
+
state = signal({ kind: 'loading' }, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
2216
|
+
expanded = signal(false, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
2217
|
+
available = computed(() => {
|
|
2218
|
+
const state = this.state();
|
|
2219
|
+
return state.kind === 'available' ? state : null;
|
|
2220
|
+
}, ...(ngDevMode ? [{ debugName: "available" }] : /* istanbul ignore next */ []));
|
|
2221
|
+
unavailableKey = computed(() => {
|
|
2222
|
+
const state = this.state();
|
|
2223
|
+
return state.kind === 'unavailable' ? state.messageKey : null;
|
|
2224
|
+
}, ...(ngDevMode ? [{ debugName: "unavailableKey" }] : /* istanbul ignore next */ []));
|
|
2225
|
+
formatContext = computed(() => ({
|
|
2226
|
+
lang: this.lang(),
|
|
2227
|
+
currency: this.currency(),
|
|
2228
|
+
formatDate: (value, type) => this.datePipe.transform(value, type),
|
|
2229
|
+
translate: (key, params) => this.transloco.translate(key, params),
|
|
2230
|
+
}), ...(ngDevMode ? [{ debugName: "formatContext" }] : /* istanbul ignore next */ []));
|
|
2231
|
+
view = computed(() => {
|
|
2232
|
+
const state = this.available();
|
|
2233
|
+
if (!state) {
|
|
2234
|
+
return null;
|
|
2235
|
+
}
|
|
2236
|
+
const ctx = this.formatContext();
|
|
2237
|
+
const target = this.target();
|
|
2238
|
+
const { document, basis } = state;
|
|
2239
|
+
const names = target.statusNames ?? {};
|
|
2240
|
+
const status = document.provider === 'status';
|
|
2241
|
+
const result = status
|
|
2242
|
+
? statusName(String(document.result ?? ''), names)
|
|
2243
|
+
: formatTypedValue(document.result, state.viewType, ctx);
|
|
2244
|
+
const summary = this.summarize(document, result, ctx, names);
|
|
2245
|
+
const details = buildExplanationDetails(document, ctx, names);
|
|
2246
|
+
return {
|
|
2247
|
+
basis,
|
|
2248
|
+
calculatedAt: document.calculatedAt,
|
|
2249
|
+
definitionChanged: state.definitionChanged,
|
|
2250
|
+
refreshed: state.refreshed,
|
|
2251
|
+
result,
|
|
2252
|
+
summary,
|
|
2253
|
+
equation: summary.kind === 'equation' ? summary.segments : [],
|
|
2254
|
+
operator: summary.kind === 'equation' ? summary.operator : '=',
|
|
2255
|
+
description: summary.kind === 'description' || summary.kind === 'message'
|
|
2256
|
+
? summary.text
|
|
2257
|
+
: '',
|
|
2258
|
+
descriptionIsCode: summary.kind === 'description' ? summary.code : false,
|
|
2259
|
+
// A current calculation is shown beside the value on the page, never in
|
|
2260
|
+
// place of it: the page keeps what it read.
|
|
2261
|
+
differs: basis === 'currentCalculation' &&
|
|
2262
|
+
!status &&
|
|
2263
|
+
!isSameSavedValue(primitiveText(document.result), target.displayedValue)
|
|
2264
|
+
? {
|
|
2265
|
+
page: formatTypedValue(target.displayedValue ?? null, state.viewType, ctx),
|
|
2266
|
+
current: result,
|
|
2267
|
+
}
|
|
2268
|
+
: null,
|
|
2269
|
+
details,
|
|
2270
|
+
hasDetails: hasExplanationDetails(details),
|
|
2271
|
+
};
|
|
2272
|
+
}, ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
2273
|
+
request;
|
|
2274
|
+
constructor() {
|
|
2275
|
+
inject(DestroyRef).onDestroy(() => this.request?.unsubscribe());
|
|
2276
|
+
}
|
|
2277
|
+
// Created when the popover opens and destroyed when it closes: one read per
|
|
2278
|
+
// open, never re-read when the value it explains is refreshed underneath.
|
|
2279
|
+
ngOnInit() {
|
|
2280
|
+
this.load(false);
|
|
2281
|
+
}
|
|
2282
|
+
load(retried) {
|
|
2283
|
+
const target = this.target();
|
|
2284
|
+
this.request?.unsubscribe();
|
|
2285
|
+
this.request = this.api.read(target.source, target.propertyKey).subscribe({
|
|
2286
|
+
next: (response) => this.apply(response, retried),
|
|
2287
|
+
error: () => this.state.set({ kind: 'failed' }),
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
apply(response, retried) {
|
|
2291
|
+
// The value was saved again while the explanation was read: show the new
|
|
2292
|
+
// value (a read, never a recalculation), then explain that one.
|
|
2293
|
+
if (response.status === 'valueChanged' && !retried) {
|
|
2294
|
+
this.refresher?.refreshStaleCalculatedValue();
|
|
2295
|
+
this.load(true);
|
|
2296
|
+
return;
|
|
2297
|
+
}
|
|
2298
|
+
const explanation = response.explanation;
|
|
2299
|
+
const basis = response.basis ?? 'savedCalculation';
|
|
2300
|
+
if (response.status !== 'available' ||
|
|
2301
|
+
!explanation ||
|
|
2302
|
+
explanation.schemaVersion !== 1 ||
|
|
2303
|
+
!PROVIDERS.has(explanation.provider) ||
|
|
2304
|
+
!BASES.has(basis)) {
|
|
2305
|
+
this.state.set({
|
|
2306
|
+
kind: 'unavailable',
|
|
2307
|
+
messageKey: UNAVAILABLE_KEYS[response.status] ?? `${KEY_PREFIX}.unavailable`,
|
|
2308
|
+
});
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
// Only a saved calculation names the persisted value; a newer one than
|
|
2312
|
+
// the value on screen means the screen is behind.
|
|
2313
|
+
const stale = basis === 'savedCalculation' &&
|
|
2314
|
+
!isSameSavedValue(response.savedValue, this.target().displayedValue);
|
|
2315
|
+
if (stale) {
|
|
2316
|
+
this.refresher?.refreshStaleCalculatedValue();
|
|
2317
|
+
}
|
|
2318
|
+
this.state.set({
|
|
2319
|
+
kind: 'available',
|
|
2320
|
+
basis: basis,
|
|
2321
|
+
document: explanation,
|
|
2322
|
+
definitionChanged: response.definitionChanged,
|
|
2323
|
+
refreshed: stale && !!this.refresher,
|
|
2324
|
+
viewType: response.display?.viewType ?? this.target().viewType,
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
summarize(document, result, ctx, names) {
|
|
2328
|
+
if (document.provider === 'status') {
|
|
2329
|
+
const rule = selectedStatusRule(document);
|
|
2330
|
+
const condition = rule?.condition
|
|
2331
|
+
? buildExplanationSegments(rule.condition, ctx)
|
|
2332
|
+
: null;
|
|
2333
|
+
if (condition) {
|
|
2334
|
+
return { kind: 'equation', segments: condition, operator: '⇒' };
|
|
2335
|
+
}
|
|
2336
|
+
if (!rule && (document.statusRules?.length ?? 0) > 0) {
|
|
2337
|
+
return {
|
|
2338
|
+
kind: 'message',
|
|
2339
|
+
text: ctx.translate(`${KEY_PREFIX}.noRuleMatched`, {
|
|
2340
|
+
status: statusName(String(document.result ?? ''), names),
|
|
2341
|
+
}),
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
if (document.provider === 'codeBuilder') {
|
|
2346
|
+
const parts = buildCodeSegments(document, ctx);
|
|
2347
|
+
if (parts.length) {
|
|
2348
|
+
return { kind: 'equation', segments: parts, operator: '=' };
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
if (isEquationDocument(document)) {
|
|
2352
|
+
const segments = buildExplanationSegments(document, ctx);
|
|
2353
|
+
if (segments?.length) {
|
|
2354
|
+
return { kind: 'equation', segments, operator: '=' };
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
// A native method, a schedule field or a manual status: the backend's
|
|
2358
|
+
// description of the calculation, then its result.
|
|
2359
|
+
return {
|
|
2360
|
+
kind: 'description',
|
|
2361
|
+
text: document.formula || document.formulaWithValues || '—',
|
|
2362
|
+
code: document.provider === 'formula',
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCalculationExplanation, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2366
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityCalculationExplanation, isStandalone: true, selector: "mt-entity-calculation-explanation", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null } }, providers: [MTDateFormatPipe], ngImport: i0, template: `
|
|
2367
|
+
<div
|
|
2368
|
+
class="flex max-h-[70vh] w-96 max-w-[calc(100vw-2rem)] flex-col gap-3 overflow-y-auto text-sm"
|
|
2369
|
+
>
|
|
2370
|
+
<div class="flex min-w-0 flex-col gap-0.5">
|
|
2371
|
+
<span
|
|
2372
|
+
class="truncate font-semibold text-surface-900 dark:text-surface-0"
|
|
2373
|
+
>
|
|
2374
|
+
{{ target().label }}
|
|
2375
|
+
</span>
|
|
2376
|
+
<span class="text-xs text-surface-500 dark:text-surface-400">
|
|
2377
|
+
{{
|
|
2378
|
+
prefix +
|
|
2379
|
+
(available()?.basis === 'currentCalculation'
|
|
2380
|
+
? '.currentTitle'
|
|
2381
|
+
: '.title') | transloco
|
|
2382
|
+
}}
|
|
2383
|
+
</span>
|
|
2384
|
+
</div>
|
|
2385
|
+
|
|
2386
|
+
@switch (state().kind) {
|
|
2387
|
+
@case ('loading') {
|
|
2388
|
+
<div class="flex flex-col gap-2" aria-busy="true">
|
|
2389
|
+
<div
|
|
2390
|
+
class="h-10 animate-pulse rounded-md bg-surface-100 dark:bg-surface-800"
|
|
2391
|
+
></div>
|
|
2392
|
+
<div
|
|
2393
|
+
class="h-3 w-1/2 animate-pulse rounded-md bg-surface-100 dark:bg-surface-800"
|
|
2394
|
+
></div>
|
|
2395
|
+
</div>
|
|
2396
|
+
}
|
|
2397
|
+
@case ('available') {
|
|
2398
|
+
@if (view(); as v) {
|
|
2399
|
+
<div
|
|
2400
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-3 py-2 text-sm text-surface-800 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-100"
|
|
2401
|
+
>
|
|
2402
|
+
@switch (v.summary.kind) {
|
|
2403
|
+
@case ('equation') {
|
|
2404
|
+
<mt-calculation-explanation-equation
|
|
2405
|
+
[segments]="v.equation"
|
|
2406
|
+
[result]="v.result"
|
|
2407
|
+
[resultOperator]="v.operator"
|
|
2408
|
+
/>
|
|
2409
|
+
}
|
|
2410
|
+
@case ('description') {
|
|
2411
|
+
<div class="flex flex-col gap-1">
|
|
2412
|
+
<span
|
|
2413
|
+
class="break-words"
|
|
2414
|
+
[class.font-mono]="v.descriptionIsCode"
|
|
2415
|
+
[attr.dir]="v.descriptionIsCode ? 'ltr' : null"
|
|
2416
|
+
>{{ v.description }}</span
|
|
2417
|
+
>
|
|
2418
|
+
<span>
|
|
2419
|
+
=
|
|
2420
|
+
<bdi class="font-semibold">{{ v.result }}</bdi>
|
|
2421
|
+
</span>
|
|
2422
|
+
</div>
|
|
2423
|
+
}
|
|
2424
|
+
@case ('message') {
|
|
2425
|
+
<span>{{ v.description }}</span>
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
</div>
|
|
2429
|
+
<div class="text-xs text-surface-500 dark:text-surface-400">
|
|
2430
|
+
{{
|
|
2431
|
+
prefix +
|
|
2432
|
+
(v.basis === 'currentCalculation'
|
|
2433
|
+
? '.currentCalculatedAt'
|
|
2434
|
+
: '.calculatedAt') | transloco
|
|
2435
|
+
}}
|
|
2436
|
+
<span dir="ltr" class="tabular-nums">{{
|
|
2437
|
+
v.calculatedAt | mtDateFormat: 'dateTime'
|
|
2438
|
+
}}</span>
|
|
2439
|
+
</div>
|
|
2440
|
+
@if (v.differs; as differs) {
|
|
2441
|
+
<div
|
|
2442
|
+
class="rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700"
|
|
2443
|
+
>
|
|
2444
|
+
{{ prefix + '.differsFromPage' | transloco: differs }}
|
|
2445
|
+
</div>
|
|
2446
|
+
}
|
|
2447
|
+
@if (v.definitionChanged) {
|
|
2448
|
+
<div
|
|
2449
|
+
class="rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700"
|
|
2450
|
+
>
|
|
2451
|
+
{{ prefix + '.definitionChanged' | transloco }}
|
|
2452
|
+
</div>
|
|
2453
|
+
}
|
|
2454
|
+
@if (v.refreshed) {
|
|
2455
|
+
<div
|
|
2456
|
+
class="rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700"
|
|
2457
|
+
>
|
|
2458
|
+
{{ prefix + '.valueRefreshed' | transloco }}
|
|
2459
|
+
</div>
|
|
2460
|
+
}
|
|
2461
|
+
@if (v.hasDetails) {
|
|
2462
|
+
<button
|
|
2463
|
+
type="button"
|
|
2464
|
+
class="self-start rounded-md text-xs font-medium text-primary-700 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500 dark:text-primary-300"
|
|
2465
|
+
[attr.aria-expanded]="expanded()"
|
|
2466
|
+
(click)="expanded.set(!expanded())"
|
|
2467
|
+
>
|
|
2468
|
+
{{
|
|
2469
|
+
prefix + (expanded() ? '.hideDetails' : '.showDetails')
|
|
2470
|
+
| transloco
|
|
2471
|
+
}}
|
|
2472
|
+
</button>
|
|
2473
|
+
@if (expanded()) {
|
|
2474
|
+
<mt-calculation-explanation-details [details]="v.details" />
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
@case ('unavailable') {
|
|
2480
|
+
@if (unavailableKey(); as messageKey) {
|
|
2481
|
+
<div
|
|
2482
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-3 py-2 text-surface-600 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-300"
|
|
2483
|
+
>
|
|
2484
|
+
{{ messageKey | transloco }}
|
|
2485
|
+
</div>
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
@case ('failed') {
|
|
2489
|
+
<div
|
|
2490
|
+
class="rounded-md border border-red-200 bg-red-50 px-3 py-2 text-red-700"
|
|
2491
|
+
>
|
|
2492
|
+
{{ prefix + '.loadFailed' | transloco }}
|
|
2493
|
+
</div>
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
</div>
|
|
2497
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CalculationExplanationEquation, selector: "mt-calculation-explanation-equation", inputs: ["segments", "result", "resultOperator"] }, { kind: "component", type: CalculationExplanationDetails, selector: "mt-calculation-explanation-details", inputs: ["details"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2498
|
+
}
|
|
2499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCalculationExplanation, decorators: [{
|
|
2500
|
+
type: Component,
|
|
2501
|
+
args: [{
|
|
2502
|
+
selector: 'mt-entity-calculation-explanation',
|
|
2503
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2504
|
+
imports: [
|
|
2505
|
+
TranslocoPipe,
|
|
2506
|
+
MTDateFormatPipe,
|
|
2507
|
+
CalculationExplanationEquation,
|
|
2508
|
+
CalculationExplanationDetails,
|
|
2509
|
+
],
|
|
2510
|
+
providers: [MTDateFormatPipe],
|
|
2511
|
+
template: `
|
|
2512
|
+
<div
|
|
2513
|
+
class="flex max-h-[70vh] w-96 max-w-[calc(100vw-2rem)] flex-col gap-3 overflow-y-auto text-sm"
|
|
2514
|
+
>
|
|
2515
|
+
<div class="flex min-w-0 flex-col gap-0.5">
|
|
2516
|
+
<span
|
|
2517
|
+
class="truncate font-semibold text-surface-900 dark:text-surface-0"
|
|
2518
|
+
>
|
|
2519
|
+
{{ target().label }}
|
|
2520
|
+
</span>
|
|
2521
|
+
<span class="text-xs text-surface-500 dark:text-surface-400">
|
|
2522
|
+
{{
|
|
2523
|
+
prefix +
|
|
2524
|
+
(available()?.basis === 'currentCalculation'
|
|
2525
|
+
? '.currentTitle'
|
|
2526
|
+
: '.title') | transloco
|
|
2527
|
+
}}
|
|
2528
|
+
</span>
|
|
2529
|
+
</div>
|
|
2530
|
+
|
|
2531
|
+
@switch (state().kind) {
|
|
2532
|
+
@case ('loading') {
|
|
2533
|
+
<div class="flex flex-col gap-2" aria-busy="true">
|
|
2534
|
+
<div
|
|
2535
|
+
class="h-10 animate-pulse rounded-md bg-surface-100 dark:bg-surface-800"
|
|
2536
|
+
></div>
|
|
2537
|
+
<div
|
|
2538
|
+
class="h-3 w-1/2 animate-pulse rounded-md bg-surface-100 dark:bg-surface-800"
|
|
2539
|
+
></div>
|
|
2540
|
+
</div>
|
|
2541
|
+
}
|
|
2542
|
+
@case ('available') {
|
|
2543
|
+
@if (view(); as v) {
|
|
2544
|
+
<div
|
|
2545
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-3 py-2 text-sm text-surface-800 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-100"
|
|
2546
|
+
>
|
|
2547
|
+
@switch (v.summary.kind) {
|
|
2548
|
+
@case ('equation') {
|
|
2549
|
+
<mt-calculation-explanation-equation
|
|
2550
|
+
[segments]="v.equation"
|
|
2551
|
+
[result]="v.result"
|
|
2552
|
+
[resultOperator]="v.operator"
|
|
2553
|
+
/>
|
|
2554
|
+
}
|
|
2555
|
+
@case ('description') {
|
|
2556
|
+
<div class="flex flex-col gap-1">
|
|
2557
|
+
<span
|
|
2558
|
+
class="break-words"
|
|
2559
|
+
[class.font-mono]="v.descriptionIsCode"
|
|
2560
|
+
[attr.dir]="v.descriptionIsCode ? 'ltr' : null"
|
|
2561
|
+
>{{ v.description }}</span
|
|
2562
|
+
>
|
|
2563
|
+
<span>
|
|
2564
|
+
=
|
|
2565
|
+
<bdi class="font-semibold">{{ v.result }}</bdi>
|
|
2566
|
+
</span>
|
|
2567
|
+
</div>
|
|
2568
|
+
}
|
|
2569
|
+
@case ('message') {
|
|
2570
|
+
<span>{{ v.description }}</span>
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
</div>
|
|
2574
|
+
<div class="text-xs text-surface-500 dark:text-surface-400">
|
|
2575
|
+
{{
|
|
2576
|
+
prefix +
|
|
2577
|
+
(v.basis === 'currentCalculation'
|
|
2578
|
+
? '.currentCalculatedAt'
|
|
2579
|
+
: '.calculatedAt') | transloco
|
|
2580
|
+
}}
|
|
2581
|
+
<span dir="ltr" class="tabular-nums">{{
|
|
2582
|
+
v.calculatedAt | mtDateFormat: 'dateTime'
|
|
2583
|
+
}}</span>
|
|
2584
|
+
</div>
|
|
2585
|
+
@if (v.differs; as differs) {
|
|
2586
|
+
<div
|
|
2587
|
+
class="rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700"
|
|
2588
|
+
>
|
|
2589
|
+
{{ prefix + '.differsFromPage' | transloco: differs }}
|
|
2590
|
+
</div>
|
|
2591
|
+
}
|
|
2592
|
+
@if (v.definitionChanged) {
|
|
2593
|
+
<div
|
|
2594
|
+
class="rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700"
|
|
2595
|
+
>
|
|
2596
|
+
{{ prefix + '.definitionChanged' | transloco }}
|
|
2597
|
+
</div>
|
|
2598
|
+
}
|
|
2599
|
+
@if (v.refreshed) {
|
|
2600
|
+
<div
|
|
2601
|
+
class="rounded-md border border-primary-200 bg-primary-50 px-3 py-2 text-xs text-primary-700"
|
|
2602
|
+
>
|
|
2603
|
+
{{ prefix + '.valueRefreshed' | transloco }}
|
|
2604
|
+
</div>
|
|
2605
|
+
}
|
|
2606
|
+
@if (v.hasDetails) {
|
|
2607
|
+
<button
|
|
2608
|
+
type="button"
|
|
2609
|
+
class="self-start rounded-md text-xs font-medium text-primary-700 hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500 dark:text-primary-300"
|
|
2610
|
+
[attr.aria-expanded]="expanded()"
|
|
2611
|
+
(click)="expanded.set(!expanded())"
|
|
2612
|
+
>
|
|
2613
|
+
{{
|
|
2614
|
+
prefix + (expanded() ? '.hideDetails' : '.showDetails')
|
|
2615
|
+
| transloco
|
|
2616
|
+
}}
|
|
2617
|
+
</button>
|
|
2618
|
+
@if (expanded()) {
|
|
2619
|
+
<mt-calculation-explanation-details [details]="v.details" />
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
@case ('unavailable') {
|
|
2625
|
+
@if (unavailableKey(); as messageKey) {
|
|
2626
|
+
<div
|
|
2627
|
+
class="rounded-md border border-surface-200 bg-surface-50 px-3 py-2 text-surface-600 dark:border-surface-700 dark:bg-surface-800 dark:text-surface-300"
|
|
2628
|
+
>
|
|
2629
|
+
{{ messageKey | transloco }}
|
|
2630
|
+
</div>
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
@case ('failed') {
|
|
2634
|
+
<div
|
|
2635
|
+
class="rounded-md border border-red-200 bg-red-50 px-3 py-2 text-red-700"
|
|
2636
|
+
>
|
|
2637
|
+
{{ prefix + '.loadFailed' | transloco }}
|
|
2638
|
+
</div>
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
</div>
|
|
2642
|
+
`,
|
|
2643
|
+
}]
|
|
2644
|
+
}], ctorParameters: () => [], propDecorators: { target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: true }] }] } });
|
|
2645
|
+
function primitiveText(value) {
|
|
2646
|
+
return value === null || value === undefined || typeof value === 'object'
|
|
2647
|
+
? null
|
|
2648
|
+
: String(value);
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* Whether the saved value is the one on screen. Both are the persisted string,
|
|
2652
|
+
* but a number may be written either way (`40` and `40.0`), so numbers compare
|
|
2653
|
+
* as numbers.
|
|
2654
|
+
*/
|
|
2655
|
+
function isSameSavedValue(saved, displayed) {
|
|
2656
|
+
const a = (saved ?? '').trim();
|
|
2657
|
+
const b = (displayed ?? '').trim();
|
|
2658
|
+
if (a === b) {
|
|
2659
|
+
return true;
|
|
2660
|
+
}
|
|
2661
|
+
if (a === '' || b === '') {
|
|
2662
|
+
return false;
|
|
2663
|
+
}
|
|
2664
|
+
const x = Number(a);
|
|
2665
|
+
const y = Number(b);
|
|
2666
|
+
return Number.isFinite(x) && Number.isFinite(y) && x === y;
|
|
2667
|
+
}
|
|
2668
|
+
|
|
348
2669
|
const TOOLTIP_KEYS = {
|
|
349
2670
|
idle: 'components.entitiesPreview.calculatedValue',
|
|
350
2671
|
running: 'components.entitiesPreview.calculatingValue',
|
|
@@ -352,6 +2673,7 @@ const TOOLTIP_KEYS = {
|
|
|
352
2673
|
delayed: 'components.entitiesPreview.calculationDelayed',
|
|
353
2674
|
};
|
|
354
2675
|
const CHANGED_TOOLTIP_KEY = 'components.entitiesPreview.calculatedValueChanged';
|
|
2676
|
+
const EXPLAIN_TOOLTIP_KEY = 'components.entitiesPreview.explainCalculation';
|
|
355
2677
|
/** The calculated-value mark. Drawn, so it sits centred at any size. */
|
|
356
2678
|
class EntityCalculatedGlyph {
|
|
357
2679
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCalculatedGlyph, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -406,19 +2728,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
406
2728
|
* Marks a property value the backend calculates. Rendered beside its label; it
|
|
407
2729
|
* pulses while a recalculation that covers the value is in progress, and stays
|
|
408
2730
|
* lit without pulsing once that is taking longer than expected.
|
|
2731
|
+
*
|
|
2732
|
+
* Given an `explanation` target it is a button: clicking it shows how the saved
|
|
2733
|
+
* value was calculated.
|
|
409
2734
|
*/
|
|
410
2735
|
class EntityCalculatedIndicator {
|
|
411
2736
|
/** Set while the value is being recalculated. */
|
|
412
2737
|
status = input(null, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
413
2738
|
/** The value's last change, described in the tooltip when it is not busy. */
|
|
414
2739
|
change = input(null, ...(ngDevMode ? [{ debugName: "change" }] : /* istanbul ignore next */ []));
|
|
2740
|
+
/** The value to explain on click. Without it the mark only has a tooltip. */
|
|
2741
|
+
explanation = input(null, ...(ngDevMode ? [{ debugName: "explanation" }] : /* istanbul ignore next */ []));
|
|
2742
|
+
popover = viewChild(Popover, ...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
2743
|
+
opened = signal(false, ...(ngDevMode ? [{ debugName: "opened" }] : /* istanbul ignore next */ []));
|
|
415
2744
|
pulsing = computed(() => !!this.status() && this.status() !== 'delayed', ...(ngDevMode ? [{ debugName: "pulsing" }] : /* istanbul ignore next */ []));
|
|
416
2745
|
tooltipKey = computed(() => {
|
|
417
2746
|
const status = this.status();
|
|
418
2747
|
if (status) {
|
|
419
2748
|
return TOOLTIP_KEYS[status];
|
|
420
2749
|
}
|
|
421
|
-
|
|
2750
|
+
if (this.change()) {
|
|
2751
|
+
return CHANGED_TOOLTIP_KEY;
|
|
2752
|
+
}
|
|
2753
|
+
return this.explanation() ? EXPLAIN_TOOLTIP_KEY : TOOLTIP_KEYS.idle;
|
|
422
2754
|
}, ...(ngDevMode ? [{ debugName: "tooltipKey" }] : /* istanbul ignore next */ []));
|
|
423
2755
|
tooltipParams = computed(() => {
|
|
424
2756
|
const change = this.change();
|
|
@@ -426,20 +2758,14 @@ class EntityCalculatedIndicator {
|
|
|
426
2758
|
? { previous: change.previous, current: change.current }
|
|
427
2759
|
: undefined;
|
|
428
2760
|
}, ...(ngDevMode ? [{ debugName: "tooltipParams" }] : /* istanbul ignore next */ []));
|
|
2761
|
+
toggle(event) {
|
|
2762
|
+
// The mark sits inside cards and headers that may act on a click.
|
|
2763
|
+
event.stopPropagation();
|
|
2764
|
+
this.popover()?.toggle(event);
|
|
2765
|
+
}
|
|
429
2766
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCalculatedIndicator, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityCalculatedIndicator, isStandalone: true, selector: "mt-entity-calculated-indicator", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, change: { classPropertyName: "change", publicName: "change", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "inline-flex shrink-0" }, ngImport: i0, template: `
|
|
431
|
-
<
|
|
432
|
-
class="relative inline-flex size-4 cursor-help items-center justify-center rounded-full select-none"
|
|
433
|
-
[class]="
|
|
434
|
-
status()
|
|
435
|
-
? 'bg-primary-700 text-white'
|
|
436
|
-
: 'bg-surface-100 text-surface-500 dark:bg-surface-800 dark:text-surface-300'
|
|
437
|
-
"
|
|
438
|
-
role="img"
|
|
439
|
-
[attr.aria-label]="tooltipKey() | transloco: tooltipParams()"
|
|
440
|
-
[mtTooltip]="tooltipKey() | transloco: tooltipParams()"
|
|
441
|
-
tooltipPosition="top"
|
|
442
|
-
>
|
|
2767
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityCalculatedIndicator, isStandalone: true, selector: "mt-entity-calculated-indicator", inputs: { status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, change: { classPropertyName: "change", publicName: "change", isSignal: true, isRequired: false, transformFunction: null }, explanation: { classPropertyName: "explanation", publicName: "explanation", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "inline-flex shrink-0" }, viewQueries: [{ propertyName: "popover", first: true, predicate: Popover, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2768
|
+
<ng-template #mark>
|
|
443
2769
|
@if (pulsing()) {
|
|
444
2770
|
<span
|
|
445
2771
|
class="absolute inset-0 animate-ping rounded-full bg-primary-700 opacity-60 motion-reduce:animate-none"
|
|
@@ -447,28 +2773,70 @@ class EntityCalculatedIndicator {
|
|
|
447
2773
|
></span>
|
|
448
2774
|
}
|
|
449
2775
|
<mt-entity-calculated-glyph class="relative" />
|
|
450
|
-
</
|
|
451
|
-
|
|
2776
|
+
</ng-template>
|
|
2777
|
+
|
|
2778
|
+
@if (explanation(); as target) {
|
|
2779
|
+
<button
|
|
2780
|
+
type="button"
|
|
2781
|
+
class="relative inline-flex size-4 cursor-pointer items-center justify-center rounded-full select-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500"
|
|
2782
|
+
[class]="
|
|
2783
|
+
status()
|
|
2784
|
+
? 'bg-primary-700 text-white'
|
|
2785
|
+
: 'bg-surface-100 text-surface-500 hover:bg-primary-100 hover:text-primary-700 dark:bg-surface-800 dark:text-surface-300'
|
|
2786
|
+
"
|
|
2787
|
+
[attr.aria-label]="tooltipKey() | transloco: tooltipParams()"
|
|
2788
|
+
aria-haspopup="dialog"
|
|
2789
|
+
[mtTooltip]="tooltipKey() | transloco: tooltipParams()"
|
|
2790
|
+
tooltipPosition="top"
|
|
2791
|
+
(click)="toggle($event)"
|
|
2792
|
+
>
|
|
2793
|
+
<ng-container [ngTemplateOutlet]="mark" />
|
|
2794
|
+
</button>
|
|
2795
|
+
<!-- Projected content is created with this view even while the popover
|
|
2796
|
+
is closed, so the explanation is gated on the open state: it reads
|
|
2797
|
+
its value when opened, not when the page loads. -->
|
|
2798
|
+
<p-popover
|
|
2799
|
+
appendTo="body"
|
|
2800
|
+
(onShow)="opened.set(true)"
|
|
2801
|
+
(onHide)="opened.set(false)"
|
|
2802
|
+
>
|
|
2803
|
+
@if (opened()) {
|
|
2804
|
+
<mt-entity-calculation-explanation [target]="target" />
|
|
2805
|
+
}
|
|
2806
|
+
</p-popover>
|
|
2807
|
+
} @else {
|
|
2808
|
+
<span
|
|
2809
|
+
class="relative inline-flex size-4 cursor-help items-center justify-center rounded-full select-none"
|
|
2810
|
+
[class]="
|
|
2811
|
+
status()
|
|
2812
|
+
? 'bg-primary-700 text-white'
|
|
2813
|
+
: 'bg-surface-100 text-surface-500 dark:bg-surface-800 dark:text-surface-300'
|
|
2814
|
+
"
|
|
2815
|
+
role="img"
|
|
2816
|
+
[attr.aria-label]="tooltipKey() | transloco: tooltipParams()"
|
|
2817
|
+
[mtTooltip]="tooltipKey() | transloco: tooltipParams()"
|
|
2818
|
+
tooltipPosition="top"
|
|
2819
|
+
>
|
|
2820
|
+
<ng-container [ngTemplateOutlet]="mark" />
|
|
2821
|
+
</span>
|
|
2822
|
+
}
|
|
2823
|
+
`, isInline: true, dependencies: [{ kind: "component", type: EntityCalculatedGlyph, selector: "mt-entity-calculated-glyph" }, { kind: "component", type: EntityCalculationExplanation, selector: "mt-entity-calculation-explanation", inputs: ["target"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
452
2824
|
}
|
|
453
2825
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCalculatedIndicator, decorators: [{
|
|
454
2826
|
type: Component,
|
|
455
2827
|
args: [{
|
|
456
2828
|
selector: 'mt-entity-calculated-indicator',
|
|
457
2829
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
458
|
-
imports: [
|
|
2830
|
+
imports: [
|
|
2831
|
+
EntityCalculatedGlyph,
|
|
2832
|
+
EntityCalculationExplanation,
|
|
2833
|
+
NgTemplateOutlet,
|
|
2834
|
+
Popover,
|
|
2835
|
+
Tooltip,
|
|
2836
|
+
TranslocoPipe,
|
|
2837
|
+
],
|
|
459
2838
|
template: `
|
|
460
|
-
<
|
|
461
|
-
class="relative inline-flex size-4 cursor-help items-center justify-center rounded-full select-none"
|
|
462
|
-
[class]="
|
|
463
|
-
status()
|
|
464
|
-
? 'bg-primary-700 text-white'
|
|
465
|
-
: 'bg-surface-100 text-surface-500 dark:bg-surface-800 dark:text-surface-300'
|
|
466
|
-
"
|
|
467
|
-
role="img"
|
|
468
|
-
[attr.aria-label]="tooltipKey() | transloco: tooltipParams()"
|
|
469
|
-
[mtTooltip]="tooltipKey() | transloco: tooltipParams()"
|
|
470
|
-
tooltipPosition="top"
|
|
471
|
-
>
|
|
2839
|
+
<ng-template #mark>
|
|
472
2840
|
@if (pulsing()) {
|
|
473
2841
|
<span
|
|
474
2842
|
class="absolute inset-0 animate-ping rounded-full bg-primary-700 opacity-60 motion-reduce:animate-none"
|
|
@@ -476,41 +2844,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
476
2844
|
></span>
|
|
477
2845
|
}
|
|
478
2846
|
<mt-entity-calculated-glyph class="relative" />
|
|
479
|
-
</
|
|
2847
|
+
</ng-template>
|
|
2848
|
+
|
|
2849
|
+
@if (explanation(); as target) {
|
|
2850
|
+
<button
|
|
2851
|
+
type="button"
|
|
2852
|
+
class="relative inline-flex size-4 cursor-pointer items-center justify-center rounded-full select-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary-500"
|
|
2853
|
+
[class]="
|
|
2854
|
+
status()
|
|
2855
|
+
? 'bg-primary-700 text-white'
|
|
2856
|
+
: 'bg-surface-100 text-surface-500 hover:bg-primary-100 hover:text-primary-700 dark:bg-surface-800 dark:text-surface-300'
|
|
2857
|
+
"
|
|
2858
|
+
[attr.aria-label]="tooltipKey() | transloco: tooltipParams()"
|
|
2859
|
+
aria-haspopup="dialog"
|
|
2860
|
+
[mtTooltip]="tooltipKey() | transloco: tooltipParams()"
|
|
2861
|
+
tooltipPosition="top"
|
|
2862
|
+
(click)="toggle($event)"
|
|
2863
|
+
>
|
|
2864
|
+
<ng-container [ngTemplateOutlet]="mark" />
|
|
2865
|
+
</button>
|
|
2866
|
+
<!-- Projected content is created with this view even while the popover
|
|
2867
|
+
is closed, so the explanation is gated on the open state: it reads
|
|
2868
|
+
its value when opened, not when the page loads. -->
|
|
2869
|
+
<p-popover
|
|
2870
|
+
appendTo="body"
|
|
2871
|
+
(onShow)="opened.set(true)"
|
|
2872
|
+
(onHide)="opened.set(false)"
|
|
2873
|
+
>
|
|
2874
|
+
@if (opened()) {
|
|
2875
|
+
<mt-entity-calculation-explanation [target]="target" />
|
|
2876
|
+
}
|
|
2877
|
+
</p-popover>
|
|
2878
|
+
} @else {
|
|
2879
|
+
<span
|
|
2880
|
+
class="relative inline-flex size-4 cursor-help items-center justify-center rounded-full select-none"
|
|
2881
|
+
[class]="
|
|
2882
|
+
status()
|
|
2883
|
+
? 'bg-primary-700 text-white'
|
|
2884
|
+
: 'bg-surface-100 text-surface-500 dark:bg-surface-800 dark:text-surface-300'
|
|
2885
|
+
"
|
|
2886
|
+
role="img"
|
|
2887
|
+
[attr.aria-label]="tooltipKey() | transloco: tooltipParams()"
|
|
2888
|
+
[mtTooltip]="tooltipKey() | transloco: tooltipParams()"
|
|
2889
|
+
tooltipPosition="top"
|
|
2890
|
+
>
|
|
2891
|
+
<ng-container [ngTemplateOutlet]="mark" />
|
|
2892
|
+
</span>
|
|
2893
|
+
}
|
|
480
2894
|
`,
|
|
481
2895
|
host: {
|
|
482
2896
|
class: 'inline-flex shrink-0',
|
|
483
2897
|
},
|
|
484
2898
|
}]
|
|
485
|
-
}], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], change: [{ type: i0.Input, args: [{ isSignal: true, alias: "change", required: false }] }] } });
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* One shared active-language signal per `TranslocoService`.
|
|
489
|
-
*
|
|
490
|
-
* `mt-entity-preview` renders once per property per record — a client-list card
|
|
491
|
-
* grid mounts thousands of them — so a `toSignal(langChanges$)` inside each
|
|
492
|
-
* instance would open thousands of subscriptions to the same Subject just to
|
|
493
|
-
* read one global value. The language is global, so the signal is too: created
|
|
494
|
-
* once, cached against the service, and shared by every entity that needs it.
|
|
495
|
-
*
|
|
496
|
-
* `manualCleanup` is deliberate. The cached signal outlives any single
|
|
497
|
-
* component by design, and the service it hangs off is the root injector's —
|
|
498
|
-
* tying its subscription to whichever entity happened to ask first would tear
|
|
499
|
-
* it down the moment that entity scrolled out of view.
|
|
500
|
-
*/
|
|
501
|
-
const langSignals = new WeakMap();
|
|
502
|
-
function sharedActiveLang(transloco) {
|
|
503
|
-
const cached = langSignals.get(transloco);
|
|
504
|
-
if (cached) {
|
|
505
|
-
return cached;
|
|
506
|
-
}
|
|
507
|
-
const lang = toSignal(transloco.langChanges$, {
|
|
508
|
-
initialValue: transloco.getActiveLang(),
|
|
509
|
-
manualCleanup: true,
|
|
510
|
-
});
|
|
511
|
-
langSignals.set(transloco, lang);
|
|
512
|
-
return lang;
|
|
513
|
-
}
|
|
2899
|
+
}], propDecorators: { status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], change: [{ type: i0.Input, args: [{ isSignal: true, alias: "change", required: false }] }], explanation: [{ type: i0.Input, args: [{ isSignal: true, alias: "explanation", required: false }] }], popover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => Popover), { isSignal: true }] }] } });
|
|
514
2900
|
|
|
515
2901
|
/**
|
|
516
2902
|
* The largest amount still rendered in full.
|
|
@@ -773,6 +3159,8 @@ class EntityField {
|
|
|
773
3159
|
calculated = computed(() => this.previewData?.().calculated === true, ...(ngDevMode ? [{ debugName: "calculated" }] : /* istanbul ignore next */ []));
|
|
774
3160
|
calculationStatus = computed(() => this.previewData?.().calculationStatus, ...(ngDevMode ? [{ debugName: "calculationStatus" }] : /* istanbul ignore next */ []));
|
|
775
3161
|
calculationChange = computed(() => this.previewData?.().calculationChange, ...(ngDevMode ? [{ debugName: "calculationChange" }] : /* istanbul ignore next */ []));
|
|
3162
|
+
/** What the calculated-value mark explains on click, if anything. */
|
|
3163
|
+
calculationExplanation = computed(() => toCalculationExplanationTarget(this.previewData?.(), this.label()), ...(ngDevMode ? [{ debugName: "calculationExplanation" }] : /* istanbul ignore next */ []));
|
|
776
3164
|
recentChange = computed(() => {
|
|
777
3165
|
const change = this.calculationChange();
|
|
778
3166
|
return change?.recent ? change : null;
|
|
@@ -838,12 +3226,13 @@ class EntityField {
|
|
|
838
3226
|
<mt-entity-calculated-indicator
|
|
839
3227
|
[status]="calculationStatus()"
|
|
840
3228
|
[change]="calculationChange()"
|
|
3229
|
+
[explanation]="calculationExplanation()"
|
|
841
3230
|
/>
|
|
842
3231
|
}
|
|
843
3232
|
</div>
|
|
844
3233
|
}
|
|
845
3234
|
</div>
|
|
846
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: EntityCalculatedIndicator, selector: "mt-entity-calculated-indicator", inputs: ["status", "change"] }, { kind: "component", type: EntityCalculationChangeChip, selector: "mt-entity-calculation-change", inputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3235
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: EntityCalculatedIndicator, selector: "mt-entity-calculated-indicator", inputs: ["status", "change", "explanation"] }, { kind: "component", type: EntityCalculationChangeChip, selector: "mt-entity-calculation-change", inputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
847
3236
|
}
|
|
848
3237
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityField, decorators: [{
|
|
849
3238
|
type: Component,
|
|
@@ -880,6 +3269,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
880
3269
|
<mt-entity-calculated-indicator
|
|
881
3270
|
[status]="calculationStatus()"
|
|
882
3271
|
[change]="calculationChange()"
|
|
3272
|
+
[explanation]="calculationExplanation()"
|
|
883
3273
|
/>
|
|
884
3274
|
}
|
|
885
3275
|
</div>
|
|
@@ -1316,6 +3706,8 @@ class EntityPercentage {
|
|
|
1316
3706
|
value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1317
3707
|
rawValue = input(...(ngDevMode ? [undefined, { debugName: "rawValue" }] : /* istanbul ignore next */ []));
|
|
1318
3708
|
displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
|
|
3709
|
+
/** What the calculated-value mark explains on click, if anything. */
|
|
3710
|
+
calculationExplanation = computed(() => toCalculationExplanationTarget(this.data(), this.displayName()), ...(ngDevMode ? [{ debugName: "calculationExplanation" }] : /* istanbul ignore next */ []));
|
|
1319
3711
|
displayValue = computed(() => {
|
|
1320
3712
|
const d = this.data();
|
|
1321
3713
|
const raw = d
|
|
@@ -1425,11 +3817,11 @@ class EntityPercentage {
|
|
|
1425
3817
|
return Number.isNaN(numericValue) ? null : numericValue;
|
|
1426
3818
|
}
|
|
1427
3819
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPercentage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1428
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPercentage, isStandalone: true, selector: "mt-entity-percentage", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rawValue: { classPropertyName: "rawValue", publicName: "rawValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\r\n <div class=\"flex items-center justify-between\">\r\n @if (!hideName()) {\r\n <span class=\"inline-flex min-w-0 items-center gap-1\">\r\n <span class=\"text-xs font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n />\r\n }\r\n </span>\r\n }\r\n <span class=\"inline-flex items-center gap-1.5\" [class.ms-auto]=\"hideName()\">\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n <span class=\"text-xs font-bold\">{{ displayValue() }}</span>\r\n </span>\r\n </div>\r\n @if (hasNumericValue()) {\r\n <mt-progress\r\n [value]=\"numericValue()\"\r\n [showLabel]=\"false\"\r\n [height]=\"9\"\r\n [maxValue]=\"maxValue()\"\r\n [color]=\"progressColor()\"\r\n >\r\n </mt-progress>\r\n } @else {\r\n <div class=\"h-[9px] rounded-full bg-gray-200\"></div>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: Progress, selector: "mt-progress", inputs: ["value", "mode", "showLabel", "unit", "color", "minValue", "maxValue", "height", "circleSize", "strokeWidth", "customClass"] }, { kind: "component", type: EntityCalculatedIndicator, selector: "mt-entity-calculated-indicator", inputs: ["status", "change"] }, { kind: "component", type: EntityCalculationChangeChip, selector: "mt-entity-calculation-change", inputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3820
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPercentage, isStandalone: true, selector: "mt-entity-percentage", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rawValue: { classPropertyName: "rawValue", publicName: "rawValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex flex-col gap-1\">\r\n <div class=\"flex items-center justify-between\">\r\n @if (!hideName()) {\r\n <span class=\"inline-flex min-w-0 items-center gap-1\">\r\n <span class=\"text-xs font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n [explanation]=\"calculationExplanation()\"\r\n />\r\n }\r\n </span>\r\n }\r\n <span class=\"inline-flex items-center gap-1.5\" [class.ms-auto]=\"hideName()\">\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n <span class=\"text-xs font-bold\">{{ displayValue() }}</span>\r\n </span>\r\n </div>\r\n @if (hasNumericValue()) {\r\n <mt-progress\r\n [value]=\"numericValue()\"\r\n [showLabel]=\"false\"\r\n [height]=\"9\"\r\n [maxValue]=\"maxValue()\"\r\n [color]=\"progressColor()\"\r\n >\r\n </mt-progress>\r\n } @else {\r\n <div class=\"h-[9px] rounded-full bg-gray-200\"></div>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: Progress, selector: "mt-progress", inputs: ["value", "mode", "showLabel", "unit", "color", "minValue", "maxValue", "height", "circleSize", "strokeWidth", "customClass"] }, { kind: "component", type: EntityCalculatedIndicator, selector: "mt-entity-calculated-indicator", inputs: ["status", "change", "explanation"] }, { kind: "component", type: EntityCalculationChangeChip, selector: "mt-entity-calculation-change", inputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1429
3821
|
}
|
|
1430
3822
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPercentage, decorators: [{
|
|
1431
3823
|
type: Component,
|
|
1432
|
-
args: [{ selector: 'mt-entity-percentage', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [Progress, EntityCalculatedIndicator, EntityCalculationChangeChip], template: "<div class=\"flex flex-col gap-1\">\r\n <div class=\"flex items-center justify-between\">\r\n @if (!hideName()) {\r\n <span class=\"inline-flex min-w-0 items-center gap-1\">\r\n <span class=\"text-xs font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n />\r\n }\r\n </span>\r\n }\r\n <span class=\"inline-flex items-center gap-1.5\" [class.ms-auto]=\"hideName()\">\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n <span class=\"text-xs font-bold\">{{ displayValue() }}</span>\r\n </span>\r\n </div>\r\n @if (hasNumericValue()) {\r\n <mt-progress\r\n [value]=\"numericValue()\"\r\n [showLabel]=\"false\"\r\n [height]=\"9\"\r\n [maxValue]=\"maxValue()\"\r\n [color]=\"progressColor()\"\r\n >\r\n </mt-progress>\r\n } @else {\r\n <div class=\"h-[9px] rounded-full bg-gray-200\"></div>\r\n }\r\n</div>\r\n" }]
|
|
3824
|
+
args: [{ selector: 'mt-entity-percentage', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [Progress, EntityCalculatedIndicator, EntityCalculationChangeChip], template: "<div class=\"flex flex-col gap-1\">\r\n <div class=\"flex items-center justify-between\">\r\n @if (!hideName()) {\r\n <span class=\"inline-flex min-w-0 items-center gap-1\">\r\n <span class=\"text-xs font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n [explanation]=\"calculationExplanation()\"\r\n />\r\n }\r\n </span>\r\n }\r\n <span class=\"inline-flex items-center gap-1.5\" [class.ms-auto]=\"hideName()\">\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n <span class=\"text-xs font-bold\">{{ displayValue() }}</span>\r\n </span>\r\n </div>\r\n @if (hasNumericValue()) {\r\n <mt-progress\r\n [value]=\"numericValue()\"\r\n [showLabel]=\"false\"\r\n [height]=\"9\"\r\n [maxValue]=\"maxValue()\"\r\n [color]=\"progressColor()\"\r\n >\r\n </mt-progress>\r\n } @else {\r\n <div class=\"h-[9px] rounded-full bg-gray-200\"></div>\r\n }\r\n</div>\r\n" }]
|
|
1433
3825
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], rawValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "rawValue", required: false }] }] } });
|
|
1434
3826
|
|
|
1435
3827
|
class EntityCurrency {
|
|
@@ -1472,6 +3864,8 @@ class EntityCheckbox {
|
|
|
1472
3864
|
value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1473
3865
|
rawValue = input(...(ngDevMode ? [undefined, { debugName: "rawValue" }] : /* istanbul ignore next */ []));
|
|
1474
3866
|
displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
|
|
3867
|
+
/** What the calculated-value mark explains on click, if anything. */
|
|
3868
|
+
calculationExplanation = computed(() => toCalculationExplanationTarget(this.data(), this.displayName()), ...(ngDevMode ? [{ debugName: "calculationExplanation" }] : /* istanbul ignore next */ []));
|
|
1475
3869
|
emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;
|
|
1476
3870
|
hideName = computed(() => isEntityLabelHidden(this.data()?.configuration), ...(ngDevMode ? [{ debugName: "hideName" }] : /* istanbul ignore next */ []));
|
|
1477
3871
|
// Reads `rawValue` first (the value as stored) and falls back to the
|
|
@@ -1485,11 +3879,11 @@ class EntityCheckbox {
|
|
|
1485
3879
|
return coerceCheckboxValue(this.data()?.value ?? this.value());
|
|
1486
3880
|
}, ...(ngDevMode ? [{ debugName: "checkboxState" }] : /* istanbul ignore next */ []));
|
|
1487
3881
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1488
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityCheckbox, isStandalone: true, selector: "mt-entity-checkbox", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rawValue: { classPropertyName: "rawValue", publicName: "rawValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex items-center gap-2\">\r\n @if (checkboxState() === true) {\r\n <svg class=\"w-5 h-5 text-green-500\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else if (checkboxState() === false) {\r\n <svg class=\"w-5 h-5 text-gray-300\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm-1-5.414l-2.293-2.293a1 1 0 011.414-1.414L10 11.172l3.879-3.879a1 1 0 111.414 1.414L10 13.414l-.707-.707-.293-.293z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else {\r\n <span\r\n class=\"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-100 px-1 text-[10px] font-semibold text-gray-500\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n @if (!hideName()) {\r\n <span class=\"text-sm font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n />\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n }\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: EntityCalculatedIndicator, selector: "mt-entity-calculated-indicator", inputs: ["status", "change"] }, { kind: "component", type: EntityCalculationChangeChip, selector: "mt-entity-calculation-change", inputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3882
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityCheckbox, isStandalone: true, selector: "mt-entity-checkbox", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rawValue: { classPropertyName: "rawValue", publicName: "rawValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex items-center gap-2\">\r\n @if (checkboxState() === true) {\r\n <svg class=\"w-5 h-5 text-green-500\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else if (checkboxState() === false) {\r\n <svg class=\"w-5 h-5 text-gray-300\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm-1-5.414l-2.293-2.293a1 1 0 011.414-1.414L10 11.172l3.879-3.879a1 1 0 111.414 1.414L10 13.414l-.707-.707-.293-.293z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else {\r\n <span\r\n class=\"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-100 px-1 text-[10px] font-semibold text-gray-500\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n @if (!hideName()) {\r\n <span class=\"text-sm font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n [explanation]=\"calculationExplanation()\"\r\n />\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n }\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: EntityCalculatedIndicator, selector: "mt-entity-calculated-indicator", inputs: ["status", "change", "explanation"] }, { kind: "component", type: EntityCalculationChangeChip, selector: "mt-entity-calculation-change", inputs: ["change"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1489
3883
|
}
|
|
1490
3884
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCheckbox, decorators: [{
|
|
1491
3885
|
type: Component,
|
|
1492
|
-
args: [{ selector: 'mt-entity-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityCalculatedIndicator, EntityCalculationChangeChip], template: "<div class=\"flex items-center gap-2\">\r\n @if (checkboxState() === true) {\r\n <svg class=\"w-5 h-5 text-green-500\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else if (checkboxState() === false) {\r\n <svg class=\"w-5 h-5 text-gray-300\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm-1-5.414l-2.293-2.293a1 1 0 011.414-1.414L10 11.172l3.879-3.879a1 1 0 111.414 1.414L10 13.414l-.707-.707-.293-.293z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else {\r\n <span\r\n class=\"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-100 px-1 text-[10px] font-semibold text-gray-500\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n @if (!hideName()) {\r\n <span class=\"text-sm font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n />\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n }\r\n }\r\n</div>\r\n" }]
|
|
3886
|
+
args: [{ selector: 'mt-entity-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityCalculatedIndicator, EntityCalculationChangeChip], template: "<div class=\"flex items-center gap-2\">\r\n @if (checkboxState() === true) {\r\n <svg class=\"w-5 h-5 text-green-500\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else if (checkboxState() === false) {\r\n <svg class=\"w-5 h-5 text-gray-300\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\r\n <path\r\n fill-rule=\"evenodd\"\r\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm-1-5.414l-2.293-2.293a1 1 0 011.414-1.414L10 11.172l3.879-3.879a1 1 0 111.414 1.414L10 13.414l-.707-.707-.293-.293z\"\r\n clip-rule=\"evenodd\"\r\n />\r\n </svg>\r\n } @else {\r\n <span\r\n class=\"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-100 px-1 text-[10px] font-semibold text-gray-500\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n @if (!hideName()) {\r\n <span class=\"text-sm font-semibold\">{{ displayName() }}</span>\r\n @if (data()?.calculated) {\r\n <mt-entity-calculated-indicator\r\n [status]=\"data()?.calculationStatus\"\r\n [change]=\"data()?.calculationChange\"\r\n [explanation]=\"calculationExplanation()\"\r\n />\r\n @if (data()?.calculationChange; as change) {\r\n @if (change.recent) {\r\n <mt-entity-calculation-change [change]=\"change\" />\r\n }\r\n }\r\n }\r\n }\r\n</div>\r\n" }]
|
|
1493
3887
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], rawValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "rawValue", required: false }] }] } });
|
|
1494
3888
|
|
|
1495
3889
|
class EntityLongText {
|
|
@@ -2323,11 +4717,11 @@ class EntityConnection {
|
|
|
2323
4717
|
}, ...(ngDevMode ? [{ debugName: "connection" }] : /* istanbul ignore next */ []));
|
|
2324
4718
|
displayValue = computed(() => displayOrPlaceholder(this.connection()?.display), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
2325
4719
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityConnection, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2326
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityConnection, isStandalone: true, selector: "mt-entity-connection", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\
|
|
4720
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityConnection, isStandalone: true, selector: "mt-entity-connection", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <div\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >\n {{ displayValue() }}\n </div>\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2327
4721
|
}
|
|
2328
4722
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityConnection, decorators: [{
|
|
2329
4723
|
type: Component,
|
|
2330
|
-
args: [{ selector: 'mt-entity-connection', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\
|
|
4724
|
+
args: [{ selector: 'mt-entity-connection', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <div\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >\n {{ displayValue() }}\n </div>\n</mt-entity-field>\n" }]
|
|
2331
4725
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
2332
4726
|
function normalizeEntityConnection(value) {
|
|
2333
4727
|
if (value === null || value === undefined || value === '') {
|
|
@@ -2375,11 +4769,11 @@ class EntityScheduleItem {
|
|
|
2375
4769
|
}, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
2376
4770
|
emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;
|
|
2377
4771
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityScheduleItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2378
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityScheduleItem, isStandalone: true, selector: "mt-entity-schedule-item", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\
|
|
4772
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityScheduleItem, isStandalone: true, selector: "mt-entity-schedule-item", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (items().length) {\n <div class=\"flex flex-wrap items-center gap-2\">\n @for (item of items(); track item.id) {\n <mt-chip [label]=\"item.name\" size=\"small\" />\n }\n </div>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "component", type: Chip, selector: "mt-chip", inputs: ["label", "icon", "image", "removable", "removeIcon", "styleClass", "size"], outputs: ["onRemove", "onImageError"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2379
4773
|
}
|
|
2380
4774
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityScheduleItem, decorators: [{
|
|
2381
4775
|
type: Component,
|
|
2382
|
-
args: [{ selector: 'mt-entity-schedule-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, Chip], template: "<mt-entity-field\
|
|
4776
|
+
args: [{ selector: 'mt-entity-schedule-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, Chip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (items().length) {\n <div class=\"flex flex-wrap items-center gap-2\">\n @for (item of items(); track item.id) {\n <mt-chip [label]=\"item.name\" size=\"small\" />\n }\n </div>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n" }]
|
|
2383
4777
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
2384
4778
|
|
|
2385
4779
|
/**
|
|
@@ -3957,7 +6351,8 @@ const CALCULATION_CHANGE_CHIP_MS = 30_000;
|
|
|
3957
6351
|
* Whether a surface marks this property as calculated. `isCalculated` alone is
|
|
3958
6352
|
* too broad: the backend also sets it, with no calculation method, on system
|
|
3959
6353
|
* columns such as `created_at`, `id` and `team_members`. A status has no method
|
|
3960
|
-
* but is recalculated
|
|
6354
|
+
* but is recalculated. An auto code is generated rather than recalculated, but
|
|
6355
|
+
* the backend explains it like any calculated value, so it is marked too.
|
|
3961
6356
|
*/
|
|
3962
6357
|
function isCalculatedProperty(meta) {
|
|
3963
6358
|
if (!meta) {
|
|
@@ -3966,9 +6361,7 @@ function isCalculatedProperty(meta) {
|
|
|
3966
6361
|
if (meta.viewType === 'Status') {
|
|
3967
6362
|
return true;
|
|
3968
6363
|
}
|
|
3969
|
-
return
|
|
3970
|
-
!!meta.calculationMethod &&
|
|
3971
|
-
meta.calculationMethod !== 'CodeBuilder');
|
|
6364
|
+
return meta.isCalculated === true && !!meta.calculationMethod;
|
|
3972
6365
|
}
|
|
3973
6366
|
const EMPTY_CHANGES = new Map();
|
|
3974
6367
|
const historyKey = (scope, recordId, propertyKey) => `${scope}|${recordId}|${propertyKey}`;
|
|
@@ -4622,5 +7015,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
4622
7015
|
* Generated bundle index. Do not edit.
|
|
4623
7016
|
*/
|
|
4624
7017
|
|
|
4625
|
-
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 };
|
|
7018
|
+
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$1 as 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 };
|
|
4626
7019
|
//# sourceMappingURL=masterteam-components-entities.mjs.map
|