@deviceinsight/ng-ui-components 7.23.0 → 7.25.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
@@ -95,9 +95,10 @@ npx yalc link "@deviceinsight/ng-ui-components"
95
95
 
96
96
  # CI
97
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:
98
+ `.gitlab-ci.yml` installs the dependencies and then runs `test`, `lint` and `typecheck`
99
+ on every branch except `main`. The `audit` job (`npm run scan`) only runs on `develop`,
100
+ `feature/*` and `renovate/*` branches, so hotfixes and tags are not blocked by it. On `develop` the
101
+ `pages` job publishes the static Storybook to GitLab Pages. The `publish` job runs for `develop` and for tags:
101
102
  `-SNAPSHOT` versions are published to the internal Nexus registry under the `next`
102
103
  tag, releases go to the public npm registry. A release older than the currently
103
104
  published `latest` is published under a `hotfix-<major>.<minor>` tag so that `latest`
@@ -118,77 +119,55 @@ After git flow is installed, the repo needs to be initialized. Run `git flow ini
118
119
  question with the default (press Enter/Return). The script verifies that the branches
119
120
  are named `main` and `develop`.
120
121
 
121
- ## Building a release
122
+ ## Releasing the develop branch
122
123
 
123
- To build a release of this library, execute `./release.sh`, which consists of the following steps:
124
+ Run the release script from the repository root:
124
125
 
125
- ### Before the release: Check for vulnerabilities and run the tests
126
-
127
- Vulnerabilities can occur at any time.
128
- To be sure, the pipeline for the branches and the tags created
129
- in the release process will not fail, the script runs the checks locally before building the
130
- release:
131
-
132
- ```
133
- npm install
134
- npm run scan
135
- npm run test
126
+ ```shell
127
+ ./release.sh
136
128
  ```
137
129
 
