@acorex/modules 20.7.16 → 20.7.17

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 (32) hide show
  1. package/business-core/index.d.ts +39 -2
  2. package/contact-core/index.d.ts +1 -7
  3. package/customer-management/index.d.ts +1 -27
  4. package/data-management/index.d.ts +17 -4
  5. package/fesm2022/acorex-modules-business-core.mjs +316 -4
  6. package/fesm2022/acorex-modules-business-core.mjs.map +1 -1
  7. package/fesm2022/{acorex-modules-contact-core-emergency-service.entity-Cro3bM4G.mjs → acorex-modules-contact-core-emergency-service.entity-l8rYNqP1.mjs} +2 -1
  8. package/fesm2022/acorex-modules-contact-core-emergency-service.entity-l8rYNqP1.mjs.map +1 -0
  9. package/fesm2022/acorex-modules-contact-core.mjs +6 -47
  10. package/fesm2022/acorex-modules-contact-core.mjs.map +1 -1
  11. package/fesm2022/{acorex-modules-customer-management-customer.entity-CRp5g0OZ.mjs → acorex-modules-customer-management-customer.entity-B7-T9_T7.mjs} +9 -9
  12. package/fesm2022/acorex-modules-customer-management-customer.entity-B7-T9_T7.mjs.map +1 -0
  13. package/fesm2022/acorex-modules-customer-management.mjs +1 -111
  14. package/fesm2022/acorex-modules-customer-management.mjs.map +1 -1
  15. package/fesm2022/acorex-modules-data-management.mjs +56 -45
  16. package/fesm2022/acorex-modules-data-management.mjs.map +1 -1
  17. package/fesm2022/{acorex-modules-human-capital-management-leave-request.entity-CviI9xJC.mjs → acorex-modules-human-capital-management-leave-request.entity-CS3Fr_k2.mjs} +2 -1
  18. package/fesm2022/acorex-modules-human-capital-management-leave-request.entity-CS3Fr_k2.mjs.map +1 -0
  19. package/fesm2022/acorex-modules-human-capital-management.mjs +1 -1
  20. package/fesm2022/acorex-modules-person-management.mjs +9 -19
  21. package/fesm2022/acorex-modules-person-management.mjs.map +1 -1
  22. package/fesm2022/acorex-modules-supplier-management.mjs +19 -229
  23. package/fesm2022/acorex-modules-supplier-management.mjs.map +1 -1
  24. package/package.json +6 -6
  25. package/supplier-management/index.d.ts +4 -50
  26. package/fesm2022/acorex-modules-contact-core-emergency-service.entity-Cro3bM4G.mjs.map +0 -1
  27. package/fesm2022/acorex-modules-customer-management-customer-segment.entity-CoYAU5g3.mjs +0 -69
  28. package/fesm2022/acorex-modules-customer-management-customer-segment.entity-CoYAU5g3.mjs.map +0 -1
  29. package/fesm2022/acorex-modules-customer-management-customer-type.entity-pt4gpOGq.mjs +0 -79
  30. package/fesm2022/acorex-modules-customer-management-customer-type.entity-pt4gpOGq.mjs.map +0 -1
  31. package/fesm2022/acorex-modules-customer-management-customer.entity-CRp5g0OZ.mjs.map +0 -1
  32. package/fesm2022/acorex-modules-human-capital-management-leave-request.entity-CviI9xJC.mjs.map +0 -1
@@ -8121,7 +8121,7 @@ class AXPMetaDataFormWidgetEditComponent extends AXPValueWidgetComponent {
8121
8121
  return false;
8122
8122
  }
8123
8123
  return groups.some((group) => {
8124
- const fields = group.fields || [];
8124
+ const fields = (group.parameters || group.fields || []);
8125
8125
  return fields.length > 0 && fields.some((field) => field != null);
8126
8126
  });
8127
8127
  }, ...(ngDevMode ? [{ debugName: "hasDefinitions" }] : []));
