@masterteam/components 0.0.263 → 0.0.264
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 +10 -2
- package/assets/i18n/en.json +10 -2
- package/fesm2022/masterteam-components-business-fields.mjs +13 -8
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-button.mjs +34 -4
- package/fesm2022/masterteam-components-button.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +8 -4
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-client-page-menu.mjs +4 -3
- package/fesm2022/masterteam-components-client-page-menu.mjs.map +1 -1
- package/fesm2022/masterteam-components-client-page.mjs +48 -6
- package/fesm2022/masterteam-components-client-page.mjs.map +1 -1
- package/fesm2022/masterteam-components-color-picker-field.mjs +8 -4
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-confirmation.mjs +1 -1
- package/fesm2022/masterteam-components-confirmation.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +8 -4
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-drawer.mjs +1 -1
- package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs +1 -1
- package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
- package/fesm2022/masterteam-components-editor-field.mjs +8 -4
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-empty-state.mjs +53 -0
- package/fesm2022/masterteam-components-empty-state.mjs.map +1 -0
- package/fesm2022/masterteam-components-entities.mjs +184 -34
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs +82 -3
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-icon-field.mjs +9 -12
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs +9 -5
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs +8 -4
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-number-field.mjs +8 -4
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-page-header.mjs +2 -2
- package/fesm2022/masterteam-components-page-header.mjs.map +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs +8 -4
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-property-filter-builder.mjs +1 -1
- package/fesm2022/masterteam-components-property-filter-builder.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-cards-field.mjs +8 -3
- package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +7 -3
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +232 -57
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components-tabs.mjs +1 -1
- package/fesm2022/masterteam-components-tabs.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +9 -5
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs +8 -4
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-tree.mjs +1 -1
- package/fesm2022/masterteam-components-tree.mjs.map +1 -1
- package/fesm2022/masterteam-components-treeselect-field.mjs +2 -2
- package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-upload-field.mjs +9 -4
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-user-search-field.mjs +8 -4
- package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +211 -33
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +5 -1
- package/types/masterteam-components-business-fields.d.ts +4 -0
- package/types/masterteam-components-button.d.ts +27 -1
- package/types/masterteam-components-checkbox-field.d.ts +4 -0
- package/types/masterteam-components-client-page.d.ts +7 -1
- package/types/masterteam-components-color-picker-field.d.ts +4 -0
- package/types/masterteam-components-date-field.d.ts +4 -0
- package/types/masterteam-components-editor-field.d.ts +4 -0
- package/types/masterteam-components-empty-state.d.ts +47 -0
- package/types/masterteam-components-entities.d.ts +77 -5
- package/types/masterteam-components-field-validation.d.ts +38 -2
- package/types/masterteam-components-icon-field.d.ts +4 -0
- package/types/masterteam-components-location-field.d.ts +4 -0
- package/types/masterteam-components-multi-select-field.d.ts +4 -0
- package/types/masterteam-components-number-field.d.ts +4 -0
- package/types/masterteam-components-pick-list-field.d.ts +4 -0
- package/types/masterteam-components-radio-cards-field.d.ts +4 -0
- package/types/masterteam-components-select-field.d.ts +4 -0
- package/types/masterteam-components-table.d.ts +114 -4
- package/types/masterteam-components-text-field.d.ts +4 -0
- package/types/masterteam-components-textarea-field.d.ts +4 -0
- package/types/masterteam-components-upload-field.d.ts +4 -0
- package/types/masterteam-components-user-search-field.d.ts +4 -0
- package/types/masterteam-components.d.ts +81 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, input, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { TranslocoService } from '@jsverse/transloco';
|
|
4
|
+
import { Button } from '@masterteam/components/button';
|
|
5
|
+
import { Icon } from '@masterteam/icons';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The one empty state.
|
|
9
|
+
*
|
|
10
|
+
* Before this the product had three: the table's illustrated "No data found",
|
|
11
|
+
* the cards view's bare grey "No cards found.", and a hardcoded, untranslated
|
|
12
|
+
* "No data found" in the client page menu. Three patterns across one product
|
|
13
|
+
* read as three teams, and none of them said what the list holds or offered a
|
|
14
|
+
* way to fill it.
|
|
15
|
+
*
|
|
16
|
+
* Everything is optional: with no inputs at all it renders exactly what the
|
|
17
|
+
* table used to, so adopting it is never a regression.
|
|
18
|
+
*/
|
|
19
|
+
class EmptyState {
|
|
20
|
+
transloco = inject(TranslocoService);
|
|
21
|
+
variant = input('empty', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
22
|
+
/** Defaults to the variant's illustration; `none` opts out entirely. */
|
|
23
|
+
illustration = input(...(ngDevMode ? [undefined, { debugName: "illustration" }] : /* istanbul ignore next */ []));
|
|
24
|
+
/** Heading. Falls back to the variant's default copy. */
|
|
25
|
+
title = input(...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
|
|
26
|
+
/** One line saying what the list holds, or why nothing matched. */
|
|
27
|
+
description = input(...(ngDevMode ? [undefined, { debugName: "description" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/** Renders the call to action when set — "New risk", "Clear filters". */
|
|
29
|
+
actionLabel = input(...(ngDevMode ? [undefined, { debugName: "actionLabel" }] : /* istanbul ignore next */ []));
|
|
30
|
+
actionIcon = input(...(ngDevMode ? [undefined, { debugName: "actionIcon" }] : /* istanbul ignore next */ []));
|
|
31
|
+
actionClick = output();
|
|
32
|
+
resolvedTitle = computed(() => this.title()?.trim() ||
|
|
33
|
+
this.transloco.translate(this.variant() === 'filtered'
|
|
34
|
+
? 'components.emptyState.filteredTitle'
|
|
35
|
+
: 'components.emptyState.emptyTitle'), ...(ngDevMode ? [{ debugName: "resolvedTitle" }] : /* istanbul ignore next */ []));
|
|
36
|
+
resolvedIllustration = computed(() => this.illustration() ?? (this.variant() === 'filtered' ? 'filter' : 'box'), ...(ngDevMode ? [{ debugName: "resolvedIllustration" }] : /* istanbul ignore next */ []));
|
|
37
|
+
resolvedDescription = computed(() => this.description()?.trim() || '', ...(ngDevMode ? [{ debugName: "resolvedDescription" }] : /* istanbul ignore next */ []));
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmptyState, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
39
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmptyState, isStandalone: true, selector: "mt-empty-state", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, illustration: { classPropertyName: "illustration", publicName: "illustration", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, actionLabel: { classPropertyName: "actionLabel", publicName: "actionLabel", isSignal: true, isRequired: false, transformFunction: null }, actionIcon: { classPropertyName: "actionIcon", publicName: "actionIcon", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionClick: "actionClick" }, host: { classAttribute: "block w-full" }, ngImport: i0, template: "<div\r\n class=\"mt-empty-state flex flex-col items-center justify-center gap-3 px-6 py-10 text-center\"\r\n role=\"status\"\r\n>\r\n @if (resolvedIllustration() !== \"none\") {\r\n <div aria-hidden=\"true\">\r\n @if (resolvedIllustration() === \"filter\") {\r\n <mt-icon\r\n icon=\"general.filter-funnel-01\"\r\n class=\"text-5xl text-surface-300\"\r\n />\r\n } @else {\r\n <svg\r\n width=\"152\"\r\n height=\"120\"\r\n viewBox=\"0 0 152 120\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"76\" cy=\"52\" r=\"52\" fill=\"#E9EAEB\" />\r\n <g filter=\"url(#filter0_ddd_2474_28277)\">\r\n <path\r\n d=\"M77.6 16C66.8273 16 57.2978 21.3233 51.4987 29.4829C49.605 29.0363 47.6301 28.8 45.6 28.8C31.4615 28.8 20 40.2615 20 54.4C20 68.5385 31.4615 80 45.6 80L109.6 80C121.971 80 132 69.9712 132 57.6C132 45.2288 121.971 35.2 109.6 35.2C108.721 35.2 107.854 35.2506 107.002 35.349C102.098 23.9677 90.7797 16 77.6 16Z\"\r\n fill=\"#FAFAFA\"\r\n />\r\n <ellipse\r\n cx=\"45.6\"\r\n cy=\"54.3998\"\r\n rx=\"25.6\"\r\n ry=\"25.6\"\r\n fill=\"url(#paint0_linear_2474_28277)\"\r\n />\r\n <circle\r\n cx=\"77.6016\"\r\n cy=\"48\"\r\n r=\"32\"\r\n fill=\"url(#paint1_linear_2474_28277)\"\r\n />\r\n <ellipse\r\n cx=\"109.599\"\r\n cy=\"57.6002\"\r\n rx=\"22.4\"\r\n ry=\"22.4\"\r\n fill=\"url(#paint2_linear_2474_28277)\"\r\n />\r\n </g>\r\n <circle cx=\"21\" cy=\"19\" r=\"5\" fill=\"#F5F5F5\" />\r\n <circle cx=\"18\" cy=\"109\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"145\" cy=\"35\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"134\" cy=\"8\" r=\"4\" fill=\"#F5F5F5\" />\r\n <foreignObject x=\"44\" y=\"54\" width=\"64\" height=\"64\">\r\n <div\r\n xmlns=\"http://www.w3.org/1999/xhtml\"\r\n style=\"\r\n backdrop-filter: blur(4px);\r\n clip-path: url(#bgblur_0_2474_28277_clip_path);\r\n height: 100%;\r\n width: 100%;\r\n \"\r\n ></div>\r\n </foreignObject>\r\n <g data-figma-bg-blur-radius=\"8\">\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n fill=\"#344054\"\r\n fill-opacity=\"0.4\"\r\n />\r\n <path\r\n d=\"M85 95L81.5001 91.5M84 85.5C84 90.1944 80.1944 94 75.5 94C70.8056 94 67 90.1944 67 85.5C67 80.8056 70.8056 77 75.5 77C80.1944 77 84 80.8056 84 85.5Z\"\r\n stroke=\"white\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </g>\r\n <defs>\r\n <filter\r\n id=\"filter0_ddd_2474_28277\"\r\n x=\"0\"\r\n y=\"16\"\r\n width=\"152\"\r\n height=\"104\"\r\n filterUnits=\"userSpaceOnUse\"\r\n color-interpolation-filters=\"sRGB\"\r\n >\r\n <feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\" />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"1.5\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"3\" />\r\n <feGaussianBlur stdDeviation=\"1.5\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.04 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"BackgroundImageFix\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"8\" />\r\n <feGaussianBlur stdDeviation=\"4\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.03 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect1_dropShadow_2474_28277\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"20\" />\r\n <feGaussianBlur stdDeviation=\"12\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.08 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect2_dropShadow_2474_28277\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in=\"SourceGraphic\"\r\n in2=\"effect3_dropShadow_2474_28277\"\r\n result=\"shape\"\r\n />\r\n </filter>\r\n <clipPath\r\n id=\"bgblur_0_2474_28277_clip_path\"\r\n transform=\"translate(-44 -54)\"\r\n >\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n />\r\n </clipPath>\r\n <linearGradient\r\n id=\"paint0_linear_2474_28277\"\r\n x1=\"25.9429\"\r\n y1=\"37.4855\"\r\n x2=\"71.2\"\r\n y2=\"79.9998\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint1_linear_2474_28277\"\r\n x1=\"53.0301\"\r\n y1=\"26.8571\"\r\n x2=\"109.602\"\r\n y2=\"80\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint2_linear_2474_28277\"\r\n x1=\"92.3992\"\r\n y1=\"42.8002\"\r\n x2=\"131.999\"\r\n y2=\"80.0002\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n }\r\n </div>\r\n }\r\n\r\n <p class=\"m-0 text-base font-medium text-surface-600 dark:text-surface-200\">\r\n {{ resolvedTitle() }}\r\n </p>\r\n\r\n @if (resolvedDescription(); as description) {\r\n <p\r\n class=\"m-0 max-w-md text-sm font-normal text-surface-500 dark:text-surface-400\"\r\n >\r\n {{ description }}\r\n </p>\r\n }\r\n\r\n @if (actionLabel(); as label) {\r\n <mt-button\r\n class=\"mt-1\"\r\n [label]=\"label\"\r\n [icon]=\"actionIcon()\"\r\n [severity]=\"variant() === 'filtered' ? 'secondary' : 'primary'\"\r\n [variant]=\"variant() === 'filtered' ? 'outlined' : undefined\"\r\n size=\"small\"\r\n (onClick)=\"actionClick.emit()\"\r\n />\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmptyState, decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{ selector: 'mt-empty-state', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [Button, Icon], host: {
|
|
44
|
+
class: 'block w-full',
|
|
45
|
+
}, template: "<div\r\n class=\"mt-empty-state flex flex-col items-center justify-center gap-3 px-6 py-10 text-center\"\r\n role=\"status\"\r\n>\r\n @if (resolvedIllustration() !== \"none\") {\r\n <div aria-hidden=\"true\">\r\n @if (resolvedIllustration() === \"filter\") {\r\n <mt-icon\r\n icon=\"general.filter-funnel-01\"\r\n class=\"text-5xl text-surface-300\"\r\n />\r\n } @else {\r\n <svg\r\n width=\"152\"\r\n height=\"120\"\r\n viewBox=\"0 0 152 120\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"76\" cy=\"52\" r=\"52\" fill=\"#E9EAEB\" />\r\n <g filter=\"url(#filter0_ddd_2474_28277)\">\r\n <path\r\n d=\"M77.6 16C66.8273 16 57.2978 21.3233 51.4987 29.4829C49.605 29.0363 47.6301 28.8 45.6 28.8C31.4615 28.8 20 40.2615 20 54.4C20 68.5385 31.4615 80 45.6 80L109.6 80C121.971 80 132 69.9712 132 57.6C132 45.2288 121.971 35.2 109.6 35.2C108.721 35.2 107.854 35.2506 107.002 35.349C102.098 23.9677 90.7797 16 77.6 16Z\"\r\n fill=\"#FAFAFA\"\r\n />\r\n <ellipse\r\n cx=\"45.6\"\r\n cy=\"54.3998\"\r\n rx=\"25.6\"\r\n ry=\"25.6\"\r\n fill=\"url(#paint0_linear_2474_28277)\"\r\n />\r\n <circle\r\n cx=\"77.6016\"\r\n cy=\"48\"\r\n r=\"32\"\r\n fill=\"url(#paint1_linear_2474_28277)\"\r\n />\r\n <ellipse\r\n cx=\"109.599\"\r\n cy=\"57.6002\"\r\n rx=\"22.4\"\r\n ry=\"22.4\"\r\n fill=\"url(#paint2_linear_2474_28277)\"\r\n />\r\n </g>\r\n <circle cx=\"21\" cy=\"19\" r=\"5\" fill=\"#F5F5F5\" />\r\n <circle cx=\"18\" cy=\"109\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"145\" cy=\"35\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"134\" cy=\"8\" r=\"4\" fill=\"#F5F5F5\" />\r\n <foreignObject x=\"44\" y=\"54\" width=\"64\" height=\"64\">\r\n <div\r\n xmlns=\"http://www.w3.org/1999/xhtml\"\r\n style=\"\r\n backdrop-filter: blur(4px);\r\n clip-path: url(#bgblur_0_2474_28277_clip_path);\r\n height: 100%;\r\n width: 100%;\r\n \"\r\n ></div>\r\n </foreignObject>\r\n <g data-figma-bg-blur-radius=\"8\">\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n fill=\"#344054\"\r\n fill-opacity=\"0.4\"\r\n />\r\n <path\r\n d=\"M85 95L81.5001 91.5M84 85.5C84 90.1944 80.1944 94 75.5 94C70.8056 94 67 90.1944 67 85.5C67 80.8056 70.8056 77 75.5 77C80.1944 77 84 80.8056 84 85.5Z\"\r\n stroke=\"white\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </g>\r\n <defs>\r\n <filter\r\n id=\"filter0_ddd_2474_28277\"\r\n x=\"0\"\r\n y=\"16\"\r\n width=\"152\"\r\n height=\"104\"\r\n filterUnits=\"userSpaceOnUse\"\r\n color-interpolation-filters=\"sRGB\"\r\n >\r\n <feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\" />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"1.5\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"3\" />\r\n <feGaussianBlur stdDeviation=\"1.5\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.04 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"BackgroundImageFix\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"8\" />\r\n <feGaussianBlur stdDeviation=\"4\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.03 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect1_dropShadow_2474_28277\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"20\" />\r\n <feGaussianBlur stdDeviation=\"12\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.08 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect2_dropShadow_2474_28277\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in=\"SourceGraphic\"\r\n in2=\"effect3_dropShadow_2474_28277\"\r\n result=\"shape\"\r\n />\r\n </filter>\r\n <clipPath\r\n id=\"bgblur_0_2474_28277_clip_path\"\r\n transform=\"translate(-44 -54)\"\r\n >\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n />\r\n </clipPath>\r\n <linearGradient\r\n id=\"paint0_linear_2474_28277\"\r\n x1=\"25.9429\"\r\n y1=\"37.4855\"\r\n x2=\"71.2\"\r\n y2=\"79.9998\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint1_linear_2474_28277\"\r\n x1=\"53.0301\"\r\n y1=\"26.8571\"\r\n x2=\"109.602\"\r\n y2=\"80\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint2_linear_2474_28277\"\r\n x1=\"92.3992\"\r\n y1=\"42.8002\"\r\n x2=\"131.999\"\r\n y2=\"80.0002\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n }\r\n </div>\r\n }\r\n\r\n <p class=\"m-0 text-base font-medium text-surface-600 dark:text-surface-200\">\r\n {{ resolvedTitle() }}\r\n </p>\r\n\r\n @if (resolvedDescription(); as description) {\r\n <p\r\n class=\"m-0 max-w-md text-sm font-normal text-surface-500 dark:text-surface-400\"\r\n >\r\n {{ description }}\r\n </p>\r\n }\r\n\r\n @if (actionLabel(); as label) {\r\n <mt-button\r\n class=\"mt-1\"\r\n [label]=\"label\"\r\n [icon]=\"actionIcon()\"\r\n [severity]=\"variant() === 'filtered' ? 'secondary' : 'primary'\"\r\n [variant]=\"variant() === 'filtered' ? 'outlined' : undefined\"\r\n size=\"small\"\r\n (onClick)=\"actionClick.emit()\"\r\n />\r\n }\r\n</div>\r\n" }]
|
|
46
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], illustration: [{ type: i0.Input, args: [{ isSignal: true, alias: "illustration", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], actionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionLabel", required: false }] }], actionIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionIcon", required: false }] }], actionClick: [{ type: i0.Output, args: ["actionClick"] }] } });
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generated bundle index. Do not edit.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
export { EmptyState };
|
|
53
|
+
//# sourceMappingURL=masterteam-components-empty-state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-empty-state.mjs","sources":["../../../../packages/masterteam/components/empty-state/empty-state.ts","../../../../packages/masterteam/components/empty-state/empty-state.html","../../../../packages/masterteam/components/empty-state/masterteam-components-empty-state.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n inject,\r\n input,\r\n output,\r\n} from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { Icon, MTIcon } from '@masterteam/icons';\r\n\r\n/**\r\n * Which story an empty list is telling. They are different situations and they\r\n * need different words: \"nothing here yet\" invites the user to create the first\r\n * record, \"nothing matched\" invites them to widen the filter. Rendering the\r\n * same magnifying glass for both actively misleads — it implies a search is\r\n * hiding results when none was applied (finding H-12).\r\n */\r\nexport type EmptyStateVariant = 'empty' | 'filtered';\r\n\r\n/** Artwork slot. `none` for tight surfaces (a sidebar menu, a small panel). */\r\nexport type EmptyStateIllustration = 'box' | 'filter' | 'none';\r\n\r\n/**\r\n * The one empty state.\r\n *\r\n * Before this the product had three: the table's illustrated \"No data found\",\r\n * the cards view's bare grey \"No cards found.\", and a hardcoded, untranslated\r\n * \"No data found\" in the client page menu. Three patterns across one product\r\n * read as three teams, and none of them said what the list holds or offered a\r\n * way to fill it.\r\n *\r\n * Everything is optional: with no inputs at all it renders exactly what the\r\n * table used to, so adopting it is never a regression.\r\n */\r\n@Component({\r\n selector: 'mt-empty-state',\r\n standalone: true,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [Button, Icon],\r\n templateUrl: './empty-state.html',\r\n host: {\r\n class: 'block w-full',\r\n },\r\n})\r\nexport class EmptyState {\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n readonly variant = input<EmptyStateVariant>('empty');\r\n\r\n /** Defaults to the variant's illustration; `none` opts out entirely. */\r\n readonly illustration = input<EmptyStateIllustration>();\r\n\r\n /** Heading. Falls back to the variant's default copy. */\r\n readonly title = input<string>();\r\n\r\n /** One line saying what the list holds, or why nothing matched. */\r\n readonly description = input<string>();\r\n\r\n /** Renders the call to action when set — \"New risk\", \"Clear filters\". */\r\n readonly actionLabel = input<string>();\r\n readonly actionIcon = input<MTIcon>();\r\n\r\n readonly actionClick = output<void>();\r\n\r\n readonly resolvedTitle = computed(\r\n () =>\r\n this.title()?.trim() ||\r\n this.transloco.translate(\r\n this.variant() === 'filtered'\r\n ? 'components.emptyState.filteredTitle'\r\n : 'components.emptyState.emptyTitle',\r\n ),\r\n );\r\n\r\n readonly resolvedIllustration = computed<EmptyStateIllustration>(\r\n () =>\r\n this.illustration() ?? (this.variant() === 'filtered' ? 'filter' : 'box'),\r\n );\r\n\r\n readonly resolvedDescription = computed(\r\n () => this.description()?.trim() || '',\r\n );\r\n}\r\n","<div\r\n class=\"mt-empty-state flex flex-col items-center justify-center gap-3 px-6 py-10 text-center\"\r\n role=\"status\"\r\n>\r\n @if (resolvedIllustration() !== \"none\") {\r\n <div aria-hidden=\"true\">\r\n @if (resolvedIllustration() === \"filter\") {\r\n <mt-icon\r\n icon=\"general.filter-funnel-01\"\r\n class=\"text-5xl text-surface-300\"\r\n />\r\n } @else {\r\n <svg\r\n width=\"152\"\r\n height=\"120\"\r\n viewBox=\"0 0 152 120\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n >\r\n <circle cx=\"76\" cy=\"52\" r=\"52\" fill=\"#E9EAEB\" />\r\n <g filter=\"url(#filter0_ddd_2474_28277)\">\r\n <path\r\n d=\"M77.6 16C66.8273 16 57.2978 21.3233 51.4987 29.4829C49.605 29.0363 47.6301 28.8 45.6 28.8C31.4615 28.8 20 40.2615 20 54.4C20 68.5385 31.4615 80 45.6 80L109.6 80C121.971 80 132 69.9712 132 57.6C132 45.2288 121.971 35.2 109.6 35.2C108.721 35.2 107.854 35.2506 107.002 35.349C102.098 23.9677 90.7797 16 77.6 16Z\"\r\n fill=\"#FAFAFA\"\r\n />\r\n <ellipse\r\n cx=\"45.6\"\r\n cy=\"54.3998\"\r\n rx=\"25.6\"\r\n ry=\"25.6\"\r\n fill=\"url(#paint0_linear_2474_28277)\"\r\n />\r\n <circle\r\n cx=\"77.6016\"\r\n cy=\"48\"\r\n r=\"32\"\r\n fill=\"url(#paint1_linear_2474_28277)\"\r\n />\r\n <ellipse\r\n cx=\"109.599\"\r\n cy=\"57.6002\"\r\n rx=\"22.4\"\r\n ry=\"22.4\"\r\n fill=\"url(#paint2_linear_2474_28277)\"\r\n />\r\n </g>\r\n <circle cx=\"21\" cy=\"19\" r=\"5\" fill=\"#F5F5F5\" />\r\n <circle cx=\"18\" cy=\"109\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"145\" cy=\"35\" r=\"7\" fill=\"#F5F5F5\" />\r\n <circle cx=\"134\" cy=\"8\" r=\"4\" fill=\"#F5F5F5\" />\r\n <foreignObject x=\"44\" y=\"54\" width=\"64\" height=\"64\">\r\n <div\r\n xmlns=\"http://www.w3.org/1999/xhtml\"\r\n style=\"\r\n backdrop-filter: blur(4px);\r\n clip-path: url(#bgblur_0_2474_28277_clip_path);\r\n height: 100%;\r\n width: 100%;\r\n \"\r\n ></div>\r\n </foreignObject>\r\n <g data-figma-bg-blur-radius=\"8\">\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n fill=\"#344054\"\r\n fill-opacity=\"0.4\"\r\n />\r\n <path\r\n d=\"M85 95L81.5001 91.5M84 85.5C84 90.1944 80.1944 94 75.5 94C70.8056 94 67 90.1944 67 85.5C67 80.8056 70.8056 77 75.5 77C80.1944 77 84 80.8056 84 85.5Z\"\r\n stroke=\"white\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </g>\r\n <defs>\r\n <filter\r\n id=\"filter0_ddd_2474_28277\"\r\n x=\"0\"\r\n y=\"16\"\r\n width=\"152\"\r\n height=\"104\"\r\n filterUnits=\"userSpaceOnUse\"\r\n color-interpolation-filters=\"sRGB\"\r\n >\r\n <feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\" />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"1.5\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"3\" />\r\n <feGaussianBlur stdDeviation=\"1.5\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.04 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"BackgroundImageFix\"\r\n result=\"effect1_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"8\" />\r\n <feGaussianBlur stdDeviation=\"4\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.03 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect1_dropShadow_2474_28277\"\r\n result=\"effect2_dropShadow_2474_28277\"\r\n />\r\n <feColorMatrix\r\n in=\"SourceAlpha\"\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\r\n result=\"hardAlpha\"\r\n />\r\n <feMorphology\r\n radius=\"4\"\r\n operator=\"erode\"\r\n in=\"SourceAlpha\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feOffset dy=\"20\" />\r\n <feGaussianBlur stdDeviation=\"12\" />\r\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\r\n <feColorMatrix\r\n type=\"matrix\"\r\n values=\"0 0 0 0 0.0392157 0 0 0 0 0.0496732 0 0 0 0 0.0705882 0 0 0 0.08 0\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in2=\"effect2_dropShadow_2474_28277\"\r\n result=\"effect3_dropShadow_2474_28277\"\r\n />\r\n <feBlend\r\n mode=\"normal\"\r\n in=\"SourceGraphic\"\r\n in2=\"effect3_dropShadow_2474_28277\"\r\n result=\"shape\"\r\n />\r\n </filter>\r\n <clipPath\r\n id=\"bgblur_0_2474_28277_clip_path\"\r\n transform=\"translate(-44 -54)\"\r\n >\r\n <path\r\n d=\"M52 86C52 72.7452 62.7452 62 76 62C89.2548 62 100 72.7452 100 86C100 99.2548 89.2548 110 76 110C62.7452 110 52 99.2548 52 86Z\"\r\n />\r\n </clipPath>\r\n <linearGradient\r\n id=\"paint0_linear_2474_28277\"\r\n x1=\"25.9429\"\r\n y1=\"37.4855\"\r\n x2=\"71.2\"\r\n y2=\"79.9998\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint1_linear_2474_28277\"\r\n x1=\"53.0301\"\r\n y1=\"26.8571\"\r\n x2=\"109.602\"\r\n y2=\"80\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n <linearGradient\r\n id=\"paint2_linear_2474_28277\"\r\n x1=\"92.3992\"\r\n y1=\"42.8002\"\r\n x2=\"131.999\"\r\n y2=\"80.0002\"\r\n gradientUnits=\"userSpaceOnUse\"\r\n >\r\n <stop stop-color=\"#D0D5DD\" />\r\n <stop offset=\"0.350715\" stop-color=\"white\" stop-opacity=\"0\" />\r\n </linearGradient>\r\n </defs>\r\n </svg>\r\n }\r\n </div>\r\n }\r\n\r\n <p class=\"m-0 text-base font-medium text-surface-600 dark:text-surface-200\">\r\n {{ resolvedTitle() }}\r\n </p>\r\n\r\n @if (resolvedDescription(); as description) {\r\n <p\r\n class=\"m-0 max-w-md text-sm font-normal text-surface-500 dark:text-surface-400\"\r\n >\r\n {{ description }}\r\n </p>\r\n }\r\n\r\n @if (actionLabel(); as label) {\r\n <mt-button\r\n class=\"mt-1\"\r\n [label]=\"label\"\r\n [icon]=\"actionIcon()\"\r\n [severity]=\"variant() === 'filtered' ? 'secondary' : 'primary'\"\r\n [variant]=\"variant() === 'filtered' ? 'outlined' : undefined\"\r\n size=\"small\"\r\n (onClick)=\"actionClick.emit()\"\r\n />\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAwBA;;;;;;;;;;;AAWG;MAWU,UAAU,CAAA;AACJ,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAE5C,IAAA,OAAO,GAAG,KAAK,CAAoB,OAAO,8EAAC;;IAG3C,YAAY,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,cAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAA0B;;IAG9C,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;;IAGvB,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;;IAG7B,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IAC7B,UAAU,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,YAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IAE5B,WAAW,GAAG,MAAM,EAAQ;AAE5B,IAAA,aAAa,GAAG,QAAQ,CAC/B,MACE,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE;QACpB,IAAI,CAAC,SAAS,CAAC,SAAS,CACtB,IAAI,CAAC,OAAO,EAAE,KAAK;AACjB,cAAE;AACF,cAAE,kCAAkC,CACvC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,eAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CACJ;AAEQ,IAAA,oBAAoB,GAAG,QAAQ,CACtC,MACE,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,sBAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAC5E;AAEQ,IAAA,mBAAmB,GAAG,QAAQ,CACrC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,0FACvC;uGArCU,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAV,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,YAAA,EAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,UAAA,EAAA,cAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,cAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EC9CvB,8lSA4OA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDpMY,MAAM,yWAAE,IAAI,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAMX,UAAU,EAAA,UAAA,EAAA,CAAA;kBAVtB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,EAAA,UAAA,EACd,IAAI,EAAA,eAAA,EACC,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAA,IAAA,EAEjB;AACJ,wBAAA,KAAK,EAAE,cAAc;AACtB,qBAAA,EAAA,QAAA,EAAA,8lSAAA,EAAA;;;AE5CH;;AAEG;;;;"}
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, computed, ChangeDetectionStrategy, Component, signal, effect, untracked, inject, output, ElementRef, NgZone, Directive, model } from '@angular/core';
|
|
3
3
|
import { TruncateTooltip, Tooltip } from '@masterteam/components/tooltip';
|
|
4
4
|
import { Icon } from '@masterteam/icons';
|
|
5
|
-
import { MTDateFormatPipe, REQUEST_CONTEXT } from '@masterteam/components';
|
|
5
|
+
import { MTDateFormatPipe, REQUEST_CONTEXT, readableTextOn } from '@masterteam/components';
|
|
6
6
|
import { HttpContext, HttpClient } from '@angular/common/http';
|
|
7
7
|
import { TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
|
8
8
|
import { Avatar } from '@masterteam/components/avatar';
|
|
@@ -43,9 +43,44 @@ function isEntityAlignEnd(configuration) {
|
|
|
43
43
|
const config = configuration;
|
|
44
44
|
return config?.alignEnd ?? false;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The product default: label above value.
|
|
48
|
+
*
|
|
49
|
+
* It used to be `bottom`, which is why Portfolio and Program cards rendered
|
|
50
|
+
* "06/07/2026" then "Start Date" while Project cards — whose properties had
|
|
51
|
+
* been through the property-configuration drawer, and so carry an explicit
|
|
52
|
+
* `labelPosition` — rendered the label first. Two orders inside one Explore
|
|
53
|
+
* module, reachable by clicking a different item in the same sidebar
|
|
54
|
+
* (finding M-13). Label-first reads better down a column of mixed field types,
|
|
55
|
+
* so it is what every unconfigured property now gets.
|
|
56
|
+
*
|
|
57
|
+
* An explicit configuration still wins: an administrator who deliberately
|
|
58
|
+
* chose value-above-label for a property keeps it.
|
|
59
|
+
*/
|
|
46
60
|
function resolveEntityLabelPosition(configuration) {
|
|
47
61
|
const config = configuration;
|
|
48
|
-
return config?.labelPosition ?? config?.labelPostion ?? '
|
|
62
|
+
return config?.labelPosition ?? config?.labelPostion ?? 'top';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Rewrites a localised numeric string into something `parseFloat` can read.
|
|
66
|
+
*
|
|
67
|
+
* `rawNumericValue` can fall back to the already-formatted display string, so
|
|
68
|
+
* whatever `Intl.NumberFormat` produced has to survive a round trip. Under
|
|
69
|
+
* `ar` that is harmless (Latin digits plus invisible direction marks), but
|
|
70
|
+
* `ar-SA` renders Arabic-Indic digits and an Arabic decimal separator, which
|
|
71
|
+
* parse to NaN — the bar would silently disappear rather than show a value.
|
|
72
|
+
*
|
|
73
|
+
* Handles Arabic-Indic (U+0660-0669) and Eastern Arabic-Indic (U+06F0-06F9)
|
|
74
|
+
* digits, the Arabic decimal separator, thousands separators, and the
|
|
75
|
+
* bidirectional marks Intl inserts around the percent sign.
|
|
76
|
+
*/
|
|
77
|
+
function normalizeNumerals(input) {
|
|
78
|
+
return input
|
|
79
|
+
.replace(/[]/g, '')
|
|
80
|
+
.replace(/[٠-٩]/g, (d) => String(d.charCodeAt(0) - 0x0660))
|
|
81
|
+
.replace(/[۰-۹]/g, (d) => String(d.charCodeAt(0) - 0x06f0))
|
|
82
|
+
.replace(/[٫]/g, '.')
|
|
83
|
+
.replace(/[٬ ]/g, '');
|
|
49
84
|
}
|
|
50
85
|
|
|
51
86
|
class EntityField {
|
|
@@ -150,11 +185,11 @@ class EntityText {
|
|
|
150
185
|
return displayOrPlaceholder(this.value());
|
|
151
186
|
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
152
187
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityText, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
153
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityText, isStandalone: true, selector: "mt-entity-text", 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\
|
|
188
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityText, isStandalone: true, selector: "mt-entity-text", 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 <!--\n Two lines before the ellipsis, not one. Portfolio and project names were\n being cut mid-word on the Explore board (\"Smart City Infrastructure Po\u2026\"),\n which makes similarly-titled records indistinguishable without opening each\n one (finding H-06). `line-clamp-2` still ellipsises what genuinely does not\n fit, and `mtTruncateTooltip` reads `scrollHeight > clientHeight`, so the\n tooltip keeps working for the clamped case exactly as it did for the\n single-line one.\n -->\n <div\n class=\"min-w-0 max-w-full line-clamp-2 break-words text-sm font-semibold\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n [innerHTML]=\"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 });
|
|
154
189
|
}
|
|
155
190
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityText, decorators: [{
|
|
156
191
|
type: Component,
|
|
157
|
-
args: [{ selector: 'mt-entity-text', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\
|
|
192
|
+
args: [{ selector: 'mt-entity-text', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <!--\n Two lines before the ellipsis, not one. Portfolio and project names were\n being cut mid-word on the Explore board (\"Smart City Infrastructure Po\u2026\"),\n which makes similarly-titled records indistinguishable without opening each\n one (finding H-06). `line-clamp-2` still ellipsises what genuinely does not\n fit, and `mtTruncateTooltip` reads `scrollHeight > clientHeight`, so the\n tooltip keeps working for the clamped case exactly as it did for the\n single-line one.\n -->\n <div\n class=\"min-w-0 max-w-full line-clamp-2 break-words text-sm font-semibold\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n [innerHTML]=\"displayValue()\"\n ></div>\n</mt-entity-field>\n" }]
|
|
158
193
|
}], 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 }] }] } });
|
|
159
194
|
|
|
160
195
|
class EntityDate {
|
|
@@ -182,11 +217,11 @@ class EntityDate {
|
|
|
182
217
|
}, ...(ngDevMode ? [{ debugName: "resolvedViewType" }] : /* istanbul ignore next */ []));
|
|
183
218
|
displayValue = computed(() => this.data()?.rawValue ?? this.data()?.value ?? this.value(), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
184
219
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityDate, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
185
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityDate, isStandalone: true, selector: "mt-entity-date", 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 }, viewType: { classPropertyName: "viewType", publicName: "viewType", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\
|
|
220
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityDate, isStandalone: true, selector: "mt-entity-date", 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 }, viewType: { classPropertyName: "viewType", publicName: "viewType", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <span\n class=\"block min-w-0 truncate text-sm font-semibold tabular-nums whitespace-nowrap\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >\n @if (displayValue()) {\n {{ displayValue() | mtDateFormat: resolvedViewType() }}\n } @else {\n -\n }\n </span>\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]" }, { kind: "pipe", type: MTDateFormatPipe, name: "mtDateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
186
221
|
}
|
|
187
222
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityDate, decorators: [{
|
|
188
223
|
type: Component,
|
|
189
|
-
args: [{ selector: 'mt-entity-date', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip, MTDateFormatPipe], template: "<mt-entity-field\
|
|
224
|
+
args: [{ selector: 'mt-entity-date', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip, MTDateFormatPipe], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <span\n class=\"block min-w-0 truncate text-sm font-semibold tabular-nums whitespace-nowrap\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >\n @if (displayValue()) {\n {{ displayValue() | mtDateFormat: resolvedViewType() }}\n } @else {\n -\n }\n </span>\n</mt-entity-field>\n" }]
|
|
190
225
|
}], 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 }] }], viewType: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewType", required: false }] }] } });
|
|
191
226
|
|
|
192
227
|
class EntityStatus {
|
|
@@ -386,6 +421,9 @@ function resolvePercentageColor(value, source) {
|
|
|
386
421
|
}
|
|
387
422
|
|
|
388
423
|
class EntityPercentage {
|
|
424
|
+
transloco = inject(TranslocoService);
|
|
425
|
+
/** Active locale, so number formatting follows the UI language. */
|
|
426
|
+
locale = computed(() => this.transloco.getActiveLang() || 'en', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
389
427
|
/** Full entity data object */
|
|
390
428
|
data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : /* istanbul ignore next */ []));
|
|
391
429
|
/** Individual inputs (used when data is not provided) */
|
|
@@ -441,7 +479,23 @@ class EntityPercentage {
|
|
|
441
479
|
resolvePercentageColor(raw, fromProperty) ??
|
|
442
480
|
'primary');
|
|
443
481
|
}, ...(ngDevMode ? [{ debugName: "progressColor" }] : /* istanbul ignore next */ []));
|
|
444
|
-
/**
|
|
482
|
+
/**
|
|
483
|
+
* Renders a percentage for the active locale.
|
|
484
|
+
*
|
|
485
|
+
* This used to echo the backend's string and only append `%` when that string
|
|
486
|
+
* already carried one — so in Arabic, where the API returns a bare `"25"`,
|
|
487
|
+
* the symbol vanished and a progress value rendered as an unlabelled `25`.
|
|
488
|
+
* Next to a bar that could be a percentage, a count or a score (finding
|
|
489
|
+
* H-08).
|
|
490
|
+
*
|
|
491
|
+
* Formatting from the NUMBER through `Intl.NumberFormat` makes the symbol,
|
|
492
|
+
* the decimal separator and the digit shapes follow the locale instead of the
|
|
493
|
+
* payload. `maximumFractionDigits: 1` preserves the precision the old code
|
|
494
|
+
* kept; `style: 'percent'` expects a fraction, hence the /100.
|
|
495
|
+
*
|
|
496
|
+
* Non-numeric values pass through untouched — a status string or an em dash
|
|
497
|
+
* must not be mangled into `NaN%`.
|
|
498
|
+
*/
|
|
445
499
|
formatPercentageDisplay(raw) {
|
|
446
500
|
if (isValueMissing(raw)) {
|
|
447
501
|
return raw;
|
|
@@ -450,14 +504,24 @@ class EntityPercentage {
|
|
|
450
504
|
if (num === null) {
|
|
451
505
|
return raw;
|
|
452
506
|
}
|
|
453
|
-
|
|
454
|
-
|
|
507
|
+
try {
|
|
508
|
+
return new Intl.NumberFormat(this.locale(), {
|
|
509
|
+
style: 'percent',
|
|
510
|
+
maximumFractionDigits: 1,
|
|
511
|
+
}).format(num / 100);
|
|
512
|
+
}
|
|
513
|
+
catch {
|
|
514
|
+
// An unknown locale tag must not cost the user their number.
|
|
515
|
+
return `${Number(num.toFixed(1))}%`;
|
|
516
|
+
}
|
|
455
517
|
}
|
|
456
518
|
parseNumericValue(raw) {
|
|
457
519
|
if (isValueMissing(raw)) {
|
|
458
520
|
return null;
|
|
459
521
|
}
|
|
460
|
-
const normalizedRawValue = String(raw)
|
|
522
|
+
const normalizedRawValue = normalizeNumerals(String(raw))
|
|
523
|
+
.replace(/[%٪]/g, '')
|
|
524
|
+
.trim();
|
|
461
525
|
if (!normalizedRawValue) {
|
|
462
526
|
return null;
|
|
463
527
|
}
|
|
@@ -472,26 +536,113 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
472
536
|
args: [{ selector: 'mt-entity-percentage', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [Progress], 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=\"text-xs font-semibold\">{{ displayName() }}</span>\r\n }\r\n <span class=\"text-xs font-bold\" [class.ms-auto]=\"hideName()\">{{\r\n displayValue()\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" }]
|
|
473
537
|
}], 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 }] }] } });
|
|
474
538
|
|
|
539
|
+
/**
|
|
540
|
+
* The largest amount still rendered in full.
|
|
541
|
+
*
|
|
542
|
+
* The reviewer measured exactly where the line falls: `100,000 SAR` fits a card
|
|
543
|
+
* slot, `1,000,000 SAR` does not and loses its currency to the ellipsis. So the
|
|
544
|
+
* comparison below is inclusive — anything ABOVE this compacts, and everything
|
|
545
|
+
* a tenant sees today at or under it is untouched.
|
|
546
|
+
*/
|
|
547
|
+
const CURRENCY_COMPACT_THRESHOLD = 100_000;
|
|
548
|
+
/**
|
|
549
|
+
* The numeric amount inside a formatted currency string.
|
|
550
|
+
*
|
|
551
|
+
* Strips the currency token, the grouping separators and the bidirectional
|
|
552
|
+
* marks `Intl` leaves around them, and normalises Arabic-Indic digits so an
|
|
553
|
+
* `ar-SA` payload parses like an `en` one. `null` when there is no number.
|
|
554
|
+
*/
|
|
555
|
+
function parseCurrencyAmount(raw) {
|
|
556
|
+
if (typeof raw !== 'string') {
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
const numeric = normalizeNumerals(raw).replace(/[^0-9.+-]/g, '');
|
|
560
|
+
if (!numeric || !/\d/.test(numeric)) {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
const parsed = Number.parseFloat(numeric);
|
|
564
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Whatever is left of a formatted amount once the number is removed — `SAR`,
|
|
568
|
+
* `ر.س`, `$`. Read from the payload rather than configured, so a tenant's own
|
|
569
|
+
* currency survives untouched.
|
|
570
|
+
*/
|
|
571
|
+
function currencyUnitOf(formatted) {
|
|
572
|
+
return normalizeNumerals(formatted)
|
|
573
|
+
.replace(/[0-9.,+-]/g, '')
|
|
574
|
+
.trim();
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* A large currency amount shortened so it fits a card slot, with the unit kept.
|
|
578
|
+
*
|
|
579
|
+
* A budget of a million or more used to render as `1,000,000 …`: the digits
|
|
580
|
+
* survived the ellipsis and the currency did not, so the largest and most
|
|
581
|
+
* consequential figures in the product were the only ones whose unit could not
|
|
582
|
+
* be read (finding H-06). Compact notation keeps the whole thing inside the
|
|
583
|
+
* slot — `SAR 1M` instead of `1,000,000 SAR` — and callers put the exact figure
|
|
584
|
+
* in a tooltip, which is where a precise number belongs on a summary card.
|
|
585
|
+
*
|
|
586
|
+
* Returns `formatted` unchanged whenever the value already fits, is not a
|
|
587
|
+
* number, or the runtime has no compact notation — so no tenant sees an
|
|
588
|
+
* existing number change shape for no reason.
|
|
589
|
+
*/
|
|
590
|
+
function compactCurrencyDisplay(formatted, rawValue, locale, threshold = CURRENCY_COMPACT_THRESHOLD) {
|
|
591
|
+
const amount = parseCurrencyAmount(rawValue ?? formatted);
|
|
592
|
+
if (amount === null || Math.abs(amount) <= threshold) {
|
|
593
|
+
return formatted;
|
|
594
|
+
}
|
|
595
|
+
let compact;
|
|
596
|
+
try {
|
|
597
|
+
compact = new Intl.NumberFormat(locale, {
|
|
598
|
+
notation: 'compact',
|
|
599
|
+
maximumFractionDigits: 1,
|
|
600
|
+
}).format(amount);
|
|
601
|
+
}
|
|
602
|
+
catch {
|
|
603
|
+
return formatted;
|
|
604
|
+
}
|
|
605
|
+
const unit = currencyUnitOf(formatted);
|
|
606
|
+
if (!unit) {
|
|
607
|
+
return compact;
|
|
608
|
+
}
|
|
609
|
+
// Keep the payload's own unit placement — `SAR 1,000` and `1,000 SAR` are
|
|
610
|
+
// both in use, and flipping one to the other reads as a different currency.
|
|
611
|
+
return formatted.trimStart().startsWith(unit)
|
|
612
|
+
? `${unit} ${compact}`
|
|
613
|
+
: `${compact} ${unit}`;
|
|
614
|
+
}
|
|
615
|
+
|
|
475
616
|
class EntityCurrency {
|
|
617
|
+
transloco = inject(TranslocoService);
|
|
618
|
+
/** Active locale, so number formatting follows the UI language. */
|
|
619
|
+
locale = computed(() => this.transloco.getActiveLang() || 'en', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
476
620
|
/** Full entity data object */
|
|
477
621
|
data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : /* istanbul ignore next */ []));
|
|
478
622
|
/** Individual inputs (used when data is not provided) */
|
|
479
623
|
name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
|
|
480
624
|
value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
481
625
|
displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
|
|
482
|
-
|
|
626
|
+
/** The backend's fully grouped string — always the tooltip, never truncated. */
|
|
627
|
+
fullValue = computed(() => {
|
|
483
628
|
const d = this.data();
|
|
484
629
|
if (d) {
|
|
485
630
|
return displayOrPlaceholder(typeof d.value === 'string' ? d.value : null);
|
|
486
631
|
}
|
|
487
632
|
return displayOrPlaceholder(this.value());
|
|
488
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
633
|
+
}, ...(ngDevMode ? [{ debugName: "fullValue" }] : /* istanbul ignore next */ []));
|
|
634
|
+
/**
|
|
635
|
+
* What the cell renders: the backend's string, or a compact form of it when
|
|
636
|
+
* the amount is large enough that the currency token would be truncated away.
|
|
637
|
+
* See {@link compactCurrencyDisplay} (finding H-06).
|
|
638
|
+
*/
|
|
639
|
+
displayValue = computed(() => compactCurrencyDisplay(this.fullValue(), this.data()?.rawValue, this.locale()), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
489
640
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCurrency, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
490
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityCurrency, isStandalone: true, selector: "mt-entity-currency", 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\
|
|
641
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityCurrency, isStandalone: true, selector: "mt-entity-currency", 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 <span\n class=\"block min-w-0 truncate text-sm font-semibold tabular-nums whitespace-nowrap\"\n [mtTooltip]=\"fullValue()\"\n tooltipPosition=\"top\"\n >\n {{ displayValue() }}\n </span>\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
491
642
|
}
|
|
492
643
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityCurrency, decorators: [{
|
|
493
644
|
type: Component,
|
|
494
|
-
args: [{ selector: 'mt-entity-currency', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField,
|
|
645
|
+
args: [{ selector: 'mt-entity-currency', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, Tooltip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <span\n class=\"block min-w-0 truncate text-sm font-semibold tabular-nums whitespace-nowrap\"\n [mtTooltip]=\"fullValue()\"\n tooltipPosition=\"top\"\n >\n {{ displayValue() }}\n </span>\n</mt-entity-field>\n" }]
|
|
495
646
|
}], 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 }] }] } });
|
|
496
647
|
|
|
497
648
|
class EntityCheckbox {
|
|
@@ -1052,7 +1203,7 @@ class EntityAttachment {
|
|
|
1052
1203
|
return undefined;
|
|
1053
1204
|
}
|
|
1054
1205
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityAttachment, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1055
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityAttachment, isStandalone: true, selector: "mt-entity-attachment", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, endPoint: { classPropertyName: "endPoint", publicName: "endPoint", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"relaxed\"\r\n>\r\n @if (hasAttachments()) {\r\n @if (shape() === \"compact\") {\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @for (\r\n attachment of attachments();\r\n track attachmentTrackBy($index, attachment)\r\n ) {\r\n <mt-button\r\n iconPos=\"top\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [icon]=\"attachmentActionIcon($index, attachment)\"\r\n [tooltip]=\"attachmentTooltip(attachment)\"\r\n styleClass=\"h-9! w-9! rounded-lg! transition-all duration-200 hover:scale-105 hover:border-primary-500! hover:text-primary-600! hover:bg-primary-50!\"\r\n (onClick)=\"onCompactAttachmentClick($event, attachment)\"\r\n (mouseenter)=\"\r\n hoveredAttachmentKey.set(attachmentTrackBy($index, attachment))\r\n \"\r\n (mouseleave)=\"hoveredAttachmentKey.set(null)\"\r\n (onFocus)=\"\r\n hoveredAttachmentKey.set(attachmentTrackBy($index, attachment))\r\n \"\r\n (onBlur)=\"hoveredAttachmentKey.set(null)\"\r\n />\r\n }\r\n </div>\r\n } @else {\r\n <mt-upload-field\r\n class=\"w-full\"\r\n [ngModel]=\"uploadValue()\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n [shape]=\"'card'\"\r\n [multiple]=\"isMultiple()\"\r\n [readonly]=\"true\"\r\n [endPoint]=\"endPoint()\"\r\n [accept]=\"acceptTypes()\"\r\n [context]=\"context()\"\r\n />\r\n }\r\n } @else {\r\n <span class=\"text-sm font-semibold\">{{ empty }}</span>\r\n }\r\n</mt-entity-field>\r\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: UploadField, selector: "mt-upload-field", inputs: ["label", "title", "description", "endPoint", "size", "userImgClass", "shape", "multiple", "accept", "isDragging", "fileSizeLimit", "readonly", "context"], outputs: ["isDraggingChange", "onChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1206
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityAttachment, isStandalone: true, selector: "mt-entity-attachment", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, endPoint: { classPropertyName: "endPoint", publicName: "endPoint", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"relaxed\"\r\n>\r\n @if (hasAttachments()) {\r\n @if (shape() === \"compact\") {\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @for (\r\n attachment of attachments();\r\n track attachmentTrackBy($index, attachment)\r\n ) {\r\n <mt-button\r\n iconPos=\"top\"\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [icon]=\"attachmentActionIcon($index, attachment)\"\r\n [tooltip]=\"attachmentTooltip(attachment)\"\r\n styleClass=\"h-9! w-9! rounded-lg! transition-all duration-200 hover:scale-105 hover:border-primary-500! hover:text-primary-600! hover:bg-primary-50!\"\r\n (onClick)=\"onCompactAttachmentClick($event, attachment)\"\r\n (mouseenter)=\"\r\n hoveredAttachmentKey.set(attachmentTrackBy($index, attachment))\r\n \"\r\n (mouseleave)=\"hoveredAttachmentKey.set(null)\"\r\n (onFocus)=\"\r\n hoveredAttachmentKey.set(attachmentTrackBy($index, attachment))\r\n \"\r\n (onBlur)=\"hoveredAttachmentKey.set(null)\"\r\n />\r\n }\r\n </div>\r\n } @else {\r\n <mt-upload-field\r\n class=\"w-full\"\r\n [ngModel]=\"uploadValue()\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n [shape]=\"'card'\"\r\n [multiple]=\"isMultiple()\"\r\n [readonly]=\"true\"\r\n [endPoint]=\"endPoint()\"\r\n [accept]=\"acceptTypes()\"\r\n [context]=\"context()\"\r\n />\r\n }\r\n } @else {\r\n <span class=\"text-sm font-semibold\">{{ empty }}</span>\r\n }\r\n</mt-entity-field>\r\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: UploadField, selector: "mt-upload-field", inputs: ["label", "title", "description", "endPoint", "size", "userImgClass", "shape", "multiple", "accept", "isDragging", "fileSizeLimit", "readonly", "context"], outputs: ["isDraggingChange", "onChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1056
1207
|
}
|
|
1057
1208
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityAttachment, decorators: [{
|
|
1058
1209
|
type: Component,
|
|
@@ -1144,11 +1295,11 @@ class EntityConnection {
|
|
|
1144
1295
|
}, ...(ngDevMode ? [{ debugName: "connection" }] : /* istanbul ignore next */ []));
|
|
1145
1296
|
displayValue = computed(() => displayOrPlaceholder(this.connection()?.display), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
1146
1297
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityConnection, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1147
|
-
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 });
|
|
1298
|
+
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\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n>\r\n <div\r\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >\r\n {{ displayValue() }}\r\n </div>\r\n</mt-entity-field>\r\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 });
|
|
1148
1299
|
}
|
|
1149
1300
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityConnection, decorators: [{
|
|
1150
1301
|
type: Component,
|
|
1151
|
-
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" }]
|
|
1302
|
+
args: [{ selector: 'mt-entity-connection', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n>\r\n <div\r\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >\r\n {{ displayValue() }}\r\n </div>\r\n</mt-entity-field>\r\n" }]
|
|
1152
1303
|
}], 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 }] }] } });
|
|
1153
1304
|
function normalizeEntityConnection(value) {
|
|
1154
1305
|
if (value === null || value === undefined || value === '') {
|
|
@@ -1196,13 +1347,15 @@ class EntityScheduleItem {
|
|
|
1196
1347
|
}, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
1197
1348
|
emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;
|
|
1198
1349
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityScheduleItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1199
|
-
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 });
|
|
1350
|
+
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\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (items().length) {\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @for (item of items(); track item.id) {\r\n <mt-chip [label]=\"item.name\" size=\"small\" />\r\n }\r\n </div>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\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 });
|
|
1200
1351
|
}
|
|
1201
1352
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityScheduleItem, decorators: [{
|
|
1202
1353
|
type: Component,
|
|
1203
|
-
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" }]
|
|
1354
|
+
args: [{ selector: 'mt-entity-schedule-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [EntityField, Chip], template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (items().length) {\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @for (item of items(); track item.id) {\r\n <mt-chip [label]=\"item.name\" size=\"small\" />\r\n }\r\n </div>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\n" }]
|
|
1204
1355
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
1205
1356
|
|
|
1357
|
+
/** Neutral grey for a status the catalog left without a colour. */
|
|
1358
|
+
const DEFAULT_STATUS_COLOR = '#9CA3AF';
|
|
1206
1359
|
class EntityLeafDetails {
|
|
1207
1360
|
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1208
1361
|
leafValue = computed(() => {
|
|
@@ -1222,26 +1375,23 @@ class EntityLeafDetails {
|
|
|
1222
1375
|
return `${name} (${total})`;
|
|
1223
1376
|
}, ...(ngDevMode ? [{ debugName: "labelWithTotal" }] : /* istanbul ignore next */ []));
|
|
1224
1377
|
labelIcon = computed(() => this.leafValue()?.levelIcon ?? null, ...(ngDevMode ? [{ debugName: "labelIcon" }] : /* istanbul ignore next */ []));
|
|
1225
|
-
/** Default LeafDetails labels to top, while still honoring saved configuration */
|
|
1226
|
-
fieldConfig = computed(() => {
|
|
1227
|
-
const configuration = this.data().configuration;
|
|
1228
|
-
if (configuration?.labelPosition || configuration?.labelPostion) {
|
|
1229
|
-
return configuration;
|
|
1230
|
-
}
|
|
1231
|
-
return {
|
|
1232
|
-
...configuration,
|
|
1233
|
-
labelPosition: 'top',
|
|
1234
|
-
};
|
|
1235
|
-
}, ...(ngDevMode ? [{ debugName: "fieldConfig" }] : /* istanbul ignore next */ []));
|
|
1236
1378
|
statusColor(color) {
|
|
1237
|
-
return color ??
|
|
1379
|
+
return color ?? DEFAULT_STATUS_COLOR;
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Foreground for the count, chosen against the badge colour instead of always
|
|
1383
|
+
* white — a light catalog colour measured 2.59:1 with white on it, the lowest
|
|
1384
|
+
* contrast in the product (findings M-04, H-03).
|
|
1385
|
+
*/
|
|
1386
|
+
statusTextColor(color) {
|
|
1387
|
+
return readableTextOn(this.statusColor(color));
|
|
1238
1388
|
}
|
|
1239
1389
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityLeafDetails, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1240
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityLeafDetails, isStandalone: true, selector: "mt-entity-leaf-details", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"labelWithTotal()\"\r\n [labelIconName]=\"labelIcon()\"\r\n [configuration]=\"
|
|
1390
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityLeafDetails, isStandalone: true, selector: "mt-entity-leaf-details", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"labelWithTotal()\"\r\n [labelIconName]=\"labelIcon()\"\r\n [configuration]=\"data().configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (leafValue(); as leaf) {\r\n <div class=\"flex flex-wrap gap-1.5\">\r\n @for (status of leaf.statuses; track status.key) {\r\n <!--\r\n The badge is a count, and the colour is the only thing saying WHICH\r\n count \u2014 so the status name has to be reachable without hovering, and\r\n the number has to be legible on whatever hex the tenant's catalog\r\n carries. The tooltip names it for a pointer, the aria-label names it\r\n for a screen reader, and the foreground is chosen against the badge\r\n colour rather than hardcoded white (findings M-04, H-03).\r\n -->\r\n <div\r\n class=\"flex h-7 min-w-7 items-center justify-center rounded-lg px-1.5 text-xs font-bold tabular-nums\"\r\n role=\"img\"\r\n [style.background-color]=\"statusColor(status.color)\"\r\n [style.color]=\"statusTextColor(status.color)\"\r\n [attr.aria-label]=\"status.display + ': ' + status.count\"\r\n [pTooltip]=\"status.display\"\r\n tooltipPosition=\"top\"\r\n >\r\n {{ status.count }}\r\n </div>\r\n }\r\n @if (leaf.statuses.length === 0) {\r\n <span class=\"text-sm text-muted-color\">\u2014</span>\r\n }\r\n </div>\r\n }\r\n</mt-entity-field>\r\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "showOnEllipsis", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip", "pTooltipPT", "pTooltipUnstyled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1241
1391
|
}
|
|
1242
1392
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityLeafDetails, decorators: [{
|
|
1243
1393
|
type: Component,
|
|
1244
|
-
args: [{ selector: 'mt-entity-leaf-details', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, TooltipModule], template: "<mt-entity-field\r\n [label]=\"labelWithTotal()\"\r\n [labelIconName]=\"labelIcon()\"\r\n [configuration]=\"
|
|
1394
|
+
args: [{ selector: 'mt-entity-leaf-details', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, TooltipModule], template: "<mt-entity-field\r\n [label]=\"labelWithTotal()\"\r\n [labelIconName]=\"labelIcon()\"\r\n [configuration]=\"data().configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (leafValue(); as leaf) {\r\n <div class=\"flex flex-wrap gap-1.5\">\r\n @for (status of leaf.statuses; track status.key) {\r\n <!--\r\n The badge is a count, and the colour is the only thing saying WHICH\r\n count \u2014 so the status name has to be reachable without hovering, and\r\n the number has to be legible on whatever hex the tenant's catalog\r\n carries. The tooltip names it for a pointer, the aria-label names it\r\n for a screen reader, and the foreground is chosen against the badge\r\n colour rather than hardcoded white (findings M-04, H-03).\r\n -->\r\n <div\r\n class=\"flex h-7 min-w-7 items-center justify-center rounded-lg px-1.5 text-xs font-bold tabular-nums\"\r\n role=\"img\"\r\n [style.background-color]=\"statusColor(status.color)\"\r\n [style.color]=\"statusTextColor(status.color)\"\r\n [attr.aria-label]=\"status.display + ': ' + status.count\"\r\n [pTooltip]=\"status.display\"\r\n tooltipPosition=\"top\"\r\n >\r\n {{ status.count }}\r\n </div>\r\n }\r\n @if (leaf.statuses.length === 0) {\r\n <span class=\"text-sm text-muted-color\">\u2014</span>\r\n }\r\n </div>\r\n }\r\n</mt-entity-field>\r\n" }]
|
|
1245
1395
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }] } });
|
|
1246
1396
|
|
|
1247
1397
|
/**
|
|
@@ -2029,5 +2179,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
2029
2179
|
* Generated bundle index. Do not edit.
|
|
2030
2180
|
*/
|
|
2031
2181
|
|
|
2032
|
-
export { ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildDisplayEntities, buildSectionKey, expandLeafDetailsEntity, getEntitySectionTitle, groupEntitiesIntoSections, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, matchesPercentageColorRule, resolveLocalizedLabel, resolvePercentageColor };
|
|
2182
|
+
export { CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildDisplayEntities, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, expandLeafDetailsEntity, getEntitySectionTitle, groupEntitiesIntoSections, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, matchesPercentageColorRule, parseCurrencyAmount, resolveLocalizedLabel, resolvePercentageColor };
|
|
2033
2183
|
//# sourceMappingURL=masterteam-components-entities.mjs.map
|