-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1098 from easyops-cn/derrickma/feat-eo-submit-button
feat(): 新增 eo-submit-button 构件
- Loading branch information
Showing
3 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
bricks/basic/src/editors/eo-submit-buttons/eoSubmitButton.schema.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
export const eoSubmitButtonsSchema = { | ||
name: "layout", | ||
type: "void", | ||
component: { | ||
name: "FormLayout", | ||
props: { | ||
layout: "vertical", | ||
}, | ||
}, | ||
children: [ | ||
{ | ||
name: "categoryTitle_submit", | ||
type: "void", | ||
decorator: { | ||
name: "CategoryTitle", | ||
props: { | ||
text: "提交按钮", | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "submitText", | ||
title: "按钮文字", | ||
type: "string", | ||
}, | ||
{ | ||
name: "submitType", | ||
type: "string", | ||
title: "按钮类型", | ||
component: { | ||
name: "Select", | ||
props: { | ||
placeholder: "请选择按钮类型", | ||
allowClear: true, | ||
options: [ | ||
"primary", | ||
"default", | ||
"dashed", | ||
"ghost", | ||
"link", | ||
"text", | ||
"icon", | ||
].map((item) => ({ | ||
label: item, | ||
value: item, | ||
})), | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "submitDisabled", | ||
title: "禁用", | ||
type: "boolean", | ||
}, | ||
{ | ||
name: "disableAfterClick", | ||
title: "点击后禁用", | ||
type: "boolean", | ||
}, | ||
{ | ||
name: "categoryTitle_cancel", | ||
type: "void", | ||
decorator: { | ||
name: "CategoryTitle", | ||
props: { | ||
text: "取消按钮", | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "cancelText", | ||
title: "按钮文字", | ||
type: "string", | ||
}, | ||
{ | ||
name: "cancelType", | ||
type: "string", | ||
title: "按钮类型", | ||
component: { | ||
name: "Select", | ||
props: { | ||
placeholder: "请选择按钮类型", | ||
allowClear: true, | ||
options: [ | ||
"primary", | ||
"default", | ||
"dashed", | ||
"ghost", | ||
"link", | ||
"text", | ||
"icon", | ||
].map((item) => ({ | ||
label: item, | ||
value: item, | ||
})), | ||
}, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React, { createElement } from "react"; | ||
import { customEditors } from "@next-core/runtime"; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import type { EditorComponentProps } from "@next-bricks/visual-builder/property-editor"; | ||
import { eoSubmitButtonsSchema } from "./eoSubmitButton.schema"; | ||
|
||
function EoSubmitButtonsComponent( | ||
props: EditorComponentProps | ||
): React.ReactElement { | ||
const { SchemaFieldComponent, formilySchemaFormatter, advancedMode } = props; | ||
|
||
return createElement(SchemaFieldComponent, { | ||
schema: formilySchemaFormatter(eoSubmitButtonsSchema, advancedMode), | ||
}); | ||
} | ||
|
||
customEditors.define("eo-submit-buttons", EoSubmitButtonsComponent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import "./eo-button/index.js"; | ||
import "./eo-submit-buttons/index.js"; | ||
import "./eo-text/index.js"; | ||
import "./eo-search-bar/index.js"; | ||
import "./eo-spin/index.js"; | ||
import "./eo-tag/index.js"; | ||
import "./eo-popover/index.js"; | ||
import "./eo-search/index.js"; | ||
import "./eo-category/index.js"; | ||
import "./eo-category/index.js"; |