ynotsoft-dynamic-form 1.0.80 → 1.0.82
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 +36 -4
- package/dist/dynamic-form.js +13 -9
- package/dist/dynamic-form.umd.cjs +38 -38
- package/dist/index.css +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -59,6 +59,7 @@ npm run dev --workspace ynotsoft-dynamic-form
|
|
|
59
59
|
### 5\. How to push changes
|
|
60
60
|
|
|
61
61
|
#### For Regular Development Changes:
|
|
62
|
+
|
|
62
63
|
```bash
|
|
63
64
|
# 1. Commit your changes
|
|
64
65
|
git add .
|
|
@@ -69,6 +70,7 @@ git tag v1.0.[version-number]
|
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
#### For NPM Package Releases:
|
|
73
|
+
|
|
72
74
|
```bash
|
|
73
75
|
# 1. Update version in package.json (in packages/dynamic-form-lib/)
|
|
74
76
|
npm version patch # for bug fixes (1.0.0 → 1.0.1)
|
|
@@ -83,12 +85,14 @@ git push origin v1.0.[version-number] # Replace with your actual version
|
|
|
83
85
|
```
|
|
84
86
|
|
|
85
87
|
#### Version Management:
|
|
88
|
+
|
|
86
89
|
- **Single Source of Truth:** Version is maintained in `packages/dynamic-form-lib/package.json`
|
|
87
90
|
- **Git Tags:** Use format `v1.0.[version-number]` (matches package.json version with "v" prefix)
|
|
88
91
|
- **NPM Registry:** GitHub Actions reads git tag, strips "v" prefix, publishes as `1.0.[version-number]` to NPM
|
|
89
92
|
- **Auto-Sync:** Git tag version must match package.json version for successful deployment
|
|
90
93
|
|
|
91
94
|
**Quick Check:**
|
|
95
|
+
|
|
92
96
|
```bash
|
|
93
97
|
# Verify versions match before pushing
|
|
94
98
|
cat packages/dynamic-form-lib/package.json | grep version
|
|
@@ -116,7 +120,7 @@ const formDefinition = {
|
|
|
116
120
|
|
|
117
121
|
<DynamicForm
|
|
118
122
|
formDefinition={formDefinition}
|
|
119
|
-
returnType=
|
|
123
|
+
returnType={false}
|
|
120
124
|
defaultValues={{ name: "John Doe" }}
|
|
121
125
|
sendFormValues={(values) => console.log(values)}
|
|
122
126
|
onFieldsChange={(values) => console.log("Changed:", values)}
|
|
@@ -254,10 +258,10 @@ Search for selections and select multiple/single
|
|
|
254
258
|
required: true,
|
|
255
259
|
placeholder: "Type to search users...",
|
|
256
260
|
// layout: "inline", // default inline
|
|
257
|
-
layout: "dialog",
|
|
261
|
+
layout: "dialog",
|
|
258
262
|
optionsUrl: "/api/users/search", // API endpoint
|
|
259
|
-
minSearchLength: 2, // Minimum characters before search (default: 2)
|
|
260
|
-
selectMode: "single", // 'single' | 'multiple' (default: 'single')
|
|
263
|
+
minSearchLength: 2, // Minimum characters before search (default: 2)
|
|
264
|
+
selectMode: "single", // 'single' | 'multiple' (default: 'single')
|
|
261
265
|
}
|
|
262
266
|
```
|
|
263
267
|
|
|
@@ -551,6 +555,34 @@ Load options from API:
|
|
|
551
555
|
}
|
|
552
556
|
```
|
|
553
557
|
|
|
558
|
+
### Adding Custom styles per field
|
|
559
|
+
|
|
560
|
+
Add custom styles to control field layout flow like: col-span-full | col-span-6
|
|
561
|
+
|
|
562
|
+
field property: 'class:'
|
|
563
|
+
|
|
564
|
+
```javascript
|
|
565
|
+
{
|
|
566
|
+
name: 'city',
|
|
567
|
+
label: 'City',
|
|
568
|
+
type: 'select',
|
|
569
|
+
class: "col-span-6" // using tailwind classes to control layout flow.
|
|
570
|
+
}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Adding description per field.
|
|
574
|
+
|
|
575
|
+
Add description below the input field to give helpful information to users
|
|
576
|
+
|
|
577
|
+
```javascript
|
|
578
|
+
{
|
|
579
|
+
name: 'sort',
|
|
580
|
+
label: 'Sort Order',
|
|
581
|
+
type: 'select',
|
|
582
|
+
description: "Sort by priority. 1: Highest Priority , 5 Lowerst Priority" // Use to add description below fields
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
554
586
|
---
|
|
555
587
|
|
|
556
588
|
## Complete Example
|
package/dist/dynamic-form.js
CHANGED
|
@@ -4677,12 +4677,8 @@ const Df = ({ editor: e, error: t }) => {
|
|
|
4677
4677
|
const [, n] = fe(0);
|
|
4678
4678
|
if (Ze(() => {
|
|
4679
4679
|
if (!e) return;
|
|
4680
|
-
const s = () =>
|
|
4681
|
-
|
|
4682
|
-
};
|
|
4683
|
-
return e.on("transaction", s), () => {
|
|
4684
|
-
e.off("transaction", s);
|
|
4685
|
-
};
|
|
4680
|
+
const s = () => n((i) => i + 1);
|
|
4681
|
+
return e.on("transaction", s), () => e.off("transaction", s);
|
|
4686
4682
|
}, [e]), !e) return null;
|
|
4687
4683
|
const o = (s) => `p-2 rounded-sm transition-colors duration-200 focus-visible:ring-1 focus-visible:ring-ring/40 focus-visible:outline-none ${s ? "bg-primary text-primary-foreground" : "hover:bg-accent hover:text-accent-foreground text-muted-foreground"}`.trim(), r = () => /* @__PURE__ */ c("div", { className: "w-px h-4 bg-border mx-1 self-center", "aria-hidden": "true" });
|
|
4688
4684
|
return /* @__PURE__ */ M(
|
|
@@ -9881,7 +9877,7 @@ const sh = ({
|
|
|
9881
9877
|
) : g[S.name] && console.log(
|
|
9882
9878
|
`[fieldFormat RENDER] Error exists in state for ${S.name} but not passed in props!`
|
|
9883
9879
|
)), A.includes(S.type))
|
|
9884
|
-
return /* @__PURE__ */ c("div", { className: S.
|
|
9880
|
+
return /* @__PURE__ */ c("div", { className: S.class || "col-span-full", children: b });
|
|
9885
9881
|
const T = S.containerStyle, _ = S.color || "blue", N = T === "card" ? `rounded-lg border text-card-foreground shadow-sm p-4 ${S.containerClassName || W[_] || W.blue}` : "", K = /* @__PURE__ */ M(Ke, { children: [
|
|
9886
9882
|
S.label && /* @__PURE__ */ M(
|
|
9887
9883
|
"label",
|
|
@@ -9895,9 +9891,10 @@ const sh = ({
|
|
|
9895
9891
|
}
|
|
9896
9892
|
),
|
|
9897
9893
|
/* @__PURE__ */ c("div", { children: b }),
|
|
9894
|
+
S.description && /* @__PURE__ */ c("p", { class: "text-xs mt-1.5 text-gray-400", children: S.description }),
|
|
9898
9895
|
k && /* @__PURE__ */ c("p", { className: "text-sm text-red-500 mt-1", children: k })
|
|
9899
9896
|
] });
|
|
9900
|
-
return /* @__PURE__ */ c("div", { className:
|
|
9897
|
+
return /* @__PURE__ */ c("div", { className: "mb-4", children: T === "card" ? /* @__PURE__ */ c("div", { className: N, children: K }) : K });
|
|
9901
9898
|
}
|
|
9902
9899
|
const V = (b) => {
|
|
9903
9900
|
if (b.showIf && !b.showIf(f)) return null;
|
|
@@ -9934,7 +9931,14 @@ const sh = ({
|
|
|
9934
9931
|
onSubmit: H,
|
|
9935
9932
|
className: "grid grid-cols-12 gap-x-4 mx-auto w-full ",
|
|
9936
9933
|
children: [
|
|
9937
|
-
o ? o.fields.map((b) => /* @__PURE__ */ c(
|
|
9934
|
+
o ? o.fields.map((b) => /* @__PURE__ */ c(
|
|
9935
|
+
"div",
|
|
9936
|
+
{
|
|
9937
|
+
className: `${b.class || "col-span-full"} `,
|
|
9938
|
+
children: V(b)
|
|
9939
|
+
},
|
|
9940
|
+
b.name + b.type
|
|
9941
|
+
)) : /* @__PURE__ */ c("div", { children: "Loading..." }),
|
|
9938
9942
|
/* @__PURE__ */ c(
|
|
9939
9943
|
"div",
|
|
9940
9944
|
{
|