@acorex/platform 21.0.0-next.73 → 21.0.0-next.75

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.
@@ -2,7 +2,7 @@ import { AXToastService } from '@acorex/components/toast';
2
2
  import * as i6 from '@acorex/core/translation';
3
3
  import { AXTranslationService, AXTranslationModule, resolveMultiLanguageString, translateSync } from '@acorex/core/translation';
4
4
  import * as i4$3 from '@acorex/platform/common';
5
- import { AXPNotFoundError, AXPEntityCommandScope, axpNavigateAppPath, AXPSettingsService, AXPCommonSettings, normalizeEntityDisplayTemplate, isUnresolvedEntityDisplayTemplate, AXPFilterOperatorMiddlewareService, isCardFieldBadgeDisplay, resolveCardFieldBadgeColor, getEntityInfo, resolveEnabledMasterListLayouts, resolveDefaultMasterListLayout, AXPRefreshEvent, AXPReloadEvent, axpRedirectToNotFound, AXPCleanNestedFilters, AXPFileTypeProviderService, AXPFileStorageService, buildEntitySearchTitleContext, resolveEntityRowTitleTemplate, AXPFileActionsService, axpIsEntityRecordNotFound, AXPDefaultMultiLanguageConfigService, withDefaultMultiLanguageOnWidgetNodeTree, AXPEntityQueryType, AXPWorkflowNavigateAction, AXP_NOT_FOUND_ROUTE, AXP_PROTECTED_ROUTE_GUARDS, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER, AXPMenuItemsDataSourceDefinition } from '@acorex/platform/common';
5
+ import { AXPNotFoundError, AXPEntityCommandScope, axpNavigateAppPath, AXPSettingsService, AXPCommonSettings, normalizeEntityDisplayTemplate, isUnresolvedEntityDisplayTemplate, AXPFilterOperatorMiddlewareService, isCardFieldBadgeDisplay, resolveCardFieldBadgeColor, getEntityInfo, resolveEnabledMasterListLayouts, resolveDefaultMasterListLayout, AXPRefreshEvent, AXPReloadEvent, axpRedirectToNotFound, ENTITY_ROW_POPUP_TITLE_OPTION, AXPCleanNestedFilters, AXPFileTypeProviderService, AXPFileStorageService, resolveEntityRowDisplayTitle, AXPFileActionsService, axpIsEntityRecordNotFound, AXPDefaultMultiLanguageConfigService, withDefaultMultiLanguageOnWidgetNodeTree, AXPEntityQueryType, buildEntitySearchTitleContext, AXPWorkflowNavigateAction, AXP_NOT_FOUND_ROUTE, AXP_PROTECTED_ROUTE_GUARDS, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER, AXPMenuItemsDataSourceDefinition } from '@acorex/platform/common';
6
6
  import * as i0 from '@angular/core';
7
7
  import { InjectionToken, inject, Injector, runInInjectionContext, Injectable, input, viewChild, signal, computed, ElementRef, ChangeDetectionStrategy, Component, ApplicationRef, EnvironmentInjector, createComponent, NgModule, ChangeDetectorRef, effect, Input, afterNextRender, untracked, ViewEncapsulation, viewChildren, linkedSignal, HostBinding, output, makeEnvironmentProviders } from '@angular/core';
8
8
  import { Subject, takeUntil } from 'rxjs';
@@ -12037,6 +12037,11 @@ var entityDefinitionProviderWidgetEdit_component = /*#__PURE__*/Object.freeze({
12037
12037
  });
12038
12038
 
12039
12039
  //#region ---- Column Mapping Helpers ----
12040
+ function resolveEntityListRowTitleTemplate(entity) {
12041
+ return (entity.interfaces?.master?.single?.title ??
12042
+ entity.formats?.searchResult?.title ??
12043
+ entity.formats?.individual);
12044
+ }
12040
12045
  /**
12041
12046
  * Maps an entity property to a list widget column configuration.
12042
12047
  * Preserves readonly behavior and leverages the property's interface options when available.
@@ -12068,6 +12073,7 @@ function mapPropertyToWidgetColumn(property) {
12068
12073
  */
