@acorex/modules 19.0.0 → 19.0.1

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.
@@ -1,8 +1,8 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, Injector, Injectable, signal, Component, NgModule } from '@angular/core';
3
1
  import * as i1$1 from '@acorex/platform/common';
4
- import { AXMEntityCrudServiceImpl, AXPEntityQueryType, AXPEntityCommandScope, AXPSettingsService, AXPDataGenerator, AXP_MENU_PROVIDER, AXPComponentSlotModule } from '@acorex/platform/common';
2
+ import { AXMEntityCrudServiceImpl, AXPDataGenerator, AXPEntityQueryType, AXPEntityCommandScope, AXPSettingsService, AXP_MENU_PROVIDER, AXPComponentSlotModule } from '@acorex/platform/common';
5
3
  import { AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
4
+ import * as i0 from '@angular/core';
5
+ import { Injectable, inject, Injector, signal, Component, NgModule } from '@angular/core';
6
6
  import { AXPEntityService, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
7
7
  import * as i3 from '@acorex/components/button';
8
8
  import { AXButtonModule } from '@acorex/components/button';
@@ -24,69 +24,39 @@ const AXMLocalizationManagementModuleConst = {
24
24
  cultureEntity: 'culture',
25
25
  };
26
26
 
27
- class AXMLocalizationManagementModuleEntityLoader {
28
- constructor() {
29
- this.injector = inject(Injector);
30
- }
31
- async get(moduleName, entityName) {
32
- return new Promise(async (resolve) => {
33
- switch (entityName) {
34
- case AXMLocalizationManagementModuleConst.languageEntity: {
35
- const entity = (await Promise.resolve().then(function () { return language_entity; })).languageEntityFactory;
36
- resolve(entity(this.injector));
37
- break;
38
- }
39
- case AXMLocalizationManagementModuleConst.timeZoneEntity: {
40
- const entity = (await Promise.resolve().then(function () { return timeZone_entity; })).timeZoneEntityFactory;
41
- resolve(entity(this.injector));
42
- break;
43
- }
44
- case AXMLocalizationManagementModuleConst.cultureEntity: {
45
- const entity = (await Promise.resolve().then(function () { return culture_entity; })).cultureEntityFactory;
46
- resolve(entity(this.injector));
47
- break;
48
- }
49
- default:
50
- resolve(null);
51
- }
52
- });
53
- }
54
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLocalizationManagementModuleEntityLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
55
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLocalizationManagementModuleEntityLoader }); }
56
- }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLocalizationManagementModuleEntityLoader, decorators: [{
58
- type: Injectable
59
- }] });
27
+ const LANGUAGE_SOURCE_NAME = 'localization-management.language';
28
+ const TIMEZONE_SOURCE_NAME = 'localization-management.timeZone';
29
+ const CULTURE_SOURCE_NAME = 'localization-management.culture';
60
30
 
61
- class AXMLanguageService extends AXMEntityCrudServiceImpl {
31
+ class AXMCultureService extends AXMEntityCrudServiceImpl {
62
32
  }
63
- class AXMLanguageServiceImpl extends AXMEntityCrudServiceImpl {
33
+ class AXMCultureServiceImpl extends AXMEntityCrudServiceImpl {
64
34
  constructor() {
65
- super(`${AXMLocalizationManagementModuleConst.moduleName}.${AXMLocalizationManagementModuleConst.languageEntity}`);
35
+ super(CULTURE_SOURCE_NAME);
66
36
  }
67
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
68
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageServiceImpl }); }
37
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCultureServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
38
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCultureServiceImpl }); }
69
39
  }
70
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageServiceImpl, decorators: [{
40
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCultureServiceImpl, decorators: [{
71
41
  type: Injectable
72
42
  }], ctorParameters: () => [] });
73
43
 
