@gustavo-valsechi/client 1.4.125 → 1.4.127
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.
|
@@ -39,13 +39,7 @@ var import_contexts = require("../../../../../../contexts");
|
|
|
39
39
|
var import_lodash = __toESM(require("lodash"));
|
|
40
40
|
function InputSelectOption(props) {
|
|
41
41
|
const target = (0, import_contexts.useTarget)();
|
|
42
|
-
const [value, set] = (0, import_react.useState)("");
|
|
43
42
|
const [options, setOptions] = (0, import_react.useState)(props.options);
|
|
44
|
-
(0, import_react.useEffect)(() => {
|
|
45
|
-
var _a;
|
|
46
|
-
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
47
|
-
target.close(props.inputRef);
|
|
48
|
-
}, [value, props.inputRef]);
|
|
49
43
|
(0, import_react.useEffect)(() => {
|
|
50
44
|
const optionsElement = document.getElementById("input-options");
|
|
51
45
|
if (!optionsElement) return;
|
|
@@ -56,13 +50,13 @@ function InputSelectOption(props) {
|
|
|
56
50
|
if (!filter) return setOptions(props.options);
|
|
57
51
|
const filtredOptions = import_lodash.default.filter(props.options, (data) => {
|
|
58
52
|
var _a;
|
|
59
|
-
const
|
|
53
|
+
const value = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
|
|
60
54
|
const normalize = (text) => import_lodash.default.deburr(text == null ? void 0 : text.toLowerCase());
|
|
61
|
-
if (import_lodash.default.isString(
|
|
62
|
-
console.log(typeof
|
|
63
|
-
console.log(
|
|
64
|
-
console.log(
|
|
65
|
-
return import_lodash.default.includes(normalize(
|
|
55
|
+
if (import_lodash.default.isString(value)) return import_lodash.default.includes(normalize(value), normalize(filter));
|
|
56
|
+
console.log(typeof value);
|
|
57
|
+
console.log(value);
|
|
58
|
+
console.log(value == null ? void 0 : value.textContent);
|
|
59
|
+
return import_lodash.default.includes(normalize(value == null ? void 0 : value.textContent), normalize(filter));
|
|
66
60
|
});
|
|
67
61
|
setOptions(filtredOptions);
|
|
68
62
|
}
|
|
@@ -71,13 +65,18 @@ function InputSelectOption(props) {
|
|
|
71
65
|
observer.observe(optionsElement, { attributes: true });
|
|
72
66
|
return () => observer.disconnect();
|
|
73
67
|
}, [props.options]);
|
|
68
|
+
const onSelect = (value) => {
|
|
69
|
+
var _a;
|
|
70
|
+
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
71
|
+
target.close(props.inputRef);
|
|
72
|
+
};
|
|
74
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { id: "input-options", width: props.width, children: import_lodash.default.map(
|
|
75
74
|
options,
|
|
76
75
|
(data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
76
|
"div",
|
|
78
77
|
{
|
|
79
78
|
className: "input-option",
|
|
80
|
-
onClick: () =>
|
|
79
|
+
onClick: () => onSelect(Object.keys(data)[index]),
|
|
81
80
|
children: Object.values(data)[index] || ""
|
|
82
81
|
},
|
|
83
82
|
index
|
|
@@ -6,13 +6,7 @@ import { useTarget } from "../../../../../../contexts";
|
|
|
6
6
|
import _ from "lodash";
|
|
7
7
|
function InputSelectOption(props) {
|
|
8
8
|
const target = useTarget();
|
|
9
|
-
const [value, set] = useState("");
|
|
10
9
|
const [options, setOptions] = useState(props.options);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
var _a;
|
|
13
|
-
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
14
|
-
target.close(props.inputRef);
|
|
15
|
-
}, [value, props.inputRef]);
|
|
16
10
|
useEffect(() => {
|
|
17
11
|
const optionsElement = document.getElementById("input-options");
|
|
18
12
|
if (!optionsElement) return;
|
|
@@ -23,13 +17,13 @@ function InputSelectOption(props) {
|
|
|
23
17
|
if (!filter) return setOptions(props.options);
|
|
24
18
|
const filtredOptions = _.filter(props.options, (data) => {
|
|
25
19
|
var _a;
|
|
26
|
-
const
|
|
20
|
+
const value = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
|
|
27
21
|
const normalize = (text) => _.deburr(text == null ? void 0 : text.toLowerCase());
|
|
28
|
-
if (_.isString(
|
|
29
|
-
console.log(typeof
|
|
30
|
-
console.log(
|
|
31
|
-
console.log(
|
|
32
|
-
return _.includes(normalize(
|
|
22
|
+
if (_.isString(value)) return _.includes(normalize(value), normalize(filter));
|
|
23
|
+
console.log(typeof value);
|
|
24
|
+
console.log(value);
|
|
25
|
+
console.log(value == null ? void 0 : value.textContent);
|
|
26
|
+
return _.includes(normalize(value == null ? void 0 : value.textContent), normalize(filter));
|
|
33
27
|
});
|
|
34
28
|
setOptions(filtredOptions);
|
|
35
29
|
}
|
|
@@ -38,13 +32,18 @@ function InputSelectOption(props) {
|
|
|
38
32
|
observer.observe(optionsElement, { attributes: true });
|
|
39
33
|
return () => observer.disconnect();
|
|
40
34
|
}, [props.options]);
|
|
35
|
+
const onSelect = (value) => {
|
|
36
|
+
var _a;
|
|
37
|
+
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
38
|
+
target.close(props.inputRef);
|
|
39
|
+
};
|
|
41
40
|
return /* @__PURE__ */ jsx(Container, { id: "input-options", width: props.width, children: _.map(
|
|
42
41
|
options,
|
|
43
42
|
(data, index) => /* @__PURE__ */ jsx(
|
|
44
43
|
"div",
|
|
45
44
|
{
|
|
46
45
|
className: "input-option",
|
|
47
|
-
onClick: () =>
|
|
46
|
+
onClick: () => onSelect(Object.keys(data)[index]),
|
|
48
47
|
children: Object.values(data)[index] || ""
|
|
49
48
|
},
|
|
50
49
|
index
|
|
@@ -190,6 +190,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
190
190
|
onMouseLeave: () => {
|
|
191
191
|
insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
|
|
192
192
|
},
|
|
193
|
+
onClick: () => elementFocusable(target, index).focus(),
|
|
193
194
|
children: target.component
|
|
194
195
|
}
|
|
195
196
|
),
|
|
@@ -156,6 +156,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
156
156
|
onMouseLeave: () => {
|
|
157
157
|
insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
|
|
158
158
|
},
|
|
159
|
+
onClick: () => elementFocusable(target, index).focus(),
|
|
159
160
|
children: target.component
|
|
160
161
|
}
|
|
161
162
|
),
|