@masterteam/components 0.0.310 → 0.0.312

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.
@@ -239,6 +239,69 @@ function normalizeNumerals(input) {
239
239
  .replace(/[٬  ]/g, '');
240
240
  }
241
241
 
242
+ const INTERNAL_NAME_KEY = 'internal_username';
243
+ const EXTERNAL_NAME_KEY = 'external_username';
244
+ function matchesKey(field, key) {
245
+ return field.normalizedKey === key || field.key === key;
246
+ }
247
+ /** Keep the name slot's identity/layout, and use the populated name's renderer. */
248
+ function projectName(internal, external) {
249
+ const isEmptyUser = internal.viewType === 'User' &&
250
+ internal.value != null &&
251
+ typeof internal.value === 'object' &&
252
+ !internal.value.userName?.trim();
253
+ if (internal.value != null && internal.value !== '' && !isEmptyUser) {
254
+ return internal;
255
+ }
256
+ if (external.value == null || external.value === '')
257
+ return internal;
258
+ return {
259
+ ...internal,
260
+ rawValue: external.rawValue,
261
+ value: external.value,
262
+ viewType: external.viewType,
263
+ type: external.type,
264
+ propertyConfiguration: external.propertyConfiguration,
265
+ nestedProperties: external.nestedProperties,
266
+ comparison: external.comparison,
267
+ color: external.color,
268
+ };
269
+ }
270
+ /** Stakeholder cards show the two mutually exclusive names in one name slot. */
271
+ function mergeStakeholderNameEntities(entities) {
272
+ const internal = entities.find((entity) => matchesKey(entity, INTERNAL_NAME_KEY));
273
+ const external = entities.find((entity) => matchesKey(entity, EXTERNAL_NAME_KEY));
274
+ if (!internal || !external)
275
+ return entities;
276
+ const name = projectName(internal, external);
277
+ return entities.flatMap((entity) => entity === external ? [] : [entity === internal ? name : entity]);
278
+ }
279
+ /** Hide the duplicate only when both stakeholder name fields are displayed. */
280
+ function mergeStakeholderNameColumns(columns) {
281
+ if (!columns.some((column) => matchesKey(column, INTERNAL_NAME_KEY))) {
282
+ return columns;
283
+ }
284
+ if (!columns.some((column) => matchesKey(column, EXTERNAL_NAME_KEY))) {
285
+ return columns;
286
+ }
287
+ return columns.filter((column) => !matchesKey(column, EXTERNAL_NAME_KEY));
288
+ }
289
+ /** Presentation only: retain the original cells and row edit/submission maps. */
290
+ function mergeStakeholderNameRows(columns, rows) {
291
+ const internal = columns.find((column) => matchesKey(column, INTERNAL_NAME_KEY));
292
+ const external = columns.find((column) => matchesKey(column, EXTERNAL_NAME_KEY));
293
+ if (!internal || !external)
294
+ return rows;
295
+ return rows.map((row) => {
296
+ const internalCell = row[internal.key];
297
+ const externalCell = row[external.key];
298
+ if (!internalCell || !externalCell)
299
+ return row;
300
+ const name = projectName(internalCell, externalCell);
301
+ return name === internalCell ? row : { ...row, [internal.key]: name };
302
+ });
303
+ }
304
+
242
305
  /**
243
306
  * Publishes an `EntityRuntimeContext` to a subtree of entity renderers.
244
307
  *
@@ -2535,11 +2598,11 @@ class EntityListPreview {
2535
2598
  });
2536
2599
  }
2537
2600
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
2538
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListPreview, isStandalone: true, selector: "mt-entity-list-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"label()\"\r\n [configuration]=\"data().configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (tableHost(); as host) {\r\n <!--\r\n The related records, rendered in full by the read-only\r\n `mt-entity-list-field`. It owns the metadata request, the access notices\r\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\r\n arrives through an outlet rather than an import.\r\n -->\r\n <ng-container\r\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\r\n ></ng-container>\r\n } @else if (showTrigger()) {\r\n <!--\r\n The count carries the information; the button carries the affordance.\r\n `mt-button` owns the tooltip and the accessible name, so the trigger is\r\n one element rather than a button wrapped in a tooltip host. A Related\r\n list opened as a table says \"View\" instead of a count; see\r\n `triggerLabel`.\r\n -->\r\n <mt-button\r\n icon=\"general.eye\"\r\n [label]=\"triggerLabel()\"\r\n [tooltip]=\"tooltip()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n variant=\"text\"\r\n size=\"small\"\r\n styleClass=\"!px-2 !py-1 !gap-1\"\r\n (onClick)=\"openDrawer()\"\r\n />\r\n } @else {\r\n <span\r\n class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\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: 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: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2601
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListPreview, isStandalone: true, selector: "mt-entity-list-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"label()\"\r\n [configuration]=\"data().configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (tableHost(); as host) {\r\n <!--\r\n The related records, rendered in full by the read-only\r\n `mt-entity-list-field`. It owns the metadata request, the access notices\r\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\r\n arrives through an outlet rather than an import.\r\n -->\r\n <ng-container\r\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\r\n ></ng-container>\r\n } @else if (showTrigger()) {\r\n <!--\r\n The count carries the information; the button carries the affordance.\r\n `mt-button` owns the tooltip and the accessible name, so the trigger is\r\n one element rather than a button wrapped in a tooltip host. A Related\r\n list opened as a table says \"View\" instead of a count; see\r\n `triggerLabel`.\r\n\r\n `w-fit`: the `mt-button` host is a block-level grid, so in a cell it\r\n spans the full width and so does the `p-button` the tooltip anchors to \u2014\r\n the tooltip centred over the cell, not over the button.\r\n -->\r\n <mt-button\r\n class=\"w-fit\"\r\n icon=\"general.eye\"\r\n [label]=\"triggerLabel()\"\r\n [tooltip]=\"tooltip()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n variant=\"text\"\r\n size=\"small\"\r\n styleClass=\"!px-2 !py-1 !gap-1\"\r\n (onClick)=\"openDrawer()\"\r\n />\r\n } @else {\r\n <span\r\n class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\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: 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: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2539
2602
  }
2540
2603
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListPreview, decorators: [{
2541
2604
  type: Component,
2542
- args: [{ selector: 'mt-entity-list-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, Button, NgComponentOutlet], template: "<mt-entity-field\r\n [label]=\"label()\"\r\n [configuration]=\"data().configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (tableHost(); as host) {\r\n <!--\r\n The related records, rendered in full by the read-only\r\n `mt-entity-list-field`. It owns the metadata request, the access notices\r\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\r\n arrives through an outlet rather than an import.\r\n -->\r\n <ng-container\r\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\r\n ></ng-container>\r\n } @else if (showTrigger()) {\r\n <!--\r\n The count carries the information; the button carries the affordance.\r\n `mt-button` owns the tooltip and the accessible name, so the trigger is\r\n one element rather than a button wrapped in a tooltip host. A Related\r\n list opened as a table says \"View\" instead of a count; see\r\n `triggerLabel`.\r\n -->\r\n <mt-button\r\n icon=\"general.eye\"\r\n [label]=\"triggerLabel()\"\r\n [tooltip]=\"tooltip()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n variant=\"text\"\r\n size=\"small\"\r\n styleClass=\"!px-2 !py-1 !gap-1\"\r\n (onClick)=\"openDrawer()\"\r\n />\r\n } @else {\r\n <span\r\n class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\n" }]
2605
+ args: [{ selector: 'mt-entity-list-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [EntityField, Button, NgComponentOutlet], template: "<mt-entity-field\r\n [label]=\"label()\"\r\n [configuration]=\"data().configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (tableHost(); as host) {\r\n <!--\r\n The related records, rendered in full by the read-only\r\n `mt-entity-list-field`. It owns the metadata request, the access notices\r\n and the column projection \u2014 see `ENTITY_LIST_TABLE_COMPONENT` for why it\r\n arrives through an outlet rather than an import.\r\n -->\r\n <ng-container\r\n *ngComponentOutlet=\"host.component; inputs: host.inputs\"\r\n ></ng-container>\r\n } @else if (showTrigger()) {\r\n <!--\r\n The count carries the information; the button carries the affordance.\r\n `mt-button` owns the tooltip and the accessible name, so the trigger is\r\n one element rather than a button wrapped in a tooltip host. A Related\r\n list opened as a table says \"View\" instead of a count; see\r\n `triggerLabel`.\r\n\r\n `w-fit`: the `mt-button` host is a block-level grid, so in a cell it\r\n spans the full width and so does the `p-button` the tooltip anchors to \u2014\r\n the tooltip centred over the cell, not over the button.\r\n -->\r\n <mt-button\r\n class=\"w-fit\"\r\n icon=\"general.eye\"\r\n [label]=\"triggerLabel()\"\r\n [tooltip]=\"tooltip()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n variant=\"text\"\r\n size=\"small\"\r\n styleClass=\"!px-2 !py-1 !gap-1\"\r\n (onClick)=\"openDrawer()\"\r\n />\r\n } @else {\r\n <span\r\n class=\"inline-flex w-fit items-center rounded-md bg-surface-100 px-3 py-2 text-xs font-semibold text-muted-color\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\n" }]
2543
2606
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }] } });
2544
2607
 
2545
2608
  /**
@@ -3577,5 +3640,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
3577
3640
  * Generated bundle index. Do not edit.
3578
3641
  */
3579
3642
 
3580
- export { CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, ENTITY_LIST_TABLE_COMPONENT, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityRuntimeContextStore, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, humanizeEntityListKey, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntityListLocalDocument, isEntityListSelectionDocument, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, localCellsByFieldId, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, readEntityValueColor, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalFieldConfiguration, resolveLocalFieldLabel, resolveLocalFieldViewType, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, sharedActiveLang, sortLocalRows, splitConnectionKey, splitLeafKey, summarizeEntityListRows, visibleLocalSchemaFields };
3643
+ export { CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, ENTITY_LIST_TABLE_COMPONENT, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityRuntimeContextStore, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, humanizeEntityListKey, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntityListLocalDocument, isEntityListSelectionDocument, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, localCellsByFieldId, matchesPercentageColorRule, mergeStakeholderNameColumns, mergeStakeholderNameEntities, mergeStakeholderNameRows, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, readEntityValueColor, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalFieldConfiguration, resolveLocalFieldLabel, resolveLocalFieldViewType, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, sharedActiveLang, sortLocalRows, splitConnectionKey, splitLeafKey, summarizeEntityListRows, visibleLocalSchemaFields };
3581
3644
  //# sourceMappingURL=masterteam-components-entities.mjs.map