@dsivd/prestations-ng 18.0.0-beta.1 → 18.0.0-beta.3

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.
package/CHANGELOG.md CHANGED
@@ -2937,17 +2937,17 @@ data: {
2937
2937
 
2938
2938
  - added some inputs to affect the presence of (facultatif) on every label :
2939
2939
 
2940
- - `@Input() countryRequired = true`
2941
- - `@Input() swissNpaLocalityRequired = true`
2942
- - `@Input() streetRequired = true`
2943
- - `@Input() streetNumberRequired = false`
2944
- - `@Input() foreignZipCodeRequired = true`
2945
- - `@Input() foreignLocalityRequired = true`
2946
- - `@Input() foreignStreetRequired = true`
2947
- - `@Input() foreignStreetNumberRequired = false`
2948
- - `@Input() postOfficeBoxTextRequired = false`
2949
- - `@Input() addressLine1Required = false`
2950
- - `@Input() addressLine2Required = false
2940
+ - `@Input() countryRequired = true`
2941
+ - `@Input() swissNpaLocalityRequired = true`
2942
+ - `@Input() streetRequired = true`
2943
+ - `@Input() streetNumberRequired = false`
2944
+ - `@Input() foreignZipCodeRequired = true`
2945
+ - `@Input() foreignLocalityRequired = true`
2946
+ - `@Input() foreignStreetRequired = true`
2947
+ - `@Input() foreignStreetNumberRequired = false`
2948
+ - `@Input() postOfficeBoxTextRequired = false`
2949
+ - `@Input() addressLine1Required = false`
2950
+ - `@Input() addressLine2Required = false
2951
2951
 
2952
2952
  ## [11.1.4]
2953
2953
 
@@ -5167,8 +5167,8 @@ If you've added an "Obligatoire" label somewhere in your prestation, please chan
5167
5167
  </foehn-list>
5168
5168
  `
5169
5169
  ```
5170
- - itemsPerPage is 10, if none provided
5171
- - trackBy is done on index, if no trackBy function is provided
5170
+ - itemsPerPage is 10, if none provided
5171
+ - trackBy is done on index, if no trackBy function is provided
5172
5172
 
5173
5173
  ## [7.20.0] - 2018.08.29
5174
5174
 
@@ -114,13 +114,7 @@ You can replace the content of your `.eslintrc.json` with the following `json`.
114
114
  project: ['tsconfig.json'],
115
115
  createDefaultProgram: true
116
116
  },
117
- plugins: [
118
- 'import',
119
- 'jsdoc',
120
- 'rxjs',
121
- 'rxjs-angular',
122
- 'simple-import-sort'
123
- ],
117
+ plugins: ['import', 'rxjs', 'rxjs-angular', 'simple-import-sort'],
124
118
  extends: [
125
119
  'plugin:@angular-eslint/recommended',
126
120
  'plugin:@angular-eslint/template/process-inline-templates',
@@ -129,8 +123,7 @@ You can replace the content of your `.eslintrc.json` with the following `json`.
129
123
  'plugin:import/recommended',
130
124
  'plugin:import/errors',
131
125
  'plugin:import/warnings',
132
- 'plugin:import/typescript',
133
- 'plugin:jsdoc/recommended'
126
+ 'plugin:import/typescript'
134
127
  ],
135
128
  rules: {
136
129
  /* @angular-eslint */
@@ -355,13 +348,7 @@ You can replace the content of your `.eslintrc.json` with the following `json`.
355
348
  'simple-import-sort/exports': 'error',
356
349
  'import/first': 'error',
357
350
  'import/newline-after-import': 'error',
358
- 'import/no-duplicates': 'error',
359
- /* @jsdoc */
360
- 'jsdoc/check-alignment': 'error',
361
- 'jsdoc/check-indentation': 'error',
362
- 'jsdoc/no-types': 'error',
363
- 'jsdoc/require-param-type': 'off',
364
- 'jsdoc/require-returns-type': 'off'
351
+ 'import/no-duplicates': 'error'
365
352
  }
366
353
  },
367
354
  // HTML
package/UPGRADING_V18.md CHANGED
@@ -29,10 +29,27 @@ npm install @angular/cli@18 -g
29
29
  ng update @angular/core@18 @angular/cli@18
