@acorex-platform/module-asset-management-client 0.0.38 → 0.0.48

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.
Files changed (50) hide show
  1. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-rental-history.mjs +15 -0
  2. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-rental-history.mjs.map +1 -1
  3. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-system-assignment.mjs +15 -0
  4. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-system-assignment.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-system-type.mjs +15 -0
  6. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-system-type.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-system.mjs +15 -0
  8. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-system.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-type-section-component.mjs +15 -0
  10. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-type-section-component.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-type-section.mjs +15 -0
  12. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-type-section.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-type.mjs +15 -0
  14. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset-type.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset.mjs +19 -16
  16. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entities-asset.mjs.map +1 -1
  17. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-acorex-platform-module-asset-management-client-contracts-entity-catalog-zq5ishZC.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-acorex-platform-module-asset-management-client-contracts-entity-catalog-BqTxF2sX.mjs} +9 -9
  18. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-acorex-platform-module-asset-management-client-contracts-entity-catalog-zq5ishZC.mjs.map → acorex-platform-module-asset-management-client-contracts-entity-catalog-acorex-platform-module-asset-management-client-contracts-entity-catalog-BqTxF2sX.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-rental-history.entity-CldKruJ6.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-rental-history.entity-M-klzvLG.mjs} +17 -2
  20. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-rental-history.entity-M-klzvLG.mjs.map +1 -0
  21. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-assignment.entity-BVmBaNdk.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-assignment.entity-Bl7tfdX2.mjs} +17 -2
  22. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-assignment.entity-Bl7tfdX2.mjs.map +1 -0
  23. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-type.entity-CXBtrDgS.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-type.entity-Vzxm-Xkl.mjs} +17 -2
  24. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-type.entity-Vzxm-Xkl.mjs.map +1 -0
  25. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system.entity-Bc8WJQff.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system.entity-BPM49QqC.mjs} +17 -2
  26. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system.entity-BPM49QqC.mjs.map +1 -0
  27. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section-component.entity-BJ-kv3eg.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section-component.entity-Bz8SwpFk.mjs} +17 -2
  28. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section-component.entity-Bz8SwpFk.mjs.map +1 -0
  29. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section.entity-Bkgb9pRD.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section.entity-j34Of0mA.mjs} +17 -2
  30. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section.entity-j34Of0mA.mjs.map +1 -0
  31. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type.entity-9gozE1Z0.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type.entity-DWL3Sh0E.mjs} +17 -2
  32. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type.entity-DWL3Sh0E.mjs.map +1 -0
  33. package/fesm2022/{acorex-platform-module-asset-management-client-contracts-entity-catalog-asset.entity-JDs4GpIw.mjs → acorex-platform-module-asset-management-client-contracts-entity-catalog-asset.entity-CTfucn7k.mjs} +21 -18
  34. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset.entity-CTfucn7k.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog.mjs +1 -1
  36. package/fesm2022/acorex-platform-module-asset-management-client-contracts.mjs +21 -1
  37. package/fesm2022/acorex-platform-module-asset-management-client-contracts.mjs.map +1 -1
  38. package/fesm2022/acorex-platform-module-asset-management-client.mjs +92 -66
  39. package/fesm2022/acorex-platform-module-asset-management-client.mjs.map +1 -1
  40. package/package.json +2 -2
  41. package/types/acorex-platform-module-asset-management-client-contracts.d.ts +9 -3
  42. package/types/acorex-platform-module-asset-management-client.d.ts +1 -0
  43. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-rental-history.entity-CldKruJ6.mjs.map +0 -1
  44. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-assignment.entity-BVmBaNdk.mjs.map +0 -1
  45. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system-type.entity-CXBtrDgS.mjs.map +0 -1
  46. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-system.entity-Bc8WJQff.mjs.map +0 -1
  47. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section-component.entity-BJ-kv3eg.mjs.map +0 -1
  48. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type-section.entity-Bkgb9pRD.mjs.map +0 -1
  49. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset-type.entity-9gozE1Z0.mjs.map +0 -1
  50. package/fesm2022/acorex-platform-module-asset-management-client-contracts-entity-catalog-asset.entity-JDs4GpIw.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';
