bhd-components 0.9.7 → 0.9.9

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.
@@ -2,6 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
4
4
  import * as React from "react";
5
+ import { useRef } from "react";
5
6
  import "./index.less";
6
7
  import Table from "../../../table";
7
8
  import { Loading, NotData, ServerError } from "../../../images";
@@ -17,10 +18,18 @@ import i18Conversion from "../../../i18n";
17
18
  超长内容 出现滚动条 需在管理列定义好width 没有定义的max-width:300
18
19
  */ const BhdTableSimple = (props)=>{
19
20
  let { className, locale, borderBottom = false, rowSelection, ajaxErr, dataSource, kind = "simple", loading, notDataText = i18Conversion("noData") } = props;
21
+ const tableRef = useRef(null);
20
22
  const renderTableText = ()=>{
23
+ let minHeight = props.scroll.y.replace(/\)/, "");
24
+ minHeight = minHeight + " - 42px)";
25
+ let width = tableRef.current ? tableRef.current.offsetWidth - 42 : 0;
21
26
  if (ajaxErr) {
22
27
  return /*#__PURE__*/ _jsxs("div", {
23
28
  className: "app_BhdTableSimple_errorTable",
29
+ style: {
30
+ minHeight: minHeight,
31
+ width: width + 'px'
32
+ },
24
33
  children: [
25
34
  /*#__PURE__*/ _jsx("img", {
26
35
  src: ServerError,
@@ -36,7 +45,8 @@ import i18Conversion from "../../../i18n";
36
45
  return /*#__PURE__*/ _jsxs("div", {
37
46
  className: "app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable",
38
47
  style: {
39
- minHeight: "150px"
48
+ minHeight: minHeight,
49
+ width: width + 'px'
40
50
  },
41
51
  children: [
42
52
  /*#__PURE__*/ _jsx("img", {
@@ -56,7 +66,8 @@ import i18Conversion from "../../../i18n";
56
66
  return /*#__PURE__*/ _jsxs("div", {
57
67
  className: "app_BhdTableSimple_noTable",
58
68
  style: {
59
- width: "100%"
69
+ width: width + 'px',
70
+ minHeight: minHeight
60
71
  },
61
72
  children: [
62
73
  /*#__PURE__*/ _jsx("img", {
@@ -69,22 +80,12 @@ import i18Conversion from "../../../i18n";
69
80
  ]
70
81
  });
71
82
  };
72
- const loadingTable = /*#__PURE__*/ _jsxs("div", {
73
- className: "app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable",
74
- children: [
75
- /*#__PURE__*/ _jsx("img", {
76
- src: Loading,
77
- alt: "",
78
- style: {
79
- width: "48px",
80
- height: "48px"
81
- }
82
- }),
83
- /*#__PURE__*/ _jsx("p", {
84
- children: i18Conversion("Load")
85
- })
86
- ]
87
- });
83
+ // const loadingTable = (
84
+ // <div className="app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable">
85
+ // <img src={Loading} alt="" style={{ width: "48px", height: "48px" }} />
86
+ // <p>{i18Conversion("Load")}</p>
87
+ // </div>
88
+ // );
88
89
  const tableProps = _object_spread_props(_object_spread({
89
90
  style: {
90
91
  width: "100%"
@@ -104,6 +105,9 @@ import i18Conversion from "../../../i18n";
104
105
  // if (loading) {
105
106
  // return loadingTable;
106
107
  // }
107
- return /*#__PURE__*/ _jsx(Table, _object_spread({}, tableProps));
108
+ return /*#__PURE__*/ _jsx("div", {
109
+ ref: tableRef,
110
+ children: /*#__PURE__*/ _jsx(Table, _object_spread({}, tableProps))
111
+ });
108
112
  };
109
113
  export default BhdTableSimple;
@@ -3,6 +3,12 @@
3
3
  /* 无数据样式 */
4
4
  .app_BhdTableSimple_noTable {
5
5
  padding: 24px 0;
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ justify-content: center;
10
+ position: sticky;
11
+ left: 16px;
6
12
  img {
7
13
  width: 200px;
8
14
  height: 200px;
@@ -17,6 +23,13 @@
17
23
  /* 错误样式 */
18
24
  .app_BhdTableSimple_errorTable {
19
25
  padding: 24px 0;
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ justify-content: center;
30
+ position: sticky;
31
+ left: 16px;
32
+
20
33
  img {
21
34
  width: 200px;
22
35
  height: 200px;
@@ -73,9 +73,9 @@
73
73
  margin-top: 16px;
74
74
  :global{
75
75
  /* table 无数据,异常时 */
76
- .app_BhdTableSimple_errorTable,.app_BhdTableSimple_noTable{
77
- padding-top: 120px;
78
- }
76
+ // .app_BhdTableSimple_errorTable,.app_BhdTableSimple_noTable{
77
+ // padding-top: 120px;
78
+ // }
79
79
  }
80
80
  }
81
81
  }
@@ -53,6 +53,7 @@ const Table = (props)=>{
53
53
  const timerRef = useRef({
54
54
  timer: null
55
55
  });
56
+ const scrollObjectRef = useRef(null);
56
57
  const { defaultWidthRang = [
57
58
  180,
58
59
  240,
@@ -75,7 +76,7 @@ const Table = (props)=>{
75
76
  }
76
77
  let { columns: selfColumns } = initColumnsWidth(props.columns, tableWidth);
77
78
  setColumns(selfColumns);
78
- let obj = scrollObject ? scrollObject : {};
79
+ let obj = scrollObjectRef.current ? scrollObjectRef.current : {};
79
80
  obj = _object_spread_props(_object_spread({}, obj), {
80
81
  x: tableWidth
81
82
  });
@@ -224,6 +225,11 @@ const Table = (props)=>{
224
225
  }, [
225
226
  props.scroll
226
227
  ]);
228
+ useEffect(()=>{
229
+ scrollObjectRef.current = scrollObject;
230
+ }, [
231
+ scrollObject
232
+ ]);
227
233
  let config = _object_spread_props(_object_spread({
228
234
  bordered: false
229
235
  }, props), {
@@ -2,6 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
4
4
  import * as React from "react";
5
+ import { useRef } from "react";
5
6
  import "./index.less";
6
7
  import Table from "../../../table";
7
8
  import { Loading, NotData, ServerError } from "../../../images";
@@ -17,10 +18,18 @@ import i18Conversion from "../../../i18n";
17
18
  超长内容 出现滚动条 需在管理列定义好width 没有定义的max-width:300
18
19
  */ var BhdTableSimple = function(props) {
19
20
  var className = props.className, locale = props.locale, _props_borderBottom = props.borderBottom, borderBottom = _props_borderBottom === void 0 ? false : _props_borderBottom, rowSelection = props.rowSelection, ajaxErr = props.ajaxErr, dataSource = props.dataSource, _props_kind = props.kind, kind = _props_kind === void 0 ? "simple" : _props_kind, loading = props.loading, _props_notDataText = props.notDataText, notDataText = _props_notDataText === void 0 ? i18Conversion("noData") : _props_notDataText;
21
+ var tableRef = useRef(null);
20
22
  var renderTableText = function() {
23
+ var minHeight = props.scroll.y.replace(/\)/, "");
24
+ minHeight = minHeight + " - 42px)";
25
+ var width = tableRef.current ? tableRef.current.offsetWidth - 42 : 0;
21
26
  if (ajaxErr) {
22
27
  return /*#__PURE__*/ _jsxs("div", {
23
28
  className: "app_BhdTableSimple_errorTable",
29
+ style: {
30
+ minHeight: minHeight,
31
+ width: width + "px"
32
+ },
24
33
  children: [
25
34
  /*#__PURE__*/ _jsx("img", {
26
35
  src: ServerError,
@@ -36,7 +45,8 @@ import i18Conversion from "../../../i18n";
36
45
  return /*#__PURE__*/ _jsxs("div", {
37
46
  className: "app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable",
38
47
  style: {
39
- minHeight: "150px"
48
+ minHeight: minHeight,
49
+ width: width + "px"
40
50
  },
41
51
  children: [
42
52
  /*#__PURE__*/ _jsx("img", {
@@ -56,7 +66,8 @@ import i18Conversion from "../../../i18n";
56
66
  return /*#__PURE__*/ _jsxs("div", {
57
67
  className: "app_BhdTableSimple_noTable",
58
68
  style: {
59
- width: "100%"
69
+ width: width + "px",
70
+ minHeight: minHeight
60
71
  },
61
72
  children: [
62
73
  /*#__PURE__*/ _jsx("img", {
@@ -69,22 +80,12 @@ import i18Conversion from "../../../i18n";
69
80
  ]
70
81
  });
71
82
  };
72
- var loadingTable = /*#__PURE__*/ _jsxs("div", {
73
- className: "app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable",
74
- children: [
75
- /*#__PURE__*/ _jsx("img", {
76
- src: Loading,
77
- alt: "",
78
- style: {
79
- width: "48px",
80
- height: "48px"
81
- }
82
- }),
83
- /*#__PURE__*/ _jsx("p", {
84
- children: i18Conversion("Load")
85
- })
86
- ]
87
- });
83
+ // const loadingTable = (
84
+ // <div className="app_BhdTableSimple_noTable app_BhdTableSimple_noTable_loadingTable">
85
+ // <img src={Loading} alt="" style={{ width: "48px", height: "48px" }} />
86
+ // <p>{i18Conversion("Load")}</p>
87
+ // </div>
88
+ // );
88
89
  var tableProps = _object_spread_props(_object_spread({
89
90
  style: {
90
91
  width: "100%"
@@ -104,6 +105,9 @@ import i18Conversion from "../../../i18n";
104
105
  // if (loading) {
105
106
  // return loadingTable;
106
107
  // }
107
- return /*#__PURE__*/ _jsx(Table, _object_spread({}, tableProps));
108
+ return /*#__PURE__*/ _jsx("div", {
109
+ ref: tableRef,
110
+ children: /*#__PURE__*/ _jsx(Table, _object_spread({}, tableProps))
111
+ });
108
112
  };
109
113
  export default BhdTableSimple;
@@ -3,6 +3,12 @@
3
3
  /* 无数据样式 */
4
4
  .app_BhdTableSimple_noTable {
5
5
  padding: 24px 0;
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ justify-content: center;
10
+ position: sticky;
11
+ left: 16px;
6
12
  img {
7
13
  width: 200px;
8
14
  height: 200px;
@@ -17,6 +23,13 @@
17
23
  /* 错误样式 */
18
24
  .app_BhdTableSimple_errorTable {
19
25
  padding: 24px 0;
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ justify-content: center;
30
+ position: sticky;
31
+ left: 16px;
32
+
20
33
  img {
21
34
  width: 200px;
22
35
  height: 200px;
@@ -73,9 +73,9 @@
73
73
  margin-top: 16px;
74
74
  :global{
75
75
  /* table 无数据,异常时 */
76
- .app_BhdTableSimple_errorTable,.app_BhdTableSimple_noTable{
77
- padding-top: 120px;
78
- }
76
+ // .app_BhdTableSimple_errorTable,.app_BhdTableSimple_noTable{
77
+ // padding-top: 120px;
78
+ // }
79
79
  }
80
80
  }
81
81
  }
@@ -54,6 +54,7 @@ var Table = function(props) {
54
54
  var timerRef = useRef({
55
55
  timer: null
56
56
  });
57
+ var scrollObjectRef = useRef(null);
57
58
  var _props_defaultWidthRang = props.defaultWidthRang, defaultWidthRang = _props_defaultWidthRang === void 0 ? [
58
59
  180,
59
60
  240,
@@ -76,7 +77,7 @@ var Table = function(props) {
76
77
  }
77
78
  var _initColumnsWidth = initColumnsWidth(props.columns, tableWidth), selfColumns = _initColumnsWidth.columns;
78
79
  setColumns(selfColumns);
79
- var obj = scrollObject ? scrollObject : {};
80
+ var obj = scrollObjectRef.current ? scrollObjectRef.current : {};
80
81
  obj = _object_spread_props(_object_spread({}, obj), {
81
82
  x: tableWidth
82
83
  });
@@ -229,6 +230,11 @@ var Table = function(props) {
229
230
  }, [
230
231
  props.scroll
231
232
  ]);
233
+ useEffect(function() {
234
+ scrollObjectRef.current = scrollObject;
235
+ }, [
236
+ scrollObject
237
+ ]);
232
238
  var config = _object_spread_props(_object_spread({
233
239
  bordered: false
234
240
  }, props), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {