@propbinder/mobile-design 0.2.23 → 0.2.25

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.
@@ -2355,14 +2355,50 @@ class DsMobileProfileActionsSheetComponent {
2355
2355
  constructor(modalController, injector) {
2356
2356
  this.modalController = modalController;
2357
2357
  this.injector = injector;
2358
- // Initialize selected language when component is created
2359
- this.selectedLanguage.set(this.currentLanguage);
2360
- this.initialLanguage = this.currentLanguage;
2361
2358
  // Set initial height after render
2362
2359
  afterNextRender(() => {
2363
2360
  this.updateHeight();
2364
2361
  }, { injector: this.injector });
2365
2362
  }
2363
+ ngOnChanges(changes) {
2364
+ if (changes['currentLanguage']) {
2365
+ const val = changes['currentLanguage'].currentValue;
2366
+ if (val) {
2367
+ this.selectedLanguage.set(val);
2368
+ this.initialLanguage = val;
2369
+ }
2370
+ }
2371
+ }
2372
+ ngOnInit() {
2373
+ // Try to get language from localStorage as fallback
2374
+ const storedLangCode = this.getLanguageFromStorage();
2375
+ if (storedLangCode) {
2376
+ this.selectedLanguage.set(storedLangCode);
2377
+ this.initialLanguage = storedLangCode;
2378
+ }
2379
+ else if (!this.selectedLanguage()) {
2380
+ // Fallback to input if storage is empty
2381
+ this.selectedLanguage.set(this.currentLanguage);
2382
+ this.initialLanguage = this.currentLanguage;
2383
+ }
2384
+ }
2385
+ /**
2386
+ * Try to resolve short language code from localStorage ('selectedLanguage' key)
2387
+ */
2388
+ getLanguageFromStorage() {
2389
+ try {
2390
+ const stored = localStorage.getItem('selectedLanguage'); // e.g. "da-DK", "sv-SE"
2391
+ if (!stored)
2392
+ return null;
2393
+ // Find the code from availableLanguages that matches this locale/string
2394
+ // We check if any language code is part of the stored string (e.g. 'da' in 'da-DK')
2395
+ const match = this.availableLanguages.find(lang => lang.code === stored || stored.startsWith(lang.code + '-'));
2396
+ return match ? match.code : null;
2397
+ }
2398
+ catch (e) {
2399
+ return null;
2400
+ }
2401
+ }
2366
2402
  /**
2367
2403
  * Handle action item click
2368
2404
  */
@@ -2500,7 +2536,7 @@ class DsMobileProfileActionsSheetComponent {
2500
2536
  this.modalController.dismiss({ action }, 'select');
2501
2537
  }
2502
2538
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: DsMobileProfileActionsSheetComponent, deps: [{ token: i1.ModalController }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2503
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DsMobileProfileActionsSheetComponent, isStandalone: true, selector: "ds-mobile-profile-actions-sheet", inputs: { actionGroups: "actionGroups", currentLanguage: "currentLanguage", availableLanguages: "availableLanguages" }, viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["viewContainer"], descendants: true, read: ElementRef }, { propertyName: "sheetWrapper", first: true, predicate: ["sheetWrapper"], descendants: true, read: ElementRef }], ngImport: i0, template: `
2539
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: DsMobileProfileActionsSheetComponent, isStandalone: true, selector: "ds-mobile-profile-actions-sheet", inputs: { actionGroups: "actionGroups", currentLanguage: "currentLanguage", availableLanguages: "availableLanguages" }, viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["viewContainer"], descendants: true, read: ElementRef }, { propertyName: "sheetWrapper", first: true, predicate: ["sheetWrapper"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: `
2504
2540
  <ds-mobile-bottom-sheet-wrapper>
2505
2541
  <div class="profile-sheet-content" #sheetWrapper>
2506
2542
  <!-- View Container with CSS Animation -->