2
2
  import { AXP_MENU_PROVIDER, AXP_SEARCH_PROVIDER, AXP_STATUS_PROVIDERS, AXPSearchCommandProvider, createEntityCommandOptions } from '@acorex-platform/framework-client/common';
3
- import { AXP_MODULE_MANIFEST_PROVIDER, AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, provideLazyProvider, AXP_FEATURE_DEFINITION_PROVIDER, AXPDataGenerator } from '@acorex-platform/framework-client/core';
3
+ import { AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, provideLazyProvider, AXP_FEATURE_DEFINITION_PROVIDER, AXPDataGenerator } from '@acorex-platform/framework-client/core';
4
4
  import { AXP_PAGE_COMPONENT_PROVIDER, AXPStandardSectionItemsBuilderComponent } from '@acorex-platform/framework-client/layout/components';
5
5
  import { AXPMiddlewareAbortError, AXP_ENTITY_STORAGE_MIDDLEWARE, AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
6
6
  import { provideCommand, provideCommandSetups, AXPCommandService } from '@acorex-platform/framework-client/runtime';
@@ -67,26 +67,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
67
67
  type: Injectable
68
68
  }] });
69
69
 
70
- //#region ---- Imports ----
71
- //#endregion
72
- //#region ---- Manifest Definition ----
73
- /**
74
- * Asset Management Module Manifest.
75
- * Defines module metadata, features, and provider references.
76
- */
77
- const AssetManagementManifest = {
78
- name: RootConfig.module.name,
79
- version: '1.0.0',
80
- title: RootConfig.module.title,
81
- icon: RootConfig.module.icon,
82
- i18n: RootConfig.config.i18n,
83
- type: 'domain',
84
- domain: 'asset-maintenance',
85
- required: false,
86
- // Module dependencies (optional)
87
- };
88
- //#endregion
89
-
90
70
  //#region ---- Imports ----
91
71
  //#endregion
92
72
  //#region ---- Asset System Type Has Child Middleware ----
