@hortiview/modulebase 0.0.11518 → 0.0.11535
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/components/ModuleBase.js +39 -38
- package/dist/hooks/useCustom.d.ts +3 -3
- package/dist/hooks/useCustom.js +13 -12
- package/dist/hooks/useNavigate.js +4 -25
- package/dist/hooks/useStores.d.ts +1 -1
- package/dist/main.js +4 -4
- package/dist/stores/EnvironmentStore.d.ts +1 -1
- package/dist/stores/EnvironmentStore.js +8 -3
- package/dist/types/Environment.d.ts +1 -1
- package/dist/types/ModuleApi.d.ts +10 -0
- package/dist/{chunk-IR6S3I6Y-BvQXS3A3.js → useNavigate-BW3A9mQm.js} +698 -667
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
2
|
import { S as k, h as N, Q as x, n as u, m as M, R as H, c as K, a as E, b as h, e as B, d as j, f as L, g as U, o as S, r as D, i as G, j as A, p as C, s as V, k as W } from "../QueryClientProvider-DQv4Y3Qu.js";
|
|
3
3
|
import { useState as $, useEffect as q } from "react";
|
|
4
|
-
import { c as z, R as X } from "../
|
|
5
|
-
import { REQUIRED_PROPS as
|
|
6
|
-
import { SignalRProvider as
|
|
4
|
+
import { c as z, R as X, u as Y, O as J } from "../useNavigate-BW3A9mQm.js";
|
|
5
|
+
import { REQUIRED_PROPS as Z } from "../constants.js";
|
|
6
|
+
import { SignalRProvider as ee } from "../provider/SignalR/SignalRProvider.js";
|
|
7
7
|
import { useBasePropsStore as R } from "../stores/BasePropsStore.js";
|
|
8
8
|
import { useEnvironmentStore as F } from "../stores/EnvironmentStore.js";
|
|
9
|
-
var
|
|
9
|
+
var te = class extends k {
|
|
10
10
|
constructor(e = {}) {
|
|
11
11
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
12
12
|
}
|
|
@@ -77,12 +77,12 @@ var Z = class extends k {
|
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, se = class extends H {
|
|
81
81
|
#e;
|
|
82
82
|
#t;
|
|
83
83
|
#s;
|
|
84
84
|
constructor(e) {
|
|
85
|
-
super(), this.mutationId = e.mutationId, this.#t = e.mutationCache, this.#e = [], this.state = e.state ||
|
|
85
|
+
super(), this.mutationId = e.mutationId, this.#t = e.mutationCache, this.#e = [], this.state = e.state || ie(), this.setOptions(e.options), this.scheduleGc();
|
|
86
86
|
}
|
|
87
87
|
setOptions(e) {
|
|
88
88
|
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
@@ -251,7 +251,7 @@ var Z = class extends k {
|
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
|
-
function
|
|
254
|
+
function ie() {
|
|
255
255
|
return {
|
|
256
256
|
context: void 0,
|
|
257
257
|
data: void 0,
|
|
@@ -264,7 +264,7 @@ function te() {
|
|
|
264
264
|
submittedAt: 0
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
var
|
|
267
|
+
var re = class extends k {
|
|
268
268
|
constructor(e = {}) {
|
|
269
269
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
270
270
|
}
|
|
@@ -272,7 +272,7 @@ var se = class extends k {
|
|
|
272
272
|
#t;
|
|
273
273
|
#s;
|
|
274
274
|
build(e, t, s) {
|
|
275
|
-
const i = new
|
|
275
|
+
const i = new se({
|
|
276
276
|
mutationCache: this,
|
|
277
277
|
mutationId: ++this.#s,
|
|
278
278
|
options: e.defaultMutationOptions(t),
|
|
@@ -361,16 +361,16 @@ function T(e) {
|
|
|
361
361
|
const i = t.options, r = t.fetchOptions?.meta?.fetchMore?.direction, n = t.state.data?.pages || [], d = t.state.data?.pageParams || [];
|
|
362
362
|
let c = { pages: [], pageParams: [] }, f = 0;
|
|
363
363
|
const P = async () => {
|
|
364
|
-
let
|
|
364
|
+
let p = !1;
|
|
365
365
|
const w = (o) => {
|
|
366
366
|
Object.defineProperty(o, "signal", {
|
|
367
367
|
enumerable: !0,
|
|
368
|
-
get: () => (t.signal.aborted ?
|
|
369
|
-
|
|
368
|
+
get: () => (t.signal.aborted ? p = !0 : t.signal.addEventListener("abort", () => {
|
|
369
|
+
p = !0;
|
|
370
370
|
}), t.signal)
|
|
371
371
|
});
|
|
372
|
-
}, a = B(t.options, t.fetchOptions),
|
|
373
|
-
if (
|
|
372
|
+
}, a = B(t.options, t.fetchOptions), m = async (o, l, g) => {
|
|
373
|
+
if (p)
|
|
374
374
|
return Promise.reject();
|
|
375
375
|
if (l == null && o.pages.length)
|
|
376
376
|
return Promise.resolve(o);
|
|
@@ -378,31 +378,31 @@ function T(e) {
|
|
|
378
378
|
client: t.client,
|
|
379
379
|
queryKey: t.queryKey,
|
|
380
380
|
pageParam: l,
|
|
381
|
-
direction:
|
|
381
|
+
direction: g ? "backward" : "forward",
|
|
382
382
|
meta: t.options.meta
|
|
383
383
|
};
|
|
384
384
|
w(v);
|
|
385
385
|
const _ = await a(
|
|
386
386
|
v
|
|
387
|
-
), { maxPages: b } = t.options, Q =
|
|
387
|
+
), { maxPages: b } = t.options, Q = g ? j : L;
|
|
388
388
|
return {
|
|
389
389
|
pages: Q(o.pages, _, b),
|
|
390
390
|
pageParams: Q(o.pageParams, l, b)
|
|
391
391
|
};
|
|
392
392
|
};
|
|
393
393
|
if (r && n.length) {
|
|
394
|
-
const o = r === "backward", l = o ?
|
|
394
|
+
const o = r === "backward", l = o ? ne : I, g = {
|
|
395
395
|
pages: n,
|
|
396
396
|
pageParams: d
|
|
397
|
-
}, v = l(i,
|
|
398
|
-
c = await
|
|
397
|
+
}, v = l(i, g);
|
|
398
|
+
c = await m(g, v, o);
|
|
399
399
|
} else {
|
|
400
400
|
const o = e ?? n.length;
|
|
401
401
|
do {
|
|
402
402
|
const l = f === 0 ? d[0] ?? i.initialPageParam : I(i, c);
|
|
403
403
|
if (f > 0 && l == null)
|
|
404
404
|
break;
|
|
405
|
-
c = await
|
|
405
|
+
c = await m(c, l), f++;
|
|
406
406
|
} while (f < o);
|
|
407
407
|
}
|
|
408
408
|
return c;
|
|
@@ -429,10 +429,10 @@ function I(e, { pages: t, pageParams: s }) {
|
|
|
429
429
|
s
|
|
430
430
|
) : void 0;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function ne(e, { pages: t, pageParams: s }) {
|
|
433
433
|
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
|
|
434
434
|
}
|
|
435
|
-
var
|
|
435
|
+
var ae = class {
|
|
436
436
|
#e;
|
|
437
437
|
#t;
|
|
438
438
|
#s;
|
|
@@ -442,7 +442,7 @@ var re = class {
|
|
|
442
442
|
#a;
|
|
443
443
|
#u;
|
|
444
444
|
constructor(e = {}) {
|
|
445
|
-
this.#e = e.queryCache || new
|
|
445
|
+
this.#e = e.queryCache || new te(), this.#t = e.mutationCache || new re(), this.#s = e.defaultOptions || {}, this.#i = /* @__PURE__ */ new Map(), this.#n = /* @__PURE__ */ new Map(), this.#r = 0;
|
|
446
446
|
}
|
|
447
447
|
mount() {
|
|
448
448
|
this.#r++, this.#r === 1 && (this.#a = U.subscribe(async (e) => {
|
|
@@ -629,7 +629,7 @@ var re = class {
|
|
|
629
629
|
this.#e.clear(), this.#t.clear();
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
|
-
const
|
|
632
|
+
const ue = new ae({
|
|
633
633
|
defaultOptions: {
|
|
634
634
|
mutations: {
|
|
635
635
|
retry: !1
|
|
@@ -643,22 +643,22 @@ const ne = new re({
|
|
|
643
643
|
retry: !1
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
}),
|
|
646
|
+
}), oe = () => (Y(), /* @__PURE__ */ y(J, {})), Oe = ({
|
|
647
647
|
props: e,
|
|
648
648
|
routes: t,
|
|
649
649
|
env: s = void 0,
|
|
650
650
|
useSignalR: i = !1,
|
|
651
|
-
queryClient: r =
|
|
651
|
+
queryClient: r = ue
|
|
652
652
|
}) => {
|
|
653
|
-
const n = R((a) => a.setBaseProps), d = R((a) => a.modulePermissionToken), c = F((a) => a.setEnvironment), f = F((a) => a.addEnvironment), [P,
|
|
653
|
+
const n = R((a) => a.setBaseProps), d = R((a) => a.modulePermissionToken), c = F((a) => a.setEnvironment), f = F((a) => a.addEnvironment), [P, p] = $(!1);
|
|
654
654
|
q(() => {
|
|
655
|
-
const a =
|
|
656
|
-
if (
|
|
655
|
+
const a = le();
|
|
656
|
+
if (p(!a), a && c(a), !s) return;
|
|
657
657
|
console.log(s);
|
|
658
|
-
const
|
|
659
|
-
|
|
658
|
+
const m = s[a?.ENVIRONMENT];
|
|
659
|
+
m && f(m);
|
|
660
660
|
}, [f, s, c]), q(() => {
|
|
661
|
-
|
|
661
|
+
p(!he(e)), n(e);
|
|
662
662
|
}, [
|
|
663
663
|
e.currentLanguage,
|
|
664
664
|
e.currentLanguageId,
|
|
@@ -670,22 +670,23 @@ const ne = new re({
|
|
|
670
670
|
const w = z([
|
|
671
671
|
{
|
|
672
672
|
path: e.basePath,
|
|
673
|
-
children: t
|
|
673
|
+
children: t,
|
|
674
|
+
element: /* @__PURE__ */ y(oe, {})
|
|
674
675
|
}
|
|
675
676
|
]);
|
|
676
|
-
return P ? /* @__PURE__ */
|
|
677
|
-
},
|
|
677
|
+
return P ? /* @__PURE__ */ y("div", { children: "TODO: Show fancy error" }) : d ? /* @__PURE__ */ y(W, { client: r, children: /* @__PURE__ */ y(ee, { enabled: i, children: /* @__PURE__ */ y(X, { router: w }) }) }) : /* @__PURE__ */ y("div", { children: "TODO: Show fancy Loadingspinner" });
|
|
678
|
+
}, he = (e) => Z.every((t) => ce(t, e)), ce = (e, t) => {
|
|
678
679
|
if (!t[e]) {
|
|
679
680
|
if (t.throwError)
|
|
680
681
|
return t.throwError(`Missing required prop: ${e}`, 404), !1;
|
|
681
682
|
throw new Error(`Missing required prop: ${e}`);
|
|
682
683
|
}
|
|
683
684
|
return !0;
|
|
684
|
-
},
|
|
685
|
+
}, le = () => {
|
|
685
686
|
const e = window.__env__;
|
|
686
687
|
if (e && e.COMMON_API && e.MODULE_AUTH_API && e.API_PREFIX && e.ENVIRONMENT)
|
|
687
688
|
return e;
|
|
688
689
|
};
|
|
689
690
|
export {
|
|
690
|
-
|
|
691
|
+
Oe as ModuleBase
|
|
691
692
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const useCustom: <T>({ endpoint, queryKey, token, }: {
|
|
1
|
+
export declare const useCustom: <T>({ endpoint, queryKey, token, selector, }: {
|
|
3
2
|
endpoint: string;
|
|
4
3
|
queryKey: (string | undefined)[];
|
|
5
4
|
token?: string;
|
|
6
|
-
|
|
5
|
+
selector?: (data: any) => T;
|
|
6
|
+
}) => import('@tanstack/react-query').UseQueryResult<T, Error>;
|
package/dist/hooks/useCustom.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { u as m } from "../useQuery-znAyMQW1.js";
|
|
2
|
-
import { useBasePropsStore as
|
|
3
|
-
import { universalSelector as
|
|
4
|
-
import { d as
|
|
5
|
-
const
|
|
6
|
-
endpoint:
|
|
7
|
-
queryKey:
|
|
8
|
-
token:
|
|
2
|
+
import { useBasePropsStore as i } from "../stores/BasePropsStore.js";
|
|
3
|
+
import { universalSelector as n } from "../types/Requests.js";
|
|
4
|
+
import { d as p } from "../fetches-DUCQo_6B.js";
|
|
5
|
+
const d = ({
|
|
6
|
+
endpoint: e,
|
|
7
|
+
queryKey: t,
|
|
8
|
+
token: s,
|
|
9
|
+
selector: o
|
|
9
10
|
}) => {
|
|
10
|
-
const
|
|
11
|
+
const u = i((r) => r.organizationId);
|
|
11
12
|
return m({
|
|
12
|
-
queryKey: [...
|
|
13
|
-
queryFn: () =>
|
|
14
|
-
select: (
|
|
13
|
+
queryKey: [...t, u],
|
|
14
|
+
queryFn: () => p(e, s),
|
|
15
|
+
select: (r) => o ? o(r) : n(r)
|
|
15
16
|
});
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
d as useCustom
|
|
19
20
|
};
|
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { u as
|
|
3
|
-
import
|
|
4
|
-
const m = () => {
|
|
5
|
-
const e = r(
|
|
6
|
-
(t) => t.currentNavigationPath
|
|
7
|
-
), a = r(
|
|
8
|
-
(t) => t.navigateTo
|
|
9
|
-
), i = r(
|
|
10
|
-
(t) => t.navigateInHortiview
|
|
11
|
-
), n = v();
|
|
12
|
-
return o(() => {
|
|
13
|
-
e && n(e, { replace: !0 });
|
|
14
|
-
}, [e, n]), s(
|
|
15
|
-
(t) => {
|
|
16
|
-
if (i) {
|
|
17
|
-
i(t);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
a && a(t);
|
|
21
|
-
},
|
|
22
|
-
[i, a]
|
|
23
|
-
);
|
|
24
|
-
};
|
|
1
|
+
import "react";
|
|
2
|
+
import { u as e } from "../useNavigate-BW3A9mQm.js";
|
|
3
|
+
import "../stores/BasePropsStore.js";
|
|
25
4
|
export {
|
|
26
|
-
|
|
5
|
+
e as useNavigate
|
|
27
6
|
};
|
|
@@ -23,7 +23,7 @@ export declare const useBaseProps: () => Pick<import('../types/Deprecated').Depr
|
|
|
23
23
|
setBaseProps: (props: import('../main').BaseProps) => void;
|
|
24
24
|
}, keyof import('../types/Deprecated').DeprecatedBaseProps | "modulePermissionToken" | "moduleId" | "organizationId" | "basePath" | "currentNavigationPath" | "sourcePath" | "currentLanguage" | "currentLanguageId" | "alertRules" | "commonOptions" | "navigateInHortiview" | "addBreadcrumbTranslation" | "showSnackbar" | "showMessage" | "logEvent" | "logError" | "throwError">;
|
|
25
25
|
export declare const useConfig: () => Pick<{
|
|
26
|
-
environment
|
|
26
|
+
environment: import('../types/Environment').HortiViewEnvironments;
|
|
27
27
|
setEnvironment: (environment: import('../types/Environment').HortiViewEnvironments) => void;
|
|
28
28
|
addEnvironment: (customEnv: import('../types/Environment').CustomEnv) => void;
|
|
29
29
|
}, "environment">;
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleBase as r } from "./components/ModuleBase.js";
|
|
2
2
|
import { useBreadcrumbTranslation as t } from "./hooks/useBreadcrumbTranslation.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useSignalRMessages as
|
|
3
|
+
import { u as a } from "./useNavigate-BW3A9mQm.js";
|
|
4
|
+
import { useSignalRMessages as p } from "./hooks/useSignalRMessages.js";
|
|
5
5
|
import { useBaseProps as x, useConfig as i } from "./hooks/useStores.js";
|
|
6
6
|
import { useCustom as g } from "./hooks/useCustom.js";
|
|
7
7
|
import { useEntity as B } from "./hooks/useEntity.js";
|
|
@@ -13,7 +13,7 @@ export {
|
|
|
13
13
|
i as useConfig,
|
|
14
14
|
g as useCustom,
|
|
15
15
|
B as useEntity,
|
|
16
|
-
|
|
16
|
+
a as useNavigate,
|
|
17
17
|
C as useOption,
|
|
18
|
-
|
|
18
|
+
p as useSignalRMessages
|
|
19
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomEnv, HortiViewEnvironments } from '../types/Environment';
|
|
2
2
|
type EnvironmentStore = {
|
|
3
|
-
environment
|
|
3
|
+
environment: HortiViewEnvironments;
|
|
4
4
|
setEnvironment: (environment: HortiViewEnvironments) => void;
|
|
5
5
|
addEnvironment: (customEnv: CustomEnv) => void;
|
|
6
6
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { c as r } from "../react-QiIgv49H.js";
|
|
2
|
-
const
|
|
3
|
-
environment:
|
|
2
|
+
const m = r((e) => ({
|
|
3
|
+
environment: {
|
|
4
|
+
ENVIRONMENT: "DEV",
|
|
5
|
+
COMMON_API: "",
|
|
6
|
+
MODULE_AUTH_API: "",
|
|
7
|
+
API_PREFIX: ""
|
|
8
|
+
},
|
|
4
9
|
setEnvironment: (n) => e({ environment: n }),
|
|
5
10
|
addEnvironment: (n) => e((o) => ({ environment: { ...n, ...o.environment } }))
|
|
6
11
|
}));
|
|
7
12
|
export {
|
|
8
|
-
|
|
13
|
+
m as useEnvironmentStore
|
|
9
14
|
};
|
|
@@ -8,7 +8,7 @@ export interface HortiViewEnvironments {
|
|
|
8
8
|
export interface CustomWindow extends Window {
|
|
9
9
|
__env__?: HortiViewEnvironments;
|
|
10
10
|
}
|
|
11
|
-
export type Environments = 'DEVELOPMENT' | 'TEST' | '
|
|
11
|
+
export type Environments = 'DEVELOPMENT' | 'TEST' | 'Bayer-TEST' | 'Bayer-DEMO' | 'Bayer-PROD';
|
|
12
12
|
export type EnvConfig = {
|
|
13
13
|
[key in Environments]: CustomEnv;
|
|
14
14
|
};
|
|
@@ -77,4 +77,14 @@ export interface Season {
|
|
|
77
77
|
}
|
|
78
78
|
export interface BlockPlantLayout {
|
|
79
79
|
id: string;
|
|
80
|
+
blockId: string;
|
|
81
|
+
arrangementType: string | null;
|
|
82
|
+
offsetPlants: number;
|
|
83
|
+
offsetPlantsUnit: string;
|
|
84
|
+
rowLength: number;
|
|
85
|
+
rowLengthUnit: string;
|
|
86
|
+
offsetRows: number;
|
|
87
|
+
offsetRowsUnit: string;
|
|
88
|
+
numberOfRows: number;
|
|
89
|
+
numberOfPlants: number;
|
|
80
90
|
}
|