ynotsoft-dynamic-form 1.0.68 → 1.0.70
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 +105 -4
- package/dist/dynamic-form.js +4293 -23279
- package/dist/dynamic-form.umd.cjs +83 -235
- package/dist/index.css +1 -1
- package/package.json +5 -12
package/README.md
CHANGED
|
@@ -1,3 +1,104 @@
|
|
|
1
|
+
# DynamicForm Component - Complete Field Reference
|
|
2
|
+
|
|
3
|
+
## Install and Development Setup (Bun Monorepo)
|
|
4
|
+
|
|
5
|
+
This project uses **Bun** as the package manager and **Vite** with custom path aliasing for Hot Module Replacement (HMR) in the monorepo workspace.
|
|
6
|
+
|
|
7
|
+
### 1\. Prerequisites
|
|
8
|
+
|
|
9
|
+
You **must** have **Bun** installed to manage dependencies and run development scripts.
|
|
10
|
+
( <https://bun.com/docs/installation> )
|
|
11
|
+
|
|
12
|
+
> Can now use npm instead of bun </br>
|
|
13
|
+
> node ^v22.7.0 required
|
|
14
|
+
|
|
15
|
+
### 2\. Install Dependencies
|
|
16
|
+
|
|
17
|
+
From the root of the repository (`dynamic-form/`):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install all dependencies and create workspace symlinks using Bun
|
|
21
|
+
bun install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 3\. Build the Library (Initial Setup)
|
|
25
|
+
|
|
26
|
+
Because the library's `package.json` entry points point to files in the `/dist` directory, you must run an initial build so the example app can resolve the dependency.
|
|
27
|
+
|
|
28
|
+
From the root of the repository:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run build #runs: bun run --filter @ynotsoft/dynamic-form build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
or you can use npm commands using the workspace (--workspace) flag and passing in the name of the package
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
npm run build --workspace ynotsoft-dynamic-form
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 4\. Start the Example App
|
|
41
|
+
|
|
42
|
+
Run the development server for the example application.
|
|
43
|
+
|
|
44
|
+
From the root of the repository:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run example #runs: bun --filter example dev
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
or you can use npm commands using the workspace (--workspace) flag and passing in the name of the package
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
npm run dev --workspace ynotsoft-dynamic-form
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> **IMPORTANT NOTE ON HMR (Hot Module Replacement):**
|
|
57
|
+
> If HMR fails for changes made in the `packages/dynamic-form-lib/` source code, ensure your `example-app/vite.config.js` has the necessary **Path Aliasing** configured to bypass the symlink watcher issue. This is configured to resolve HMR issues and is essential for local development.
|
|
58
|
+
|
|
59
|
+
### 5\. How to push changes
|
|
60
|
+
|
|
61
|
+
#### For Regular Development Changes:
|
|
62
|
+
```bash
|
|
63
|
+
# 1. Commit your changes
|
|
64
|
+
git add .
|
|
65
|
+
git commit -m "feat: your change description"
|
|
66
|
+
|
|
67
|
+
# 2. Create tag
|
|
68
|
+
git tag v1.0.[version-number]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### For NPM Package Releases:
|
|
72
|
+
```bash
|
|
73
|
+
# 1. Update version in package.json (in packages/dynamic-form-lib/)
|
|
74
|
+
npm version patch # for bug fixes (1.0.0 → 1.0.1)
|
|
75
|
+
|
|
76
|
+
# 2. Build the library
|
|
77
|
+
npm run build
|
|
78
|
+
|
|
79
|
+
# 3. Create and push version tag
|
|
80
|
+
git push origin v1.0.[version-number] # Replace with your actual version
|
|
81
|
+
|
|
82
|
+
# 4. GitHub Actions will automatically publish to NPM
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Version Management:
|
|
86
|
+
- **Single Source of Truth:** Version is maintained in `packages/dynamic-form-lib/package.json`
|
|
87
|
+
- **Git Tags:** Use format `v1.0.[version-number]` (matches package.json version with "v" prefix)
|
|
88
|
+
- **NPM Registry:** GitHub Actions reads git tag, strips "v" prefix, publishes as `1.0.[version-number]` to NPM
|
|
89
|
+
- **Auto-Sync:** Git tag version must match package.json version for successful deployment
|
|
90
|
+
|
|
91
|
+
**Quick Check:**
|
|
92
|
+
```bash
|
|
93
|
+
# Verify versions match before pushing
|
|
94
|
+
cat packages/dynamic-form-lib/package.json | grep version
|
|
95
|
+
git tag --list | tail -1
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> **Note:** The GitHub Actions workflow automatically publishes to NPM when you push a version tag (e.g., `v1.0.[version-number]`). No manual `npm publish` required unless you are not logged into NPM already.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
1
102
|
## Overview
|
|
2
103
|
|
|
3
104
|
The DynamicForm component provides a flexible, declarative way to build forms with various field types, validation, conditional logic, and styling options.
|
|
@@ -15,7 +116,7 @@ const formDefinition = {
|
|
|
15
116
|
|
|
16
117
|
<DynamicForm
|
|
17
118
|
formDefinition={formDefinition}
|
|
18
|
-
returnType={false}
|
|
119
|
+
returnType= {false}
|
|
19
120
|
defaultValues={{ name: "John Doe" }}
|
|
20
121
|
sendFormValues={(values) => console.log(values)}
|
|
21
122
|
onFieldsChange={(values) => console.log("Changed:", values)}
|
|
@@ -153,10 +254,10 @@ Search for selections and select multiple/single
|
|
|
153
254
|
required: true,
|
|
154
255
|
placeholder: "Type to search users...",
|
|
155
256
|
// layout: "inline", // default inline
|
|
156
|
-
layout: "dialog",
|
|
257
|
+
layout: "dialog",
|
|
157
258
|
optionsUrl: "/api/users/search", // API endpoint
|
|
158
|
-
minSearchLength: 2, // Minimum characters before search (default: 2)
|
|
159
|
-
selectMode: "single", // 'single' | 'multiple' (default: 'single')
|
|
259
|
+
minSearchLength: 2, // Minimum characters before search (default: 2)
|
|
260
|
+
selectMode: "single", // 'single' | 'multiple' (default: 'single')
|
|
160
261
|
}
|
|
161
262
|
```
|
|
162
263
|
|