Skip to content

Commit

Permalink
Merge pull request #1098 from easyops-cn/derrickma/feat-eo-submit-button
Browse files Browse the repository at this point in the history
feat(): 新增 eo-submit-button 构件
  • Loading branch information
lijmyeah authored Jun 21, 2024
2 parents 9c9385e + 5210496 commit e1c7eba
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 1 deletion.
100 changes: 100 additions & 0 deletions bricks/basic/src/editors/eo-submit-buttons/eoSubmitButton.schema.tsx
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,
})),
},
},
},
],
};
18 changes: 18 additions & 0 deletions bricks/basic/src/editors/eo-submit-buttons/index.tsx
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);
3 changes: 2 additions & 1 deletion bricks/basic/src/editors/index.ts
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";

0 comments on commit e1c7eba

Please sign in to comment.