@nr1e/qwik-ui 2.0.7 → 2.0.9
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.
|
@@ -16,6 +16,8 @@ const TextField = qwik.component$((props) => {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const touched = qwik.useSignal(false);
|
|
19
|
+
const originalTriggerResetValue = props.triggerReset?.value;
|
|
20
|
+
const originalTriggerValidationValue = props.triggerValidation?.value;
|
|
19
21
|
qwik.useTask$(({ track }) => {
|
|
20
22
|
if (props.error && typeof props.error !== "string") {
|
|
21
23
|
track(() => error.value);
|
|
@@ -67,9 +69,13 @@ const TextField = qwik.component$((props) => {
|
|
|
67
69
|
qwik.useTask$(async ({ track }) => {
|
|
68
70
|
if (props.triggerReset) {
|
|
69
71
|
track(() => props.triggerReset?.value);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
if (originalTriggerResetValue !== props.triggerReset.value) {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
value.value = originalValue;
|
|
75
|
+
error.value = void 0;
|
|
76
|
+
touched.value = false;
|
|
77
|
+
}, 300);
|
|
78
|
+
}
|
|
73
79
|
}
|
|
74
80
|
});
|
|
75
81
|
const validate = qwik.$(async () => {
|
|
@@ -116,8 +122,10 @@ const TextField = qwik.component$((props) => {
|
|
|
116
122
|
qwik.useTask$(async ({ track }) => {
|
|
117
123
|
if (props.triggerValidation) {
|
|
118
124
|
track(() => props.triggerValidation?.value);
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
if (props.triggerValidation.value !== originalTriggerValidationValue) {
|
|
126
|
+
touched.value = true;
|
|
127
|
+
await validate();
|
|
128
|
+
}
|
|
121
129
|
}
|
|
122
130
|
});
|
|
123
131
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
@@ -14,6 +14,8 @@ const TextField = component$((props) => {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const touched = useSignal(false);
|
|
17
|
+
const originalTriggerResetValue = props.triggerReset?.value;
|
|
18
|
+
const originalTriggerValidationValue = props.triggerValidation?.value;
|
|
17
19
|
useTask$(({ track }) => {
|
|
18
20
|
if (props.error && typeof props.error !== "string") {
|
|
19
21
|
track(() => error.value);
|
|
@@ -65,9 +67,13 @@ const TextField = component$((props) => {
|
|
|
65
67
|
useTask$(async ({ track }) => {
|
|
66
68
|
if (props.triggerReset) {
|
|
67
69
|
track(() => props.triggerReset?.value);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
if (originalTriggerResetValue !== props.triggerReset.value) {
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
value.value = originalValue;
|
|
73
|
+
error.value = void 0;
|
|
74
|
+
touched.value = false;
|
|
75
|
+
}, 300);
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
});
|
|
73
79
|
const validate = $(async () => {
|
|
@@ -114,8 +120,10 @@ const TextField = component$((props) => {
|
|
|
114
120
|
useTask$(async ({ track }) => {
|
|
115
121
|
if (props.triggerValidation) {
|
|
116
122
|
track(() => props.triggerValidation?.value);
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
if (props.triggerValidation.value !== originalTriggerValidationValue) {
|
|
124
|
+
touched.value = true;
|
|
125
|
+
await validate();
|
|
126
|
+
}
|
|
119
127
|
}
|
|
120
128
|
});
|
|
121
129
|
return /* @__PURE__ */ jsxs("div", {
|