74
- async function languageEntityFactory(injector) {
75
- const dataService = injector.get(AXMLanguageService);
44
+ async function cultureEntityFactory(injector) {
45
+ const dataService = injector.get(AXMCultureService);
76
46
  const entityDef = {
77
47
  module: 'localization-management',
78
- name: 'language',
79
- source: 'localizationManagement.language',
80
- title: 'Language',
48
+ name: 'culture',
49
+ source: 'localizationManagement.culture',
50
+ title: 'Culture',
81
51
  formats: {
82
- individual: 'Language',
83
- plural: 'Languages',
52
+ individual: 'Culture',
53
+ plural: 'Cultures',
84
54
  },
85
55
  relatedEntities: [],
86
56
  groups: [
87
57
  {
88
- id: 'language',
89
- title: 'Language',
58
+ id: 'culture',
59
+ title: 'Culture',
90
60
  },
91
61
  ],
92
62
  properties: [
@@ -127,7 +97,9 @@ async function languageEntityFactory(injector) {
127
97
  commands: {
128
98
  create: {
129
99
  execute: async (data) => {
130
- return Promise.resolve(dataService.insertOne(data));
100
+ const entity = Object.assign(data, { id: AXPDataGenerator.uuid() });
101
+ dataService.insertOne(entity);
102
+ return Promise.resolve(entity);
131
103
  },
132
104
  },
133
105
  delete: {
@@ -305,140 +277,81 @@ async function languageEntityFactory(injector) {
305
277
  return entityDef;
306
278
  }
307
279
 
308
- var language_entity = /*#__PURE__*/Object.freeze({
280
+ var culture_entity = /*#__PURE__*/Object.freeze({
309
281
  __proto__: null,
310
- languageEntityFactory: languageEntityFactory
282
+ cultureEntityFactory: cultureEntityFactory
311
283
  });
312
284
 
313
- const LANGUAGE_VARIANT_KEY = 'localization:language';
314
- // ThemeStore - Manages theme settings and system changes
315
- const AXPLocalizationStoreService = signalStore({ providedIn: 'root' },
316
- // Initial State
317
- withState((translationService = inject(AXTranslationService)) => {
318
- const state = {
319
- language: translationService.getDefaultLang(),
320
- };
321
- return state;
322
- }),
323
- // Computed Signals
324
- // withComputed(({ }) => ({
325
- // })),
326
- // Methods for State Management
327
- withMethods((store, settingService = inject(AXPSettingsService), translationService = inject(AXTranslationService)) => {
328
- return {
329
- changeLanguage(lang) {
330
- settingService.set(LANGUAGE_VARIANT_KEY, lang);
331
- translationService.setActiveLang(lang);
332
- patchState(store, { language: lang });
333
- },
334
- async loadSetting() {
335
- const lang = (await settingService.get(LANGUAGE_VARIANT_KEY)) ?? translationService.getDefaultLang();
336
- settingService.set(LANGUAGE_VARIANT_KEY, lang);
337
- translationService.setActiveLang(lang);
338
- patchState(store, { language: lang });
339
- },
340
- };
341
- }));
342
-
343
- class AXMLanguageSlotComponent {
285
+ class AXMLocalizationManagementModuleEntityLoader {
344
286
  constructor() {
345
- this.languageService = inject(AXMLanguageService);
346
- this.store = inject(AXPLocalizationStoreService);
347
- this.items = signal([]);
287
+ this.injector = inject(Injector);
348
288
  }
349
- async ngOnInit() {
350
- const items = (await this.languageService.query()).items.map(c => ({ code: c.code, title: c.title }));
351
- this.items.set(items);
289
+ async get(moduleName, entityName) {
290
+ return new Promise(async (resolve) => {
291
+ switch (entityName) {
292
+ case AXMLocalizationManagementModuleConst.languageEntity: {
293
+ const entity = (await Promise.resolve().then(function () { return language_entity; })).languageEntityFactory;
294
+ resolve(entity(this.injector));
295
+ break;
296
+ }
297
+ case AXMLocalizationManagementModuleConst.timeZoneEntity: {
298
+ const entity = (await Promise.resolve().then(function () { return timeZone_entity; })).timeZoneEntityFactory;
299
+ resolve(entity(this.injector));
300
+ break;
301
+ }
302
+ case AXMLocalizationManagementModuleConst.cultureEntity: {
303
+ const entity = (await Promise.resolve().then(function () { return culture_entity; })).cultureEntityFactory;
304
+ resolve(entity(this.injector));
305
+ break;
306
+ }
307
+ default:
308
+ resolve(null);
309
+ }
310
+ });
352
311
  }
353
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
354
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AXMLanguageSlotComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<ax-button look=\"blank\">\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 [text]=\"lang.title\" [selected]=\"store.language()===lang.code\"\n (onClick)=\"store.changeLanguage(lang.code)\">\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>", dependencies: [{ kind: "ngmodule", type: AXDropdownModule }, { kind: "component", type: i1.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "_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-sub-title, 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", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "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"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: CommonModule }] }); }
312
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLocalizationManagementModuleEntityLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
313
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLocalizationManagementModuleEntityLoader }); }
355
314
  }
356
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageSlotComponent, decorators: [{
357
- type: Component,
358
- args: [{ imports: [AXDropdownModule, AXDecoratorModule, AXPopoverModule, AXButtonModule, CommonModule], template: "<ax-button look=\"blank\">\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 [text]=\"lang.title\" [selected]=\"store.language()===lang.code\"\n (onClick)=\"store.changeLanguage(lang.code)\">\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>" }]
315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLocalizationManagementModuleEntityLoader, decorators: [{
316
+ type: Injectable
359
317
  }] });
360
318
 
361
- class AXMLocalizationManagementModuleMenuProvider {
362
- constructor() {
363
- this.entityService = inject(AXPEntityService);
364
- }
365
- async provide(context) {
366
- const scope = AXMLocalizationManagementModuleConst.i18n;
367
- const moduleName = AXMLocalizationManagementModuleConst.moduleName;
368
- context.addItems([
369
- {
370
- text: `t('module-name', {scope: "${scope}"})`,
371
- icon: 'fa-solid fa-globe-stand',
372
- type: 'menu',
373
- priority: 9100,
374
- data: {
375
- // requiredPermission: 'demo.admin.settings',
376
- },
377
- children: [
378
- {
379
- priority: 9001,
380
- icon: 'fa-solid fa-language',
381
- text: `t('language-definition', {scope: "${scope}"})`,
382
- path: this.entityService.createPath(moduleName, AXMLocalizationManagementModuleConst.languageEntity),
383
- },
384
- {
385
- priority: 9003,
386
- icon: 'fa-solid fa-clock-one-thirty',
387
- text: `t('time-zone', {scope: "${scope}"})`,
388
- path: this.entityService.createPath(moduleName, AXMLocalizationManagementModuleConst.timeZoneEntity),
389
- },
390
- {
391
- priority: 9003,
392
- icon: 'fa-solid fa-mountain-sun',
393
- text: `t('culture', {scope: "${scope}"})`,
394
- path: this.entityService.createPath(moduleName, AXMLocalizationManagementModuleConst.cultureEntity),
395
- },
396
- ],
397
- },
398
- ]);
399
- }
400
- }
401
-
402
- const LANGUAGE_SOURCE_NAME = 'localization-management.language';
403
- const TIMEZONE_SOURCE_NAME = 'localization-management.timeZone';
404
- const CULTURE_SOURCE_NAME = 'localization-management.culture';
405
-
406
- class AXMTimeZoneService extends AXMEntityCrudServiceImpl {
319
+ class AXMLanguageService extends AXMEntityCrudServiceImpl {
407
320
  }
408
- class AXMTimeZoneServiceImpl extends AXMEntityCrudServiceImpl {
321
+ class AXMLanguageServiceImpl extends AXMEntityCrudServiceImpl {
409
322
  constructor() {
410
- super(TIMEZONE_SOURCE_NAME);
323
+ super(`${AXMLocalizationManagementModuleConst.moduleName}.${AXMLocalizationManagementModuleConst.languageEntity}`);
411
324
  }
412
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMTimeZoneServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
413
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMTimeZoneServiceImpl }); }
325
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
326
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageServiceImpl }); }
414
327
  }
415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMTimeZoneServiceImpl, decorators: [{
328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageServiceImpl, decorators: [{
416
329
  type: Injectable
417
330
  }], ctorParameters: () => [] });
418
331
 
419
- async function timeZoneEntityFactory(injector) {
420
- const dataService = injector.get(AXMTimeZoneService);
332
+ async function languageEntityFactory(injector) {
333
+ const dataService = injector.get(AXMLanguageService);
421
334
  const entityDef = {
422
335
  module: 'localization-management',
423
- name: 'time-zone',
424
- source: 'localizationManagement.timeZone',
425
- title: 'Time Zone',
336
+ name: 'language',
337
+ source: 'localizationManagement.language',
338
+ title: 'Language',
426
339
  formats: {
427
- individual: 'Time Zone',
428
- plural: 'Time Zones',
340
+ individual: 'Language',
341
+ plural: 'Languages',
429
342
  },
430
343
  relatedEntities: [],
431
344
  groups: [
432
345
  {
433
- id: 'section',
434
- title: 'Time Zone',
346
+ id: 'language',
347
+ title: 'Language',
435
348
  },
436
349
  ],
437
350
  properties: [
438
351
  {
439
352
  name: 'title',
440
353
  title: 'Title',
441
- groupId: 'section',
354
+ groupId: 'language',
442
355
  schema: {
443
356
  dataType: 'string',
444
357
  interface: {
@@ -452,9 +365,9 @@ async function timeZoneEntityFactory(injector) {
452
365
  ],
453
366
  },
454
367
  {
455
- name: 'name',
456
- title: 'Name',
457
- groupId: 'section',
368
+ name: 'code',
369
+ title: 'Code',
370
+ groupId: 'language',
458
371
  schema: {
459
372
  dataType: 'string',
460
373
  interface: {
@@ -467,86 +380,28 @@ async function timeZoneEntityFactory(injector) {
467
380
  },
468
381
  ],
469
382
  },
470
- {
471
- name: 'gmtOffset',
472
- title: 'GMT Offset',
473
- groupId: 'section',
474
- schema: {
475
- dataType: 'integer',
476
- interface: {
477
- type: AXPWidgetsCatalog.text,
478
- },
479
- },
480
- validations: [
481
- {
482
- rule: 'required',
483
- },
484
- ],
485
- },
486
- {
487
- name: 'gmtOffsetName',
488
- title: 'GMT',
489
- groupId: 'section',
490
- schema: {
491
- dataType: 'string',
492
- interface: {
493
- type: AXPWidgetsCatalog.text,
494
- },
495
- },
496
- validations: [
497
- {
498
- rule: 'required',
499
- },
500
- ],
501
- },
502
- {
503
- name: 'abbreviation',
504
- title: 'Abbreviation',
505
- groupId: 'section',
506
- schema: {
507
- dataType: 'string',
508
- interface: {
509
- type: AXPWidgetsCatalog.text,
510
- },
511
- },
512
- validations: [
513
- {
514
- rule: 'required',
515
- },
516
- ],
517
- },
518
- {
519
- name: 'tzName',
520
- title: 'TZ',
521
- groupId: 'section',
522
- schema: {
523
- dataType: 'string',
524
- interface: {
525
- type: AXPWidgetsCatalog.text,
526
- },
527
- },
528
- validations: [
529
- {
530
- rule: 'required',
531
- },
532
- ],
533
- },
534
- ],
535
- columns: [{ name: 'title' }, { name: 'gmtOffsetName' }, { name: 'abbreviation' }, { name: 'tzName' }],
536
- commands: {
537
- create: {
538
- execute: async (data) => {
539
- return Promise.resolve({});
383
+ ],
384
+ columns: [{ name: 'title' }, { name: 'code' }],
385
+ commands: {
386
+ create: {
387
+ execute: async (data) => {
388
+ return Promise.resolve(dataService.insertOne(data));
540
389
  },
541
390
  },
542
391
  delete: {
543
392
  execute: async (id) => {
393
+ await await dataService.deleteOne(id);
544
394
  return Promise.resolve();
545
395
  },
546
396
  },
547
397
  update: {
548
398
  execute: async (data) => {
549
- return Promise.resolve();
399
+ return new Promise((resolve) => {
400
+ setTimeout(async () => {
401
+ await dataService.updateOne(data.id, data);
402
+ resolve(data);
403
+ }, 1000);
404
+ });
550
405
  },
551
406
  },
552
407
  },
@@ -571,16 +426,15 @@ async function timeZoneEntityFactory(injector) {
571
426
  },
572
427
  interfaces: {
573
428
  master: {
574
- single: {
575
- title: '{{title}}',
429
+ create: {
576
430
  sections: [
577
431
  {
578
- id: 'section',
432
+ id: 'language',
579
433
  },
580
434
  ],
581
435
  properties: [
582
436
  {
583
- name: 'name',
437
+ name: 'title',
584
438
  layout: {
585
439
  positions: {
586
440
  lg: {
@@ -590,7 +444,7 @@ async function timeZoneEntityFactory(injector) {
590
444
  },
591
445
  },
592
446
  {
593
- name: 'title',
447
+ name: 'code',
594
448
  layout: {
595
449
  positions: {
596
450
  lg: {
@@ -599,8 +453,17 @@ async function timeZoneEntityFactory(injector) {
599
453
  },
600
454
  },
601
455
  },
456
+ ],
457
+ },
458
+ update: {
459
+ sections: [
602
460
  {
603
- name: 'gmtOffset',
461
+ id: 'language',
462
+ },
463
+ ],
464
+ properties: [
465
+ {
466
+ name: 'title',
604
467
  layout: {
605
468
  positions: {
606
469
  lg: {
@@ -610,7 +473,7 @@ async function timeZoneEntityFactory(injector) {
610
473
  },
611
474
  },
612
475
  {
613
- name: 'gmtOffsetName',
476
+ name: 'code',
614
477
  layout: {
615
478
  positions: {
616
479
  lg: {
@@ -619,8 +482,18 @@ async function timeZoneEntityFactory(injector) {
619
482
  },
620
483
  },
621
484
  },
485
+ ],
486
+ },
487
+ single: {
488
+ title: '{{title}}',
489
+ sections: [
490
+ {
491
+ id: 'language',
492
+ },
493
+ ],
494
+ properties: [
622
495
  {
623
- name: 'abbreviation',
496
+ name: 'title',
624
497
  layout: {
625
498
  positions: {
626
499
  lg: {
@@ -630,7 +503,7 @@ async function timeZoneEntityFactory(injector) {
630
503
  },
631
504
  },
632
505
  {
633
- name: 'tzName',
506
+ name: 'code',
634
507
  layout: {
635
508
  positions: {
636
509
  lg: {
@@ -644,6 +517,20 @@ async function timeZoneEntityFactory(injector) {
644
517
  },
645
518
  list: {
646
519
  actions: [
520
+ {
521
+ title: 'Create New',
522
+ command: 'create-entity',
523
+ priority: 'primary',
524
+ type: 'create',
525
+ scope: AXPEntityCommandScope.TypeLevel,
526
+ },
527
+ {
528
+ title: 'Delete Items',
529
+ command: 'delete-entity',
530
+ priority: 'primary',
531
+ type: 'delete',
532
+ scope: AXPEntityCommandScope.Selected,
533
+ },
647
534
  {
648
535
  title: 'Details',
649
536
  command: 'open-entity',
@@ -651,6 +538,13 @@ async function timeZoneEntityFactory(injector) {
651
538
  type: 'view',
652
539
  scope: AXPEntityCommandScope.Individual,
653
540
  },
541
+ {
542
+ title: 'Delete',
543
+ command: 'delete-entity',
544
+ priority: 'secondary',
545
+ type: 'delete',
546
+ scope: AXPEntityCommandScope.Individual,
547
+ },
654
548
  ],
655
549
  views: [
656
550
  {
@@ -669,47 +563,136 @@ async function timeZoneEntityFactory(injector) {
669
563
  return entityDef;
670
564
  }
671
565
 
672
- var timeZone_entity = /*#__PURE__*/Object.freeze({
566
+ var language_entity = /*#__PURE__*/Object.freeze({
673
567
  __proto__: null,
674
- timeZoneEntityFactory: timeZoneEntityFactory
568
+ languageEntityFactory: languageEntityFactory
675
569
  });
676
570
 
677
- class AXMCultureService extends AXMEntityCrudServiceImpl {
571
+ const LANGUAGE_VARIANT_KEY = 'localization:language';
572
+ // ThemeStore - Manages theme settings and system changes
573
+ const AXPLocalizationStoreService = signalStore({ providedIn: 'root' },
574
+ // Initial State
575
+ withState((translationService = inject(AXTranslationService)) => {
576
+ const state = {
577
+ language: translationService.getDefaultLang(),
578
+ };
579
+ return state;
580
+ }),
581
+ // Computed Signals
582
+ // withComputed(({ }) => ({
583
+ // })),
584
+ // Methods for State Management
585
+ withMethods((store, settingService = inject(AXPSettingsService), translationService = inject(AXTranslationService)) => {
586
+ return {
587
+ changeLanguage(lang) {
588
+ settingService.set(LANGUAGE_VARIANT_KEY, lang);
589
+ translationService.setActiveLang(lang);
590
+ patchState(store, { language: lang });
591
+ },
592
+ async loadSetting() {
593
+ const lang = (await settingService.get(LANGUAGE_VARIANT_KEY)) ?? translationService.getDefaultLang();
594
+ settingService.set(LANGUAGE_VARIANT_KEY, lang);
595
+ translationService.setActiveLang(lang);
596
+ patchState(store, { language: lang });
597
+ },
598
+ };
599
+ }));
600
+
601
+ class AXMLanguageSlotComponent {
602
+ constructor() {
603
+ this.languageService = inject(AXMLanguageService);
604
+ this.store = inject(AXPLocalizationStoreService);
605
+ this.items = signal([]);
606
+ }
607
+ async ngOnInit() {
608
+ const items = (await this.languageService.query()).items.map(c => ({ code: c.code, title: c.title }));
609
+ this.items.set(items);
610
+ }
611
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
612
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AXMLanguageSlotComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<ax-button look=\"blank\">\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 [text]=\"lang.title\" [selected]=\"store.language()===lang.code\"\n (onClick)=\"store.changeLanguage(lang.code)\">\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>", dependencies: [{ kind: "ngmodule", type: AXDropdownModule }, { kind: "component", type: i1.AXDropdownPanelComponent, selector: "ax-dropdown-panel", inputs: ["isOpen", "fitParent", "dropdownWidth", "position", "_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-sub-title, 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", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "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"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: CommonModule }] }); }
678
613
  }
679
- class AXMCultureServiceImpl extends AXMEntityCrudServiceImpl {
614
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMLanguageSlotComponent, decorators: [{
615
+ type: Component,
616
+ args: [{ imports: [AXDropdownModule, AXDecoratorModule, AXPopoverModule, AXButtonModule, CommonModule], template: "<ax-button look=\"blank\">\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 [text]=\"lang.title\" [selected]=\"store.language()===lang.code\"\n (onClick)=\"store.changeLanguage(lang.code)\">\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>" }]
617
+ }] });
618
+
619
+ class AXMLocalizationManagementModuleMenuProvider {
680
620
  constructor() {
681
- super(CULTURE_SOURCE_NAME);
621
+ this.entityService = inject(AXPEntityService);
622
+ }
623
+ async provide(context) {
624
+ const scope = AXMLocalizationManagementModuleConst.i18n;
625
+ const moduleName = AXMLocalizationManagementModuleConst.moduleName;
626
+ context.addItems([
627
+ {
628
+ text: `t('module-name', {scope: "${scope}"})`,
629
+ icon: 'fa-solid fa-globe-stand',
630
+ type: 'menu',
631
+ priority: 9100,
632
+ data: {
633
+ // requiredPermission: 'demo.admin.settings',
634
+ },
635
+ children: [
636
+ {
637
+ priority: 9001,
638
+ icon: 'fa-solid fa-language',
639
+ text: `t('language-definition', {scope: "${scope}"})`,
640
+ path: this.entityService.createPath(moduleName, AXMLocalizationManagementModuleConst.languageEntity),
641
+ },
642
+ {
643
+ priority: 9003,
644
+ icon: 'fa-solid fa-clock-one-thirty',
645
+ text: `t('time-zone', {scope: "${scope}"})`,
646
+ path: this.entityService.createPath(moduleName, AXMLocalizationManagementModuleConst.timeZoneEntity),
647
+ },
648
+ {
649
+ priority: 9003,
650
+ icon: 'fa-solid fa-mountain-sun',
651
+ text: `t('culture', {scope: "${scope}"})`,
652
+ path: this.entityService.createPath(moduleName, AXMLocalizationManagementModuleConst.cultureEntity),
653
+ },
654
+ ],
655
+ },
656
+ ]);
682
657
  }
683
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCultureServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
684
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCultureServiceImpl }); }
685
658
  }
686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCultureServiceImpl, decorators: [{
659
+
660
+ class AXMTimeZoneService extends AXMEntityCrudServiceImpl {
661
+ }
662
+ class AXMTimeZoneServiceImpl extends AXMEntityCrudServiceImpl {
663
+ constructor() {
664
+ super(TIMEZONE_SOURCE_NAME);
665
+ }
666
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMTimeZoneServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
667
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMTimeZoneServiceImpl }); }
668
+ }
669
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMTimeZoneServiceImpl, decorators: [{
687
670
  type: Injectable
688
671
  }], ctorParameters: () => [] });
689
672
 
690
- async function cultureEntityFactory(injector) {
691
- const dataService = injector.get(AXMCultureService);
673
+ async function timeZoneEntityFactory(injector) {
674
+ const dataService = injector.get(AXMTimeZoneService);
692
675
  const entityDef = {
693
676
  module: 'localization-management',
694
- name: 'culture',
695
- source: 'localizationManagement.culture',
696
- title: 'Culture',
677
+ name: 'time-zone',
678
+ source: 'localizationManagement.timeZone',
679
+ title: 'Time Zone',
697
680
  formats: {
698
- individual: 'Culture',
699
- plural: 'Cultures',
681
+ individual: 'Time Zone',
682
+ plural: 'Time Zones',
700
683
  },
701
684
  relatedEntities: [],
702
685
  groups: [
703
686
  {
704
- id: 'culture',
705
- title: 'Culture',
687
+ id: 'section',
688
+ title: 'Time Zone',
706
689
  },
707
690
  ],
708
691
  properties: [
709
692
  {
710
693
  name: 'title',
711
694
  title: 'Title',
712
- groupId: 'language',
695
+ groupId: 'section',
713
696
  schema: {
714
697
  dataType: 'string',
715
698
  interface: {
@@ -723,9 +706,73 @@ async function cultureEntityFactory(injector) {
723
706
  ],
724
707
  },
725
708
  {
726
- name: 'code',
727
- title: 'Code',
728
- groupId: 'language',
709
+ name: 'name',
710
+ title: 'Name',
711
+ groupId: 'section',
712
+ schema: {
713
+ dataType: 'string',
714
+ interface: {
715
+ type: AXPWidgetsCatalog.text,
716
+ },
717
+ },
718
+ validations: [
719
+ {
720
+ rule: 'required',
721
+ },
722
+ ],
723
+ },
724
+ {
725
+ name: 'gmtOffset',
726
+ title: 'GMT Offset',
727
+ groupId: 'section',
728
+ schema: {
729
+ dataType: 'integer',
730
+ interface: {
731
+ type: AXPWidgetsCatalog.text,
732
+ },
733
+ },
734
+ validations: [
735
+ {
736
+ rule: 'required',
737
+ },
738
+ ],
739
+ },
740
+ {
741
+ name: 'gmtOffsetName',
742
+ title: 'GMT',
743
+ groupId: 'section',
744
+ schema: {
745
+ dataType: 'string',
746
+ interface: {
747
+ type: AXPWidgetsCatalog.text,
748
+ },
749
+ },
750
+ validations: [
751
+ {
752
+ rule: 'required',
753
+ },
754
+ ],
755
+ },
756
+ {
757
+ name: 'abbreviation',
758
+ title: 'Abbreviation',
759
+ groupId: 'section',
760
+ schema: {
761
+ dataType: 'string',
762
+ interface: {
763
+ type: AXPWidgetsCatalog.text,
764
+ },
765
+ },
766
+ validations: [
767
+ {
768
+ rule: 'required',
769
+ },
770
+ ],
771
+ },
772
+ {
773
+ name: 'tzName',
774
+ title: 'TZ',
775
+ groupId: 'section',
729
776
  schema: {
730
777
  dataType: 'string',
731
778
  interface: {
@@ -739,29 +786,21 @@ async function cultureEntityFactory(injector) {
739
786
  ],
740
787
  },
741
788
  ],
742
- columns: [{ name: 'title' }, { name: 'code' }],
789
+ columns: [{ name: 'title' }, { name: 'gmtOffsetName' }, { name: 'abbreviation' }, { name: 'tzName' }],
743
790
  commands: {
744
791
  create: {
745
792
  execute: async (data) => {
746
- const entity = Object.assign(data, { id: AXPDataGenerator.uuid() });
747
- dataService.insertOne(entity);
748
- return Promise.resolve(entity);
793
+ return Promise.resolve({});
749
794
  },
750
795
  },
751
796
  delete: {
752
797
  execute: async (id) => {
753
- await await dataService.deleteOne(id);
754
798
  return Promise.resolve();
755
799
  },
756
800
  },
757
801
  update: {
758
802
  execute: async (data) => {
759
- return new Promise((resolve) => {
760
- setTimeout(async () => {
761
- await dataService.updateOne(data.id, data);
762
- resolve(data);
763
- }, 1000);
764
- });
803
+ return Promise.resolve();
765
804
  },
766
805
  },
767
806
  },
@@ -786,15 +825,16 @@ async function cultureEntityFactory(injector) {
786
825
  },
787
826
  interfaces: {
788
827
  master: {
789
- create: {
828
+ single: {
829
+ title: '{{title}}',
790
830
  sections: [
791
831
  {
792
- id: 'language',
832
+ id: 'section',
793
833
  },
794
834
  ],
795
835
  properties: [
796
836
  {
797
- name: 'title',
837
+ name: 'name',
798
838
  layout: {
799
839
  positions: {
800
840
  lg: {
@@ -804,7 +844,7 @@ async function cultureEntityFactory(injector) {
804
844
  },
805
845
  },
806
846
  {
807
- name: 'code',
847
+ name: 'title',
808
848
  layout: {
809
849
  positions: {
810
850
  lg: {
@@ -813,17 +853,8 @@ async function cultureEntityFactory(injector) {
813
853
  },
814
854
  },
815
855
  },
816
- ],
817
- },
818
- update: {
819
- sections: [
820
- {
821
- id: 'language',
822
- },
823
- ],
824
- properties: [
825
856
  {
826
- name: 'title',
857
+ name: 'gmtOffset',
827
858
  layout: {
828
859
  positions: {
829
860
  lg: {
@@ -833,7 +864,7 @@ async function cultureEntityFactory(injector) {
833
864
  },
834
865
  },
835
866
  {
836
- name: 'code',
867
+ name: 'gmtOffsetName',
837
868
  layout: {
838
869
  positions: {
839
870
  lg: {
@@ -842,18 +873,8 @@ async function cultureEntityFactory(injector) {
842
873
  },
843
874
  },
844
875
  },
845
- ],
846
- },
847
- single: {
848
- title: '{{title}}',
849
- sections: [
850
- {
851
- id: 'language',
852
- },
853
- ],
854
- properties: [
855
876
  {
856
- name: 'title',
877
+ name: 'abbreviation',
857
878
  layout: {
858
879
  positions: {
859
880
  lg: {
@@ -863,7 +884,7 @@ async function cultureEntityFactory(injector) {
863
884
  },
864
885
  },
865
886
  {
866
- name: 'code',
887
+ name: 'tzName',
867
888
  layout: {
868
889
  positions: {
869
890
  lg: {
@@ -877,20 +898,6 @@ async function cultureEntityFactory(injector) {
877
898
  },
878
899
  list: {
879
900
  actions: [
880
- {
881
- title: 'Create New',
882
- command: 'create-entity',
883
- priority: 'primary',
884
- type: 'create',
885
- scope: AXPEntityCommandScope.TypeLevel,
886
- },
887
- {
888
- title: 'Delete Items',
889
- command: 'delete-entity',
890
- priority: 'primary',
891
- type: 'delete',
892
- scope: AXPEntityCommandScope.Selected,
893
- },
894
901
  {
895
902
  title: 'Details',
896
903
  command: 'open-entity',
@@ -898,13 +905,6 @@ async function cultureEntityFactory(injector) {
898
905
  type: 'view',
899
906
  scope: AXPEntityCommandScope.Individual,
900
907
  },
901
- {
902
- title: 'Delete',
903
- command: 'delete-entity',
904
- priority: 'secondary',
905
- type: 'delete',
906
- scope: AXPEntityCommandScope.Individual,
907
- },
908
908
  ],
909
909
  views: [
910
910
  {
@@ -923,9 +923,9 @@ async function cultureEntityFactory(injector) {
923
923
  return entityDef;
924
924
  }
925
925
 
926
- var culture_entity = /*#__PURE__*/Object.freeze({
926
+ var timeZone_entity = /*#__PURE__*/Object.freeze({
927
927
  __proto__: null,
928
- cultureEntityFactory: cultureEntityFactory
928
+ timeZoneEntityFactory: timeZoneEntityFactory
929
929
  });
930
930
 
931
931
  class AXMLocalizationManagementModule {
@@ -1019,5 +1019,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1019
1019
  * Generated bundle index. Do not edit.
1020
1020
  */
1021
1021
 
1022
- export { AXMCultureService, AXMCultureServiceImpl, AXMLanguageService, AXMLanguageServiceImpl, AXMLocalizationManagementModule, AXMLocalizationManagementModuleEntityLoader, AXMLocalizationManagementModuleMenuProvider, AXMTimeZoneService, AXMTimeZoneServiceImpl, CULTURE_SOURCE_NAME, LANGUAGE_SOURCE_NAME, TIMEZONE_SOURCE_NAME, cultureEntityFactory, languageEntityFactory, timeZoneEntityFactory };
1022
+ export { AXMCultureService, AXMCultureServiceImpl, AXMLanguageService, AXMLanguageServiceImpl, AXMLocalizationManagementModule, AXMLocalizationManagementModuleConst, AXMLocalizationManagementModuleEntityLoader, AXMLocalizationManagementModuleMenuProvider, AXMTimeZoneService, AXMTimeZoneServiceImpl, CULTURE_SOURCE_NAME, LANGUAGE_SOURCE_NAME, TIMEZONE_SOURCE_NAME, cultureEntityFactory, languageEntityFactory, timeZoneEntityFactory };
1023
1023
  //# sourceMappingURL=acorex-modules-localization-management.mjs.map