138
- If `package-lock.json` changed during the install, the script commits it.
139
-
140
- ### Building the release
141
-
142
- 1. Switch to develop branch and make sure both main and develop are current:
143
-
144
- `git checkout develop && git pull && git fetch origin main:main`
145
-
146
- The script also aborts if the workarea is dirty or if `develop` has unpushed commits.
147
-
148
- 2. Get the upcoming release from `package.json` and start the release:
149
-
150
- `git flow release start $RELEASE_VERSION`, e.g. `git flow release start 1.2.0`.
151
-
152
- 3. Edit the version in `package.json`.
153
-
154
- 3.1. Edit the version in `package.json`, remove the `-SNAPSHOT`.
155
-
156
- 3.2. Commit `package.json`. Commit message should be `Release $RELEASE_VERSION`, e.g. `Release 1.2.0`.
157
-
158
- 4. Finish the release:
159
-
160
- `git flow release finish`
161
-
162
- This will merge the release branch into the `main` branch and create a tag.
163
- It will also merge the release branch into the `develop` branch.
164
-
165
- After this you should be on the `develop` branch.
166
-
167
- 4.1 A merge conflict might occur in `package.json` for the `version`, when main is merged into the develop branch:
168
-
169
- Resolve it by taking the version of the `develop` branch. Then run `npm install` to resolve conflicts in `package-lock.version`.
170
-
171
- Run `git status` to see if there are more conflicts. If there are, resolve them and `git add` the fixed files.
172
-
173
- If there are no more conflicts, run `git add package*` and `git commit`.
174
-
175
- 5. Start a new snapshot version:
176
-
177
- 5.1.
178
- Edit the version in `package.json`,
179
- increment the minor version (e.g., from `1.1.0` to `1.2.0`) and add the `-SNAPSHOT` again,
180
- so that the version is e.g. `1.2.0-SNAPSHOT`.
181
-
182
- 5.2. Run `npm install`.
183
-
184
- 5.3. Commit `package.json` and `package-lock.json`. Commit message should be `Starting $NEW_SNAPSHOT_VERSION`, e.g. `Starting 1.2.0`.
185
-
186
- 6. Push the branches and the tag:
187
-
188
- On branch `develop`:
189
-
190
- `git push`
191
- `git checkout main`
192
- `git push`
193
- `git push --tags`
194
- `git checkout develop`
130
+ Before running it, make sure the workarea is clean and all commits on `develop` are pushed; otherwise the script aborts.
131
+ It releases the current version from `package.json` (without `-SNAPSHOT`) and afterwards starts the next minor snapshot version.
132
+
133
+ ## Building a hotfix for a specific version of this library
134
+
135
+ When building a hotfix in `ng-ui-scale`, first check which version of this library is used on the `main` branch of `ng-ui-scale`, e.g. with `git show origin/main:package.json | grep ng-ui-components`.
136
+ Then build the hotfix on top of exactly that version, so that no unrelated changes from newer releases end up in the `ng-ui-scale` hotfix.
137
+ Do not use `release.sh` or `git flow hotfix` for this: `git flow hotfix finish` merges into `main`, which already contains the newer release.
138
+
139
+ Example: `ng-ui-scale` uses 7.22.0 while 7.24.0 is already released (the version on `main` of this library):
140
+
141
+ 1. Create the branch `hotfix/7.22.1` from the tag 7.22.0:
142
+ ```shell
143
+ git fetch --tags
144
+ git checkout -b hotfix/7.22.1 7.22.0
145
+ ```
146
+ 2. Set the version in `package.json` and `package-lock.json` to 7.22.1:
147
+ ```shell
148
+ npm version 7.22.1 --no-git-tag-version
149
+ ```
150
+ If the `audit` job in `.gitlab-ci.yml` still runs on every branch except `main`, copy its `rules` from `develop`, so that the vulnerability audit does not block the hotfix pipeline.
151
+ 3. Implement or cherry-pick the changes needed for the hotfix, either directly on the hotfix branch or in a feature branch that is merged into it.
152
+ 4. Add a `## Version 7.22.1` entry to `CHANGELOG.md` describing the changes in the hotfix.
153
+ 5. Run `npm run build`, `npm test -- --run` and `npm run lint` to verify there are no errors.
154
+ 6. Commit the changes.
155
+ 7. Tag the hotfix commit and push the tag:
156
+ ```shell
157
+ git tag -a 7.22.1 -m "Hotfix 7.22.1"
158
+ git push origin 7.22.1
159
+ ```
160
+ The `publish` CI job builds the tag and publishes it to npm.
161
+ Because 7.22.1 is older than the `latest` version, it is published under the dist-tag `hotfix-7.22` and `latest` stays at 7.24.0.
162
+ 8. Merge the hotfix branch into `develop` and push `develop`:
163
+ ```shell
164
+ git checkout develop
165
+ git pull
166
+ git merge --no-ff hotfix/7.22.1
167
+ git push
168
+ ```
169
+ `package.json` and `package-lock.json` will conflict; keep the `-SNAPSHOT` version of `develop` and run `npm install` before committing the merge.
170
+ In `CHANGELOG.md`, keep the 7.22.1 entry between the entries for 7.23.0 and 7.22.0.
171
+ Do not merge the hotfix branch into `main`.
172
+ 9. Delete the local hotfix branch: `git branch -d hotfix/7.22.1`.
173
+ 10. Update `ng-ui-scale` on its hotfix branch to 7.22.1.
package/dist/index.cjs CHANGED
@@ -6,7 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
9
  var __copyProps = (to, from, except, desc) => {
11
10
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
11
  key = keys[i];
@@ -17,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
17
16
  }
18
17
  return to;
19
18
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
20
  value: mod,
22
21
  enumerable: true
23
22
  }) : target, mod));
@@ -73,7 +72,6 @@ let _svgdotjs_svg_js = require("@svgdotjs/svg.js");
73
72
  let highcharts = require("highcharts");
74
73
  highcharts = __toESM(highcharts, 1);
75
74
  let highcharts_react_official = require("highcharts-react-official");
76
- highcharts_react_official = __toESM(highcharts_react_official, 1);
77
75
  let _rc_component_slider = require("@rc-component/slider");
78
76
  _rc_component_slider = __toESM(_rc_component_slider, 1);
79
77
  let _rc_component_tooltip = require("@rc-component/tooltip");
@@ -94,8 +92,10 @@ var setGlobalErrorMessageBoxOptions = (options) => {
94
92
  globalErrorMessageBoxOptions = options;
95
93
  };
