xt-plugin-intl 0.6.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.
Files changed (66) hide show
  1. package/.editorconfig +16 -0
  2. package/.postcssrc.json +1 -0
  3. package/.rush/temp/chunked-rush-logs/xt-plugin-i11l.build.chunks.jsonl +23 -0
  4. package/.rush/temp/chunked-rush-logs/xt-plugin-intl.build-deploy-latest.chunks.jsonl +80 -0
  5. package/.rush/temp/chunked-rush-logs/xt-plugin-intl.build-deploy-next.chunks.jsonl +29 -0
  6. package/.rush/temp/chunked-rush-logs/xt-plugin-intl.build.chunks.jsonl +24 -0
  7. package/.rush/temp/chunked-rush-logs/xt-plugin-intl.test.chunks.jsonl +50 -0
  8. package/.rush/temp/package-deps_test.json +53 -0
  9. package/.rush/temp/shrinkwrap-deps.json +1083 -0
  10. package/CHANGELOG.md +13 -0
  11. package/README.md +8 -0
  12. package/angular.json +163 -0
  13. package/package.json +62 -0
  14. package/projects/intl/README.md +8 -0
  15. package/projects/intl/ng-package.json +7 -0
  16. package/projects/intl/node_modules/.vite/results.json +1 -0
  17. package/projects/intl/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  18. package/projects/intl/package.json +22 -0
  19. package/projects/intl/src/lib/country/intl-country.component.css +0 -0
  20. package/projects/intl/src/lib/country/intl-country.component.html +24 -0
  21. package/projects/intl/src/lib/country/intl-country.component.spec.ts +33 -0
  22. package/projects/intl/src/lib/country/intl-country.component.ts +66 -0
  23. package/projects/intl/src/lib/currency/intl-currency.component.css +0 -0
  24. package/projects/intl/src/lib/currency/intl-currency.component.html +7 -0
  25. package/projects/intl/src/lib/currency/intl-currency.component.spec.ts +74 -0
  26. package/projects/intl/src/lib/currency/intl-currency.component.ts +46 -0
  27. package/projects/intl/src/lib/register.ts +36 -0
  28. package/projects/intl/src/public-api.ts +8 -0
  29. package/projects/intl/src/test-setup.ts +18 -0
  30. package/projects/intl/tsconfig.lib.json +14 -0
  31. package/projects/intl/tsconfig.lib.prod.json +11 -0
  32. package/projects/intl/tsconfig.spec.json +18 -0
  33. package/projects/intl/vitest.config.ts +19 -0
  34. package/projects/intl-plugin/federation.config.js +44 -0
  35. package/projects/intl-plugin/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  36. package/projects/intl-plugin/public/favicon.ico +0 -0
  37. package/projects/intl-plugin/public/pluginicon.png +0 -0
  38. package/projects/intl-plugin/src/app/app.component.css +0 -0
  39. package/projects/intl-plugin/src/app/app.component.html +3 -0
  40. package/projects/intl-plugin/src/app/app.component.spec.ts +33 -0
  41. package/projects/intl-plugin/src/app/app.component.ts +23 -0
  42. package/projects/intl-plugin/src/app/app.config.ts +19 -0
  43. package/projects/intl-plugin/src/app/app.routes.ts +7 -0
  44. package/projects/intl-plugin/src/app/test-component/test.component.css +0 -0
  45. package/projects/intl-plugin/src/app/test-component/test.component.html +28 -0
  46. package/projects/intl-plugin/src/app/test-component/test.component.spec.ts +30 -0
  47. package/projects/intl-plugin/src/app/test-component/test.component.ts +53 -0
  48. package/projects/intl-plugin/src/bootstrap.ts +6 -0
  49. package/projects/intl-plugin/src/index.html +13 -0
  50. package/projects/intl-plugin/src/main.ts +6 -0
  51. package/projects/intl-plugin/src/styles.css +4 -0
  52. package/projects/intl-plugin/src/test-setup.ts +18 -0
  53. package/projects/intl-plugin/tsconfig.app.json +15 -0
  54. package/projects/intl-plugin/tsconfig.federation.json +13 -0
  55. package/projects/intl-plugin/tsconfig.spec.json +18 -0
  56. package/projects/intl-plugin/vitest.config.ts +19 -0
  57. package/rush-logs/xt-plugin-i11l.build.error.log +8 -0
  58. package/rush-logs/xt-plugin-i11l.build.log +23 -0
  59. package/rush-logs/xt-plugin-intl.build-deploy-latest.error.log +43 -0
  60. package/rush-logs/xt-plugin-intl.build-deploy-latest.log +80 -0
  61. package/rush-logs/xt-plugin-intl.build-deploy-next.error.log +10 -0
  62. package/rush-logs/xt-plugin-intl.build-deploy-next.log +29 -0
  63. package/rush-logs/xt-plugin-intl.build.error.log +9 -0
  64. package/rush-logs/xt-plugin-intl.build.log +24 -0
  65. package/rush-logs/xt-plugin-intl.test.log +50 -0
  66. package/tsconfig.json +36 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## [0.6.0](https://github.com/dont-code/ng-xtend/compare/xt-plugin-intl-v0.5.5...xt-plugin-intl-v0.6.0) (2026-01-07)
