bhd-components 0.2.4 → 0.2.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/dist/ae211df8.esm.es5.production.js +256 -0
- package/dist/{88060020.esm.es5.development.js → d2be063c.esm.es5.development.js} +12492 -12945
- package/dist/table.esm.es5.development.js +10 -15
- package/dist/table.esm.es5.production.js +1 -1
- package/es2017/message/index.js +21 -15
- package/es2017/pagination/index.d.ts +2 -2
- package/es2017/pagination/index.js +2 -2
- package/es2017/provider/index.d.ts +3 -3
- package/es2017/provider/index.js +4 -4
- package/es2017/table/index.d.ts +2 -2
- package/es2017/table/index.js +56 -29
- package/es2017/tableSelect/index.d.ts +2 -2
- package/es2017/tableSelect/index.js +2 -2
- package/es2017/textTootip/index.d.ts +2 -2
- package/es2017/textTootip/index.js +12 -6
- package/es2017/titleBar/index.d.ts +8 -3
- package/es2017/titleBar/index.js +47 -16
- package/es2017/titleBar/index.module.less +3 -0
- package/es2017/utils/object.js +17 -5
- package/es2017/viewImage/index.d.ts +2 -2
- package/es2017/viewImage/index.js +16 -4
- package/esm/message/index.js +21 -15
- package/esm/pagination/index.d.ts +2 -2
- package/esm/pagination/index.js +2 -2
- package/esm/provider/index.d.ts +3 -3
- package/esm/provider/index.js +4 -4
- package/esm/table/index.d.ts +2 -2
- package/esm/table/index.js +59 -32
- package/esm/tableSelect/index.d.ts +2 -2
- package/esm/tableSelect/index.js +2 -2
- package/esm/textTootip/index.d.ts +2 -2
- package/esm/textTootip/index.js +13 -7
- package/esm/titleBar/index.d.ts +8 -3
- package/esm/titleBar/index.js +48 -16
- package/esm/titleBar/index.module.less +3 -0
- package/esm/utils/object.js +18 -6
- package/esm/viewImage/index.d.ts +2 -2
- package/esm/viewImage/index.js +17 -5
- package/package.json +2 -2
- package/dist/e40d2239.esm.es5.production.js +0 -228
- package/es2017/table/index22.d.ts +0 -12
- package/es2017/table/index22.js +0 -159
- package/esm/table/index22.d.ts +0 -12
- package/esm/table/index22.js +0 -162
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import 'core-js/modules/es.array.map.js';
|
|
3
|
-
import 'core-js/modules/es.regexp.test.js';
|
|
4
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
5
|
-
import 'core-js/modules/es.string.fixed.js';
|
|
6
|
-
import 'core-js/modules/es.array.concat.js';
|
|
1
|
+
import { _ as _sliced_to_array, j as jsx, a as _object_spread_props, b as _object_spread, T as Tooltip, c as Table$1 } from './d2be063c.esm.es5.development.js';
|
|
7
2
|
import { useState, useRef, useEffect } from 'react';
|
|
8
3
|
import 'react/jsx-runtime';
|
|
9
4
|
import 'react-dom';
|
|
@@ -26,7 +21,7 @@ var getTextSize = function(str) {
|
|
|
26
21
|
};
|
|
27
22
|
var TextTootip = function(props) {
|
|
28
23
|
var children = props.children, title = props.title, width = props.width;
|
|
29
|
-
var _useState =
|
|
24
|
+
var _useState = _sliced_to_array(useState(false), 2), open = _useState[0], setOpen = _useState[1];
|
|
30
25
|
var mouseEnter = function(e) {
|
|
31
26
|
var w = 0;
|
|
32
27
|
if (typeof width === "function") {
|
|
@@ -43,7 +38,7 @@ var TextTootip = function(props) {
|
|
|
43
38
|
var mouseLeave = function() {
|
|
44
39
|
setOpen(false);
|
|
45
40
|
};
|
|
46
|
-
return /*#__PURE__*/ jsx(Tooltip,
|
|
41
|
+
return /*#__PURE__*/ jsx(Tooltip, _object_spread_props(_object_spread({}, props), {
|
|
47
42
|
open: open,
|
|
48
43
|
children: /*#__PURE__*/ jsx("span", {
|
|
49
44
|
onMouseEnter: mouseEnter,
|
|
@@ -89,8 +84,8 @@ var Table = function(props) {
|
|
|
89
84
|
240,
|
|
90
85
|
320
|
|
91
86
|
] : _props_defaultWidthRang, _props_isFixedLeft = props.isFixedLeft, isFixedLeft = _props_isFixedLeft === void 0 ? true : _props_isFixedLeft, _props_isFixedRight = props.isFixedRight, isFixedRight = _props_isFixedRight === void 0 ? true : _props_isFixedRight, _props_bordered = props.bordered, bordered = _props_bordered === void 0 ? false : _props_bordered, kind = props.kind;
|
|
92
|
-
var _useState =
|
|
93
|
-
var _useState1 =
|
|
87
|
+
var _useState = _sliced_to_array(useState(props.columns || []), 2), columns = _useState[0], setColumns = _useState[1];
|
|
88
|
+
var _useState1 = _sliced_to_array(useState(props.scroll || undefined), 2), scrollObject = _useState1[0], setScrollObject = _useState1[1];
|
|
94
89
|
var columnTootipClassName = props.columnTootipClassName, columnTootipColor = props.columnTootipColor;
|
|
95
90
|
var initColumns = function() {
|
|
96
91
|
var scrollBarDom = tableRef.current.getElementsByClassName("bhd-table-cell-scrollbar")[0];
|
|
@@ -100,7 +95,7 @@ var Table = function(props) {
|
|
|
100
95
|
var _initColumnsWidth = initColumnsWidth(props.columns, tableWidth), selfColumns = _initColumnsWidth.columns;
|
|
101
96
|
setColumns(selfColumns);
|
|
102
97
|
var obj = scrollObject ? scrollObject : {};
|
|
103
|
-
obj =
|
|
98
|
+
obj = _object_spread_props(_object_spread({}, obj), {
|
|
104
99
|
x: tableWidth
|
|
105
100
|
});
|
|
106
101
|
setScrollObject(obj);
|
|
@@ -213,8 +208,8 @@ var Table = function(props) {
|
|
|
213
208
|
item.onCell = function(record, rowIndex) {
|
|
214
209
|
var obj = typeof item.onColumnCell === "function" ? item.onColumnCell(record, rowIndex) : {};
|
|
215
210
|
obj.style = obj.style ? obj.style : {};
|
|
216
|
-
return
|
|
217
|
-
style:
|
|
211
|
+
return _object_spread_props(_object_spread({}, obj), {
|
|
212
|
+
style: _object_spread({
|
|
218
213
|
maxWidth: item.width + "px"
|
|
219
214
|
}, obj.style)
|
|
220
215
|
});
|
|
@@ -245,7 +240,7 @@ var Table = function(props) {
|
|
|
245
240
|
}, [
|
|
246
241
|
props.columns
|
|
247
242
|
]);
|
|
248
|
-
var config =
|
|
243
|
+
var config = _object_spread_props(_object_spread({
|
|
249
244
|
bordered: false
|
|
250
245
|
}, props), {
|
|
251
246
|
columns: columns,
|
|
@@ -256,7 +251,7 @@ var Table = function(props) {
|
|
|
256
251
|
return /*#__PURE__*/ jsx("div", {
|
|
257
252
|
className: "".concat(modules_63b47c51.Table, " ").concat(kind === "simple" ? modules_63b47c51.SmallTable : ""),
|
|
258
253
|
ref: tableRef,
|
|
259
|
-
children: /*#__PURE__*/ jsx(Table$1,
|
|
254
|
+
children: /*#__PURE__*/ jsx(Table$1, _object_spread({}, config))
|
|
260
255
|
});
|
|
261
256
|
};
|
|
262
257
|
Table.SELECTION_COLUMN = Table$1.SELECTION_COLUMN;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,j as e,a as n,b as o,T as i,c as r}from"./
|
|
1
|
+
import{_ as t,j as e,a as n,b as o,T as i,c as r}from"./ae211df8.esm.es5.production.js";import{useState as l,useRef as a,useEffect as d}from"react";import"react/jsx-runtime";import"react-dom";var u={Table:"index_module_Table__5278674b",SmallTable:"index_module_SmallTable__5278674b",columnTootipClassName:"index_module_columnTootipClassName__5278674b"},c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:14,n=0,o=document.createElement("div");return o.style.position="absolute",o.style.whiteSpace="nowrap",o.style.fontSize=e+"px",o.style.opacity="0",o.innerText=t,document.body.append(o),n=o.getBoundingClientRect().width,document.body.removeChild(o),n},s=function(r){var a=r.children,d=r.title,u=r.width,s=t(l(!1),2),m=s[0],h=s[1];return e(i,n(o({},r),{open:m,children:e("span",{onMouseEnter:function(t){var e=0;(e="function"==typeof u?u(t):u)?h(!(c(d)<e)):h(!0)},onMouseLeave:function(){h(!1)},children:a})}))},m=/^\d+%$/,h=/^\d+px$/,w=function(t){var e={};return parseFloat((e=window.getComputedStyle?getComputedStyle(t,null):t.currentStyle)["padding-left"])+parseFloat(e["padding-right"])},f=function(t){try{for(;t&&"TD"!==t.nodeName;)t=t.parentElement;var e=w(t);return t.clientWidth-e}catch(t){return null}},p=function(i){var c=a(null),w=a({timer:null}),p=i.defaultWidthRang,C=void 0===p?[180,240,320]:p,g=i.isFixedLeft,v=void 0===g||g,T=i.isFixedRight,E=void 0===T||T,N=i.bordered,_=void 0!==N&&N,y=i.kind,b=t(l(i.columns||[]),2),L=b[0],x=b[1],S=t(l(i.scroll||void 0),2),R=S[0],O=S[1],F=i.columnTootipClassName,I=i.columnTootipColor,W=function(){var t=c.current.getElementsByClassName("bhd-table-cell-scrollbar")[0],e=t?t.clientWidth:0,r=_?c.current.offsetWidth-2-e:c.current.offsetWidth-e;console.log("gaodug",e);var l=M(i.columns,r).columns;x(l);var a=R||{};a=n(o({},a),{x:r}),O(a)},M=function(t,i){var r=0,l=0,a=0;t=t.map(function(t){return t.width=t.width||"auto",m.test(t.width)?t.width=parseFloat(t.width)>=100?"auto":i*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=C),l+=t.widthRang[0],a+=t.widthRang[1]):(l+=t.width,a+=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 f(t.target)},title:t,trigger:"hover",overlayClassName:F||u.columnTootipClassName,color:I||"#FFF",children:e("span",{children:t})})}),t});var d=i-l;if(d>0){var c=0;t=(t=t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]+d/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=d<0?t.map(function(e,n){return v&&0===n&&(e.fixed="left"),E&&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,i){var r="function"==typeof t.onColumnCell?t.onColumnCell(e,i):{};return r.style=r.style?r.style:{},n(o({},r),{style:o({maxWidth:t.width+"px"},r.style)})},t}),{columns:t,scrollWidth:a}},A=function(){clearTimeout(w.current.timer),w.current.timer=setTimeout(function(){W()},1e3)};d(function(){return W(),window.addEventListener("resize",A),function(){clearTimeout(w.current.timer),window.removeEventListener("resize",A)}},[i.columns]);var U=n(o({bordered:!1},i),{columns:L,scroll:R||{x:"auto"}});return e("div",{className:"".concat(u.Table," ").concat("simple"===y?u.SmallTable:""),ref:c,children:e(r,o({},U))})};p.SELECTION_COLUMN=r.SELECTION_COLUMN,p.EXPAND_COLUMN=r.EXPAND_COLUMN,p.SELECTION_ALL=r.SELECTION_ALL,p.SELECTION_INVERT=r.SELECTION_INVERT,p.SELECTION_NONE=r.SELECTION_NONE,p.Column=r.Column,p.ColumnGroup=r.ColumnGroup;export{p as default};
|
package/es2017/message/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
2
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import styles from "./index.module.less";
|
|
@@ -8,31 +8,37 @@ import { ExclamationCircleFilled } from "../icons/index";
|
|
|
8
8
|
const BhdMessage = _object_spread_props(_object_spread({}, message), {
|
|
9
9
|
customSuccess: (config)=>{
|
|
10
10
|
let className = styles.customSuccess;
|
|
11
|
-
if (typeof config === "string")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if (typeof config === "string") {
|
|
12
|
+
return message.success({
|
|
13
|
+
content: config,
|
|
14
|
+
className
|
|
15
|
+
});
|
|
16
|
+
}
|
|
15
17
|
return message.success(_object_spread_props(_object_spread({}, config), {
|
|
16
18
|
className: `${className} ${config.className || ""}`
|
|
17
19
|
}));
|
|
18
20
|
},
|
|
19
21
|
customWarning: (config)=>{
|
|
20
22
|
let className = styles.customWarning;
|
|
21
|
-
if (typeof config === "string")
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (typeof config === "string") {
|
|
24
|
+
return message.warning({
|
|
25
|
+
content: config,
|
|
26
|
+
className
|
|
27
|
+
});
|
|
28
|
+
}
|
|
25
29
|
return message.warning(_object_spread_props(_object_spread({}, config), {
|
|
26
30
|
className: `${className} ${config.className || ""}`
|
|
27
31
|
}));
|
|
28
32
|
},
|
|
29
33
|
customError: (config)=>{
|
|
30
34
|
let className = styles.customError;
|
|
31
|
-
if (typeof config === "string")
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
if (typeof config === "string") {
|
|
36
|
+
return message.error({
|
|
37
|
+
content: config,
|
|
38
|
+
className,
|
|
39
|
+
icon: /*#__PURE__*/ _jsx(ExclamationCircleFilled, {})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
36
42
|
return message.error(_object_spread_props(_object_spread({}, config), {
|
|
37
43
|
className: `${className} ${config.className || ""}`,
|
|
38
44
|
icon: config.icon || /*#__PURE__*/ _jsx(ExclamationCircleFilled, {})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import type { PaginationProps } from "antd/es/pagination";
|
|
3
|
-
declare const BhdPagination: (props: PaginationProps) => JSX.Element;
|
|
3
|
+
declare const BhdPagination: (props: PaginationProps) => React.JSX.Element;
|
|
4
4
|
export default BhdPagination;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
2
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import styles from "./index.module.less";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
declare const Provider: {
|
|
3
|
-
(Component: any, customConfig?: {}): ({ ...props }: any) => JSX.Element;
|
|
4
|
-
Component(props: any): JSX.Element;
|
|
3
|
+
(Component: any, customConfig?: {}): ({ ...props }: any) => React.JSX.Element;
|
|
4
|
+
Component(props: any): React.JSX.Element;
|
|
5
5
|
};
|
|
6
6
|
export default Provider;
|
package/es2017/provider/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _extends from "@swc/helpers/
|
|
2
|
-
import _object_destructuring_empty from "@swc/helpers/
|
|
3
|
-
import _object_spread from "@swc/helpers/
|
|
4
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty";
|
|
3
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
4
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
5
5
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { ConfigProvider } from "antd";
|
package/es2017/table/index.d.ts
CHANGED
package/es2017/table/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
2
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { useState, useEffect, useRef } from "react";
|
|
@@ -10,14 +10,19 @@ const widthPercentage = /^\d+%$/;
|
|
|
10
10
|
const widthPx = /^\d+px$/;
|
|
11
11
|
/* 获取元素的宽度 */ const getElementPadding = (node)=>{
|
|
12
12
|
let computedStyle = {};
|
|
13
|
-
if (window.getComputedStyle)
|
|
14
|
-
|
|
13
|
+
if (window.getComputedStyle) {
|
|
14
|
+
computedStyle = getComputedStyle(node, null);
|
|
15
|
+
} else {
|
|
16
|
+
computedStyle = node.currentStyle; //兼容IE的写法
|
|
17
|
+
}
|
|
15
18
|
return parseFloat(computedStyle["padding-left"]) + parseFloat(computedStyle["padding-right"]);
|
|
16
19
|
};
|
|
17
20
|
//获取宽度
|
|
18
21
|
const getParentWidth = (node)=>{
|
|
19
22
|
try {
|
|
20
|
-
while(node && node.nodeName !== "TD")
|
|
23
|
+
while(node && node.nodeName !== "TD"){
|
|
24
|
+
node = node.parentElement;
|
|
25
|
+
}
|
|
21
26
|
let padding = getElementPadding(node);
|
|
22
27
|
return node.clientWidth - padding;
|
|
23
28
|
} catch (error) {
|
|
@@ -59,25 +64,34 @@ const Table = (props)=>{
|
|
|
59
64
|
columns = columns.map((item)=>{
|
|
60
65
|
item.width = item.width || "auto";
|
|
61
66
|
// item.width=parseFloat(item.width)
|
|
62
|
-
if (widthPercentage.test(item.width))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
item.width
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
else
|
|
69
|
-
|
|
67
|
+
if (widthPercentage.test(item.width)) {
|
|
68
|
+
//检测到宽度为百分比 则转换为具体px 如大于100% 则视为自适应
|
|
69
|
+
item.width = parseFloat(item.width) >= 100 ? "auto" : tableWidth * parseFloat(item.width) / 100;
|
|
70
|
+
} else if (typeof item.width === "number") {
|
|
71
|
+
//检测为number 则为具体的像素值
|
|
72
|
+
item.width = item.width;
|
|
73
|
+
} else if (widthPx.test(item.width)) {
|
|
74
|
+
//检测为 "12px" 则为具体的值
|
|
75
|
+
item.width = parseFloat(item.width);
|
|
76
|
+
} else {
|
|
77
|
+
//其它为auto
|
|
78
|
+
item.width = "auto";
|
|
79
|
+
}
|
|
70
80
|
if (item.width === "auto") {
|
|
71
81
|
autoNum += 1;
|
|
72
|
-
if (!item.widthRang)
|
|
73
|
-
|
|
82
|
+
if (!item.widthRang) {
|
|
83
|
+
//没有设置自适应区间的 走默认区间
|
|
84
|
+
item.widthRang = defaultWidthRang;
|
|
85
|
+
}
|
|
74
86
|
minWidth += item.widthRang[0];
|
|
75
87
|
scrollWidth += item.widthRang[1];
|
|
76
88
|
} else {
|
|
77
89
|
minWidth += item.width;
|
|
78
90
|
scrollWidth += item.width;
|
|
79
91
|
}
|
|
80
|
-
if (!item.onColumnCell)
|
|
92
|
+
if (!item.onColumnCell) {
|
|
93
|
+
item.onColumnCell = item.onCell || (()=>({}));
|
|
94
|
+
}
|
|
81
95
|
if (!item.render) {
|
|
82
96
|
item.ellipsis = {
|
|
83
97
|
showTitle: false
|
|
@@ -115,21 +129,34 @@ const Table = (props)=>{
|
|
|
115
129
|
});
|
|
116
130
|
columns = columns.map((item, index)=>{
|
|
117
131
|
//存在适应自适应列侯 多余宽度 则平均分配每一列(除最后一列)
|
|
118
|
-
if (avgWidth > 0 && index !== columns.length - 1)
|
|
132
|
+
if (avgWidth > 0 && index !== columns.length - 1) {
|
|
133
|
+
item.width += avgWidth / columns.length - 1;
|
|
134
|
+
}
|
|
119
135
|
return item;
|
|
120
136
|
});
|
|
121
|
-
} else if (diff < 0)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
} else if (diff < 0) {
|
|
138
|
+
//宽度不足 自适应列取最佳宽度 并出现滚动条 且第一列 最后一列 固定
|
|
139
|
+
columns = columns.map((item, index)=>{
|
|
140
|
+
if (isFixedLeft && index === 0) {
|
|
141
|
+
item.fixed = "left";
|
|
142
|
+
}
|
|
143
|
+
if (isFixedRight && index === columns.length - 1) {
|
|
144
|
+
item.fixed = "right";
|
|
145
|
+
}
|
|
146
|
+
if (item.width === "auto") {
|
|
147
|
+
item.width = item.widthRang[1];
|
|
148
|
+
}
|
|
149
|
+
return item;
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
// 相等 自适应列取最小宽度
|
|
153
|
+
columns = columns.map((item)=>{
|
|
154
|
+
if (item.width === "auto") {
|
|
155
|
+
item.width = item.widthRang[0];
|
|
156
|
+
}
|
|
157
|
+
return item;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
133
160
|
columns.map((item)=>{
|
|
134
161
|
item.onCell = (record, rowIndex)=>{
|
|
135
162
|
let obj = typeof item.onColumnCell === "function" ? item.onColumnCell(record, rowIndex) : {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const BhdTableSelect: (props: any) => JSX.Element;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const BhdTableSelect: (props: any) => React.JSX.Element;
|
|
3
3
|
export default BhdTableSelect;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: xiazhi
|
|
3
3
|
* @Date: 2023-06-06 14:37:48
|
|
4
|
-
*/ import _object_spread from "@swc/helpers/
|
|
5
|
-
import _object_spread_props from "@swc/helpers/
|
|
4
|
+
*/ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
5
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
6
6
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { useRef } from "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import type { TooltipProps } from "antd/es/tooltip";
|
|
3
3
|
type TextTootipProps = TooltipProps & {
|
|
4
4
|
children: any;
|
|
5
5
|
width?: number | Function;
|
|
6
6
|
title: string;
|
|
7
7
|
};
|
|
8
|
-
declare const TextTootip: (props: TextTootipProps) => JSX.Element;
|
|
8
|
+
declare const TextTootip: (props: TextTootipProps) => React.JSX.Element;
|
|
9
9
|
export default TextTootip;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
2
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { useState } from "react";
|
|
@@ -22,10 +22,16 @@ const TextTootip = (props)=>{
|
|
|
22
22
|
const [open, setOpen] = useState(false);
|
|
23
23
|
const mouseEnter = (e)=>{
|
|
24
24
|
let w = 0;
|
|
25
|
-
if (typeof width === "function")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (typeof width === "function") {
|
|
26
|
+
w = width(e);
|
|
27
|
+
} else {
|
|
28
|
+
w = width;
|
|
29
|
+
}
|
|
30
|
+
if (!w) {
|
|
31
|
+
setOpen(true);
|
|
32
|
+
} else {
|
|
33
|
+
setOpen(getTextSize(title) < w ? false : true);
|
|
34
|
+
}
|
|
29
35
|
};
|
|
30
36
|
const mouseLeave = ()=>{
|
|
31
37
|
setOpen(false);
|
|
@@ -3,9 +3,14 @@ interface TitleBarProps {
|
|
|
3
3
|
title?: React.ReactElement;
|
|
4
4
|
leftIcon?: React.ReactElement;
|
|
5
5
|
subTitle?: React.ReactElement;
|
|
6
|
-
rightContent: () => React.ReactElement;
|
|
7
|
-
wrapClassName?: string;
|
|
6
|
+
rightContent: (kind?: string) => React.ReactElement;
|
|
8
7
|
rightMaxWidth?: number;
|
|
8
|
+
wrapClassName?: string;
|
|
9
|
+
leftIconClassName?: string;
|
|
10
|
+
leftTitleClassName?: string;
|
|
11
|
+
leftSubTitleClassName?: string;
|
|
12
|
+
rightClassName?: string;
|
|
13
|
+
leftClassName?: string;
|
|
9
14
|
}
|
|
10
|
-
declare const TitleBar: (props: TitleBarProps) => JSX.Element;
|
|
15
|
+
declare const TitleBar: (props: TitleBarProps) => React.JSX.Element;
|
|
11
16
|
export default TitleBar;
|
package/es2017/titleBar/index.js
CHANGED
|
@@ -1,40 +1,70 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
// import {render} from "react-dom";
|
|
5
|
-
import { createRoot } from "react-dom";
|
|
3
|
+
import { useState, useEffect, useLayoutEffect, useRef } from "react";
|
|
6
4
|
import styles from "./index.module.less";
|
|
7
5
|
const TitleBar = (props)=>{
|
|
8
|
-
let { title , leftIcon , subTitle , rightContent , wrapClassName ="" , rightMaxWidth =45 } = props;
|
|
9
|
-
useRef(null);
|
|
6
|
+
let { title , leftIcon , subTitle , rightContent , wrapClassName ="" , rightMaxWidth =45 , leftIconClassName ="" , leftTitleClassName ="" , leftSubTitleClassName ="" , rightClassName ="" , leftClassName ="" } = props;
|
|
7
|
+
const titleBarRef = useRef(null);
|
|
8
|
+
const rightContentRef = useRef(null);
|
|
9
|
+
const [kind, setKind] = useState("screen"); //"screen" 全展示 minScreen:小屏展示
|
|
10
|
+
const [screenWidth, setScreenWidth] = useState(0); //screen下的宽度
|
|
10
11
|
const renderRightContent = ()=>{
|
|
11
|
-
const dom = rightContent();
|
|
12
|
-
let div = document.createElement("div");
|
|
13
|
-
let root = createRoot(div);
|
|
14
|
-
root.render(dom);
|
|
15
|
-
console.log("rootroot", root, div.clientWidth);
|
|
12
|
+
const dom = rightContent(kind);
|
|
16
13
|
return dom;
|
|
17
14
|
};
|
|
18
|
-
|
|
15
|
+
// const onResize = useCallback(, [screenWidth]);
|
|
16
|
+
const onResize = ()=>{
|
|
17
|
+
const { width } = titleBarRef.current.getBoundingClientRect();
|
|
18
|
+
const maxWidth = width * rightMaxWidth / 100;
|
|
19
|
+
console.log("resize", maxWidth, screenWidth);
|
|
20
|
+
if (screenWidth > maxWidth) {
|
|
21
|
+
// kind minScreen
|
|
22
|
+
setKind("minScreen");
|
|
23
|
+
} else {
|
|
24
|
+
setKind("screen");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
useLayoutEffect(()=>{
|
|
28
|
+
const { width } = titleBarRef.current.getBoundingClientRect();
|
|
29
|
+
const maxWidth = width * rightMaxWidth / 100;
|
|
30
|
+
const rightWidth = rightContentRef.current.getBoundingClientRect().width;
|
|
31
|
+
setScreenWidth(rightWidth);
|
|
32
|
+
console.log("rightWidthrightWidth", rightWidth, maxWidth);
|
|
33
|
+
if (rightWidth > maxWidth) {
|
|
34
|
+
// kind minScreen
|
|
35
|
+
setKind("minScreen");
|
|
36
|
+
} else {
|
|
37
|
+
setKind("screen");
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
useEffect(()=>{
|
|
41
|
+
window.addEventListener("resize", onResize);
|
|
42
|
+
return ()=>{
|
|
43
|
+
window.removeEventListener("resize", onResize);
|
|
44
|
+
};
|
|
45
|
+
}, [
|
|
46
|
+
screenWidth
|
|
47
|
+
]);
|
|
19
48
|
return /*#__PURE__*/ _jsxs("div", {
|
|
20
49
|
className: `${styles.titleBar} ${wrapClassName}`,
|
|
50
|
+
ref: titleBarRef,
|
|
21
51
|
children: [
|
|
22
52
|
/*#__PURE__*/ _jsxs("div", {
|
|
23
|
-
className: styles.left
|
|
53
|
+
className: `${styles.left} ${leftClassName}`,
|
|
24
54
|
children: [
|
|
25
55
|
leftIcon && /*#__PURE__*/ _jsx("div", {
|
|
26
|
-
className: styles.leftIcon
|
|
56
|
+
className: `${styles.leftIcon} ${leftIconClassName}`,
|
|
27
57
|
children: leftIcon
|
|
28
58
|
}),
|
|
29
59
|
/*#__PURE__*/ _jsxs("div", {
|
|
30
60
|
className: styles.leftContent,
|
|
31
61
|
children: [
|
|
32
62
|
/*#__PURE__*/ _jsx("div", {
|
|
33
|
-
className: styles.leftTitle
|
|
63
|
+
className: `${styles.leftTitle} ${leftTitleClassName}`,
|
|
34
64
|
children: title
|
|
35
65
|
}),
|
|
36
66
|
subTitle && /*#__PURE__*/ _jsx("div", {
|
|
37
|
-
className: styles.leftSubTitle
|
|
67
|
+
className: `${styles.leftSubTitle} ${leftSubTitleClassName}`,
|
|
38
68
|
children: subTitle
|
|
39
69
|
})
|
|
40
70
|
]
|
|
@@ -42,7 +72,8 @@ const TitleBar = (props)=>{
|
|
|
42
72
|
]
|
|
43
73
|
}),
|
|
44
74
|
rightContent && /*#__PURE__*/ _jsx("div", {
|
|
45
|
-
className: styles.right
|
|
75
|
+
className: `${styles.right} ${rightClassName}`,
|
|
76
|
+
ref: rightContentRef,
|
|
46
77
|
children: renderRightContent()
|
|
47
78
|
})
|
|
48
79
|
]
|
package/es2017/utils/object.js
CHANGED
|
@@ -11,16 +11,28 @@ const cloneDeep = (obj)=>{
|
|
|
11
11
|
return new Function("return " + func)();
|
|
12
12
|
}
|
|
13
13
|
// 处理正则
|
|
14
|
-
if (obj instanceof RegExp)
|
|
14
|
+
if (obj instanceof RegExp) {
|
|
15
|
+
return new RegExp(obj);
|
|
16
|
+
}
|
|
15
17
|
// 处理Set对象
|
|
16
|
-
if (obj instanceof Set)
|
|
18
|
+
if (obj instanceof Set) {
|
|
19
|
+
return new Set(obj);
|
|
20
|
+
}
|
|
17
21
|
// 处理Map对象
|
|
18
|
-
if (obj instanceof Map)
|
|
22
|
+
if (obj instanceof Map) {
|
|
23
|
+
return new Map(obj);
|
|
24
|
+
}
|
|
19
25
|
// 处理日期
|
|
20
|
-
if (obj instanceof Date)
|
|
26
|
+
if (obj instanceof Date) {
|
|
27
|
+
return new Date(obj);
|
|
28
|
+
}
|
|
21
29
|
// 用被克隆对象的构造函数创建一个实例,这样克隆出来的对象也是那个构造函数的实例,保持相同的所属类
|
|
22
30
|
let newObj = new obj.constructor();
|
|
23
|
-
for(let key in obj)
|
|
31
|
+
for(let key in obj){
|
|
32
|
+
if (obj.hasOwnProperty(key)) {
|
|
33
|
+
newObj[key] = cloneDeep(obj[key]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
24
36
|
return newObj;
|
|
25
37
|
};
|
|
26
38
|
export { cloneDeep };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const AppViewImage: (props: any) => JSX.Element;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const AppViewImage: (props: any) => React.JSX.Element;
|
|
3
3
|
export default AppViewImage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/
|
|
2
|
-
import _object_spread_props from "@swc/helpers/
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { useState, useEffect, useImperativeHandle, useRef } from "react";
|
|
@@ -19,6 +19,15 @@ const ViewImage = (props)=>{
|
|
|
19
19
|
const [imgError, setImgError] = useState(false); //图片是否加载出错
|
|
20
20
|
const event_contextmenu = ()=>false;
|
|
21
21
|
const getSrc = ()=>{};
|
|
22
|
+
const scaleChange = (value)=>{
|
|
23
|
+
if (value >= maxScale) {
|
|
24
|
+
value = maxScale;
|
|
25
|
+
}
|
|
26
|
+
if (value <= minScale) {
|
|
27
|
+
value = minScale;
|
|
28
|
+
}
|
|
29
|
+
setScaleValue(value);
|
|
30
|
+
};
|
|
22
31
|
const rotate = ()=>{};
|
|
23
32
|
const downloadUrl = ()=>{};
|
|
24
33
|
const close = ()=>{};
|
|
@@ -37,8 +46,11 @@ const ViewImage = (props)=>{
|
|
|
37
46
|
// }
|
|
38
47
|
};
|
|
39
48
|
useEffect(()=>{
|
|
40
|
-
if (multiSelect)
|
|
41
|
-
|
|
49
|
+
if (multiSelect) {
|
|
50
|
+
getSrc(0);
|
|
51
|
+
} else {
|
|
52
|
+
getSrc();
|
|
53
|
+
}
|
|
42
54
|
document.addEventListener("contextmenu", event_contextmenu);
|
|
43
55
|
return ()=>{
|
|
44
56
|
document.removeEventListener("contextmenu", event_contextmenu);
|