@gustavo-valsechi/client 1.4.144 → 1.4.146
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.
|
@@ -50,12 +50,6 @@ function InputSelect(props) {
|
|
|
50
50
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
51
51
|
const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
|
|
52
52
|
const value = ((_b = import_lodash.default.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
|
|
53
|
-
(0, import_react.useEffect)(() => {
|
|
54
|
-
if (focus) return;
|
|
55
|
-
const optionsElement = document.getElementById("input-options");
|
|
56
|
-
if (!optionsElement) return;
|
|
57
|
-
optionsElement.setAttribute("value", "");
|
|
58
|
-
}, [focus]);
|
|
59
53
|
(0, import_react.useEffect)(() => {
|
|
60
54
|
var _a2;
|
|
61
55
|
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
|
|
@@ -81,13 +75,16 @@ function InputSelect(props) {
|
|
|
81
75
|
const onFocus = (event) => {
|
|
82
76
|
setFocus(true);
|
|
83
77
|
if (register.onFocus) register.onFocus(event);
|
|
78
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
79
|
+
if (!optionsElement) return;
|
|
80
|
+
setFilter(optionsElement.getAttribute("value") || "");
|
|
84
81
|
};
|
|
85
82
|
const onChange = (event) => {
|
|
86
83
|
const value2 = event.target.value || "";
|
|
87
84
|
event.target.value = props.mask ? props.mask(value2) : value2;
|
|
88
85
|
setFilter(value2);
|
|
89
86
|
if (props.onFilter) props.onFilter(value2);
|
|
90
|
-
const optionsElement = document.getElementById(
|
|
87
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
91
88
|
if (!optionsElement) return;
|
|
92
89
|
optionsElement.setAttribute("value", value2);
|
|
93
90
|
};
|
|
@@ -17,12 +17,6 @@ function InputSelect(props) {
|
|
|
17
17
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
18
18
|
const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
|
|
19
19
|
const value = ((_b = _.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (focus) return;
|
|
22
|
-
const optionsElement = document.getElementById("input-options");
|
|
23
|
-
if (!optionsElement) return;
|
|
24
|
-
optionsElement.setAttribute("value", "");
|
|
25
|
-
}, [focus]);
|
|
26
20
|
useEffect(() => {
|
|
27
21
|
var _a2;
|
|
28
22
|
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
|
|
@@ -48,13 +42,16 @@ function InputSelect(props) {
|
|
|
48
42
|
const onFocus = (event) => {
|
|
49
43
|
setFocus(true);
|
|
50
44
|
if (register.onFocus) register.onFocus(event);
|
|
45
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
46
|
+
if (!optionsElement) return;
|
|
47
|
+
setFilter(optionsElement.getAttribute("value") || "");
|
|
51
48
|
};
|
|
52
49
|
const onChange = (event) => {
|
|
53
50
|
const value2 = event.target.value || "";
|
|
54
51
|
event.target.value = props.mask ? props.mask(value2) : value2;
|
|
55
52
|
setFilter(value2);
|
|
56
53
|
if (props.onFilter) props.onFilter(value2);
|
|
57
|
-
const optionsElement = document.getElementById(
|
|
54
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
58
55
|
if (!optionsElement) return;
|
|
59
56
|
optionsElement.setAttribute("value", value2);
|
|
60
57
|
};
|
|
@@ -42,7 +42,7 @@ function InputSelectOption(props) {
|
|
|
42
42
|
const target = (0, import_contexts.useTarget)();
|
|
43
43
|
const [options, setOptions] = (0, import_react.useState)(props.options);
|
|
44
44
|
(0, import_react.useEffect)(() => {
|
|
45
|
-
const optionsElement = document.getElementById(
|
|
45
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
46
46
|
if (!optionsElement) return;
|
|
47
47
|
const observer = new MutationObserver((mutations) => {
|
|
48
48
|
for (const mutation of mutations) {
|
|
@@ -68,8 +68,11 @@ function InputSelectOption(props) {
|
|
|
68
68
|
var _a;
|
|
69
69
|
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
70
70
|
target.close(props.inputRef);
|
|
71
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
72
|
+
if (!optionsElement) return;
|
|
73
|
+
optionsElement.setAttribute("value", "");
|
|
71
74
|
};
|
|
72
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { id:
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { id: `input-${props.name}-options`, width: props.width, children: import_lodash.default.map(
|
|
73
76
|
options,
|
|
74
77
|
(data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
78
|
"div",
|
|
@@ -9,7 +9,7 @@ function InputSelectOption(props) {
|
|
|
9
9
|
const target = useTarget();
|
|
10
10
|
const [options, setOptions] = useState(props.options);
|
|
11
11
|
useEffect(() => {
|
|
12
|
-
const optionsElement = document.getElementById(
|
|
12
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
13
13
|
if (!optionsElement) return;
|
|
14
14
|
const observer = new MutationObserver((mutations) => {
|
|
15
15
|
for (const mutation of mutations) {
|
|
@@ -35,8 +35,11 @@ function InputSelectOption(props) {
|
|
|
35
35
|
var _a;
|
|
36
36
|
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
37
37
|
target.close(props.inputRef);
|
|
38
|
+
const optionsElement = document.getElementById(`input-${props.name}-options`);
|
|
39
|
+
if (!optionsElement) return;
|
|
40
|
+
optionsElement.setAttribute("value", "");
|
|
38
41
|
};
|
|
39
|
-
return /* @__PURE__ */ jsx(Container, { id:
|
|
42
|
+
return /* @__PURE__ */ jsx(Container, { id: `input-${props.name}-options`, width: props.width, children: _.map(
|
|
40
43
|
options,
|
|
41
44
|
(data, index) => /* @__PURE__ */ jsx(
|
|
42
45
|
"div",
|