96
94
  var storeGroupName = (groupName, toastId) => {
97
- if (groupName) if (groupNamesToToastIds[groupName]) groupNamesToToastIds[groupName] = [...groupNamesToToastIds[groupName], toastId];
98
- else groupNamesToToastIds[groupName] = [toastId];
95
+ if (groupName) {
96
+ if (groupNamesToToastIds[groupName]) groupNamesToToastIds[groupName] = [...groupNamesToToastIds[groupName], toastId];
97
+ else groupNamesToToastIds[groupName] = [toastId];
98
+ }
99
99
  };
100
100
  var messageBoxSuccess = (content, options, groupName) => {
101
101
  const toastId = react_toastify_unstyled.toast.success(content, {
@@ -271,8 +271,10 @@ function convertToTree({ childNodeKey, idKey, displayNameKey, typeKey, lazyLoada
271
271
  */
272
272
  function patchNode(node, patch) {
273
273
  let patchedChildren;
274
- if (patch.children !== void 0) if (node.children !== void 0) patchedChildren = [...node.children, ...patch.children];
275
- else patchedChildren = [...patch.children];
274
+ if (patch.children !== void 0) {
275
+ if (node.children !== void 0) patchedChildren = [...node.children, ...patch.children];
276
+ else patchedChildren = [...patch.children];
277
+ }
276
278
  return {
277
279
  ...node,
278
280
  ...patch,
@@ -842,8 +844,9 @@ function RouteLink({ to, confirm, className, title, children, keyboardShortcut,
842
844
  pushRoute();
843
845
  }
844
846
  };
847
+ const href = history.createHref(typeof to === "string" ? { pathname: to } : to);
845
848
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
846
- href: history.createHref(typeof to === "string" ? { pathname: to } : to),
849
+ href,
847
850
  onClick: handleClickEvent,
848
851
  className: `di route-link ${className || ""}`,
849
852
  title: title ? t(title.id, { defaultValue: title.defaultValue }) : void 0,
@@ -1084,8 +1087,9 @@ var NodeInfo = class extends react.PureComponent {
1084
1087
  }
1085
1088
  render() {
1086
1089
  const { node, node: { name }, leafNode, expanded, isLastChild, onExpand, selectionState, isLoading } = this.props;
1090
+ const selected = selectionState === SelectionState.ALL;
1087
1091
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1088
- className: `node-info ${selectionState === SelectionState.ALL ? "selected" : ""}`,
1092
+ className: `node-info ${selected ? "selected" : ""}`,
1089
1093
  children: [
1090
1094
  isLastChild !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, { lastChild: isLastChild }),
1091
1095
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeImage, {
@@ -1779,10 +1783,12 @@ var ReactableTableHeader = class extends react.Component {
1779
1783
  this.getClassName = (columnDef) => {
1780
1784
  const { paginationSettings, tableName } = this.props;
1781
1785
  const className = getClassName(tableName, columnDef.name);
1782
- if (columnDef.sortable) if (columnDef.name === paginationSettings.sort.property) if (paginationSettings.sort.direction === "ASC") return `${className} sortable sortAsc`;
1783
- else return `${className} sortable sortDes`;
1784
- else return `${className} sortable`;
1785
- else return `${className}`;
1786
+ if (columnDef.sortable) {
1787
+ if (columnDef.name === paginationSettings.sort.property) {
1788
+ if (paginationSettings.sort.direction === "ASC") return `${className} sortable sortAsc`;
1789
+ else return `${className} sortable sortDes`;
1790
+ } else return `${className} sortable`;
1791
+ } else return `${className}`;
1786
1792
  };
1787
1793
  this.printLabel = (label) => {
1788
1794
  if (isTranslationDescriptor(label)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trans, {
@@ -2070,17 +2076,19 @@ var ReactableWithClientSidePagination = class extends react.Component {
2070
2076
  };
2071
2077
  this.handleSelectChange = (selected, item) => {
2072
2078
  const { onSelectedItemsChange, selectedItems = [], uniqueItemKey } = this.props;
2073
- if (onSelectedItemsChange) if (selected) onSelectedItemsChange(selectedItems.concat(uniqueItemKey(item)));
2074
- else onSelectedItemsChange(selectedItems.filter((key) => key !== uniqueItemKey(item)));
2075
- else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2079
+ if (onSelectedItemsChange) {
2080
+ if (selected) onSelectedItemsChange(selectedItems.concat(uniqueItemKey(item)));
2081
+ else onSelectedItemsChange(selectedItems.filter((key) => key !== uniqueItemKey(item)));
2082
+ } else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2076
2083
  };
2077
2084
  this.handleSelectAllChange = (selectedAll) => {
2078
2085
  const { onSelectedItemsChange, items, selectedItems = [], uniqueItemKey } = this.props;
2079
2086
  const { filteredItems } = this.state;
2080
2087
  const visibleItems = (filteredItems || items || []).map(uniqueItemKey);
2081
- if (onSelectedItemsChange) if (selectedAll) onSelectedItemsChange((0, lodash.uniqWith)([...selectedItems, ...visibleItems], lodash.isEqual).sort());
2082
- else onSelectedItemsChange((0, lodash.difference)(selectedItems, visibleItems));
2083
- else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2088
+ if (onSelectedItemsChange) {
2089
+ if (selectedAll) onSelectedItemsChange((0, lodash.uniqWith)([...selectedItems, ...visibleItems], lodash.isEqual).sort());
2090
+ else onSelectedItemsChange((0, lodash.difference)(selectedItems, visibleItems));
2091
+ } else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2084
2092
  };
2085
2093
  this.areSelectedAll = () => {
2086
2094
  const { items, selectedItems, uniqueItemKey } = this.props;
@@ -2120,8 +2128,9 @@ var ReactableWithClientSidePagination = class extends react.Component {
2120
2128
  }
2121
2129
  render() {
2122
2130
  const { uniqueItemKey, isLoading, columnDefs, rowDef, tableName, clickable, selectable, selectedItems, onChangeSize } = this.props;
2131
+ const finalColumnDefs = selectable ? extendColumnDefsWithCheckboxes(columnDefs, this.handleSelectChange, this.handleSelectAllChange, this.areSelectedAll(), selectedItems || [], uniqueItemKey) : columnDefs;
2123
2132
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Reactable, {
2124
- columnDefs: selectable ? extendColumnDefsWithCheckboxes(columnDefs, this.handleSelectChange, this.handleSelectAllChange, this.areSelectedAll(), selectedItems || [], uniqueItemKey) : columnDefs,
2133
+ columnDefs: finalColumnDefs,
2125
2134
  rowDef,
2126
2135
  uniqueItemKey,
2127
2136
  paginationSettings: this.state.paginationSettings,
@@ -2603,7 +2612,7 @@ var MultiMenuItem = class extends react.PureComponent {
2603
2612
  };
2604
2613
  //#endregion
2605
2614
  //#region src/components/periodpicker/components/Inputs.tsx
2606
- var ONE_HOUR = 3600 * 1e3;
2615
+ var ONE_HOUR = 36e5;
2607
2616
  function Inputs({ period, onChange, readOnly, locale, timezone }) {
2608
2617
  const [showWarningTarget, setShowWarningTarget] = (0, react.useState)("");
2609
2618
  const warningTimeoutRef = (0, react.useRef)(void 0);
@@ -2812,7 +2821,7 @@ function createLastXDays(days, timezone) {
2812
2821
  tsEnd: (0, dayjs.default)().endOf("day").valueOf()
2813
2822
  };
2814
2823
  }
2815
- var DAY_TO_MILLIS = 1e3 * 60 * 60 * 24;
2824
+ var DAY_TO_MILLIS = 864e5;
2816
2825
  function periodToDays({ tsStart, tsEnd }) {
2817
2826
  return Math.round((tsEnd - tsStart + 1) / DAY_TO_MILLIS);
2818
2827
  }
@@ -3411,9 +3420,10 @@ var Chart = class extends react.Component {
3411
3420
  }
3412
3421
  render() {
3413
3422
  const built = this.buildOptions();
3414
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(highcharts_react_official.default, {
3423
+ const options = this.props.updateOptions ? this.props.updateOptions(built) : built;
3424
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(highcharts_react_official.HighchartsReact, {
3415
3425
  highcharts: highcharts.default,
3416
- options: this.props.updateOptions ? this.props.updateOptions(built) : built,
3426
+ options,
3417
3427
  containerProps: { className: this.props.className },
3418
3428
  callback: this.handleChart
3419
3429
  });
@@ -3421,54 +3431,15 @@ var Chart = class extends react.Component {
3421
3431
  };
3422
3432
  //#endregion
3423
3433
  //#region src/components/slider/RcSliderWithTooltip.tsx
3424
- var import_raf = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
3425
- Object.defineProperty(exports, "__esModule", { value: true });
3426
- exports.default = void 0;
3427
- var raf = (callback) => +setTimeout(callback, 16);
3428
- var caf = (num) => clearTimeout(num);
3429
- if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
3430
- raf = (callback) => window.requestAnimationFrame(callback);
3431
- caf = (handle) => window.cancelAnimationFrame(handle);
3432
- }
3433
- var rafUUID = 0;
3434
- var rafIds = /* @__PURE__ */ new Map();
3435
- function cleanup(id) {
3436
- rafIds.delete(id);
3437
- }
3438
- var wrapperRaf = (callback, times = 1) => {
3439
- rafUUID += 1;
3440
- const id = rafUUID;
3441
- function callRef(leftTimes) {
3442
- if (leftTimes === 0) {
3443
- cleanup(id);
3444
- callback();
3445
- } else {
3446
- const realId = raf(() => {
3447
- callRef(leftTimes - 1);
3448
- });
3449
- rafIds.set(id, realId);
3450
- }
3451
- }
3452
- callRef(times);
3453
- return id;
3454
- };
3455
- wrapperRaf.cancel = (id) => {
3456
- const realId = rafIds.get(id);
3457
- cleanup(id);
3458
- return caf(realId);
3459
- };
3460
- if (process.env.NODE_ENV !== "production") wrapperRaf.ids = () => rafIds;
3461
- exports.default = wrapperRaf;
3462
- })))(), 1);
3463
3434
  var HandleTooltip = (props) => {
3464
3435
  const { value, children, visible, tipFormatter = (val) => `${val}`, ...restProps } = props;
3465
3436
  const tooltipRef = (0, react.useRef)(null);
3466
3437
  const rafRef = (0, react.useRef)(null);
3467
3438
  function cancelKeepAlign() {
3468
- if (rafRef.current) import_raf.default.cancel(rafRef.current);
3439
+ if (rafRef.current) cancelAnimationFrame(rafRef.current);
3469
3440
  }
3470
3441
  function keepAlign() {
3471
- rafRef.current = (0, import_raf.default)(() => {
3442
+ rafRef.current = requestAnimationFrame(() => {
3472
3443
  tooltipRef.current?.forceAlign();
3473
3444
  });
3474
3445
  }
@@ -3510,12 +3481,13 @@ function useLimitStyling(limit, min, max) {
3510
3481
  if (!containerEl) throw new Error(".rc-slider-rail element missing");
3511
3482
  const disabledAreaEl = containerEl?.querySelector(`.disabled-area-element`);
3512
3483
  const sliderWidth = containerEl.getBoundingClientRect().width;
3513
- if (disabledAreaEl) if (limit == null) disabledAreaEl.remove();
3514
- else {
3515
- const width = Math.round((max - limit) / (max - min) * sliderWidth);
3516
- disabledAreaEl.style.width = `${width}px`;
3517
- }
3518
- else if (limit != null) {
3484
+ if (disabledAreaEl) {
3485
+ if (limit == null) disabledAreaEl.remove();
3486
+ else {
3487
+ const width = Math.round((max - limit) / (max - min) * sliderWidth);
3488
+ disabledAreaEl.style.width = `${width}px`;
3489
+ }
3490
+ } else if (limit != null) {
3519
3491
  const width = Math.round((max - limit) / (max - min) * sliderWidth);
3520
3492
  const disabledAreaEl = document.createElement("div");
3521
3493
  disabledAreaEl.classList.add("disabled-area-element");