@pixpilot/formily-shadcn 1.4.5 → 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.cts +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 +3 -3
- 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.cts +3 -3
- package/dist/components/ToggleButton.d.ts +3 -3
- package/dist/components/array-common/ArrayItemDraftFields.cjs +37 -25
- package/dist/components/array-common/ArrayItemDraftFields.js +37 -25
- package/dist/components/array-common/ArrayItemsList.cjs +3 -2
- package/dist/components/array-common/ArrayItemsList.js +3 -2
- package/dist/components/array-common/ItemWrapper.cjs +1 -0
- package/dist/components/array-common/ItemWrapper.js +1 -0
- package/dist/components/array-common/ListItem.cjs +21 -4
- package/dist/components/array-common/ListItem.js +23 -6
- package/dist/components/array-common/use-array-item-draft-form.cjs +31 -15
- package/dist/components/array-common/use-array-item-draft-form.js +31 -15
- package/dist/components/array-common/use-array-item-edit-state.cjs +5 -14
- package/dist/components/array-common/use-array-item-edit-state.js +5 -13
- 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 +67 -9
- package/dist/components/array-dialog/EditDialog.js +67 -9
- package/dist/components/array-popover/ArrayPopover.cjs +34 -17
- package/dist/components/array-popover/ArrayPopover.js +35 -18
- package/dist/components/array-popover/Popover.cjs +100 -88
- package/dist/components/array-popover/Popover.js +100 -88
- package/dist/components/context/types.d.cts +7 -2
- package/dist/components/context/types.d.ts +7 -2
- package/dist/components/slider/Slider.d.ts +3 -3
- package/dist/components/slider/SliderInput.d.ts +3 -3
- package/package.json +4 -4
|
@@ -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";
|
|
@@ -9,12 +11,14 @@ import { ArrayItemsEditPopover } from "./Popover.js";
|
|
|
9
11
|
import { observer } from "@formily/react";
|
|
10
12
|
import React from "react";
|
|
11
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { cn } from "@pixpilot/shadcn";
|
|
14
|
+
import { Popover, PopoverTrigger, cn } from "@pixpilot/shadcn";
|
|
13
15
|
|
|
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,
|
|
@@ -30,22 +34,35 @@ const ArrayPopoverBase = observer((props) => {
|
|
|
30
34
|
onMoveUp,
|
|
31
35
|
onMoveDown,
|
|
32
36
|
onEdit: handleEdit,
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
children:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
children: /* @__PURE__ */ jsx(Popover, {
|
|
38
|
+
open: activeItemManager.activeItem !== void 0,
|
|
39
|
+
modal: true,
|
|
40
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
...rest,
|
|
42
|
+
className: cn("space-y-2", className),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(ArrayItemsList, {
|
|
45
|
+
isNewItem,
|
|
46
|
+
activeIndex: activeItemManager.activeItem
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "pt-2",
|
|
50
|
+
children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
51
|
+
asChild: true,
|
|
52
|
+
children: /* @__PURE__ */ jsx(ArrayBase.Addition, {})
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ jsx(ArrayItemsEditPopover, {
|
|
56
|
+
activeItemManager,
|
|
57
|
+
onCancel: handleCancelClick,
|
|
58
|
+
onAutoSave: handleLiveChange,
|
|
59
|
+
autoSave,
|
|
60
|
+
schema,
|
|
61
|
+
onSave: handleSaveClick,
|
|
62
|
+
...popoverProps
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
})
|
|
49
66
|
})
|
|
50
67
|
});
|
|
51
68
|
});
|
|
@@ -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');
|
|
@@ -6,16 +8,16 @@ let __formily_react = require("@formily/react");
|
|
|
6
8
|
__formily_react = require_rolldown_runtime.__toESM(__formily_react);
|
|
7
9
|
let react = require("react");
|
|
8
10
|
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let lucide_react = require("lucide-react");
|
|
12
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
13
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
14
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
11
15
|
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
12
16
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
13
|
-
let react_dom = require("react-dom");
|
|
14
|
-
react_dom = require_rolldown_runtime.__toESM(react_dom);
|
|
15
17
|
|
|
16
18
|
//#region src/components/array-popover/Popover.tsx
|
|
17
|
-
const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, onAutoSave, onCancel,
|
|
18
|
-
const { arrayField, activeIndex, isNewItem,
|
|
19
|
+
const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, onAutoSave, onCancel, activeItemManager, autoSave,...rest }) => {
|
|
20
|
+
const { arrayField, activeIndex, isNewItem, normalizedAutoSave, draftForm, basePath, validationPath, isolatedForm, isDirty, title, description, shouldShake, triggerShake, handleSave, handleCancel } = require_use_array_item_edit_state.useArrayItemEditState({
|
|
19
21
|
schema,
|
|
20
22
|
activeItemManager,
|
|
21
23
|
onSave,
|
|
@@ -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);
|
|
@@ -40,7 +48,7 @@ const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, o
|
|
|
40
48
|
triggerShake();
|
|
41
49
|
return;
|
|
42
50
|
}
|
|
43
|
-
Promise.resolve(draftForm.validate()).then(() => {
|
|
51
|
+
Promise.resolve(draftForm.validate(validationPath)).then(() => {
|
|
44
52
|
handleCancel();
|
|
45
53
|
}).catch(() => {
|
|
46
54
|
triggerShake();
|
|
@@ -50,93 +58,97 @@ const ArrayItemsEditPopover = (0, __formily_react.observer)(({ schema, onSave, o
|
|
|
50
58
|
draftForm,
|
|
51
59
|
handleCancel,
|
|
52
60
|
isDirty,
|
|
53
|
-
triggerShake
|
|
61
|
+
triggerShake,
|
|
62
|
+
validationPath
|
|
54
63
|
]);
|
|
55
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.PopoverContent, {
|
|
65
|
+
side: "top",
|
|
66
|
+
...contentProps,
|
|
67
|
+
className: (0, __pixpilot_shadcn.cn)(shouldShake ? "relative w-96 pp-shake" : "relative w-96", contentProps.className),
|
|
68
|
+
onInteractOutside: (event) => {
|
|
69
|
+
contentProps.onInteractOutside?.(event);
|
|
70
|
+
if (event.defaultPrevented) return;
|
|
71
|
+
if (isDirty) {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
triggerShake();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
event.preventDefault();
|
|
59
77
|
validateAndClose();
|
|
60
|
-
},
|
|
61
|
-
|
|
78
|
+
},
|
|
79
|
+
onEscapeKeyDown: (event) => {
|
|
80
|
+
contentProps.onEscapeKeyDown?.(event);
|
|
81
|
+
if (event.defaultPrevented) return;
|
|
82
|
+
if (isDirty) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
triggerShake();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
validateAndClose();
|
|
89
|
+
},
|
|
62
90
|
children: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
91
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ShakeStyles.ShakeStyles, {}),
|
|
92
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
93
|
+
type: "button",
|
|
94
|
+
variant: "ghost",
|
|
95
|
+
size: "icon",
|
|
96
|
+
className: "absolute right-2 top-2 z-10 size-8",
|
|
97
|
+
"aria-label": "Close",
|
|
98
|
+
onClick: validateAndClose,
|
|
99
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XIcon, { className: "size-4" })
|
|
66
100
|
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
size: "sm",
|
|
119
|
-
onClick: handleSave,
|
|
120
|
-
children: "Save"
|
|
121
|
-
})]
|
|
122
|
-
}),
|
|
123
|
-
normalizedAutoSave && isNewItem && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
124
|
-
className: "flex justify-end gap-2",
|
|
125
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
126
|
-
type: "button",
|
|
127
|
-
variant: "outline",
|
|
128
|
-
size: "sm",
|
|
129
|
-
onClick: handleDiscard,
|
|
130
|
-
children: "Discard"
|
|
131
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
132
|
-
type: "button",
|
|
133
|
-
size: "sm",
|
|
134
|
-
onClick: validateAndClose,
|
|
135
|
-
children: "Done"
|
|
136
|
-
})]
|
|
137
|
-
})
|
|
138
|
-
]
|
|
139
|
-
})]
|
|
101
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
102
|
+
className: "space-y-4",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105
|
+
className: "space-y-2",
|
|
106
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
107
|
+
className: "font-medium leading-none",
|
|
108
|
+
children: title
|
|
109
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
110
|
+
className: "text-muted-foreground text-sm",
|
|
111
|
+
children: description
|
|
112
|
+
})]
|
|
113
|
+
}),
|
|
114
|
+
activeIndex != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ArrayItemDraftFields.ArrayItemDraftFields, {
|
|
115
|
+
schema,
|
|
116
|
+
form: draftForm,
|
|
117
|
+
basePath,
|
|
118
|
+
isolated: isolatedForm,
|
|
119
|
+
className: "space-y-4"
|
|
120
|
+
}),
|
|
121
|
+
!normalizedAutoSave && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
122
|
+
className: "flex justify-end gap-2",
|
|
123
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
124
|
+
type: "button",
|
|
125
|
+
variant: "outline",
|
|
126
|
+
size: "sm",
|
|
127
|
+
onClick: handleCancel,
|
|
128
|
+
children: "Cancel"
|
|
129
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
130
|
+
type: "button",
|
|
131
|
+
size: "sm",
|
|
132
|
+
onClick: handleSave,
|
|
133
|
+
children: "Save"
|
|
134
|
+
})]
|
|
135
|
+
}),
|
|
136
|
+
normalizedAutoSave && isNewItem && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
137
|
+
className: "flex justify-end gap-2",
|
|
138
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
139
|
+
type: "button",
|
|
140
|
+
variant: "outline",
|
|
141
|
+
size: "sm",
|
|
142
|
+
onClick: handleDiscard,
|
|
143
|
+
children: "Discard"
|
|
144
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
145
|
+
type: "button",
|
|
146
|
+
size: "sm",
|
|
147
|
+
onClick: validateAndClose,
|
|
148
|
+
children: "Done"
|
|
149
|
+
})]
|
|
150
|
+
})
|
|
151
|
+
]
|
|
140
152
|
})
|
|
141
153
|
]
|
|
142
154
|
});
|
|
@@ -1,15 +1,17 @@
|
|
|
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";
|
|
4
6
|
import { observer } from "@formily/react";
|
|
5
7
|
import React from "react";
|
|
8
|
+
import { XIcon } from "lucide-react";
|
|
6
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Button,
|
|
8
|
-
import { createPortal } from "react-dom";
|
|
10
|
+
import { Button, PopoverContent, cn } from "@pixpilot/shadcn";
|
|
9
11
|
|
|
10
12
|
//#region src/components/array-popover/Popover.tsx
|
|
11
|
-
const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
12
|
-
const { arrayField, activeIndex, isNewItem,
|
|
13
|
+
const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel, activeItemManager, autoSave,...rest }) => {
|
|
14
|
+
const { arrayField, activeIndex, isNewItem, normalizedAutoSave, draftForm, basePath, validationPath, isolatedForm, isDirty, title, description, shouldShake, triggerShake, handleSave, handleCancel } = useArrayItemEditState({
|
|
13
15
|
schema,
|
|
14
16
|
activeItemManager,
|
|
15
17
|
onSave,
|
|
@@ -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);
|
|
@@ -34,7 +42,7 @@ const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
|
34
42
|
triggerShake();
|
|
35
43
|
return;
|
|
36
44
|
}
|
|
37
|
-
Promise.resolve(draftForm.validate()).then(() => {
|
|
45
|
+
Promise.resolve(draftForm.validate(validationPath)).then(() => {
|
|
38
46
|
handleCancel();
|
|
39
47
|
}).catch(() => {
|
|
40
48
|
triggerShake();
|
|
@@ -44,93 +52,97 @@ const ArrayItemsEditPopover = observer(({ schema, onSave, onAutoSave, onCancel,
|
|
|
44
52
|
draftForm,
|
|
45
53
|
handleCancel,
|
|
46
54
|
isDirty,
|
|
47
|
-
triggerShake
|
|
55
|
+
triggerShake,
|
|
56
|
+
validationPath
|
|
48
57
|
]);
|
|
49
|
-
return /* @__PURE__ */ jsxs(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
return /* @__PURE__ */ jsxs(PopoverContent, {
|
|
59
|
+
side: "top",
|
|
60
|
+
...contentProps,
|
|
61
|
+
className: cn(shouldShake ? "relative w-96 pp-shake" : "relative w-96", contentProps.className),
|
|
62
|
+
onInteractOutside: (event) => {
|
|
63
|
+
contentProps.onInteractOutside?.(event);
|
|
64
|
+
if (event.defaultPrevented) return;
|
|
65
|
+
if (isDirty) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
triggerShake();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
event.preventDefault();
|
|
53
71
|
validateAndClose();
|
|
54
|
-
},
|
|
55
|
-
|
|
72
|
+
},
|
|
73
|
+
onEscapeKeyDown: (event) => {
|
|
74
|
+
contentProps.onEscapeKeyDown?.(event);
|
|
75
|
+
if (event.defaultPrevented) return;
|
|
76
|
+
if (isDirty) {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
triggerShake();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
validateAndClose();
|
|
83
|
+
},
|
|
56
84
|
children: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
85
|
+
/* @__PURE__ */ jsx(ShakeStyles, {}),
|
|
86
|
+
/* @__PURE__ */ jsx(Button, {
|
|
87
|
+
type: "button",
|
|
88
|
+
variant: "ghost",
|
|
89
|
+
size: "icon",
|
|
90
|
+
className: "absolute right-2 top-2 z-10 size-8",
|
|
91
|
+
"aria-label": "Close",
|
|
92
|
+
onClick: validateAndClose,
|
|
93
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-4" })
|
|
60
94
|
}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
size: "sm",
|
|
113
|
-
onClick: handleSave,
|
|
114
|
-
children: "Save"
|
|
115
|
-
})]
|
|
116
|
-
}),
|
|
117
|
-
normalizedAutoSave && isNewItem && /* @__PURE__ */ jsxs("div", {
|
|
118
|
-
className: "flex justify-end gap-2",
|
|
119
|
-
children: [/* @__PURE__ */ jsx(Button, {
|
|
120
|
-
type: "button",
|
|
121
|
-
variant: "outline",
|
|
122
|
-
size: "sm",
|
|
123
|
-
onClick: handleDiscard,
|
|
124
|
-
children: "Discard"
|
|
125
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
126
|
-
type: "button",
|
|
127
|
-
size: "sm",
|
|
128
|
-
onClick: validateAndClose,
|
|
129
|
-
children: "Done"
|
|
130
|
-
})]
|
|
131
|
-
})
|
|
132
|
-
]
|
|
133
|
-
})]
|
|
95
|
+
/* @__PURE__ */ jsxs("div", {
|
|
96
|
+
className: "space-y-4",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ jsxs("div", {
|
|
99
|
+
className: "space-y-2",
|
|
100
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
101
|
+
className: "font-medium leading-none",
|
|
102
|
+
children: title
|
|
103
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
104
|
+
className: "text-muted-foreground text-sm",
|
|
105
|
+
children: description
|
|
106
|
+
})]
|
|
107
|
+
}),
|
|
108
|
+
activeIndex != null && /* @__PURE__ */ jsx(ArrayItemDraftFields, {
|
|
109
|
+
schema,
|
|
110
|
+
form: draftForm,
|
|
111
|
+
basePath,
|
|
112
|
+
isolated: isolatedForm,
|
|
113
|
+
className: "space-y-4"
|
|
114
|
+
}),
|
|
115
|
+
!normalizedAutoSave && /* @__PURE__ */ jsxs("div", {
|
|
116
|
+
className: "flex justify-end gap-2",
|
|
117
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
118
|
+
type: "button",
|
|
119
|
+
variant: "outline",
|
|
120
|
+
size: "sm",
|
|
121
|
+
onClick: handleCancel,
|
|
122
|
+
children: "Cancel"
|
|
123
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
124
|
+
type: "button",
|
|
125
|
+
size: "sm",
|
|
126
|
+
onClick: handleSave,
|
|
127
|
+
children: "Save"
|
|
128
|
+
})]
|
|
129
|
+
}),
|
|
130
|
+
normalizedAutoSave && isNewItem && /* @__PURE__ */ jsxs("div", {
|
|
131
|
+
className: "flex justify-end gap-2",
|
|
132
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
133
|
+
type: "button",
|
|
134
|
+
variant: "outline",
|
|
135
|
+
size: "sm",
|
|
136
|
+
onClick: handleDiscard,
|
|
137
|
+
children: "Discard"
|
|
138
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
139
|
+
type: "button",
|
|
140
|
+
size: "sm",
|
|
141
|
+
onClick: validateAndClose,
|
|
142
|
+
children: "Done"
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
]
|
|
134
146
|
})
|
|
135
147
|
]
|
|
136
148
|
});
|
|
@@ -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.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react1920 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui520 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider/Slider.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Formily-connected Slider component
|
|
7
7
|
* Range input for selecting numeric values
|
|
8
8
|
*/
|
|
9
|
-
declare const Slider$1:
|
|
9
|
+
declare const Slider$1: react1920.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui520.SliderProps>, "ref"> & react1920.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Slider$1 as Slider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react1918 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui519 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider/SliderInput.d.ts
|
|
5
|
-
declare const SliderInput$1:
|
|
5
|
+
declare const SliderInput$1: react1918.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui519.SliderInputProps>, "ref"> & react1918.RefAttributes<unknown>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SliderInput$1 as SliderInput };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/formily-shadcn",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"description": "Formily integration for shadcn/ui components",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"react-dom": "19.2.0",
|
|
59
59
|
"tsdown": "^0.15.12",
|
|
60
60
|
"typescript": "^5.9.3",
|
|
61
|
-
"@internal/
|
|
61
|
+
"@internal/tsconfig": "0.1.0",
|
|
62
62
|
"@internal/prettier-config": "0.0.1",
|
|
63
|
+
"@internal/eslint-config": "0.3.0",
|
|
63
64
|
"@internal/tsdown-config": "0.1.0",
|
|
64
|
-
"@internal/vitest-config": "0.1.0"
|
|
65
|
-
"@internal/tsconfig": "0.1.0"
|
|
65
|
+
"@internal/vitest-config": "0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"prettier": "@internal/prettier-config",
|
|
68
68
|
"scripts": {
|