@acorex-platform/module-locale-management-client 0.0.21

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.
@@ -0,0 +1,1251 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable, signal, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as i1$1 from '@acorex-platform/framework-client/core';
5
+ import { objectKeyValueTransforms, AXP_APP_STARTUP_PRIORITY, AXPComponentSlotModule, AXP_MODULE_MANIFEST_PROVIDER, AXP_CONTEXT_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/core';
6
+ import { provideQuerySetups } from '@acorex-platform/framework-client/runtime';
7
+ import { RootConfig, getLocaleProfileCatalogCodes, AXPApplicationsPlatformPermissionKeys, AXPLocaleManagementMenuKeys } from '@acorex-platform/module-locale-management-client/contracts';
8
+ import * as i3 from '@acorex/components/button';
9
+ import { AXButtonModule } from '@acorex/components/button';
10
+ import * as i2 from '@acorex/components/decorators';
11
+ import { AXDecoratorModule } from '@acorex/components/decorators';
12
+ import * as i1 from '@acorex/components/dropdown';
13
+ import { AXDropdownModule } from '@acorex/components/dropdown';
14
+ import { AXPopoverModule } from '@acorex/components/popover';
15
+ import { AXPRegionalSetting, AXPPlatformScope, AXPWidgetsList, AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
16
+ import { AXPSettingsService, resolveEffectiveAvailableLanguageCodes, AXPSearchCommandProvider, createEntityCommandOptions, AXPPlatformSettingsLoadState, AXP_LOCALE_MANAGEMENT_PORT, AXPRegionalCalendarService, AXP_MENU_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER } from '@acorex-platform/framework-client/common';
17
+ import { AXCalendarService } from '@acorex/core/date-time';
18
+ import { AXLocaleService, AX_LOCALE_PROFILE_PROVIDERS } from '@acorex/core/locale';
19
+ import { AXTranslationService } from '@acorex/core/translation';
20
+ import { signalStore, withState, withMethods, patchState, withHooks } from '@ngrx/signals';
21
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
22
+ import { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';
23
+ import { AXPCommonPermissionGroupKeys, AXPCommonMenuKeys } from '@acorex-platform/module-common-client/contracts';
24
+ import { AXM_LOCALE_CONTEXT_DEFINITIONS } from '@acorex-platform/module-locale-management-contracts';
25
+
26
+ //#region ---- Imports ----
27
+ //#endregion
28
+ //#region ---- Manifest Definition ----
29
+ /**
30
+ * Locale Management Module Manifest.
31
+ * Defines module metadata, features, and provider references.
32
+ */
33
+ const LocaleManagementManifest = {
34
+ name: RootConfig.module.name,
35
+ version: '1.0.0',
36
+ title: RootConfig.module.title,
37
+ icon: RootConfig.module.icon,
38
+ i18n: RootConfig.config.i18n,
39
+ type: 'platform',
40
+ domain: 'platform',
41
+ required: true,
42
+ // Module dependencies (optional)
43
+ };
44
+ //#endregion
45
+
46
+ const REGIONAL_SETTING_KEYS = [
47
+ AXPRegionalSetting.LocaleProfile,
48
+ AXPRegionalSetting.Language,
49
+ AXPRegionalSetting.Calendar,
50
+ ];
51
+ // Regional Store - Manages regional settings and system changes
52
+ const AXPRegionalStoreService = signalStore({ providedIn: 'root' },
53
+ // Initial State
54
+ withState(() => {
55
+ // Initialize with safe defaults - actual values will be loaded via loadSetting()
56
+ const state = {
57
+ profile: null,
58
+ language: null,
59
+ calendar: null,
60
+ };
61
+ return state;
62
+ }),
63
+ // Computed Signals
64
+ // withComputed(({ }) => ({
65
+ // })),
66
+ // Methods for State Management
67
+ withMethods((store, settingsService = inject(AXPSettingsService), localeService = inject(AXLocaleService), calendarService = inject(AXCalendarService), translateService = inject(AXTranslationService)) => {
68
+ const applyChanges = async () => {
69
+ const profile = localeService.activeProfile();
70
+ const html = document.getElementsByTagName('html')[0];
71
+ profile.i18nMeta?.rtl ? html.setAttribute('dir', 'rtl') : html.removeAttribute('dir');
72
+ };
73
+ const applyProfileFormats = async (profile) => {
74
+ const date = profile.formats?.date;
75
+ if (date?.short) {
76
+ await settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.ShortDate, date.short);
77
+ }
78
+ if (date?.medium) {
79
+ await settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.MediumDate, date.medium);
80
+ }
81
+ if (date?.long) {
82
+ await settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.LongDate, date.long);
83
+ }
84
+ const time = profile.formats?.time;
85
+ if (time?.short) {
86
+ await settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.ShortTime, time.short);
87
+ }
88
+ if (time?.medium) {
89
+ await settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.MediumTime, time.medium);
90
+ }
91
+ if (time?.long) {
92
+ await settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.LongTime, time.long);
93
+ }
94
+ };
95
+ return {
96
+ async changeProfile(profileCode) {
97
+ await localeService.setProfile(profileCode);
98
+ const profile = localeService.activeProfile();
99
+ if (store.profile() != profile.localeInfo.code) {
100
+ settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.LocaleProfile, profile.localeInfo.code);
101
+ settingsService.scope(AXPPlatformScope.User).set(AXPRegionalSetting.Language, profile.localeInfo.code);
102
+ patchState(store, { profile: profile.localeInfo.code });
103
+ }
104
+ await applyProfileFormats(profile);
105
+ await applyChanges();
106
+ },
107
+ /**
108
+ * Applies effective regional settings (user → tenant → platform) to locale, calendar, i18n, and document direction.
109
+ */
110
+ async loadSetting() {
111
+ const profileCode = (await settingsService.get(AXPRegionalSetting.LocaleProfile)) || 'en-US';
112
+ patchState(store, { profile: profileCode });
113
+ if (profileCode) {
114
+ await localeService.setProfile(profileCode);
115
+ }
116
+ const calendar = (await settingsService.get(AXPRegionalSetting.Calendar));
117
+ if (calendar) {
118
+ patchState(store, { calendar });
119
+ calendarService.setActiveCalendar(calendar);
120
+ }
121
+ const language = (await settingsService.get(AXPRegionalSetting.Language));
122
+ if (language) {
123
+ patchState(store, { language });
124
+ translateService.setActiveLang(language);
125
+ }
126
+ await applyChanges();
127
+ },
128
+ };
129
+ }), withHooks((store, settingsService = inject(AXPSettingsService)) => ({
130
+ onInit() {
131
+ settingsService.onLoaded.subscribe(() => {
132
+ void store.loadSetting();
133
+ });
134
+ settingsService.onChanged.subscribe(async (setting) => {
135
+ if (REGIONAL_SETTING_KEYS.some((k) => setting.keys.includes(k))) {
136
+ await store.loadSetting();
137
+ }
138
+ });
139
+ },
140
+ onDestroy() { },
141
+ })));
142
+
143
+ /** Simple cache - timezones are static reference data */
144
+ let timezonesCache = null;
145
+ /** Dedupes concurrent bootstrap callers so a failed/slow query cannot storm the API. */
146
+ let timezonesLoadPromise = null;
147
+ class AXMLocaleManagementService {
148
+ constructor() {
149
+ this.entityService = inject(AXPEntityService);
150
+ this.settingsService = inject(AXPSettingsService);
151
+ this.languagesDataAccessor = this.entityService
152
+ .withEntity(RootConfig.module.name, RootConfig.entities.languages.name)
153
+ .data();
154
+ this.timezonesDataAccessor = this.entityService
155
+ .withEntity(RootConfig.module.name, RootConfig.entities.timezones.name)
156
+ .data();
157
+ this.localesDataAccessor = this.entityService
158
+ .withEntity(RootConfig.module.name, RootConfig.entities.locales.name)
159
+ .data();
160
+ this.activeQuery = {
161
+ skip: 0,
162
+ take: 1000,
163
+ filter: {
164
+ logic: 'and',
165
+ filters: [
166
+ {
167
+ field: 'isActive',
168
+ operator: {
169
+ type: 'equal',
170
+ },
171
+ value: true,
172
+ },
173
+ ],
174
+ },
175
+ sort: [
176
+ {
177
+ field: 'title',
178
+ dir: 'asc',
179
+ },
180
+ ],
181
+ };
182
+ }
183
+ async getLocaleProfiles() {
184
+ const { profiles } = await import('./acorex-platform-module-locale-management-client-profiles-l46U-cgo.mjs');
185
+ const catalogCodes = getLocaleProfileCatalogCodes();
186
+ if (!catalogCodes?.length) {
187
+ return profiles;
188
+ }
189
+ const allowSet = new Set(catalogCodes);
190
+ const filtered = profiles.filter((profile) => allowSet.has(profile.code));
191
+ return filtered.length > 0 ? filtered : profiles;
192
+ }
193
+ async getAvailableLocaleProfiles() {
194
+ const profiles = await this.getLocaleProfiles();
195
+ const allowed = await resolveEffectiveAvailableLanguageCodes(this.settingsService);
196
+ if (allowed.length === 0) {
197
+ return profiles;
198
+ }
199
+ const allowSet = new Set(allowed);
200
+ return profiles.filter((profile) => allowSet.has(profile.code));
201
+ }
202
+ async getLanguages() {
203
+ const result = await this.languagesDataAccessor.query(this.activeQuery);
204
+ return result.items.map((c) => ({
205
+ code: c.code,
206
+ title: c.title,
207
+ }));
208
+ }
209
+ async getLocales() {
210
+ const result = await this.localesDataAccessor.query(this.activeQuery);
211
+ return result.items.map((c) => ({
212
+ code: c.code,
213
+ title: c.title,
214
+ }));
215
+ }
216
+ async getAvailableLanguages() {
217
+ const profiles = await this.getAvailableLocaleProfiles();
218
+ return profiles.map((profile) => ({
219
+ code: profile.code,
220
+ title: profile.title,
221
+ }));
222
+ }
223
+ async getTimeZones() {
224
+ if (timezonesCache) {
225
+ return timezonesCache;
226
+ }
227
+ if (!timezonesLoadPromise) {
228
+ timezonesLoadPromise = this.loadTimeZones().finally(() => {
229
+ timezonesLoadPromise = null;
230
+ });
231
+ }
232
+ return timezonesLoadPromise;
233
+ }
234
+ async getBrowserTimeZoneCode() {
235
+ // Prefer browser IANA zone — no network needed during app bootstrap / login.
236
+ const browserIana = typeof Intl !== 'undefined'
237
+ ? Intl.DateTimeFormat().resolvedOptions().timeZone
238
+ : undefined;
239
+ if (browserIana) {
240
+ return browserIana;
241
+ }
242
+ try {
243
+ const timeZones = await this.getTimeZones();
244
+ const offsetMinutes = new Date().getTimezoneOffset() * -1;
245
+ const matchedZone = timeZones.find((zone) => zone.offset === offsetMinutes);
246
+ return matchedZone?.code ?? 'UTC';
247
+ }
248
+ catch {
249
+ return 'UTC';
250
+ }
251
+ }
252
+ async loadTimeZones() {
253
+ try {
254
+ const result = await this.timezonesDataAccessor.query({
255
+ ...this.activeQuery,
256
+ sort: [{ field: 'standardOffset', dir: 'asc' }],
257
+ });
258
+ const padZero = (value) => value.toString().padStart(2, '0');
259
+ const formatOffset = (offset) => {
260
+ const sign = offset > 0 ? '+' : '-';
261
+ const hours = padZero(Math.floor(Math.abs(offset) / 60));
262
+ const minutes = padZero(Math.abs(offset % 60));
263
+ return `${sign}${hours}:${minutes}`;
264
+ };
265
+ timezonesCache = result.items.map((c) => ({
266
+ code: c.code,
267
+ title: `${c.title} (${formatOffset(c.standardOffset)})`,
268
+ offset: c.standardOffset,
269
+ iana: c.code,
270
+ abbr: c.abbreviation,
271
+ }));
272
+ return timezonesCache;
273
+ }
274
+ catch {
275
+ // Do not cache failures — allow retry after login when auth is available.
276
+ return [];
277
+ }
278
+ }
279
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
280
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementService, providedIn: 'root' }); }
281
+ }
282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementService, decorators: [{
283
+ type: Injectable,
284
+ args: [{
285
+ providedIn: 'root',
286
+ }]
287
+ }] });
288
+
289
+ class AXMLanguageSlotComponent {
290
+ constructor() {
291
+ this.localeManagementService = inject(AXMLocaleManagementService);
292
+ this.store = inject(AXPRegionalStoreService);
293
+ this.items = signal([], /* @ts-ignore */
294
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
295
+ }
296
+ async ngOnInit() {
297
+ const items = await this.localeManagementService.getAvailableLocaleProfiles();
298
+ this.items.set(items);
299
+ }
300
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLanguageSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
301
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMLanguageSlotComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<ax-button color=\"primary\">\n <ax-icon class=\"fa-regular fa-globe\"> </ax-icon>\n <ax-dropdown-panel>\n <ax-button-item-list>\n @for(lang of items(); track lang){\n <ax-button-item\n [text]=\"lang.title\"\n [selected]=\"store.profile() === lang.code\"\n (onClick)=\"store.changeProfile(lang.code)\"\n >\n <ax-prefix>\n <ax-icon icon=\"fa-solid fa-flag\"> </ax-icon>\n </ax-prefix>\n </ax-button-item>\n }\n </ax-button-item-list>\n </ax-dropdown-panel>\n</ax-button>\n", dependencies: [{ kind: "ngmodule", type: AXDropdownModule }, { kind: "component", type: i1.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "placement", "_target", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i3.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i3.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: i3.AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
302
+ }
303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLanguageSlotComponent, decorators: [{
304
+ type: Component,
305
+ args: [{ imports: [AXDropdownModule, AXDecoratorModule, AXPopoverModule, AXButtonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ax-button color=\"primary\">\n <ax-icon class=\"fa-regular fa-globe\"> </ax-icon>\n <ax-dropdown-panel>\n <ax-button-item-list>\n @for(lang of items(); track lang){\n <ax-button-item\n [text]=\"lang.title\"\n [selected]=\"store.profile() === lang.code\"\n (onClick)=\"store.changeProfile(lang.code)\"\n >\n <ax-prefix>\n <ax-icon icon=\"fa-solid fa-flag\"> </ax-icon>\n </ax-prefix>\n </ax-button-item>\n }\n </ax-button-item-list>\n </ax-dropdown-panel>\n</ax-button>\n" }]
306
+ }] });
307
+
308
+ /**
309
+ * Custom locale profile provider that integrates with the locale-management module
310
+ * to provide profiles from the platform's data instead of the default UI library profiles
311
+ */
312
+ class AXMLocaleProfileProviderService {
313
+ constructor() {
314
+ this.localeManagementService = inject(AXMLocaleManagementService);
315
+ }
316
+ /**
317
+ * Provides locale profiles from the locale-management module
318
+ * This allows the platform to override the default UI library profiles
319
+ */
320
+ async provide() {
321
+ try {
322
+ // Get profiles from the locale-management module
323
+ const profiles = await this.localeManagementService.getLocaleProfiles();
324
+ // Convert to the format expected by the UI library
325
+ const result = {};
326
+ for (const profile of profiles) {
327
+ try {
328
+ // Convert AXPLocaleProfile to AXLocaleProfile (remove platform-specific properties)
329
+ const coreProfile = {
330
+ localeInfo: profile.localeInfo,
331
+ calendar: profile.calendar,
332
+ formats: profile.formats,
333
+ units: profile.units,
334
+ i18nMeta: profile.i18nMeta,
335
+ };
336
+ // Validate that the profile has all required properties
337
+ if (this.isValidProfile(coreProfile)) {
338
+ // Store the profile with lazy loading for better performance
339
+ result[profile.code] = () => Promise.resolve(coreProfile);
340
+ }
341
+ else {
342
+ console.warn(`[AXMLocaleProfileProviderService] Profile ${profile.code} is missing required properties, skipping`);
343
+ }
344
+ }
345
+ catch (profileError) {
346
+ console.error(`[AXMLocaleProfileProviderService] Error processing profile ${profile.code}:`, profileError);
347
+ }
348
+ }
349
+ if (Object.keys(result).length === 0) {
350
+ console.warn('[AXMLocaleProfileProviderService] No valid profiles found, falling back to default behavior');
351
+ }
352
+ else {
353
+ //console.log(`[AXMLocaleProfileProviderService] Successfully loaded ${Object.keys(result).length} profiles:`, Object.keys(result));
354
+ }
355
+ return result;
356
+ }
357
+ catch (error) {
358
+ console.error('[AXMLocaleProfileProviderService] Failed to load profiles:', error);
359
+ // Fallback to empty result if loading fails
360
+ return {};
361
+ }
362
+ }
363
+ /**
364
+ * Validates that a profile has all required properties
365
+ */
366
+ isValidProfile(profile) {
367
+ return (profile &&
368
+ profile.localeInfo &&
369
+ profile.calendar &&
370
+ profile.formats &&
371
+ profile.units &&
372
+ typeof profile.localeInfo.code === 'string' &&
373
+ typeof profile.localeInfo.language === 'string');
374
+ }
375
+ /**
376
+ * Gets the list of available locale codes from the locale-management module
377
+ * This can be used by other services to check available locales
378
+ */
379
+ async getAvailableLocaleCodes() {
380
+ try {
381
+ const profiles = await this.localeManagementService.getLocaleProfiles();
382
+ return profiles.map(p => p.code);
383
+ }
384
+ catch (error) {
385
+ console.error('[AXMLocaleProfileProviderService] Failed to get available locale codes:', error);
386
+ return [];
387
+ }
388
+ }
389
+ /**
390
+ * Checks if a specific locale is available
391
+ */
392
+ async hasLocale(localeCode) {
393
+ try {
394
+ const codes = await this.getAvailableLocaleCodes();
395
+ return codes.includes(localeCode);
396
+ }
397
+ catch (error) {
398
+ console.error(`[AXMLocaleProfileProviderService] Failed to check locale ${localeCode}:`, error);
399
+ return false;
400
+ }
401
+ }
402
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleProfileProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
403
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleProfileProviderService, providedIn: 'root' }); }
404
+ }
405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleProfileProviderService, decorators: [{
406
+ type: Injectable,
407
+ args: [{
408
+ providedIn: 'root',
409
+ }]
410
+ }] });
411
+
412
+ //#endregion
413
+ //#region ---- Permission Definition Provider ----
414
+ /**
415
+ * Registers MaintainLocales under Applications & Platform.
416
+ */
417
+ class AXMLocaleManagementPermissionDefinitionProvider {
418
+ async define(context) {
419
+ const keys = AXPApplicationsPlatformPermissionKeys;
420
+ const groups = AXPCommonPermissionGroupKeys;
421
+ const P = '@common:applications-platform.permissions';
422
+ const G = '@common:permission-groups';
423
+ context.addGroup(groups.ApplicationsPlatform.Root, `${G}.applications-platform.title`, `${G}.applications-platform.description`, { order: 110 });
424
+ context
425
+ .addGroup(groups.ApplicationsPlatform.Configuration, `${G}.applications-platform-configuration.title`, `${G}.applications-platform-configuration.description`, { parent: groups.ApplicationsPlatform.Root, order: 30 })
426
+ .addPermission(keys.MaintainLocales, `${P}.maintain-locales.title`, `${P}.maintain-locales.description`, {
427
+ modules: ['LocaleManagement'],
428
+ requiredFeatures: ['LocaleManagement'],
429
+ })
430
+ .endPermission()
431
+ .endGroup();
432
+ }
433
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementPermissionDefinitionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
434
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementPermissionDefinitionProvider }); }
435
+ }
436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementPermissionDefinitionProvider, decorators: [{
437
+ type: Injectable
438
+ }] });
439
+
440
+ class AXMLocaleManagementMenuProvider {
441
+ constructor() {
442
+ this.entityService = inject(AXPEntityService);
443
+ }
444
+ async provide(context) {
445
+ const module = RootConfig.module;
446
+ const maintainLocales = AXPApplicationsPlatformPermissionKeys.MaintainLocales;
447
+ // Languages under Configuration/Region
448
+ context.find(AXPCommonMenuKeys.Region).addItems([
449
+ {
450
+ name: AXPLocaleManagementMenuKeys.Languages,
451
+ text: '@locale-management:languages.menus.languages.title',
452
+ path: this.entityService.createPath(module.name, RootConfig.entities.languages.name),
453
+ icon: RootConfig.entities.languages.icon,
454
+ priority: 3,
455
+ policy: {
456
+ features: [module.name],
457
+ permissions: [maintainLocales],
458
+ },
459
+ },
460
+ ]);
461
+ // Timezones under Configuration/Date and Time
462
+ context.find(AXPCommonMenuKeys.DateAndTime).addItems([
463
+ {
464
+ name: AXPLocaleManagementMenuKeys.Timezones,
465
+ text: '@locale-management:timezones.menus.timezones.title',
466
+ path: this.entityService.createPath(module.name, RootConfig.entities.timezones.name),
467
+ icon: RootConfig.entities.timezones.icon,
468
+ priority: 1,
469
+ policy: {
470
+ features: [module.name],
471
+ permissions: [maintainLocales],
472
+ },
473
+ },
474
+ ]);
475
+ }
476
+ }
477
+
478
+ class AXMRegionalSettingProvider {
479
+ constructor(injector) {
480
+ this.injector = injector;
481
+ this.regionalService = this.injector.get(AXMLocaleManagementService);
482
+ this.translateService = this.injector.get(AXTranslationService);
483
+ }
484
+ async provide(context) {
485
+ const i18n = (key) => `@locale-management:settings.settings.regional.${key}`;
486
+ const profiles = await this.regionalService.getLocaleProfiles();
487
+ const defaultProfile = profiles.find((p) => p.code === 'en-US');
488
+ const defaultAvailableLanguages = profiles.map((p) => p.code);
489
+ const multipleLanguagesVisibility = `{{ ((await settings.get('${AXPRegionalSetting.AvailableLanguages}')) || []).length > 1 }}`;
490
+ context
491
+ .addGroup('regional-settings', i18n('nav-title'), i18n('description'), 'fa-light fa-earth-americas', i18n('title'), 30)
492
+ // Date & Time Section
493
+ .addSection('date-time', i18n('datetime.title'), i18n('datetime.description'))
494
+ .addSetting({
495
+ key: AXPRegionalSetting.TimeZone,
496
+ title: i18n('datetime.timezone.title'),
497
+ scope: 'T',
498
+ overridableAt: ['U'],
499
+ isInherited: true,
500
+ defaultValue: 'UTC',
501
+ valueTransforms: objectKeyValueTransforms('code'),
502
+ widget: {
503
+ type: AXPWidgetsList.Editors.LookupBox,
504
+ options: {
505
+ entity: 'LocaleManagement.Timezones',
506
+ look: 'select',
507
+ allowSearch: true,
508
+ valueField: 'code',
509
+ textField: 'title',
510
+ filter: {
511
+ logic: 'and',
512
+ filters: [{ field: 'isActive', operator: { type: 'equal' }, value: true }],
513
+ },
514
+ },
515
+ },
516
+ description: i18n('datetime.timezone.description'),
517
+ })
518
+ .endSection()
519
+ // Region Section
520
+ .addSection('region', i18n('region.title'), i18n('region.description'))
521
+ .addSetting({
522
+ key: AXPRegionalSetting.AvailableLanguages,
523
+ title: i18n('region.available-languages.title'),
524
+ scope: 'P',
525
+ overridableAt: ['T'],
526
+ isInherited: true,
527
+ defaultValue: defaultAvailableLanguages,
528
+ widget: {
529
+ type: AXPWidgetsList.Editors.SelectionList,
530
+ options: {
531
+ multiple: true,
532
+ valueField: 'code',
533
+ textField: 'title',
534
+ dataSource: 'LocaleManagement:ListLocaleProfiles',
535
+ },
536
+ },
537
+ description: i18n('region.available-languages.description'),
538
+ })
539
+ .addSetting({
540
+ key: AXPRegionalSetting.LocaleProfile,
541
+ title: i18n('region.format.title'),
542
+ scope: 'U',
543
+ overridableAt: [],
544
+ isInherited: true,
545
+ defaultValue: defaultProfile.code,
546
+ valueTransforms: objectKeyValueTransforms('code'),
547
+ widget: {
548
+ type: AXPWidgetsList.Editors.SelectBox,
549
+ options: {
550
+ valueField: 'code',
551
+ textField: 'title',
552
+ dataSource: 'LocaleManagement:ListAvailableLocaleProfiles',
553
+ visibility: multipleLanguagesVisibility,
554
+ },
555
+ },
556
+ description: i18n('region.format.description'),
557
+ })
558
+ .addSetting({
559
+ key: AXPRegionalSetting.Language,
560
+ title: i18n('region.language.title'),
561
+ scope: 'U',
562
+ overridableAt: [],
563
+ isInherited: true,
564
+ defaultValue: await this.translateService.getDefaultLang(),
565
+ valueTransforms: objectKeyValueTransforms('code'),
566
+ widget: {
567
+ type: AXPWidgetsList.Editors.SelectBox,
568
+ options: {
569
+ valueField: 'code',
570
+ textField: 'title',
571
+ dataSource: 'LocaleManagement:ListAvailableLocaleProfiles',
572
+ visibility: multipleLanguagesVisibility,
573
+ },
574
+ triggers: [
575
+ {
576
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
577
+ action: `{{ widget.setValue(context.eval('${AXPRegionalSetting.LocaleProfile}')) }}`,
578
+ },
579
+ ],
580
+ },
581
+ description: i18n('region.language.description'),
582
+ })
583
+ .addSetting({
584
+ key: AXPRegionalSetting.Calendar,
585
+ title: i18n('region.calendar.title'),
586
+ scope: 'U',
587
+ overridableAt: [],
588
+ isInherited: true,
589
+ defaultValue: defaultProfile.calendar.system,
590
+ valueTransforms: objectKeyValueTransforms('id'),
591
+ widget: {
592
+ type: AXPWidgetsList.Editors.SelectBox,
593
+ options: {
594
+ valueField: 'id',
595
+ textField: 'title',
596
+ dataSource: 'CalendarManagement:ListCalendarSystems',
597
+ },
598
+ triggers: [
599
+ {
600
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
601
+ action: [
602
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').calendar.system) }}`,
603
+ ],
604
+ },
605
+ ],
606
+ },
607
+ description: i18n('region.calendar.description'),
608
+ })
609
+ .addSetting({
610
+ key: AXPRegionalSetting.CalendarEvents,
611
+ title: i18n('region.calendar-events.title'),
612
+ scope: 'U',
613
+ overridableAt: [],
614
+ isInherited: true,
615
+ defaultValue: [],
616
+ widget: {
617
+ type: AXPWidgetsList.Editors.LookupBox,
618
+ options: {
619
+ entity: 'CalendarManagement.Calendar',
620
+ look: 'select',
621
+ multiple: true,
622
+ valueField: 'id',
623
+ textField: 'title',
624
+ filter: {
625
+ logic: 'or',
626
+ filters: [
627
+ { field: 'isArchived', operator: { type: 'equal' }, value: false },
628
+ { field: 'isArchived', operator: { type: 'isNull' } },
629
+ ],
630
+ },
631
+ },
632
+ },
633
+ description: i18n('region.calendar-events.description'),
634
+ })
635
+ .addSetting({
636
+ key: AXPRegionalSetting.FirstDayOfWeek,
637
+ title: i18n('region.firstday.title'),
638
+ scope: 'T',
639
+ overridableAt: [],
640
+ isInherited: false,
641
+ defaultValue: defaultProfile.calendar.week.startsOn,
642
+ valueTransforms: objectKeyValueTransforms('value'),
643
+ widget: {
644
+ type: AXPWidgetsList.Editors.SelectBox,
645
+ options: {
646
+ valueField: 'value',
647
+ textField: 'text',
648
+ dataSource: [
649
+ {
650
+ text: i18n('region.firstday.options.saturday'),
651
+ value: 6,
652
+ },
653
+ {
654
+ text: i18n('region.firstday.options.sunday'),
655
+ value: 0,
656
+ },
657
+ {
658
+ text: i18n('region.firstday.options.monday'),
659
+ value: 1,
660
+ },
661
+ ],
662
+ triggers: [
663
+ {
664
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
665
+ action: [
666
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').calendar.week.startsOn) }}`,
667
+ ],
668
+ },
669
+ ],
670
+ },
671
+ },
672
+ description: i18n('region.firstday.description'),
673
+ })
674
+ .addSetting({
675
+ key: AXPRegionalSetting.WeekendDays,
676
+ title: i18n('region.workdays.title'),
677
+ scope: 'T',
678
+ overridableAt: [],
679
+ isInherited: false,
680
+ defaultValue: defaultProfile.calendar.week.weekends,
681
+ widget: {
682
+ type: AXPWidgetsList.Editors.SelectionList,
683
+ options: {
684
+ multiple: true,
685
+ valueField: 'value',
686
+ textField: 'text',
687
+ dataSource: [
688
+ { text: i18n('region.workdays.options.monday'), value: 1 },
689
+ { text: i18n('region.workdays.options.tuesday'), value: 2 },
690
+ { text: i18n('region.workdays.options.wednesday'), value: 3 },
691
+ { text: i18n('region.workdays.options.thursday'), value: 4 },
692
+ { text: i18n('region.workdays.options.friday'), value: 5 },
693
+ { text: i18n('region.workdays.options.saturday'), value: 6 },
694
+ { text: i18n('region.workdays.options.sunday'), value: 0 },
695
+ ],
696
+ },
697
+ triggers: [
698
+ {
699
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
700
+ action: [
701
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').calendar.week.weekends) }}`,
702
+ ],
703
+ },
704
+ ],
705
+ },
706
+ description: i18n('region.workdays.description'),
707
+ })
708
+ .addSetting({
709
+ key: AXPRegionalSetting.MultiLanguageSupport,
710
+ title: i18n('region.multilanguage-support.title'),
711
+ scope: 'T',
712
+ overridableAt: [],
713
+ isInherited: true,
714
+ defaultValue: false,
715
+ widget: {
716
+ type: AXPWidgetsCatalog.toggle,
717
+ options: {
718
+ label: null,
719
+ },
720
+ },
721
+ description: i18n('region.multilanguage-support.description'),
722
+ })
723
+ // .addSetting({
724
+ // key: AXPRegionalSetting.ShortDate,
725
+ // title: i18n('region.shortdate.title'),
726
+ // scope: 'U',
727
+ // isInherited: true,
728
+ // defaultValue: defaultProfile.formats.date.medium,
729
+ // valueTransforms: objectKeyValueTransforms('value'),
730
+ // widget: {
731
+ // type: AXPWidgetsList.Editors.SelectBox,
732
+ // options: {
733
+ // valueField: 'value',
734
+ // textField: 'text',
735
+ // dataSource: await Promise.all(
736
+ // profiles.map(async (c) => ({
737
+ // text: `${c.formats.date.medium} (${await this.formatService.format(new Date(), 'datetime', { format: c.formats.date.medium })})`,
738
+ // value: c.formats.date.medium,
739
+ // })),
740
+ // ),
741
+ // },
742
+ // triggers: [
743
+ // {
744
+ // event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
745
+ // action: [
746
+ // `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').formats.date.short) }}`,
747
+ // ],
748
+ // },
749
+ // ],
750
+ // },
751
+ // description: i18n('region.shortdate.description'),
752
+ // })
753
+ // .addSetting({
754
+ // key: AXPRegionalSetting.LongDate,
755
+ // title: i18n('region.longdate.title'),
756
+ // scope: 'U',
757
+ // isInherited: true,
758
+ // defaultValue: defaultProfile.formats.date.long,
759
+ // valueTransforms: objectKeyValueTransforms('value'),
760
+ // widget: {
761
+ // type: AXPWidgetsList.Editors.SelectBox,
762
+ // options: {
763
+ // valueField: 'value',
764
+ // textField: 'text',
765
+ // dataSource: await Promise.all(
766
+ // profiles.map(async (c) => ({
767
+ // text: `${c.formats.date.long} (${await this.formatService.format(new Date(), 'datetime', { format: c.formats.date.long })})`,
768
+ // value: c.formats.date.long,
769
+ // })),
770
+ // ),
771
+ // },
772
+ // triggers: [
773
+ // {
774
+ // event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
775
+ // action: [
776
+ // `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').formats.date.long) }}`,
777
+ // ],
778
+ // },
779
+ // ],
780
+ // },
781
+ // description: i18n('region.longdate.description'),
782
+ // })
783
+ // .addSetting({
784
+ // key: AXPRegionalSetting.ShortTime,
785
+ // title: i18n('region.shorttime.title'),
786
+ // scope: 'U',
787
+ // isInherited: true,
788
+ // defaultValue: defaultProfile.formats.time.short,
789
+ // valueTransforms: objectKeyValueTransforms('value'),
790
+ // widget: {
791
+ // type: AXPWidgetsList.Editors.SelectBox,
792
+ // options: {
793
+ // valueField: 'value',
794
+ // textField: 'text',
795
+ // dataSource: await Promise.all(
796
+ // profiles.map(async (c) => ({
797
+ // text: `${c.formats.time.short} (${await this.formatService.format(new Date(), 'datetime', { format: c.formats.time.short })})`,
798
+ // value: c.formats.time.short,
799
+ // })),
800
+ // ),
801
+ // },
802
+ // triggers: [
803
+ // {
804
+ // event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
805
+ // action: [
806
+ // `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').formats.time.short) }}`,
807
+ // ],
808
+ // },
809
+ // ],
810
+ // },
811
+ // description: i18n('region.shorttime.description'),
812
+ // })
813
+ // .addSetting({
814
+ // key: AXPRegionalSetting.LongTime,
815
+ // title: i18n('region.longtime.title'),
816
+ // scope: 'U',
817
+ // isInherited: true,
818
+ // defaultValue: defaultProfile.formats.time.long,
819
+ // valueTransforms: objectKeyValueTransforms('value'),
820
+ // widget: {
821
+ // type: AXPWidgetsList.Editors.SelectBox,
822
+ // options: {
823
+ // valueField: 'value',
824
+ // textField: 'text',
825
+ // dataSource: await Promise.all(
826
+ // profiles.map(async (c) => ({
827
+ // text: `${c.formats.time.long} (${await this.formatService.format(new Date(), 'datetime', { format: c.formats.time.long })})`,
828
+ // value: c.formats.time.long,
829
+ // })),
830
+ // ),
831
+ // },
832
+ // triggers: [
833
+ // {
834
+ // event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
835
+ // action: [
836
+ // `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').formats.time.long) }}`,
837
+ // ],
838
+ // },
839
+ // ],
840
+ // },
841
+ // description: i18n('region.longtime.description'),
842
+ // })
843
+ .endSection()
844
+ // Unit Settings Section
845
+ .addSection('units', i18n('units.title'), i18n('units.description'))
846
+ .addSetting({
847
+ key: AXPRegionalSetting.TemperatureUnits,
848
+ title: i18n('units.temperature.title'),
849
+ scope: 'U',
850
+ overridableAt: [],
851
+ isInherited: true,
852
+ defaultValue: defaultProfile.units.temperature,
853
+ valueTransforms: objectKeyValueTransforms('value'),
854
+ widget: {
855
+ type: AXPWidgetsList.Editors.SelectBox,
856
+ options: {
857
+ valueField: 'value',
858
+ textField: 'text',
859
+ dataSource: profiles.map((c) => ({
860
+ text: i18n(`units.temperature.options.${c.units.temperature}`),
861
+ value: c.units.temperature,
862
+ })),
863
+ },
864
+ triggers: [
865
+ {
866
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
867
+ action: [
868
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').units.temperature) }}`,
869
+ ],
870
+ },
871
+ ],
872
+ },
873
+ description: i18n('units.temperature.description'),
874
+ })
875
+ .addSetting({
876
+ key: AXPRegionalSetting.DistanceUnits,
877
+ title: i18n('units.distance.title'),
878
+ scope: 'U',
879
+ overridableAt: [],
880
+ isInherited: true,
881
+ defaultValue: defaultProfile.units.distance,
882
+ valueTransforms: objectKeyValueTransforms('value'),
883
+ widget: {
884
+ type: AXPWidgetsList.Editors.SelectBox,
885
+ options: {
886
+ valueField: 'value',
887
+ textField: 'text',
888
+ dataSource: profiles.map((c) => ({
889
+ text: i18n(`units.distance.options.${c.units.distance}`),
890
+ value: c.units.distance,
891
+ })),
892
+ },
893
+ triggers: [
894
+ {
895
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
896
+ action: [
897
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').units.distance) }}`,
898
+ ],
899
+ },
900
+ ],
901
+ },
902
+ description: i18n('units.distance.description'),
903
+ })
904
+ .addSetting({
905
+ key: AXPRegionalSetting.WeightUnits,
906
+ title: i18n('units.weight.title'),
907
+ scope: 'U',
908
+ overridableAt: [],
909
+ isInherited: true,
910
+ defaultValue: defaultProfile.units.weight,
911
+ valueTransforms: objectKeyValueTransforms('value'),
912
+ widget: {
913
+ type: AXPWidgetsList.Editors.SelectBox,
914
+ options: {
915
+ valueField: 'value',
916
+ textField: 'text',
917
+ dataSource: profiles.map((c) => ({
918
+ text: i18n(`units.weight.options.${c.units.weight}`),
919
+ value: c.units.weight,
920
+ })),
921
+ },
922
+ triggers: [
923
+ {
924
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
925
+ action: [
926
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').units.weight) }}`,
927
+ ],
928
+ },
929
+ ],
930
+ },
931
+ description: i18n('units.weight.description'),
932
+ })
933
+ .addSetting({
934
+ key: AXPRegionalSetting.VolumeUnits,
935
+ title: i18n('units.volume.title'),
936
+ scope: 'U',
937
+ overridableAt: [],
938
+ isInherited: true,
939
+ defaultValue: defaultProfile.units.volume,
940
+ valueTransforms: objectKeyValueTransforms('value'),
941
+ widget: {
942
+ type: AXPWidgetsList.Editors.SelectBox,
943
+ options: {
944
+ valueField: 'value',
945
+ textField: 'text',
946
+ dataSource: [
947
+ { text: i18n('units.volume.options.liters'), value: 'liters' },
948
+ { text: i18n('units.volume.options.gallons'), value: 'gallons' },
949
+ ],
950
+ },
951
+ triggers: [
952
+ {
953
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
954
+ action: [
955
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').units.volume) }}`,
956
+ ],
957
+ },
958
+ ],
959
+ },
960
+ description: i18n('units.volume.description'),
961
+ })
962
+ .addSetting({
963
+ key: AXPRegionalSetting.SpeedUnits,
964
+ title: i18n('units.speed.title'),
965
+ scope: 'U',
966
+ overridableAt: [],
967
+ isInherited: true,
968
+ defaultValue: defaultProfile.units.speed,
969
+ valueTransforms: objectKeyValueTransforms('value'),
970
+ widget: {
971
+ type: AXPWidgetsList.Editors.SelectBox,
972
+ options: {
973
+ valueField: 'value',
974
+ textField: 'text',
975
+ dataSource: profiles.map((c) => ({
976
+ text: i18n(`units.speed.options.${c.units.speed}`),
977
+ value: c.units.speed,
978
+ })),
979
+ },
980
+ triggers: [
981
+ {
982
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
983
+ action: [
984
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').units.speed) }}`,
985
+ ],
986
+ },
987
+ ],
988
+ },
989
+ description: i18n('units.speed.description'),
990
+ })
991
+ .addSetting({
992
+ key: AXPRegionalSetting.AreaUnits,
993
+ title: i18n('units.area.title'),
994
+ scope: 'U',
995
+ overridableAt: [],
996
+ isInherited: true,
997
+ defaultValue: defaultProfile.units.area,
998
+ valueTransforms: objectKeyValueTransforms('value'),
999
+ widget: {
1000
+ type: AXPWidgetsList.Editors.SelectBox,
1001
+ options: {
1002
+ valueField: 'value',
1003
+ textField: 'text',
1004
+ dataSource: profiles.map((c) => ({
1005
+ text: i18n(`units.area.options.${c.units.area}`),
1006
+ value: c.units.area,
1007
+ })),
1008
+ },
1009
+ triggers: [
1010
+ {
1011
+ event: `{{ events.context('${AXPRegionalSetting.LocaleProfile}') }}`,
1012
+ action: [
1013
+ `{{ widget.setValue(widget.find('${AXPRegionalSetting.LocaleProfile}').output('item').units.area) }}`,
1014
+ ],
1015
+ },
1016
+ ],
1017
+ },
1018
+ description: i18n('units.area.description'),
1019
+ })
1020
+ .endSection()
1021
+ .endGroup();
1022
+ }
1023
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRegionalSettingProvider, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
1024
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRegionalSettingProvider }); }
1025
+ }
1026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRegionalSettingProvider, decorators: [{
1027
+ type: Injectable
1028
+ }], ctorParameters: () => [{ type: i0.Injector }] });
1029
+
1030
+ class AXMLocaleManagementSearchCommandProvider extends AXPSearchCommandProvider {
1031
+ constructor() {
1032
+ super(...arguments);
1033
+ this.commands = [
1034
+ {
1035
+ id: 'create-language',
1036
+ group: 'command',
1037
+ title: 'New Language',
1038
+ icon: RootConfig.entities.languages.icon,
1039
+ description: 'Create a new language with locales.',
1040
+ command: {
1041
+ name: 'Entity:Create',
1042
+ options: createEntityCommandOptions(`${RootConfig.module.name}.${RootConfig.entities.languages.name}`, {
1043
+ name: RootConfig.entities.languages.name,
1044
+ module: RootConfig.module.name,
1045
+ title: RootConfig.entities.languages.title,
1046
+ }),
1047
+ },
1048
+ },
1049
+ {
1050
+ id: 'create-timezone',
1051
+ group: 'command',
1052
+ title: 'New Timezone',
1053
+ icon: RootConfig.entities.timezones.icon,
1054
+ description: 'Create a new timezone definition.',
1055
+ command: {
1056
+ name: 'Entity:Create',
1057
+ options: createEntityCommandOptions(`${RootConfig.module.name}.${RootConfig.entities.timezones.name}`, {
1058
+ name: RootConfig.entities.timezones.name,
1059
+ module: RootConfig.module.name,
1060
+ title: RootConfig.entities.timezones.title,
1061
+ }),
1062
+ },
1063
+ },
1064
+ ];
1065
+ }
1066
+ }
1067
+
1068
+ //#region ---- Locale & regional context definitions ----
1069
+ class AXMLocaleManagementContextDefinitionProvider {
1070
+ async items() {
1071
+ return AXM_LOCALE_CONTEXT_DEFINITIONS;
1072
+ }
1073
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementContextDefinitionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1074
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementContextDefinitionProvider }); }
1075
+ }
1076
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementContextDefinitionProvider, decorators: [{
1077
+ type: Injectable
1078
+ }] });
1079
+
1080
+ /** Hide the header language switch when the tenant allow-list has at most one profile. */
1081
+ const LANGUAGE_SLOT_VISIBLE_WHEN_MULTIPLE = `{{ ((await settings.get('${AXPRegionalSetting.AvailableLanguages}')) || []).length > 1 }}`;
1082
+ class AXMLocaleManagementModule {
1083
+ constructor(appInitService, injector) {
1084
+ const service = injector.get(AXPRegionalStoreService);
1085
+ const platformSettingsLoadState = injector.get(AXPPlatformSettingsLoadState);
1086
+ appInitService.registerTask({
1087
+ name: 'regional-settings',
1088
+ statusText: '@locale-management:app-startup.applying-regional-settings',
1089
+ priority: AXP_APP_STARTUP_PRIORITY.regionalSettings,
1090
+ run: async () => {
1091
+ if (platformSettingsLoadState.hasFailure() ||
1092
+ platformSettingsLoadState.hasPendingOfflineContinue() ||
1093
+ platformSettingsLoadState.isOfflineMode()) {
1094
+ return;
1095
+ }
1096
+ await service.loadSetting();
1097
+ },
1098
+ });
1099
+ }
1100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementModule, deps: [{ token: i1$1.AXPAppStartUpService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.NgModule }); }
1101
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementModule, imports: [CommonModule, i1$1.AXPComponentSlotModule] }); }
1102
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementModule, providers: [
1103
+ {
1104
+ provide: AXP_LOCALE_MANAGEMENT_PORT,
1105
+ useExisting: AXMLocaleManagementService,
1106
+ },
1107
+ // Module-specific providers (not part of manifest system)
1108
+ {
1109
+ provide: AX_LOCALE_PROFILE_PROVIDERS,
1110
+ useClass: AXMLocaleProfileProviderService,
1111
+ multi: true,
1112
+ },
1113
+ {
1114
+ provide: AXCalendarService,
1115
+ useClass: AXPRegionalCalendarService,
1116
+ },
1117
+ // Module Manifest Provider
1118
+ {
1119
+ provide: AXP_MODULE_MANIFEST_PROVIDER,
1120
+ useValue: LocaleManagementManifest,
1121
+ multi: true,
1122
+ },
1123
+ // Provider references (now using tokens)
1124
+ {
1125
+ provide: AXP_PERMISSION_DEFINITION_PROVIDER,
1126
+ useClass: AXMLocaleManagementPermissionDefinitionProvider,
1127
+ multi: true,
1128
+ },
1129
+ {
1130
+ provide: AXP_MENU_PROVIDER,
1131
+ useClass: AXMLocaleManagementMenuProvider,
1132
+ multi: true,
1133
+ },
1134
+ {
1135
+ provide: AXP_SETTING_DEFINITION_PROVIDER,
1136
+ useClass: AXMRegionalSettingProvider,
1137
+ multi: true,
1138
+ },
1139
+ {
1140
+ provide: AXP_SEARCH_PROVIDER,
1141
+ useClass: AXMLocaleManagementSearchCommandProvider,
1142
+ multi: true,
1143
+ },
1144
+ provideQuerySetups([
1145
+ {
1146
+ key: 'LocaleManagement:ListLocaleProfiles',
1147
+ loader: () => import('./acorex-platform-module-locale-management-client-list-locale-profiles.query-D_PLL72r.mjs').then((c) => c.AXMListLocaleProfilesQuery),
1148
+ },
1149
+ {
1150
+ key: 'LocaleManagement:ListAvailableLocaleProfiles',
1151
+ loader: () => import('./acorex-platform-module-locale-management-client-list-available-locale-profiles.query-30KT5v3V.mjs').then((c) => c.AXMListAvailableLocaleProfilesQuery),
1152
+ },
1153
+ ]),
1154
+ {
1155
+ provide: AXP_CONTEXT_DEFINITION_PROVIDER,
1156
+ useClass: AXMLocaleManagementContextDefinitionProvider,
1157
+ multi: true,
1158
+ },
1159
+ ], imports: [CommonModule,
1160
+ AXPComponentSlotModule.forChild({
1161
+ 'root-header-end': [
1162
+ {
1163
+ name: 'language',
1164
+ component: AXMLanguageSlotComponent,
1165
+ condition: LANGUAGE_SLOT_VISIBLE_WHEN_MULTIPLE,
1166
+ },
1167
+ ],
1168
+ })] }); }
1169
+ }
1170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMLocaleManagementModule, decorators: [{
1171
+ type: NgModule,
1172
+ args: [{
1173
+ imports: [
1174
+ CommonModule,
1175
+ AXPComponentSlotModule.forChild({
1176
+ 'root-header-end': [
1177
+ {
1178
+ name: 'language',
1179
+ component: AXMLanguageSlotComponent,
1180
+ condition: LANGUAGE_SLOT_VISIBLE_WHEN_MULTIPLE,
1181
+ },
1182
+ ],
1183
+ }),
1184
+ ],
1185
+ providers: [
1186
+ {
1187
+ provide: AXP_LOCALE_MANAGEMENT_PORT,
1188
+ useExisting: AXMLocaleManagementService,
1189
+ },
1190
+ // Module-specific providers (not part of manifest system)
1191
+ {
1192
+ provide: AX_LOCALE_PROFILE_PROVIDERS,
1193
+ useClass: AXMLocaleProfileProviderService,
1194
+ multi: true,
1195
+ },
1196
+ {
1197
+ provide: AXCalendarService,
1198
+ useClass: AXPRegionalCalendarService,
1199
+ },
1200
+ // Module Manifest Provider
1201
+ {
1202
+ provide: AXP_MODULE_MANIFEST_PROVIDER,
1203
+ useValue: LocaleManagementManifest,
1204
+ multi: true,
1205
+ },
1206
+ // Provider references (now using tokens)
1207
+ {
1208
+ provide: AXP_PERMISSION_DEFINITION_PROVIDER,
1209
+ useClass: AXMLocaleManagementPermissionDefinitionProvider,
1210
+ multi: true,
1211
+ },
1212
+ {
1213
+ provide: AXP_MENU_PROVIDER,
1214
+ useClass: AXMLocaleManagementMenuProvider,
1215
+ multi: true,
1216
+ },
1217
+ {
1218
+ provide: AXP_SETTING_DEFINITION_PROVIDER,
1219
+ useClass: AXMRegionalSettingProvider,
1220
+ multi: true,
1221
+ },
1222
+ {
1223
+ provide: AXP_SEARCH_PROVIDER,
1224
+ useClass: AXMLocaleManagementSearchCommandProvider,
1225
+ multi: true,
1226
+ },
1227
+ provideQuerySetups([
1228
+ {
1229
+ key: 'LocaleManagement:ListLocaleProfiles',
1230
+ loader: () => import('./acorex-platform-module-locale-management-client-list-locale-profiles.query-D_PLL72r.mjs').then((c) => c.AXMListLocaleProfilesQuery),
1231
+ },
1232
+ {
1233
+ key: 'LocaleManagement:ListAvailableLocaleProfiles',
1234
+ loader: () => import('./acorex-platform-module-locale-management-client-list-available-locale-profiles.query-30KT5v3V.mjs').then((c) => c.AXMListAvailableLocaleProfilesQuery),
1235
+ },
1236
+ ]),
1237
+ {
1238
+ provide: AXP_CONTEXT_DEFINITION_PROVIDER,
1239
+ useClass: AXMLocaleManagementContextDefinitionProvider,
1240
+ multi: true,
1241
+ },
1242
+ ],
1243
+ }]
1244
+ }], ctorParameters: () => [{ type: i1$1.AXPAppStartUpService }, { type: i0.Injector }] });
1245
+
1246
+ /**
1247
+ * Generated bundle index. Do not edit.
1248
+ */
1249
+
1250
+ export { AXMLocaleManagementMenuProvider, AXMLocaleManagementModule, AXMLocaleManagementPermissionDefinitionProvider, AXMLocaleManagementSearchCommandProvider, AXMLocaleManagementService, AXMLocaleProfileProviderService };
1251
+ //# sourceMappingURL=acorex-platform-module-locale-management-client.mjs.map