Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI: Replace global lodash dependency with individual packages (#2430)

Martin Peeters7d490b6c8fc8
diff --git a/ui/component/core/package.json b/ui/component/core/package.json
index a3dbc58cd..cc88df9b8 100644
--- a/ui/component/core/package.json
+++ b/ui/component/core/package.json
@@ -28,13 +28,14 @@
"i18next": "^21.5.3",
"i18next-http-backend": "^1.3.1",
"keycloak-js": "^25.0.1",
- "lodash": "^4.17.21",
+ "lodash.transform": "^4.6.0",
"moment": "^2.29.4",
"platform": "^1.3.6",
"qs": "^6.8.0",
"url-search-params-polyfill": "^8.1.0"
},
"devDependencies": {
+ "@types/lodash.transform": "^4",
"@types/qs": "^6.9.7"
},
"publishConfig": {
diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.ts
index af497d89f..a48c6731d 100644
--- a/ui/component/core/src/util.ts
+++ b/ui/component/core/src/util.ts
@@ -28,7 +28,7 @@ import i18next from "i18next";
import Qs from "qs";
import moment from "moment";
import DateTimeFormatOptions = Intl.DateTimeFormatOptions;
-import {transform} from "lodash";
+import transform from "lodash.transform";
export class Deferred<T> {
diff --git a/ui/component/or-asset-tree/package.json b/ui/component/or-asset-tree/package.json
index a431de05b..40034c845 100644
--- a/ui/component/or-asset-tree/package.json
+++ b/ui/component/or-asset-tree/package.json
@@ -28,9 +28,12 @@
"@openremote/or-mwc-components": "workspace:*",
"@openremote/or-translate": "workspace:*",
"lit": "^3.3.1",
- "lodash": "^4.17.21",
+ "lodash.debounce": "^4.0.8",
"qs": "^6.8.0"
},
+ "devDependencies": {
+ "@types/lodash.debounce": "^4"
+ },
"publishConfig": {
"access": "public"
}
diff --git a/ui/component/or-asset-tree/src/index.ts b/ui/component/or-asset-tree/src/index.ts
index 2ef384cc6..9846dfc76 100644
--- a/ui/component/or-asset-tree/src/index.ts
+++ b/ui/component/or-asset-tree/src/index.ts
@@ -39,7 +39,7 @@ import {OrAddAssetDialog, OrAddChangedEvent} from "./or-add-asset-dialog";
import "./or-add-asset-dialog";
import {showSnackbar} from "@openremote/or-mwc-components/or-mwc-snackbar";
import {when} from "lit/directives/when.js";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
export interface AssetTreeTypeConfig {
include?: string[];
diff --git a/ui/component/or-attribute-card/package.json b/ui/component/or-attribute-card/package.json
index d9061e9ec..62aa16c1c 100644
--- a/ui/component/or-attribute-card/package.json
+++ b/ui/component/or-attribute-card/package.json
@@ -34,9 +34,12 @@
"chart.js": "^3.6.0",
"chartjs-adapter-moment": "^1.0.0",
"lit": "^3.3.1",
- "lodash": "^4.17.21",
+ "lodash.debounce": "^4.0.8",
"moment": "^2.29.4"
},
+ "devDependencies": {
+ "@types/lodash.debounce": "^4"
+ },
"publishConfig": {
"access": "public"
}
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 0a0b50c9e..d3a1348b5 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -29,7 +29,7 @@ import {OrMwcDialog, showDialog} from "@openremote/or-mwc-components/or-mwc-dial
import {OrAssetAttributePicker, OrAssetAttributePickerPickedEvent} from "@openremote/or-attribute-picker";
import {getContentWithMenuTemplate} from "@openremote/or-mwc-components/or-mwc-menu";
import {when} from "lit/directives/when.js";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
export type ContextMenuOption = "editAttribute" | "editDelta" | "editCurrentValue" | "delete";
diff --git a/ui/component/or-attribute-history/package.json b/ui/component/or-attribute-history/package.json
index 8cb9f96a0..0a15a3283 100644
--- a/ui/component/or-attribute-history/package.json
+++ b/ui/component/or-attribute-history/package.json
@@ -32,9 +32,12 @@
"echarts": "~6.0.0",
"jsonpath-plus": "^6.0.1",
"lit": "^3.3.1",
- "lodash": "^4.17.21",
+ "lodash.debounce": "^4.0.8",
"moment": "^2.29.4"
},
+ "devDependencies": {
+ "@types/lodash.debounce": "^4"
+ },
"publishConfig": {
"access": "public"
}
diff --git a/ui/component/or-attribute-history/src/index.ts b/ui/component/or-attribute-history/src/index.ts
index 85ae80207..1403fcd04 100644
--- a/ui/component/or-attribute-history/src/index.ts
+++ b/ui/component/or-attribute-history/src/index.ts
@@ -5,7 +5,7 @@ import {GridComponent, GridComponentOption, DataZoomComponent, DataZoomComponent
import {LineChart, LineSeriesOption} from "echarts/charts";
import {UniversalTransition} from "echarts/features";
import {CanvasRenderer} from "echarts/renderers";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
import {
css,
html,
diff --git a/ui/component/or-chart/package.json b/ui/component/or-chart/package.json
index 45759595b..b16761fd1 100644
--- a/ui/component/or-chart/package.json
+++ b/ui/component/or-chart/package.json
@@ -35,10 +35,11 @@
"@openremote/rest": "workspace:*",
"echarts": "~6.0.0",
"lit": "^3.3.1",
- "lodash": "^4.17.21",
+ "lodash.debounce": "^4.0.8",
"moment": "^2.29.4"
},
"devDependencies": {
+ "@types/lodash.debounce": "^4",
"@types/offscreencanvas": "^2019.6.4"
},
"publishConfig": {
diff --git a/ui/component/or-chart/src/index.ts b/ui/component/or-chart/src/index.ts
index e4cbe330e..76e2b879f 100644
--- a/ui/component/or-chart/src/index.ts
+++ b/ui/component/or-chart/src/index.ts
@@ -31,7 +31,7 @@ import {GenericAxiosResponse, isAxiosError} from "@openremote/rest";
import {OrAssetAttributePicker, OrAssetAttributePickerPickedEvent} from "@openremote/or-attribute-picker";
import {OrMwcDialog, showDialog} from "@openremote/or-mwc-components/or-mwc-dialog";
import {cache} from "lit/directives/cache.js";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
import {getContentWithMenuTemplate} from "@openremote/or-mwc-components/or-mwc-menu";
import {ListItem} from "@openremote/or-mwc-components/or-mwc-list";
import {when} from "lit/directives/when.js";
diff --git a/ui/component/or-dashboard-builder/package.json b/ui/component/or-dashboard-builder/package.json
index fd50f0b4d..9735afd1d 100644
--- a/ui/component/or-dashboard-builder/package.json
+++ b/ui/component/or-dashboard-builder/package.json
@@ -40,9 +40,14 @@
"@openremote/rest": "workspace:*",
"gridstack": "^12.4.2",
"lit": "^3.3.1",
- "lodash": "^4.17.21",
+ "lodash.debounce": "^4.0.8",
+ "lodash.throttle": "^4.1.1",
"moment": "^2.29.4"
},
+ "devDependencies": {
+ "@types/lodash.debounce": "^4",
+ "@types/lodash.throttle": "^4"
+ },
"publishConfig": {
"access": "public"
}
diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts b/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts
index bf6f56ac4..039768049 100644
--- a/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts
+++ b/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts
@@ -3,7 +3,7 @@ import {css, html, LitElement, TemplateResult, unsafeCSS} from "lit";
import {customElement, property, state} from "lit/decorators.js";
import {style} from "./style";
import "./or-dashboard-widgetcontainer";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
import {DashboardGridItem, DashboardScalingPreset, DashboardScreenPreset, DashboardTemplate, DashboardWidget} from "@openremote/model";
import {getActivePreset} from "./index";
import {InputType, OrInputChangedEvent} from "@openremote/or-mwc-components/or-mwc-input";
diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-widgetcontainer.ts b/ui/component/or-dashboard-builder/src/or-dashboard-widgetcontainer.ts
index 077396d71..56233bf14 100644
--- a/ui/component/or-dashboard-builder/src/or-dashboard-widgetcontainer.ts
+++ b/ui/component/or-dashboard-builder/src/or-dashboard-widgetcontainer.ts
@@ -1,7 +1,7 @@
import {html, LitElement, PropertyValues} from "lit";
import {customElement, property, query, state} from "lit/decorators.js";
import {when} from "lit/directives/when.js";
-import {throttle} from "lodash";
+import throttle from "lodash.throttle";
import {style} from "./style";
import {DashboardWidget} from "@openremote/model";
import {OrWidget, WidgetManifest} from "./util/or-widget";
diff --git a/ui/component/or-dashboard-builder/src/settings/barchart-settings.ts b/ui/component/or-dashboard-builder/src/settings/barchart-settings.ts
index 043065795..3b4444073 100644
--- a/ui/component/or-dashboard-builder/src/settings/barchart-settings.ts
+++ b/ui/component/or-dashboard-builder/src/settings/barchart-settings.ts
@@ -36,7 +36,7 @@ import {OrChart} from "@openremote/or-chart";
import {getAssetDescriptorIconTemplate} from "@openremote/or-icon";
import {createRef, Ref, ref} from "lit/directives/ref.js";
import {AttributesChartPanel} from "../panels/attributes-chart-panel";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
const styling = css`
.switch-container {
diff --git a/ui/component/or-dashboard-builder/src/settings/chart-settings.ts b/ui/component/or-dashboard-builder/src/settings/chart-settings.ts
index 5a078a9d2..6b8366ba1 100644
--- a/ui/component/or-dashboard-builder/src/settings/chart-settings.ts
+++ b/ui/component/or-dashboard-builder/src/settings/chart-settings.ts
@@ -4,7 +4,7 @@ import {WidgetSettings} from "../util/widget-settings";
import "../panels/attributes-chart-panel";
import "../util/settings-panel";
import {i18next} from "@openremote/or-translate";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
import {AttributesChartPanel} from "../panels/attributes-chart-panel";
import {AttributeAction, AttributeActionEvent, AttributesSelectEvent} from "../panels/attributes-panel";
import {Asset, AssetDatapointIntervalQuery, AssetDatapointIntervalQueryFormula, AssetDescriptor, Attribute, AttributeRef} from "@openremote/model";
diff --git a/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts b/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts
index add91e270..925a0cde6 100644
--- a/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts
@@ -7,7 +7,7 @@ import {WidgetSettings} from "../util/widget-settings";
import { customElement, query, queryAll, state } from "lit/decorators.js";
import {AttributeInputSettings} from "../settings/attribute-input-settings";
import { when } from "lit/directives/when.js";
-import {throttle} from "lodash";
+import throttle from "lodash.throttle";
import {Util} from "@openremote/core";
import "@openremote/or-attribute-input";
diff --git a/ui/component/or-gauge/package.json b/ui/component/or-gauge/package.json
index 92a0832a8..2779bf21f 100644
--- a/ui/component/or-gauge/package.json
+++ b/ui/component/or-gauge/package.json
@@ -27,7 +27,10 @@
"@openremote/or-translate": "workspace:*",
"gaugeJS": "^1.3.7",
"lit": "^3.3.1",
- "lodash": "^4.17.21"
+ "lodash.debounce": "^4.0.8"
+ },
+ "devDependencies": {
+ "@types/lodash.debounce": "^4"
},
"publishConfig": {
"access": "public"
diff --git a/ui/component/or-gauge/src/index.ts b/ui/component/or-gauge/src/index.ts
index e45f285e6..921646cb6 100644
--- a/ui/component/or-gauge/src/index.ts
+++ b/ui/component/or-gauge/src/index.ts
@@ -4,7 +4,7 @@ import {Asset, AssetModelUtil, Attribute, AttributeRef} from "@openremote/model"
import { Gauge, GaugeOptions } from "gaugeJS";
import manager, { Util } from "@openremote/core";
import {i18next} from "@openremote/or-translate";
-import {debounce} from "lodash";
+import debounce from "lodash.debounce";
import { getAssetDescriptorIconTemplate } from "@openremote/or-icon";
//language=css
diff --git a/ui/component/or-map/package.json b/ui/component/or-map/package.json
index fc91bbe10..b64184bc5 100644
--- a/ui/component/or-map/package.json
+++ b/ui/component/or-map/package.json
@@ -30,12 +30,13 @@
"@openremote/or-translate": "workspace:*",
"lit": "^3.3.1",
"lit-html": "^3.3.1",
- "lodash": "^4.17.21",
+ "lodash.debounce": "^4.0.8",
"mapbox.js": "^3.3.1",
"maplibre-gl": "^5.12.0"
},
"devDependencies": {
"@types/geojson": "^7946.0.7",
+ "@types/lodash.debounce": "^4",
"@types/mapbox": "^1.6.42"
},
"publishConfig": {
diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.ts
index 9359d728d..e03b26c9c 100644
--- a/ui/component/or-map/src/index.ts
+++ b/ui/component/or-map/src/index.ts
@@ -16,7 +16,7 @@ import {
import {OrMwcDialog, showDialog} from "@openremote/or-mwc-components/or-mwc-dialog";
import {getMarkerIconAndColorFromAssetType} from "./util";
import {i18next} from "@openremote/or-translate";
-import { debounce } from "lodash";
+import debounce from "lodash.debounce";
import { Asset, Attribute, GeoJsonConfig, GeoJSONPoint, MapType, WellknownAttributes } from "@openremote/model";
import { CoordinatesControl, CoordinatesRegexPattern, getCoordinatesInputKeyHandler } from "./controls/coordinates";
import { CenterControl } from "./controls/center";
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index a401d1097..af7828af4 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -15,7 +15,7 @@ import maplibregl,{
} from "maplibre-gl";
import MaplibreGeocoder from "@maplibre/maplibre-gl-geocoder";
import "@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css";
-import { debounce } from "lodash";
+import debounce from "lodash.debounce";
import {
ControlPosition,
OrMapClickedEvent,
diff --git a/ui/util/package.json b/ui/util/package.json
index a2c4b2793..00bc085c7 100644
--- a/ui/util/package.json
+++ b/ui/util/package.json
@@ -12,7 +12,6 @@
"@custom-elements-manifest/analyzer": "^0.10.4",
"@rspack/cli": "~1.7.1",
"@rspack/core": "~1.7.1",
- "@types/lodash": "^4.17.21",
"@types/react": "^18",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
diff --git a/yarn.lock b/yarn.lock
index 06ce6aa64..c83430028 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1697,12 +1697,13 @@ __metadata:
"@openremote/model": "workspace:*"
"@openremote/or-icon": "workspace:*"
"@openremote/rest": "workspace:*"
+ "@types/lodash.transform": "npm:^4"
"@types/qs": "npm:^6.9.7"
axios: "npm:~1.13.2"
i18next: "npm:^21.5.3"
i18next-http-backend: "npm:^1.3.1"
keycloak-js: "npm:^25.0.1"
- lodash: "npm:^4.17.21"
+ lodash.transform: "npm:^4.6.0"
moment: "npm:^2.29.4"
platform: "npm:^1.3.6"
qs: "npm:^6.8.0"
@@ -1820,8 +1821,9 @@ __metadata:
"@openremote/or-icon": "workspace:*"
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
+ "@types/lodash.debounce": "npm:^4"
lit: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
qs: "npm:^6.8.0"
languageName: unknown
linkType: soft
@@ -1876,10 +1878,11 @@ __metadata:
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
"@openremote/rest": "workspace:*"
+ "@types/lodash.debounce": "npm:^4"
chart.js: "npm:^3.6.0"
chartjs-adapter-moment: "npm:^1.0.0"
lit: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
moment: "npm:^2.29.4"
languageName: unknown
linkType: soft
@@ -1896,10 +1899,11 @@ __metadata:
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
"@openremote/rest": "workspace:*"
+ "@types/lodash.debounce": "npm:^4"
echarts: "npm:~6.0.0"
jsonpath-plus: "npm:^6.0.1"
lit: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
moment: "npm:^2.29.4"
languageName: unknown
linkType: soft
@@ -1948,10 +1952,11 @@ __metadata:
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
"@openremote/rest": "workspace:*"
+ "@types/lodash.debounce": "npm:^4"
"@types/offscreencanvas": "npm:^2019.6.4"
echarts: "npm:~6.0.0"
lit: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
moment: "npm:^2.29.4"
languageName: unknown
linkType: soft
@@ -1993,9 +1998,12 @@ __metadata:
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
"@openremote/rest": "workspace:*"
+ "@types/lodash.debounce": "npm:^4"
+ "@types/lodash.throttle": "npm:^4"
gridstack: "npm:^12.4.2"
lit: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
+ lodash.throttle: "npm:^4.1.1"
moment: "npm:^2.29.4"
languageName: unknown
linkType: soft
@@ -2022,9 +2030,10 @@ __metadata:
"@openremote/model": "workspace:*"
"@openremote/or-icon": "workspace:*"
"@openremote/or-translate": "workspace:*"
+ "@types/lodash.debounce": "npm:^4"
gaugeJS: "npm:^1.3.7"
lit: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
languageName: unknown
linkType: soft
@@ -2080,10 +2089,11 @@ __metadata:
"@openremote/or-mwc-components": "workspace:*"
"@openremote/or-translate": "workspace:*"
"@types/geojson": "npm:^7946.0.7"
+ "@types/lodash.debounce": "npm:^4"
"@types/mapbox": "npm:^1.6.42"
lit: "npm:^3.3.1"
lit-html: "npm:^3.3.1"
- lodash: "npm:^4.17.21"
+ lodash.debounce: "npm:^4.0.8"
mapbox.js: "npm:^3.3.1"
maplibre-gl: "npm:^5.12.0"
languageName: unknown
@@ -2315,7 +2325,6 @@ __metadata:
"@custom-elements-manifest/analyzer": "npm:^0.10.4"
"@rspack/cli": "npm:~1.7.1"
"@rspack/core": "npm:~1.7.1"
- "@types/lodash": "npm:^4.17.21"
"@types/react": "npm:^18"
"@typescript-eslint/eslint-plugin": "npm:^5.9.0"
"@typescript-eslint/parser": "npm:^5.9.0"
@@ -3395,7 +3404,34 @@ __metadata:
languageName: node
linkType: hard
-"@types/lodash@npm:^4.17.21":
+"@types/lodash.debounce@npm:^4":
+ version: 4.0.9
+ resolution: "@types/lodash.debounce@npm:4.0.9"
+ dependencies:
+ "@types/lodash": "npm:*"
+ checksum: 10c0/9fbb24e5e52616faf60ba5c82d8c6517f4b86fc6e9ab353b4c56c0760f63d9bf53af3f2d8f6c37efa48090359fb96dba1087d497758511f6c40677002191d042
+ languageName: node
+ linkType: hard
+
+"@types/lodash.throttle@npm:^4":
+ version: 4.1.9
+ resolution: "@types/lodash.throttle@npm:4.1.9"
+ dependencies:
+ "@types/lodash": "npm:*"
+ checksum: 10c0/93f7096dcaea8f54a4f52d5175d97a471f155f5bae4649c967cc29bcae506a456476d13b4392361799b31c3b96659560e1bbfddf00f550a50c685f6c037411a6
+ languageName: node
+ linkType: hard
+
+"@types/lodash.transform@npm:^4":
+ version: 4.6.9
+ resolution: "@types/lodash.transform@npm:4.6.9"
+ dependencies:
+ "@types/lodash": "npm:*"
+ checksum: 10c0/857f4d9483dcfbafc1313aa0c59fcf60ba0fa949d516986160855e089cfe9667ced7ad03a3e984b76c148056ab84c91c074debbd287fbd224d32faef6f190ba2
+ languageName: node
+ linkType: hard
+
+"@types/lodash@npm:*":
version: 4.17.23
resolution: "@types/lodash@npm:4.17.23"
checksum: 10c0/9d9cbfb684e064a2b78aab9e220d398c9c2a7d36bc51a07b184ff382fa043a99b3d00c16c7f109b4eb8614118f4869678dbae7d5c6700ed16fb9340e26cc0bf6
@@ -8354,6 +8390,13 @@ __metadata:
languageName: node
linkType: hard
+"lodash.transform@npm:^4.6.0":
+ version: 4.6.0
+ resolution: "lodash.transform@npm:4.6.0"
+ checksum: 10c0/ad7f376b00dccff09f8597f19a171f2e074756178ae74887346876e10f6f0d83009460cc0793183cc5ee4e24a72ff86e68031c45b5aa2731c2f681a4dc93fe77
+ languageName: node
+ linkType: hard
+
"lodash@npm:^4.17.20, lodash@npm:^4.17.21":
version: 4.17.21
resolution: "lodash@npm:4.17.21"