@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/dist/index.js CHANGED
@@ -35,32 +35,9 @@ import Dropzone from "react-dropzone";
35
35
  import { AsyncPaginate } from "react-select-async-paginate";
36
36
  import { SVG } from "@svgdotjs/svg.js";
37
37
  import Highcharts from "highcharts";
38
- import HighchartsReact from "highcharts-react-official";
38
+ import { HighchartsReact } from "highcharts-react-official";
39
39
  import Slider$1 from "@rc-component/slider";
40
40
  import Tooltip from "@rc-component/tooltip";
41
- //#region \0rolldown/runtime.js
42
- var __create = Object.create;
43
- var __defProp = Object.defineProperty;
44
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
45
- var __getOwnPropNames = Object.getOwnPropertyNames;
46
- var __getProtoOf = Object.getPrototypeOf;
47
- var __hasOwnProp = Object.prototype.hasOwnProperty;
48
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
49
- var __copyProps = (to, from, except, desc) => {
50
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
51
- key = keys[i];
52
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
53
- get: ((k) => from[k]).bind(null, key),
54
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
55
- });
56
- }
57
- return to;
58
- };
59
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
60
- value: mod,
61
- enumerable: true
62
- }) : target, mod));
63
- //#endregion
64
41
  //#region src/modules/messageBox/messageBox.tsx
65
42
  var groupNamesToToastIds = {};
66
43
  var DEFAULT_AUTO_CLOSE_MS = 3e3;
@@ -77,8 +54,10 @@ var setGlobalErrorMessageBoxOptions = (options) => {
77
54
  globalErrorMessageBoxOptions = options;
78
55
  };
79
56
  var storeGroupName = (groupName, toastId) => {
80
- if (groupName) if (groupNamesToToastIds[groupName]) groupNamesToToastIds[groupName] = [...groupNamesToToastIds[groupName], toastId];
81
- else groupNamesToToastIds[groupName] = [toastId];
57
+ if (groupName) {
58
+ if (groupNamesToToastIds[groupName]) groupNamesToToastIds[groupName] = [...groupNamesToToastIds[groupName], toastId];
59
+ else groupNamesToToastIds[groupName] = [toastId];
60
+ }
82
61
  };