30
30
  ```
31
31
 
32
- When asked the question "Select the migrations that you'd like to run", accept "use-application-builder" by hitting "Space" key then "Enter"
32
+ When asked the question "Select the migrations that you'd like to run", accept "use-application-builder" by hitting "Space" key then "Enter".
33
+ Then fix provideHttpClient withXsrfConfiguration by modifying your `app.module.ts` and adding:
34
+ `{
35
+ cookieName: 'XSRF-TOKEN',
36
+ headerName: 'X-XSRF-TOKEN'
37
+ }`
38
+ to `withXsrfConfiguration()`.
39
+
40
+ ```diff
41
+ providers: [
42
+ META_SERVICE_PROVIDER,
43
+ - provideHttpClient(withXsrfConfiguration()),
44
+ + provideHttpClient(withXsrfConfiguration({
45
+ + cookieName: 'XSRF-TOKEN',
46
+ + headerName: 'X-XSRF-TOKEN'
47
+ + })),
48
+ ]
49
+ ```
33
50
 
34
51
  ```bash
35
- ng update @fortawesome/angular-fontawesome@0.15
52
+ ng update @fortawesome/angular-fontawesome@0.15 --force
36
53
  ```
37
54
 
38
55
  ### Updating to Angular 19
@@ -47,17 +64,30 @@ Just FYI if you are curious about the details, you can find the Angular update g
47
64
 
48
65
  ```bash
49
66
  npm install @angular/cli@19 -g
50
- ng update @angular/core@19 @angular/cli@19 --force
51
- ng update @dsivd/prestations-ng@latest
52
67
  ng update typescript@5.5
53
- ng update rxjs@7
68
+ ng update @dsivd/prestations-ng@latest
69
+ ```
70
+
71
+ When asked the question "Select the migrations that you'd like to run", accept "provide-initializer" by hitting "Space" key then "Enter".
72
+
73
+ ```bash
74
+ ng update @angular/cli@19
75
+ ```
76
+
77
+ When asked the question "Select the migrations that you'd like to run", accept "use-application-builder" by hitting "Space" key then "Enter".
78
+
79
+ ```bash
54
80
  ng update @angular-eslint/builder@19
55
81
 
82
+ npm install --save-dev jasmine@5
83
+
84
+ ng update karma@6.4 karma-chrome-launcher@3.2 karma-coverage@2.2 karma-jasmine@5.1 karma-jasmine-html-reporter@2.1
85
+
56
86
  npm install --save-dev @typescript-eslint/utils@7 @typescript-eslint/types@7
57
87
 
58
88
  ng update @angular-eslint/eslint-plugin@19 @angular-eslint/eslint-plugin-template@19 @angular-eslint/template-parser@19
59
89
  ng update @typescript-eslint/eslint-plugin@7 @typescript-eslint/parser@7
60
- ng update eslint-plugin-import eslint-plugin-jasmine eslint-plugin-jsdoc eslint-plugin-rxjs-angular
90
+ ng update eslint-plugin-import eslint-plugin-jasmine eslint-plugin-rxjs-angular
61
91
  ng update eslint@8
62
92
  ng update eslint-plugin-rxjs
63
93
  ng update @types/jasmine@5 @types/node@20 ts-node@10
@@ -67,6 +97,26 @@ npm remove eslint-plugin-jsdoc
67
97
  npm update
68
98
  ```
69
99
 
100
+ #### NgHttpLoader migration as standalone
101
+
102
+ In your `app.module.ts` file:
103
+
104
+ - Remove `import { NgHttpLoaderModule } from 'ng-http-loader';`
105
+ - Remove `NgHttpLoaderModule.forRoot()` from `imports` in `@NgModule(...)`
106
+ - Add `NgHttpLoaderComponent` to `imports` in `@NgModule(...)`
107
+
108
+ ```diff
109
+ - import { NgHttpLoaderModule } from 'ng-http-loader';
110
+ + import { NgHttpLoaderComponent } from 'ng-http-loader';
111
+
112
+ @NgModule({
113
+ imports: [
114
+ - NgHttpLoaderModule.forRoot(),
115
+ + NgHttpLoaderComponent,
116
+ ],
117
+ })
118
+ ```
119
+
70
120
  #### Browsers list update
71
121
 
72
122
  Run update schematic:
@@ -82,6 +132,25 @@ You will have to fix the json file after the copy as it won't copy the double qu
82
132
 
83
133
  Then run
84
134
 
135
+ ```bash
136
+ npm run lint
137
+ ```
138
+
139
+ Fix manually all errors **Components, Directives and Pipes should not opt out of standalone @angular-eslint/prefer-standalone** by either:
140
+
141
+ - Transforming your component into a `standalone` component by changing `standalone: false` into `standalone: true` (recommended by angular)
142
+ - Adding `// eslint-disable-next-line @angular-eslint/prefer-standalone` above `standalone: false`
143
+
144
+ Then run again:
145
+
146
+ ```bash
147
+ npm run lint
148
+ ```
149
+
150
+ To be sure you haven't forgotten any.
151
+
152
+ Finally, run:
153
+
85
154
  ```bash
86
155
  ng lint --fix=true
87
156
  ```
