@gustavo-valsechi/client 1.4.149 → 1.4.150
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/types/form/types/select/index.js +3 -3
- package/dist/components/types/form/types/select/index.mjs +3 -3
- package/dist/components/types/form/types/select/options/index.js +5 -7
- package/dist/components/types/form/types/select/options/index.mjs +5 -7
- package/dist/interfaces/components/form/select/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -48,8 +48,8 @@ function InputSelect(props) {
|
|
|
48
48
|
const [focus, setFocus] = (0, import_react.useState)(false);
|
|
49
49
|
const [filter, setFilter] = (0, import_react.useState)("");
|
|
50
50
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
51
|
-
const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
|
|
52
|
-
const value = ((_b =
|
|
51
|
+
const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
|
|
52
|
+
const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || "";
|
|
53
53
|
console.log(inputValue);
|
|
54
54
|
console.log(import_lodash.default.find(props.options, (option) => Object.keys(option)[0] === inputValue));
|
|
55
55
|
console.log(value);
|
|
@@ -114,7 +114,7 @@ function InputSelect(props) {
|
|
|
114
114
|
onFocus,
|
|
115
115
|
onBlur,
|
|
116
116
|
onClick: () => inputRef.current.focus(),
|
|
117
|
-
value: focus ? filter :
|
|
117
|
+
value: focus ? filter : inputValue,
|
|
118
118
|
placeholder: import_lodash.default.isString(value) ? value : (value == null ? void 0 : value.textContent) || ""
|
|
119
119
|
}
|
|
120
120
|
),
|
|
@@ -15,8 +15,8 @@ function InputSelect(props) {
|
|
|
15
15
|
const [focus, setFocus] = useState(false);
|
|
16
16
|
const [filter, setFilter] = useState("");
|
|
17
17
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
18
|
-
const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
|
|
19
|
-
const value = ((_b =
|
|
18
|
+
const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
|
|
19
|
+
const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || "";
|
|
20
20
|
console.log(inputValue);
|
|
21
21
|
console.log(_.find(props.options, (option) => Object.keys(option)[0] === inputValue));
|
|
22
22
|
console.log(value);
|
|
@@ -81,7 +81,7 @@ function InputSelect(props) {
|
|
|
81
81
|
onFocus,
|
|
82
82
|
onBlur,
|
|
83
83
|
onClick: () => inputRef.current.focus(),
|
|
84
|
-
value: focus ? filter :
|
|
84
|
+
value: focus ? filter : inputValue,
|
|
85
85
|
placeholder: _.isString(value) ? value : (value == null ? void 0 : value.textContent) || ""
|
|
86
86
|
}
|
|
87
87
|
),
|
|
@@ -49,9 +49,7 @@ function InputSelectOption(props) {
|
|
|
49
49
|
if (mutation.type === "attributes" && mutation.attributeName === "value") {
|
|
50
50
|
const filter = optionsElement.getAttribute("value") || "";
|
|
51
51
|
if (!filter) return setOptions(props.options);
|
|
52
|
-
const filtredOptions = import_lodash.default.filter(props.options, (
|
|
53
|
-
var _a;
|
|
54
|
-
const value = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
|
|
52
|
+
const filtredOptions = import_lodash.default.filter(props.options, (value) => {
|
|
55
53
|
const normalize = (text2) => import_lodash.default.deburr(text2 == null ? void 0 : text2.toLowerCase());
|
|
56
54
|
if (import_lodash.default.isString(value)) return import_lodash.default.includes(normalize(value), normalize(filter));
|
|
57
55
|
const text = import_utils.default.format.textIntoElement(value);
|
|
@@ -74,14 +72,14 @@ function InputSelectOption(props) {
|
|
|
74
72
|
};
|
|
75
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { id: `input-${props.name}-options`, width: props.width, children: import_lodash.default.map(
|
|
76
74
|
options,
|
|
77
|
-
(
|
|
75
|
+
(value, key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
76
|
"div",
|
|
79
77
|
{
|
|
80
78
|
className: "input-option",
|
|
81
|
-
onClick: () => onSelect(
|
|
82
|
-
children:
|
|
79
|
+
onClick: () => onSelect(key),
|
|
80
|
+
children: value || ""
|
|
83
81
|
},
|
|
84
|
-
|
|
82
|
+
key
|
|
85
83
|
)
|
|
86
84
|
) });
|
|
87
85
|
}
|
|
@@ -16,9 +16,7 @@ function InputSelectOption(props) {
|
|
|
16
16
|
if (mutation.type === "attributes" && mutation.attributeName === "value") {
|
|
17
17
|
const filter = optionsElement.getAttribute("value") || "";
|
|
18
18
|
if (!filter) return setOptions(props.options);
|
|
19
|
-
const filtredOptions = _.filter(props.options, (
|
|
20
|
-
var _a;
|
|
21
|
-
const value = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
|
|
19
|
+
const filtredOptions = _.filter(props.options, (value) => {
|
|
22
20
|
const normalize = (text2) => _.deburr(text2 == null ? void 0 : text2.toLowerCase());
|
|
23
21
|
if (_.isString(value)) return _.includes(normalize(value), normalize(filter));
|
|
24
22
|
const text = Utils.format.textIntoElement(value);
|
|
@@ -41,14 +39,14 @@ function InputSelectOption(props) {
|
|
|
41
39
|
};
|
|
42
40
|
return /* @__PURE__ */ jsx(Container, { id: `input-${props.name}-options`, width: props.width, children: _.map(
|
|
43
41
|
options,
|
|
44
|
-
(
|
|
42
|
+
(value, key) => /* @__PURE__ */ jsx(
|
|
45
43
|
"div",
|
|
46
44
|
{
|
|
47
45
|
className: "input-option",
|
|
48
|
-
onClick: () => onSelect(
|
|
49
|
-
children:
|
|
46
|
+
onClick: () => onSelect(key),
|
|
47
|
+
children: value || ""
|
|
50
48
|
},
|
|
51
|
-
|
|
49
|
+
key
|
|
52
50
|
)
|
|
53
51
|
) });
|
|
54
52
|
}
|