4
+
5
+
6
+ ### Features
7
+
8
+ * all plugins, libs to release please ([35ddd53](https://github.com/dont-code/ng-xtend/commit/35ddd5362c3350572f44ebe79824e297fd03c7eb))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * reworked publish & deploy scripts with release-please ([aed0d88](https://github.com/dont-code/ng-xtend/commit/aed0d884c0a8bfcc85645e87d19480939737bdf6))
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ ![ng-xtend logo](https://dont-code.net/assets/images/logos/logo-xtend-angular-red-small.png)
2
+
3
+ # XT-Plugin-Sample
4
+
5
+ This is a plugin for [ng-xtend framework](https://github.com/dont-code/ng-xtend/blob/main/README.md).
6
+
7
+ It is an example of very Simple (Hello), Simple (Currency) and Complex (Money) components supporting ng-xtend
8
+
package/angular.json ADDED
@@ -0,0 +1,163 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "cli": {
5
+ "packageManager": "pnpm",
6
+ "analytics": "aa50d3e8-3b23-4c0b-886c-589e9f92b5bc",
7
+ "cache": {
8
+ "enabled": true
9
+ }
10
+ },
11
+ "newProjectRoot": "projects",
12
+ "projects": {
13
+ "intl": {
14
+ "projectType": "library",
15
+ "root": "projects/intl",
16
+ "sourceRoot": "projects/intl/src",
17
+ "prefix": "lib",
18
+ "architect": {
19
+ "build": {
20
+ "builder": "@angular-devkit/build-angular:ng-packagr",
21
+ "options": {
22
+ "project": "projects/intl/ng-package.json"
23
+ },
24
+ "configurations": {
25
+ "production": {
26
+ "tsConfig": "projects/intl/tsconfig.lib.prod.json"
27
+ },
28
+ "development": {
29
+ "tsConfig": "projects/intl/tsconfig.lib.json"
30
+ }
31
+ },
32
+ "defaultConfiguration": "development"
33
+ },
34
+ "test": {
35
+ "builder": "@analogjs/vitest-angular:test",
36
+ "options": {
37
+ "tsConfig": "projects/intl/tsconfig.spec.json",
38
+ "polyfills": []
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "intl-plugin": {
44
+ "projectType": "application",
45
+ "schematics": {
46
+ "@schematics/angular:component": {
47
+ "style": "css"
48
+ }
49
+ },
50
+ "root": "projects/intl-plugin",
51
+ "sourceRoot": "projects/intl-plugin/src",
52
+ "prefix": "app",
53
+ "architect": {
54
+ "build": {
55
+ "builder": "@angular-architects/native-federation:build",
56
+ "options": {},
57
+ "configurations": {
58
+ "production": {
59
+ "target": "intl-plugin:esbuild:production"
60
+ },
61
+ "development": {
62
+ "target": "intl-plugin:esbuild:development",
63
+ "dev": true
64
+ }
65
+ },
66
+ "defaultConfiguration": "production"
67
+ },
68
+ "serve": {
69
+ "builder": "@angular-architects/native-federation:build",
70
+ "options": {
71
+ "target": "intl-plugin:serve-original:development",
72
+ "rebuildDelay": 0,
73
+ "dev": true,
74
+ "port": 0
75
+ }
76
+ },
77
+ "esbuild": {
78
+ "builder": "@angular-devkit/build-angular:application",
79
+ "options": {
80
+ "outputPath": "dist/xt-intl-plugin",
81
+ "index": "projects/intl-plugin/src/index.html",
82
+ "browser": "projects/intl-plugin/src/main.ts",
83
+ "preserveSymlinks": true,
84
+ "polyfills": [
85
+ "es-module-shims"
86
+ ],
87
+ "tsConfig": "projects/intl-plugin/tsconfig.app.json",
88
+ "inlineStyleLanguage": "css",
89
+ "assets": [
90
+ {
91
+ "glob": "**/*",
92
+ "input": "projects/intl-plugin/public"
93
+ }
94
+ ],
95
+ "styles": [
96
+ "projects/intl-plugin/src/styles.css"
97
+ ],
98
+ "scripts": []
99
+ },
100
+ "configurations": {
101
+ "production": {
102
+ "budgets": [
103
+ {
104
+ "type": "initial",
105
+ "maximumWarning": "500kB",
106
+ "maximumError": "1MB"
107
+ },
108
+ {
109
+ "type": "anyComponentStyle",
110
+ "maximumWarning": "2kB",
111
+ "maximumError": "4kB"
112
+ }
113
+ ],
114
+ "outputHashing": "all"
115
+ },
116
+ "development": {
117
+ "optimization": false,
118
+ "extractLicenses": false,
119
+ "sourceMap": true
120
+ }
121
+ },
122
+ "defaultConfiguration": "development"
123
+ },
124
+ "serve-original": {
125
+ "builder": "@angular-devkit/build-angular:dev-server",
126
+ "configurations": {
127
+ "production": {
128
+ "buildTarget": "intl-plugin:esbuild:production"
129
+ },
130
+ "development": {
131
+ "buildTarget": "intl-plugin:esbuild:development"
132
+ }
133
+ },
134
+ "defaultConfiguration": "development",
135
+ "options": {
136
+ "port": 4203
137
+ }
138
+ },
139
+ "extract-i18n": {
140
+ "builder": "@angular-devkit/build-angular:extract-i18n"
141
+ },
142
+ "test": {
143
+ "builder": "@analogjs/vitest-angular:test",
144
+ "options": {
145
+ "polyfills": [],
146
+ "tsConfig": "projects/intl-plugin/tsconfig.spec.json",
147
+ "inlineStyleLanguage": "css",
148
+ "assets": [
149
+ {
150
+ "glob": "**/*",
151
+ "input": "projects/intl-plugin/public"
152
+ }
153
+ ],
154
+ "styles": [
155
+ "projects/intl-plugin/src/styles.css"
156
+ ],
157
+ "scripts": []
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "xt-plugin-intl",
3
+ "version": "0.6.0",
4
+ "scripts": {
5
+ "ng": "ng",
6
+ "start": "ng serve",
7
+ "build": "ng build intl --configuration=development",
8
+ "build-deploy": "APP=intl-plugin && MAIN_LIB=intl && ng build $MAIN_LIB --configuration=$BUILD && ng build $APP --configuration=$BUILD --output-path=\"../../dist/$STAGE/$APP\" --base-href=\"https://test.dont-code.net/apps/$STAGE/$APP/\"",
9
+ "watch": "ng build --watch --configuration=development",
10
+ "test": "cd projects/intl && ../../node_modules/.bin/vitest && cd ../intl-plugin && ../../node_modules/.bin/vitest"
11
+ },
12
+ "publishConfig": {
13
+ "directory": "dist/xt-plugin-intl",
14
+ "linkDirectory": true
15
+ },
16
+ "repository": {
17
+ "url": "git+https://github.com/dont-code/ng-xtend.git"
18
+ },
19
+ "private": false,
20
+ "dependencies": {
21
+ "@angular/animations": "^20.3.9",
22
+ "@angular/common": "^20.3.9",
23
+ "@angular/compiler": "^20.3.9",
24
+ "@angular/core": "^20.3.9",
25
+ "@angular/forms": "^20.3.9",
26
+ "@angular/platform-browser": "^20.3.9",
27
+ "@angular/platform-browser-dynamic": "^20.3.9",
28
+ "@angular/router": "^20.3.9",
29
+ "@angular/cdk": "^20.2.4",
30
+ "xt-components": "workspace:^",
31
+ "xt-type": "workspace:^",
32
+ "rxjs": "^7.8.2",
33
+ "primeng": "^20.3.0",
34
+ "es-module-shims": "^2.6.2",
35
+ "primeicons": "^7.0.0",
36
+ "@primeuix/themes": "^1.2.5",
37
+ "tslib": "^2.8.1",
38
+ "@angular-architects/native-federation": "^20.1.7",
39
+ "@softarc/native-federation-runtime": "^3.3.6",
40
+ "tailwindcss": "~4.1.16",
41
+ "countries-ts": "~2.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@primeuix/utils": "^0.6.1",
45
+ "@primeuix/styled": "^0.7.2",
46
+ "@tailwindcss/postcss": "~4.1.16",
47
+ "postcss": "~8.5.6",
48
+ "@angular-devkit/build-angular": "^20.3.8",
49
+ "@angular/cli": "^20.3.8",
50
+ "@angular/compiler-cli": "^20.3.9",
51
+ "@angular/build": "^20.3.8",
52
+ "ng-packagr": "^20.3.0",
53
+ "typescript": "^5.9.3",
54
+ "happy-dom": "^18.0.1",
55
+ "@analogjs/vite-plugin-angular": "^1.22.4",
56
+ "@analogjs/vitest-angular": "^1.22.4",
57
+ "jsdom": "^26.1.0",
58
+ "vite": "^7.1.12",
59
+ "vitest": "^3.2.4",
60
+ "vite-tsconfig-paths": "~5.1.4"
61
+ }
62
+ }
@@ -0,0 +1,8 @@
1
+ ![ng-xtend logo](https://dont-code.net/assets/images/logos/logo-xtend-angular-red-small.png)
2
+
3
+ # XT-Plugin-Sample
4
+
5
+ This is a plugin for [ng-xtend framework](https://github.com/dont-code/ng-xtend/blob/main/README.md).
6
+
7
+ It is an example of very Simple (Hello), Simple (Currency) and Complex (Money) components supporting ng-xtend
8
+
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/xt-plugin-intl",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ {"version":"3.1.4","results":[[":src/lib/country/intl-country.component.spec.ts",{"duration":93.49325200000021,"failed":false}]]}
@@ -0,0 +1 @@
1
+ {"version":"3.2.4","results":[[":src/lib/currency/intl-currency.component.spec.ts",{"duration":622.5719389999977,"failed":false}],[":src/lib/country/intl-country.component.spec.ts",{"duration":401.13012100000196,"failed":false}]]}
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "xt-plugin-intl",
3
+ "version": "0.6.0",
4
+ "peerDependencies": {
5
+ "@angular/animations": "^19.0.5",
6
+ "@angular/common": "^19.0.5",
7
+ "@angular/compiler": "^19.0.5",
8
+ "@angular/core": "^19.0.5",
9
+ "@angular/forms": "^19.0.5",
10
+ "@angular/platform-browser": "^19.0.5",
11
+ "@angular/platform-browser-dynamic": "^19.0.5",
12
+ "@angular/router": "^19.0.5",
13
+ "xt-components": "workspace:^",
14
+ "rxjs": "^7.8.0",
15
+ "primeng": "^19.0.2",
16
+ "primeicons": "^7.0.0"
17
+ },
18
+ "dependencies": {
19
+ "tslib": "^2.3.0"
20
+ },
21
+ "sideEffects": false
22
+ }
@@ -0,0 +1,24 @@
1
+ @if (isInForm() ) {
2
+ <ng-container [formGroup]="formGroup()">
3
+ <p-autocomplete [fluid]="true" optionValue="alpha3" [forceSelection]="true" [dropdown]="true" [formControlName]="formControlName()" [suggestions]="listOfCountries()" (completeMethod)="matchCountry($event)" (onUnselect)="selectionCanceled($event)" (onSelect)="selectionChange($event)">
4
+ <ng-template let-country #item>
5
+ <div class="flex items-center gap-4">
6
+ <img [src]="country.flag" style="width: 18px" />
7
+ <span>{{country.label}}</span>
8
+ </div>
9
+ </ng-template>
10
+ </p-autocomplete>
11
+ </ng-container>
12
+ } @else {
13
+ @let country=currentCountry();
14
+ @if (country!=null) {
15
+ @if (context().displayMode=='INLINE_VIEW') {
16
+ <img [src]="country.flag" style="width: 18px" />
17
+ } @else {
18
+ <div class="flex items-center gap-4">
19
+ <img [src]="country.flag" style="width: 18px" />
20
+ <span>{{country.label}}</span>
21
+ </div>
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,33 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { beforeEach, describe, expect, it } from 'vitest';
3
+ import { registerInternationalPlugin } from '../register';
4
+ import { XtBaseContext, XtResolverService } from 'xt-components';
5
+ import { IntlCountryComponent } from './intl-country.component';
6
+ import { provideZonelessChangeDetection } from '@angular/core';
7
+
8
+ describe('IntlCountryComponent', () => {
9
+ let component: IntlCountryComponent;
10
+ let fixture: ComponentFixture<IntlCountryComponent>;
11
+
12
+ beforeEach(async () => {
13
+ await TestBed.configureTestingModule({
14
+ imports: [IntlCountryComponent],
15
+ providers: [provideZonelessChangeDetection()]
16
+ })
17
+ .compileComponents();
18
+
19
+ registerInternationalPlugin(TestBed.inject(XtResolverService));
20
+ });
21
+
22
+ it('should create', () => {
23
+ fixture = TestBed.createComponent(IntlCountryComponent);
24
+ component = fixture.componentInstance;
25
+ const context= new XtBaseContext<string>('FULL_VIEW');
26
+ context.setDisplayValue("FRA");
27
+ fixture.componentRef.setInput('context', context);
28
+ fixture.detectChanges();
29
+
30
+ expect(component).toBeTruthy();
31
+
32
+ });
33
+ });
@@ -0,0 +1,66 @@
1
+ import { ChangeDetectionStrategy, Component, computed, OnInit, output, signal } from '@angular/core';
2
+ import { XtSimpleComponent } from 'xt-components';
3
+ import { ReactiveFormsModule } from '@angular/forms';
4
+ import {
5
+ AutoComplete,
6
+ AutoCompleteCompleteEvent,
7
+ AutoCompleteSelectEvent,
8
+ AutoCompleteUnselectEvent
9
+ } from 'primeng/autocomplete';
10
+ import countriests from 'countries-ts';
11
+ const { listCountries, searchCountries, alpha3Codes, getByAlpha3 } = countriests;
12
+
13
+ import { Country } from 'countries-ts';
14
+
15
+ @Component({
16
+ selector: 'xt-intl-country',
17
+ imports: [
18
+ ReactiveFormsModule,
19
+ AutoComplete
20
+ ],
21
+ templateUrl: './intl-country.component.html',
22
+ styleUrl: './intl-country.component.css',
23
+ changeDetection: ChangeDetectionStrategy.OnPush
24
+ })
25
+ export class IntlCountryComponent extends XtSimpleComponent<string> {
26
+ selected= output<string|undefined>();
27
+
28
+ listOfCountries=signal<Country[]> (listCountries());
29
+
30
+ constructor() {
31
+ super();
32
+ // Converts the code to alpha3 codes
33
+ this.toAlpha3(listCountries());
34
+ }
35
+
36
+ matchCountry($event: AutoCompleteCompleteEvent) {
37
+ this.listOfCountries.set (searchCountries($event.query)
38
+ );
39
+ }
40
+
41
+ selectionChange($event: AutoCompleteSelectEvent) {
42
+ this.selected.emit($event.value.alpha3);
43
+ }
44
+
45
+ selectionCanceled($event: AutoCompleteUnselectEvent) {
46
+ this.selected.emit(undefined);
47
+ }
48
+
49
+ override setupInputOutput () {
50
+ this.outputsObject.valueSelected=this.selected;
51
+ }
52
+
53
+ toAlpha3 (list:Country[]): Country[] {
54
+ for (const country of list) {
55
+ country.alpha3=alpha3Codes[country.code]??country.code;
56
+ }
57
+ return list;
58
+ }
59
+
60
+ currentCountry = computed( () => {
61
+ const val=this.displayValue();
62
+ if (val!=null) {
63
+ return getByAlpha3(val);
64
+ } else return null;
65
+ });
66
+ }
@@ -0,0 +1,7 @@
1
+ @if (isInForm() ) {
2
+ <ng-container [formGroup]="formGroup()">
3
+ <p-autocomplete [fluid]="true" [forceSelection]="true" [dropdown]="true" [formControlName]="formControlName()" [suggestions]="listOfCurrencies()" (completeMethod)="matchCurrency($event)" (onUnselect)="selectionCanceled($event)" (onSelect)="selectionChange($event)"></p-autocomplete>
4
+ </ng-container>
5
+ } @else {
6
+ {{ context().displayValue() }}
7
+ }
@@ -0,0 +1,74 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { IntlCurrencyComponent } from './intl-currency.component';
4
+ import { provideZonelessChangeDetection } from '@angular/core';
5
+ import { HostTestTypedComponent, HostTestTypedFormComponent, XtBaseContext, XtResolverService } from 'xt-components';
6
+ import { registerInternationalPlugin } from '../register';
7
+ import { By } from '@angular/platform-browser';
8
+ import { beforeEach, describe, expect, it } from 'vitest';
9
+
10
+ describe('XtCurrencyComponent', () => {
11
+
12
+ beforeEach(async () => {
13
+ await TestBed.configureTestingModule({
14
+ imports: [IntlCurrencyComponent],
15
+ providers: [provideZonelessChangeDetection()]
16
+ })
17
+ .compileComponents();
18
+
19
+ registerInternationalPlugin(TestBed.inject(XtResolverService));
20
+ });
21
+
22
+ it('should create', () => {
23
+ let component: IntlCurrencyComponent;
24
+ let fixture: ComponentFixture<IntlCurrencyComponent>;
25
+ fixture = TestBed.createComponent(IntlCurrencyComponent);
26
+ component = fixture.componentInstance;
27
+ const context= new XtBaseContext<string>('FULL_VIEW');
28
+ context.setDisplayValue("");
29
+ fixture.componentRef.setInput('context', context);
30
+ fixture.detectChanges();
31
+ expect(component).toBeTruthy();
32
+ });
33
+
34
+ it('should support currency display', () => {
35
+ const hostFixture = TestBed.createComponent(HostTestTypedComponent);
36
+ hostFixture.componentRef.setInput('value', 'EUR');
37
+ hostFixture.componentRef.setInput('valueType', 'currency');
38
+
39
+ const host = hostFixture.componentInstance;
40
+ expect(host).toBeTruthy();
41
+ hostFixture.detectChanges();
42
+ expect(hostFixture.nativeElement.textContent).toContain('EUR');
43
+
44
+ hostFixture.componentRef.setInput('value', 'USD');
45
+ hostFixture.detectChanges();
46
+ expect(hostFixture.nativeElement.textContent).toContain('USD');
47
+
48
+ });
49
+
50
+ it('should support currency edit', () => {
51
+ const hostFixture = TestBed.createComponent(HostTestTypedFormComponent);
52
+ hostFixture.componentRef.setInput('formDescription', {
53
+ currency:'EUR'
54
+ });
55
+ hostFixture.componentRef.setInput('valueType', 'currency');
56
+ hostFixture.componentRef.setInput('controlName', 'currency');
57
+
58
+ const host = hostFixture.componentInstance;
59
+ expect(host).toBeTruthy();
60
+ hostFixture.detectChanges();
61
+
62
+ const currencyComponent = hostFixture.debugElement.query(By.directive(IntlCurrencyComponent));
63
+ expect(currencyComponent).toBeTruthy();
64
+ const input = currencyComponent.query(By.css('input'));
65
+
66
+ expect(input.nativeElement.value).toEqual ('EUR');
67
+
68
+ host.computeFormGroup().patchValue({'currency':"USD"});
69
+ hostFixture.detectChanges();
70
+ expect(input.nativeElement.value).toEqual ("USD");
71
+
72
+ });
73
+
74
+ });
@@ -0,0 +1,46 @@
1
+ import { ChangeDetectionStrategy, Component, output, signal } from '@angular/core';
2
+ import { ReactiveFormsModule } from '@angular/forms';
3
+ import { InputNumberModule } from 'primeng/inputnumber';
4
+ import { XtSimpleComponent } from 'xt-components';
5
+ import { CommonModule } from '@angular/common';
6
+ import { InputTextModule } from 'primeng/inputtext';
7
+ import {
8
+ AutoComplete,
9
+ AutoCompleteCompleteEvent,
10
+ AutoCompleteSelectEvent,
11
+ AutoCompleteUnselectEvent
12
+ } from 'primeng/autocomplete';
13
+
14
+ @Component({
15
+ selector: 'xt-intl-currency',
16
+ standalone: true,
17
+ imports: [CommonModule, InputNumberModule, ReactiveFormsModule, InputTextModule, AutoComplete],
18
+ templateUrl: './intl-currency.component.html',
19
+ styleUrl: './intl-currency.component.css',
20
+ changeDetection: ChangeDetectionStrategy.OnPush
21
+ })
22
+ export class IntlCurrencyComponent extends XtSimpleComponent<string> {
23
+ selected= output<string|undefined>();
24
+
25
+ listOfCurrencies=signal<string[]> (Intl.supportedValuesOf('currency'));
26
+
27
+ matchCurrency($event: AutoCompleteCompleteEvent) {
28
+ this.listOfCurrencies.set (Intl.supportedValuesOf('currency').filter(currency => {
29
+ return currency.indexOf($event.query) != -1;
30
+
31
+ }));
32
+ }
33
+
34
+ selectionChange($event: AutoCompleteSelectEvent) {
35
+ this.selected.emit($event.value);
36
+ }
37
+
38
+ selectionCanceled($event: AutoCompleteUnselectEvent) {
39
+ this.selected.emit(undefined);
40
+ }
41
+
42
+ override setupInputOutput () {
43
+ this.outputsObject.valueSelected=this.selected;
44
+ }
45
+
46
+ }
@@ -0,0 +1,36 @@
1
+ import { XtResolverService } from 'xt-components';
2
+ import { IntlCurrencyComponent } from './currency/intl-currency.component';
3
+ import { IntlCountryComponent } from './country/intl-country.component';
4
+
5
+ export function registerInternationalPlugin (resolverService:XtResolverService):string {
6
+ const pluginName = "Plugin International";
7
+ console.info ('Registering '+pluginName);
8
+ resolverService.registerPlugin ({
9
+ name:pluginName,
10
+ uriLogo:'pluginicon.png',
11
+ components: [
12
+ {
13
+ componentName:'IntlCurrency',
14
+ componentClass:IntlCurrencyComponent,
15
+ typesHandled: ['currency'],
16
+ outputs: ['valueSelected']
17
+ },
18
+ {
19
+ componentName:'IntlCountry',
20
+ componentClass:IntlCountryComponent,
21
+ typesHandled: ['country'],
22
+ outputs: ['valueSelected']
23
+ }
24
+ ],
25
+ types:
26
+ {
27
+ currency:'string',
28
+ country:'string'
29
+ }
30
+ });
31
+ return pluginName;
32
+ }
33
+
34
+ export function registerPlugin (resolverService:XtResolverService):string {
35
+ return registerInternationalPlugin(resolverService);
36
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Public API Surface of intl-plugin
3
+ */
4
+
5
+ export * from './lib/currency/intl-currency.component';
6
+ export * from './lib/country/intl-country.component';
7
+ export * from './lib/register';
8
+
@@ -0,0 +1,18 @@
1
+ import "@angular/compiler";
2
+
3
+ import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
4
+
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import { NgModule, provideZonelessChangeDetection } from '@angular/core';
7
+
8
+
9
+ @NgModule({
10
+ imports: [BrowserTestingModule],
11
+ providers: [provideZonelessChangeDetection()],
12
+ })
13
+ export class TestingModule {}
14
+
15
+ getTestBed().initTestEnvironment(
16
+ [TestingModule],
17
+ platformBrowserTesting()
18
+ );
@@ -0,0 +1,14 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/lib",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "types": []
10
+ },
11
+ "exclude": [
12
+ "**/*.spec.ts"
13
+ ]
14
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,18 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "target": "es2016",
8
+ "types": [
9
+ "vitest/globals","node"
10
+ ],
11
+ "emitDecoratorMetadata": true
12
+ },
13
+ "files": ["src/test-setup.ts"],
14
+ "include": [
15
+ "src/**/*.spec.ts",
16
+ "src/**/*.d.ts"
17
+ ]
18
+ }