@deviceinsight/ng-ui-components 7.22.0 → 7.24.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 +104 -9
- package/dist/index.cjs +161 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +161 -165
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -3
- package/dist/types/__mocks__/i18n.d.ts.map +1 -1
- package/dist/types/components/chart/Chart.d.ts +11 -3
- package/dist/types/components/chart/Chart.d.ts.map +1 -1
- package/dist/types/components/chart/Chart.stories.d.ts +7 -7
- package/dist/types/components/chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/components/colorpicker/ColorTextInput.d.ts.map +1 -1
- package/dist/types/components/colorpicker/GradientColorPicker.stories.d.ts.map +1 -1
- package/dist/types/components/colorpicker/GridColorPicker.stories.d.ts.map +1 -1
- package/dist/types/components/contentHeader/ContentHeader.d.ts.map +1 -1
- package/dist/types/components/contentHeader/ContentHeader.stories.d.ts.map +1 -1
- package/dist/types/components/infobox/InfoBox.d.ts.map +1 -1
- package/dist/types/components/infobox/InfoBox.stories.d.ts.map +1 -1
- package/dist/types/components/input/DateInput.d.ts.map +1 -1
- package/dist/types/components/input/DateInput.stories.d.ts +2 -1
- package/dist/types/components/input/DateInput.stories.d.ts.map +1 -1
- package/dist/types/components/input/DateTimeInput.d.ts.map +1 -1
- package/dist/types/components/input/DateTimeInput.stories.d.ts +12 -11
- package/dist/types/components/input/DateTimeInput.stories.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearch.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearch.stories.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearchAsync.d.ts +5 -1
- package/dist/types/components/input/SelectWithSearchAsync.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearchAsync.stories.d.ts.map +1 -1
- package/dist/types/components/input/UrnInput.d.ts.map +1 -1
- package/dist/types/components/input/UrnInput.stories.d.ts.map +1 -1
- package/dist/types/components/input/ValidatedTextInput.d.ts.map +1 -1
- package/dist/types/components/input/ValidatedTextInput.stories.d.ts.map +1 -1
- package/dist/types/components/link/RouteLink.stories.d.ts.map +1 -1
- package/dist/types/components/multiMenu/MultiMenu.stories.d.ts.map +1 -1
- package/dist/types/components/multiMenu/components/MultiMenuContext.d.ts.map +1 -1
- package/dist/types/components/multiMenu/components/MultiMenuItem.d.ts.map +1 -1
- package/dist/types/components/pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/pagination/Pagination.stories.d.ts.map +1 -1
- package/dist/types/components/periodpicker/PeriodPicker.stories.d.ts.map +1 -1
- package/dist/types/components/periodpicker/components/MonthPicker.d.ts.map +1 -1
- package/dist/types/components/periodpicker/periods.d.ts.map +1 -1
- package/dist/types/components/prompt/Prompt.stories.d.ts.map +1 -1
- package/dist/types/components/reactable/Reactable.d.ts.map +1 -1
- package/dist/types/components/reactable/Reactable.stories.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableFilterRow.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableHeader.d.ts +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableHeader.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableRow.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTextFilter.d.ts.map +1 -1
- package/dist/types/components/reactableWithClientSidePagination/ReactableWithClientSidePagination.d.ts +7 -1
- package/dist/types/components/reactableWithClientSidePagination/ReactableWithClientSidePagination.d.ts.map +1 -1
- package/dist/types/components/reactableWithClientSidePagination/ReactableWithClientSidePagination.stories.d.ts.map +1 -1
- package/dist/types/components/slider/RcSliderWithTooltip.d.ts.map +1 -1
- package/dist/types/components/slider/Slider.d.ts.map +1 -1
- package/dist/types/components/slider/Slider.stories.d.ts.map +1 -1
- package/dist/types/components/svg/SvgImage.d.ts.map +1 -1
- package/dist/types/components/svg/SvgImage.stories.d.ts.map +1 -1
- package/dist/types/components/svg/utils/getMutableNodeList.d.ts.map +1 -1
- package/dist/types/components/svg/utils/getSvgElement.d.ts +1 -1
- package/dist/types/components/svg/utils/getSvgElement.d.ts.map +1 -1
- package/dist/types/components/svg/utils/transformPositionModifications.d.ts +1 -1
- package/dist/types/components/svg/utils/transformPositionModifications.d.ts.map +1 -1
- package/dist/types/components/svg/utils/validateSvg.d.ts +1 -1
- package/dist/types/components/svg/utils/validateSvg.d.ts.map +1 -1
- package/dist/types/components/tabs/RouteTabs.stories.d.ts.map +1 -1
- package/dist/types/components/treeview/TreeView.d.ts +9 -4
- package/dist/types/components/treeview/TreeView.d.ts.map +1 -1
- package/dist/types/components/treeview/TreeView.stories.d.ts.map +1 -1
- package/dist/types/components/treeview/components/Node.d.ts +2 -5
- package/dist/types/components/treeview/components/Node.d.ts.map +1 -1
- package/dist/types/components/treeview/components/NodeInfo.d.ts.map +1 -1
- package/dist/types/components/upload/FileUpload.d.ts.map +1 -1
- package/dist/types/components/upload/FileUpload.stories.d.ts.map +1 -1
- package/dist/types/components/upload/ImageUpload.d.ts +2 -2
- package/dist/types/components/upload/ImageUpload.d.ts.map +1 -1
- package/dist/types/components/upload/ImageUpload.stories.d.ts +11 -11
- package/dist/types/components/upload/ImageUpload.stories.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/messageBox/MessageBox.stories.d.ts.map +1 -1
- package/dist/types/modules/messageBox/messageBox.d.ts.map +1 -1
- package/dist/types/modules/utils/uuidGen.d.ts.map +1 -1
- package/package.json +24 -28
package/README.md
CHANGED
|
@@ -1,18 +1,109 @@
|
|
|
1
|
+
# General
|
|
2
|
+
|
|
3
|
+
This project contains the higher-level React components shared by
|
|
4
|
+
[NG-UI](https://gitlab.device-insight.com/ng-ui/ng-ui) and custom projects.
|
|
5
|
+
It is published as `@deviceinsight/ng-ui-components` and builds on
|
|
6
|
+
`@deviceinsight/ng-ui-basic-components` and `@deviceinsight/ng-ui-api-client`.
|
|
7
|
+
|
|
8
|
+
The package is ESM-first (`dist/index.js`) with a CommonJS build (`dist/index.cjs`)
|
|
9
|
+
and type declarations (`dist/types/index.d.ts`). The bundled stylesheet is exported
|
|
10
|
+
separately and has to be imported by the consuming project:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import '@deviceinsight/ng-ui-components/style.css';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`react`, `react-dom`, `i18next`, `react-i18next` and `react-router-dom` are peer
|
|
17
|
+
dependencies and have to be provided by the consuming project.
|
|
18
|
+
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
`src/index.ts` is the public API. It currently exports:
|
|
22
|
+
|
|
23
|
+
- **Inputs** — `DateInput`, `DateTimeInput`, `UrnInput`, `ValidatedTextInput`,
|
|
24
|
+
`SelectWithSearch`, `SelectWithSearchAsync`, `PeriodPicker`, `Slider`
|
|
25
|
+
- **Data display** — `Reactable`, `ReactableWithClientSidePagination`, `Pagination`,
|
|
26
|
+
`TreeView` (plus `getTreeNodePathById`), `Chart`, `InfoBox`, `ContentHeader`
|
|
27
|
+
- **Color pickers** — `ColorPicker` / `GridColorPicker`, `GradientColorPicker`
|
|
28
|
+
- **Navigation** — `RouteLink`, `RouteTabs`, `MultiMenu`, `MultiMenuItem`
|
|
29
|
+
- **Upload** — `FileUpload`, `ImageUpload`
|
|
30
|
+
- **SVG** — `SvgImage` and the helpers `getSvgElement`, `getMutableNodeList`,
|
|
31
|
+
`validateSvg`
|
|
32
|
+
- **Prompt** — `withPrompt`
|
|
33
|
+
- **Message box** — `messageBoxSuccess`, `messageBoxInfo`, `messageBoxWarn`,
|
|
34
|
+
`messageBoxError`, `messageBoxDismissSingle`, `messageBoxDismissGroup`,
|
|
35
|
+
`messageBoxDismissAll`, `setGlobalMessageBoxOptions`,
|
|
36
|
+
`setGlobalErrorMessageBoxOptions`, `MessageBoxContainer`
|
|
37
|
+
- **Utilities** — `uuidV4`, `nanoid10`, `initializeTranslation`
|
|
38
|
+
- the accompanying types (`ReactableProps`, `ReactableColumnDef`, `Period`,
|
|
39
|
+
`SvgImageProps`, `PaginationSettings`, …)
|
|
40
|
+
|
|
41
|
+
Translations live in `src/i18n` and are set up by calling `initializeTranslation`.
|
|
42
|
+
`src/modules` holds non-component code (message box, utils), `src/styles` the
|
|
43
|
+
stylesheet, `src/utils` shared helpers.
|
|
44
|
+
|
|
45
|
+
# Development
|
|
46
|
+
|
|
47
|
+
Node is pinned via `.nvmrc` (see also the `engines` field in `package.json`).
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
npm install
|
|
51
|
+
npm run storybook # dev server on http://localhost:6006
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Available scripts:
|
|
55
|
+
|
|
56
|
+
| Script | Description |
|
|
57
|
+
| ------------------------- | -------------------------------------------------------------------------- |
|
|
58
|
+
| `npm run build` | Cleans `dist`, bundles with Vite and emits types via `tsconfig.types.json` |
|
|
59
|
+
| `npm test` | Runs the Vitest suite (watch mode by default, `--run` for a single pass) |
|
|
60
|
+
| `npm run watch` | Rebuilds and runs `yalc push` on every successful compile |
|
|
61
|
+
| `npm run clean` | Removes `dist` |
|
|
62
|
+
| `npm run storybook` | Starts Storybook on port 6006 |
|
|
63
|
+
| `npm run build-storybook` | Builds the static Storybook |
|
|
64
|
+
| `npm run typecheck` | `tsc --noEmit` |
|
|
65
|
+
| `npm run lint` | Lints with oxlint and checks formatting with Prettier |
|
|
66
|
+
| `npm run prettier` | Formats the sources and `.mdx` files |
|
|
67
|
+
| `npm run scan` | Vulnerability scan via `audit-ci` using `scan-config.json5` |
|
|
68
|
+
|
|
69
|
+
Tests use Vitest with `happy-dom` and Testing Library; the setup lives in
|
|
70
|
+
`vitest.setup.tsx` and the config in `vitest.config.mts`. Components are additionally
|
|
71
|
+
exercised via Storybook stories (`*.stories.tsx`).
|
|
72
|
+
|
|
73
|
+
Commits are checked by a husky `pre-commit` hook that runs `lint-staged`
|
|
74
|
+
(prettier on the staged files).
|
|
75
|
+
|
|
76
|
+
`CHANGELOG.md` is maintained per version. Renovate dependency updates append their
|
|
77
|
+
entry automatically via the `postUpgradeTasks` hook in `renovate.json`, which calls
|
|
78
|
+
`./update-changelog.sh <depName> <currentVersion> <newVersion>`.
|
|
79
|
+
|
|
1
80
|
# Linking for local development
|
|
2
81
|
|
|
3
|
-
We recommend using `yalc` tool for linking
|
|
82
|
+
We recommend using the `yalc` tool for linking `@deviceinsight/ng-ui-components`. It's because `yalc` generates exactly the same package as
|
|
4
83
|
it would be published to the npm registry, especially it removes files that should be ignored and their existence cause
|
|
5
|
-
problems when we use `
|
|
84
|
+
problems when we use `npm link`.
|
|
6
85
|
|
|
7
86
|
Here's how to do the linking:
|
|
8
87
|
|
|
9
88
|
```shell
|
|
10
|
-
|
|
89
|
+
npm run build
|
|
90
|
+
npx yalc publish
|
|
11
91
|
|
|
12
92
|
# in the project where you want to link this library to:
|
|
13
|
-
yalc link "@deviceinsight/ng-ui-components"
|
|
93
|
+
npx yalc link "@deviceinsight/ng-ui-components"
|
|
14
94
|
```
|
|
15
95
|
|
|
96
|
+
# CI
|
|
97
|
+
|
|
98
|
+
`.gitlab-ci.yml` installs the dependencies and then runs `test`, `scan`, `lint` and
|
|
99
|
+
`typecheck` on every branch except `main`. On `develop` the `pages` job publishes the
|
|
100
|
+
static Storybook to GitLab Pages. The `publish` job runs for `develop` and for tags:
|
|
101
|
+
`-SNAPSHOT` versions are published to the internal Nexus registry under the `next`
|
|
102
|
+
tag, releases go to the public npm registry. A release older than the currently
|
|
103
|
+
published `latest` is published under a `hotfix-<major>.<minor>` tag so that `latest`
|
|
104
|
+
is not moved backwards. `publish_alpha` is a manual job that publishes an alpha
|
|
105
|
+
prerelease of the `VERSION` variable to the internal registry under `next`.
|
|
106
|
+
|
|
16
107
|
# Releasing the library using git flow
|
|
17
108
|
|
|
18
109
|
## Prerequisites
|
|
@@ -24,7 +115,8 @@ The git flow tools need to be installed. This depends on your operating system.
|
|
|
24
115
|
They can be also installed from the git repo: https://github.com/petervanderdoes/gitflow-avh
|
|
25
116
|
|
|
26
117
|
After git flow is installed, the repo needs to be initialized. Run `git flow init` and answer every
|
|
27
|
-
question with the default (press Enter/Return).
|
|
118
|
+
question with the default (press Enter/Return). The script verifies that the branches
|
|
119
|
+
are named `main` and `develop`.
|
|
28
120
|
|
|
29
121
|
## Building a release
|
|
30
122
|
|
|
@@ -34,9 +126,8 @@ To build a release of this library, execute `./release.sh`, which consists of th
|
|
|
34
126
|
|
|
35
127
|
Vulnerabilities can occur at any time.
|
|
36
128
|
To be sure, the pipeline for the branches and the tags created
|
|
37
|
-
in the release process will not fail,
|
|
38
|
-
release
|
|
39
|
-
To do this, run:
|
|
129
|
+
in the release process will not fail, the script runs the checks locally before building the
|
|
130
|
+
release:
|
|
40
131
|
|
|
41
132
|
```
|
|
42
133
|
npm install
|
|
@@ -44,12 +135,16 @@ npm run scan
|
|
|
44
135
|
npm run test
|
|
45
136
|
```
|
|
46
137
|
|
|
138
|
+
If `package-lock.json` changed during the install, the script commits it.
|
|
139
|
+
|
|
47
140
|
### Building the release
|
|
48
141
|
|
|
49
142
|
1. Switch to develop branch and make sure both main and develop are current:
|
|
50
143
|
|
|
51
144
|
`git checkout develop && git pull && git fetch origin main:main`
|
|
52
145
|
|
|
146
|
+
The script also aborts if the workarea is dirty or if `develop` has unpushed commits.
|
|
147
|
+
|
|
53
148
|
2. Get the upcoming release from `package.json` and start the release:
|
|
54
149
|
|
|
55
150
|
`git flow release start $RELEASE_VERSION`, e.g. `git flow release start 1.2.0`.
|
|
@@ -86,7 +181,7 @@ so that the version is e.g. `1.2.0-SNAPSHOT`.
|
|
|
86
181
|
|
|
87
182
|
5.2. Run `npm install`.
|
|
88
183
|
|
|
89
|
-
5.
|
|
184
|
+
5.3. Commit `package.json` and `package-lock.json`. Commit message should be `Starting $NEW_SNAPSHOT_VERSION`, e.g. `Starting 1.2.0`.
|
|
90
185
|
|
|
91
186
|
6. Push the branches and the tag:
|
|
92
187
|
|