@@ -197,12 +177,6 @@ class AXMAssetManagementModule {
197
177
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAssetManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
198
178
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMAssetManagementModule }); }
199
179
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMAssetManagementModule, providers: [
200
- // Module Manifest Provider
201
- {
202
- provide: AXP_MODULE_MANIFEST_PROVIDER,
203
- useValue: AssetManagementManifest,
204
- multi: true,
205
- },
206
180
  {
207
181
  provide: AXP_CATALOG_SCOPE_DEFINITION_PROVIDER,
208
182
  useClass: AXMAssetManagementCatalogScopeDefinitionProvider,
@@ -251,12 +225,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
251
225
  args: [{
252
226
  imports: [],
253
227
  providers: [
254
- // Module Manifest Provider
255
- {
256
- provide: AXP_MODULE_MANIFEST_PROVIDER,
257
- useValue: AssetManagementManifest,
258
- multi: true,
259
- },
260
228
  {
261
229
  provide: AXP_CATALOG_SCOPE_DEFINITION_PROVIDER,
262
230
  useClass: AXMAssetManagementCatalogScopeDefinitionProvider,
@@ -1024,7 +992,13 @@ class AXMAssetTypeSectionBuilderComponent {
1024
992
  this.linkAssetMode = computed(() => this.options()['linkAssetMode'] === true, /* @ts-ignore */
1025
993
  ...(ngDevMode ? [{ debugName: "linkAssetMode" }] : /* istanbul ignore next */ []));
1026
994
  this.#syncValueToBuilder = effect(() => {
1027
- const normalized = normalizeAssetTypeSectionBuilderValue(this.value(), this.assetTypeId());
995
+ const raw = this.value();
996
+ // In link mode an empty value means "template not loaded yet" — do not invent a default section.
997
+ if (this.linkAssetMode() && (!raw || !Array.isArray(raw.sections) || raw.sections.length === 0)) {
998
+ this.builderValue.set({ sections: [] });
999
+ return;
1000
+ }
1001
+ const normalized = normalizeAssetTypeSectionBuilderValue(raw, this.assetTypeId());
1028
1002
  this.builderValue.set(this.toBuilderValue(normalized));
1029
1003
  }, /* @ts-ignore */
1030
1004
  ...(ngDevMode ? [{ debugName: "#syncValueToBuilder" }] : /* istanbul ignore next */ []));
@@ -1251,9 +1225,10 @@ class AXMAssetTypeSectionBuilderComponent {
1251
1225
  };
1252
1226
  }
1253
1227
  async promptEditLinkedAssetItem(item, _sectionId, _value) {
1228
+ const assetTypeId = this.resolveLinkedItemAssetTypeId(item);
1254
1229
  const seed = {
1255
1230
  assetId: String(item['assetId'] ?? ''),
1256
- assetTypeId: String(item['assetTypeId'] ?? '').trim(),
1231
+ assetTypeId,
1257
1232
  asset: item['asset'] ?? {
1258
1233
  id: '',
1259
1234
  code: '',
@@ -1270,6 +1245,17 @@ class AXMAssetTypeSectionBuilderComponent {
1270
1245
  asset: result.assetId ? result.asset : undefined,
1271
1246
  };
1272
1247
  }
1248
+ resolveLinkedItemAssetTypeId(item) {
1249
+ const fromField = typeof item['assetTypeId'] === 'string' ? item['assetTypeId'].trim() : '';
1250
+ if (fromField) {
1251
+ return fromField;
1252
+ }
1253
+ const nested = item['assetType'];
1254
+ if (nested && typeof nested.id === 'string' && nested.id.trim()) {
1255
+ return nested.id.trim();
1256
+ }
1257
+ return '';
1258
+ }
1273
1259
  async promptLinkAssetForm(seed) {
1274
1260
  const title = (await this.translationService.translateAsync('@asset-management:assets.entities.asset.components.asset-component.actions.edit.title')) || 'Edit Component Asset';
1275
1261
  const result = await this.layoutBuilder
@@ -1282,7 +1268,7 @@ class AXMAssetTypeSectionBuilderComponent {
1282
1268
  .setContext({ ...seed })
1283
1269
  .content((layout) => {
1284
1270
  layout.mode('edit');
1285
- layout.dynamicForm(this.buildLinkAssetFormDefinition());
1271
+ layout.dynamicForm(this.buildLinkAssetFormDefinition(seed.assetTypeId));
1286
1272
  })
1287
1273
  .setActions((actions) => {
1288
1274
  actions.cancel('@general:actions.cancel.title').submit('@general:actions.save.title');
@@ -1296,7 +1282,7 @@ class AXMAssetTypeSectionBuilderComponent {
1296
1282
  const asset = context.asset ?? { id: assetId, code: '', title: '' };
1297
1283
  return { success: true, kind: 'object', value: {
1298
1284
  assetId,
1299
- assetTypeId: String(context.assetTypeId ?? ''),
1285
+ assetTypeId: String(context.assetTypeId ?? seed.assetTypeId ?? ''),
1300
1286
  asset: {
1301
1287
  id: String(asset.id ?? assetId),
1302
1288
  code: String(asset.code ?? ''),
@@ -1512,8 +1498,11 @@ class AXMAssetTypeSectionBuilderComponent {
1512
1498
  };
1513
1499
  return { groups: [group] };
1514
1500
  }
1515
- buildLinkAssetFormDefinition() {
1501
+ buildLinkAssetFormDefinition(requiredAssetTypeId) {
1516
1502
  const currentAssetId = this.options()['mainAssetId'];
1503
+ const assetTypeFilterValue = typeof requiredAssetTypeId === 'string' && requiredAssetTypeId.trim()
1504
+ ? requiredAssetTypeId.trim()
1505
+ : "{{ context.eval('assetTypeId') }}";
1517
1506
  const filters = [
1518
1507
  ...(typeof currentAssetId === 'string' && currentAssetId
1519
1508
  ? [{ field: 'id', operator: { type: 'notEqual' }, value: currentAssetId }]
@@ -1521,7 +1510,7 @@ class AXMAssetTypeSectionBuilderComponent {
1521
1510
  {
1522
1511
  field: 'assetTypeId',
1523
1512
  operator: { type: 'equal' },
1524
- value: "{{ context.eval('assetTypeId') }}",
1513
+ value: assetTypeFilterValue,
1525
1514
  },
1526
1515
  ];
1527
1516
  const group = {
@@ -1817,8 +1806,19 @@ class AXMAssetTypeSectionBuilderPageComponent extends AXPPageLayoutBaseComponent
1817
1806
  this.context = computed(() => this.rootContext(), /* @ts-ignore */
1818
1807
  ...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
1819
1808
  this.sourceRecordId = computed(() => {
1820
- const id = get(this.context(), this.sourceIdPath());
1821
- return typeof id === 'string' ? id : undefined;
1809
+ const ctx = this.context();
1810
+ const id = get(ctx, this.sourceIdPath());
1811
+ if (typeof id === 'string' && id.length > 0) {
1812
+ return id;
1813
+ }
1814
+ // Lookup expose often hydrates nested `assetType.id` before/without top-level assetTypeId.
1815
+ if (this.sourceIdPath() === 'assetTypeId') {
1816
+ const nested = get(ctx, 'assetType.id');
1817
+ if (typeof nested === 'string' && nested.length > 0) {
1818
+ return nested;
1819
+ }
1820
+ }
1821
+ return undefined;
1822
1822
  }, /* @ts-ignore */
1823
1823
  ...(ngDevMode ? [{ debugName: "sourceRecordId" }] : /* istanbul ignore next */ []));
1824
1824
  this.targetRecordId = computed(() => {
@@ -1858,27 +1858,60 @@ class AXMAssetTypeSectionBuilderPageComponent extends AXPPageLayoutBaseComponent
1858
1858
  this.#syncFromContext = effect((onCleanup) => {
1859
1859
  const ctx = this.context();
1860
1860
  const id = this.sourceRecordId();
1861
- const value = get(ctx, this.fieldName());
1862
- const linkedFromContext = get(ctx, this.fieldName());
1863
- const sourceValue = get(ctx, this.sourceFieldName());
1861
+ const linkMode = this.linkAssetMode();
1862
+ const fieldName = this.fieldName();
1864
1863
  const sourceField = this.sourceFieldName();
1865
- const immediateValue = this.linkAssetMode()
1866
- ? this.buildLinkedAssetValue(sourceValue ?? null, this.pickPersistedComponentLinks(linkedFromContext, undefined))
1867
- : (value ?? null);
1868
- this.baselineValue.set(immediateValue);
1869
- this.committedValue.set(immediateValue);
1870
- untracked(() => this.recompute());
1864
+ const value = get(ctx, fieldName);
1865
+ const linkedFromContext = get(ctx, fieldName);
1866
+ if (!linkMode) {
1867
+ const immediateValue = (value ?? null);
1868
+ this.baselineValue.set(immediateValue);
1869
+ this.committedValue.set(immediateValue);
1870
+ untracked(() => this.recompute());
1871
+ if (!id) {
1872
+ return;
1873
+ }
1874
+ let cancelled = false;
1875
+ const sourceEntityRef = this.sourceEntityRef();
1876
+ const load = async () => {
1877
+ try {
1878
+ const sourceRecord = await this.entityService.withEntity(sourceEntityRef).data().byKey(id);
1879
+ if (cancelled)
1880
+ return;
1881
+ const fallbackValue = get(sourceRecord, sourceField);
1882
+ const resolved = this.hasSections(value) ? value : (fallbackValue ?? null);
1883
+ this.baselineValue.set(resolved);
1884
+ this.committedValue.set(resolved);
1885
+ untracked(() => this.recompute());
1886
+ }
1887
+ catch {
1888
+ if (cancelled)
1889
+ return;
1890
+ this.baselineValue.set(immediateValue);
1891
+ this.committedValue.set(immediateValue);
1892
+ untracked(() => this.recompute());
1893
+ }
1894
+ };
1895
+ void load();
1896
+ onCleanup(() => {
1897
+ cancelled = true;
1898
+ });
1899
+ return;
1900
+ }
1901
+ // ----- linkAssetMode: template from source entity (AssetType), links on target (Asset) -----
1902
+ // Never use target context's `components` (or empty defaults) as the structure template.
1871
1903
  if (!id) {
1904
+ const empty = this.buildLinkedAssetValue(null, this.pickPersistedComponentLinks(linkedFromContext, undefined));
1905
+ this.baselineValue.set(empty);
1906
+ this.committedValue.set(empty);
1907
+ untracked(() => this.recompute());
1872
1908
  return;
1873
1909
  }
1874
1910
  let cancelled = false;
1875
1911
  const sourceEntityRef = this.sourceEntityRef();
1876
1912
  const targetEntityRef = this.targetEntityRef();
1877
1913
  const targetRecordId = this.targetRecordId();
1878
- const linkMode = this.linkAssetMode();
1879
- const fieldName = this.fieldName();
1880
- const shouldFetchPersistedLinksFromTarget = linkMode &&
1881
- typeof targetRecordId === 'string' &&
1914
+ const shouldFetchPersistedLinksFromTarget = typeof targetRecordId === 'string' &&
1882
1915
  targetRecordId.length > 0 &&
1883
1916
  targetEntityRef !== sourceEntityRef;
1884
1917
  const load = async () => {
@@ -1891,17 +1924,11 @@ class AXMAssetTypeSectionBuilderPageComponent extends AXPPageLayoutBaseComponent
1891
1924
  ]);
1892
1925
  if (cancelled)
1893
1926
  return;
1894
- const fallbackValue = get(sourceRecord, sourceField);
1895
- const recordLinksUnknown = linkMode && shouldFetchPersistedLinksFromTarget
1927
+ const template = get(sourceRecord, sourceField);
1928
+ const recordLinksUnknown = shouldFetchPersistedLinksFromTarget
1896
1929
  ? get(targetRecord, fieldName)
1897
- : linkMode
1898
- ? get(sourceRecord, fieldName)
1899
- : undefined;
1900
- const resolved = linkMode
1901
- ? this.buildLinkedAssetValue(sourceValue ?? fallbackValue ?? null, this.pickPersistedComponentLinks(linkedFromContext, recordLinksUnknown))
1902
- : this.hasSections(value)
1903
- ? value
1904
- : (fallbackValue ?? null);
1930
+ : get(sourceRecord, fieldName);
1931
+ const resolved = this.buildLinkedAssetValue(this.hasSections(template) ? (template ?? null) : null, this.pickPersistedComponentLinks(linkedFromContext, recordLinksUnknown));
1905
1932
  this.baselineValue.set(resolved);
1906
1933
  this.committedValue.set(resolved);
1907
1934
  untracked(() => this.recompute());
@@ -1909,8 +1936,7 @@ class AXMAssetTypeSectionBuilderPageComponent extends AXPPageLayoutBaseComponent
1909
1936
  catch {
1910
1937
  if (cancelled)
1911
1938
  return;
1912
- this.baselineValue.set(immediateValue);
1913
- this.committedValue.set(immediateValue);
1939
+ // Keep whatever is already shown; do not wipe with an empty target-context template.
1914
1940
  untracked(() => this.recompute());
1915
1941
  }
1916
1942
  };