@yuuvis/client-core 3.2.2 → 3.4.0

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.
@@ -1423,8 +1423,9 @@ class LocalizationService {
1423
1423
  }));
1424
1424
  }
1425
1425
  getLocalizedResource(key) {
1426
+ // TODO: Fix return type to also include undefined
1426
1427
  const iso = this.#translate.getCurrentLang();
1427
- return { ...this.#i18n, ...this.#extension[iso] }[key] || key;
1428
+ return { ...this.#i18n, ...this.#extension[iso] }[key];
1428
1429
  }
1429
1430
  getLocalizedLabel(id) {
1430
1431
  return this.getLocalizedResource(`${id}_label`);
@@ -1669,7 +1670,13 @@ class SystemService {
1669
1670
  * @deprecated use LocalizationService.getLocalizedResource instead
1670
1671
  */
1671
1672
  getLocalizedResource(key) {
1672
- return this.#localization.getLocalizedResource(key);
1673
+ try {
1674
+ // return this.system!.i18n[key];
1675
+ return this.#localization.getLocalizedResource(key);
1676
+ }
1677
+ catch (error) {
1678
+ return key;
1679
+ }
1673
1680
  }
1674
1681
  /**
1675
1682
  * @deprecated use LocalizationService.getLocalizedResource instead
@@ -2026,10 +2033,16 @@ class SystemService {
2026
2033
  .map((sot) => sot.value)
2027
2034
  .forEach((sotID) => objectTypesQA[sotID].propertyReference.forEach((propertyRef) => objectTypeFieldIDs.push(propertyRef.value)));
2028
2035
  }
2029
- let fields = objectTypeFieldIDs.map((id) => ({
2030
- ...propertiesQA[id],
2031
- _internalType: this.getInternalFormElementType(propertiesQA[id].propertyType, propertiesQA[id].classifications)
2032
- }));
2036
+ let fields = objectTypeFieldIDs.map((id) => {
2037
+ const propDef = propertiesQA[id];
2038
+ const propRef = schemaTypeDefinition.propertyReference.find((propertyRef) => propertyRef.value === id);
2039
+ const required = propRef?.required ?? propDef.required;
2040
+ return {
2041
+ ...propDef,
2042
+ required,
2043
+ _internalType: this.getInternalFormElementType(propertiesQA[id].propertyType, propertiesQA[id].classifications)
2044
+ };
2045
+ });
2033
2046
  // also resolve properties of the base type
2034
2047
  if (schemaTypeDefinition.baseId !== schemaTypeDefinition.id && !!objectTypesQA[schemaTypeDefinition.baseId]) {
2035
2048
  fields = fields.concat(this.#resolveObjectTypeFields(objectTypesQA[schemaTypeDefinition.baseId], propertiesQA, objectTypesQA));
@@ -4345,7 +4358,11 @@ class CatalogService {
4345
4358
  #getCatalogs() {
4346
4359
  return this.#search.searchCmis(`SELECT * FROM ${SystemType.CATALOG}`, 1000).pipe(map$1((res) => res.items.map((item) => ({
4347
4360
  objectId: item.fields.get(BaseObjectTypeField.OBJECT_ID),
4348
- name: item.fields.get(CatalogTypeField.NATIVE_ID)
4361
+ name: item.fields.get(CatalogTypeField.NATIVE_ID),
4362
+ raw: Array.from(item.fields).reduce((acc, [key, wrapper]) => {
4363
+ acc[key] = wrapper;
4364
+ return acc;
4365
+ }, {})
4349
4366
  }))));
4350
4367
  }
4351
4368
  /** Loads the catalog list, sorts by name and publishes to the `catalogs` signal. */
@@ -4399,16 +4416,35 @@ class CatalogService {
4399
4416
  totalNumItems: response.totalNumItems
4400
4417
  };
4401
4418
  }
4419
+ #getEntryState(properties) {
4420
+ const validFrom = this.#prop(properties, CatalogTypeField.DATE_VALID_FROM);
4421
+ const validUntil = this.#prop(properties, CatalogTypeField.DATE_VALID_UNTIL);
4422
+ const now = new Date().toISOString();
4423
+ if (validFrom && now < validFrom) {
4424
+ return 'upcoming';
4425
+ }
4426
+ if (validUntil && now > validUntil) {
4427
+ return 'expired';
4428
+ }
4429
+ return 'active';
4430
+ }
4402
4431
  #mapEntry(apiObject) {
4403
4432
  const props = apiObject.properties;
4404
4433
  return {
4434
+ _state: this.#getEntryState(props),
4405
4435
  objectId: this.#prop(props, BaseObjectTypeField.OBJECT_ID),
4406
4436
  name: this.#prop(props, CatalogTypeField.NATIVE_ID),
4407
4437
  catalogName: this.#prop(props, CatalogTypeField.CATALOG_NATIVE_ID),
4408
4438
  localizations: this.#parseLocalization(props[CatalogTypeField.LOCALIZATION]),
4409
4439
  validFrom: this.#prop(props, CatalogTypeField.DATE_VALID_FROM),
4410
4440
  validUntil: this.#prop(props, CatalogTypeField.DATE_VALID_UNTIL),
4411
- properties: this.#extractCustomProperties(props)
4441
+ properties: this.#extractCustomProperties(props),
4442
+ raw: Object.entries(props).reduce((acc, [key, wrapper]) => {
4443
+ if (wrapper && typeof wrapper === 'object' && 'value' in wrapper) {
4444
+ acc[key] = wrapper.value;
4445
+ }
4446
+ return acc;
4447
+ }, {})
4412
4448
  };
4413
4449
  }
4414
4450
  #prop(properties, key) {