@@ -8178,10 +8178,11 @@ class AXPMetaDataFormWidgetEditComponent extends AXPValueWidgetComponent {
8178
8178
  convertGroupsToFormDefinition(groups) {
8179
8179
  const formGroups = [];
8180
8180
  groups.forEach((group) => {
8181
+ // Support both: group.parameters (form-definition) or group.fields (meta-data-selector)
8182
+ const parameters = group.parameters;
8181
8183
  const fields = group.fields || [];
8182
8184
  const validFields = fields.filter((field) => field != null);
8183
- if (validFields.length > 0) {
8184
- const parameters = validFields.map((field) => this.convertMetadataToFieldDefinition(field));
8185
+ if (parameters && parameters.length > 0) {
8185
8186
  formGroups.push({
8186
8187
  name: this.sanitizeGroupName(group.name || 'default'),
8187
8188
  title: group.title || group.name,
@@ -8190,6 +8191,16 @@ class AXPMetaDataFormWidgetEditComponent extends AXPValueWidgetComponent {
8190
8191
  parameters,
8191
8192
  });
8192
8193
  }
8194
+ else if (validFields.length > 0) {
8195
+ const params = validFields.map((field) => this.convertMetadataToFieldDefinition(field));
8196
+ formGroups.push({
8197
+ name: this.sanitizeGroupName(group.name || 'default'),
8198
+ title: group.title || group.name,
8199
+ description: group.description,
8200
+ look: groups.length > 1 ? 'group' : 'container',
8201
+ parameters: params,
8202
+ });
8203
+ }
8193
8204
  });
8194
8205
  return { groups: formGroups };
8195
8206
  }
@@ -8397,9 +8408,8 @@ class ShowMetaDataFormPopupCommand {
8397
8408
  };
8398
8409
  }
8399
8410
  const finalId = evaluatedInput.id;
8400
- // Get current entity record to get the metadata expression value
8401
- const [moduleName, entityName] = entity.split('.');
8402
- const currentRecord = await this.findRecord(entity, finalId);
8411
+ // Get current entity record (override findRecord to use custom data sources)
8412
+ const currentRecord = await this.findRecord(entity, finalId, evaluatedInput);
8403
8413
  if (!currentRecord) {
8404
8414
  return {
8405
8415
  success: false,
@@ -8408,45 +8418,14 @@ class ShowMetaDataFormPopupCommand {
8408
8418
  },
8409
8419
  };
8410
8420
  }
8411
- // Note: pathValue might be null/undefined, but the metadata expression evaluator will handle it
8412
- // The expression will return an empty array if pathValue is not available
8413
- // Resolve entity to get metadata expression and determine if it's category or entity lookup
8414
- const entityDef = await this.entityRegistry.resolve(moduleName, entityName);
8415
- const metaDataFormExt = entityDef.extensions?.metaDataForm?.[field];
8416
- if (!metaDataFormExt) {
8417
- return {
8418
- success: false,
8419
- message: {
8420
- text: await this.translationService.translateAsync('@data-management:metadata-definitions.messages.meta-data-form-not-configured'),
8421
- },
8422
- };
8423
- }
8424
- // Get path property to determine metadata source type
8425
- const props = entityDef.properties || [];
8426
- const pathProperty = props.find((p) => p.name === path);
8427
- const targetEntity = pathProperty?.schema?.interface?.options?.['entity'];
8428
- if (!targetEntity) {
8429
- return {
8430
- success: false,
8431
- message: {
8432
- text: await this.translationService.translateAsync('@data-management:metadata-definitions.messages.invalid-path-field'),
8433
- },
8434
- };
8435
- }
8436
- // Build metadata expression based on target entity type
8437
- let metadataExpression;
8438
- if (targetEntity.endsWith('Category')) {
8439
- // Category lookup - use fromCategory
8440
- metadataExpression = `{{ metadata.fromCategory("${entity}", context.eval('${path}')) }}`;
8441
- }
8442
- else {
8443
- // Relationship lookup - use fromEntity
8444
- metadataExpression = `{{ metadata.fromEntity("${targetEntity}", context.eval('${path}')) }}`;
8445
- }
8421
+ // Resolve groups (override resolveGroups to load from custom APIs)
8422
+ const { groups: resolvedGroups, dialogTitle: resolvedTitle } = await this.resolveGroups(evaluatedInput, currentRecord);
8446
8423
  // Get current meta data form value
8447
8424
  const currentMetaDataValue = currentRecord[field] || {};
8448
8425
  // Build dialog title
8449
- const dialogTitle = title || metaDataFormExt.title || await this.translationService.translateAsync('@data-management:metadata-definitions.components.meta-data-form.title');
8426
+ const dialogTitle = title ||
8427
+ resolvedTitle ||
8428
+ (await this.translationService.translateAsync('@data-management:metadata-definitions.components.meta-data-form.title'));
8450
8429
  // Open dialog with meta-data-form-editor widget
8451
8430
  const result = await this.layoutBuilder
8452
8431
  .create()
@@ -8462,13 +8441,13 @@ class ShowMetaDataFormPopupCommand {
8462
8441
  .content((layout) => {
8463
8442
  layout.flex((flex) => {
8464
8443
  flex.setDirection('column').setGap('16px');
8465
- // Add meta-data-form-editor widget with metadata expression
8444
+ // Add meta-data-form-editor widget with groups (expression or array)
8466
8445
  flex.formField('', (fieldBuilder) => {
8467
8446
  fieldBuilder
8468
8447
  .path(field)
8469
8448
  .setShowLabel(false)
8470
8449
  .customWidget('meta-data-form-editor', {
8471
- groups: metadataExpression,
8450
+ groups: resolvedGroups,
8472
8451
  });
8473
8452
  });
8474
8453
  });
@@ -8512,11 +8491,43 @@ class ShowMetaDataFormPopupCommand {
8512
8491
  //#region ---- Overridable Methods ----
8513
8492
  /**
8514
8493
  * Loads a record by entity and id. Override to use custom data sources or key handling.
8494
+ * @param input - Optional; overrides can use input.data or other fields to return custom record.
8515
8495
  */
8516
- findRecord(entity, id) {
8496
+ findRecord(entity, id, input) {
8517
8497
  const dataAccessor = this.entityService.withEntity(entity).data();
8518
8498
  return dataAccessor.byKey(id);
8519
8499
  }
8500
+ /**
8501
+ * Resolves groups for the meta-data-form-editor.
8502
+ * Override to load groups from custom APIs instead of entity metadata.
8503
+ * @returns Expression string (evaluated at runtime) or groups array; dialogTitle is optional fallback.
8504
+ */
8505
+ async resolveGroups(input, currentRecord) {
8506
+ const { entity, field = META_DATA_FORM_FIELD, path } = input;
8507
+ const [moduleName, entityName] = entity.split('.');
8508
+ const entityDef = await this.entityRegistry.resolve(moduleName, entityName);
8509
+ const metaDataFormExt = entityDef.extensions?.metaDataForm?.[field];
8510
+ if (!metaDataFormExt) {
8511
+ throw new Error(await this.translationService.translateAsync('@data-management:metadata-definitions.messages.meta-data-form-not-configured'));
8512
+ }
8513
+ const props = entityDef.properties || [];
8514
+ const pathProperty = props.find((p) => p.name === path);
8515
+ const targetEntity = pathProperty?.schema?.interface?.options?.['entity'];
8516
+ if (!targetEntity) {
8517
+ throw new Error(await this.translationService.translateAsync('@data-management:metadata-definitions.messages.invalid-path-field'));
8518
+ }
8519
+ let metadataExpression;
8520
+ if (targetEntity.endsWith('Category')) {
8521
+ metadataExpression = `{{ metadata.fromCategory("${entity}", context.eval('${path}')) }}`;
8522
+ }
8523
+ else {
8524
+ metadataExpression = `{{ metadata.fromEntity("${targetEntity}", context.eval('${path}')) }}`;
8525
+ }
8526
+ return {
8527
+ groups: metadataExpression,
8528
+ dialogTitle: metaDataFormExt.title,
8529
+ };
8530
+ }
8520
8531
  /**
8521
8532
  * Persists meta-data form changes. Override to use custom persistence or validation.
8522
8533
  */