wt-enjoy-link-antd-repack 4.1.51 → 4.1.52

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.
@@ -10,5 +10,6 @@ export declare const BiuCustomTable: React.MemoExoticComponent<React.ForwardRefE
10
10
  suppWidth?: number | undefined;
11
11
  tableH?: number | undefined;
12
12
  virtual?: boolean | undefined;
13
+ sortable?: boolean | undefined;
13
14
  columns?: BiuColumnType[] | undefined;
14
15
  } & Omit<TableProps<any>, "columns"> & React.RefAttributes<unknown>>>;
@@ -1,5 +1,6 @@
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 = ["cardtitle", "tableW", "suppWidth", "tableH", "columns", "virtual"];
2
+ var _excluded = ["cardtitle", "tableW", "suppWidth", "tableH", "columns"],
3
+ _excluded2 = ["dataIndex", "width", "render"];
3
4
  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
5
  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
6
  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; }
@@ -8,7 +9,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
11
  import React, { forwardRef, useMemo } from 'react';
11
- import { BiuDivider, BiuVirtualTable, BiuResizeTable } from "./..";
12
+ import { BiuDivider, BiuResizeTable } from "./..";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { Fragment as _Fragment } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -30,8 +31,6 @@ export var BiuCustomTable = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(fun
30
31
  tableH = props.tableH,
31
32
  _props$columns = props.columns,
32
33
  columns = _props$columns === void 0 ? [] : _props$columns,
33
- _props$virtual = props.virtual,
34
- virtual = _props$virtual === void 0 ? false : _props$virtual,
35
34
  tableProps = _objectWithoutProperties(props, _excluded);
36
35
  var scrollX = useMemo(function () {
37
36
  var scrollWidth = calcColsTotalWidth(columns, suppWidth);
@@ -49,28 +48,30 @@ export var BiuCustomTable = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(fun
49
48
  pagination: false,
50
49
  columns: columns.filter(function (col) {
51
50
  return !col.noShow;
52
- }).map(function (col) {
51
+ }).map(function (_ref) {
52
+ var dataIndex = _ref.dataIndex,
53
+ _ref$width = _ref.width,
54
+ width = _ref$width === void 0 ? 180 : _ref$width,
55
+ _render = _ref.render,
56
+ restColumn = _objectWithoutProperties(_ref, _excluded2);
53
57
  return _objectSpread(_objectSpread({
54
- key: col.dataIndex
55
- }, col), {}, {
56
- width: col.width,
58
+ key: dataIndex,
59
+ dataIndex: dataIndex
60
+ }, restColumn), {}, {
61
+ width: width,
57
62
  render: function render(text, record, index) {
58
- return col.render ? col.render(text, record, index) : text;
63
+ return _render ? _render(text, record, index) : text;
59
64
  }
60
65
  });
61
66
  })
62
67
  };
63
68
  }, [columns, scrollX, tableH]);
64
- var myTable = virtual ? /*#__PURE__*/_jsx(BiuVirtualTable, _objectSpread(_objectSpread({
65
- ref: ref
66
- }, tableProps), defaultTableProps)) : /*#__PURE__*/_jsx(BiuResizeTable, _objectSpread(_objectSpread({
67
- ref: ref,
68
- isCellEdit: true
69
- }, defaultTableProps), tableProps));
70
- if (cardtitle === undefined || cardtitle === null) return myTable;
71
69
  return /*#__PURE__*/_jsxs(_Fragment, {
72
- children: [/*#__PURE__*/_jsx(BiuDivider, {
70
+ children: [cardtitle && /*#__PURE__*/_jsx(BiuDivider, {
73
71
  children: cardtitle
74
- }), myTable]
72
+ }), /*#__PURE__*/_jsx(BiuResizeTable, _objectSpread(_objectSpread({
73
+ ref: ref,
74
+ isCellEdit: true
75
+ }, defaultTableProps), tableProps))]
75
76
  });
76
77
  }));
@@ -32,4 +32,3 @@ export * from './BiuTable';
32
32
  export * from './BiuTableLink';
33
33
  export * from './BiuTableSelect';
34
34
  export * from './BiuTabs';
