@pixpilot/formily-shadcn 1.10.6 → 1.10.7
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/Checkbox.d.ts +2 -2
- package/dist/components/DatePicker.d.ts +3 -3
- package/dist/components/Form.d.ts +2 -2
- package/dist/components/FormGrid.d.ts +2 -2
- package/dist/components/IconPicker.d.cts +3 -3
- package/dist/components/IconPicker.d.ts +3 -3
- package/dist/components/IconToggle.d.cts +2 -2
- package/dist/components/Input.d.cts +3 -3
- package/dist/components/Radio.d.ts +2 -2
- package/dist/components/Rating.d.cts +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 +2 -2
- package/dist/components/Textarea.d.ts +2 -2
- package/dist/components/ToggleButton.d.ts +2 -2
- package/dist/components/array-tags/ArrayTags.d.cts +2 -2
- package/dist/components/array-tags/ArrayTags.d.ts +2 -2
- package/dist/components/array-toggle-group/ArrayToggleGroup.d.ts +2 -2
- package/dist/components/context/types.d.cts +2 -2
- package/dist/components/context/types.d.ts +2 -2
- package/dist/components/file-upload/use-file-upload-feedback.cjs +43 -29
- package/dist/components/file-upload/use-file-upload-feedback.js +43 -29
- package/dist/components/form-item/ConnectedFormItem.d.cts +4 -4
- package/dist/components/number/NumberInput.d.cts +3 -3
- package/dist/components/schema-field/schema-field-basics.d.cts +303 -303
- package/dist/components/schema-field/schema-field-basics.d.ts +299 -299
- package/dist/components/schema-field/schema-field-extended.d.cts +501 -501
- package/dist/components/schema-field/schema-field-extended.d.ts +33 -33
- package/dist/components/schema-field/schema-field.d.cts +412 -412
- package/dist/components/schema-field/schema-field.d.ts +409 -409
- package/dist/components/slider/SliderSelect.d.cts +3 -3
- package/dist/components/slider/SliderSelect.d.ts +3 -3
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react1 from "react";
|
|
2
2
|
import * as _radix_ui_react_checkbox0 from "@radix-ui/react-checkbox";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Checkbox.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_checkbox0 from "@radix-ui/react-checkbox";
|
|
|
6
6
|
* Formily-connected Checkbox component
|
|
7
7
|
* Maps Formily field checked state to shadcn Checkbox
|
|
8
8
|
*/
|
|
9
|
-
declare const Checkbox:
|
|
9
|
+
declare const Checkbox: react1.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_checkbox0.CheckboxProps & react1.RefAttributes<HTMLButtonElement>>, "ref"> & react1.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Checkbox };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { DatePickerProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/DatePicker.d.ts
|
|
5
|
-
declare const DatePicker$1:
|
|
5
|
+
declare const DatePicker$1: react4.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> &
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react4.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { DatePicker$1 as DatePicker };
|
|
@@ -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_runtime0 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_runtime0.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_runtime1 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_runtime1.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react7 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:
|
|
11
|
+
declare const IconPicker: react7.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react7.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 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: react0.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react0.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker$1 as IconPicker };
|
|
@@ -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/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: react4.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react4.RefAttributes<HTMLButtonElement>>, "ref"> & react4.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { IconToggle };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react9 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Input.d.ts
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@ import * as react12 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: react9.ForwardRefExoticComponent<Omit<Partial<react9.ClassAttributes<HTMLInputElement> & react9.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"> & react9.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_runtime3 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_runtime3.JSX.Element;
|
|
19
19
|
declare namespace Radio {
|
|
20
20
|
var displayName: string;
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react13 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:
|
|
10
|
-
children?:
|
|
11
|
-
}> &
|
|
9
|
+
declare const Rating: react13.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.RatingProps & {
|
|
10
|
+
children?: react13.ReactNode | undefined;
|
|
11
|
+
}> & react13.RefAttributes<unknown>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { 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_runtime2 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_runtime2.JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { Row };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react19 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: react19.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react19.RefAttributes<HTMLDivElement>>, "ref"> & react19.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Separator };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react19 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: react19.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react19.RefAttributes<HTMLButtonElement>>, "ref"> & react19.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react16 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: react16.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react16.RefAttributes<HTMLButtonElement>>, "ref"> & react16.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react22 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: react22.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react22.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react26 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: react26.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react26.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react22 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: react22.ForwardRefExoticComponent<Omit<Partial<react22.ClassAttributes<HTMLTextAreaElement> & react22.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react22.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react28 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui2 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ToggleButton.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui2 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 ToggleButton$1:
|
|
9
|
+
declare const ToggleButton$1: react28.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui2.ToggleButtonProps, "ref"> & react28.RefAttributes<HTMLButtonElement>>, "ref"> & react28.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { ToggleButton$1 as ToggleButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _formily_react102 from "@formily/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { TagsInputProps } from "@pixpilot/shadcn-ui";
|
|
4
4
|
|
|
@@ -54,6 +54,6 @@ interface ArrayTagsProps extends TagsInputProps {
|
|
|
54
54
|
* };
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
declare const ArrayTags: React.MemoExoticComponent<
|
|
57
|
+
declare const ArrayTags: React.MemoExoticComponent<_formily_react102.ReactFC<ArrayTagsProps>>;
|
|
58
58
|
//#endregion
|
|
59
59
|
export { ArrayTags, ArrayTagsProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _formily_react0 from "@formily/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { TagsInputProps } from "@pixpilot/shadcn-ui";
|
|
4
4
|
|
|
@@ -54,6 +54,6 @@ interface ArrayTagsProps extends TagsInputProps {
|
|
|
54
54
|
* };
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
declare const ArrayTags: React.MemoExoticComponent<
|
|
57
|
+
declare const ArrayTags: React.MemoExoticComponent<_formily_react0.ReactFC<ArrayTagsProps>>;
|
|
58
58
|
//#endregion
|
|
59
59
|
export { ArrayTags, ArrayTagsProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _formily_react0 from "@formily/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ToggleGroupProps } from "@pixpilot/shadcn-ui";
|
|
4
4
|
|
|
@@ -60,6 +60,6 @@ interface ArrayToggleGroupProps extends Omit<ToggleGroupProps, 'value' | 'onChan
|
|
|
60
60
|
* };
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
declare const ArrayToggleGroup: React.MemoExoticComponent<
|
|
63
|
+
declare const ArrayToggleGroup: React.MemoExoticComponent<_formily_react0.ReactFC<Omit<ArrayToggleGroupProps, "ref">>>;
|
|
64
64
|
//#endregion
|
|
65
65
|
export { ArrayToggleGroup, ArrayToggleGroupProps };
|
|
@@ -2,11 +2,11 @@ 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,
|
|
5
|
+
import { DialogContentProps, FormFileUploadOptions, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
6
6
|
|
|
7
7
|
//#region src/components/context/types.d.ts
|
|
8
8
|
interface FomFileUpload {
|
|
9
|
-
onUpload?: (files: File[], options:
|
|
9
|
+
onUpload?: (files: File[], options: FormFileUploadOptions) => void;
|
|
10
10
|
maxSize?: number;
|
|
11
11
|
}
|
|
12
12
|
interface FormSettings {
|
|
@@ -2,11 +2,11 @@ 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,
|
|
5
|
+
import { DialogContentProps, FormFileUploadOptions, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
6
6
|
|
|
7
7
|
//#region src/components/context/types.d.ts
|
|
8
8
|
interface FomFileUpload {
|
|
9
|
-
onUpload?: (files: File[], options:
|
|
9
|
+
onUpload?: (files: File[], options: FormFileUploadOptions) => void;
|
|
10
10
|
maxSize?: number;
|
|
11
11
|
}
|
|
12
12
|
interface FormSettings {
|
|
@@ -19,39 +19,53 @@ function useFileUploadFeedback(props) {
|
|
|
19
19
|
if (onUpload == null) {
|
|
20
20
|
if (process.env.NODE_ENV !== "production") throw new Error("onUpload prop required for FileUploadInline. Provide handler on form or field props.");
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const handleFilesRejection = react.default.useCallback((files) => {
|
|
23
|
+
onFilesReject?.(files);
|
|
24
|
+
const maximumError = files.filter((f) => f.message.startsWith("Maximum"));
|
|
25
|
+
const withFileSizeError = files.filter((f) => f.message.startsWith("File too large"));
|
|
26
|
+
const otherErrors = files.filter((f) => !withFileSizeError.includes(f) && !maximumError.includes(f));
|
|
27
|
+
const messages = [];
|
|
28
|
+
if (maximumError.length > 0) messages.push(maximumError[0].message);
|
|
29
|
+
if (maxSize != null && withFileSizeError.length > 0) {
|
|
30
|
+
const fileList = withFileSizeError.map((f) => `${f.file.name} (${(0, pretty_bytes.default)(f.file.size)})`).join("\n");
|
|
31
|
+
messages.push(`Files exceed ${(0, pretty_bytes.default)(maxSize)} limit:\n${fileList}`);
|
|
32
|
+
}
|
|
33
|
+
if (otherErrors.length > 0) otherErrors.forEach((f) => {
|
|
34
|
+
messages.push(`${f.message}: ${f.file.name}`);
|
|
35
|
+
});
|
|
36
|
+
field.setFeedback({
|
|
37
|
+
type: "warning",
|
|
38
|
+
messages: [messages.join("\n")]
|
|
39
|
+
});
|
|
40
|
+
}, [
|
|
41
|
+
field,
|
|
24
42
|
maxSize,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
messages: [messages.join("\n")]
|
|
43
|
+
onFilesReject
|
|
44
|
+
]);
|
|
45
|
+
const handleFileValidate = react.default.useCallback((file) => {
|
|
46
|
+
field.setFeedback({
|
|
47
|
+
type: "warning",
|
|
48
|
+
messages: []
|
|
49
|
+
});
|
|
50
|
+
return onFileValidate?.(file);
|
|
51
|
+
}, [field, onFileValidate]);
|
|
52
|
+
return {
|
|
53
|
+
onUpload: react.default.useCallback(async (files, options) => {
|
|
54
|
+
if (onUploadProp) return onUploadProp(files, options);
|
|
55
|
+
return onUpload?.(files, {
|
|
56
|
+
...options,
|
|
57
|
+
component: field.componentType,
|
|
58
|
+
componentProps: { ...field.componentProps }
|
|
42
59
|
});
|
|
43
60
|
}, [
|
|
44
|
-
field,
|
|
45
|
-
|
|
46
|
-
|
|
61
|
+
field.componentProps,
|
|
62
|
+
field.componentType,
|
|
63
|
+
onUpload,
|
|
64
|
+
onUploadProp
|
|
47
65
|
]),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
messages: []
|
|
52
|
-
});
|
|
53
|
-
return onFileValidate?.(file);
|
|
54
|
-
}, [field, onFileValidate])
|
|
66
|
+
maxSize,
|
|
67
|
+
handleFilesRejection,
|
|
68
|
+
handleFileValidate
|
|
55
69
|
};
|
|
56
70
|
}
|
|
57
71
|
|
|
@@ -13,39 +13,53 @@ function useFileUploadFeedback(props) {
|
|
|
13
13
|
const onUpload = onUploadProp ?? fileUpload?.onUpload;
|
|
14
14
|
const maxSize = maxSizeProp ?? fileUpload?.maxSize;
|
|
15
15
|
if (onUpload == null) throw new Error("onUpload prop required for FileUploadInline. Provide handler on form or field props.");
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const handleFilesRejection = React.useCallback((files) => {
|
|
17
|
+
onFilesReject?.(files);
|
|
18
|
+
const maximumError = files.filter((f) => f.message.startsWith("Maximum"));
|
|
19
|
+
const withFileSizeError = files.filter((f) => f.message.startsWith("File too large"));
|
|
20
|
+
const otherErrors = files.filter((f) => !withFileSizeError.includes(f) && !maximumError.includes(f));
|
|
21
|
+
const messages = [];
|
|
22
|
+
if (maximumError.length > 0) messages.push(maximumError[0].message);
|
|
23
|
+
if (maxSize != null && withFileSizeError.length > 0) {
|
|
24
|
+
const fileList = withFileSizeError.map((f) => `${f.file.name} (${prettyBytes(f.file.size)})`).join("\n");
|
|
25
|
+
messages.push(`Files exceed ${prettyBytes(maxSize)} limit:\n${fileList}`);
|
|
26
|
+
}
|
|
27
|
+
if (otherErrors.length > 0) otherErrors.forEach((f) => {
|
|
28
|
+
messages.push(`${f.message}: ${f.file.name}`);
|
|
29
|
+
});
|
|
30
|
+
field.setFeedback({
|
|
31
|
+
type: "warning",
|
|
32
|
+
messages: [messages.join("\n")]
|
|
33
|
+
});
|
|
34
|
+
}, [
|
|
35
|
+
field,
|
|
18
36
|
maxSize,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
messages: [messages.join("\n")]
|
|
37
|
+
onFilesReject
|
|
38
|
+
]);
|
|
39
|
+
const handleFileValidate = React.useCallback((file) => {
|
|
40
|
+
field.setFeedback({
|
|
41
|
+
type: "warning",
|
|
42
|
+
messages: []
|
|
43
|
+
});
|
|
44
|
+
return onFileValidate?.(file);
|
|
45
|
+
}, [field, onFileValidate]);
|
|
46
|
+
return {
|
|
47
|
+
onUpload: React.useCallback(async (files, options) => {
|
|
48
|
+
if (onUploadProp) return onUploadProp(files, options);
|
|
49
|
+
return onUpload?.(files, {
|
|
50
|
+
...options,
|
|
51
|
+
component: field.componentType,
|
|
52
|
+
componentProps: { ...field.componentProps }
|
|
36
53
|
});
|
|
37
54
|
}, [
|
|
38
|
-
field,
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
field.componentProps,
|
|
56
|
+
field.componentType,
|
|
57
|
+
onUpload,
|
|
58
|
+
onUploadProp
|
|
41
59
|
]),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
messages: []
|
|
46
|
-
});
|
|
47
|
-
return onFileValidate?.(file);
|
|
48
|
-
}, [field, onFileValidate])
|
|
60
|
+
maxSize,
|
|
61
|
+
handleFilesRejection,
|
|
62
|
+
handleFileValidate
|
|
49
63
|
};
|
|
50
64
|
}
|
|
51
65
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FormItemProps } from "./form-item-types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react1889 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/form-item/ConnectedFormItem.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* FormItem component connected to Formily field state.
|
|
7
7
|
* Automatically maps field validation state to component props.
|
|
8
8
|
*/
|
|
9
|
-
declare const FormItem:
|
|
10
|
-
children?:
|
|
11
|
-
}>, "ref"> &
|
|
9
|
+
declare const FormItem: react1889.ForwardRefExoticComponent<Omit<Partial<FormItemProps & {
|
|
10
|
+
children?: react1889.ReactNode | undefined;
|
|
11
|
+
}>, "ref"> & react1889.RefAttributes<unknown>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { FormItem };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react33 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/number/NumberInput.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Number Input component
|
|
6
6
|
*/
|
|
7
|
-
declare const NumberInput:
|
|
7
|
+
declare const NumberInput: react33.ForwardRefExoticComponent<Omit<Partial<react33.ClassAttributes<HTMLInputElement> & react33.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
8
|
prefix?: React.ReactNode;
|
|
9
9
|
suffix?: React.ReactNode;
|
|
10
10
|
groupClassName?: string;
|
|
11
11
|
prefixClassName?: string;
|
|
12
12
|
suffixClassName?: string;
|
|
13
|
-
}>, "ref"> &
|
|
13
|
+
}>, "ref"> & react33.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { NumberInput };
|