bhd-components 0.2.0 → 0.2.2

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,62 +1,76 @@
1
- .index_module_Table__999e5203 {
1
+ .index_module_Table__84e7aa4c {
2
2
  width: 100%;
3
3
  }
4
- .index_module_Table__999e5203 {
4
+ .index_module_Table__84e7aa4c {
5
5
  /* 多选框间距问题 */
6
6
  }
7
- .index_module_Table__999e5203 table th,
8
- .index_module_Table__999e5203 table td {
7
+ .index_module_Table__84e7aa4c table th,
8
+ .index_module_Table__84e7aa4c table td {
9
9
  border: none;
10
10
  border-bottom: 1px solid #e8e8e8;
11
11
  }
12
- .index_module_Table__999e5203 table > .bhd-table-thead > tr > .bhd-table-cell {
12
+ .index_module_Table__84e7aa4c table > .bhd-table-thead > tr > .bhd-table-cell {
13
13
  font-weight: 400;
14
14
  font-size: 16px;
15
15
  color: rgba(0, 0, 0, 0.85);
16
16
  white-space: nowrap;
17
17
  background: #fafafa;
18
18
  }
19
- .index_module_Table__999e5203 table > .bhd-table-thead > tr > .bhd-table-cell:nth-child(1) {
19
+ .index_module_Table__84e7aa4c table > .bhd-table-thead > tr > .bhd-table-cell:nth-child(1) {
20
20
  padding-left: 40px;
21
21
  }
22
- .index_module_Table__999e5203 table > .bhd-table-thead > tr > .bhd-table-cell:last-child {
22
+ .index_module_Table__84e7aa4c table > .bhd-table-thead > tr > .bhd-table-cell:last-child {
23
23
  padding-right: 40px;
24
24
  }
25
- .index_module_Table__999e5203 table > .bhd-table-thead > tr > .bhd-table-cell::before {
25
+ .index_module_Table__84e7aa4c table > .bhd-table-thead > tr > .bhd-table-cell::before {
26
26
  display: none;
27
27
  }
28
- .index_module_Table__999e5203 table tbody tr.bhd-table-placeholder:hover td {
28
+ .index_module_Table__84e7aa4c table tbody tr.bhd-table-placeholder:hover td {
29
29
  background-color: #ffffff;
30
30
  }
31
- .index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) {
31
+ .index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) {
32
32
  background: transparent;
33
33
  }
34
- .index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder):hover td {
34
+ .index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder):hover td {
35
35
  background-color: #ffeeeb !important;
36
36
  }
37
- .index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) td {
37
+ .index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td {
38
38
  word-wrap: break-word;
39
39
  word-break: break-all;
40
40
  overflow: hidden;
41
41
  white-space: nowrap;
42
42
  text-overflow: ellipsis;
43
+ /* 多选框 距右的距离 */
43
44
  }
44
- .index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) td:nth-child(1) {
45
+ .index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td:nth-child(1) {
45
46
  padding-left: 40px;
46
47
  }
47
- .index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) td:last-child {
48
+ .index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td:last-child {
48
49
  padding-right: 40px;
49
50
  }
50
- .index_module_Table__999e5203 .bhd-table-wrapper {
51
+ .index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td.bhd-table-selection-column {
52
+ -webkit-padding-end: 16px;
53
+ padding-inline-end: 16px;
54
+ }
55
+ .index_module_Table__84e7aa4c .bhd-table-wrapper {
51
56
  /* check 选中变色 */
57
+ /* scroll 固定列 设置overflow:hidden 阴影消失问题 */
52
58
  }
53
- .index_module_Table__999e5203 .bhd-table-wrapper .bhd-table-selection-col {
59
+ .index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-selection-col {
54
60
  width: 72px !important;
55
61
  }
56
- .index_module_Table__999e5203 .bhd-table-wrapper .bhd-table-tbody > tr.bhd-table-row-selected > td {
62
+ .index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-tbody > tr.bhd-table-row-selected > td {
57
63
  background: #ffffff;
58
64
  }
59
- .index_module_columnTootipClassName__999e5203 .bhd-tooltip-content .bhd-tooltip-inner {
65
+ .index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-left-first::after,
66
+ .index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-left-last::after {
67
+ right: 2px;
68
+ }
69
+ .index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-right-first::after,
70
+ .index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-right-last::after {
71
+ left: 2px;
72
+ }
73
+ .index_module_columnTootipClassName__84e7aa4c .bhd-tooltip-content .bhd-tooltip-inner {
60
74
  color: rgba(0, 0, 0, 0.85);
61
75
  word-break: break-all;
62
76
  }
@@ -1,111 +1,14 @@
1
+ import { _ as _slicedToArray, j as jsx, a as _objectSpreadProps, b as _objectSpread, T as Tooltip, c as Table$1 } from './88060020.esm.es5.development.js';
1
2
  import 'core-js/modules/es.array.map.js';
3
+ import 'core-js/modules/es.regexp.test.js';
2
4
  import 'core-js/modules/es.regexp.exec.js';
3
5
  import 'core-js/modules/es.string.fixed.js';
4
6
  import { useState, useRef, useEffect } from 'react';
5
- import { j as jsx, T as Tooltip, a as Table$1 } from './6a77b797.esm.es5.development.js';
6
7
  import 'react/jsx-runtime';
7
8
  import 'react-dom';
8
9
 
9
- var modules_63b47c51 = {"Table":"index_module_Table__999e5203","columnTootipClassName":"index_module_columnTootipClassName__999e5203"};
10
+ var modules_63b47c51 = {"Table":"index_module_Table__84e7aa4c","columnTootipClassName":"index_module_columnTootipClassName__84e7aa4c"};
10
11
 
11
- function _arrayLikeToArray$1(arr, len) {
12
- if (len == null || len > arr.length) len = arr.length;
13
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14
- return arr2;
15
- }
16
- function _arrayWithHoles$1(arr) {
17
- if (Array.isArray(arr)) return arr;
18
- }
19
- function _defineProperty$1(obj, key, value) {
20
- if (key in obj) {
21
- Object.defineProperty(obj, key, {
22
- value: value,
23
- enumerable: true,
24
- configurable: true,
25
- writable: true
26
- });
27
- } else {
28
- obj[key] = value;
29
- }
30
- return obj;
31
- }
32
- function _iterableToArrayLimit$1(arr, i) {
33
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
34
- if (_i == null) return;
35
- var _arr = [];
36
- var _n = true;
37
- var _d = false;
38
- var _s, _e;
39
- try {
40
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
41
- _arr.push(_s.value);
42
- if (i && _arr.length === i) break;
43
- }
44
- } catch (err) {
45
- _d = true;
46
- _e = err;
47
- } finally{
48
- try {
49
- if (!_n && _i["return"] != null) _i["return"]();
50
- } finally{
51
- if (_d) throw _e;
52
- }
53
- }
54
- return _arr;
55
- }
56
- function _nonIterableRest$1() {
57
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
58
- }
59
- function _objectSpread$1(target) {
60
- for(var i = 1; i < arguments.length; i++){
61
- var source = arguments[i] != null ? arguments[i] : {};
62
- var ownKeys = Object.keys(source);
63
- if (typeof Object.getOwnPropertySymbols === "function") {
64
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
65
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
66
- }));
67
- }
68
- ownKeys.forEach(function(key) {
69
- _defineProperty$1(target, key, source[key]);
70
- });
71
- }
72
- return target;
73
- }
74
- function ownKeys$1(object, enumerableOnly) {
75
- var keys = Object.keys(object);
76
- if (Object.getOwnPropertySymbols) {
77
- var symbols = Object.getOwnPropertySymbols(object);
78
- if (enumerableOnly) {
79
- symbols = symbols.filter(function(sym) {
80
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
81
- });
82
- }
83
- keys.push.apply(keys, symbols);
84
- }
85
- return keys;
86
- }
87
- function _objectSpreadProps$1(target, source) {
88
- source = source != null ? source : {};
89
- if (Object.getOwnPropertyDescriptors) {
90
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
91
- } else {
92
- ownKeys$1(Object(source)).forEach(function(key) {
93
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
94
- });
95
- }
96
- return target;
97
- }
98
- function _slicedToArray$1(arr, i) {
99
- return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
100
- }
101
- function _unsupportedIterableToArray$1(o, minLen) {
102
- if (!o) return;
103
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
104
- var n = Object.prototype.toString.call(o).slice(8, -1);
105
- if (n === "Object" && o.constructor) n = o.constructor.name;
106
- if (n === "Map" || n === "Set") return Array.from(n);
107
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
108
- }
109
12
  var getTextSize = function(str) {
110
13
  var fontSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 14;
111
14
  var result = 0;
@@ -122,7 +25,7 @@ var getTextSize = function(str) {
122
25
  };
123
26
  var TextTootip = function(props) {
124
27
  var children = props.children, title = props.title, width = props.width;
125
- var _useState = _slicedToArray$1(useState(false), 2), open = _useState[0], setOpen = _useState[1];
28
+ var _useState = _slicedToArray(useState(false), 2), open = _useState[0], setOpen = _useState[1];
126
29
  var mouseEnter = function(e) {
127
30
  var w = 0;
128
31
  if (typeof width === "function") {
@@ -139,7 +42,7 @@ var TextTootip = function(props) {
139
42
  var mouseLeave = function() {
140
43
  setOpen(false);
141
44
  };
142
- return /*#__PURE__*/ jsx(Tooltip, _objectSpreadProps$1(_objectSpread$1({}, props), {
45
+ return /*#__PURE__*/ jsx(Tooltip, _objectSpreadProps(_objectSpread({}, props), {
143
46
  open: open,
144
47
  children: /*#__PURE__*/ jsx("span", {
145
48
  onMouseEnter: mouseEnter,
@@ -150,125 +53,50 @@ var TextTootip = function(props) {
150
53
  };
151
54
  var TextTootip$1 = TextTootip;
152
55
 
153
- function _arrayLikeToArray(arr, len) {
154
- if (len == null || len > arr.length) len = arr.length;
155
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
156
- return arr2;
157
- }
158
- function _arrayWithHoles(arr) {
159
- if (Array.isArray(arr)) return arr;
160
- }
161
- function _defineProperty(obj, key, value) {
162
- if (key in obj) {
163
- Object.defineProperty(obj, key, {
164
- value: value,
165
- enumerable: true,
166
- configurable: true,
167
- writable: true
168
- });
56
+ var widthPercentage = /^\d+%$/;
57
+ var widthPx = /^\d+px$/;
58
+ /* 获取元素的宽度 */ var getElementPadding = function(node) {
59
+ var computedStyle = {};
60
+ if (window.getComputedStyle) {
61
+ computedStyle = getComputedStyle(node, null);
169
62
  } else {
170
- obj[key] = value;
63
+ computedStyle = node.currentStyle; //兼容IE的写法
171
64
  }
172
- return obj;
173
- }
174
- function _iterableToArrayLimit(arr, i) {
175
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
176
- if (_i == null) return;
177
- var _arr = [];
178
- var _n = true;
179
- var _d = false;
180
- var _s, _e;
65
+ return parseFloat(computedStyle["padding-left"]) + parseFloat(computedStyle["padding-right"]);
66
+ };
67
+ //获取宽度
68
+ var getParentWidth = function(node) {
181
69
  try {
182
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
183
- _arr.push(_s.value);
184
- if (i && _arr.length === i) break;
185
- }
186
- } catch (err) {
187
- _d = true;
188
- _e = err;
189
- } finally{
190
- try {
191
- if (!_n && _i["return"] != null) _i["return"]();
192
- } finally{
193
- if (_d) throw _e;
194
- }
195
- }
196
- return _arr;
197
- }
198
- function _nonIterableRest() {
199
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
200
- }
201
- function _objectSpread(target) {
202
- for(var i = 1; i < arguments.length; i++){
203
- var source = arguments[i] != null ? arguments[i] : {};
204
- var ownKeys = Object.keys(source);
205
- if (typeof Object.getOwnPropertySymbols === "function") {
206
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
207
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
208
- }));
209
- }
210
- ownKeys.forEach(function(key) {
211
- _defineProperty(target, key, source[key]);
212
- });
213
- }
214
- return target;
215
- }
216
- function ownKeys(object, enumerableOnly) {
217
- var keys = Object.keys(object);
218
- if (Object.getOwnPropertySymbols) {
219
- var symbols = Object.getOwnPropertySymbols(object);
220
- if (enumerableOnly) {
221
- symbols = symbols.filter(function(sym) {
222
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
223
- });
70
+ while(node && node.nodeName !== "TD"){
71
+ node = node.parentElement;
224
72
  }
225
- keys.push.apply(keys, symbols);
73
+ var padding = getElementPadding(node);
74
+ return node.clientWidth - padding;
75
+ } catch (error) {
76
+ return null;
226
77
  }
227
- return keys;
228
- }
229
- function _objectSpreadProps(target, source) {
230
- source = source != null ? source : {};
231
- if (Object.getOwnPropertyDescriptors) {
232
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
233
- } else {
234
- ownKeys(Object(source)).forEach(function(key) {
235
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
236
- });
237
- }
238
- return target;
239
- }
240
- function _slicedToArray(arr, i) {
241
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
242
- }
243
- function _unsupportedIterableToArray(o, minLen) {
244
- if (!o) return;
245
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
246
- var n = Object.prototype.toString.call(o).slice(8, -1);
247
- if (n === "Object" && o.constructor) n = o.constructor.name;
248
- if (n === "Map" || n === "Set") return Array.from(n);
249
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
250
- }
251
- var widthPercentage = /^\d+%$/;
252
- var widthPx = /^\d+px$/;
78
+ };
253
79
  // const defaultWidthRang: widthRangType = [180, 240, 320]; //默认自适应的值 [最小值,最佳值,最大值]
254
80
  //传入的参数为onCell==>需要进行函数合并
255
81
  var Table = function(props) {
256
- var ref = useRef(null);
82
+ var tableRef = useRef(null);
83
+ var timerRef = useRef({
84
+ timer: null
85
+ });
257
86
  var _props_defaultWidthRang = props.defaultWidthRang, defaultWidthRang = _props_defaultWidthRang === void 0 ? [
258
87
  180,
259
88
  240,
260
89
  320
261
- ] : _props_defaultWidthRang;
90
+ ] : _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;
262
91
  var _useState = _slicedToArray(useState(props.columns || []), 2), columns = _useState[0], setColumns = _useState[1];
263
92
  var _useState1 = _slicedToArray(useState(props.scroll || undefined), 2), scrollObject = _useState1[0], setScrollObject = _useState1[1];
264
93
  var columnTootipClassName = props.columnTootipClassName, columnTootipColor = props.columnTootipColor;
265
94
  var initColumns = function() {
266
- var _initColumnsWidth = initColumnsWidth(props.columns, ref.current.offsetWidth), selfColumns = _initColumnsWidth.columns;
95
+ var _initColumnsWidth = initColumnsWidth(props.columns, tableRef.current.offsetWidth), selfColumns = _initColumnsWidth.columns;
267
96
  setColumns(selfColumns);
268
97
  var obj = scrollObject ? scrollObject : {};
269
98
  obj = _objectSpreadProps(_objectSpread({}, obj), {
270
- // x: scrollWidth,
271
- x: ref.current.offsetWidth
99
+ x: tableRef.current.offsetWidth
272
100
  });
273
101
  setScrollObject(obj);
274
102
  };
@@ -315,7 +143,9 @@ var Table = function(props) {
315
143
  };
316
144
  item.render = function(text) {
317
145
  return /*#__PURE__*/ jsx(TextTootip$1, {
318
- width: item.width,
146
+ width: function(e) {
147
+ return getParentWidth(e.target);
148
+ },
319
149
  title: text,
320
150
  trigger: "hover",
321
151
  overlayClassName: columnTootipClassName || modules_63b47c51.columnTootipClassName,
@@ -344,6 +174,7 @@ var Table = function(props) {
344
174
  }
345
175
  return item;
346
176
  });
177
+ // console.log("diffdiff",diff,tableWidth,minWidth,avgWidth,columns,autoNum)
347
178
  columns = columns.map(function(item, index) {
348
179
  //存在适应自适应列侯 多余宽度 则平均分配每一列(除最后一列)
349
180
  if (avgWidth > 0 && index !== columns.length - 1) {
@@ -354,8 +185,11 @@ var Table = function(props) {
354
185
  } else if (diff < 0) {
355
186
  //宽度不足 自适应列取最佳宽度 并出现滚动条 且第一列 最后一列 固定
356
187
  columns = columns.map(function(item, index) {
357
- if (index === 0 || index === columns.length - 1) {
358
- item.fixed = index === 0 ? "left" : "right";
188
+ if (isFixedLeft && index === 0) {
189
+ item.fixed = "left";
190
+ }
191
+ if (isFixedRight && index === columns.length - 1) {
192
+ item.fixed = "right";
359
193
  }
360
194
  if (item.width === "auto") {
361
195
  item.width = item.widthRang[1];
@@ -381,6 +215,7 @@ var Table = function(props) {
381
215
  }, obj.style)
382
216
  });
383
217
  };
218
+ console.log("宽度宽度", item, item.width, item.widthRang);
384
219
  return item;
385
220
  });
386
221
  return {
@@ -388,11 +223,18 @@ var Table = function(props) {
388
223
  scrollWidth: scrollWidth
389
224
  };
390
225
  };
226
+ var onResize = function() {
227
+ clearTimeout(timerRef.current.timer);
228
+ timerRef.current.timer = setTimeout(function() {
229
+ initColumns();
230
+ }, 1000);
231
+ };
391
232
  useEffect(function() {
392
233
  initColumns();
393
- // window.addEventListener("resize", initColumns);
234
+ window.addEventListener("resize", onResize);
394
235
  return function() {
395
- // window.removeEventListener("resize", initColumns);
236
+ clearTimeout(timerRef.current.timer);
237
+ window.removeEventListener("resize", onResize);
396
238
  };
397
239
  }, [
398
240
  props.columns
@@ -402,15 +244,22 @@ var Table = function(props) {
402
244
  }, props), {
403
245
  columns: columns,
404
246
  scroll: scrollObject || {
405
- x: "none"
247
+ x: "auto"
406
248
  }
407
249
  });
408
- console.log("scrollObjectscrollObject", scrollObject, config);
409
250
  return /*#__PURE__*/ jsx("div", {
410
251
  className: modules_63b47c51.Table,
411
- ref: ref,
252
+ ref: tableRef,
412
253
  children: /*#__PURE__*/ jsx(Table$1, _objectSpread({}, config))
413
254
  });
414
255
  };
256
+ // let BhdTable=Provider(Table)
257
+ Table.SELECTION_COLUMN = Table$1.SELECTION_COLUMN;
258
+ Table.EXPAND_COLUMN = Table$1.EXPAND_COLUMN;
259
+ Table.SELECTION_ALL = Table$1.SELECTION_ALL;
260
+ Table.SELECTION_INVERT = Table$1.SELECTION_INVERT;
261
+ Table.SELECTION_NONE = Table$1.SELECTION_NONE;
262
+ Table.Column = Table$1.Column;
263
+ Table.ColumnGroup = Table$1.ColumnGroup;
415
264
 
416
265
  export { Table as default };
@@ -1 +1 @@
1
- .index_module_Table__999e5203{width:100%}.index_module_Table__999e5203 table td,.index_module_Table__999e5203 table th{border:none;border-bottom:1px solid #e8e8e8}.index_module_Table__999e5203 table>.bhd-table-thead>tr>.bhd-table-cell{background:#fafafa;color:rgba(0,0,0,.85);font-size:16px;font-weight:400;white-space:nowrap}.index_module_Table__999e5203 table>.bhd-table-thead>tr>.bhd-table-cell:first-child{padding-left:40px}.index_module_Table__999e5203 table>.bhd-table-thead>tr>.bhd-table-cell:last-child{padding-right:40px}.index_module_Table__999e5203 table>.bhd-table-thead>tr>.bhd-table-cell:before{display:none}.index_module_Table__999e5203 table tbody tr.bhd-table-placeholder:hover td{background-color:#fff}.index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder){background:transparent}.index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder):hover td{background-color:#ffeeeb!important}.index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) td{word-wrap:break-word;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all}.index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) td:first-child{padding-left:40px}.index_module_Table__999e5203 table tbody tr:not(.bhd-table-placeholder) td:last-child{padding-right:40px}.index_module_Table__999e5203 .bhd-table-wrapper .bhd-table-selection-col{width:72px!important}.index_module_Table__999e5203 .bhd-table-wrapper .bhd-table-tbody>tr.bhd-table-row-selected>td{background:#fff}.index_module_columnTootipClassName__999e5203 .bhd-tooltip-content .bhd-tooltip-inner{color:rgba(0,0,0,.85);word-break:break-all}
1
+ .index_module_Table__84e7aa4c{width:100%}.index_module_Table__84e7aa4c table td,.index_module_Table__84e7aa4c table th{border:none;border-bottom:1px solid #e8e8e8}.index_module_Table__84e7aa4c table>.bhd-table-thead>tr>.bhd-table-cell{background:#fafafa;color:rgba(0,0,0,.85);font-size:16px;font-weight:400;white-space:nowrap}.index_module_Table__84e7aa4c table>.bhd-table-thead>tr>.bhd-table-cell:first-child{padding-left:40px}.index_module_Table__84e7aa4c table>.bhd-table-thead>tr>.bhd-table-cell:last-child{padding-right:40px}.index_module_Table__84e7aa4c table>.bhd-table-thead>tr>.bhd-table-cell:before{display:none}.index_module_Table__84e7aa4c table tbody tr.bhd-table-placeholder:hover td{background-color:#fff}.index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder){background:transparent}.index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder):hover td{background-color:#ffeeeb!important}.index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td{word-wrap:break-word;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all}.index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td:first-child{padding-left:40px}.index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td:last-child{padding-right:40px}.index_module_Table__84e7aa4c table tbody tr:not(.bhd-table-placeholder) td.bhd-table-selection-column{-webkit-padding-end:16px;padding-inline-end:16px}.index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-selection-col{width:72px!important}.index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-tbody>tr.bhd-table-row-selected>td{background:#fff}.index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-left-first:after,.index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-left-last:after{right:2px}.index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-right-first:after,.index_module_Table__84e7aa4c .bhd-table-wrapper .bhd-table-cell-fix-right-last:after{left:2px}.index_module_columnTootipClassName__84e7aa4c .bhd-tooltip-content .bhd-tooltip-inner{color:rgba(0,0,0,.85);word-break:break-all}
@@ -1 +1 @@
1
- import"core-js/modules/es.array.map.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.fixed.js";import{useState as t,useRef as e,useEffect as r}from"react";import{j as n,T as o,a as i}from"./7fed7be7.esm.es5.production.js";import"react/jsx-runtime";import"react-dom";var l={Table:"index_module_Table__999e5203",columnTootipClassName:"index_module_columnTootipClassName__999e5203"};function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var u=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:14,r=0,n=document.createElement("div");return n.style.position="absolute",n.style.whiteSpace="nowrap",n.style.fontSize=e+"px",n.style.opacity="0",n.innerText=t,document.body.append(n),r=n.getBoundingClientRect().width,document.body.removeChild(n),r},c=function(e){var r,i,l,c=e.children,s=e.title,f=e.width,d=function(t){if(Array.isArray(t))return t}(r=t(!1))||function(t,e){var r,n,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(t);!(l=(r=o.next()).done)&&(i.push(r.value),!e||i.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return i}}(r,2)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}}(r,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=d[0],h=d[1];return n(o,(i=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n,o;n=t,o=r[e],e in n?Object.defineProperty(n,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[e]=o})}return t}({},e),l=l={open:p,children:n("span",{onMouseEnter:function(t){var e=0;(e="function"==typeof f?f(t):f)?h(!(u(s)<e)):h(!0)},onMouseLeave:function(){h(!1)},children:c})},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):(function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r})(Object(l)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(l,t))}),i))};function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function f(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n,o;n=t,o=r[e],e in n?Object.defineProperty(n,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[e]=o})}return t}function d(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r.push.apply(r,n)}return r})(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r,n,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(t);!(l=(r=o.next()).done)&&(i.push(r.value),!e||i.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var h=/^\d+%$/,y=/^\d+px$/,m=function(o){var a=e(null),u=o.defaultWidthRang,s=void 0===u?[180,240,320]:u,m=p(t(o.columns||[]),2),b=m[0],w=m[1],g=p(t(o.scroll||void 0),2),O=g[0],v=g[1],j=o.columnTootipClassName,P=o.columnTootipColor,C=function(){var t=S(o.columns,a.current.offsetWidth).columns;w(t);var e=O||{};v(e=d(f({},e),{x:a.current.offsetWidth}))},S=function(t,e){var r=0,o=0,i=0;t=t.map(function(t){return t.width=t.width||"auto",h.test(t.width)?t.width=parseFloat(t.width)>=100?"auto":e*t.width:"number"==typeof t.width?t.width=t.width:y.test(t.width)?t.width=parseFloat(t.width):t.width="auto","auto"===t.width?(r+=1,t.widthRang||(t.widthRang=s),o+=t.widthRang[0],i+=t.widthRang[1]):(o+=t.width,i+=t.width),t.onColumnCell||(t.onColumnCell=t.onCell||function(){return{}}),t.render||(t.ellipsis={showTitle:!1},t.render=function(e){return n(c,{width:t.width,title:e,trigger:"hover",overlayClassName:j||l.columnTootipClassName,color:P||"#FFF",children:n("span",{children:e})})}),t});var a=e-o;if(a>0){var u=0;t=(t=t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]+a/r,t.width>t.widthRang[2]&&(u+=t.width-t.widthRang[2],t.width=t.widthRang[2])),t})).map(function(e,r){return u>0&&r!==t.length-1&&(e.width+=u/t.length-1),e})}else t=a<0?t.map(function(e,r){return(0===r||r===t.length-1)&&(e.fixed=0===r?"left":"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,r){var n="function"==typeof t.onColumnCell?t.onColumnCell(e,r):{};return n.style=n.style?n.style:{},d(f({},n),{style:f({maxWidth:t.width+"px"},n.style)})},t}),{columns:t,scrollWidth:i}};r(function(){return C(),function(){}},[o.columns]);var x=d(f({bordered:!1},o),{columns:b,scroll:O||{x:"none"}});return console.log("scrollObjectscrollObject",O,x),n("div",{className:l.Table,ref:a,children:n(i,f({},x))})};export{m as default};
1
+ import{_ as t,j as e,a as n,b as o,T as i,c as r}from"./e40d2239.esm.es5.production.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.regexp.test.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.fixed.js";import{useState as l,useRef as d,useEffect as u}from"react";import"react/jsx-runtime";import"react-dom";var a={Table:"index_module_Table__84e7aa4c",columnTootipClassName:"index_module_columnTootipClassName__84e7aa4c"},s=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},c=function(r){var d=r.children,u=r.title,a=r.width,c=t(l(!1),2),m=c[0],h=c[1];return e(i,n(o({},r),{open:m,children:e("span",{onMouseEnter:function(t){var e=0;(e="function"==typeof a?a(t):a)?h(!(s(u)<e)):h(!0)},onMouseLeave:function(){h(!1)},children:d})}))},m=/^\d+%$/,h=/^\d+px$/,p=function(t){var e={};return parseFloat((e=window.getComputedStyle?getComputedStyle(t,null):t.currentStyle)["padding-left"])+parseFloat(e["padding-right"])},w=function(t){try{for(;t&&"TD"!==t.nodeName;)t=t.parentElement;var e=p(t);return t.clientWidth-e}catch(t){return null}},f=function(i){var s=d(null),p=d({timer:null}),f=i.defaultWidthRang,C=void 0===f?[180,240,320]:f,g=i.isFixedLeft,v=void 0===g||g,E=i.isFixedRight,N=void 0===E||E,T=t(l(i.columns||[]),2),y=T[0],L=T[1],x=t(l(i.scroll||void 0),2),_=x[0],R=x[1],O=i.columnTootipClassName,S=i.columnTootipColor,j=function(){var t=b(i.columns,s.current.offsetWidth).columns;L(t);var e=_||{};e=n(o({},e),{x:s.current.offsetWidth}),R(e)},b=function(t,i){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":i*t.width:"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],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(c,{width:function(t){return w(t.target)},title:t,trigger:"hover",overlayClassName:O||a.columnTootipClassName,color:S||"#FFF",children:e("span",{children:t})})}),t});var u=i-l;if(u>0){var s=0;t=(t=t.map(function(t){return"auto"===t.width&&(t.width=t.widthRang[0]+u/r,t.width>t.widthRang[2]&&(s+=t.width-t.widthRang[2],t.width=t.widthRang[2])),t})).map(function(e,n){return s>0&&n!==t.length-1&&(e.width+=s/t.length-1),e})}else t=u<0?t.map(function(e,n){return v&&0===n&&(e.fixed="left"),N&&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)})},console.log("宽度宽度",t,t.width,t.widthRang),t}),{columns:t,scrollWidth:d}},I=function(){clearTimeout(p.current.timer),p.current.timer=setTimeout(function(){j()},1e3)};u(function(){return j(),window.addEventListener("resize",I),function(){clearTimeout(p.current.timer),window.removeEventListener("resize",I)}},[i.columns]);var F=n(o({bordered:!1},i),{columns:y,scroll:_||{x:"auto"}});return e("div",{className:a.Table,ref:s,children:e(r,o({},F))})};f.SELECTION_COLUMN=r.SELECTION_COLUMN,f.EXPAND_COLUMN=r.EXPAND_COLUMN,f.SELECTION_ALL=r.SELECTION_ALL,f.SELECTION_INVERT=r.SELECTION_INVERT,f.SELECTION_NONE=r.SELECTION_NONE,f.Column=r.Column,f.ColumnGroup=r.ColumnGroup;export{f as default};
@@ -0,0 +1 @@
1
+ export * from '@ant-design/icons';
@@ -0,0 +1 @@
1
+ export * from "@ant-design/icons";
package/es2017/index.d.ts CHANGED
@@ -68,6 +68,6 @@ export { default as QRCode } from 'antd/es/qrcode';
68
68
  export { default as version } from 'antd/es/version';
69
69
  export { default as Provider } from "./provider";
70
70
  export { default as TextTootip } from "./textTootip";
71
- export { default as zh_CN } from "antd/locale/en_US";
72
- export { default as en_US } from "antd/locale/zh_CN";
71
+ export { default as zh_CN } from "antd/locale/zh_CN";
72
+ export { default as en_US } from "antd/locale/en_US";
73
73
  export { default as Table } from "./table";
package/es2017/index.js CHANGED
@@ -70,6 +70,6 @@ export { default as QRCode } from "antd/es/qrcode";
70
70
  export { default as version } from "antd/es/version";
71
71
  /* 自定义修改 */ export { default as Provider } from "./provider/index";
72
72
  export { default as TextTootip } from "./textTootip/index";
73
- export { default as zh_CN } from "antd/locale/en_US";
74
- export { default as en_US } from "antd/locale/zh_CN";
73
+ export { default as zh_CN } from "antd/locale/zh_CN";
74
+ export { default as en_US } from "antd/locale/en_US";
75
75
  export { default as Table } from "./table/index"; //改写table逻辑
@@ -1,3 +1,12 @@
1
1
  /// <reference types="react" />
2
- declare const Table: (props: any) => JSX.Element;
2
+ declare const Table: {
3
+ (props: any): JSX.Element;
4
+ SELECTION_COLUMN: {};
5
+ EXPAND_COLUMN: {};
6
+ SELECTION_ALL: "SELECT_ALL";
7
+ SELECTION_INVERT: "SELECT_INVERT";
8
+ SELECTION_NONE: "SELECT_NONE";
9
+ Column: typeof import("antd/es/table/Column").default;
10
+ ColumnGroup: typeof import("antd/es/table/ColumnGroup").default;
11
+ };
3
12
  export default Table;