@pixpilot/formily-shadcn 2.1.1 → 2.2.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.
Files changed (29) hide show
  1. package/dist/components/array-toggle-group/ArrayToggleGroup.d.ts +2 -2
  2. package/dist/components/column/Column.d.ts +2 -2
  3. package/dist/components/date-picker/DatePicker.d.cts +3 -3
  4. package/dist/components/date-picker/DatePicker.d.ts +3 -3
  5. package/dist/components/dialog-item/ConnectedDialogItem.d.cts +4 -4
  6. package/dist/components/dialog-item/ConnectedDialogItem.d.ts +4 -4
  7. package/dist/components/drawer-item/ConnectedDrawerItem.d.cts +4 -4
  8. package/dist/components/drawer-item/ConnectedDrawerItem.d.ts +4 -4
  9. package/dist/components/form/Form.d.cts +2 -2
  10. package/dist/components/form/Form.d.ts +2 -2
  11. package/dist/components/form/mcp.js +38 -1
  12. package/dist/components/form-grid/FormGrid.d.cts +2 -2
  13. package/dist/components/form-grid/FormGrid.d.ts +2 -2
  14. package/dist/components/popover-item/ConnectedPopoverItem.d.cts +4 -4
  15. package/dist/components/popover-item/ConnectedPopoverItem.d.ts +4 -4
  16. package/dist/components/radio/Radio.d.cts +2 -2
  17. package/dist/components/radio/Radio.d.ts +2 -2
  18. package/dist/components/rich-text-editor/mcp.js +53 -8
  19. package/dist/components/row/Row.d.cts +2 -2
  20. package/dist/components/row/Row.d.ts +2 -2
  21. package/dist/components/schema-field/schema-field-basics.d.cts +380 -380
  22. package/dist/components/schema-field/schema-field-basics.d.ts +380 -380
  23. package/dist/components/schema-field/schema-field-extended.d.cts +533 -533
  24. package/dist/components/schema-field/schema-field-extended.d.ts +534 -534
  25. package/dist/components/schema-field/schema-field.d.cts +468 -468
  26. package/dist/components/schema-field/schema-field.d.ts +467 -467
  27. package/dist/utils/transform-schema.cjs +26 -6
  28. package/dist/utils/transform-schema.js +26 -6
  29. package/package.json +6 -5
@@ -1,4 +1,4 @@
1
- import * as _formily_react0 from "@formily/react";
1
+ import * as _formily_react102 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<_formily_react0.ReactFC<Omit<ArrayToggleGroupProps, "ref">>>;
63
+ declare const ArrayToggleGroup: React.MemoExoticComponent<_formily_react102.ReactFC<Omit<ArrayToggleGroupProps, "ref">>>;
64
64
  //#endregion
65
65
  export { ArrayToggleGroup, ArrayToggleGroupProps };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/column/Column.d.ts
5
5
  interface IColumnProps {
@@ -36,6 +36,6 @@ interface IColumnProps {
36
36
  declare function Column({
37
37
  className,
38
38
  children
39
- }: IColumnProps): react_jsx_runtime0.JSX.Element;
39
+ }: IColumnProps): react_jsx_runtime3.JSX.Element;
40
40
  //#endregion
41
41
  export { Column, IColumnProps };
@@ -1,12 +1,12 @@
1
- import * as react2 from "react";
1
+ import * as react0 from "react";
2
2
  import { DatePickerProps } from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/date-picker/DatePicker.d.ts
5
5
 
6
- declare const DatePicker: react2.ForwardRefExoticComponent<Partial<{
6
+ declare const DatePicker: react0.ForwardRefExoticComponent<Partial<{
7
7
  value?: Date;
8
8
  onChange?: (date: Date | undefined) => void;
9
9
  placeholder?: string;
10
- } & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react2.RefAttributes<unknown>>;
10
+ } & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react0.RefAttributes<unknown>>;
11
11
  //#endregion
12
12
  export { DatePicker };
@@ -1,12 +1,12 @@
1
- import * as react2 from "react";
1
+ import * as react1575 from "react";
2
2
  import { DatePickerProps } from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/date-picker/DatePicker.d.ts
5
5
 
6
- declare const DatePicker$1: react2.ForwardRefExoticComponent<Partial<{
6
+ declare const DatePicker$1: react1575.ForwardRefExoticComponent<Partial<{
7
7
  value?: Date;
8
8
  onChange?: (date: Date | undefined) => void;
9
9
  placeholder?: string;
10
- } & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react2.RefAttributes<unknown>>;
10
+ } & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react1575.RefAttributes<unknown>>;
11
11
  //#endregion
12
12
  export { DatePicker$1 as DatePicker };
@@ -1,5 +1,5 @@
1
1
  import { DialogItemProps } from "./BaseDialogItem.cjs";
