@dev-dudu-0515/panasuri 1.0.0 → 1.0.1
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/README.md +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,13 +16,13 @@ It provides:
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install
|
|
19
|
+
npm install @dev-dudu-0515/panasuri
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Then import the helper.
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import { createValidator } from "@
|
|
25
|
+
import { createValidator } from "@dev-dudu-0515/panasuri";
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
---
|
|
@@ -66,6 +66,7 @@ Returns:
|
|
|
66
66
|
|----------|-------------|
|
|
67
67
|
| `errors` | Reactive object containing validation errors. |
|
|
68
68
|
| `isValid()` | Validates the entire form and returns `true` or `false`. |
|
|
69
|
+
| `validateAll()` | Validates all form fields. |
|
|
69
70
|
| `validateField(field)` | Validates a single field. |
|
|
70
71
|
|
|
71
72
|
---
|
|
@@ -81,6 +82,12 @@ validateField("username");
|
|
|
81
82
|
Example:
|
|
82
83
|
|
|
83
84
|
```ts
|
|
85
|
+
const touched = reactive({
|
|
86
|
+
username: false
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
...
|
|
90
|
+
|
|
84
91
|
<input
|
|
85
92
|
@input=${(e: Event) => {
|
|
86
93
|
input.username = (e.target as HTMLInputElement).value;
|
|
@@ -139,6 +146,10 @@ const submit = () => {
|
|
|
139
146
|
## Complete Example
|
|
140
147
|
|
|
141
148
|
```ts
|
|
149
|
+
const touched = reactive({
|
|
150
|
+
username: false
|
|
151
|
+
});
|
|
152
|
+
|
|
142
153
|
const { errors, isValid, validateField } = createValidator(
|
|
143
154
|
input,
|
|
144
155
|
LoginSchema,
|