@pixpilot/formily-shadcn 1.5.0 → 1.6.0
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/components/Form.d.ts +2 -2
- package/dist/components/FormGrid.d.ts +2 -2
- package/dist/components/IconPicker.d.ts +3 -3
- package/dist/components/IconToggle.d.cts +2 -2
- package/dist/components/IconToggle.d.ts +3 -3
- package/dist/components/Input.d.cts +3 -3
- package/dist/components/Input.d.ts +3 -3
- package/dist/components/Radio.d.ts +2 -2
- package/dist/components/Rating.d.ts +4 -4
- package/dist/components/Row.d.ts +2 -2
- package/dist/components/Separator.d.ts +2 -2
- package/dist/components/Switch.d.cts +2 -2
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/TagsInputInline.d.cts +2 -2
- package/dist/components/TagsInputInline.d.ts +3 -3
- package/dist/components/Textarea.d.cts +2 -2
- package/dist/components/Textarea.d.ts +2 -2
- package/dist/components/ToggleButton.d.ts +3 -3
- package/dist/components/array-dialog/ArrayDialog.cjs +8 -4
- package/dist/components/array-dialog/ArrayDialog.js +8 -4
- package/dist/components/array-dialog/EditDialog.cjs +12 -4
- package/dist/components/array-dialog/EditDialog.js +12 -4
- package/dist/components/array-popover/ArrayPopover.cjs +5 -1
- package/dist/components/array-popover/ArrayPopover.js +5 -1
- package/dist/components/array-popover/Popover.cjs +14 -2
- package/dist/components/array-popover/Popover.js +15 -3
- package/dist/components/context/types.d.cts +7 -2
- package/dist/components/context/types.d.ts +7 -2
- package/dist/components/schema-field/schema-field-basics.d.ts +303 -303
- package/dist/components/schema-field/schema-field-extended.d.cts +632 -632
- package/dist/components/schema-field/schema-field-extended.d.ts +633 -633
- package/dist/components/schema-field/schema-field.d.cts +412 -412
- package/dist/components/schema-field/schema-field.d.ts +412 -412
- package/dist/components/slider/Slider.d.ts +3 -3
- package/dist/components/slider/SliderInput.d.ts +3 -3
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormContextStates } from "./context/form-context.js";
|
|
2
2
|
import "./context/index.js";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
5
5
|
import { Form } from "@formily/core";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Form.d.ts
|
|
@@ -25,6 +25,6 @@ declare function Form$1({
|
|
|
25
25
|
onAutoSubmit,
|
|
26
26
|
layout,
|
|
27
27
|
settings
|
|
28
|
-
}: IFormProps):
|
|
28
|
+
}: IFormProps): react_jsx_runtime2.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { Form$1 as Form };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FormGrid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime4.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react29 from "react";
|
|
2
2
|
import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconPicker.d.ts
|
|
@@ -8,8 +8,8 @@ import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
|
8
8
|
* Automatically connects to Formily field state
|
|
9
9
|
* Supports both static and async icon providers
|
|
10
10
|
*/
|
|
11
|
-
declare const IconPicker$1:
|
|
11
|
+
declare const IconPicker$1: react29.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react29.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker$1 as IconPicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react10 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconToggle.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const IconToggle:
|
|
9
|
+
declare const IconToggle: react10.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react10.RefAttributes<HTMLButtonElement>>, "ref"> & react10.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { IconToggle };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react22 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui2 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconToggle.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const IconToggle$1:
|
|
9
|
+
declare const IconToggle$1: react22.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui2.IconToggleProps, "ref"> & react22.RefAttributes<HTMLButtonElement>>, "ref"> & react22.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { IconToggle$1 as IconToggle };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Input.d.ts
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@ import * as react9 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react6.ForwardRefExoticComponent<Omit<Partial<react6.ClassAttributes<HTMLInputElement> & react6.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
10
|
prefix?: React.ReactNode;
|
|
11
11
|
suffix?: React.ReactNode;
|
|
12
12
|
groupClassName?: string;
|
|
13
13
|
prefixClassName?: string;
|
|
14
14
|
suffixClassName?: string;
|
|
15
|
-
}>, "ref"> &
|
|
15
|
+
}>, "ref"> & react6.RefAttributes<unknown>>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { Input };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react25 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Input.d.ts
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@ import * as react9 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react25.ForwardRefExoticComponent<Omit<Partial<react25.ClassAttributes<HTMLInputElement> & react25.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
10
|
prefix?: React.ReactNode;
|
|
11
11
|
suffix?: React.ReactNode;
|
|
12
12
|
groupClassName?: string;
|
|
13
13
|
prefixClassName?: string;
|
|
14
14
|
suffixClassName?: string;
|
|
15
|
-
}>, "ref"> &
|
|
15
|
+
}>, "ref"> & react25.RefAttributes<unknown>>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { Input };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { RadioGroup } from "@pixpilot/shadcn";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Radio.d.ts
|
|
@@ -15,7 +15,7 @@ type RadioProps = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Radio component with options rendering
|
|
17
17
|
*/
|
|
18
|
-
declare function Radio(props: RadioProps):
|
|
18
|
+
declare function Radio(props: RadioProps): react_jsx_runtime0.JSX.Element;
|
|
19
19
|
declare namespace Radio {
|
|
20
20
|
var displayName: string;
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Rating.d.ts
|
|
@@ -6,8 +6,8 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
|
6
6
|
* Formily-connected Rating component
|
|
7
7
|
* Automatically connects shadcn-ui Rating to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Rating$1:
|
|
10
|
-
children?:
|
|
11
|
-
}> &
|
|
9
|
+
declare const Rating$1: react4.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.RatingProps & {
|
|
10
|
+
children?: react4.ReactNode | undefined;
|
|
11
|
+
}> & react4.RefAttributes<unknown>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { Rating$1 as Rating };
|
package/dist/components/Row.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Row.d.ts
|
|
5
5
|
interface IRowProps {
|
|
@@ -36,6 +36,6 @@ interface IRowProps {
|
|
|
36
36
|
declare function Row({
|
|
37
37
|
className,
|
|
38
38
|
children
|
|
39
|
-
}: IRowProps):
|
|
39
|
+
}: IRowProps): react_jsx_runtime1.JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { Row };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react7 from "react";
|
|
2
2
|
import * as _radix_ui_react_separator0 from "@radix-ui/react-separator";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Separator.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_separator0 from "@radix-ui/react-separator";
|
|
|
6
6
|
* Formily-connected Separator component
|
|
7
7
|
* A visual divider for content sections
|
|
8
8
|
*/
|
|
9
|
-
declare const Separator:
|
|
9
|
+
declare const Separator: react7.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react7.RefAttributes<HTMLDivElement>>, "ref"> & react7.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Separator };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react21 from "react";
|
|
2
2
|
import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Switch.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
|
6
6
|
* Formily-connected Switch component
|
|
7
7
|
* Toggle switch for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const Switch:
|
|
9
|
+
declare const Switch: react21.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react21.RefAttributes<HTMLButtonElement>>, "ref"> & react21.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react10 from "react";
|
|
2
2
|
import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Switch.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
|
6
6
|
* Formily-connected Switch component
|
|
7
7
|
* Toggle switch for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const Switch:
|
|
9
|
+
declare const Switch: react10.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react10.RefAttributes<HTMLButtonElement>>, "ref"> & react10.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react19 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/TagsInputInline.d.ts
|
|
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
|
10
10
|
* Based on DiceUI's tags-input for inline tag editing with keyboard navigation
|
|
11
11
|
* and validation support.
|
|
12
12
|
*/
|
|
13
|
-
declare const TagsInputInLine:
|
|
13
|
+
declare const TagsInputInLine: react19.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react19.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react13 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/TagsInputInline.d.ts
|
|
5
5
|
|
|
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
|
10
10
|
* Based on DiceUI's tags-input for inline tag editing with keyboard navigation
|
|
11
11
|
* and validation support.
|
|
12
12
|
*/
|
|
13
|
-
declare const TagsInputInLine:
|
|
13
|
+
declare const TagsInputInLine: react13.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.TagsInputProps> & react13.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react24 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Textarea.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Textarea component
|
|
6
6
|
*/
|
|
7
|
-
declare const Textarea:
|
|
7
|
+
declare const Textarea: react24.ForwardRefExoticComponent<Omit<Partial<react24.ClassAttributes<HTMLTextAreaElement> & react24.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react24.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react15 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Textarea.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Textarea component
|
|
6
6
|
*/
|
|
7
|
-
declare const Textarea:
|
|
7
|
+
declare const Textarea: react15.ForwardRefExoticComponent<Omit<Partial<react15.ClassAttributes<HTMLTextAreaElement> & react15.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react15.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react19 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ToggleButton.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const ToggleButton$1:
|
|
9
|
+
declare const ToggleButton$1: react19.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui1.ToggleButtonProps, "ref"> & react19.RefAttributes<HTMLButtonElement>>, "ref"> & react19.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { ToggleButton$1 as ToggleButton };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_use_form_context = require('../../hooks/use-form-context.cjs');
|
|
3
|
+
require('../../hooks/index.cjs');
|
|
2
4
|
const require_array_base = require('../array-base/array-base.cjs');
|
|
3
5
|
const require_component_context = require('../array-base/component-context.cjs');
|
|
4
6
|
require('../array-base/index.cjs');
|
|
@@ -25,7 +27,9 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
25
27
|
const ArrayDialogBase = (0, __formily_react.observer)((props) => {
|
|
26
28
|
const schema = (0, __formily_react.useFieldSchema)();
|
|
27
29
|
const { onAdd, onRemove, onMoveDown, onMoveUp, onEdit, className, transformActions, dialogProps } = props;
|
|
28
|
-
const {
|
|
30
|
+
const { settings = {} } = require_use_form_context.useFormContext();
|
|
31
|
+
const { autoSave: globalAutoSave } = settings.dialog || {};
|
|
32
|
+
const autoSave = props.autoSave ?? globalAutoSave ?? false;
|
|
29
33
|
const { activeItemManager, handleAdd, handleEdit, isNewItem, handleSaveClick, handleLiveChange, handleCancelClick } = require_use_array_editor.useArrayEditor({
|
|
30
34
|
onAdd,
|
|
31
35
|
onEdit,
|
|
@@ -35,7 +39,7 @@ const ArrayDialogBase = (0, __formily_react.observer)((props) => {
|
|
|
35
39
|
const items = require_use_array_item_schema.useArrayItemSchema();
|
|
36
40
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_array_base.ArrayBase, {
|
|
37
41
|
...props,
|
|
38
|
-
autoSave
|
|
42
|
+
autoSave,
|
|
39
43
|
transformActions,
|
|
40
44
|
onAdd: handleAdd,
|
|
41
45
|
onRemove,
|
|
@@ -57,10 +61,10 @@ const ArrayDialogBase = (0, __formily_react.observer)((props) => {
|
|
|
57
61
|
})]
|
|
58
62
|
});
|
|
59
63
|
});
|
|
60
|
-
const
|
|
64
|
+
const ArrayItemsComponent = (rest) => {
|
|
61
65
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_component_context.ArrayComponentProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArrayDialogBase, { ...rest }) });
|
|
62
66
|
};
|
|
63
|
-
const ArrayDialog =
|
|
67
|
+
const ArrayDialog = ArrayItemsComponent;
|
|
64
68
|
ArrayDialog.displayName = "ArrayDialog";
|
|
65
69
|
require_array_base.ArrayBase.mixin(ArrayDialog);
|
|
66
70
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useFormContext } from "../../hooks/use-form-context.js";
|
|
2
|
+
import "../../hooks/index.js";
|
|
1
3
|
import { ArrayBase } from "../array-base/array-base.js";
|
|
2
4
|
import { ArrayComponentProvider, useArrayComponents } from "../array-base/component-context.js";
|
|
3
5
|
import "../array-base/index.js";
|
|
@@ -21,7 +23,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
21
23
|
const ArrayDialogBase = observer((props) => {
|
|
22
24
|
const schema = useFieldSchema();
|
|
23
25
|
const { onAdd, onRemove, onMoveDown, onMoveUp, onEdit, className, transformActions, dialogProps } = props;
|
|
24
|
-
const {
|
|
26
|
+
const { settings = {} } = useFormContext();
|
|
27
|
+
const { autoSave: globalAutoSave } = settings.dialog || {};
|
|
28
|
+
const autoSave = props.autoSave ?? globalAutoSave ?? false;
|
|
25
29
|
const { activeItemManager, handleAdd, handleEdit, isNewItem, handleSaveClick, handleLiveChange, handleCancelClick } = useArrayEditor({
|
|
26
30
|
onAdd,
|
|
27
31
|
onEdit,
|
|
@@ -31,7 +35,7 @@ const ArrayDialogBase = observer((props) => {
|
|
|
31
35
|
const items = useArrayItemSchema();
|
|
32
36
|
return /* @__PURE__ */ jsxs(ArrayBase, {
|
|
33
37
|
...props,
|
|
34
|
-
autoSave
|
|
38
|
+
autoSave,
|
|
35
39
|
transformActions,
|
|
36
40
|
onAdd: handleAdd,
|
|
37
41
|
onRemove,
|
|
@@ -53,10 +57,10 @@ const ArrayDialogBase = observer((props) => {
|
|
|
53
57
|
})]
|
|
54
58
|
});
|
|
55
59
|
});
|
|
56
|
-
const
|
|
60
|
+
const ArrayItemsComponent = (rest) => {
|
|
57
61
|
return /* @__PURE__ */ jsx(ArrayComponentProvider, { children: /* @__PURE__ */ jsx(ArrayDialogBase, { ...rest }) });
|
|
58
62
|
};
|
|
59
|
-
const ArrayDialog =
|
|
63
|
+
const ArrayDialog = ArrayItemsComponent;
|
|
60
64
|
ArrayDialog.displayName = "ArrayDialog";
|
|
61
65
|
ArrayBase.mixin(ArrayDialog);
|
|
62
66
|
|
|
@@ -19,7 +19,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
19
19
|
* Renders form fields based on the array item schema
|
|
20
20
|
* RecursionField inherits component registry from parent SchemaField context (preserved through Radix Portal)
|
|
21
21
|
*/
|
|
22
|
-
const EditDialog = (0, __formily_react.observer)(({ schema, onSave, onAutoSave: _onAutoSave, onCancel, activeItemManager, autoSave
|
|
22
|
+
const EditDialog = (0, __formily_react.observer)(({ schema, onSave, onAutoSave: _onAutoSave, onCancel, activeItemManager, autoSave,...rest }) => {
|
|
23
23
|
const { arrayField, activeIndex: itemIndex, isNewItem, open, normalizedAutoSave, draftForm, basePath, validationPath, isolatedForm, isDirty, title, description, shouldShake, triggerShake, handleSave, handleCancel } = require_use_array_item_edit_state.useArrayItemEditState({
|
|
24
24
|
schema,
|
|
25
25
|
activeItemManager,
|
|
@@ -64,20 +64,28 @@ const EditDialog = (0, __formily_react.observer)(({ schema, onSave, onAutoSave:
|
|
|
64
64
|
normalizedAutoSave
|
|
65
65
|
]);
|
|
66
66
|
const { settings = {} } = require_use_form_context.useFormContext();
|
|
67
|
+
const { autoSave: _globalAutoSave,...dialogSettings } = settings.dialog || {};
|
|
68
|
+
const dialogContentProps = {
|
|
69
|
+
...dialogSettings,
|
|
70
|
+
...rest
|
|
71
|
+
};
|
|
67
72
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.Dialog, {
|
|
68
73
|
open,
|
|
69
74
|
onOpenChange: (isOpen) => {
|
|
70
75
|
if (!isOpen) validateAndClose();
|
|
71
76
|
},
|
|
72
77
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn_ui.DialogContent, {
|
|
73
|
-
...
|
|
74
|
-
|
|
75
|
-
className: (0, __pixpilot_shadcn_ui.cn)("sm:max-w-[525px]", shouldShake && "pp-shake", className),
|
|
78
|
+
...dialogContentProps,
|
|
79
|
+
className: (0, __pixpilot_shadcn_ui.cn)("sm:max-w-[525px]", shouldShake && "pp-shake", dialogContentProps.className),
|
|
76
80
|
onInteractOutside: (event) => {
|
|
81
|
+
dialogContentProps.onInteractOutside?.(event);
|
|
82
|
+
if (event.defaultPrevented) return;
|
|
77
83
|
event.preventDefault();
|
|
78
84
|
validateAndClose();
|
|
79
85
|
},
|
|
80
86
|
onEscapeKeyDown: (event) => {
|
|
87
|
+
dialogContentProps.onEscapeKeyDown?.(event);
|
|
88
|
+
if (event.defaultPrevented) return;
|
|
81
89
|
event.preventDefault();
|
|
82
90
|
validateAndClose();
|
|
83
91
|
},
|
|
@@ -14,7 +14,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
* Renders form fields based on the array item schema
|
|
15
15
|
* RecursionField inherits component registry from parent SchemaField context (preserved through Radix Portal)
|
|
16
16
|
*/
|
|
17
|
-
const EditDialog = observer(({ schema, onSave, onAutoSave: _onAutoSave, onCancel, activeItemManager, autoSave
|
|
17
|
+
const EditDialog = observer(({ schema, onSave, onAutoSave: _onAutoSave, onCancel, activeItemManager, autoSave,...rest }) => {
|
|
18
18
|
const { arrayField, activeIndex: itemIndex, isNewItem, open, normalizedAutoSave, draftForm, basePath, validationPath, isolatedForm, isDirty, title, description, shouldShake, triggerShake, handleSave, handleCancel } = useArrayItemEditState({
|
|
19
19
|
schema,
|
|
20
20
|
activeItemManager,
|
|
@@ -59,20 +59,28 @@ const EditDialog = observer(({ schema, onSave, onAutoSave: _onAutoSave, onCancel
|
|
|
59
59
|
normalizedAutoSave
|
|
60
60
|
]);
|
|
61
61
|
const { settings = {} } = useFormContext();
|
|
62
|
+
const { autoSave: _globalAutoSave,...dialogSettings } = settings.dialog || {};
|
|
63
|
+
const dialogContentProps = {
|
|
64
|
+
...dialogSettings,
|
|
65
|
+
...rest
|
|
66
|
+
};
|
|
62
67
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
63
68
|
open,
|
|
64
69
|
onOpenChange: (isOpen) => {
|
|
65
70
|
if (!isOpen) validateAndClose();
|
|
66
71
|
},
|
|
67
72
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
68
|
-
...
|
|
69
|
-
|
|
70
|
-
className: cn("sm:max-w-[525px]", shouldShake && "pp-shake", className),
|
|
73
|
+
...dialogContentProps,
|
|
74
|
+
className: cn("sm:max-w-[525px]", shouldShake && "pp-shake", dialogContentProps.className),
|
|
71
75
|
onInteractOutside: (event) => {
|
|
76
|
+
dialogContentProps.onInteractOutside?.(event);
|
|
77
|
+
if (event.defaultPrevented) return;
|
|
72
78
|
event.preventDefault();
|
|
73
79
|
validateAndClose();
|
|
74
80
|
},
|
|
75
81
|
onEscapeKeyDown: (event) => {
|
|
82
|
+
dialogContentProps.onEscapeKeyDown?.(event);
|
|
83
|
+
if (event.defaultPrevented) return;
|
|
76
84
|
event.preventDefault();
|
|
77
85
|
validateAndClose();
|
|
78
86
|
},
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_use_form_context = require('../../hooks/use-form-context.cjs');
|
|
3
|
+
require('../../hooks/index.cjs');
|
|
2
4
|
const require_array_base = require('../array-base/array-base.cjs');
|
|
3
5
|
const require_component_context = require('../array-base/component-context.cjs');
|
|
4
6
|
require('../array-base/index.cjs');
|
|
@@ -19,7 +21,9 @@ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
|
19
21
|
//#region src/components/array-popover/ArrayPopover.tsx
|
|
20
22
|
const ArrayPopoverBase = (0, __formily_react.observer)((props) => {
|
|
21
23
|
const { onAdd, onRemove, onMoveDown, onMoveUp, onEdit, autoSave: autoSaveProp, className, children, transformActions, popoverProps,...rest } = props;
|
|
22
|
-
const
|
|
24
|
+
const { settings = {} } = require_use_form_context.useFormContext();
|
|
25
|
+
const { autoSave: globalAutoSave } = settings.popover || {};
|
|
26
|
+
const autoSave = autoSaveProp ?? globalAutoSave ?? true;
|
|
23
27
|
const { activeItemManager, handleAdd, isNewItem, handleEdit, handleSaveClick, handleLiveChange, handleCancelClick } = require_use_array_editor.useArrayEditor({
|
|
24
28
|
onAdd,
|
|
25
29
|
onEdit,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useFormContext } from "../../hooks/use-form-context.js";
|
|
2
|
+
import "../../hooks/index.js";
|
|
1
3
|
import { ArrayBase } from "../array-base/array-base.js";
|
|
2
4
|
import { ArrayComponentProvider } from "../array-base/component-context.js";
|
|
3
5
|
import "../array-base/index.js";
|
|
@@ -14,7 +16,9 @@ import { Popover, PopoverTrigger, cn } from "@pixpilot/shadcn";
|
|
|
14
16
|
//#region src/components/array-popover/ArrayPopover.tsx
|
|
15
17
|
const ArrayPopoverBase = observer((props) => {
|
|
16
18
|
const { onAdd, onRemove, onMoveDown, onMoveUp, onEdit, autoSave: autoSaveProp, className, children, transformActions, popoverProps,...rest } = props;
|
|
17
|
-
const
|
|
19
|
+
const { settings = {} } = useFormContext();
|
|
20
|
+
const { autoSave: globalAutoSave } = settings.popover || {};
|
|
21
|
+
const autoSave = autoSaveProp ?? globalAutoSave ?? true;
|
|
18
22
|
const { activeItemManager, handleAdd, isNewItem, handleEdit, handleSaveClick, handleLiveChange, handleCancelClick } = useArrayEditor({
|
|
19
23
|
onAdd,
|
|
20
24
|
onEdit,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_use_form_context = require('../../hooks/use-form-context.cjs');
|
|
3
|
+
require('../../hooks/index.cjs');
|
|
2
4
|
const require_ArrayItemDraftFields = require('../array-common/ArrayItemDraftFields.cjs');
|
|
3
5
|
const require_ShakeStyles = require('../array-common/ShakeStyles.cjs');
|
|
4
6
|
const require_use_array_item_edit_state = require('../array-common/use-array-item-edit-state.cjs');
|
|
@@ -23,6 +25,12 @@ const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, o
|
|
|
23
25
|
onAutoSave,
|
|
24
26
|
autoSave
|
|
25
27
|
});
|
|
28
|
+
const { settings = {} } = require_use_form_context.useFormContext();
|
|
29
|
+
const { autoSave: _globalAutoSave,...popoverSettings } = settings.popover || {};
|
|
30
|
+
const contentProps = {
|
|
31
|
+
...popoverSettings,
|
|
32
|
+
...rest
|
|
33
|
+
};
|
|
26
34
|
const handleDiscard = react.default.useCallback(() => {
|
|
27
35
|
if (activeIndex === void 0) return;
|
|
28
36
|
if (normalizedAutoSave && isNewItem) arrayField.remove?.(activeIndex).catch(console.error);
|
|
@@ -54,10 +62,12 @@ const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, o
|
|
|
54
62
|
validationPath
|
|
55
63
|
]);
|
|
56
64
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.PopoverContent, {
|
|
57
|
-
className: shouldShake ? "relative w-96 pp-shake" : "relative w-96",
|
|
58
65
|
side: "top",
|
|
59
|
-
...
|
|
66
|
+
...contentProps,
|
|
67
|
+
className: (0, __pixpilot_shadcn.cn)(shouldShake ? "relative w-96 pp-shake" : "relative w-96", contentProps.className),
|
|
60
68
|
onInteractOutside: (event) => {
|
|
69
|
+
contentProps.onInteractOutside?.(event);
|
|
70
|
+
if (event.defaultPrevented) return;
|
|
61
71
|
if (isDirty) {
|
|
62
72
|
event.preventDefault();
|
|
63
73
|
triggerShake();
|
|
@@ -67,6 +77,8 @@ const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, o
|
|
|
67
77
|
validateAndClose();
|
|
68
78
|
},
|
|
69
79
|
onEscapeKeyDown: (event) => {
|
|
80
|
+
contentProps.onEscapeKeyDown?.(event);
|
|
81
|
+
if (event.defaultPrevented) return;
|
|
70
82
|
if (isDirty) {
|
|
71
83
|
event.preventDefault();
|
|
72
84
|
triggerShake();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useFormContext } from "../../hooks/use-form-context.js";
|
|
2
|
+
import "../../hooks/index.js";
|
|
1
3
|
import { ArrayItemDraftFields } from "../array-common/ArrayItemDraftFields.js";
|
|
2
4
|
import { ShakeStyles } from "../array-common/ShakeStyles.js";
|
|
3
5
|
import { useArrayItemEditState } from "../array-common/use-array-item-edit-state.js";
|
|
@@ -5,7 +7,7 @@ import { observer } from "@formily/react";
|
|
|
5
7
|
import React from "react";
|
|
6
8
|
import { XIcon } from "lucide-react";
|
|
7
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { Button, PopoverContent } from "@pixpilot/shadcn";
|
|
10
|
+
import { Button, PopoverContent, cn } from "@pixpilot/shadcn";
|
|
9
11
|
|
|
10
12
|
//#region src/components/array-popover/Popover.tsx
|
|
11
13
|
const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel, activeItemManager, autoSave,...rest }) => {
|
|
@@ -17,6 +19,12 @@ const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
|
17
19
|
onAutoSave,
|
|
18
20
|
autoSave
|
|
19
21
|
});
|
|
22
|
+
const { settings = {} } = useFormContext();
|
|
23
|
+
const { autoSave: _globalAutoSave,...popoverSettings } = settings.popover || {};
|
|
24
|
+
const contentProps = {
|
|
25
|
+
...popoverSettings,
|
|
26
|
+
...rest
|
|
27
|
+
};
|
|
20
28
|
const handleDiscard = React.useCallback(() => {
|
|
21
29
|
if (activeIndex === void 0) return;
|
|
22
30
|
if (normalizedAutoSave && isNewItem) arrayField.remove?.(activeIndex).catch(console.error);
|
|
@@ -48,10 +56,12 @@ const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
|
48
56
|
validationPath
|
|
49
57
|
]);
|
|
50
58
|
return /* @__PURE__ */ jsxs(PopoverContent, {
|
|
51
|
-
className: shouldShake ? "relative w-96 pp-shake" : "relative w-96",
|
|
52
59
|
side: "top",
|
|
53
|
-
...
|
|
60
|
+
...contentProps,
|
|
61
|
+
className: cn(shouldShake ? "relative w-96 pp-shake" : "relative w-96", contentProps.className),
|
|
54
62
|
onInteractOutside: (event) => {
|
|
63
|
+
contentProps.onInteractOutside?.(event);
|
|
64
|
+
if (event.defaultPrevented) return;
|
|
55
65
|
if (isDirty) {
|
|
56
66
|
event.preventDefault();
|
|
57
67
|
triggerShake();
|
|
@@ -61,6 +71,8 @@ const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
|
61
71
|
validateAndClose();
|
|
62
72
|
},
|
|
63
73
|
onEscapeKeyDown: (event) => {
|
|
74
|
+
contentProps.onEscapeKeyDown?.(event);
|
|
75
|
+
if (event.defaultPrevented) return;
|
|
64
76
|
if (isDirty) {
|
|
65
77
|
event.preventDefault();
|
|
66
78
|
triggerShake();
|
|
@@ -2,7 +2,7 @@ import { ActionItem } from "../array-base/types.cjs";
|
|
|
2
2
|
import "../array-base/index.cjs";
|
|
3
3
|
import { FormSpace } from "../../types/form.cjs";
|
|
4
4
|
import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.cjs";
|
|
5
|
-
import { DialogContentProps, FileUploadProgressCallBacks, IconProvider, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
5
|
+
import { DialogContentProps, FileUploadProgressCallBacks, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
6
6
|
|
|
7
7
|
//#region src/components/context/types.d.ts
|
|
8
8
|
interface FomFileUpload {
|
|
@@ -37,7 +37,12 @@ interface FormSettings {
|
|
|
37
37
|
actions?: ActionItem[] | false;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
dialog?: DialogContentProps
|
|
40
|
+
dialog?: DialogContentProps & {
|
|
41
|
+
autoSave?: boolean;
|
|
42
|
+
};
|
|
43
|
+
popover?: PopoverContentProps & {
|
|
44
|
+
autoSave?: boolean;
|
|
45
|
+
};
|
|
41
46
|
}
|
|
42
47
|
/**
|
|
43
48
|
* Layout configuration options for form components.
|
|
@@ -2,7 +2,7 @@ import { ActionItem } from "../array-base/types.js";
|
|
|
2
2
|
import "../array-base/index.js";
|
|
3
3
|
import { FormSpace } from "../../types/form.js";
|
|
4
4
|
import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.js";
|
|
5
|
-
import { DialogContentProps, FileUploadProgressCallBacks, IconProvider, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
5
|
+
import { DialogContentProps, FileUploadProgressCallBacks, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
6
6
|
|
|
7
7
|
//#region src/components/context/types.d.ts
|
|
8
8
|
interface FomFileUpload {
|
|
@@ -37,7 +37,12 @@ interface FormSettings {
|
|
|
37
37
|
actions?: ActionItem[] | false;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
dialog?: DialogContentProps
|
|
40
|
+
dialog?: DialogContentProps & {
|
|
41
|
+
autoSave?: boolean;
|
|
42
|
+
};
|
|
43
|
+
popover?: PopoverContentProps & {
|
|
44
|
+
autoSave?: boolean;
|
|
45
|
+
};
|
|
41
46
|
}
|
|
42
47
|
/**
|
|
43
48
|
* Layout configuration options for form components.
|