2
- import * as react4 from "react";
2
+ import * as react1 from "react";
3
3
 
4
4
  //#region src/components/dialog-item/ConnectedDialogItem.d.ts
5
5
 
@@ -8,8 +8,8 @@ import * as react4 from "react";
8
8
  * Maps field label, description, and validation state onto the decorator the
9
9
  * same way FormItem does.
10
10
  */
11
- declare const DialogItem: react4.ForwardRefExoticComponent<Omit<Partial<DialogItemProps & {
12
- children?: react4.ReactNode | undefined;
13
- }>, "ref"> & react4.RefAttributes<unknown>>;
11
+ declare const DialogItem: react1.ForwardRefExoticComponent<Omit<Partial<DialogItemProps & {
12
+ children?: react1.ReactNode | undefined;
13
+ }>, "ref"> & react1.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { DialogItem };
@@ -1,5 +1,5 @@
1
1
  import { DialogItemProps } from "./BaseDialogItem.js";
2
- import * as react0 from "react";
2
+ import * as react1577 from "react";
3
3
 
4
4
  //#region src/components/dialog-item/ConnectedDialogItem.d.ts
5
5
 
@@ -8,8 +8,8 @@ import * as react0 from "react";
8
8
  * Maps field label, description, and validation state onto the decorator the
9
9
  * same way FormItem does.
10
10
  */
11
- declare const DialogItem: react0.ForwardRefExoticComponent<Omit<Partial<DialogItemProps & {
12
- children?: react0.ReactNode | undefined;
13
- }>, "ref"> & react0.RefAttributes<unknown>>;
11
+ declare const DialogItem: react1577.ForwardRefExoticComponent<Omit<Partial<DialogItemProps & {
12
+ children?: react1577.ReactNode | undefined;
13
+ }>, "ref"> & react1577.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { DialogItem };
@@ -1,5 +1,5 @@
1
1
  import { DrawerItemProps } from "./BaseDrawerItem.cjs";
2
- import * as react7 from "react";
2
+ import * as react4 from "react";
3
3
 
4
4
  //#region src/components/drawer-item/ConnectedDrawerItem.d.ts
5
5
 
@@ -8,8 +8,8 @@ import * as react7 from "react";
8
8
  * Maps field label, description, and validation state onto the decorator the
9
9
  * same way FormItem does.
10
10
  */
11
- declare const DrawerItem: react7.ForwardRefExoticComponent<Omit<Partial<DrawerItemProps & {
12
- children?: react7.ReactNode | undefined;
13
- }>, "ref"> & react7.RefAttributes<unknown>>;
11
+ declare const DrawerItem: react4.ForwardRefExoticComponent<Omit<Partial<DrawerItemProps & {
12
+ children?: react4.ReactNode | undefined;
13
+ }>, "ref"> & react4.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { DrawerItem };
@@ -1,5 +1,5 @@
1
1
  import { DrawerItemProps } from "./BaseDrawerItem.js";
2
- import * as react4 from "react";
2
+ import * as react1580 from "react";
3
3
 
4
4
  //#region src/components/drawer-item/ConnectedDrawerItem.d.ts
5
5
 
@@ -8,8 +8,8 @@ import * as react4 from "react";
8
8
  * Maps field label, description, and validation state onto the decorator the
9
9
  * same way FormItem does.
10
10
  */
11
- declare const DrawerItem: react4.ForwardRefExoticComponent<Omit<Partial<DrawerItemProps & {
12
- children?: react4.ReactNode | undefined;
13
- }>, "ref"> & react4.RefAttributes<unknown>>;
11
+ declare const DrawerItem: react1580.ForwardRefExoticComponent<Omit<Partial<DrawerItemProps & {
12
+ children?: react1580.ReactNode | undefined;
13
+ }>, "ref"> & react1580.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { DrawerItem };
@@ -2,7 +2,7 @@ import { FormContextStates } from "../context/form-context.cjs";
2
2
  import "../context/index.cjs";
3
3
  import React from "react";
4
4
  import { Form } from "@formily/core";
5
- import * as react_jsx_runtime3 from "react/jsx-runtime";
5
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
 
7
7
  //#region src/components/form/Form.d.ts
8
8
  interface IFormProps extends FormContextStates {
@@ -27,6 +27,6 @@ declare function Form$1({
27
27
  onAutoSubmit,
28
28
  layout,
29
29
  settings
30
- }: IFormProps): react_jsx_runtime3.JSX.Element;
30
+ }: IFormProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
32
  export { Form$1 as Form, IFormProps };
@@ -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 react_jsx_runtime1 from "react/jsx-runtime";
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/Form.d.ts
@@ -27,6 +27,6 @@ declare function Form$1({
27
27
  onAutoSubmit,
28
28
  layout,
29
29
  settings
30
- }: IFormProps): react_jsx_runtime1.JSX.Element;
30
+ }: IFormProps): react_jsx_runtime2.JSX.Element;
31
31
  //#endregion
