adb-shared 7.0.15 → 22.0.0-beta.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.
- package/README.md +123 -63
- package/fesm2022/adb-shared-map.mjs +2274 -897
- package/fesm2022/adb-shared-map.mjs.map +1 -1
- package/fesm2022/adb-shared.mjs +4765 -2894
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +11 -9
- package/types/adb-shared-map.d.ts +437 -237
- package/types/adb-shared.d.ts +1057 -875
package/README.md
CHANGED
|
@@ -1,63 +1,123 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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.
|