bhd-components 0.4.5 → 0.5.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/table.esm.es5.development.js +2 -2
- package/dist/table.esm.es5.production.js +1 -1
- package/es2017/bhdAppLayout/components/BhdTableSimple/index.js +97 -0
- package/es2017/bhdAppLayout/components/BhdTableSimple/index.less +52 -0
- package/es2017/bhdAppLayout/index.d.ts +28 -0
- package/es2017/bhdAppLayout/index.js +127 -0
- package/es2017/bhdAppLayout/index.module.less +95 -0
- package/es2017/bhdSelect/index.d.ts +9 -10
- package/es2017/bhdTipModal/index.module.less +87 -90
- package/es2017/i18n/en_US.d.ts +2 -0
- package/es2017/i18n/en_US.js +8 -0
- package/es2017/i18n/index.d.ts +2 -0
- package/es2017/i18n/index.js +14 -0
- package/es2017/i18n/zh_CN.d.ts +2 -0
- package/es2017/i18n/zh_CN.js +8 -0
- package/es2017/images/index.d.ts +2 -0
- package/es2017/images/index.js +2 -0
- package/es2017/images/notData.js +2 -0
- package/es2017/images/serverError.js +2 -0
- package/es2017/index.d.ts +1 -0
- package/es2017/index.js +1 -0
- package/es2017/message/index.d.ts +3 -3
- package/es2017/provider/index.js +2 -0
- package/es2017/table/index.js +2 -2
- package/es2017/theme/variable.less +1 -1
- package/es2017/titleBar/index.d.ts +5 -5
- package/esm/bhdAppLayout/components/BhdTableSimple/index.js +97 -0
- package/esm/bhdAppLayout/components/BhdTableSimple/index.less +52 -0
- package/esm/bhdAppLayout/index.d.ts +28 -0
- package/esm/bhdAppLayout/index.js +130 -0
- package/esm/bhdAppLayout/index.module.less +95 -0
- package/esm/bhdSelect/index.d.ts +9 -10
- package/esm/bhdTipModal/index.module.less +87 -90
- package/esm/i18n/en_US.d.ts +2 -0
- package/esm/i18n/en_US.js +8 -0
- package/esm/i18n/index.d.ts +2 -0
- package/esm/i18n/index.js +14 -0
- package/esm/i18n/zh_CN.d.ts +2 -0
- package/esm/i18n/zh_CN.js +8 -0
- package/esm/images/index.d.ts +2 -0
- package/esm/images/index.js +2 -0
- package/esm/images/notData.js +2 -0
- package/esm/images/serverError.js +2 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/message/index.d.ts +3 -3
- package/esm/provider/index.js +2 -0
- package/esm/table/index.js +2 -2
- package/esm/theme/variable.less +1 -1
- package/esm/titleBar/index.d.ts +5 -5
- package/package.json +1 -1
|
@@ -179,7 +179,7 @@ var Table = function(props) {
|
|
|
179
179
|
});
|
|
180
180
|
var diff = tableWidth - minWidth;
|
|
181
181
|
if (diff > 0) {
|
|
182
|
-
var avgWidth = 0;
|
|
182
|
+
var avgWidth = autoNum === 0 ? diff : 0;
|
|
183
183
|
// 有多余空间 平均分配至每个自适应的列
|
|
184
184
|
columns = columns.map(function(item) {
|
|
185
185
|
if (item.width === "auto") {
|
|
@@ -196,7 +196,7 @@ var Table = function(props) {
|
|
|
196
196
|
columns = columns.map(function(item, index) {
|
|
197
197
|
//存在适应自适应列侯 多余宽度 则平均分配每一列(除最后一列)
|
|
198
198
|
if (avgWidth > 0 && index !== columns.length - 1) {
|
|
199
|
-
item.width += avgWidth / columns.length - 1;
|
|
199
|
+
item.width += avgWidth / (columns.length - 1);
|
|
200
200
|
}
|
|
201
201
|
return item;
|
|
202
202
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,j as e,a as n,b as i,T as o,c as r}from"./28cd83d3.esm.es5.production.js";import{useState as l,useRef as d,useEffect as a}from"react";import"react/jsx-runtime";import"react-dom";var u={Table:"index_module_Table__dfa8dab0",SmallTable:"index_module_SmallTable__dfa8dab0",columnTootipClassName:"index_module_columnTootipClassName__dfa8dab0"},c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:14,n=0,i=document.createElement("div");return i.style.position="absolute",i.style.whiteSpace="nowrap",i.style.fontSize=e+"px",i.style.opacity="0",i.innerText=t,document.body.append(i),n=i.getBoundingClientRect().width,document.body.removeChild(i),n},s=function(r){var d=r.children,a=r.title,u=r.width,s=t(l(!1),2),m=s[0],h=s[1];return e(o,n(i({},r),{open:m,children:e("span",{onMouseEnter:function(t){var e=0;(e="function"==typeof u?u(t):u)?h(!(c(a)<e)):h(!0)},onMouseLeave:function(){h(!1)},children:d})}))},m=/^\d+%$/,h=/^\d+px$/,f=function(t){var e={};return parseFloat((e=window.getComputedStyle?getComputedStyle(t,null):t.currentStyle)["padding-left"])+parseFloat(e["padding-right"])},p=function(t){try{for(;t&&"TD"!==t.nodeName;)t=t.parentElement;var e=f(t);return t.clientWidth-e}catch(t){return null}},w=0,C=function(o){var c=d(null),f=d({timer:null}),C=o.defaultWidthRang,v=void 0===C?[180,240,320]:C,E=o.isFixedLeft,T=void 0===E||E,N=o.isFixedRight,g=void 0===N||N,y=o.bordered,_=void 0!==y&&y,L=o.kind,b=t(l(o.columns||[]),2),x=b[0],S=b[1],R=t(l(o.scroll||void 0),2),O=R[0],F=R[1],I=o.columnTootipClassName,W=o.columnTootipColor,M=function(){(t=document.createElement("div")).style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t),e=document.createElement("div"),t.appendChild(e),r=t.offsetWidth-e.offsetWidth,t.parentNode.removeChild(t),w=r||w;var t,e,r,l=_?c.current.offsetWidth-2-w:c.current.offsetWidth-w,d=A(o.columns,l).columns;S(d);var a=O||{};a=n(i({},a),{x:l}),F(a)},A=function(t,o){var r=0,l=0,d=0;t=t.map(function(t){return t.width=t.width||"auto",m.test(t.width)?t.width=parseFloat(t.width)>=100?"auto":o*parseFloat(t.width)/100:"number"==typeof t.width?t.width=t.width:h.test(t.width)?t.width=parseFloat(t.width):t.width="auto","auto"===t.width?(r+=1,t.widthRang||(t.widthRang=v),l+=t.widthRang[0],d+=t.widthRang[1]):(l+=t.width,d+=t.width),t.onColumnCell||(t.onColumnCell=t.onCell||function(){return{}}),t.render||(t.ellipsis={showTitle:!1},t.render=function(t){return e(s,{width:function(t){return p(t.target)},title:t,trigger:"hover",overlayClassName:I||u.columnTootipClassName,color:W||"#FFF",children:e("span",{children:t})})}),t});var a=o-l;if(a>0){var c=0;t=(t=t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]+a/r,t.width>t.widthRang[2]&&(c+=t.width-t.widthRang[2],t.width=t.widthRang[2])),t})).map(function(e,n){return c>0&&n!==t.length-1&&(e.width+=c/t.length-1),e})}else t=a<0?t.map(function(e,n){return T&&0===n&&(e.fixed="left"),g&&n===t.length-1&&(e.fixed="right"),"auto"===e.width&&(e.width=e.widthRang[1]),e}):t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]),t});return t.map(function(t){return t.onCell=function(e,o){var r="function"==typeof t.onColumnCell?t.onColumnCell(e,o):{};return r.style=r.style?r.style:{},n(i({},r),{style:i({maxWidth:t.width+"px"},r.style)})},t}),{columns:t,scrollWidth:d}},U=function(){clearTimeout(f.current.timer),f.current.timer=setTimeout(function(){M()},1e3)};a(function(){return M(),window.addEventListener("resize",U),function(){clearTimeout(f.current.timer),window.removeEventListener("resize",U)}},[o.columns]),a(function(){F(o.scroll||void 0)},[o.scroll]);var j=n(i({bordered:!1},o),{columns:x,scroll:O||{x:"auto"}});return e("div",{className:"".concat(u.Table," ").concat("simple"===L?u.SmallTable:""),ref:c,children:e(r,i({},j))})};C.SELECTION_COLUMN=r.SELECTION_COLUMN,C.EXPAND_COLUMN=r.EXPAND_COLUMN,C.SELECTION_ALL=r.SELECTION_ALL,C.SELECTION_INVERT=r.SELECTION_INVERT,C.SELECTION_NONE=r.SELECTION_NONE,C.Column=r.Column,C.ColumnGroup=r.ColumnGroup;export{C as default};
|
|
1
|
+
import{_ as t,j as e,a as n,b as i,T as o,c as r}from"./28cd83d3.esm.es5.production.js";import{useState as l,useRef as d,useEffect as a}from"react";import"react/jsx-runtime";import"react-dom";var u={Table:"index_module_Table__dfa8dab0",SmallTable:"index_module_SmallTable__dfa8dab0",columnTootipClassName:"index_module_columnTootipClassName__dfa8dab0"},c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:14,n=0,i=document.createElement("div");return i.style.position="absolute",i.style.whiteSpace="nowrap",i.style.fontSize=e+"px",i.style.opacity="0",i.innerText=t,document.body.append(i),n=i.getBoundingClientRect().width,document.body.removeChild(i),n},s=function(r){var d=r.children,a=r.title,u=r.width,s=t(l(!1),2),m=s[0],h=s[1];return e(o,n(i({},r),{open:m,children:e("span",{onMouseEnter:function(t){var e=0;(e="function"==typeof u?u(t):u)?h(!(c(a)<e)):h(!0)},onMouseLeave:function(){h(!1)},children:d})}))},m=/^\d+%$/,h=/^\d+px$/,f=function(t){var e={};return parseFloat((e=window.getComputedStyle?getComputedStyle(t,null):t.currentStyle)["padding-left"])+parseFloat(e["padding-right"])},p=function(t){try{for(;t&&"TD"!==t.nodeName;)t=t.parentElement;var e=f(t);return t.clientWidth-e}catch(t){return null}},w=0,C=function(o){var c=d(null),f=d({timer:null}),C=o.defaultWidthRang,v=void 0===C?[180,240,320]:C,E=o.isFixedLeft,T=void 0===E||E,N=o.isFixedRight,g=void 0===N||N,y=o.bordered,_=void 0!==y&&y,L=o.kind,b=t(l(o.columns||[]),2),x=b[0],S=b[1],R=t(l(o.scroll||void 0),2),O=R[0],F=R[1],I=o.columnTootipClassName,W=o.columnTootipColor,M=function(){(t=document.createElement("div")).style.visibility="hidden",t.style.overflow="scroll",document.body.appendChild(t),e=document.createElement("div"),t.appendChild(e),r=t.offsetWidth-e.offsetWidth,t.parentNode.removeChild(t),w=r||w;var t,e,r,l=_?c.current.offsetWidth-2-w:c.current.offsetWidth-w,d=A(o.columns,l).columns;S(d);var a=O||{};a=n(i({},a),{x:l}),F(a)},A=function(t,o){var r=0,l=0,d=0;t=t.map(function(t){return t.width=t.width||"auto",m.test(t.width)?t.width=parseFloat(t.width)>=100?"auto":o*parseFloat(t.width)/100:"number"==typeof t.width?t.width=t.width:h.test(t.width)?t.width=parseFloat(t.width):t.width="auto","auto"===t.width?(r+=1,t.widthRang||(t.widthRang=v),l+=t.widthRang[0],d+=t.widthRang[1]):(l+=t.width,d+=t.width),t.onColumnCell||(t.onColumnCell=t.onCell||function(){return{}}),t.render||(t.ellipsis={showTitle:!1},t.render=function(t){return e(s,{width:function(t){return p(t.target)},title:t,trigger:"hover",overlayClassName:I||u.columnTootipClassName,color:W||"#FFF",children:e("span",{children:t})})}),t});var a=o-l;if(a>0){var c=0===r?a:0;t=(t=t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]+a/r,t.width>t.widthRang[2]&&(c+=t.width-t.widthRang[2],t.width=t.widthRang[2])),t})).map(function(e,n){return c>0&&n!==t.length-1&&(e.width+=c/(t.length-1)),e})}else t=a<0?t.map(function(e,n){return T&&0===n&&(e.fixed="left"),g&&n===t.length-1&&(e.fixed="right"),"auto"===e.width&&(e.width=e.widthRang[1]),e}):t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]),t});return t.map(function(t){return t.onCell=function(e,o){var r="function"==typeof t.onColumnCell?t.onColumnCell(e,o):{};return r.style=r.style?r.style:{},n(i({},r),{style:i({maxWidth:t.width+"px"},r.style)})},t}),{columns:t,scrollWidth:d}},U=function(){clearTimeout(f.current.timer),f.current.timer=setTimeout(function(){M()},1e3)};a(function(){return M(),window.addEventListener("resize",U),function(){clearTimeout(f.current.timer),window.removeEventListener("resize",U)}},[o.columns]),a(function(){F(o.scroll||void 0)},[o.scroll]);var j=n(i({bordered:!1},o),{columns:x,scroll:O||{x:"auto"}});return e("div",{className:"".concat(u.Table," ").concat("simple"===L?u.SmallTable:""),ref:c,children:e(r,i({},j))})};C.SELECTION_COLUMN=r.SELECTION_COLUMN,C.EXPAND_COLUMN=r.EXPAND_COLUMN,C.SELECTION_ALL=r.SELECTION_ALL,C.SELECTION_INVERT=r.SELECTION_INVERT,C.SELECTION_NONE=r.SELECTION_NONE,C.Column=r.Column,C.ColumnGroup=r.ColumnGroup;export{C as default};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import "./index.less";
|
|
6
|
+
import Table from "../../../table";
|
|
7
|
+
import { Loading, NotData, ServerError } from "../../../images";
|
|
8
|
+
import i18Conversion from "../../../i18n";
|
|
9
|
+
/*
|
|
10
|
+
参数与Table一致
|
|
11
|
+
|
|
12
|
+
ajaxErr:接口是否报错
|
|
13
|
+
notDataText:无数据时,显示的文案
|
|
14
|
+
borderBottom: 是否显示下边框线
|
|
15
|
+
loading:是否加载中
|
|
16
|
+
className
|
|
17
|
+
超长内容 出现滚动条 需在管理列定义好width 没有定义的max-width:300
|
|
18
|
+
*/ const BhdTableSimple = (props)=>{
|
|
19
|
+
let { className , locale , borderBottom =false , rowSelection , ajaxErr , dataSource , kind ="simple" , loading , notDataText =i18Conversion("noData") } = props;
|
|
20
|
+
const renderTableText = ()=>{
|
|
21
|
+
if (ajaxErr) {
|
|
22
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
23
|
+
className: "app_BhdTableSimple_errorTable",
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ _jsx("img", {
|
|
26
|
+
src: ServerError,
|
|
27
|
+
alt: "",
|
|
28
|
+
srcset: ""
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ _jsx("p", {
|
|
31
|
+
children: i18Conversion("系统繁忙,稍后重试!")
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (loading) {
|
|
37
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
38
|
+
className: "app_BhdTableSimple_noTable",
|
|
39
|
+
style: {
|
|
40
|
+
minHeight: "150px"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
45
|
+
className: "app_BhdTableSimple_noTable",
|
|
46
|
+
style: {
|
|
47
|
+
width: "100%"
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsx("img", {
|
|
51
|
+
src: NotData,
|
|
52
|
+
alt: ""
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsx("div", {
|
|
55
|
+
children: notDataText
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const loadingTable = /*#__PURE__*/ _jsxs("div", {
|
|
61
|
+
className: "app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable",
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsx("img", {
|
|
64
|
+
src: Loading,
|
|
65
|
+
alt: "",
|
|
66
|
+
style: {
|
|
67
|
+
width: "48px",
|
|
68
|
+
height: "48px"
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx("p", {
|
|
72
|
+
children: i18Conversion("Load")
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
const tableProps = _object_spread_props(_object_spread({
|
|
77
|
+
style: {
|
|
78
|
+
width: "100%"
|
|
79
|
+
}
|
|
80
|
+
}, props), {
|
|
81
|
+
loading: false,
|
|
82
|
+
dataSource: ajaxErr ? [] : dataSource,
|
|
83
|
+
className: `app_BhdTableSimple ${className || " "} ${rowSelection ? "app_BhdTableSimple_rowSelection" : ""}`,
|
|
84
|
+
locale: {
|
|
85
|
+
emptyText: renderTableText()
|
|
86
|
+
},
|
|
87
|
+
scroll: props.scroll
|
|
88
|
+
});
|
|
89
|
+
if (kind === "simple") {
|
|
90
|
+
className += " app_BhdTableSimple_simple";
|
|
91
|
+
}
|
|
92
|
+
if (loading) {
|
|
93
|
+
return loadingTable;
|
|
94
|
+
}
|
|
95
|
+
return /*#__PURE__*/ _jsx(Table, _object_spread({}, tableProps));
|
|
96
|
+
};
|
|
97
|
+
export default BhdTableSimple;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@import "../../../theme/variable.less";
|
|
2
|
+
.app_BhdTableSimple {
|
|
3
|
+
/* 无数据样式 */
|
|
4
|
+
.app_BhdTableSimple_noTable {
|
|
5
|
+
padding: 24px 0;
|
|
6
|
+
img {
|
|
7
|
+
width: 200px;
|
|
8
|
+
height: 200px;
|
|
9
|
+
margin-bottom: 24px;
|
|
10
|
+
}
|
|
11
|
+
div {
|
|
12
|
+
color: @color-text-tertiary-Tr;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* 错误样式 */
|
|
18
|
+
.app_BhdTableSimple_errorTable {
|
|
19
|
+
padding: 24px 0;
|
|
20
|
+
img {
|
|
21
|
+
width: 200px;
|
|
22
|
+
height: 200px;
|
|
23
|
+
margin-bottom: 24px;
|
|
24
|
+
}
|
|
25
|
+
p {
|
|
26
|
+
color: @color-text-tertiary-Tr;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
span {
|
|
29
|
+
color: rgba(240, 93, 59, 1);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* 加载样式 */
|
|
40
|
+
.app_BhdTableSimple_noTable_loadingTable {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 50%;
|
|
47
|
+
left: 50%;
|
|
48
|
+
transform: translate(-50%, -50%);
|
|
49
|
+
img {
|
|
50
|
+
margin-bottom: 24px;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TitleBarProps } from "../titleBar";
|
|
3
|
+
import { PaginationProps } from "antd";
|
|
4
|
+
interface footerConfigProps extends PaginationProps {
|
|
5
|
+
leftDom?: React.ReactElement;
|
|
6
|
+
}
|
|
7
|
+
interface BhdAppLayoutProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
headerClassName?: string;
|
|
10
|
+
tableBoxClassName?: string;
|
|
11
|
+
headConfig?: TitleBarProps;
|
|
12
|
+
filterConfig?: {
|
|
13
|
+
filterArr: {
|
|
14
|
+
id: string | number;
|
|
15
|
+
title: string | number;
|
|
16
|
+
value: string | number;
|
|
17
|
+
}[];
|
|
18
|
+
onClearSingle: (id: string | number) => void;
|
|
19
|
+
onClearAll: () => void;
|
|
20
|
+
};
|
|
21
|
+
headContent?: any;
|
|
22
|
+
otherContent?: any;
|
|
23
|
+
tableConfig?: any;
|
|
24
|
+
footerConfig?: footerConfigProps;
|
|
25
|
+
scrollConfig?: any;
|
|
26
|
+
}
|
|
27
|
+
declare function BhdAppLayout(props: BhdAppLayoutProps): React.JSX.Element;
|
|
28
|
+
export default BhdAppLayout;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { useState, useLayoutEffect, useRef } from "react";
|
|
6
|
+
import styles from "./index.module.less";
|
|
7
|
+
import TitleBar from "../titleBar";
|
|
8
|
+
import { Pagination } from "antd";
|
|
9
|
+
import i18Conversion from "../i18n";
|
|
10
|
+
import BhdTableSimple from "./components/BhdTableSimple/index";
|
|
11
|
+
function BhdAppLayout(props) {
|
|
12
|
+
var _filterRef_current, _headRef_current, _otherHeadRef_current, _otherContentRef_current;
|
|
13
|
+
const { className , headerClassName , tableBoxClassName , headConfig , filterConfig , headContent , otherContent , tableConfig , footerConfig } = props;
|
|
14
|
+
const [scrollY, setScrollY] = useState("");
|
|
15
|
+
const [scrollConfig, setScrollConfig] = useState(props.scrollConfig);
|
|
16
|
+
const windowChange = ()=>{
|
|
17
|
+
var _headRef_current, _headRef_current1, _filterRef_current, _filterRef_current1, _otherHeadRef_current, _otherHeadRef_current1, _otherContentRef_current, _otherContentRef_current1;
|
|
18
|
+
let headRefHeight = isNaN(headRef === null || headRef === void 0 ? void 0 : (_headRef_current = headRef.current) === null || _headRef_current === void 0 ? void 0 : _headRef_current.offsetHeight) ? 0 : headRef === null || headRef === void 0 ? void 0 : (_headRef_current1 = headRef.current) === null || _headRef_current1 === void 0 ? void 0 : _headRef_current1.offsetHeight;
|
|
19
|
+
let filterRefHeight = isNaN(filterRef === null || filterRef === void 0 ? void 0 : (_filterRef_current = filterRef.current) === null || _filterRef_current === void 0 ? void 0 : _filterRef_current.offsetHeight) ? 0 : filterRef === null || filterRef === void 0 ? void 0 : (_filterRef_current1 = filterRef.current) === null || _filterRef_current1 === void 0 ? void 0 : _filterRef_current1.offsetHeight;
|
|
20
|
+
let otherHeadRefHeight = isNaN(otherHeadRef === null || otherHeadRef === void 0 ? void 0 : (_otherHeadRef_current = otherHeadRef.current) === null || _otherHeadRef_current === void 0 ? void 0 : _otherHeadRef_current.offsetHeight) ? 0 : otherHeadRef === null || otherHeadRef === void 0 ? void 0 : (_otherHeadRef_current1 = otherHeadRef.current) === null || _otherHeadRef_current1 === void 0 ? void 0 : _otherHeadRef_current1.offsetHeight;
|
|
21
|
+
let otherContentRefHeight = isNaN(otherContentRef === null || otherContentRef === void 0 ? void 0 : (_otherContentRef_current = otherContentRef.current) === null || _otherContentRef_current === void 0 ? void 0 : _otherContentRef_current.offsetHeight) ? 0 : otherContentRef === null || otherContentRef === void 0 ? void 0 : (_otherContentRef_current1 = otherContentRef.current) === null || _otherContentRef_current1 === void 0 ? void 0 : _otherContentRef_current1.offsetHeight;
|
|
22
|
+
const height = headRefHeight + filterRefHeight + otherHeadRefHeight + otherContentRefHeight + 56 + 16 + 60 + 50;
|
|
23
|
+
const offsetHeight = `calc(100vh - ${height}px)`;
|
|
24
|
+
setScrollY(offsetHeight);
|
|
25
|
+
setScrollConfig(_object_spread_props(_object_spread({}, props.scrollConfig), {
|
|
26
|
+
y: offsetHeight
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
const headRef = useRef(null);
|
|
30
|
+
const otherHeadRef = useRef(null);
|
|
31
|
+
const otherContentRef = useRef(null);
|
|
32
|
+
const filterRef = useRef(null);
|
|
33
|
+
useLayoutEffect(()=>{
|
|
34
|
+
windowChange();
|
|
35
|
+
}, []);
|
|
36
|
+
useLayoutEffect(()=>{
|
|
37
|
+
windowChange();
|
|
38
|
+
}, [
|
|
39
|
+
filterRef === null || filterRef === void 0 ? void 0 : (_filterRef_current = filterRef.current) === null || _filterRef_current === void 0 ? void 0 : _filterRef_current.offsetHeight,
|
|
40
|
+
headRef === null || headRef === void 0 ? void 0 : (_headRef_current = headRef.current) === null || _headRef_current === void 0 ? void 0 : _headRef_current.offsetHeight,
|
|
41
|
+
otherHeadRef === null || otherHeadRef === void 0 ? void 0 : (_otherHeadRef_current = otherHeadRef.current) === null || _otherHeadRef_current === void 0 ? void 0 : _otherHeadRef_current.offsetHeight,
|
|
42
|
+
otherContentRef === null || otherContentRef === void 0 ? void 0 : (_otherContentRef_current = otherContentRef.current) === null || _otherContentRef_current === void 0 ? void 0 : _otherContentRef_current.offsetHeight
|
|
43
|
+
]);
|
|
44
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
45
|
+
className: `${styles.bhd_app_layout} ${styles.className} ${className || ""}`,
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ _jsx("header", {
|
|
48
|
+
ref: headRef,
|
|
49
|
+
className: `${styles.bhd_app_layout_header} ${headerClassName || ""}`,
|
|
50
|
+
children: headConfig && /*#__PURE__*/ _jsx(TitleBar, _object_spread({}, headConfig))
|
|
51
|
+
}),
|
|
52
|
+
headContent && /*#__PURE__*/ _jsx("div", {
|
|
53
|
+
ref: otherHeadRef,
|
|
54
|
+
children: headContent
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ _jsxs("main", {
|
|
57
|
+
className: styles.bhd_app_layout_main,
|
|
58
|
+
children: [
|
|
59
|
+
(filterConfig === null || filterConfig === void 0 ? void 0 : filterConfig.filterArr) && filterConfig.filterArr.length ? /*#__PURE__*/ _jsxs("div", {
|
|
60
|
+
ref: filterRef,
|
|
61
|
+
className: styles.bhd_app_layout_main_filter,
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
64
|
+
className: styles.bhd_app_layout_main_filter_title,
|
|
65
|
+
children: [
|
|
66
|
+
i18Conversion("已筛选"),
|
|
67
|
+
":"
|
|
68
|
+
]
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ _jsx("ul", {
|
|
71
|
+
className: styles.bhd_app_layout_main_filter_ul,
|
|
72
|
+
children: filterConfig.filterArr.map((ele, index)=>{
|
|
73
|
+
return /*#__PURE__*/ _jsxs("li", {
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx("span", {
|
|
76
|
+
className: styles.bhd_app_layout_main_filter_show_title,
|
|
77
|
+
children: ele.title
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
80
|
+
className: styles.bhd_app_layout_main_filter_show_value,
|
|
81
|
+
children: [
|
|
82
|
+
"“",
|
|
83
|
+
ele.value,
|
|
84
|
+
"”"
|
|
85
|
+
]
|
|
86
|
+
}),
|
|
87
|
+
/*#__PURE__*/ _jsx("i", {
|
|
88
|
+
onClick: ()=>filterConfig && filterConfig.onClearSingle && filterConfig.onClearSingle(ele.id),
|
|
89
|
+
className: "iconfont iconicon_guanbi_Close"
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}, ele.id);
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ _jsx("div", {
|
|
96
|
+
onClick: filterConfig === null || filterConfig === void 0 ? void 0 : filterConfig.onClearAll,
|
|
97
|
+
className: styles.bhd_app_layout_main_filter_clear,
|
|
98
|
+
children: i18Conversion("清空条件")
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}) : null,
|
|
102
|
+
otherContent && /*#__PURE__*/ _jsx("div", {
|
|
103
|
+
ref: otherContentRef,
|
|
104
|
+
children: otherContent
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ _jsx("div", {
|
|
107
|
+
className: `${styles.bhd_app_layout_main_table} ${tableBoxClassName || ""}`,
|
|
108
|
+
children: scrollConfig ? tableConfig && /*#__PURE__*/ _jsx(BhdTableSimple, _object_spread_props(_object_spread({}, tableConfig), {
|
|
109
|
+
pagination: false,
|
|
110
|
+
scroll: _object_spread({}, scrollConfig)
|
|
111
|
+
})) : null
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
}),
|
|
115
|
+
footerConfig ? /*#__PURE__*/ _jsxs("footer", {
|
|
116
|
+
className: styles.bhd_app_layout_footer,
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ _jsx("div", {
|
|
119
|
+
children: (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.leftDom) && footerConfig.leftDom
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ _jsx(Pagination, _object_spread({}, footerConfig))
|
|
122
|
+
]
|
|
123
|
+
}) : null
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export default BhdAppLayout;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@import "../theme/variable.less";
|
|
2
|
+
.bhd_app_layout {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
height: calc(100vh - 60px);
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
:global {
|
|
8
|
+
}
|
|
9
|
+
.bhd_app_layout_header {
|
|
10
|
+
background: #FFFFFF;
|
|
11
|
+
padding: 12px 48px;
|
|
12
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
|
13
|
+
}
|
|
14
|
+
.bhd_app_layout_main {
|
|
15
|
+
flex: 1;
|
|
16
|
+
margin-bottom: 56px;
|
|
17
|
+
.bhd_app_layout_main_filter {
|
|
18
|
+
min-height: 40px;
|
|
19
|
+
background: rgba(0,0,0,0.02);
|
|
20
|
+
border-bottom: 1px solid rgba(0,0,0,0.06);
|
|
21
|
+
padding: 0 48px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
.bhd_app_layout_main_filter_title {
|
|
25
|
+
color: rgba(0, 0, 0, 0.65);
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
}
|
|
28
|
+
.bhd_app_layout_main_filter_ul {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
li:nth-of-type(1) {
|
|
32
|
+
margin-left: 0;
|
|
33
|
+
}
|
|
34
|
+
li {
|
|
35
|
+
margin-left: 8px;
|
|
36
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
37
|
+
border-radius: 2px;
|
|
38
|
+
height: 24px;
|
|
39
|
+
color: rgba(0, 0, 0, 0.65);
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
padding: 0 8px;
|
|
44
|
+
* {
|
|
45
|
+
line-height: 1;
|
|
46
|
+
}
|
|
47
|
+
.bhd_app_layout_main_filter_show_title {
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
.bhd_app_layout_main_filter_show_value {
|
|
51
|
+
margin-left: 4px;
|
|
52
|
+
margin-right: 8px;
|
|
53
|
+
}
|
|
54
|
+
:global {
|
|
55
|
+
.iconicon_guanbi_Close {
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
}
|
|
58
|
+
.iconicon_guanbi_Close:hover {
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.bhd_app_layout_main_filter_clear {
|
|
65
|
+
color: #F4523B;
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
margin-left: 8px;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.bhd_app_layout_main_table {
|
|
72
|
+
padding: 0 48px;
|
|
73
|
+
margin-top: 16px;
|
|
74
|
+
:global{
|
|
75
|
+
/* table 无数据,异常时 */
|
|
76
|
+
.app_BhdTableSimple_errorTable,.app_BhdTableSimple_noTable{
|
|
77
|
+
padding-top: 120px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
.bhd_app_layout_footer {
|
|
83
|
+
width: calc(100% - 60px);
|
|
84
|
+
height: 56px;
|
|
85
|
+
position: fixed;
|
|
86
|
+
z-index: 10;
|
|
87
|
+
bottom: 0;
|
|
88
|
+
display: flex;
|
|
89
|
+
background-color: #fff;
|
|
90
|
+
align-items: center;
|
|
91
|
+
padding: 0 48px;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
border-top: 1px solid rgba(0,0,0,0.15);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import { SelectProps } from "antd/lib/select/index";
|
|
3
|
+
interface BhdSelectProps extends SelectProps {
|
|
3
4
|
popupClassName?: string;
|
|
4
5
|
className?: string;
|
|
5
6
|
optionClassName?: string;
|
|
6
7
|
suffixIcon?: React.ReactNode;
|
|
7
8
|
children?: React.ReactNode | [React.ReactNode];
|
|
8
9
|
showSearch?: boolean;
|
|
9
|
-
dropdownRender?: (menu: React.ReactNode) =>
|
|
10
|
+
dropdownRender?: (menu: React.ReactNode) => any;
|
|
10
11
|
search_placeholder?: string;
|
|
11
12
|
select_title?: string;
|
|
12
13
|
search_label?: string;
|
|
13
14
|
mask?: boolean;
|
|
14
|
-
filterOption?: null | ((filterValue: string, item: React.ReactElement) => boolean) | boolean;
|
|
15
|
+
filterOption?: null | ((filterValue: string, item: React.ReactElement) => boolean) | boolean | any;
|
|
15
16
|
filterSort?: (a: any, b: any) => number;
|
|
16
17
|
onDropdownVisibleChange?: (open: boolean) => void;
|
|
17
18
|
onMouseEnter?: (e: React.MouseEvent) => void;
|
|
18
|
-
options:
|
|
19
|
-
value: React.Key;
|
|
20
|
-
disabled: boolean;
|
|
21
|
-
className: string;
|
|
22
|
-
title: string;
|
|
23
|
-
}[];
|
|
19
|
+
options: any;
|
|
24
20
|
arrowType?: string;
|
|
25
21
|
searchClassName?: string;
|
|
26
22
|
useType?: string;
|
|
27
23
|
listHeight?: number;
|
|
28
24
|
popupMatchSelectWidth?: number;
|
|
29
25
|
}
|
|
30
|
-
declare const BhdSelect:
|
|
26
|
+
declare const BhdSelect: {
|
|
27
|
+
(props: BhdSelectProps): React.JSX.Element;
|
|
28
|
+
Option: import("rc-select/lib/Option").OptionFC;
|
|
29
|
+
};
|
|
31
30
|
export default BhdSelect;
|