12069
12074
  function mapEntityColumnToWidgetColumn(entity, column) {
12070
12075
  const property = entity.properties.find((p) => p.name === column.name);
12076
+ const entityRowTitleTemplate = resolveEntityListRowTitleTemplate(entity);
12071
12077
  const interfaceType = property?.schema?.interface?.type;
12072
12078
  const widgetFromProperty = property?.schema?.interface
12073
12079
  ? {
@@ -12077,6 +12083,9 @@ function mapEntityColumnToWidgetColumn(entity, column) {
12077
12083
  readonly: true,
12078
12084
  columnName: column.name,
12079
12085
  ...property.schema.interface.options,
12086
+ ...(entityRowTitleTemplate
12087
+ ? { [ENTITY_ROW_POPUP_TITLE_OPTION]: entityRowTitleTemplate }
12088
+ : {}),
12080
12089
  ...(interfaceType === 'attachments'
12081
12090
  ? {
12082
12091
  entityName: property.schema.interface.options?.['entityName'] ??
@@ -19062,63 +19071,6 @@ function hasFileUploaderTitleOrDescriptionFields(editDialog) {
19062
19071
  }
19063
19072
  //#endregion
19064
19073
 
19065
- //#region ---- Imports ----
19066
- //#endregion
19067
- //#region ---- Title template resolution ----
19068
- const INVALID_DISPLAY_TEXT = '[object Object]';
19069
- /** Resolves a row field or format result to a plain display string for the active locale. */
19070
- function resolveEntityRowDisplayText(value, activeLang) {
19071
- if (value == null || value === '') {
19072
- return '';
19073
- }
19074
- if (typeof value === 'string') {
19075
- const text = value.trim();
19076
- if (!text || text === INVALID_DISPLAY_TEXT || isUnresolvedEntityDisplayTemplate(text)) {
19077
- return '';
19078
- }
19079
- return text;
19080
- }
19081
- if (typeof value === 'number' || typeof value === 'boolean') {
19082
- return String(value);
19083
- }
19084
- if (typeof value === 'object' && !Array.isArray(value)) {
19085
- const text = resolveMultiLanguageString(value, activeLang).trim();
19086
- if (!text || text === INVALID_DISPLAY_TEXT) {
19087
- return '';
19088
- }
19089
- return text;
19090
- }
19091
- return '';
19092
- }
19093
- /**
19094
- * Formats the entity row title for display using entity-driven templates and property paths.
19095
- */
19096
- function formatEntityRowDisplayTitle(entity, rowData, formatService, activeLang) {
19097
- if (!rowData) {
19098
- return '';
19099
- }
19100
- const titleContext = buildEntitySearchTitleContext(entity ?? {});
19101
- for (const path of titleContext.fallbackFields) {
19102
- const fromField = resolveEntityRowDisplayText(get(rowData, path), activeLang);
19103
- if (fromField) {
19104
- return fromField;
19105
- }
19106
- }
19107
- const templates = [
19108
- resolveEntityRowTitleTemplate(entity),
19109
- ...titleContext.fallbackTemplates,
19110
- ].filter((template) => !!template?.trim());
19111
- for (const template of templates) {
19112
- const formatted = formatService.format(normalizeEntityDisplayTemplate(template), 'string', rowData);
19113
- const fromTemplate = resolveEntityRowDisplayText(formatted, activeLang);
19114
- if (fromTemplate) {
19115
- return fromTemplate;
19116
- }
19117
- }
19118
- return '';
19119
- }
19120
- //#endregion
19121
-
19122
19074
  //#region ---- Imports ----
19123
19075
  //#endregion
19124
19076
  //#region ---- Component ----
@@ -19152,21 +19104,16 @@ class AXPFileUploaderWidgetColumnComponent extends AXPColumnWidgetComponent {
19152
19104
  this.popoverTitle = computed(() => {
19153
19105
  const row = this.rowData;
19154
19106
  const lang = this.translation.getActiveLang();
19155
- const titleRaw = get(row, 'title');
19156
- if (titleRaw != null &&
19157
- typeof titleRaw === 'object' &&
19158
- !Array.isArray(titleRaw) &&
19159
- this.translation.isValidMultiLanguageObject(titleRaw)) {
19160
- return titleRaw;
19161
- }
19162
- const resolved = formatEntityRowDisplayTitle(this.entityDef(), row, this.formatService, lang);
19107
+ const resolved = resolveEntityRowDisplayTitle({
19108
+ data: row,
19109
+ widgetOptions: this.options,
19110
+ formatService: this.formatService,
19111
+ activeLang: lang,
19112
+ entity: this.entityDef(),
19113
+ });
19163
19114
  if (resolved) {
19164
19115
  return resolved;
19165
19116
  }
19166
- const fallback = this.entityDef()?.formats?.individual;
19167
- if (fallback != null && fallback !== '') {
19168
- return resolveEntityRowDisplayText(fallback, lang) || fallback;
19169
- }
19170
19117
  return '@document-management:terms.common.file';
19171
19118
  }, ...(ngDevMode ? [{ debugName: "popoverTitle" }] : /* istanbul ignore next */ []));
19172
19119
  effect(() => {