ebaoferc 1.0.6 → 1.0.8

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.
@@ -0,0 +1,16 @@
1
+ import { TooltipProps } from 'antd';
2
+ import React from 'react';
3
+ interface OverflowTooltipProps {
4
+ /**显示的文本 */
5
+ text: string;
6
+ /** 支持最大显示行数 数字 */
7
+ maxLines?: number;
8
+ /** 自定义 Tooltip 属性 */
9
+ tooltipProps?: TooltipProps;
10
+ /** 自定义样式类名 */
11
+ className?: string;
12
+ /** 可选:指定最大宽度或使用容器宽度 */
13
+ tooltipMaxWidth?: number | 'container';
14
+ }
15
+ declare const OverflowTooltip: React.FC<OverflowTooltipProps>;
16
+ export default OverflowTooltip;
@@ -0,0 +1,102 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { Tooltip } from 'antd';
14
+ import React, { useEffect, useRef, useState } from 'react';
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ var OverflowTooltip = function OverflowTooltip(_ref) {
17
+ var text = _ref.text,
18
+ _ref$maxLines = _ref.maxLines,
19
+ maxLines = _ref$maxLines === void 0 ? 2 : _ref$maxLines,
20
+ _ref$tooltipProps = _ref.tooltipProps,
21
+ tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
22
+ _ref$className = _ref.className,
23
+ className = _ref$className === void 0 ? '' : _ref$className,
24
+ _ref$tooltipMaxWidth = _ref.tooltipMaxWidth,
25
+ tooltipMaxWidth = _ref$tooltipMaxWidth === void 0 ? 'container' : _ref$tooltipMaxWidth;
26
+ var textRef = useRef(null);
27
+ var _useState = useState(false),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ showTooltip = _useState2[0],
30
+ setShowTooltip = _useState2[1];
31
+ var containerRef = useRef(null);
32
+ var _useState3 = useState(undefined),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ computedWidth = _useState4[0],
35
+ setComputedWidth = _useState4[1];
36
+
37
+ // 确定 Tooltip 宽度
38
+ var getTooltipWidth = function getTooltipWidth() {
39
+ if (typeof tooltipMaxWidth === 'number') return tooltipMaxWidth;
40
+ if (tooltipMaxWidth === 'container') return (computedWidth || 0) + 100;
41
+ return undefined;
42
+ };
43
+
44
+ // 组件挂载/更新时计算宽度
45
+ useEffect(function () {
46
+ if (containerRef.current && tooltipMaxWidth === 'container') {
47
+ setComputedWidth(containerRef.current.offsetWidth);
48
+ }
49
+ }, [text, tooltipMaxWidth]);
50
+
51
+ // 检测文本是否溢出
52
+ var checkOverflow = function checkOverflow() {
53
+ if (textRef.current) {
54
+ var _textRef$current = textRef.current,
55
+ scrollHeight = _textRef$current.scrollHeight,
56
+ clientHeight = _textRef$current.clientHeight;
57
+ setShowTooltip(scrollHeight > clientHeight);
58
+ }
59
+ };
60
+ var handleMouseEnter = function handleMouseEnter() {
61
+ checkOverflow();
62
+ };
63
+
64
+ // 动态生成行数限制样式
65
+ var lineClampStyle = {
66
+ display: '-webkit-box',
67
+ WebkitBoxOrient: 'vertical',
68
+ WebkitLineClamp: maxLines,
69
+ overflow: 'hidden',
70
+ textOverflow: 'ellipsis',
71
+ wordBreak: 'break-word' // 添加自动换行
72
+ };
73
+ return /*#__PURE__*/_jsx("div", {
74
+ ref: containerRef,
75
+ onMouseEnter: handleMouseEnter,
76
+ children: showTooltip ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
77
+ title: text,
78
+ color: "#fff",
79
+ styles: {
80
+ body: {
81
+ width: getTooltipWidth(),
82
+ color: '#000',
83
+ lineHeight: '20px',
84
+ padding: '12px'
85
+ }
86
+ }
87
+ }, tooltipProps), {}, {
88
+ children: /*#__PURE__*/_jsx("div", {
89
+ ref: textRef,
90
+ style: lineClampStyle,
91
+ className: className,
92
+ children: text
93
+ })
94
+ })) : /*#__PURE__*/_jsx("div", {
95
+ ref: textRef,
96
+ style: lineClampStyle,
97
+ className: className,
98
+ children: text
99
+ })
100
+ });
101
+ };
102
+ export default OverflowTooltip;
@@ -6,4 +6,5 @@ export default function StyledQueryFilter(props: ProFormProps & {
6
6
  labelWidth?: number;
7
7
  itemWith?: number;
8
8
  collapsedLineCount?: number;
9
+ maxColCount?: number;
9
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["children", "labelWidth", "form", "className", "itemWith", "onReset", "collapsedLineCount"];
2
+ var _excluded = ["children", "labelWidth", "form", "className", "itemWith", "onReset", "collapsedLineCount", "maxColCount"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -31,6 +31,7 @@ export default function StyledQueryFilter(props) {
31
31
  onReset = props.onReset,
32
32
  _props$collapsedLineC = props.collapsedLineCount,
33
33
  collapsedLineCount = _props$collapsedLineC === void 0 ? 2 : _props$collapsedLineC,
34
+ maxColCount = props.maxColCount,
34
35
  rest = _objectWithoutProperties(props, _excluded);
35
36
  var _Form$useForm = Form.useForm(form),
36
37
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -72,6 +73,7 @@ export default function StyledQueryFilter(props) {
72
73
  lineCountChange: handleLineCountChange,
73
74
  width: itemWith,
74
75
  showAfterSize: true,
76
+ maxColCount: maxColCount,
75
77
  children: children
76
78
  })
77
79
  })), /*#__PURE__*/_jsxs("div", {
@@ -11,7 +11,7 @@ export declare const PaginationCommonProps: {
11
11
  showQuickJumper: boolean;
12
12
  showTotal: (total: number) => string;
13
13
  };
14
- export declare const TableCellText: (text: string | number, cellWidth: any, maxTooltipWidth: any, maxTooltipHeight: any) => import("react/jsx-runtime").JSX.Element | "-";
14
+ export declare const TableCellText: (text: string | number, cellWidth: any, maxTooltipWidth: any, maxTooltipHeight: any) => "-" | import("react/jsx-runtime").JSX.Element;
15
15
  export default function (props: StyledTableProps): import("react/jsx-runtime").JSX.Element;
16
16
  export declare const useRowSelection: () => {
17
17
  selectedRowKeys: any[];
@@ -1,6 +1,7 @@
1
1
  export { default as FlexRowCol } from './FlexRowCol';
2
2
  export * from './ImageViewTrigger';
3
3
  export * from './MindGraph';
4
+ export { default as OverflowTooltip } from './OverflowTooltip';
4
5
  export { default as QueryProCard } from './QueryProCard';
5
6
  export * from './SectionTitleBar';
6
7
  export { default as SliderVerify } from './SliderVerify';
@@ -1,6 +1,7 @@
1
1
  export { default as FlexRowCol } from "./FlexRowCol";
2
2
  export * from "./ImageViewTrigger";
3
3
  export * from "./MindGraph";
4
+ export { default as OverflowTooltip } from "./OverflowTooltip";
4
5
  export { default as QueryProCard } from "./QueryProCard";
5
6
  export * from "./SectionTitleBar";
6
7
  export { default as SliderVerify } from "./SliderVerify";
package/package.json CHANGED
@@ -1,100 +1,99 @@
1
- {
2
- "name": "ebaoferc",
3
- "version": "1.0.6",
4
- "description": "A react library developed with dumi",
5
- "license": "MIT",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "node checkProject && father build",
13
- "build:watch": "father dev",
14
- "dev": "dumi dev",
15
- "docs:build": "dumi build",
16
- "docs:preview": "dumi preview",
17
- "doctor": "father doctor",
18
- "lint": "npm run lint:es && npm run lint:css",
19
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
20
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
21
- "prepare": "husky install && dumi setup",
22
- "prepublishOnly": "father doctor && npm run build",
23
- "start": "npm run dev"
24
- },
25
- "commitlint": {
26
- "extends": [
27
- "@commitlint/config-conventional"
28
- ]
29
- },
30
- "lint-staged": {
31
- "*.{md,json}": [
32
- "prettier --write --no-error-on-unmatched-pattern"
33
- ],
34
- "*.{css,less}": [
35
- "stylelint --fix",
36
- "prettier --write"
37
- ],
38
- "*.{js,jsx}": [
39
- "eslint --fix",
40
- "prettier --write"
41
- ],
42
- "*.{ts,tsx}": [
43
- "eslint --fix",
44
- "prettier --parser=typescript --write"
45
- ]
46
- },
47
- "dependencies": {
48
- "d3": "^7.9.0",
49
- "dagre": "^0.8.5"
50
- },
51
- "devDependencies": {
52
- "@ant-design/icons": "^5.3.7",
53
- "@ant-design/pro-components": "^2.7.1",
54
- "@commitlint/cli": "^18.2.0",
55
- "@commitlint/config-conventional": "^18.1.0",
56
- "@commitlint/config-pnpm-scopes": "^18.1.0",
57
- "@types/lodash": "^4.17.7",
58
- "@types/react": "^18.2.36",
59
- "@types/react-dom": "^18.2.14",
60
- "@umijs/lint": "^4.0.87",
61
- "@umijs/max": "^4.3.6",
62
- "@vitest/coverage-v8": "^0.34.6",
63
- "ahooks": "^3.7.10",
64
- "antd": "^5.17.0",
65
- "classnames": "^2.5.1",
66
- "connect-history-api-fallback": "^2.0.0",
67
- "cross-env": "^7.0.3",
68
- "dayjs": "^1.11.10",
69
- "dumi": "^2.3.0",
70
- "eslint": "^8.23.0",
71
- "express": "^4.19.2",
72
- "father": "^4.1.0",
73
- "husky": "^8.0.1",
74
- "lint-staged": "^13.0.3",
75
- "lodash": "^4.17.21",
76
- "prettier": "^2.7.1",
77
- "prettier-plugin-organize-imports": "^3.0.0",
78
- "prettier-plugin-packagejson": "^2.2.18",
79
- "react": "^18.0.0",
80
- "react-dom": "^18.0.0",
81
- "stylelint": "^14.9.1"
82
- },
83
- "peerDependencies": {
84
- "@ant-design/icons": "^5.3.7",
85
- "@ant-design/pro-components": "^2.7.1",
86
- "ahooks": "^3.7.10",
87
- "antd": "^5.17.0",
88
- "classnames": "^2.5.1",
89
- "cross-env": "^7.0.3",
90
- "dayjs": "^1.11.10",
91
- "lodash": "^4.17.21",
92
- "react": "^18.0.0",
93
- "react-dom": "^18.0.0"
94
- },
95
- "publishConfig": {
96
- "access": "public",
97
- "registry": "https://registry.npmjs.org"
98
- },
99
- "authors": []
100
- }
1
+ {
2
+ "name": "ebaoferc",
3
+ "version": "1.0.8",
4
+ "description": "A react library developed with dumi",
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "node checkProject && father build",
12
+ "build:watch": "father dev",
13
+ "dev": "dumi dev",
14
+ "docs:build": "dumi build",
15
+ "docs:preview": "dumi preview",
16
+ "doctor": "father doctor",
17
+ "lint": "npm run lint:es && npm run lint:css",
18
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
19
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
20
+ "prepare": "husky install && dumi setup",
21
+ "prepublishOnly": "father doctor && npm run build",
22
+ "start": "npm run dev"
23
+ },
24
+ "commitlint": {
25
+ "extends": [
26
+ "@commitlint/config-conventional"
27
+ ]
28
+ },
29
+ "lint-staged": {
30
+ "*.{md,json}": [
31
+ "prettier --write --no-error-on-unmatched-pattern"
32
+ ],
33
+ "*.{css,less}": [
34
+ "stylelint --fix",
35
+ "prettier --write"
36
+ ],
37
+ "*.{js,jsx}": [
38
+ "eslint --fix",
39
+ "prettier --write"
40
+ ],
41
+ "*.{ts,tsx}": [
42
+ "eslint --fix",
43
+ "prettier --parser=typescript --write"
44
+ ]
45
+ },
46
+ "dependencies": {
47
+ "d3": "^7.9.0",
48
+ "dagre": "^0.8.5"
49
+ },
50
+ "devDependencies": {
51
+ "@ant-design/icons": "^5.3.7",
52
+ "@ant-design/pro-components": "^2.7.1",
53
+ "@commitlint/cli": "^18.2.0",
54
+ "@commitlint/config-conventional": "^18.1.0",
55
+ "@commitlint/config-pnpm-scopes": "^18.1.0",
56
+ "@types/lodash": "^4.17.7",
57
+ "@types/react": "^18.2.36",
58
+ "@types/react-dom": "^18.2.14",
59
+ "@umijs/lint": "^4.0.87",
60
+ "@umijs/max": "^4.3.6",
61
+ "@vitest/coverage-v8": "^0.34.6",
62
+ "ahooks": "^3.7.10",
63
+ "antd": "^5.24.7",
64
+ "classnames": "^2.5.1",
65
+ "connect-history-api-fallback": "^2.0.0",
66
+ "cross-env": "^7.0.3",
67
+ "dayjs": "^1.11.10",
68
+ "dumi": "^2.3.0",
69
+ "eslint": "^8.23.0",
70
+ "express": "^4.19.2",
71
+ "father": "^4.1.0",
72
+ "husky": "^8.0.1",
73
+ "lint-staged": "^13.0.3",
74
+ "lodash": "^4.17.21",
75
+ "prettier": "^2.7.1",
76
+ "prettier-plugin-organize-imports": "^3.0.0",
77
+ "prettier-plugin-packagejson": "^2.2.18",
78
+ "react": "^18.0.0",
79
+ "react-dom": "^18.0.0",
80
+ "stylelint": "^14.9.1"
81
+ },
82
+ "peerDependencies": {
83
+ "@ant-design/icons": "^5.3.7",
84
+ "@ant-design/pro-components": "^2.7.1",
85
+ "ahooks": "^3.7.10",
86
+ "antd": "^5.17.0",
87
+ "classnames": "^2.5.1",
88
+ "cross-env": "^7.0.3",
89
+ "dayjs": "^1.11.10",
90
+ "lodash": "^4.17.21",
91
+ "react": "^18.0.0",
92
+ "react-dom": "^18.0.0"
93
+ },
94
+ "publishConfig": {
95
+ "access": "public",
96
+ "registry": "https://registry.npmjs.org"
97
+ },
98
+ "authors": []
99
+ }