@gustavo-valsechi/client 1.4.109 → 1.4.111
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.
|
@@ -41,31 +41,28 @@ function InputSelectOption(props) {
|
|
|
41
41
|
const [options, setOptions] = (0, import_react.useState)(props.options);
|
|
42
42
|
(0, import_react.useEffect)(() => {
|
|
43
43
|
var _a, _b;
|
|
44
|
-
|
|
45
|
-
console.log("setValue", props.setValue);
|
|
46
|
-
(_a = props.setValue) == null ? void 0 : _a.call(props, value);
|
|
44
|
+
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
47
45
|
if (!value || !((_b = props.inputRef) == null ? void 0 : _b.current)) return;
|
|
48
46
|
props.inputRef.current.click();
|
|
49
47
|
}, [value, props.inputRef]);
|
|
50
48
|
(0, import_react.useEffect)(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
console.log("props.inputRef depois", props.inputRef);
|
|
55
|
-
props.inputRef.current.addEventListener("change", (e) => {
|
|
49
|
+
const inputRef = document.getElementById(`input-${props.name}`);
|
|
50
|
+
if (!inputRef) return;
|
|
51
|
+
inputRef.addEventListener("change", (e) => {
|
|
56
52
|
e.preventDefault();
|
|
57
|
-
const
|
|
53
|
+
const target = e.target;
|
|
54
|
+
const filter = target.value || "";
|
|
58
55
|
console.log("filter", filter);
|
|
59
56
|
if (!filter) return setOptions(props.options);
|
|
60
57
|
const filtredOptions = import_lodash.default.filter(props.options, (data) => {
|
|
61
|
-
var
|
|
62
|
-
const value2 = ((
|
|
58
|
+
var _a;
|
|
59
|
+
const value2 = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
|
|
63
60
|
if (import_lodash.default.isString(value2)) return import_lodash.default.includes(value2, filter);
|
|
64
61
|
return import_lodash.default.includes(value2 == null ? void 0 : value2.textContent, filter);
|
|
65
62
|
});
|
|
66
63
|
setOptions(filtredOptions);
|
|
67
64
|
});
|
|
68
|
-
}, [
|
|
65
|
+
}, []);
|
|
69
66
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { width: props.width, children: import_lodash.default.map(
|
|
70
67
|
options,
|
|
71
68
|
(data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -8,31 +8,28 @@ function InputSelectOption(props) {
|
|
|
8
8
|
const [options, setOptions] = useState(props.options);
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
|
|
12
|
-
console.log("setValue", props.setValue);
|
|
13
|
-
(_a = props.setValue) == null ? void 0 : _a.call(props, value);
|
|
11
|
+
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
|
|
14
12
|
if (!value || !((_b = props.inputRef) == null ? void 0 : _b.current)) return;
|
|
15
13
|
props.inputRef.current.click();
|
|
16
14
|
}, [value, props.inputRef]);
|
|
17
15
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
console.log("props.inputRef depois", props.inputRef);
|
|
22
|
-
props.inputRef.current.addEventListener("change", (e) => {
|
|
16
|
+
const inputRef = document.getElementById(`input-${props.name}`);
|
|
17
|
+
if (!inputRef) return;
|
|
18
|
+
inputRef.addEventListener("change", (e) => {
|
|
23
19
|
e.preventDefault();
|
|
24
|
-
const
|
|
20
|
+
const target = e.target;
|
|
21
|
+
const filter = target.value || "";
|
|
25
22
|
console.log("filter", filter);
|
|
26
23
|
if (!filter) return setOptions(props.options);
|
|
27
24
|
const filtredOptions = _.filter(props.options, (data) => {
|
|
28
|
-
var
|
|
29
|
-
const value2 = ((
|
|
25
|
+
var _a;
|
|
26
|
+
const value2 = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
|
|
30
27
|
if (_.isString(value2)) return _.includes(value2, filter);
|
|
31
28
|
return _.includes(value2 == null ? void 0 : value2.textContent, filter);
|
|
32
29
|
});
|
|
33
30
|
setOptions(filtredOptions);
|
|
34
31
|
});
|
|
35
|
-
}, [
|
|
32
|
+
}, []);
|
|
36
33
|
return /* @__PURE__ */ jsx(Container, { width: props.width, children: _.map(
|
|
37
34
|
options,
|
|
38
35
|
(data, index) => /* @__PURE__ */ jsx(
|