zy-react-library 2.0.5 → 2.0.6
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/README.md
CHANGED
|
@@ -44,6 +44,11 @@ export interface FormBuilderProps<Values = any> extends Omit<FormProps, "form" |
|
|
|
44
44
|
form: FormInstance<Values>;
|
|
45
45
|
/** 表单提交时的回调函数 */
|
|
46
46
|
onFinish?: (values: Values) => void;
|
|
47
|
+
/** 历史记录对象,用于返回上一页,默认使用 window.history.back */
|
|
48
|
+
history?: {
|
|
49
|
+
goBack?: () => void;
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
};
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Form as e,Spin as t,Row as o,Col as r,Space as i,Button as n,message as s}from"antd";import{useState as l,useEffect as a}from"react";import{throttle as u}from"throttle-debounce";import
|
|
1
|
+
import{Form as e,Spin as t,Row as o,Col as r,Space as i,Button as n,message as s}from"antd";import{useState as l,useEffect as a}from"react";import{throttle as u}from"throttle-debounce";import c from"./FormItemsRenderer.js";import{jsx as d,jsxs as m}from"react/jsx-runtime";const p=p=>{const{values:h,options:g,gutter:w=24,span:x=12,labelCol:y={span:4},useAutoGenerateRequired:b=!0,showActionButtons:B=!0,submitButtonText:f="提交",cancelButtonText:v="取消",showSubmitButton:A=!0,showCancelButton:C=!0,customActionButtons:F,extraActionButtons:T,history:k,loading:W=!1,...q}=p,[z,E]=l(window.innerWidth),R=u(50,()=>{const e=document.querySelector("#page-layout");e&&E(e.offsetWidth)});return a(()=>{const e=setTimeout(()=>{R()},0);return B&&window.addEventListener("resize",R),()=>{B&&window.removeEventListener("resize",R),clearTimeout(e)}},[B]),d(t,{spinning:W,children:m(e,{labelCol:y,scrollToFirstError:!0,wrapperCol:{span:24-y.span},initialValues:h,onFinishFailed:()=>{s.error("请补全必填项")},style:{width:`calc(100% - ${2*w}px)`,margin:"0 auto"},...q,children:[d(o,{gutter:w,children:d(c,{options:g,labelCol:y,span:x,gutter:w,useAutoGenerateRequired:b,initialValues:h})}),B&&m("div",{style:{position:"relative",zIndex:"9"},children:[d("div",{style:{height:"32px"}}),d(o,{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:z,margin:"0 -44px"},children:d(r,{span:24,style:{textAlign:"center"},children:F||m(i,{children:[A&&d(n,{type:"primary",htmlType:"submit",children:f}),T,C&&d(n,{onClick:()=>{k?.goBack?k.goBack():window.history.back()},children:v})]})})})]})]})})};p.displayName="FormBuilder",p.useForm=e.useForm,p.useWatch=e.useWatch;export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ArrowLeftOutlined as i}from"@ant-design/icons";import{Divider as e}from"antd";import"./index.less";import{jsx as a,jsxs as r,Fragment as t}from"react/jsx-runtime";function n(n){const{title:c,history:o,previous:s=!0}=n;return a("div",{className:"header-back",children:r("div",{className:"action",children:[s&&r(t,{children:[r("div",{className:"back",onClick:()=>o?.goBack
|
|
1
|
+
import{ArrowLeftOutlined as i}from"@ant-design/icons";import{Divider as e}from"antd";import"./index.less";import{jsx as a,jsxs as r,Fragment as t}from"react/jsx-runtime";function n(n){const{title:c,history:o,previous:s=!0}=n;return a("div",{className:"header-back",children:r("div",{className:"action",children:[s&&r(t,{children:[r("div",{className:"back",onClick:()=>{o?.goBack?o.goBack():window.history.back()},children:[a(i,{style:{fontSize:14}}),a("span",{children:"返回"})]}),a(e,{orientation:"vertical",style:{backgroundColor:"#dcdfe6",marginLeft:15,marginRight:15}})]}),a("div",{className:"title",children:c})]})})}n.displayName="HeaderBack";export{n as default};
|
package/components/Page/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Spin as e,Space as t,Button as i}from"antd";import{useState as o,useEffect as n}from"react";import{throttle as r}from"throttle-debounce";import d from"../HeaderBack/index.js";import{jsx as a,jsxs as s}from"react/jsx-runtime";function c(c){const{headerTitle:l,history:p,isShowHeader:h=!0,headerPrevious:u=!0,isShowFooter:m=!0,isShowAllAction:g=!0,loading:y=!1,backButtonText:f="关闭",contentPadding:x="20px",customActionButtons:w,extraActionButtons:v,children:
|
|
1
|
+
import{Spin as e,Space as t,Button as i}from"antd";import{useState as o,useEffect as n}from"react";import{throttle as r}from"throttle-debounce";import d from"../HeaderBack/index.js";import{jsx as a,jsxs as s}from"react/jsx-runtime";function c(c){const{headerTitle:l,history:p,isShowHeader:h=!0,headerPrevious:u=!0,isShowFooter:m=!0,isShowAllAction:g=!0,loading:y=!1,backButtonText:f="关闭",contentPadding:x="20px",customActionButtons:w,extraActionButtons:v,children:k}=c,[b,B]=o(window.innerWidth),A=r(50,()=>{const e=document.querySelector("#page-layout");e&&B(e.offsetWidth)});return n(()=>{const e=setTimeout(()=>{A()},0);return g&&m&&window.addEventListener("resize",A),()=>{g&&m&&window.removeEventListener("resize",A),clearTimeout(e)}},[g,m]),a(e,{spinning:y,children:s("div",{className:"page-layout",id:"page-layout",children:[g&&h&&a(d,{title:l,history:p,previous:u}),s("div",{style:{padding:x},children:[k&&"function"==typeof k?k():k,g&&m&&s("div",{className:"page-layout-footer",style:{position:"relative",zIndex:"9"},children:[a("div",{style:{height:"52px"}}),a("div",{style:{textAlign:"center",backgroundColor:"rgb(241, 241, 242)",padding:"10px 0",position:"fixed",bottom:"0",width:b,margin:"0px -20px"},children:w||s(t,{children:[v,a(i,{onClick:()=>{p?.goBack?p.goBack():window.history.back()},children:f})]})})]})]})]})})}c.displayName="Page";export{c as default};
|