@deviceinsight/ng-ui-scale-lib 9.14.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.
@@ -0,0 +1,280 @@
1
+ import { at as s, d0 as f, d1 as v, ag as c, d2 as g, aj as C, au as x, d3 as l, ae as r, d4 as w, d5 as P } from "./ContextBarContext-f745a63a.js";
2
+ import * as d from "react";
3
+ import { useContext as S } from "react";
4
+ import { P as T } from "./react-router-f15627c1.js";
5
+ import { Button as p, ButtonRow as j, SpinnerContainer as U } from "@deviceinsight/ng-ui-basic-components";
6
+ import { GradientColorPicker as y, ContentHeader as D } from "@deviceinsight/ng-ui-components";
7
+ import "react-router-dom";
8
+ import "@deviceinsight/ng-ui-api-client";
9
+ import "react-dom";
10
+ import "./extends-0a3e0827.js";
11
+ const u = (o) => ("0" + parseInt(o).toString(16)).slice(-2), b = (o) => {
12
+ if (o.includes("#"))
13
+ return o;
14
+ const e = o.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
15
+ return e && e.length === 4 ? `#${u(e[1])}${u(e[2])}${u(e[3])}` : "";
16
+ }, I = "#0077bb";
17
+ class L extends d.PureComponent {
18
+ constructor() {
19
+ super(...arguments), this.state = {
20
+ isOpen: !1
21
+ }, this.toggleIsOpen = () => {
22
+ const { value: e } = this.props, { isOpen: t } = this.state;
23
+ e || this.handleChange(I), this.setState({
24
+ isOpen: !t
25
+ });
26
+ }, this.handleChange = (e) => {
27
+ const { onChange: t } = this.props, n = b(e);
28
+ t(n);
29
+ }, this.handleUnset = (e) => {
30
+ e.stopPropagation();
31
+ const { onChange: t } = this.props;
32
+ t(), this.setState({
33
+ isOpen: !1
34
+ });
35
+ };
36
+ }
37
+ render() {
38
+ const { isOpen: e } = this.state, { value: t, title: n, description: a } = this.props;
39
+ return /* @__PURE__ */ s.jsx("div", { className: "di with-bottom-margin", children: /* @__PURE__ */ s.jsx(f, { title: n, description: a, children: /* @__PURE__ */ s.jsxs(v, { content: t, onClick: this.toggleIsOpen, children: [
40
+ /* @__PURE__ */ s.jsx(
41
+ y,
42
+ {
43
+ popperAlignment: "right",
44
+ inline: !1,
45
+ isOpen: e,
46
+ allowTextInput: !0,
47
+ value: t || "",
48
+ style: {
49
+ float: "left"
50
+ },
51
+ onPick: this.handleChange
52
+ }
53
+ ),
54
+ t && /* @__PURE__ */ s.jsx(
55
+ p,
56
+ {
57
+ onClick: this.handleUnset,
58
+ style: {
59
+ marginLeft: 10,
60
+ marginTop: 3,
61
+ float: "left"
62
+ },
63
+ children: /* @__PURE__ */ s.jsx(c, { i18nKey: "usergroups.detail.theme.resetColor", children: "Reset Color" })
64
+ }
65
+ )
66
+ ] }) }) });
67
+ }
68
+ }
69
+ class O extends d.PureComponent {
70
+ constructor() {
71
+ super(...arguments), this.state = {
72
+ isPreview: !1
73
+ }, this.changeConfig = (e) => (t) => {
74
+ const { config: n, onChangeConfig: a } = this.props, i = { ...n };
75
+ t ? i[e] = t : delete i[e], a(i);
76
+ }, this.handleSubmit = () => {
77
+ const { onSubmit: e } = this.props;
78
+ e();
79
+ }, this.stopPreview = () => {
80
+ const { onStopPreview: e } = this.props;
81
+ this.setState({
82
+ isPreview: !1
83
+ }), e();
84
+ }, this.startPreview = () => {
85
+ const { onStartPreview: e } = this.props;
86
+ this.setState({
87
+ isPreview: !0
88
+ }), e();
89
+ }, this.togglePreview = () => {
90
+ const { isPreview: e } = this.state;
91
+ e ? this.stopPreview() : this.startPreview();
92
+ };
93
+ }
94
+ componentDidUpdate(e) {
95
+ const { isPreview: t } = this.state;
96
+ t && e.config !== this.props.config && this.startPreview(), this.props.hasUnsavedChanges || this.stopPreview();
97
+ }
98
+ render() {
99
+ const { isPreview: e } = this.state, { config: t, hasUnsavedChanges: n } = this.props;
100
+ return /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
101
+ /* @__PURE__ */ s.jsx(
102
+ g,
103
+ {
104
+ title: {
105
+ id: "usergroups.detail.theme.logo",
106
+ defaultValue: "Logo"
107
+ },
108
+ description: {
109
+ id: "usergroups.detail.theme.logoDescription",
110
+ defaultValue: "Change the header logo (max height: 40px)"
111
+ },
112
+ value: t.logo,
113
+ onChange: this.changeConfig("logo"),
114
+ children: /* @__PURE__ */ s.jsx(
115
+ "img",
116
+ {
117
+ style: {
118
+ maxHeight: 40
119
+ },
120
+ src: t.logo,
121
+ alt: "Logo"
122
+ }
123
+ )
124
+ }
125
+ ),
126
+ /* @__PURE__ */ s.jsx(
127
+ g,
128
+ {
129
+ title: {
130
+ id: "usergroups.detail.theme.favicon",
131
+ defaultValue: "Favicon"
132
+ },
133
+ description: {
134
+ id: "usergroups.detail.theme.faviconDescription",
135
+ defaultValue: "Change the favicon"
136
+ },
137
+ value: t.favicon,
138
+ onChange: this.changeConfig("favicon"),
139
+ children: /* @__PURE__ */ s.jsx(
140
+ "img",
141
+ {
142
+ style: {
143
+ maxHeight: 16,
144
+ maxWidth: 16
145
+ },
146
+ src: t.favicon,
147
+ alt: "Favicon"
148
+ }
149
+ )
150
+ }
151
+ ),
152
+ /* @__PURE__ */ s.jsx(
153
+ L,
154
+ {
155
+ title: {
156
+ id: "usergroups.detail.theme.primaryColor",
157
+ defaultValue: "Primary Color"
158
+ },
159
+ description: {
160
+ id: "usergroups.detail.theme.primaryColorDescription",
161
+ defaultValue: "Change the main color (will be used with white text)"
162
+ },
163
+ value: t.primaryColor,
164
+ onChange: this.changeConfig("primaryColor")
165
+ }
166
+ ),
167
+ /* @__PURE__ */ s.jsxs(j, { dividing: !0, children: [
168
+ /* @__PURE__ */ s.jsx(p, { primary: !0, disabled: !n, onClick: this.handleSubmit, children: /* @__PURE__ */ s.jsx(c, { i18nKey: "usergroups.detail.theme.save", children: "Save" }) }),
169
+ /* @__PURE__ */ s.jsx(p, { disabled: !n, onClick: this.togglePreview, children: e ? /* @__PURE__ */ s.jsx(c, { i18nKey: "usergroups.detail.theme.preview", children: "Stop Preview" }) : /* @__PURE__ */ s.jsx(c, { i18nKey: "usergroups.detail.theme.preview", children: "Preview" }) })
170
+ ] })
171
+ ] });
172
+ }
173
+ }
174
+ class F extends d.PureComponent {
175
+ constructor() {
176
+ super(...arguments), this.state = {
177
+ isLoading: !0,
178
+ config: {},
179
+ savedConfig: {}
180
+ }, this.saveTheme = () => {
181
+ const { onSave: e, onDelete: t } = this.props, { config: n } = this.state;
182
+ Object.values(n).some(Boolean) ? this.handleRequestStatus(e(n)) : this.handleRequestStatus(t());
183
+ }, this.handleChangeConfig = (e) => {
184
+ this.setState({
185
+ config: e
186
+ });
187
+ }, this.handleStartPreview = () => {
188
+ const { setTheme: e } = this.props, { config: t } = this.state;
189
+ e(t);
190
+ }, this.handleStopPreview = () => {
191
+ const { unsetTheme: e } = this.props;
192
+ e();
193
+ }, this.hasUnsavedChanges = () => {
194
+ const { config: e, savedConfig: t } = this.state;
195
+ return !C.isEqual(e, t);
196
+ };
197
+ }
198
+ componentDidMount() {
199
+ this.fetchTheme();
200
+ }
201
+ componentWillUnmount() {
202
+ this.hasUnsavedChanges() && this.handleStopPreview();
203
+ }
204
+ fetchTheme() {
205
+ const { onFetch: e } = this.props;
206
+ this.handleRequestStatus(e());
207
+ }
208
+ handleRequestStatus(e) {
209
+ return this.setState({
210
+ isLoading: !0
211
+ }), e.then((t) => {
212
+ this.setState({
213
+ config: t,
214
+ savedConfig: t,
215
+ isLoading: !1
216
+ });
217
+ }).catch((t) => {
218
+ console.error(t), this.setState({
219
+ isLoading: !1
220
+ });
221
+ });
222
+ }
223
+ render() {
224
+ const { isLoading: e, config: t } = this.state;
225
+ return /* @__PURE__ */ s.jsxs("div", { children: [
226
+ /* @__PURE__ */ s.jsx(
227
+ D,
228
+ {
229
+ title: {
230
+ id: "usergroups.detail.theme.title",
231
+ defaultValue: "Custom Design Options"
232
+ }
233
+ }
234
+ ),
235
+ /* @__PURE__ */ s.jsx(U, { show: e, children: /* @__PURE__ */ s.jsx(
236
+ O,
237
+ {
238
+ config: t,
239
+ onChangeConfig: this.handleChangeConfig,
240
+ onSubmit: this.saveTheme,
241
+ onStartPreview: this.handleStartPreview,
242
+ onStopPreview: this.handleStopPreview,
243
+ hasUnsavedChanges: this.hasUnsavedChanges()
244
+ }
245
+ ) }),
246
+ /* @__PURE__ */ s.jsx(T, { when: this.hasUnsavedChanges(), message: "" })
247
+ ] });
248
+ }
249
+ }
250
+ const B = ({ usergroup: { id: o } }) => {
251
+ const { user: e } = S(x), t = (i) => {
252
+ if (e)
253
+ return e.accountGroupIds.includes(i);
254
+ }, n = async (i) => {
255
+ try {
256
+ return await w(i), t(i) && r.setUserTheme(r.getDefaultTheme()), {};
257
+ } catch (h) {
258
+ return console.error(h), await l(i);
259
+ }
260
+ }, a = async (i, h) => {
261
+ try {
262
+ return await P(i, h), t(i) ? (r.setUserTheme(h), r.setTheme(r.getUserTheme()), h) : await l(i);
263
+ } catch (m) {
264
+ return console.error(m), await l(i);
265
+ }
266
+ };
267
+ return /* @__PURE__ */ s.jsx(
268
+ F,
269
+ {
270
+ onSave: (i) => a(o, i),
271
+ onFetch: () => l(o),
272
+ onDelete: () => n(o),
273
+ setTheme: (i) => r.setTheme(i),
274
+ unsetTheme: () => r.setTheme(r.getUserTheme())
275
+ }
276
+ );
277
+ };
278
+ export {
279
+ B as default
280
+ };
package/dist/api.js ADDED
@@ -0,0 +1,84 @@
1
+ import { ai as a, au as n, at as i, aK as r, bB as c, cC as u, cD as m, cl as f, co as C, bm as d, cE as l } from "./ContextBarContext-f745a63a.js";
2
+ import { aN as F, br as G, af as L, ae as O, ag as V, cG as H, ad as K, cH as M, cF as Z, cU as $, aG as j, aU as k, cK as w, cL as J, cR as W, cS as X, cP as q, cW as Q, cO as Y, cQ as z, cJ as ee, cM as se, cN as te, cI as oe, cT as ae, cx as ne, cV as ie, cX as re, ac as ce, b$ as ue, ah as me, bV as fe } from "./ContextBarContext-f745a63a.js";
3
+ import { m as de, a as le } from "./useCanDeleteBundleVersion-64f35949.js";
4
+ import { getAxios as p } from "@deviceinsight/ng-ui-api-client";
5
+ import { s as Ae } from "./customFileCategories-1b64ed45.js";
6
+ import { useContext as t, useEffect as A } from "react";
7
+ import "react-router-dom";
8
+ import "@deviceinsight/ng-ui-basic-components";
9
+ import "@deviceinsight/ng-ui-components";
10
+ import "react-dom";
11
+ const h = (e) => a({
12
+ REACT_APP_TENANT_LOCIZE_PROJECT_ID: e.projectId,
13
+ REACT_APP_TENANT_LOCIZE_API_KEY: e.apiKey,
14
+ REACT_APP_TENANT_LOCIZE_VERSION: e.version
15
+ }), _ = () => p();
16
+ function D() {
17
+ const { user: e } = t(n);
18
+ return e;
19
+ }
20
+ function N({ className: e, icon: s, ...o }) {
21
+ return /* @__PURE__ */ i.jsx("button", { className: r(e, "tool"), ...o, children: s });
22
+ }
23
+ function R({ children: e }) {
24
+ const { addItem: s } = t(c);
25
+ return A(() => s(e), [s, e]), null;
26
+ }
27
+ function b(e) {
28
+ return console.warn("Don't use setFavicon. This function is deprecated"), u(e, !0);
29
+ }
30
+ function U(e) {
31
+ return console.warn("Don't use setPrimaryColor. This function is deprecated"), m(e, !0);
32
+ }
33
+ const v = {
34
+ onSignin: f,
35
+ onSignout: C,
36
+ onThemeChange: d,
37
+ onUserProfileChange: l
38
+ };
39
+ export {
40
+ N as ContextBarAction,
41
+ R as ContextBarActionContainer,
42
+ F as HasAuthorities,
43
+ G as RouteApi,
44
+ L as StyleApi,
45
+ O as ThemeApi,
46
+ V as Trans,
47
+ H as TranslationApi,
48
+ K as UiConfigurationApi,
49
+ M as addCustomHeaderElement,
50
+ Z as addI18nextXHRBackend,
51
+ v as eventBus,
52
+ $ as generateAssetUrn,
53
+ _ as getNguiAxios,
54
+ j as getStartPage,
55
+ k as hasAuthorities,
56
+ w as modifyAssetColumnDefinitions,
57
+ J as modifyAssetGroupColumnDefinitions,
58
+ de as modifyCanDeleteBundle,
59
+ le as modifyCanDeleteBundleVersion,
60
+ W as modifyChildAssetGroupsInitialSort,
61
+ X as modifyCustomSearchProperties,
62
+ q as modifyDashboardWidgets,
63
+ Q as modifyIsDashboardVisible,
64
+ Y as modifyMapMarkerIcon,
65
+ z as modifyPropertyVisibility,
66
+ ee as modifyRoutes,
67
+ se as modifyUserColumnDefinitions,
68
+ te as modifyUserGroupColumnDefinitions,
69
+ oe as removeCustomHeaderElement,
70
+ ae as replaceComponent,
71
+ ne as retrieveAuthInfo,
72
+ ie as setContextInfo,
73
+ Ae as setCustomFilesCategories,
74
+ re as setCustomLoginPageElement,
75
+ a as setEnvironment,
76
+ b as setFavicon,
77
+ h as setLocizeProject,
78
+ U as setPrimaryColor,
79
+ ce as setTitle,
80
+ ue as useAssetTimezone,
81
+ me as useTranslation,
82
+ D as useUserAccountInfo,
83
+ fe as ux4iotGrantRequestFunction
84
+ };
@@ -0,0 +1,33 @@
1
+ const e = "Bundle Management", E = "bundleId", _ = "bundleVersionId", n = {
2
+ ACCORDION_ITEM: "bundle-accordion-item",
3
+ CREATE_BUNDLE_DIALOG: "create-bundle-dialog-content",
4
+ CREATE_BUNDLE_BUTTON: "create-bundle-button",
5
+ CREATE_BUNDLE_COMPONENT: "create-bundle-component",
6
+ DELETE_BUNDLE_BUTTON: "delete-bundle-button",
7
+ DELETE_BUNDLE_DIALOG: "delete-bundle-dialog-content",
8
+ DELETE_VERSION_DIALOG: "delete-version-dialog-content",
9
+ BUNDLE_VERSION_VIEW: "bundle-version-view",
10
+ CANCEL_SAVE_BUNDLE_BUTTON: "cancel-save-bundle",
11
+ SAVE_BUNDLE_BUTTON: "save-bundle",
12
+ BUNDLE_NAME_INPUT: "input-bundle-name",
13
+ CREATE_VERSION_BUTTON: "create-version-button",
14
+ CANCEL_SAVE_VERSION_BUTTON: "cancel-save-version-button",
15
+ SAVE_VERSION_BUTTON: "save-version-button",
16
+ CREATE_VERSION_DIALOG: "create-version-dialog",
17
+ VERSION_NAME_INPUT: "input-version-name",
18
+ VERSION_DESCRIPTION_INPUT: "input-version-desc",
19
+ DELETE_FILE_ICON: "icon-delete-file",
20
+ DOWNLOAD_FILE_ICON: "icon-download-file",
21
+ DELETE_VERSION_ICON: "icon-delete-version",
22
+ VERSION_FILE_UPLOAD_AREA: "version-file-upload",
23
+ LABEL_VERSION_COUNT: "label-version-count",
24
+ VERSION_DETAILS_DIALOG: "version-details-dialog",
25
+ VERSION_FILES_DIALOG: "version-files-dialog",
26
+ MODAL_CLOSE_BUTTON: "modal-close-button"
27
+ };
28
+ export {
29
+ n as B,
30
+ e as M,
31
+ E as Q,
32
+ _ as a
33
+ };
@@ -0,0 +1,11 @@
1
+ const e = [];
2
+ function s(t) {
3
+ e.splice(0, e.length, ...t);
4
+ }
5
+ function o() {
6
+ return e;
7
+ }
8
+ export {
9
+ o as g,
10
+ s
11
+ };
@@ -0,0 +1,13 @@
1
+ function e() {
2
+ return e = Object.assign ? Object.assign.bind() : function(t) {
3
+ for (var n = 1; n < arguments.length; n++) {
4
+ var r = arguments[n];
5
+ for (var a in r)
6
+ ({}).hasOwnProperty.call(r, a) && (t[a] = r[a]);
7
+ }
8
+ return t;
9
+ }, e.apply(null, arguments);
10
+ }
11
+ export {
12
+ e as _
13
+ };