83
62
  var messageBoxSuccess = (content, options, groupName) => {
84
63
  const toastId = toast.success(content, {
@@ -254,8 +233,10 @@ function convertToTree({ childNodeKey, idKey, displayNameKey, typeKey, lazyLoada
254
233
  */
255
234
  function patchNode(node, patch) {
256
235
  let patchedChildren;
257
- if (patch.children !== void 0) if (node.children !== void 0) patchedChildren = [...node.children, ...patch.children];
258
- else patchedChildren = [...patch.children];
236
+ if (patch.children !== void 0) {
237
+ if (node.children !== void 0) patchedChildren = [...node.children, ...patch.children];
238
+ else patchedChildren = [...patch.children];
239
+ }
259
240
  return {
260
241
  ...node,
261
242
  ...patch,
@@ -825,8 +806,9 @@ function RouteLink({ to, confirm, className, title, children, keyboardShortcut,
825
806
  pushRoute();
826
807
  }
827
808
  };
809
+ const href = history.createHref(typeof to === "string" ? { pathname: to } : to);
828
810
  return /* @__PURE__ */ jsx("a", {
829
- href: history.createHref(typeof to === "string" ? { pathname: to } : to),
811
+ href,
830
812
  onClick: handleClickEvent,
831
813
  className: `di route-link ${className || ""}`,
832
814
  title: title ? t(title.id, { defaultValue: title.defaultValue }) : void 0,
@@ -1067,8 +1049,9 @@ var NodeInfo = class extends React.PureComponent {
1067
1049
  }
1068
1050
  render() {
1069
1051
  const { node, node: { name }, leafNode, expanded, isLastChild, onExpand, selectionState, isLoading } = this.props;
1052
+ const selected = selectionState === SelectionState.ALL;
1070
1053
  return /* @__PURE__ */ jsxs("div", {
1071
- className: `node-info ${selectionState === SelectionState.ALL ? "selected" : ""}`,
1054
+ className: `node-info ${selected ? "selected" : ""}`,
1072
1055
  children: [
1073
1056
  isLastChild !== void 0 && /* @__PURE__ */ jsx(Skeleton, { lastChild: isLastChild }),
1074
1057
  /* @__PURE__ */ jsx(NodeImage, {
@@ -1762,10 +1745,12 @@ var ReactableTableHeader = class extends Component {
1762
1745
  this.getClassName = (columnDef) => {
1763
1746
  const { paginationSettings, tableName } = this.props;
1764
1747
  const className = getClassName(tableName, columnDef.name);
1765
- if (columnDef.sortable) if (columnDef.name === paginationSettings.sort.property) if (paginationSettings.sort.direction === "ASC") return `${className} sortable sortAsc`;
1766
- else return `${className} sortable sortDes`;
1767
- else return `${className} sortable`;
1768
- else return `${className}`;
1748
+ if (columnDef.sortable) {
1749
+ if (columnDef.name === paginationSettings.sort.property) {
1750
+ if (paginationSettings.sort.direction === "ASC") return `${className} sortable sortAsc`;
1751
+ else return `${className} sortable sortDes`;
1752
+ } else return `${className} sortable`;
1753
+ } else return `${className}`;
1769
1754
  };
1770
1755
  this.printLabel = (label) => {
1771
1756
  if (isTranslationDescriptor(label)) return /* @__PURE__ */ jsx(Trans, {
@@ -2053,17 +2038,19 @@ var ReactableWithClientSidePagination = class extends Component {
2053
2038
  };
2054
2039
  this.handleSelectChange = (selected, item) => {
2055
2040
  const { onSelectedItemsChange, selectedItems = [], uniqueItemKey } = this.props;
2056
- if (onSelectedItemsChange) if (selected) onSelectedItemsChange(selectedItems.concat(uniqueItemKey(item)));
2057
- else onSelectedItemsChange(selectedItems.filter((key) => key !== uniqueItemKey(item)));
2058
- else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2041
+ if (onSelectedItemsChange) {
2042
+ if (selected) onSelectedItemsChange(selectedItems.concat(uniqueItemKey(item)));
2043
+ else onSelectedItemsChange(selectedItems.filter((key) => key !== uniqueItemKey(item)));
2044
+ } else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2059
2045
  };
2060
2046
  this.handleSelectAllChange = (selectedAll) => {
2061
2047
  const { onSelectedItemsChange, items, selectedItems = [], uniqueItemKey } = this.props;
2062
2048
  const { filteredItems } = this.state;
2063
2049
  const visibleItems = (filteredItems || items || []).map(uniqueItemKey);
2064
- if (onSelectedItemsChange) if (selectedAll) onSelectedItemsChange(uniqWith([...selectedItems, ...visibleItems], isEqual).sort());
2065
- else onSelectedItemsChange(difference(selectedItems, visibleItems));
2066
- else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2050
+ if (onSelectedItemsChange) {
2051
+ if (selectedAll) onSelectedItemsChange(uniqWith([...selectedItems, ...visibleItems], isEqual).sort());
2052
+ else onSelectedItemsChange(difference(selectedItems, visibleItems));
2053
+ } else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
2067
2054
  };
2068
2055
  this.areSelectedAll = () => {
2069
2056
  const { items, selectedItems, uniqueItemKey } = this.props;
@@ -2103,8 +2090,9 @@ var ReactableWithClientSidePagination = class extends Component {
2103
2090
  }
2104
2091
  render() {
2105
2092
  const { uniqueItemKey, isLoading, columnDefs, rowDef, tableName, clickable, selectable, selectedItems, onChangeSize } = this.props;
2093
+ const finalColumnDefs = selectable ? extendColumnDefsWithCheckboxes(columnDefs, this.handleSelectChange, this.handleSelectAllChange, this.areSelectedAll(), selectedItems || [], uniqueItemKey) : columnDefs;
2106
2094
  return /* @__PURE__ */ jsx(Reactable, {
2107
- columnDefs: selectable ? extendColumnDefsWithCheckboxes(columnDefs, this.handleSelectChange, this.handleSelectAllChange, this.areSelectedAll(), selectedItems || [], uniqueItemKey) : columnDefs,
2095
+ columnDefs: finalColumnDefs,
2108
2096
  rowDef,
2109
2097
  uniqueItemKey,
2110
2098
  paginationSettings: this.state.paginationSettings,
@@ -2586,7 +2574,7 @@ var MultiMenuItem = class extends React.PureComponent {
2586
2574
  };
2587
2575
  //#endregion
2588
2576
  //#region src/components/periodpicker/components/Inputs.tsx
2589
- var ONE_HOUR = 3600 * 1e3;
2577
+ var ONE_HOUR = 36e5;
2590
2578
  function Inputs({ period, onChange, readOnly, locale, timezone }) {
2591
2579
  const [showWarningTarget, setShowWarningTarget] = useState("");
2592
2580
  const warningTimeoutRef = useRef(void 0);
@@ -2795,7 +2783,7 @@ function createLastXDays(days, timezone) {
2795
2783
  tsEnd: dayjs().endOf("day").valueOf()
2796
2784
  };
2797
2785
  }
2798
- var DAY_TO_MILLIS = 1e3 * 60 * 60 * 24;
2786
+ var DAY_TO_MILLIS = 864e5;
2799
2787
  function periodToDays({ tsStart, tsEnd }) {
2800
2788
  return Math.round((tsEnd - tsStart + 1) / DAY_TO_MILLIS);
2801
2789
  }
@@ -3394,9 +3382,10 @@ var Chart = class extends Component {
3394
3382
  }
3395
3383
  render() {
3396
3384
  const built = this.buildOptions();
3385
+ const options = this.props.updateOptions ? this.props.updateOptions(built) : built;
3397
3386
  return /* @__PURE__ */ jsx(HighchartsReact, {
3398
3387
  highcharts: Highcharts,
3399
- options: this.props.updateOptions ? this.props.updateOptions(built) : built,
3388
+ options,
3400
3389
  containerProps: { className: this.props.className },
3401
3390
  callback: this.handleChart
3402
3391
  });
@@ -3404,54 +3393,15 @@ var Chart = class extends Component {
3404
3393
  };
3405
3394
  //#endregion
3406
3395
  //#region src/components/slider/RcSliderWithTooltip.tsx
3407
- var import_raf = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
3408
- Object.defineProperty(exports, "__esModule", { value: true });
3409
- exports.default = void 0;
3410
- var raf = (callback) => +setTimeout(callback, 16);
3411
- var caf = (num) => clearTimeout(num);
3412
- if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
3413
- raf = (callback) => window.requestAnimationFrame(callback);
3414
- caf = (handle) => window.cancelAnimationFrame(handle);
3415
- }
3416
- var rafUUID = 0;
3417
- var rafIds = /* @__PURE__ */ new Map();
3418
- function cleanup(id) {
3419
- rafIds.delete(id);
3420
- }
3421
- var wrapperRaf = (callback, times = 1) => {
3422
- rafUUID += 1;
3423
- const id = rafUUID;
3424
- function callRef(leftTimes) {
3425
- if (leftTimes === 0) {
3426
- cleanup(id);
3427
- callback();
3428
- } else {
3429
- const realId = raf(() => {
3430
- callRef(leftTimes - 1);
3431
- });
3432
- rafIds.set(id, realId);
3433
- }
3434
- }
3435
- callRef(times);
3436
- return id;
3437
- };
3438
- wrapperRaf.cancel = (id) => {
3439
- const realId = rafIds.get(id);
3440
- cleanup(id);
3441
- return caf(realId);
3442
- };
3443
- if (process.env.NODE_ENV !== "production") wrapperRaf.ids = () => rafIds;
3444
- exports.default = wrapperRaf;
3445
- })))(), 1);
3446
3396
  var HandleTooltip = (props) => {
3447
3397
  const { value, children, visible, tipFormatter = (val) => `${val}`, ...restProps } = props;
3448
3398
  const tooltipRef = useRef(null);
3449
3399
  const rafRef = useRef(null);
3450
3400
  function cancelKeepAlign() {
3451
- if (rafRef.current) import_raf.default.cancel(rafRef.current);
3401
+ if (rafRef.current) cancelAnimationFrame(rafRef.current);
3452
3402
  }
3453
3403
  function keepAlign() {
3454
- rafRef.current = (0, import_raf.default)(() => {
3404
+ rafRef.current = requestAnimationFrame(() => {
3455
3405
  tooltipRef.current?.forceAlign();
3456
3406
  });
3457
3407
  }
@@ -3493,12 +3443,13 @@ function useLimitStyling(limit, min, max) {
3493
3443
  if (!containerEl) throw new Error(".rc-slider-rail element missing");
3494
3444
  const disabledAreaEl = containerEl?.querySelector(`.disabled-area-element`);
3495
3445
  const sliderWidth = containerEl.getBoundingClientRect().width;
3496
- if (disabledAreaEl) if (limit == null) disabledAreaEl.remove();
3497
- else {
3498
- const width = Math.round((max - limit) / (max - min) * sliderWidth);
3499
- disabledAreaEl.style.width = `${width}px`;
3500
- }
3501
- else if (limit != null) {
3446
+ if (disabledAreaEl) {
3447
+ if (limit == null) disabledAreaEl.remove();
3448
+ else {
3449
+ const width = Math.round((max - limit) / (max - min) * sliderWidth);
3450
+ disabledAreaEl.style.width = `${width}px`;
3451
+ }
3452
+ } else if (limit != null) {
3502
3453
  const width = Math.round((max - limit) / (max - min) * sliderWidth);
3503
3454
  const disabledAreaEl = document.createElement("div");
3504
3455
  disabledAreaEl.classList.add("disabled-area-element");