shadcn-zod-formkit 1.27.2 → 1.27.4
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/index.cjs +13 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/dist/shadcn-zod-formkit-1.27.4.tgz +0 -0
- package/package.json +1 -1
- package/dist/shadcn-zod-formkit-1.27.2.tgz +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -88,6 +88,7 @@ type FieldConfig<T, RT = Record<string, any>> = FieldProps<T, RT> | FieldConfig<
|
|
|
88
88
|
interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
89
89
|
name: keyof T;
|
|
90
90
|
label: string;
|
|
91
|
+
withAddBtn?: boolean;
|
|
91
92
|
form?: UseFormReturn<any>;
|
|
92
93
|
isRemovebleOption?: boolean;
|
|
93
94
|
withDuplicatTag?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ type FieldConfig<T, RT = Record<string, any>> = FieldProps<T, RT> | FieldConfig<
|
|
|
88
88
|
interface FieldProps<T = Record<string, any>, RT = Record<string, any>> {
|
|
89
89
|
name: keyof T;
|
|
90
90
|
label: string;
|
|
91
|
+
withAddBtn?: boolean;
|
|
91
92
|
form?: UseFormReturn<any>;
|
|
92
93
|
isRemovebleOption?: boolean;
|
|
93
94
|
withDuplicatTag?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -196,10 +196,14 @@ var entitiesToGroupedOption = (data, optionValue = "name") => {
|
|
|
196
196
|
return entities;
|
|
197
197
|
};
|
|
198
198
|
var handleOnChage = (event, input, field) => {
|
|
199
|
-
|
|
199
|
+
let value = event;
|
|
200
|
+
if (event && typeof event === "object" && "target" in event) {
|
|
201
|
+
value = event.target.value;
|
|
202
|
+
}
|
|
203
|
+
field?.onChange(value);
|
|
200
204
|
const data = input.form?.getValues();
|
|
201
|
-
input.onChange?.(
|
|
202
|
-
|
|
205
|
+
input.onChange?.(value, data);
|
|
206
|
+
input.onAnyFieldChange?.(data);
|
|
203
207
|
};
|
|
204
208
|
var isValidField = (input, form, defaultValue) => {
|
|
205
209
|
const value = defaultValue ?? form.getValues(input.name);
|
|
@@ -5522,6 +5526,7 @@ var StringValueListInput = class extends BaseInput {
|
|
|
5522
5526
|
};
|
|
5523
5527
|
var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
5524
5528
|
const fieldName = input.name;
|
|
5529
|
+
const withAddBtn = input.withAddBtn ?? false;
|
|
5525
5530
|
useEffect(() => {
|
|
5526
5531
|
const current = form.getValues(fieldName);
|
|
5527
5532
|
if (!Array.isArray(current)) {
|
|
@@ -5585,7 +5590,7 @@ var FieldStringValueList = ({ form, input, isSubmitting }) => {
|
|
|
5585
5590
|
},
|
|
5586
5591
|
index
|
|
5587
5592
|
)),
|
|
5588
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-end mt-2", children: /* @__PURE__ */ jsx(
|
|
5593
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end mt-2", children: withAddBtn && /* @__PURE__ */ jsx(
|
|
5589
5594
|
Button,
|
|
5590
5595
|
{
|
|
5591
5596
|
type: "button",
|
|
@@ -5626,9 +5631,10 @@ var FieldSwitch = ({ input, form, isSubmitting }) => {
|
|
|
5626
5631
|
Switch,
|
|
5627
5632
|
{
|
|
5628
5633
|
checked: field.value,
|
|
5629
|
-
onCheckedChange: (event) =>
|
|
5630
|
-
|
|
5631
|
-
|
|
5634
|
+
onCheckedChange: (event) => {
|
|
5635
|
+
handleOnChage(event, input, field);
|
|
5636
|
+
},
|
|
5637
|
+
disabled: false
|
|
5632
5638
|
}
|
|
5633
5639
|
) })
|
|
5634
5640
|
] }) })
|