@pixpilot/formily-shadcn 0.13.4 → 0.14.1
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/date-picker.d.ts +3 -3
- package/dist/components/form-grid.d.cts +2 -2
- package/dist/components/form.d.cts +2 -2
- package/dist/components/icon-picker.d.ts +3 -3
- package/dist/components/input.d.ts +2 -2
- package/dist/components/json-schema-form-renderer/json-schema-form-basic.cjs +2 -9
- package/dist/components/json-schema-form-renderer/json-schema-form-basic.js +2 -9
- package/dist/components/json-schema-form-renderer/json-schema-form-extended.cjs +2 -9
- package/dist/components/json-schema-form-renderer/json-schema-form-extended.js +2 -9
- package/dist/components/json-schema-form-renderer/json-schema-form-renderer.cjs +2 -24
- package/dist/components/json-schema-form-renderer/json-schema-form-renderer.js +2 -22
- package/dist/components/json-schema-form-renderer/json-schema-form.cjs +2 -9
- package/dist/components/json-schema-form-renderer/json-schema-form.js +2 -9
- package/dist/components/json-schema-form-renderer/types.d.cts +1 -1
- package/dist/components/json-schema-form-renderer/types.d.ts +1 -1
- package/dist/components/number-input.d.cts +2 -2
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/schema-field/index.d.cts +3 -3
- package/dist/components/schema-field/index.d.ts +3 -3
- package/dist/components/schema-field/index.js +3 -3
- package/dist/components/schema-field/schema-field-basics.cjs +14 -0
- package/dist/components/schema-field/schema-field-basics.d.cts +9 -1
- package/dist/components/schema-field/schema-field-basics.d.ts +9 -1
- package/dist/components/schema-field/schema-field-basics.js +13 -1
- package/dist/components/schema-field/schema-field-extended.cjs +14 -0
- package/dist/components/schema-field/schema-field-extended.d.cts +17 -10
- package/dist/components/schema-field/schema-field-extended.d.ts +486 -479
- package/dist/components/schema-field/schema-field-extended.js +13 -1
- package/dist/components/schema-field/schema-field.cjs +14 -0
- package/dist/components/schema-field/schema-field.d.cts +9 -1
- package/dist/components/schema-field/schema-field.d.ts +267 -259
- package/dist/components/schema-field/schema-field.js +13 -1
- package/dist/components/separator.d.cts +2 -2
- package/dist/components/separator.d.ts +2 -2
- package/dist/components/slider.d.cts +2 -2
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/switch.d.cts +2 -2
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/tags-input-inline.d.cts +2 -2
- package/dist/components/tags-input-inline.d.ts +2 -2
- package/dist/components/textarea.d.ts +2 -2
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/use-form-schema.cjs +21 -0
- package/dist/hooks/use-form-schema.js +19 -0
- package/dist/hooks/use-merged-schema-components.cjs +29 -0
- package/dist/hooks/use-merged-schema-components.js +27 -0
- package/dist/hooks/use-schema-field.cjs +29 -0
- package/dist/hooks/use-schema-field.js +25 -0
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +6 -4
- package/dist/utils/array-item-editor-utils.d.cts +1 -0
- package/dist/utils/array-item-editor-utils.d.ts +1 -0
- package/dist/utils/extract-fields-decorators.d.cts +1 -0
- package/dist/utils/extract-fields-decorators.d.ts +1 -0
- package/dist/utils/for-each-schema.d.cts +1 -0
- package/dist/utils/for-each-schema.d.ts +1 -0
- package/dist/utils/get-array-item-info.d.cts +1 -0
- package/dist/utils/get-array-item-info.d.ts +1 -0
- package/dist/utils/get-default-value.d.cts +1 -0
- package/dist/utils/get-default-value.d.ts +1 -0
- package/dist/utils/has-array-item-errors.d.cts +1 -0
- package/dist/utils/has-array-item-errors.d.ts +1 -0
- package/dist/utils/has-error.d.cts +1 -0
- package/dist/utils/has-error.d.ts +1 -0
- package/dist/utils/index.d.cts +11 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/transform-schema.d.cts +6 -0
- package/dist/utils/transform-schema.d.ts +6 -0
- package/dist/utils/use-array-item-editor.d.cts +1 -0
- package/dist/utils/use-array-item-editor.d.ts +1 -0
- package/dist/utils/validate-array-item-fields.d.cts +1 -0
- package/dist/utils/validate-array-item-fields.d.ts +1 -0
- package/dist/utils/validate-schema-components.d.cts +1 -0
- package/dist/utils/validate-schema-components.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { useMergedSchemaComponents } from "../../hooks/use-merged-schema-components.js";
|
|
1
2
|
import { Combobox as Combobox$1 } from "../combobox.js";
|
|
2
3
|
import { extractComponents } from "../../utils/extract-components.js";
|
|
4
|
+
import { useFormSchema } from "../../hooks/use-form-schema.js";
|
|
3
5
|
import { Slider as Slider$1 } from "../slider.js";
|
|
4
6
|
import { TagsInputInLine } from "../tags-input-inline.js";
|
|
5
7
|
import { basicComponentRegistry } from "./schema-field-basics.js";
|
|
6
8
|
import { createSchemaField } from "@formily/react";
|
|
7
9
|
import { TagsInput } from "@pixpilot/shadcn-ui";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
11
|
|
|
9
12
|
//#region src/components/schema-field/schema-field.tsx
|
|
10
13
|
const defaultComponentRegistry = {
|
|
@@ -28,6 +31,15 @@ const defaultComponentRegistry = {
|
|
|
28
31
|
};
|
|
29
32
|
const defaultComponents = extractComponents(defaultComponentRegistry);
|
|
30
33
|
const SchemaField = createSchemaField({ components: defaultComponents });
|
|
34
|
+
const JsonSchemaField = (props) => {
|
|
35
|
+
const { components, schema,...rest } = props;
|
|
36
|
+
const { formSchema, SchemaField: SchemaFieldComponent } = useFormSchema(schema, useMergedSchemaComponents(defaultComponentRegistry, components));
|
|
37
|
+
return /* @__PURE__ */ jsx(SchemaFieldComponent, {
|
|
38
|
+
...rest,
|
|
39
|
+
schema: formSchema
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
JsonSchemaField.displayName = "JsonSchemaField";
|
|
31
43
|
|
|
32
44
|
//#endregion
|
|
33
|
-
export { SchemaField, defaultComponentRegistry, defaultComponents };
|
|
45
|
+
export { JsonSchemaField, SchemaField, defaultComponentRegistry, defaultComponents };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react12 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: react12.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react12.RefAttributes<HTMLDivElement>>, "ref"> & react12.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Separator };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react14 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: react14.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react14.RefAttributes<HTMLDivElement>>, "ref"> & react14.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 { SliderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider.d.ts
|
|
@@ -7,6 +7,6 @@ import { SliderProps } from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected Slider component
|
|
8
8
|
* Range input for selecting numeric values
|
|
9
9
|
*/
|
|
10
|
-
declare const Slider:
|
|
10
|
+
declare const Slider: react19.ForwardRefExoticComponent<Omit<Partial<SliderProps>, "ref"> & react19.RefAttributes<unknown>>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { Slider };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react17 from "react";
|
|
2
2
|
import { SliderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider.d.ts
|
|
@@ -7,6 +7,6 @@ import { SliderProps } from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected Slider component
|
|
8
8
|
* Range input for selecting numeric values
|
|
9
9
|
*/
|
|
10
|
-
declare const Slider$1:
|
|
10
|
+
declare const Slider$1: react17.ForwardRefExoticComponent<Omit<Partial<SliderProps>, "ref"> & react17.RefAttributes<unknown>>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { Slider$1 as Slider };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react21 from "react";
|
|
2
2
|
import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
3
3
|
|
|
4
4
|
//#region src/components/switch.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
|
6
6
|
* Formily-connected Switch component
|
|
7
7
|
* Toggle switch for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const Switch:
|
|
9
|
+
declare const Switch: react21.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react21.RefAttributes<HTMLButtonElement>>, "ref"> & react21.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as 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 react10 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/tags-input-inline.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: react10.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.TagsInputProps> & react10.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -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/tags-input-inline.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: react22.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.TagsInputProps> & react22.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react24 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/textarea.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Textarea component
|
|
6
6
|
*/
|
|
7
|
-
declare const Textarea:
|
|
7
|
+
declare const Textarea: react24.ForwardRefExoticComponent<Omit<Partial<react24.ClassAttributes<HTMLTextAreaElement> & react24.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react24.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
const require_use_description = require('./use-description.cjs');
|
|
2
2
|
const require_use_form_context = require('./use-form-context.cjs');
|
|
3
3
|
const require_use_label = require('./use-label.cjs');
|
|
4
|
+
const require_use_merged_schema_components = require('./use-merged-schema-components.cjs');
|
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_extract_fields_decorators = require('../utils/extract-fields-decorators.cjs');
|
|
3
|
+
const require_transform_schema = require('../utils/transform-schema.cjs');
|
|
4
|
+
require('../utils/index.cjs');
|
|
5
|
+
const require_use_schema_field = require('./use-schema-field.cjs');
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
8
|
+
|
|
9
|
+
//#region src/hooks/use-form-schema.ts
|
|
10
|
+
function useFormSchema(schema, componentsProp) {
|
|
11
|
+
const formSchema = (0, react.useMemo)(() => {
|
|
12
|
+
return require_transform_schema.transformSchema(schema, require_extract_fields_decorators.extractFieldsDecorators(componentsProp?.fields));
|
|
13
|
+
}, [schema, componentsProp]);
|
|
14
|
+
return {
|
|
15
|
+
formSchema,
|
|
16
|
+
SchemaField: require_use_schema_field.useSchemaField(formSchema, componentsProp)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.useFormSchema = useFormSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { extractFieldsDecorators } from "../utils/extract-fields-decorators.js";
|
|
2
|
+
import { transformSchema } from "../utils/transform-schema.js";
|
|
3
|
+
import "../utils/index.js";
|
|
4
|
+
import { useSchemaField } from "./use-schema-field.js";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/use-form-schema.ts
|
|
8
|
+
function useFormSchema(schema, componentsProp) {
|
|
9
|
+
const formSchema = useMemo(() => {
|
|
10
|
+
return transformSchema(schema, extractFieldsDecorators(componentsProp?.fields));
|
|
11
|
+
}, [schema, componentsProp]);
|
|
12
|
+
return {
|
|
13
|
+
formSchema,
|
|
14
|
+
SchemaField: useSchemaField(formSchema, componentsProp)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { useFormSchema };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-merged-schema-components.ts
|
|
6
|
+
/**
|
|
7
|
+
* Merges basic component registry with user-provided components.
|
|
8
|
+
* User-provided components will override basic components if the same key exists.
|
|
9
|
+
*
|
|
10
|
+
* @param basicRegistry - The basic component registry (e.g., basicComponentRegistry)
|
|
11
|
+
* @param userComponents - Optional user-provided components to merge/override
|
|
12
|
+
* @returns Merged component configuration
|
|
13
|
+
*/
|
|
14
|
+
function useMergedSchemaComponents(basicRegistry, userComponents) {
|
|
15
|
+
return (0, react.useMemo)(() => ({
|
|
16
|
+
fields: {
|
|
17
|
+
...basicRegistry,
|
|
18
|
+
...userComponents?.fields ?? {}
|
|
19
|
+
},
|
|
20
|
+
decorators: userComponents?.decorators
|
|
21
|
+
}), [
|
|
22
|
+
basicRegistry,
|
|
23
|
+
userComponents?.decorators,
|
|
24
|
+
userComponents?.fields
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.useMergedSchemaComponents = useMergedSchemaComponents;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-merged-schema-components.ts
|
|
4
|
+
/**
|
|
5
|
+
* Merges basic component registry with user-provided components.
|
|
6
|
+
* User-provided components will override basic components if the same key exists.
|
|
7
|
+
*
|
|
8
|
+
* @param basicRegistry - The basic component registry (e.g., basicComponentRegistry)
|
|
9
|
+
* @param userComponents - Optional user-provided components to merge/override
|
|
10
|
+
* @returns Merged component configuration
|
|
11
|
+
*/
|
|
12
|
+
function useMergedSchemaComponents(basicRegistry, userComponents) {
|
|
13
|
+
return useMemo(() => ({
|
|
14
|
+
fields: {
|
|
15
|
+
...basicRegistry,
|
|
16
|
+
...userComponents?.fields ?? {}
|
|
17
|
+
},
|
|
18
|
+
decorators: userComponents?.decorators
|
|
19
|
+
}), [
|
|
20
|
+
basicRegistry,
|
|
21
|
+
userComponents?.decorators,
|
|
22
|
+
userComponents?.fields
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useMergedSchemaComponents };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_validate_schema_components = require('../utils/validate-schema-components.cjs');
|
|
3
|
+
require('../utils/index.cjs');
|
|
4
|
+
const require_extract_components = require('../utils/extract-components.cjs');
|
|
5
|
+
let __formily_react = require("@formily/react");
|
|
6
|
+
__formily_react = require_rolldown_runtime.__toESM(__formily_react);
|
|
7
|
+
let react = require("react");
|
|
8
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
9
|
+
let __pixpilot_env_is_dev = require("@pixpilot/env/is-dev");
|
|
10
|
+
__pixpilot_env_is_dev = require_rolldown_runtime.__toESM(__pixpilot_env_is_dev);
|
|
11
|
+
|
|
12
|
+
//#region src/hooks/use-schema-field.ts
|
|
13
|
+
function useSchemaField(formSchema, componentsProp) {
|
|
14
|
+
return react.default.useMemo(() => {
|
|
15
|
+
const componentConfigs = { ...componentsProp?.fields ?? {} };
|
|
16
|
+
if (componentsProp?.decorators) Object.entries(componentsProp.decorators).forEach(([key, decorator]) => {
|
|
17
|
+
componentConfigs[key] = { component: decorator };
|
|
18
|
+
});
|
|
19
|
+
const components = require_extract_components.extractComponents(componentConfigs);
|
|
20
|
+
if ((0, __pixpilot_env_is_dev.isDevelopment)()) require_validate_schema_components.validateSchemaComponents(formSchema, components);
|
|
21
|
+
return (0, __formily_react.createSchemaField)({
|
|
22
|
+
components,
|
|
23
|
+
scope: {}
|
|
24
|
+
});
|
|
25
|
+
}, [formSchema, componentsProp]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.useSchemaField = useSchemaField;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { validateSchemaComponents } from "../utils/validate-schema-components.js";
|
|
2
|
+
import "../utils/index.js";
|
|
3
|
+
import { extractComponents } from "../utils/extract-components.js";
|
|
4
|
+
import { createSchemaField } from "@formily/react";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { isDevelopment } from "@pixpilot/env/is-dev";
|
|
7
|
+
|
|
8
|
+
//#region src/hooks/use-schema-field.ts
|
|
9
|
+
function useSchemaField(formSchema, componentsProp) {
|
|
10
|
+
return React.useMemo(() => {
|
|
11
|
+
const componentConfigs = { ...componentsProp?.fields ?? {} };
|
|
12
|
+
if (componentsProp?.decorators) Object.entries(componentsProp.decorators).forEach(([key, decorator]) => {
|
|
13
|
+
componentConfigs[key] = { component: decorator };
|
|
14
|
+
});
|
|
15
|
+
const components = extractComponents(componentConfigs);
|
|
16
|
+
if (isDevelopment()) validateSchemaComponents(formSchema, components);
|
|
17
|
+
return createSchemaField({
|
|
18
|
+
components,
|
|
19
|
+
scope: {}
|
|
20
|
+
});
|
|
21
|
+
}, [formSchema, componentsProp]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useSchemaField };
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_transform_schema = require('./utils/transform-schema.cjs');
|
|
3
|
+
require('./utils/index.cjs');
|
|
2
4
|
const require_array_base = require('./components/array-base/array-base.cjs');
|
|
3
5
|
require('./components/array-base/index.cjs');
|
|
4
6
|
const require_array_cards = require('./components/array-cards/array-cards.cjs');
|
|
@@ -77,6 +79,9 @@ Object.defineProperty(exports, 'FormProvider', {
|
|
|
77
79
|
});
|
|
78
80
|
exports.IconPicker = require_icon_picker.IconPicker;
|
|
79
81
|
exports.Input = require_input.Input;
|
|
82
|
+
exports.JsonSchemaField = require_schema_field.JsonSchemaField;
|
|
83
|
+
exports.JsonSchemaFieldBasics = require_schema_field_basics.JsonSchemaFieldBasics;
|
|
84
|
+
exports.JsonSchemaFieldExtended = require_schema_field_extended.JsonSchemaFieldExtended;
|
|
80
85
|
exports.JsonSchemaForm = require_json_schema_form.JsonSchemaForm;
|
|
81
86
|
exports.JsonSchemaFormBasic = require_json_schema_form_basic.JsonSchemaFormBasic;
|
|
82
87
|
exports.JsonSchemaFormExtended = require_json_schema_form_extended.JsonSchemaFormExtended;
|
|
@@ -117,4 +122,5 @@ Object.defineProperty(exports, 'createForm', {
|
|
|
117
122
|
exports.defaultComponentRegistry = require_schema_field.defaultComponentRegistry;
|
|
118
123
|
exports.defaultComponents = require_schema_field.defaultComponents;
|
|
119
124
|
exports.extendedComponentRegistry = require_schema_field_extended.extendedComponentRegistry;
|
|
120
|
-
exports.extendedComponents = require_schema_field_extended.extendedComponents;
|
|
125
|
+
exports.extendedComponents = require_schema_field_extended.extendedComponents;
|
|
126
|
+
exports.transformSchema = require_transform_schema.transformSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -31,9 +31,9 @@ import { NumberInput } from "./components/number-input.cjs";
|
|
|
31
31
|
import { ConnectedRadio, Radio } from "./components/radio.cjs";
|
|
32
32
|
import { RichTextEditor } from "./components/rich-text-editor.cjs";
|
|
33
33
|
import { Row } from "./components/row.cjs";
|
|
34
|
-
import { SchemaField, defaultComponentRegistry, defaultComponents } from "./components/schema-field/schema-field.cjs";
|
|
35
|
-
import { SchemaFieldBasics, basicComponentRegistry, basicComponents } from "./components/schema-field/schema-field-basics.cjs";
|
|
36
|
-
import { SchemaFieldExtended, extendedComponentRegistry, extendedComponents } from "./components/schema-field/schema-field-extended.cjs";
|
|
34
|
+
import { JsonSchemaField, SchemaField, defaultComponentRegistry, defaultComponents } from "./components/schema-field/schema-field.cjs";
|
|
35
|
+
import { JsonSchemaFieldBasics, SchemaFieldBasics, basicComponentRegistry, basicComponents } from "./components/schema-field/schema-field-basics.cjs";
|
|
36
|
+
import { JsonSchemaFieldExtended, SchemaFieldExtended, extendedComponentRegistry, extendedComponents } from "./components/schema-field/schema-field-extended.cjs";
|
|
37
37
|
import "./components/schema-field/index.cjs";
|
|
38
38
|
import { Select } from "./components/select.cjs";
|
|
39
39
|
import { Separator } from "./components/separator.cjs";
|
|
@@ -41,6 +41,8 @@ import { Slider } from "./components/slider.cjs";
|
|
|
41
41
|
import { Switch } from "./components/switch.cjs";
|
|
42
42
|
import { TagsInputInLine } from "./components/tags-input-inline.cjs";
|
|
43
43
|
import { Textarea } from "./components/textarea.cjs";
|
|
44
|
+
import { transformSchema } from "./utils/transform-schema.cjs";
|
|
45
|
+
import "./utils/index.cjs";
|
|
44
46
|
import { Field, FormConsumer, FormProvider, ISchema, ObjectField, VoidField } from "@formily/react";
|
|
45
47
|
import { Form as IForm, createForm } from "@formily/core";
|
|
46
|
-
export { ArrayBase, type ArrayBaseMixins, ArrayCards, ArrayCollapse, AvatarUpload, Checkbox, Column, Combobox, ConnectedRadio, DatePicker, Field, FileUpload, FileUploadInline, Form, FormConsumer, FormGrid, FormItem, type FormLayoutOptions, FormProvider, type IArrayBaseOperationProps, type IArrayBaseProps, type IForm, type ISchema, IconPicker, Input, JsonSchemaForm, JsonSchemaFormBasic, JsonSchemaFormComponent, JsonSchemaFormComponents, JsonSchemaFormExtended, JsonSchemaFormProps, JsonSchemaFormRenderer, JsonSchemaFormRendererProps, NumberInput, ObjectField, Radio, RichTextEditor, Row, SchemaField, SchemaFieldBasics, SchemaFieldExtended, Select, Separator, Slider, Switch, TagsInputInLine, Textarea, VoidField, basicComponentRegistry, basicComponents, createForm, defaultComponentRegistry, defaultComponents, extendedComponentRegistry, extendedComponents };
|
|
48
|
+
export { ArrayBase, type ArrayBaseMixins, ArrayCards, ArrayCollapse, AvatarUpload, Checkbox, Column, Combobox, ConnectedRadio, DatePicker, Field, FileUpload, FileUploadInline, Form, FormConsumer, FormGrid, FormItem, type FormLayoutOptions, FormProvider, type IArrayBaseOperationProps, type IArrayBaseProps, type IForm, type ISchema, IconPicker, Input, JsonSchemaField, JsonSchemaFieldBasics, JsonSchemaFieldExtended, JsonSchemaForm, JsonSchemaFormBasic, JsonSchemaFormComponent, JsonSchemaFormComponents, JsonSchemaFormExtended, JsonSchemaFormProps, JsonSchemaFormRenderer, JsonSchemaFormRendererProps, NumberInput, ObjectField, Radio, RichTextEditor, Row, SchemaField, SchemaFieldBasics, SchemaFieldExtended, Select, Separator, Slider, Switch, TagsInputInLine, Textarea, VoidField, basicComponentRegistry, basicComponents, createForm, defaultComponentRegistry, defaultComponents, extendedComponentRegistry, extendedComponents, transformSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ import { NumberInput } from "./components/number-input.js";
|
|
|
31
31
|
import { ConnectedRadio, Radio } from "./components/radio.js";
|
|
32
32
|
import { RichTextEditor } from "./components/rich-text-editor.js";
|
|
33
33
|
import { Row } from "./components/row.js";
|
|
34
|
-
import { SchemaField, defaultComponentRegistry, defaultComponents } from "./components/schema-field/schema-field.js";
|
|
35
|
-
import { SchemaFieldBasics, basicComponentRegistry, basicComponents } from "./components/schema-field/schema-field-basics.js";
|
|
36
|
-
import { SchemaFieldExtended, extendedComponentRegistry, extendedComponents } from "./components/schema-field/schema-field-extended.js";
|
|
34
|
+
import { JsonSchemaField, SchemaField, defaultComponentRegistry, defaultComponents } from "./components/schema-field/schema-field.js";
|
|
35
|
+
import { JsonSchemaFieldBasics, SchemaFieldBasics, basicComponentRegistry, basicComponents } from "./components/schema-field/schema-field-basics.js";
|
|
36
|
+
import { JsonSchemaFieldExtended, SchemaFieldExtended, extendedComponentRegistry, extendedComponents } from "./components/schema-field/schema-field-extended.js";
|
|
37
37
|
import "./components/schema-field/index.js";
|
|
38
38
|
import { Select } from "./components/select.js";
|
|
39
39
|
import { Separator } from "./components/separator.js";
|
|
@@ -41,6 +41,8 @@ import { Slider } from "./components/slider.js";
|
|
|
41
41
|
import { Switch } from "./components/switch.js";
|
|
42
42
|
import { TagsInputInLine } from "./components/tags-input-inline.js";
|
|
43
43
|
import { Textarea } from "./components/textarea.js";
|
|
44
|
+
import { transformSchema } from "./utils/transform-schema.js";
|
|
45
|
+
import "./utils/index.js";
|
|
44
46
|
import { Field, FormConsumer, FormProvider, ISchema, ObjectField, VoidField } from "@formily/react";
|
|
45
47
|
import { Form as IForm, createForm } from "@formily/core";
|
|
46
|
-
export { ArrayBase, type ArrayBaseMixins, ArrayCards, ArrayCollapse, AvatarUpload, Checkbox, Column, Combobox, ConnectedRadio, DatePicker, Field, FileUpload, FileUploadInline, Form, FormConsumer, FormGrid, FormItem, type FormLayoutOptions, FormProvider, type IArrayBaseOperationProps, type IArrayBaseProps, type IForm, type ISchema, IconPicker, Input, JsonSchemaForm, JsonSchemaFormBasic, JsonSchemaFormComponent, JsonSchemaFormComponents, JsonSchemaFormExtended, JsonSchemaFormProps, JsonSchemaFormRenderer, JsonSchemaFormRendererProps, NumberInput, ObjectField, Radio, RichTextEditor, Row, SchemaField, SchemaFieldBasics, SchemaFieldExtended, Select, Separator, Slider, Switch, TagsInputInLine, Textarea, VoidField, basicComponentRegistry, basicComponents, createForm, defaultComponentRegistry, defaultComponents, extendedComponentRegistry, extendedComponents };
|
|
48
|
+
export { ArrayBase, type ArrayBaseMixins, ArrayCards, ArrayCollapse, AvatarUpload, Checkbox, Column, Combobox, ConnectedRadio, DatePicker, Field, FileUpload, FileUploadInline, Form, FormConsumer, FormGrid, FormItem, type FormLayoutOptions, FormProvider, type IArrayBaseOperationProps, type IArrayBaseProps, type IForm, type ISchema, IconPicker, Input, JsonSchemaField, JsonSchemaFieldBasics, JsonSchemaFieldExtended, JsonSchemaForm, JsonSchemaFormBasic, JsonSchemaFormComponent, JsonSchemaFormComponents, JsonSchemaFormExtended, JsonSchemaFormProps, JsonSchemaFormRenderer, JsonSchemaFormRendererProps, NumberInput, ObjectField, Radio, RichTextEditor, Row, SchemaField, SchemaFieldBasics, SchemaFieldExtended, Select, Separator, Slider, Switch, TagsInputInLine, Textarea, VoidField, basicComponentRegistry, basicComponents, createForm, defaultComponentRegistry, defaultComponents, extendedComponentRegistry, extendedComponents, transformSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { transformSchema } from "./utils/transform-schema.js";
|
|
2
|
+
import "./utils/index.js";
|
|
1
3
|
import { ArrayBase } from "./components/array-base/array-base.js";
|
|
2
4
|
import "./components/array-base/index.js";
|
|
3
5
|
import { ArrayCards } from "./components/array-cards/array-cards.js";
|
|
@@ -27,10 +29,10 @@ import { Select } from "./components/select.js";
|
|
|
27
29
|
import { Separator } from "./components/separator.js";
|
|
28
30
|
import { Switch } from "./components/switch.js";
|
|
29
31
|
import { Textarea } from "./components/textarea.js";
|
|
30
|
-
import { SchemaFieldBasics, basicComponentRegistry, basicComponents } from "./components/schema-field/schema-field-basics.js";
|
|
31
|
-
import { SchemaField, defaultComponentRegistry, defaultComponents } from "./components/schema-field/schema-field.js";
|
|
32
|
+
import { JsonSchemaFieldBasics, SchemaFieldBasics, basicComponentRegistry, basicComponents } from "./components/schema-field/schema-field-basics.js";
|
|
33
|
+
import { JsonSchemaField, SchemaField, defaultComponentRegistry, defaultComponents } from "./components/schema-field/schema-field.js";
|
|
32
34
|
import { RichTextEditor } from "./components/rich-text-editor.js";
|
|
33
|
-
import { SchemaFieldExtended, extendedComponentRegistry, extendedComponents } from "./components/schema-field/schema-field-extended.js";
|
|
35
|
+
import { JsonSchemaFieldExtended, SchemaFieldExtended, extendedComponentRegistry, extendedComponents } from "./components/schema-field/schema-field-extended.js";
|
|
34
36
|
import "./components/schema-field/index.js";
|
|
35
37
|
import { JsonSchemaFormRenderer } from "./components/json-schema-form-renderer/json-schema-form-renderer.js";
|
|
36
38
|
import { JsonSchemaForm } from "./components/json-schema-form-renderer/json-schema-form.js";
|
|
@@ -40,4 +42,4 @@ import "./components/json-schema-form-renderer/index.js";
|
|
|
40
42
|
import { Field, FormConsumer, FormProvider, ObjectField, VoidField } from "@formily/react";
|
|
41
43
|
import { createForm } from "@formily/core";
|
|
42
44
|
|
|
43
|
-
export { ArrayBase, ArrayCards, ArrayCollapse, AvatarUpload, Checkbox, Column, Combobox, ConnectedRadio, DatePicker, Field, FileUpload, FileUploadInline, Form, FormConsumer, FormGrid, FormItem, FormProvider, IconPicker, Input, JsonSchemaForm, JsonSchemaFormBasic, JsonSchemaFormExtended, JsonSchemaFormRenderer, NumberInput, ObjectField, Radio, RichTextEditor, Row, SchemaField, SchemaFieldBasics, SchemaFieldExtended, Select, Separator, Slider, Switch, TagsInputInLine, Textarea, VoidField, basicComponentRegistry, basicComponents, createForm, defaultComponentRegistry, defaultComponents, extendedComponentRegistry, extendedComponents };
|
|
45
|
+
export { ArrayBase, ArrayCards, ArrayCollapse, AvatarUpload, Checkbox, Column, Combobox, ConnectedRadio, DatePicker, Field, FileUpload, FileUploadInline, Form, FormConsumer, FormGrid, FormItem, FormProvider, IconPicker, Input, JsonSchemaField, JsonSchemaFieldBasics, JsonSchemaFieldExtended, JsonSchemaForm, JsonSchemaFormBasic, JsonSchemaFormExtended, JsonSchemaFormRenderer, NumberInput, ObjectField, Radio, RichTextEditor, Row, SchemaField, SchemaFieldBasics, SchemaFieldExtended, Select, Separator, Slider, Switch, TagsInputInLine, Textarea, VoidField, basicComponentRegistry, basicComponents, createForm, defaultComponentRegistry, defaultComponents, extendedComponentRegistry, extendedComponents, transformSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from "react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from "react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Schema } from "@formily/react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Schema } from "@formily/react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Schema } from "@formily/react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Schema } from "@formily/react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@formily/core";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./array-item-editor-utils.cjs";
|
|
2
|
+
import "./extract-fields-decorators.cjs";
|
|
3
|
+
import "./for-each-schema.cjs";
|
|
4
|
+
import "./get-array-item-info.cjs";
|
|
5
|
+
import "./get-default-value.cjs";
|
|
6
|
+
import "./has-array-item-errors.cjs";
|
|
7
|
+
import "./has-error.cjs";
|
|
8
|
+
import { transformSchema } from "./transform-schema.cjs";
|
|
9
|
+
import "./use-array-item-editor.cjs";
|
|
10
|
+
import "./validate-array-item-fields.cjs";
|
|
11
|
+
import "./validate-schema-components.cjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./array-item-editor-utils.js";
|
|
2
|
+
import "./extract-fields-decorators.js";
|
|
3
|
+
import "./for-each-schema.js";
|
|
4
|
+
import "./get-array-item-info.js";
|
|
5
|
+
import "./get-default-value.js";
|
|
6
|
+
import "./has-array-item-errors.js";
|
|
7
|
+
import "./has-error.js";
|
|
8
|
+
import { transformSchema } from "./transform-schema.js";
|
|
9
|
+
import "./use-array-item-editor.js";
|
|
10
|
+
import "./validate-array-item-fields.js";
|
|
11
|
+
import "./validate-schema-components.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ArrayField } from "@formily/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ISchema } from "@formily/react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ISchema } from "@formily/react";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/formily-shadcn",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.1",
|
|
5
5
|
"description": "Formily integration for shadcn/ui components",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"lucide-react": "^0.554.0",
|
|
42
42
|
"pretty-bytes": "^7.1.0",
|
|
43
43
|
"@pixpilot/shadcn": "0.4.0",
|
|
44
|
-
"@pixpilot/shadcn-ui": "0.
|
|
44
|
+
"@pixpilot/shadcn-ui": "0.9.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@storybook/react": "^10.1.8",
|