32
32
  export { Form$1 as Form, IFormProps };
@@ -14,11 +14,48 @@ const meta = {
14
14
  },
15
15
  layout: "Optional layout configuration passed through the Formily shadcn form context.",
16
16
  onAutoSubmit: "Called with submitted values after the underlying Formily form submit succeeds.",
17
- settings: "Optional form settings passed through the Formily shadcn form context."
17
+ settings: "Optional form-wide settings passed through the Formily shadcn form context. Each key holds default props applied to every instance of that component in the form (field-level x-component-props still override them). Notably `settings.richTextEditor` accepts the full RichTextEditorProps, so you can register TipTap `extensions` (and their toolbar buttons) once for all RichTextEditor fields. See the \"RichTextEditor extensions via form settings\" example."
18
18
  }),
19
19
  examples: [{
20
20
  title: "Basic Formily form",
21
21
  code: "<Form form={form} onSubmit={(values) => save(values)}><SchemaField schema={schema} /></Form>"
22
+ }, {
23
+ title: "RichTextEditor extensions via form settings",
24
+ code: `import { Mark, mergeAttributes } from '@tiptap/core';
25
+
26
+ // Register a custom TipTap extension (or an official package like
27
+ // @tiptap/extension-highlight) once for every RichTextEditor field in the form.
28
+ const Highlight = Mark.create({
29
+ name: 'highlight',
30
+ parseHTML() {
31
+ return [{ tag: 'mark' }];
32
+ },
33
+ renderHTML({ HTMLAttributes }) {
34
+ return ['mark', mergeAttributes(HTMLAttributes), 0];
35
+ },
36
+ });
37
+
38
+ <Form
39
+ form={form}
40
+ settings={{
41
+ richTextEditor: {
42
+ extensions: [Highlight],
43
+ toolbarItems: [
44
+ 'bold',
45
+ 'italic',
46
+ '|',
47
+ {
48
+ icon: '🖍️',
49
+ tooltip: 'Highlight',
50
+ onClick: (editor) => editor.chain().focus().toggleMark('highlight').run(),
51
+ isActive: (editor) => editor.isActive('highlight'),
52
+ },
53
+ ],
54
+ },
55
+ }}
56
+ >
57
+ <SchemaField schema={schema} />
58
+ </Form>`
22
59
  }],
23
60
  keywords: [
24
61
  "formily",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/form-grid/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): react_jsx_runtime4.JSX.Element;
10
+ }: IFormGridProps): react_jsx_runtime1.JSX.Element;
11
11
  //#endregion
12
12
  export { FormGrid, IFormGridProps };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/form-grid/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): react_jsx_runtime0.JSX.Element;
10
+ }: IFormGridProps): react_jsx_runtime1.JSX.Element;
11
11
  //#endregion
12
12
  export { FormGrid, IFormGridProps };
@@ -1,5 +1,5 @@
1
1
  import { PopoverItemProps } from "./BasePopoverItem.cjs";
2
- import * as react0 from "react";
2
+ import * as react7 from "react";
3
3
 
4
4
  //#region src/components/popover-item/ConnectedPopoverItem.d.ts
5
5
 
@@ -8,8 +8,8 @@ import * as react0 from "react";
8
8
  * Maps field label, description, and validation state onto the decorator the
9
9
  * same way FormItem does.
10
10
  */
11
- declare const PopoverItem: react0.ForwardRefExoticComponent<Omit<Partial<PopoverItemProps & {
12
- children?: react0.ReactNode | undefined;
13
- }>, "ref"> & react0.RefAttributes<unknown>>;
11
+ declare const PopoverItem: react7.ForwardRefExoticComponent<Omit<Partial<PopoverItemProps & {
12
+ children?: react7.ReactNode | undefined;
13
+ }>, "ref"> & react7.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { PopoverItem };
@@ -1,5 +1,5 @@
1
1
  import { PopoverItemProps } from "./BasePopoverItem.js";
2
- import * as react7 from "react";
2
+ import * as react0 from "react";
3
3
 
4
4
  //#region src/components/popover-item/ConnectedPopoverItem.d.ts
5
5
 
@@ -8,8 +8,8 @@ import * as react7 from "react";
8
8
  * Maps field label, description, and validation state onto the decorator the
9
9
  * same way FormItem does.
10
10
  */
