Skip to content

Commit a86d453

Browse files
committed
feat(): support eo-time-picker custom editors
1 parent dd63120 commit a86d453

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
export const EoTimePickerSchema = {
2+
name: "layout",
3+
type: "void",
4+
component: {
5+
name: "FormLayout",
6+
props: {
7+
layout: "vertical",
8+
},
9+
},
10+
children: [
11+
{
12+
name: "categoryTitle_item",
13+
type: "void",
14+
decorator: {
15+
name: "CategoryTitle",
16+
props: {
17+
text: "表单项",
18+
},
19+
},
20+
},
21+
{
22+
name: "name",
23+
title: "字段名",
24+
type: "string",
25+
},
26+
{
27+
name: "label",
28+
title: "标签",
29+
type: "string",
30+
},
31+
{
32+
name: "value",
33+
title: "值",
34+
type: "string",
35+
},
36+
{
37+
name: "disabled",
38+
title: "禁用",
39+
type: "boolean",
40+
},
41+
{
42+
name: "notRender",
43+
title: "隐藏表单项",
44+
type: "boolean",
45+
component: {
46+
name: "Switch",
47+
},
48+
decorator: {
49+
name: "FormItem",
50+
props: {
51+
layout: "horizontal",
52+
tooltip:
53+
"区别于通用的“隐藏”属性,隐藏表单项时,表单不仅不显示当前项,同时也不会校验当前项;通用隐藏仅仅是不显示,但仍会校验当前项。通常,您应选择此属性来隐藏表单项。",
54+
},
55+
},
56+
},
57+
{
58+
name: "required",
59+
title: "必填",
60+
type: "boolean",
61+
component: {
62+
props: {
63+
size: "small",
64+
},
65+
},
66+
},
67+
{
68+
name: "placeholder",
69+
title: "占位说明",
70+
type: "string",
71+
},
72+
{
73+
name: "configProps",
74+
title: "Antd timePicker 属性",
75+
type: "string",
76+
component: {
77+
name: "CodeEditor",
78+
},
79+
decorator: "FormItemWithoutAdvanced",
80+
},
81+
],
82+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type _React from "react";
2+
import { customEditors } from "@next-core/runtime";
3+
import type { EditorComponentProps } from "@next-shared/property-editor";
4+
import { EoTimePickerSchema } from "./eoTimePicker.schema";
5+
6+
function EoTimePickerComponentFactory(React: typeof _React) {
7+
return function EoTimePickerComponent(
8+
props: EditorComponentProps
9+
): React.ReactElement {
10+
const { SchemaFieldComponent, formilySchemaFormatter, scope } = props;
11+
12+
return React.createElement(SchemaFieldComponent, {
13+
schema: formilySchemaFormatter(EoTimePickerSchema as any),
14+
scope,
15+
});
16+
};
17+
}
18+
19+
customEditors.define("eo-time-picker", EoTimePickerComponentFactory);

bricks/form/src/editors/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
import "./eo-date-picker/index.js";
2+
import "./eo-time-picker/index.js";

0 commit comments

Comments
 (0)