bhd-components 0.1.2 → 0.1.5

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.
@@ -1,3 +1,64 @@
1
- .Table{
2
-
3
- }
1
+ .Table {
2
+ width: 100%;
3
+ :global {
4
+ table {
5
+ th,
6
+ td {
7
+ border: none;
8
+ border-bottom: 1px solid #e8e8e8;
9
+ }
10
+ thead {
11
+ tr {
12
+ th {
13
+ &:nth-child(1){
14
+ padding-left: 40px;
15
+ }
16
+ &:last-child{
17
+ padding-right: 40px;
18
+ }
19
+ background: #fafafa;
20
+ &::before {
21
+ display: none;
22
+ }
23
+ }
24
+ }
25
+ }
26
+ tbody {
27
+ tr {
28
+ background: transparent;
29
+ &:hover {
30
+ td {
31
+
32
+ // background-color: rgba(244, 82, 59, 0.1) !important;
33
+ background-color: #FFEEEB !important;
34
+ }
35
+ }
36
+ td {
37
+ word-wrap: break-word;
38
+ word-break: break-all;
39
+ overflow: hidden;
40
+ white-space: nowrap;
41
+ text-overflow: ellipsis;
42
+ &:nth-child(1){
43
+ padding-left: 40px;
44
+ }
45
+ &:last-child{
46
+ padding-right: 40px;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ .columnTootipClassName{
56
+ :global{
57
+ .bhd-tooltip-content{
58
+ .bhd-tooltip-inner{
59
+ color: rgba(0,0,0,0.85);
60
+ word-break: break-all;
61
+ }
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { TooltipProps } from 'antd/es/tooltip';
3
+ type TextTootipProps = TooltipProps & {
4
+ children: any;
5
+ width?: number;
6
+ title: any;
7
+ };
8
+ declare const TextTootip: (props: TextTootipProps) => JSX.Element;
9
+ export default TextTootip;
@@ -0,0 +1,42 @@
1
+ import _object_spread from "@swc/helpers/src/_object_spread.mjs";
2
+ import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
3
+ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
4
+ import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
5
+ import * as React from "react";
6
+ import { useState } from "react";
7
+ import { Tooltip } from "antd";
8
+ var getTextSize = function(str) {
9
+ var fontSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 14;
10
+ var result = 0;
11
+ var ele = document.createElement("div");
12
+ ele.style.position = "absolute";
13
+ ele.style.whiteSpace = "nowrap";
14
+ ele.style.fontSize = fontSize + "px";
15
+ ele.style.opacity = "0";
16
+ ele.innerText = str;
17
+ document.body.append(ele);
18
+ result = ele.getBoundingClientRect().width;
19
+ document.body.removeChild(ele);
20
+ return result;
21
+ };
22
+ var TextTootip = function(props) {
23
+ var children = props.children, width = props.width, title = props.title;
24
+ var _useState = _sliced_to_array(useState(false), 2), open = _useState[0], setOpen = _useState[1];
25
+ var mouseEnter = function() {
26
+ if (!width) setOpen(true);
27
+ else //存在width
28
+ setOpen(getTextSize(title) < width ? false : true);
29
+ };
30
+ var mouseLeave = function() {
31
+ setOpen(false);
32
+ };
33
+ return /*#__PURE__*/ _jsx(Tooltip, _object_spread_props(_object_spread({}, props), {
34
+ open: open,
35
+ children: /*#__PURE__*/ _jsx("span", {
36
+ onMouseEnter: mouseEnter,
37
+ onMouseLeave: mouseLeave,
38
+ children: children
39
+ })
40
+ }));
41
+ };
42
+ export default TextTootip;
File without changes
@@ -0,0 +1,2 @@
1
+ declare const cloneDeep: (obj: any) => any;
2
+ export { cloneDeep };
@@ -0,0 +1,27 @@
1
+ import _instanceof from "@swc/helpers/src/_instanceof.mjs";
2
+ var cloneDeep = function(obj) {
3
+ // 处理null
4
+ if (obj === null) return null;
5
+ // 处理原始值
6
+ if (typeof obj != "object" && typeof obj != "function") return obj;
7
+ // 处理函数
8
+ if (typeof obj === "function") {
9
+ var func = obj + "";
10
+ // 返回匿名函数
11
+ // new Function('...')() 直接执行引号中的内容,与eval
12
+ return new Function("return " + func)();
13
+ }
14
+ // 处理正则
15
+ if (_instanceof(obj, RegExp)) return new RegExp(obj);
16
+ // 处理Set对象
17
+ if (_instanceof(obj, Set)) return new Set(obj);
18
+ // 处理Map对象
19
+ if (_instanceof(obj, Map)) return new Map(obj);
20
+ // 处理日期
21
+ if (_instanceof(obj, Date)) return new Date(obj);
22
+ // 用被克隆对象的构造函数创建一个实例,这样克隆出来的对象也是那个构造函数的实例,保持相同的所属类
23
+ var newObj = new obj.constructor();
24
+ for(var key in obj)if (obj.hasOwnProperty(key)) newObj[key] = cloneDeep(obj[key]);
25
+ return newObj;
26
+ };
27
+ export { cloneDeep };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",
@@ -63,7 +63,8 @@
63
63
  "stylelint": "^13.7.2"
64
64
  },
65
65
  "peerDependencies": {
66
- "react": "^17 || ^18"
66
+ "react": ">=16.9.0",
67
+ "react-dom": ">=16.9.0"
67
68
  },
68
69
  "publishConfig": {
69
70
  "access": "public"