11
- declare const PopoverItem: react7.ForwardRefExoticComponent<Omit<Partial<PopoverItemProps & {
12
- children?: react7.ReactNode | undefined;
13
- }>, "ref"> & react7.RefAttributes<unknown>>;
11
+ declare const PopoverItem: react0.ForwardRefExoticComponent<Omit<Partial<PopoverItemProps & {
12
+ children?: react0.ReactNode | undefined;
13
+ }>, "ref"> & react0.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { PopoverItem };
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps, FC } from "react";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
  import { RadioGroup } from "@pixpilot/shadcn";
4
4
 
5
5
  //#region src/components/radio/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): react_jsx_runtime1.JSX.Element;
18
+ declare function Radio(props: RadioProps): react_jsx_runtime2.JSX.Element;
19
19
  declare namespace Radio {
20
20
  var displayName: string;
21
21
  }
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps, FC } from "react";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
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/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): react_jsx_runtime2.JSX.Element;
18
+ declare function Radio(props: RadioProps): react_jsx_runtime0.JSX.Element;
19
19
  declare namespace Radio {
20
20
  var displayName: string;
21
21
  }
@@ -11,7 +11,7 @@ const meta = {
11
11
  editable: "Forwarded to the underlying UI component.",
12
12
  editorProps: "Forwarded to the underlying UI component.",
13
13
  immediatelyRender: "Forwarded to the underlying UI component.",
14
- extensions: "Forwarded to the underlying UI component.",
14
+ extensions: "Additional TipTap extensions forwarded to the underlying UI component, appended to the built-in ones (StarterKit, Link, TextAlign, Placeholder). Accepts any TipTap Extension, Node, or Mark. In schema forms pass them via `x-component-props.extensions`. See the \"Add a custom extension\" example.",
15
15
  slots: "Slot props for customizing internal rendered parts.",
16
16
  showToolbar: "Forwarded to the underlying UI component.",
17
17
  toolbarItems: "Forwarded to the underlying UI component.",
@@ -20,12 +20,14 @@ const meta = {
20
20
  allowLinkTarget: "Forwarded to the underlying UI component.",
21
21
  openOnClick: "Forwarded to the underlying UI component."
22
22
  }),
23
- examples: [{
24
- title: "Declarative schema field",
25
- code: `<SchemaField.String name="richTextEditor" title="RichTextEditor" x-decorator="FormItem" x-component="RichTextEditor" />`
26
- }, {
27
- title: "JSON schema for form renderer",
28
- code: `{
23
+ examples: [
24
+ {
25
+ title: "Declarative schema field",
26
+ code: `<SchemaField.String name="richTextEditor" title="RichTextEditor" x-decorator="FormItem" x-component="RichTextEditor" />`
27
+ },
28
+ {
29
+ title: "JSON schema for form renderer",
30
+ code: `{
29
31
  type: 'object',
30
32
  properties: {
31
33
  richTextEditor: {
@@ -36,7 +38,50 @@ const meta = {
36
38
  },
37
39
  },
38
40
  }`
39
- }],
41
+ },
42
+ {
43
+ title: "Add a custom extension via x-component-props",
44
+ code: `import { Mark, mergeAttributes } from '@tiptap/core';
45
+
46
+ // Any Mark.create / Node.create / Extension.create result (or an official
47
+ // package like @tiptap/extension-highlight) can be passed to \`extensions\`.
48
+ const Highlight = Mark.create({
49
+ name: 'highlight',
50
+ parseHTML() {
51
+ return [{ tag: 'mark' }];
52
+ },
53
+ renderHTML({ HTMLAttributes }) {
54
+ return ['mark', mergeAttributes(HTMLAttributes), 0];
55
+ },
56
+ });
57
+
58
+ const schema = {
59
+ type: 'object',
60
+ properties: {
61
+ richText: {
62
+ type: 'string',
63
+ title: 'Rich Text Editor',
64
+ 'x-decorator': 'FormItem',
65
+ 'x-component': 'RichTextEditor',
66
+ 'x-component-props': {
67
+ extensions: [Highlight],
68
+ toolbarItems: [
69
+ 'bold',
70
+ 'italic',
71
+ '|',
72
+ {
73
+ icon: '🖍️',
74
+ tooltip: 'Highlight',
75
+ onClick: (editor) => editor.chain().focus().toggleMark('highlight').run(),
76
+ isActive: (editor) => editor.isActive('highlight'),
77
+ },
78
+ ],
79
+ },
80
+ },
81
+ },
82
+ };`
83
+ }
84
+ ],
40
85
  keywords: [
41
86
  "formily",
42
87
  "rich text",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/row/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): react_jsx_runtime0.JSX.Element;
39
+ }: IRowProps): react_jsx_runtime3.JSX.Element;
40
40
  //#endregion
41
41
  export { IRowProps, Row };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/row/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): react_jsx_runtime3.JSX.Element;
39
+ }: IRowProps): react_jsx_runtime4.JSX.Element;
40
40
  //#endregion
41
41
  export { IRowProps, Row };