@pixpilot/formily-shadcn 0.37.1 → 0.39.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/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.ts +3 -3
- package/dist/components/IconToggle.d.ts +2 -2
- package/dist/components/Input.d.ts +3 -3
- package/dist/components/Radio.d.ts +2 -2
- package/dist/components/Row.d.ts +2 -2
- package/dist/components/Select.cjs +10 -1
- package/dist/components/Select.js +9 -1
- 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.ts +2 -2
- package/dist/components/Textarea.d.cts +2 -2
- package/dist/components/Textarea.d.ts +2 -2
- package/dist/components/array-collapse/Item.cjs +7 -3
- package/dist/components/array-collapse/Item.js +7 -3
- package/dist/components/array-common/ArrayItemHeaderRow.cjs +24 -23
- package/dist/components/array-common/ArrayItemHeaderRow.js +24 -23
- package/dist/components/array-common/ListItem.cjs +7 -3
- package/dist/components/array-common/ListItem.js +7 -3
- package/dist/components/array-common/get-hidden-item-schema.cjs +27 -0
- package/dist/components/array-common/get-hidden-item-schema.js +26 -0
- package/dist/components/array-common/index.cjs +1 -0
- package/dist/components/array-common/index.js +1 -0
- package/dist/components/array-dialog/EditDialog.cjs +0 -1
- package/dist/components/array-dialog/EditDialog.js +0 -1
- package/dist/components/array-popover/Popover.cjs +1 -1
- package/dist/components/array-popover/Popover.js +1 -1
- package/dist/components/file-upload/FileUpload.d.cts +8 -8
- package/dist/components/file-upload/FileUpload.d.ts +8 -8
- package/dist/components/file-upload/FileUploadInline.d.cts +8 -8
- package/dist/components/file-upload/FileUploadInline.d.ts +8 -8
- package/dist/components/number/NumberInput.d.cts +3 -3
- package/dist/components/number/NumberInput.d.ts +3 -3
- package/dist/components/schema-field/schema-field-basics.d.cts +255 -255
- package/dist/components/schema-field/schema-field-basics.d.ts +270 -270
- package/dist/components/schema-field/schema-field-extended.d.cts +285 -285
- package/dist/components/schema-field/schema-field-extended.d.ts +566 -566
- package/dist/components/schema-field/schema-field.d.ts +347 -347
- package/dist/components/slider/Slider.d.cts +3 -3
- package/dist/components/slider/SliderInput.d.cts +3 -3
- package/dist/components/slider/SliderSelect.d.cts +3 -3
- package/dist/utils/transform-schema.cjs +3 -0
- package/dist/utils/transform-schema.js +3 -0
- package/package.json +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 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: react6.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">> & react6.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_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_runtime3 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_runtime3.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react16 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: react16.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react16.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker$1 as IconPicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react22 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$1:
|
|
9
|
+
declare const IconToggle$1: react22.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.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 react2 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: react2.ForwardRefExoticComponent<Omit<Partial<react2.ClassAttributes<HTMLInputElement> & react2.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"> & react2.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
|
}
|
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 };
|
|
@@ -3,9 +3,18 @@ let __formily_react = require("@formily/react");
|
|
|
3
3
|
__formily_react = require_rolldown_runtime.__toESM(__formily_react);
|
|
4
4
|
let __pixpilot_shadcn_ui = require("@pixpilot/shadcn-ui");
|
|
5
5
|
__pixpilot_shadcn_ui = require_rolldown_runtime.__toESM(__pixpilot_shadcn_ui);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
6
8
|
|
|
7
9
|
//#region src/components/Select.tsx
|
|
8
|
-
const
|
|
10
|
+
const SelectComponent = ({ mapOption, options,...props }) => {
|
|
11
|
+
const transformedOptions = options?.map((option) => mapOption ? mapOption(option) : option);
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.Select, {
|
|
13
|
+
...props,
|
|
14
|
+
options: transformedOptions
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const Select = (0, __formily_react.connect)(SelectComponent, (0, __formily_react.mapProps)({ dataSource: "options" }));
|
|
9
18
|
|
|
10
19
|
//#endregion
|
|
11
20
|
exports.Select = Select;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { connect, mapProps } from "@formily/react";
|
|
2
2
|
import { Select } from "@pixpilot/shadcn-ui";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/components/Select.tsx
|
|
5
|
-
const
|
|
6
|
+
const SelectComponent = ({ mapOption, options,...props }) => {
|
|
7
|
+
const transformedOptions = options?.map((option) => mapOption ? mapOption(option) : option);
|
|
8
|
+
return /* @__PURE__ */ jsx(Select, {
|
|
9
|
+
...props,
|
|
10
|
+
options: transformedOptions
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
const Select$1 = connect(SelectComponent, mapProps({ dataSource: "options" }));
|
|
6
14
|
|
|
7
15
|
//#endregion
|
|
8
16
|
export { Select$1 as Select };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react8 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: react8.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react8.RefAttributes<HTMLDivElement>>, "ref"> & react8.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Separator };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react22 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: react22.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react22.RefAttributes<HTMLButtonElement>>, "ref"> & react22.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react11 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: react11.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react11.RefAttributes<HTMLButtonElement>>, "ref"> & react11.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react14 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/TagsInputInline.d.ts
|
|
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui0 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: react14.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.TagsInputProps> & react14.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react18 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: react18.ForwardRefExoticComponent<Omit<Partial<react18.ClassAttributes<HTMLTextAreaElement> & react18.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react18.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react18 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: react18.ForwardRefExoticComponent<Omit<Partial<react18.ClassAttributes<HTMLTextAreaElement> & react18.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react18.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -7,6 +7,7 @@ require('../array-base/index.cjs');
|
|
|
7
7
|
const require_SortableItem = require('../array-sortable/SortableItem.cjs');
|
|
8
8
|
require('../array-sortable/index.cjs');
|
|
9
9
|
const require_ArrayItemHeaderRow = require('../array-common/ArrayItemHeaderRow.cjs');
|
|
10
|
+
const require_get_hidden_item_schema = require('../array-common/get-hidden-item-schema.cjs');
|
|
10
11
|
const require_ItemWrapper = require('../array-common/ItemWrapper.cjs');
|
|
11
12
|
const require_use_array_item_schema = require('../array-common/use-array-item-schema.cjs');
|
|
12
13
|
require('../array-common/index.cjs');
|
|
@@ -27,6 +28,9 @@ const ArrayCollapseItem = react.default.memo((props) => {
|
|
|
27
28
|
const field = (0, __formily_react.useField)();
|
|
28
29
|
const schema = (0, __formily_react.useFieldSchema)();
|
|
29
30
|
const items = require_use_array_item_schema.useArrayItemSchema();
|
|
31
|
+
const hiddenItemSchema = react.default.useMemo(() => {
|
|
32
|
+
return require_get_hidden_item_schema.getHiddenItemSchema(items);
|
|
33
|
+
}, [items]);
|
|
30
34
|
const itemWrapperProps = require_get_x_component_props.getXComponentProps(items);
|
|
31
35
|
react.default.useEffect(() => {
|
|
32
36
|
if (isNewItem(index)) formCollapse.addActiveKey(itemId);
|
|
@@ -41,13 +45,13 @@ const ArrayCollapseItem = react.default.memo((props) => {
|
|
|
41
45
|
record: () => field.value?.[index],
|
|
42
46
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_SortableItem.SortableItem, {
|
|
43
47
|
id: itemKey,
|
|
44
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
+
children: [hiddenItemSchema ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
45
49
|
style: { display: "none" },
|
|
46
50
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__formily_react.RecursionField, {
|
|
47
|
-
schema:
|
|
51
|
+
schema: hiddenItemSchema,
|
|
48
52
|
name: index
|
|
49
53
|
})
|
|
50
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_ItemWrapper.ItemWrapper, {
|
|
54
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_ItemWrapper.ItemWrapper, {
|
|
51
55
|
...itemWrapperProps,
|
|
52
56
|
index,
|
|
53
57
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ArrayItemHeaderRow.ArrayItemHeaderRow, {
|
|
@@ -6,6 +6,7 @@ import "../array-base/index.js";
|
|
|
6
6
|
import { SortableItem } from "../array-sortable/SortableItem.js";
|
|
7
7
|
import "../array-sortable/index.js";
|
|
8
8
|
import { ArrayItemHeaderRow } from "../array-common/ArrayItemHeaderRow.js";
|
|
9
|
+
import { getHiddenItemSchema } from "../array-common/get-hidden-item-schema.js";
|
|
9
10
|
import { ItemWrapper } from "../array-common/ItemWrapper.js";
|
|
10
11
|
import { useArrayItemSchema } from "../array-common/use-array-item-schema.js";
|
|
11
12
|
import "../array-common/index.js";
|
|
@@ -21,6 +22,9 @@ const ArrayCollapseItem = React.memo((props) => {
|
|
|
21
22
|
const field = useField();
|
|
22
23
|
const schema = useFieldSchema();
|
|
23
24
|
const items = useArrayItemSchema();
|
|
25
|
+
const hiddenItemSchema = React.useMemo(() => {
|
|
26
|
+
return getHiddenItemSchema(items);
|
|
27
|
+
}, [items]);
|
|
24
28
|
const itemWrapperProps = getXComponentProps(items);
|
|
25
29
|
React.useEffect(() => {
|
|
26
30
|
if (isNewItem(index)) formCollapse.addActiveKey(itemId);
|
|
@@ -35,13 +39,13 @@ const ArrayCollapseItem = React.memo((props) => {
|
|
|
35
39
|
record: () => field.value?.[index],
|
|
36
40
|
children: /* @__PURE__ */ jsxs(SortableItem, {
|
|
37
41
|
id: itemKey,
|
|
38
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
42
|
+
children: [hiddenItemSchema ? /* @__PURE__ */ jsx("div", {
|
|
39
43
|
style: { display: "none" },
|
|
40
44
|
children: /* @__PURE__ */ jsx(RecursionField, {
|
|
41
|
-
schema:
|
|
45
|
+
schema: hiddenItemSchema,
|
|
42
46
|
name: index
|
|
43
47
|
})
|
|
44
|
-
}), /* @__PURE__ */ jsxs(ItemWrapper, {
|
|
48
|
+
}) : null, /* @__PURE__ */ jsxs(ItemWrapper, {
|
|
45
49
|
...itemWrapperProps,
|
|
46
50
|
index,
|
|
47
51
|
children: [/* @__PURE__ */ jsx(ArrayItemHeaderRow, {
|
|
@@ -72,31 +72,32 @@ const ArrayItemHeaderRow = react.default.memo(({ schema, index, className, leadi
|
|
|
72
72
|
}, i)) });
|
|
73
73
|
const arraySortable = (array?.props)?.sortable;
|
|
74
74
|
const formSortable = formConfig.array?.sortable;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
children: labelNode
|
|
84
|
-
})
|
|
85
|
-
] });
|
|
75
|
+
const dragHandleNode = arraySortable !== false && formSortable !== false ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_DragHandle.DragHandle, {
|
|
76
|
+
className: "-ml-2",
|
|
77
|
+
disabled: array?.field?.pattern !== "editable"
|
|
78
|
+
}) : null;
|
|
79
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [leading, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
80
|
+
className: "min-w-0 flex-1",
|
|
81
|
+
children: labelNode
|
|
82
|
+
})] });
|
|
86
83
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
87
84
|
className: (0, __pixpilot_shadcn_ui.cn)("flex items-center gap-2", className),
|
|
88
|
-
children: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
85
|
+
children: [
|
|
86
|
+
dragHandleNode,
|
|
87
|
+
buttonProps ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
88
|
+
...buttonProps,
|
|
89
|
+
type: buttonProps.type ?? "button",
|
|
90
|
+
className: (0, __pixpilot_shadcn_ui.cn)("flex flex-1 min-w-0 items-center gap-2", slots?.content?.className, buttonProps.className),
|
|
91
|
+
children: content
|
|
92
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
93
|
+
className: (0, __pixpilot_shadcn_ui.cn)("flex flex-1 min-w-0 items-center gap-2", slots?.content?.className),
|
|
94
|
+
children: content
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
97
|
+
className: (0, __pixpilot_shadcn_ui.cn)("flex items-center gap-1 shrink-0"),
|
|
98
|
+
children: operationsNode
|
|
99
|
+
})
|
|
100
|
+
]
|
|
100
101
|
});
|
|
101
102
|
});
|
|
102
103
|
ArrayItemHeaderRow.displayName = "ArrayItemHeaderRow";
|
|
@@ -67,31 +67,32 @@ const ArrayItemHeaderRow = React.memo(({ schema, index, className, leading, labe
|
|
|
67
67
|
}, i)) });
|
|
68
68
|
const arraySortable = (array?.props)?.sortable;
|
|
69
69
|
const formSortable = formConfig.array?.sortable;
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
children: labelNode
|
|
79
|
-
})
|
|
80
|
-
] });
|
|
70
|
+
const dragHandleNode = arraySortable !== false && formSortable !== false ? /* @__PURE__ */ jsx(DragHandle, {
|
|
71
|
+
className: "-ml-2",
|
|
72
|
+
disabled: array?.field?.pattern !== "editable"
|
|
73
|
+
}) : null;
|
|
74
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [leading, /* @__PURE__ */ jsx("div", {
|
|
75
|
+
className: "min-w-0 flex-1",
|
|
76
|
+
children: labelNode
|
|
77
|
+
})] });
|
|
81
78
|
return /* @__PURE__ */ jsxs("div", {
|
|
82
79
|
className: cn("flex items-center gap-2", className),
|
|
83
|
-
children: [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
children: [
|
|
81
|
+
dragHandleNode,
|
|
82
|
+
buttonProps ? /* @__PURE__ */ jsx("button", {
|
|
83
|
+
...buttonProps,
|
|
84
|
+
type: buttonProps.type ?? "button",
|
|
85
|
+
className: cn("flex flex-1 min-w-0 items-center gap-2", slots?.content?.className, buttonProps.className),
|
|
86
|
+
children: content
|
|
87
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: cn("flex flex-1 min-w-0 items-center gap-2", slots?.content?.className),
|
|
89
|
+
children: content
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx("div", {
|
|
92
|
+
className: cn("flex items-center gap-1 shrink-0"),
|
|
93
|
+
children: operationsNode
|
|
94
|
+
})
|
|
95
|
+
]
|
|
95
96
|
});
|
|
96
97
|
});
|
|
97
98
|
ArrayItemHeaderRow.displayName = "ArrayItemHeaderRow";
|
|
@@ -4,6 +4,7 @@ require('../array-base/index.cjs');
|
|
|
4
4
|
const require_SortableItem = require('../array-sortable/SortableItem.cjs');
|
|
5
5
|
require('../array-sortable/index.cjs');
|
|
6
6
|
const require_ArrayItemHeaderRow = require('./ArrayItemHeaderRow.cjs');
|
|
7
|
+
const require_get_hidden_item_schema = require('./get-hidden-item-schema.cjs');
|
|
7
8
|
const require_ItemWrapper = require('./ItemWrapper.cjs');
|
|
8
9
|
let __formily_react = require("@formily/react");
|
|
9
10
|
__formily_react = require_rolldown_runtime.__toESM(__formily_react);
|
|
@@ -21,19 +22,22 @@ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
|
21
22
|
*/
|
|
22
23
|
const ListItem = react.default.memo(({ itemKey, index, record, isNew }) => {
|
|
23
24
|
const schema = (0, __formily_react.useFieldSchema)();
|
|
25
|
+
const hiddenItemSchema = react.default.useMemo(() => {
|
|
26
|
+
return require_get_hidden_item_schema.getHiddenItemSchema(schema.items);
|
|
27
|
+
}, [schema.items]);
|
|
24
28
|
const isNewItem = isNew;
|
|
25
29
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_array_base.ArrayBase.Item, {
|
|
26
30
|
index,
|
|
27
31
|
record,
|
|
28
32
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_SortableItem.SortableItem, {
|
|
29
33
|
id: itemKey,
|
|
30
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
34
|
+
children: [hiddenItemSchema ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
31
35
|
style: { display: "none" },
|
|
32
36
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__formily_react.RecursionField, {
|
|
33
|
-
schema:
|
|
37
|
+
schema: hiddenItemSchema,
|
|
34
38
|
name: index
|
|
35
39
|
})
|
|
36
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ItemWrapper.ItemWrapper, {
|
|
40
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ItemWrapper.ItemWrapper, {
|
|
37
41
|
className: (0, __pixpilot_shadcn.cn)("px-3 pl-4 py-2", isNewItem && "hidden"),
|
|
38
42
|
index,
|
|
39
43
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ArrayItemHeaderRow.ArrayItemHeaderRow, {
|
|
@@ -3,6 +3,7 @@ import "../array-base/index.js";
|
|
|
3
3
|
import { SortableItem } from "../array-sortable/SortableItem.js";
|
|
4
4
|
import "../array-sortable/index.js";
|
|
5
5
|
import { ArrayItemHeaderRow } from "./ArrayItemHeaderRow.js";
|
|
6
|
+
import { getHiddenItemSchema } from "./get-hidden-item-schema.js";
|
|
6
7
|
import { ItemWrapper } from "./ItemWrapper.js";
|
|
7
8
|
import { RecursionField, useFieldSchema } from "@formily/react";
|
|
8
9
|
import React from "react";
|
|
@@ -16,19 +17,22 @@ import { cn } from "@pixpilot/shadcn";
|
|
|
16
17
|
*/
|
|
17
18
|
const ListItem = React.memo(({ itemKey, index, record, isNew }) => {
|
|
18
19
|
const schema = useFieldSchema();
|
|
20
|
+
const hiddenItemSchema = React.useMemo(() => {
|
|
21
|
+
return getHiddenItemSchema(schema.items);
|
|
22
|
+
}, [schema.items]);
|
|
19
23
|
const isNewItem = isNew;
|
|
20
24
|
return /* @__PURE__ */ jsx(ArrayBase.Item, {
|
|
21
25
|
index,
|
|
22
26
|
record,
|
|
23
27
|
children: /* @__PURE__ */ jsxs(SortableItem, {
|
|
24
28
|
id: itemKey,
|
|
25
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
29
|
+
children: [hiddenItemSchema ? /* @__PURE__ */ jsx("div", {
|
|
26
30
|
style: { display: "none" },
|
|
27
31
|
children: /* @__PURE__ */ jsx(RecursionField, {
|
|
28
|
-
schema:
|
|
32
|
+
schema: hiddenItemSchema,
|
|
29
33
|
name: index
|
|
30
34
|
})
|
|
31
|
-
}), /* @__PURE__ */ jsx(ItemWrapper, {
|
|
35
|
+
}) : null, /* @__PURE__ */ jsx(ItemWrapper, {
|
|
32
36
|
className: cn("px-3 pl-4 py-2", isNewItem && "hidden"),
|
|
33
37
|
index,
|
|
34
38
|
children: /* @__PURE__ */ jsx(ArrayItemHeaderRow, {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/array-common/get-hidden-item-schema.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates a "shallow" version of an array item schema for hidden RecursionField rendering.
|
|
5
|
+
*
|
|
6
|
+
* This prevents mounting all nested field components (like Input) when the array item UI
|
|
7
|
+
* is closed/collapsed, while still creating the array item field instance for x-reactions
|
|
8
|
+
* (e.g., dynamic titles) to work.
|
|
9
|
+
*
|
|
10
|
+
* Used in array components (ArrayDialog, ArrayCollapse) to avoid unnecessary component
|
|
11
|
+
* mounting in list/collapsed states.
|
|
12
|
+
*/
|
|
13
|
+
function getHiddenItemSchema(itemSchema) {
|
|
14
|
+
if (itemSchema == null) return null;
|
|
15
|
+
const jsonSchema = typeof itemSchema.toJSON === "function" ? itemSchema.toJSON() : itemSchema;
|
|
16
|
+
if (jsonSchema == null) return null;
|
|
17
|
+
if (typeof jsonSchema !== "object") return jsonSchema;
|
|
18
|
+
const objectSchema = jsonSchema;
|
|
19
|
+
if (objectSchema.type === "object" || objectSchema.properties != null) return {
|
|
20
|
+
...objectSchema,
|
|
21
|
+
properties: {}
|
|
22
|
+
};
|
|
23
|
+
return objectSchema;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.getHiddenItemSchema = getHiddenItemSchema;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/components/array-common/get-hidden-item-schema.ts
|
|
2
|
+
/**
|
|
3
|
+
* Creates a "shallow" version of an array item schema for hidden RecursionField rendering.
|
|
4
|
+
*
|
|
5
|
+
* This prevents mounting all nested field components (like Input) when the array item UI
|
|
6
|
+
* is closed/collapsed, while still creating the array item field instance for x-reactions
|
|
7
|
+
* (e.g., dynamic titles) to work.
|
|
8
|
+
*
|
|
9
|
+
* Used in array components (ArrayDialog, ArrayCollapse) to avoid unnecessary component
|
|
10
|
+
* mounting in list/collapsed states.
|
|
11
|
+
*/
|
|
12
|
+
function getHiddenItemSchema(itemSchema) {
|
|
13
|
+
if (itemSchema == null) return null;
|
|
14
|
+
const jsonSchema = typeof itemSchema.toJSON === "function" ? itemSchema.toJSON() : itemSchema;
|
|
15
|
+
if (jsonSchema == null) return null;
|
|
16
|
+
if (typeof jsonSchema !== "object") return jsonSchema;
|
|
17
|
+
const objectSchema = jsonSchema;
|
|
18
|
+
if (objectSchema.type === "object" || objectSchema.properties != null) return {
|
|
19
|
+
...objectSchema,
|
|
20
|
+
properties: {}
|
|
21
|
+
};
|
|
22
|
+
return objectSchema;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { getHiddenItemSchema };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_ArrayItemDraftFields = require('./ArrayItemDraftFields.cjs');
|
|
2
2
|
const require_ArrayItemHeaderRow = require('./ArrayItemHeaderRow.cjs');
|
|
3
|
+
const require_get_hidden_item_schema = require('./get-hidden-item-schema.cjs');
|
|
3
4
|
const require_ItemWrapper = require('./ItemWrapper.cjs');
|
|
4
5
|
const require_ListItem = require('./ListItem.cjs');
|
|
5
6
|
const require_use_array_data_source = require('./use-array-data-source.cjs');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ArrayItemDraftFields } from "./ArrayItemDraftFields.js";
|
|
2
2
|
import { ArrayItemHeaderRow } from "./ArrayItemHeaderRow.js";
|
|
3
|
+
import { getHiddenItemSchema } from "./get-hidden-item-schema.js";
|
|
3
4
|
import { ItemWrapper } from "./ItemWrapper.js";
|
|
4
5
|
import { ListItem } from "./ListItem.js";
|
|
5
6
|
import { useArrayDataSource } from "./use-array-data-source.js";
|
|
@@ -54,7 +54,6 @@ const EditDialog = (0, __formily_react.observer)(({ schema, onSave, onAutoSave,
|
|
|
54
54
|
autoSave,
|
|
55
55
|
itemIndex
|
|
56
56
|
});
|
|
57
|
-
if (!open) return null;
|
|
58
57
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.Dialog, {
|
|
59
58
|
open,
|
|
60
59
|
onOpenChange: (isOpen) => {
|
|
@@ -122,7 +122,7 @@ const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, o
|
|
|
122
122
|
children: description
|
|
123
123
|
})]
|
|
124
124
|
}),
|
|
125
|
-
activeIndex != null &&
|
|
125
|
+
activeIndex != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ArrayItemDraftFields.ArrayItemDraftFields, {
|
|
126
126
|
schema,
|
|
127
127
|
form: draftForm,
|
|
128
128
|
className: "space-y-4"
|
|
@@ -117,7 +117,7 @@ const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
|
117
117
|
children: description
|
|
118
118
|
})]
|
|
119
119
|
}),
|
|
120
|
-
activeIndex != null &&
|
|
120
|
+
activeIndex != null && /* @__PURE__ */ jsx(ArrayItemDraftFields, {
|
|
121
121
|
schema,
|
|
122
122
|
form: draftForm,
|
|
123
123
|
className: "space-y-4"
|