@@ -189,25 +189,8 @@ class ApplicationInfoService {
189
189
  this.pulling_ = this.http
190
190
  .get(APP_INFO_API_URL)
191
191
  .pipe(shareReplay(1));
192
- // In most prestation, we're interested in the first etape info.
193
- this.firstEtapeInfo_ = this.pulling_.pipe(filter(appInfo => !!appInfo && !!appInfo.etapeInfos), map(({ etapeInfos }) => {
194
- // Checks whether the server returns a first key, otherwise fails the
195
- // observable to ensure that client applications don't try to use this value
196
- // and are able to implement fallback strategies.
197
- const firstKey = Object.keys(etapeInfos)[0];
198
- if (!firstKey) {
199
- throw new Error('There must be at least one key in the etapeInfos');
200
- }
201
- return etapeInfos[firstKey];
202
- }));
203
- this.currentEtapeInfo_ = combineLatest([
204
- this.foehnPageService.onEtapeIdChange(),
205
- this.pulling_
206
- ]).pipe(map(([etapeId, applicationInfo]) => applicationInfo.etapeInfos[etapeId]), shareReplay(1));
207
- this.pulling_.subscribe((ai) => this.setApplicationInfo(ai));
208
- }
209
- get data() {
210
- return this.pulling_.pipe(tap(appInfo => {
192
+ // Cache the data observable to prevent recreation
193
+ this.data_ = this.pulling_.pipe(tap(appInfo => {
211
194
  if (!!appInfo.configuration.portail.baseVdChUrl?.length) {
212
195
  // already set by the backend
213
196
  return;
@@ -225,7 +208,27 @@ class ApplicationInfoService {
225
208
  appInfo.configuration.portail.baseVdChUrl =
226
209
  'https://www.vd.ch';
227
210
  }
211
+ }), shareReplay(1) // Share the result
212
+ );
213
+ // In most prestation, we're interested in the first etape info.
214
+ this.firstEtapeInfo_ = this.pulling_.pipe(filter(appInfo => !!appInfo && !!appInfo.etapeInfos), map(({ etapeInfos }) => {
215
+ // Checks whether the server returns a first key, otherwise fails the
216
+ // observable to ensure that client applications don't try to use this value
217
+ // and are able to implement fallback strategies.
218
+ const firstKey = Object.keys(etapeInfos)[0];
219
+ if (!firstKey) {
220
+ throw new Error('There must be at least one key in the etapeInfos');
221
+ }
222
+ return etapeInfos[firstKey];
228
223
  }));
224
+ this.currentEtapeInfo_ = combineLatest([
225
+ this.foehnPageService.onEtapeIdChange(),
226
+ this.pulling_
227
+ ]).pipe(map(([etapeId, applicationInfo]) => applicationInfo.etapeInfos[etapeId]), shareReplay(1));
228
+ this.pulling_.subscribe((ai) => this.setApplicationInfo(ai));
229
+ }
230
+ get data() {
231
+ return this.data_;
229
232
  }
230
233
  get firstEtapeInfo() {
231
234
  return this.firstEtapeInfo_;
@@ -9357,7 +9360,7 @@ class DatePickerHelper {
9357
9360
  this.DATE_STRING_FORMAT = 'YYYY-MM-DD';
9358
9361
  this.DATE_READABLE_FORMAT = 'D MMMM YYYY';
9359
9362
  this._displayedMonthYear = new BehaviorSubject(null);
9360
- this.loadLocale = (language) => import(`dayjs/locale/${language}`).then(() => dayjs.locale(language));
9363
+ this.loadLocale = (language) => import(/* @vite-ignore */ `dayjs/locale/${language}`).then(() => dayjs.locale(language));
9361
9364
  }
9362
9365
  get displayedMonthYear() {
9363
9366
  return this._displayedMonthYear.asObservable();