35
- export * from './BiuVirtualTable';
@@ -31,5 +31,4 @@ export * from "./BiuSplit";
31
31
  export * from "./BiuTable";
32
32
  export * from "./BiuTableLink";
33
33
  export * from "./BiuTableSelect";
34
- export * from "./BiuTabs";
35
- export * from "./BiuVirtualTable";
34
+ export * from "./BiuTabs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wt-enjoy-link-antd-repack",
3
- "version": "4.1.51",
3
+ "version": "4.1.52",
4
4
  "description": "万通业务组件",
5
5
  "sideEffects": false,
6
6
  "main": "dist/esm/index.js",
@@ -1,21 +0,0 @@
1
- import type { TableProps } from 'antd';
2
- import React from 'react';
3
- import type { BiuColumnType } from "..";
4
- export type BiuVirtualTablePropsType = Omit<TableProps<any>, 'columns' | 'scroll'> & {
5
- columns: (Omit<BiuColumnType, 'width'> & {
6
- width: number;
7
- })[];
8
- scroll: {
9
- x: number;
10
- y: number;
11
- };
12
- };
13
- export declare const BiuVirtualTable: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<TableProps<any>, "scroll" | "columns"> & {
14
- columns: (Omit<BiuColumnType, 'width'> & {
15
- width: number;
16
- })[];
17
- scroll: {
18
- x: number;
19
- y: number;
20
- };
21
- } & React.RefAttributes<unknown>>>;
@@ -1,167 +0,0 @@
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 = ["columns", "scroll", "className"];
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
- 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."); }
5
- 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); }
6
- 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; }
7
- 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; } }
8
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
- 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; }
10
- 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; }
11
- 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; }
12
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
- 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); }
14
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
- import { useSize } from 'ahooks';
17
- import { Table } from 'antd';
18
- import classNames from 'classnames';
19
- import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
20
- import { VariableSizeGrid } from 'react-window';
21
- import { styled } from 'styled-components';
22
- import { jsx as _jsx } from "react/jsx-runtime";
23
- var VariableSizeGridJSX = VariableSizeGrid;
24
- var StyledTable = styled(Table).withConfig({
25
- displayName: "StyledTable",
26
- componentId: "wt-enjoy-link-antd-repack__sc-xp2a6l-0"
27
- })([".ant-table-container{box-sizing:content-box;border:1px solid #f0f0f0 !important;}.virtual-grid{width:100% !important;overflow:scroll;&::-webkit-scrollbar{width:10px !important;}&::-webkit-scrollbar{width:10px;height:10px;}&::-webkit-scrollbar-button{width:0;height:0;}&::-webkit-scrollbar-thumb{background:#ccc;}&::-webkit-scrollbar-track{background-color:#e6e5e5;}}"]);
28
- export var BiuVirtualTable = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(function (props, parentRef) {
29
- var columns = props.columns,
30
- scroll = props.scroll,
31
- className = props.className,
32
- restProps = _objectWithoutProperties(props, _excluded);
33
- var domRef = useRef(null);
34
- var gridRef = useRef();
35
- var domSize = useSize(domRef);
36
- var _ref = domSize || {
37
- width: 0
38
- },
39
- _ref$width = _ref.width,
40
- domWidth = _ref$width === void 0 ? 0 : _ref$width;
41
- var mergedColumns = useMemo(function () {
42
- var widthColumnCount = columns.filter(function (_ref2) {
43
- var width = _ref2.width;
44
- return !width;
45
- }).length;
46
- var widthColumn = columns.reduce(function (sumWidth, _ref3) {
47
- var width = _ref3.width;
48
- return sumWidth + (width || 0);
49
- }, 0);
50
- return columns.map(function (column) {
51
- if (column.width) {
52
- if (widthColumn < domWidth && widthColumn > 0 && typeof column.width === 'number') {
53
- return _objectSpread(_objectSpread({}, column), {}, {
54
- width: column.width / widthColumn * domWidth
55
- });
56
- }
57
- return column;
58
- }
59
- return _objectSpread(_objectSpread({}, column), {}, {
60
- width: Math.floor((domWidth - widthColumn) / widthColumnCount)
61
- });
62
- });
63
- }, [columns, domWidth]);
64
- var _useState = useState(function () {
65
- var obj = {};
66
- Object.defineProperty(obj, 'scrollLeft', {
67
- get: function get() {
68
- return null;
69
- },
70
- set: function set(scrollLeft) {
71
- if (gridRef.current) {
72
- gridRef.current.scrollTo({
73
- scrollLeft: scrollLeft
74
- });
75
- }
76
- }
77
- });
78
- return obj;
79
- }),
80
- _useState2 = _slicedToArray(_useState, 1),
81
- connectObject = _useState2[0];
82
- var resetVirtualGrid = useCallback(function () {
83
- if (gridRef.current && domSize !== null && domSize !== void 0 && domSize.width) {
84
- gridRef.current.resetAfterIndices({
85
- columnIndex: 0,
86
- shouldForceUpdate: false
87
- });
88
- }
89
- }, [domSize === null || domSize === void 0 ? void 0 : domSize.width]);
90
- useEffect(function () {
91
- return resetVirtualGrid;
92
- }, [resetVirtualGrid]);
93
- var renderVirtualListRow = useCallback(function (columnIndex, rawData, rowIndex) {
94
- var columnRender = mergedColumns[columnIndex].render;
95
- var dataIndex = mergedColumns[columnIndex].dataIndex;
96
- var field = '';
97
- if (Array.isArray(dataIndex) && dataIndex.length <= 0 || !dataIndex) return null;
98
- if (Array.isArray(dataIndex)) {
99
- ;
100
- var _ref4 = dataIndex;
101
- var _ref5 = _slicedToArray(_ref4, 1);
102
- field = _ref5[0];
103
- } else {
104
- field = dataIndex;
105
- }
106
- if (columnRender) {
107
- return columnRender(rawData[rowIndex][field], rawData[rowIndex], rowIndex);
108
- }
109
- return rawData[rowIndex][field];
110
- }, [mergedColumns]);
111
- var renderVirtualList = useCallback(function (rawData, _ref6, rowClassName) {
112
- var scrollbarSize = _ref6.scrollbarSize,
113
- ref = _ref6.ref,
114
- _onScroll = _ref6.onScroll;
115
- ref.current = connectObject;
116
- return /*#__PURE__*/_jsx(VariableSizeGridJSX, {
117
- ref: gridRef,
118
- className: "virtual-grid",
119
- columnCount: mergedColumns.length,
120
- columnWidth: function columnWidth(index) {
121
- var width = mergedColumns[index].width;
122
- return index === mergedColumns.length - 1 ? width - scrollbarSize - 1 : width;
123
- },
124
- height: scroll.y,
125
- rowCount: rawData.length,
126
- rowHeight: function rowHeight() {
127
- return 38;
128
- },
129
- width: domWidth,
130
- onScroll: function onScroll(_ref7) {
131
- var scrollLeft = _ref7.scrollLeft;
132
- _onScroll({
133
- scrollLeft: scrollLeft
134
- });
135
- },
136
- children: function children(_ref8) {
137
- var columnIndex = _ref8.columnIndex,
138
- rowIndex = _ref8.rowIndex,
139
- style = _ref8.style;
140
- var rowCName = rowClassName ? rowClassName(rawData[rowIndex], rowIndex) : '';
141
- return /*#__PURE__*/_jsx("div", {
142
- className: classNames('virtual-table-cell', rowCName, {
143
- 'virtual-table-cell-last': columnIndex === mergedColumns.length - 1
144
- }),
145
- style: style,
146
- children: renderVirtualListRow(columnIndex, rawData, rowIndex)
147
- });
148
- }
149
- });
150
- }, [connectObject, domWidth, mergedColumns, renderVirtualListRow, scroll.y]);
151
- return /*#__PURE__*/_jsx("div", {
152
- ref: domRef,
153
- children: /*#__PURE__*/_jsx(StyledTable, _objectSpread(_objectSpread({
154
- ref: parentRef
155
- }, restProps), {}, {
156
- scroll: scroll,
157
- className: classNames(className, 'virtual-table'),
158
- columns: mergedColumns,
159
- pagination: false,
160
- components: {
161
- body: function body(rowData, row) {
162
- return renderVirtualList(rowData, row, restProps.rowClassName);
163
- }
164
- }
165
- }))
166
- });
167
- }));