@masterteam/components 0.0.267 → 0.0.268
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/fesm2022/masterteam-components-business-fields.mjs +5 -7
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +6 -8
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-color-picker-field.mjs +6 -8
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +6 -8
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-editor-field.mjs +6 -8
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +3 -62
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs +2 -8
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-icon-field.mjs +6 -8
- package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs +6 -8
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-multi-select-field.mjs +6 -8
- package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-number-field.mjs +6 -8
- package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs +6 -8
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-cards-field.mjs +6 -8
- package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +5 -7
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-slider-field.mjs +5 -9
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-text-field.mjs +6 -8
- package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs +6 -8
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-upload-field.mjs +5 -7
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-user-search-field.mjs +6 -8
- package/fesm2022/masterteam-components-user-search-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +35 -29
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +2 -4
- package/types/masterteam-components-checkbox-field.d.ts +2 -4
- package/types/masterteam-components-color-picker-field.d.ts +2 -4
- package/types/masterteam-components-date-field.d.ts +2 -4
- package/types/masterteam-components-editor-field.d.ts +2 -4
- package/types/masterteam-components-entities.d.ts +0 -14
- package/types/masterteam-components-icon-field.d.ts +2 -4
- package/types/masterteam-components-location-field.d.ts +2 -4
- package/types/masterteam-components-multi-select-field.d.ts +2 -4
- package/types/masterteam-components-number-field.d.ts +2 -4
- package/types/masterteam-components-pick-list-field.d.ts +2 -4
- package/types/masterteam-components-radio-cards-field.d.ts +2 -4
- package/types/masterteam-components-select-field.d.ts +2 -4
- package/types/masterteam-components-slider-field.d.ts +2 -2
- package/types/masterteam-components-text-field.d.ts +2 -4
- package/types/masterteam-components-textarea-field.d.ts +2 -4
- package/types/masterteam-components-upload-field.d.ts +2 -4
- package/types/masterteam-components-user-search-field.d.ts +2 -4
- package/types/masterteam-components.d.ts +33 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, ChangeDetectionStrategy, Component, signal, effect, untracked, inject,
|
|
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
5
|
import { MTDateFormatPipe, REQUEST_CONTEXT, readableTextOn } from '@masterteam/components';
|
|
@@ -1851,34 +1851,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1851
1851
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
|
|
1852
1852
|
|
|
1853
1853
|
const EMPTY_KEY_SET = new Set();
|
|
1854
|
-
/**
|
|
1855
|
-
* Below this host width a field narrower than {@link MIN_NARROW_SPAN} cannot
|
|
1856
|
-
* hold its own value. Matches the container query in the stylesheet, which
|
|
1857
|
-
* handles the `stackOnNarrow` case the same way.
|
|
1858
|
-
*/
|
|
1859
|
-
const NARROW_HOST_WIDTH = 400;
|
|
1860
|
-
/**
|
|
1861
|
-
* The smallest share of the 24-column grid a field may take on a narrow host —
|
|
1862
|
-
* half the row.
|
|
1863
|
-
*
|
|
1864
|
-
* A card that opts out of the soft stack still laid its fields on 24 columns,
|
|
1865
|
-
* so a three-field row inside a ~350px card gave each field about 90px, and at
|
|
1866
|
-
* that width a budget rendered "10,000 S…" and a date "01/07/2…" — finding H-06
|
|
1867
|
-
* in its narrowest form, and the reviewer was explicit that a date must never
|
|
1868
|
-
* be truncated. Raising the floor to half the row is done here rather than in
|
|
1869
|
-
* CSS because the grid cannot be re-tracked safely: a field configured `span 24`
|
|
1870
|
-
* would spill into implicit columns and collapse the explicit ones to zero.
|
|
1871
|
-
*/
|
|
1872
|
-
const MIN_NARROW_SPAN = 12;
|
|
1873
1854
|
/** Classes every entity slot carries, before its per-slot modifiers. */
|
|
1874
1855
|
const SLOT_BASE_CLASS = 'min-w-0 overflow-hidden flex items-center rounded transition-colors';
|
|
1875
1856
|
/** Opt-in dashed frame (`configuration.showBorder`). */
|
|
1876
1857
|
const SLOT_BORDER_CLASS = 'border p-3 border-dashed border-gray-200 rounded-lg';
|
|
1877
1858
|
class EntitiesPreview {
|
|
1878
1859
|
transloco = inject(TranslocoService);
|
|
1879
|
-
elementRef = inject(ElementRef);
|
|
1880
|
-
destroyRef = inject(DestroyRef);
|
|
1881
|
-
zone = inject(NgZone);
|
|
1882
1860
|
/** Array of entity data to display */
|
|
1883
1861
|
entities = input.required(...(ngDevMode ? [{ debugName: "entities" }] : /* istanbul ignore next */ []));
|
|
1884
1862
|
attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
|
|
@@ -1944,7 +1922,6 @@ class EntitiesPreview {
|
|
|
1944
1922
|
const clickableTooltip = this.clickableTooltip();
|
|
1945
1923
|
const activeTooltip = this.activeTooltip();
|
|
1946
1924
|
const lang = this.activeLang();
|
|
1947
|
-
const narrow = this.isNarrowHost();
|
|
1948
1925
|
return this.sectionGroups().map((group, groupIndex) => ({
|
|
1949
1926
|
trackKey: group.section?.key ?? `__group__${groupIndex}`,
|
|
1950
1927
|
boxed: !!group.section,
|
|
@@ -1957,7 +1934,7 @@ class EntitiesPreview {
|
|
|
1957
1934
|
entity,
|
|
1958
1935
|
trackKey: entity.key ?? String(entity.order ?? entityIndex),
|
|
1959
1936
|
containerClass: buildSlotClass(entity, clickable, active),
|
|
1960
|
-
colSpan: `span ${
|
|
1937
|
+
colSpan: `span ${(entity.configuration?.size ?? 8)}`,
|
|
1961
1938
|
clickable,
|
|
1962
1939
|
rowClickIgnore: clickable ? 'true' : null,
|
|
1963
1940
|
title: clickable ? (active ? activeTooltip : clickableTooltip) : null,
|
|
@@ -1965,34 +1942,6 @@ class EntitiesPreview {
|
|
|
1965
1942
|
}),
|
|
1966
1943
|
}));
|
|
1967
1944
|
}, ...(ngDevMode ? [{ debugName: "slotGroups" }] : /* istanbul ignore next */ []));
|
|
1968
|
-
/**
|
|
1969
|
-
* Whether the host is too narrow for the 24-column grid to stay legible.
|
|
1970
|
-
*
|
|
1971
|
-
* Measured rather than assumed: this component is narrow because of the
|
|
1972
|
-
* column layout it sits in, not because of the viewport, so a media query
|
|
1973
|
-
* would answer the wrong question — the same reason the stylesheet uses a
|
|
1974
|
-
* container query.
|
|
1975
|
-
*/
|
|
1976
|
-
hostWidth = signal(Number.POSITIVE_INFINITY, ...(ngDevMode ? [{ debugName: "hostWidth" }] : /* istanbul ignore next */ []));
|
|
1977
|
-
isNarrowHost = computed(() => this.hostWidth() <= NARROW_HOST_WIDTH, ...(ngDevMode ? [{ debugName: "isNarrowHost" }] : /* istanbul ignore next */ []));
|
|
1978
|
-
constructor() {
|
|
1979
|
-
if (typeof ResizeObserver === 'undefined') {
|
|
1980
|
-
return;
|
|
1981
|
-
}
|
|
1982
|
-
const element = this.elementRef.nativeElement;
|
|
1983
|
-
// `ResizeObserver` callbacks fire outside Angular's zone, so writing the
|
|
1984
|
-
// signal there marks this component dirty but schedules nothing to act on
|
|
1985
|
-
// it. Running the write inside the zone is what makes the re-render happen
|
|
1986
|
-
// (and is a no-op passthrough in a zoneless host).
|
|
1987
|
-
const observer = new ResizeObserver((entries) => {
|
|
1988
|
-
const width = entries[0]?.contentRect.width;
|
|
1989
|
-
if (typeof width === 'number' && width > 0) {
|
|
1990
|
-
this.zone.run(() => this.hostWidth.set(width));
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
|
-
observer.observe(element);
|
|
1994
|
-
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
1995
|
-
}
|
|
1996
1945
|
onSlotClick(source, slot) {
|
|
1997
1946
|
if (!slot.clickable)
|
|
1998
1947
|
return;
|
|
@@ -2012,15 +1961,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
2012
1961
|
class: 'block min-w-0 w-full',
|
|
2013
1962
|
'[class.mt-entities-stack-narrow]': 'stackOnNarrow()',
|
|
2014
1963
|
}, template: "<div class=\"flex flex-col gap-4\">\r\n @for (group of slotGroups(); track group.trackKey) {\r\n @if (group.boxed) {\r\n <!-- Titled section box (matches the client-form section view) -->\r\n <div\r\n class=\"flex flex-col gap-0 overflow-hidden rounded-md border border-surface-200 bg-surface-0\"\r\n >\r\n @if (group.title) {\r\n <h3\r\n class=\"m-0 border-b border-surface-200 bg-surface-50 px-4 py-3 text-lg font-semibold text-color\"\r\n dir=\"auto\"\r\n >\r\n {{ group.title }}\r\n </h3>\r\n }\r\n <div class=\"p-4\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n </div>\r\n </div>\r\n } @else {\r\n <ng-container\r\n [ngTemplateOutlet]=\"entityGrid\"\r\n [ngTemplateOutletContext]=\"{ $implicit: group.slots }\"\r\n />\r\n }\r\n }\r\n</div>\r\n\r\n<!--\r\n Every binding here reads a value the component already resolved into the slot\r\n (see `EntitiesPreview.slotGroups`). Keep it that way: this template runs once\r\n per entity per change detection pass, and a card grid renders thousands of\r\n them, so a method call or a fresh object literal in this block is measurably\r\n expensive.\r\n-->\r\n<ng-template #entityGrid let-slots>\r\n <div class=\"mt-entities-grid grid grid-cols-24 gap-x-3 gap-y-5\">\r\n @for (slot of slots; track slot.trackKey) {\r\n <div\r\n [class]=\"slot.containerClass\"\r\n [attr.data-row-click-ignore]=\"slot.rowClickIgnore\"\r\n [attr.title]=\"slot.title\"\r\n [style.grid-column]=\"slot.colSpan\"\r\n (click)=\"onSlotClick($event, slot)\"\r\n >\r\n <mt-entity-preview\r\n [data]=\"slot.entity\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [":host{container-type:inline-size}@container (max-width: 400px){:host(.mt-entities-stack-narrow) .mt-entities-grid{grid-template-columns:1fr;column-gap:0}:host(.mt-entities-stack-narrow) .mt-entities-grid>*{grid-column:1 / -1!important}}@container (max-width: 280px){.mt-entities-grid{grid-template-columns:1fr;column-gap:0}.mt-entities-grid>*{grid-column:1 / -1!important}}.mt-entity-filterable{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-in!important}.mt-entity-filter-active{cursor:url(\"data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2314b8a6' stroke='%2314b8a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 3H2l8 9.46V19l4 2v-8.54L22 3z'/%3E%3C/svg%3E\") 7 3,zoom-out!important}.mt-entity-filterable:hover{background-color:#ccfbf147;outline:1px dashed rgb(20 184 166 / .28);outline-offset:2px}.mt-entity-filter-active{background-color:#ccfbf14d;box-shadow:inset 0 0 0 1.5px #14b8a666,0 0 0 1px #ffffff80}\n"] }]
|
|
2015
|
-
}],
|
|
2016
|
-
/**
|
|
2017
|
-
* The column span a field renders at: its configured size, floored to half the
|
|
2018
|
-
* row once the host is too narrow for that size to hold the value.
|
|
2019
|
-
*/
|
|
2020
|
-
function resolveSpan(entity, narrow) {
|
|
2021
|
-
const size = (entity.configuration?.size ?? 8);
|
|
2022
|
-
return narrow && size < MIN_NARROW_SPAN ? MIN_NARROW_SPAN : size;
|
|
2023
|
-
}
|
|
1964
|
+
}], propDecorators: { entities: [{ type: i0.Input, args: [{ isSignal: true, alias: "entities", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }], stackOnNarrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackOnNarrow", required: false }] }], clickableKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableKeys", required: false }] }], activeKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeKeys", required: false }] }], clickableTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickableTooltip", required: false }] }], activeTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTooltip", required: false }] }], entityClick: [{ type: i0.Output, args: ["entityClick"] }] } });
|
|
2024
1965
|
/** Stable key resolution shared with the host — must agree on order. */
|
|
2025
1966
|
function resolveEntityKey(entity) {
|
|
2026
1967
|
return entity.key || entity.normalizedKey || entity.name || '';
|