@hortiview/shared-components 0.0.7515 → 0.0.7520
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.
|
@@ -4,7 +4,7 @@ import { FieldPath, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
|
4
4
|
/**
|
|
5
5
|
* a generic FormSelector property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
|
|
6
6
|
*/
|
|
7
|
-
type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'className' | 'clearable' | 'disabled' | 'helperText' | 'helperTextPersistent' | 'hidden' | 'hoisted' | 'label' | 'menuMaxHeight' | 'multi' | 'multiSelect' | 'noOptionsMessage' | '
|
|
7
|
+
type FormSelectProps<T extends FieldValues> = Omit<SelectProps, 'className' | 'clearable' | 'disabled' | 'helperText' | 'helperTextPersistent' | 'hidden' | 'hoisted' | 'label' | 'menuMaxHeight' | 'multi' | 'multiSelect' | 'noOptionsMessage' | 'options' | 'searchable' | 'textKey' | 'valid' | 'value' | 'valueKey' | 'variant'> & {
|
|
8
8
|
/** the name of the property in the form */
|
|
9
9
|
propertyName: Path<T>;
|
|
10
10
|
/** the label of the select */
|
|
@@ -3,25 +3,25 @@ import { Select as k } from "@element/react-components";
|
|
|
3
3
|
import { g as h } from "../../../get-UxX31Aph.js";
|
|
4
4
|
import { i as z } from "../../../isArray-Ca4KR8TK.js";
|
|
5
5
|
import { useMemo as S } from "react";
|
|
6
|
-
import { useFormContext as B, Controller as
|
|
6
|
+
import { useFormContext as B, Controller as C } from "react-hook-form";
|
|
7
7
|
import { H as G } from "../../../react-tooltip.min-BzHiZW8k.js";
|
|
8
8
|
import { SelectTooltipText as J } from "./SelectTooltipText.js";
|
|
9
|
-
import { s as
|
|
9
|
+
import { s as a } from "../../../formSelect.module-C18N-SsT.js";
|
|
10
10
|
const N = ({
|
|
11
11
|
propertyName: r,
|
|
12
12
|
label: d,
|
|
13
|
-
options:
|
|
14
|
-
multi:
|
|
13
|
+
options: n,
|
|
14
|
+
multi: m = !1,
|
|
15
15
|
disabled: F = !1,
|
|
16
16
|
hoisted: I = !1,
|
|
17
17
|
hidden: $ = !1,
|
|
18
18
|
valueKey: i = "value",
|
|
19
19
|
textKey: T = "text",
|
|
20
20
|
clearable: j = !1,
|
|
21
|
-
searchable:
|
|
22
|
-
noOptionsMessage:
|
|
23
|
-
rules:
|
|
24
|
-
...
|
|
21
|
+
searchable: v = !0,
|
|
22
|
+
noOptionsMessage: w = "",
|
|
23
|
+
rules: o,
|
|
24
|
+
...l
|
|
25
25
|
}) => {
|
|
26
26
|
const {
|
|
27
27
|
control: p,
|
|
@@ -29,12 +29,12 @@ const N = ({
|
|
|
29
29
|
} = B(), c = S(
|
|
30
30
|
() => !H && h(s, r) !== void 0,
|
|
31
31
|
[s, r, H]
|
|
32
|
-
),
|
|
33
|
-
() =>
|
|
34
|
-
[
|
|
32
|
+
), A = S(
|
|
33
|
+
() => o?.required?.value,
|
|
34
|
+
[o]
|
|
35
35
|
), D = S(
|
|
36
|
-
() =>
|
|
37
|
-
[
|
|
36
|
+
() => o?.required?.message,
|
|
37
|
+
[o]
|
|
38
38
|
), E = () => {
|
|
39
39
|
if (s && s[r]) {
|
|
40
40
|
const u = s[r]?.message;
|
|
@@ -42,33 +42,33 @@ const N = ({
|
|
|
42
42
|
}
|
|
43
43
|
return D;
|
|
44
44
|
};
|
|
45
|
-
return $ ? /* @__PURE__ */ e(
|
|
46
|
-
|
|
45
|
+
return $ ? /* @__PURE__ */ e(C, { name: r, control: p, render: () => /* @__PURE__ */ e(M, {}) }) : /* @__PURE__ */ e("div", { className: a.formSelectContainer, "data-tooltip-id": d, children: /* @__PURE__ */ e(
|
|
46
|
+
C,
|
|
47
47
|
{
|
|
48
48
|
name: r,
|
|
49
|
-
rules:
|
|
49
|
+
rules: o,
|
|
50
50
|
control: p,
|
|
51
51
|
render: ({ field: { ref: u, onChange: x, value: q, ...O } }) => {
|
|
52
|
-
let g =
|
|
53
|
-
z(
|
|
54
|
-
const f =
|
|
52
|
+
let g = n;
|
|
53
|
+
z(n) && h(n[0], "options") !== void 0 && (g = n.flatMap((t) => h(t, "options") ?? []));
|
|
54
|
+
const f = m ? g?.filter(
|
|
55
55
|
(t) => q?.includes(t[i])
|
|
56
|
-
) : g?.find((t) => t[i] === q), P =
|
|
56
|
+
) : g?.find((t) => t[i] === q), P = m && l.multiDisplayType === "text" && l.fixedHeightInput;
|
|
57
57
|
return /* @__PURE__ */ b(M, { children: [
|
|
58
58
|
/* @__PURE__ */ e(
|
|
59
59
|
k,
|
|
60
60
|
{
|
|
61
61
|
...O,
|
|
62
|
-
...
|
|
62
|
+
...l,
|
|
63
63
|
value: f ?? [],
|
|
64
64
|
label: d,
|
|
65
65
|
variant: "outlined",
|
|
66
66
|
helperText: E(),
|
|
67
|
-
helperTextPersistent:
|
|
68
|
-
options:
|
|
67
|
+
helperTextPersistent: A || c,
|
|
68
|
+
options: n,
|
|
69
69
|
valid: !c,
|
|
70
|
-
multiSelect:
|
|
71
|
-
className: `${
|
|
70
|
+
multiSelect: m,
|
|
71
|
+
className: `${a.formSelect} ${c ? a.invalid : ""} ${P ? a.multiText : ""}`,
|
|
72
72
|
disabled: F,
|
|
73
73
|
valueKey: i,
|
|
74
74
|
textKey: T,
|
|
@@ -77,15 +77,15 @@ const N = ({
|
|
|
77
77
|
x(t);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
80
|
+
if (m) {
|
|
81
81
|
x(t.map((V) => V[i]));
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
x(t[i]);
|
|
84
|
+
x(t[i]), l?.onChange?.(t);
|
|
85
85
|
},
|
|
86
86
|
hoisted: I,
|
|
87
|
-
noOptionsMessage:
|
|
88
|
-
searchable:
|
|
87
|
+
noOptionsMessage: w,
|
|
88
|
+
searchable: v,
|
|
89
89
|
clearable: j,
|
|
90
90
|
menuMaxHeight: "15rem"
|
|
91
91
|
}
|
|
@@ -97,8 +97,8 @@ const N = ({
|
|
|
97
97
|
noArrow: !0,
|
|
98
98
|
place: "bottom",
|
|
99
99
|
delayShow: 420,
|
|
100
|
-
className:
|
|
101
|
-
hidden: !f || f.length === 0 || !
|
|
100
|
+
className: a.tooltip,
|
|
101
|
+
hidden: !f || f.length === 0 || !l.fixedHeightInput,
|
|
102
102
|
children: /* @__PURE__ */ e(J, { value: f, textKey: T, valueKey: i })
|
|
103
103
|
}
|
|
104
104
|
)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7520",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|