@gustavo-valsechi/client 1.4.294 → 1.4.296
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/src/components/types/form/types/datetime/index.js +1 -2
- package/dist/src/components/types/form/types/datetime/index.mjs +1 -2
- package/dist/src/components/types/form/types/select/index.js +1 -2
- package/dist/src/components/types/form/types/select/index.mjs +1 -2
- package/dist/src/contexts/target/index.js +9 -19
- package/dist/src/contexts/target/index.mjs +9 -19
- package/dist/src/interfaces/contexts/target/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ function InputDateTime(props) {
|
|
|
50
50
|
const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
|
|
51
51
|
(0, import_react.useEffect)(() => {
|
|
52
52
|
if (!inputRef.current || !toggleRef.current) return;
|
|
53
|
-
target.
|
|
53
|
+
target.save({
|
|
54
54
|
ref: inputRef,
|
|
55
55
|
toggleRef,
|
|
56
56
|
mobileModal: {
|
|
@@ -65,7 +65,6 @@ function InputDateTime(props) {
|
|
|
65
65
|
},
|
|
66
66
|
component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_picker.default, { ...props })
|
|
67
67
|
});
|
|
68
|
-
return () => target.remove(inputRef);
|
|
69
68
|
}, [inputRef, toggleRef]);
|
|
70
69
|
const onChange = (event) => {
|
|
71
70
|
var _a2;
|
|
@@ -17,7 +17,7 @@ function InputDateTime(props) {
|
|
|
17
17
|
const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
if (!inputRef.current || !toggleRef.current) return;
|
|
20
|
-
target.
|
|
20
|
+
target.save({
|
|
21
21
|
ref: inputRef,
|
|
22
22
|
toggleRef,
|
|
23
23
|
mobileModal: {
|
|
@@ -32,7 +32,6 @@ function InputDateTime(props) {
|
|
|
32
32
|
},
|
|
33
33
|
component: /* @__PURE__ */ jsx(InputDateTimePicker, { ...props })
|
|
34
34
|
});
|
|
35
|
-
return () => target.remove(inputRef);
|
|
36
35
|
}, [inputRef, toggleRef]);
|
|
37
36
|
const onChange = (event) => {
|
|
38
37
|
var _a2;
|
|
@@ -54,7 +54,7 @@ function InputSelect(props) {
|
|
|
54
54
|
(0, import_react.useEffect)(() => {
|
|
55
55
|
var _a2;
|
|
56
56
|
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
|
|
57
|
-
target.
|
|
57
|
+
target.save({
|
|
58
58
|
ref: inputRef,
|
|
59
59
|
component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
60
|
import_options.default,
|
|
@@ -66,7 +66,6 @@ function InputSelect(props) {
|
|
|
66
66
|
}
|
|
67
67
|
)
|
|
68
68
|
});
|
|
69
|
-
return () => target.remove(inputRef);
|
|
70
69
|
}, [containerRef, inputRef, props.options]);
|
|
71
70
|
(0, import_react.useEffect)(() => {
|
|
72
71
|
if (!inputRef.current || !inputValue) return;
|
|
@@ -21,7 +21,7 @@ function InputSelect(props) {
|
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
var _a2;
|
|
23
23
|
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
|
|
24
|
-
target.
|
|
24
|
+
target.save({
|
|
25
25
|
ref: inputRef,
|
|
26
26
|
component: /* @__PURE__ */ jsx(
|
|
27
27
|
InputSelectOption,
|
|
@@ -33,7 +33,6 @@ function InputSelect(props) {
|
|
|
33
33
|
}
|
|
34
34
|
)
|
|
35
35
|
});
|
|
36
|
-
return () => target.remove(inputRef);
|
|
37
36
|
}, [containerRef, inputRef, props.options]);
|
|
38
37
|
useEffect(() => {
|
|
39
38
|
if (!inputRef.current || !inputValue) return;
|
|
@@ -115,30 +115,20 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
115
115
|
if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
|
|
116
116
|
insideMemory.push(index);
|
|
117
117
|
};
|
|
118
|
-
const
|
|
118
|
+
const save = (target) => {
|
|
119
119
|
const exists = import_lodash.default.find(memory, (data) => data.ref.current === target.ref.current);
|
|
120
|
-
|
|
120
|
+
const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === target.ref.current);
|
|
121
|
+
if (exists) {
|
|
122
|
+
memory.splice(index, 1, { ...exists, ...target });
|
|
123
|
+
setTargets([...memory]);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
121
126
|
memory.push(target);
|
|
122
127
|
setTargets([...memory]);
|
|
123
128
|
};
|
|
124
129
|
const remove = (ref) => {
|
|
125
130
|
const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
|
|
126
|
-
if (!theme.content.isMobile)
|
|
127
|
-
removeInside(index);
|
|
128
|
-
import_lodash.default.forEach(targets, (target, index2) => {
|
|
129
|
-
var _a, _b;
|
|
130
|
-
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
131
|
-
const toggleElement = ((_b = target.toggleRef) == null ? void 0 : _b.current) || element;
|
|
132
|
-
if (!(toggleElement == null ? void 0 : toggleElement.removeEventListener)) return;
|
|
133
|
-
const focusable = elementFocusable(target, index2);
|
|
134
|
-
const targetElement = containerRef.current[index2];
|
|
135
|
-
toggleElement.removeEventListener("click", () => (0, import_events.onClick)(target, index2, close, focusable, targetElement, theme, setModal));
|
|
136
|
-
if (theme.content.isMobile) return;
|
|
137
|
-
toggleElement.removeEventListener("mouseleave", () => removeInside(index2));
|
|
138
|
-
focusable.removeEventListener("focus", () => (0, import_events.onFocus)(target, index2, open));
|
|
139
|
-
focusable.removeEventListener("blur", () => (0, import_events.onBlur)(target, index2, close, focusable, insideMemory));
|
|
140
|
-
});
|
|
141
|
-
}
|
|
131
|
+
if (!theme.content.isMobile) removeInside(index);
|
|
142
132
|
memory.splice(index, 1);
|
|
143
133
|
setTargets([...memory]);
|
|
144
134
|
};
|
|
@@ -197,7 +187,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
197
187
|
TargetContext.Provider,
|
|
198
188
|
{
|
|
199
189
|
value: {
|
|
200
|
-
|
|
190
|
+
save,
|
|
201
191
|
remove,
|
|
202
192
|
close: closeTarget,
|
|
203
193
|
isActive
|
|
@@ -81,30 +81,20 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
81
81
|
if (_.some(insideMemory, (i) => i === index)) return;
|
|
82
82
|
insideMemory.push(index);
|
|
83
83
|
};
|
|
84
|
-
const
|
|
84
|
+
const save = (target) => {
|
|
85
85
|
const exists = _.find(memory, (data) => data.ref.current === target.ref.current);
|
|
86
|
-
|
|
86
|
+
const index = _.findIndex(memory, (data) => data.ref.current === target.ref.current);
|
|
87
|
+
if (exists) {
|
|
88
|
+
memory.splice(index, 1, { ...exists, ...target });
|
|
89
|
+
setTargets([...memory]);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
87
92
|
memory.push(target);
|
|
88
93
|
setTargets([...memory]);
|
|
89
94
|
};
|
|
90
95
|
const remove = (ref) => {
|
|
91
96
|
const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
|
|
92
|
-
if (!theme.content.isMobile)
|
|
93
|
-
removeInside(index);
|
|
94
|
-
_.forEach(targets, (target, index2) => {
|
|
95
|
-
var _a, _b;
|
|
96
|
-
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
97
|
-
const toggleElement = ((_b = target.toggleRef) == null ? void 0 : _b.current) || element;
|
|
98
|
-
if (!(toggleElement == null ? void 0 : toggleElement.removeEventListener)) return;
|
|
99
|
-
const focusable = elementFocusable(target, index2);
|
|
100
|
-
const targetElement = containerRef.current[index2];
|
|
101
|
-
toggleElement.removeEventListener("click", () => onClick(target, index2, close, focusable, targetElement, theme, setModal));
|
|
102
|
-
if (theme.content.isMobile) return;
|
|
103
|
-
toggleElement.removeEventListener("mouseleave", () => removeInside(index2));
|
|
104
|
-
focusable.removeEventListener("focus", () => onFocus(target, index2, open));
|
|
105
|
-
focusable.removeEventListener("blur", () => onBlur(target, index2, close, focusable, insideMemory));
|
|
106
|
-
});
|
|
107
|
-
}
|
|
97
|
+
if (!theme.content.isMobile) removeInside(index);
|
|
108
98
|
memory.splice(index, 1);
|
|
109
99
|
setTargets([...memory]);
|
|
110
100
|
};
|
|
@@ -163,7 +153,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
163
153
|
TargetContext.Provider,
|
|
164
154
|
{
|
|
165
155
|
value: {
|
|
166
|
-
|
|
156
|
+
save,
|
|
167
157
|
remove,
|
|
168
158
|
close: closeTarget,
|
|
169
159
|
isActive
|
|
@@ -13,7 +13,7 @@ export interface ITargetConfigCoords {
|
|
|
13
13
|
left: number;
|
|
14
14
|
}
|
|
15
15
|
export interface ITargetContext {
|
|
16
|
-
|
|
16
|
+
save: (config: ITargetConfig) => void;
|
|
17
17
|
remove: (ref: React.RefObject<any>) => void;
|
|
18
18
|
close: (ref: React.RefObject<any>) => void;
|
|
19
19
|
isActive: (ref: React.RefObject<any>) => boolean;
|