adb-shared 7.0.14 → 22.0.0-beta.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.
package/README.md CHANGED
@@ -1,63 +1,123 @@
1
- # ArtdataShared
2
-
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.0.
4
-
5
- ## Code scaffolding
6
-
7
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
-
9
- ```bash
10
- ng generate component component-name
11
- ```
12
-
13
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
-
15
- ```bash
16
- ng generate --help
17
- ```
18
-
19
- ## Building
20
-
21
- To build the library, run:
22
-
23
- ```bash
24
- ng build adb-shared
25
- ```
26
-
27
- This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
-
29
- ### Publishing the Library
30
-
31
- Once the project is built, you can publish your library by following these steps:
32
-
33
- 1. Navigate to the `dist` directory:
34
- ```bash
35
- cd dist/adb-shared
36
- ```
37
-
38
- 2. Run the `npm publish` command to publish your library to the npm registry:
39
- ```bash
40
- npm publish
41
- ```
42
-
43
- ## Running unit tests
44
-
45
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
-
47
- ```bash
48
- ng test
49
- ```
50
-
51
- ## Running end-to-end tests
52
-
53
- For end-to-end (e2e) testing, run:
54
-
55
- ```bash
56
- ng e2e
57
- ```
58
-
59
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
-
61
- ## Additional Resources
62
-
63
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
1
+ # adb-shared
2
+
3
+ Shared Angular components, directives, pipes, and services for ArtDatabanken applications. Version 22.0.0 targets Angular 22.
4
+
5
+ ## Installation
6
+
7
+ Install in an Angular 22 application:
8
+
9
+ ```bash
10
+ npm install adb-shared@22.0.0
11
+ ```
12
+
13
+ The application needs Angular Common, Core, Forms, and Router, as well as RxJS. The library's declared peer dependencies also include:
14
+
15
+ | Package | Version requirement |
16
+ | --- | --- |
17
+ | `@ngx-translate/core` | `>=18` |
18
+ | `@ngx-translate/http-loader` | `>=18` |
19
+ | `date-fns` | `^4.4.0` |
20
+ | `ol` | `^10.11.0` |
21
+
22
+ Configure the HTTP client and ngx-translate in the application for components that fetch data or display translations. The application is responsible for translation files and API configuration.
23
+
24
+ ## Usage
25
+
26
+ Import shared functionality from `adb-shared`. Example using a standalone component:
27
+
28
+ ```typescript
29
+ import { Component } from '@angular/core';
30
+ import { AdbPipesModule } from 'adb-shared';
31
+
32
+ @Component({
33
+ selector: 'app-example',
34
+ standalone: true,
35
+ imports: [AdbPipesModule],
36
+ template: '{{ 1234567 | adbSpacing }}',
37
+ })
38
+ export class ExampleComponent {}
39
+ ```
40
+
41
+ The library includes date pickers, pickers, pagination, modals, toast notifications, and a rich text editor. Import the corresponding module into the component or NgModule that uses it.
42
+
43
+ Configure pickers that make API requests using `AdbPickerModule.forRoot({ api: 'https://your-api.example' })` in the application's providers via `importProvidersFrom` for a standalone application, or in the root module's `imports` for an NgModule application.
44
+
45
+ ### Maps
46
+
47
+ Map functionality has a separate import path within the same npm package:
48
+
49
+ ```typescript
50
+ import { AdbMapModule } from 'adb-shared/map';
51
+ ```
52
+
53
+ Configure the map module using `AdbMapModule.forRoot(...)`. The `AdbMapConfig` configuration includes `api` and `artfaktaTaxonLists`, along with optional settings for features such as dynamic display and cluster selection. Map filters that use pickers also need the picker configuration described above.
54
+
55
+ ### Styles and assets
56
+
57
+ Components use classes from the SLU design system and Bootstrap Icons. These styles are not bundled as global CSS in the library. Install them in the consuming application as needed:
58
+
59
+ ```bash
60
+ npm install slu-design-system bootstrap-icons
61
+ ```
62
+
63
+ Add the following global styles, for example under the build target's `styles` in the application's `angular.json`:
64
+
65
+ ```json
66
+ [
67
+ "node_modules/slu-design-system/dist/designsystem-default.css",
68
+ "node_modules/bootstrap-icons/font/bootstrap-icons.css",
69
+ "node_modules/ol/ol.css",
70
+ "src/styles.scss"
71
+ ]
72
+ ```
73
+
74
+ The OpenLayers stylesheet is required for maps. Add application-specific adjustments to the application's own stylesheet; see the demo application for examples.
75
+
76
+ `ArtportalenNavModule` remains available in 22.0.0 for existing consumers. The navigation expects assets including `/assets/images/slu.svg`, `/assets/images/artdatabanken.svg`, and `/assets/artportalen/links-ap3.json`. The navigation and footer also fetch Artportalen translation files from their configured base URL. The application must provide these resources.
77
+
78
+ ## Development in this repository
79
+
80
+ Run commands from the workspace root (`components`):
81
+
82
+ ```bash
83
+ npm ci
84
+ npm start
85
+ ```
86
+
87
+ The demo application runs at `https://localhost:4200`. It uses local source files through TypeScript aliases for `adb-shared` and `adb-shared/map`.
88
+
89
+ Build the library in production mode:
90
+
91
+ ```bash
92
+ npm run build-prod
93
+ ```
94
+
95
+ The output is written to `dist/adb-shared` and includes the map module. Use `npm run watch` for continuous library builds during development.
96
+
97
+ ## Verification and publishing
98
+
99
+ 1. Check the version in `projects/adb-shared/package.json` and run the production build above.
100
+ 2. Inspect the package contents without publishing:
101
+
102
+ ```bash
103
+ npm pack ./dist/adb-shared --dry-run
104
+ ```
105
+
106
+ 3. Create a package and install it in a consuming application to verify the built exports, styles, and functionality:
107
+
108
+ ```bash
109
+ npm pack ./dist/adb-shared
110
+ ```
111
+
112
+ Install the generated `.tgz` file using `npm install /path/to/adb-shared-22.0.0.tgz` in the consuming application. Build the application and check the components it uses, including maps if applicable. The demo application's source imports do not replace this check.
113
+
114
+ 4. Publish the built package using an npm account with publishing permissions:
115
+
116
+ ```bash
117
+ cd dist/adb-shared
118
+ npm publish
119
+ ```
120
+
121
+ ## Upgrading from 7.x
122
+
123
+ Update the consuming application to Angular 22 and check the dependencies above. The map functionality in this version uses OpenLayers (`ol`); review older Leaflet integrations when upgrading. Older applications may require changes beyond updating the package version.