@titaui/pc 1.15.89-beta.1 → 1.15.89

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.
Files changed (96) hide show
  1. package/lib/components/button/index.js +4 -5
  2. package/lib/components/change-okr-modal/Filter.js +66 -70
  3. package/lib/components/edit-kr-wight/EditKrWightModal.js +21 -28
  4. package/lib/components/menus/export-modules/summary-menus/depart-menus/index.js +1 -1
  5. package/lib/components/okr-review/ReviewPop/components/ReviewBody/index.js +6 -10
  6. package/lib/components/operation-records/OperationRecordItem.js +3 -7
  7. package/lib/components/popup-select/index.css +0 -10
  8. package/lib/components/popup-select/index.js +2 -8
  9. package/lib/index.js +0 -8
  10. package/lib/pages/new-okr-list/header/index.js +12 -62
  11. package/lib/pages/new-okr-list/header/operate-record.js +49 -7
  12. package/lib/pages/new-okr-list/index.js +0 -1
  13. package/package.json +1 -1
  14. package/lib/components/okr-excel-create/components/kr-confidence/index.css +0 -18
  15. package/lib/components/okr-excel-create/components/kr-confidence/index.js +0 -61
  16. package/lib/components/okr-excel-create/components/kr-weight/index.css +0 -10
  17. package/lib/components/okr-excel-create/components/kr-weight/index.js +0 -114
  18. package/lib/components/okr-excel-create/components/okr-align/index.css +0 -49
  19. package/lib/components/okr-excel-create/components/okr-align/index.js +0 -139
  20. package/lib/components/okr-excel-create/components/okr-classify/index.css +0 -74
  21. package/lib/components/okr-excel-create/components/okr-classify/index.js +0 -117
  22. package/lib/components/okr-excel-create/components/okr-cycle/index.css +0 -40
  23. package/lib/components/okr-excel-create/components/okr-cycle/index.js +0 -85
  24. package/lib/components/okr-excel-create/components/okr-name/index.css +0 -48
  25. package/lib/components/okr-excel-create/components/okr-name/index.js +0 -116
  26. package/lib/components/okr-excel-create/components/okr-principal/index.css +0 -17
  27. package/lib/components/okr-excel-create/components/okr-principal/index.js +0 -107
  28. package/lib/components/okr-excel-create/components/okr-progress/components/kr-progress/index.css +0 -13
  29. package/lib/components/okr-excel-create/components/okr-progress/components/kr-progress/index.js +0 -46
  30. package/lib/components/okr-excel-create/components/okr-progress/components/o-progress/index.css +0 -13
  31. package/lib/components/okr-excel-create/components/okr-progress/components/o-progress/index.js +0 -47
  32. package/lib/components/okr-excel-create/components/okr-progress/components/okr-progress/index.css +0 -196
  33. package/lib/components/okr-excel-create/components/okr-progress/components/okr-progress/index.js +0 -319
  34. package/lib/components/okr-excel-create/components/okr-progress/components/okr-progress/request-api.js +0 -20
  35. package/lib/components/okr-excel-create/components/okr-progress/components/okr-progress/util.js +0 -134
  36. package/lib/components/okr-excel-create/components/okr-progress/index.css +0 -25
  37. package/lib/components/okr-excel-create/components/okr-progress/index.js +0 -90
  38. package/lib/components/okr-excel-create/components/okr-progress/interface.js +0 -5
  39. package/lib/components/okr-excel-create/components/okr-type/base-okr-type/confirm/buttonv2.js +0 -108
  40. package/lib/components/okr-excel-create/components/okr-type/base-okr-type/confirm/confirm.js +0 -166
  41. package/lib/components/okr-excel-create/components/okr-type/base-okr-type/index.css +0 -20
  42. package/lib/components/okr-excel-create/components/okr-type/base-okr-type/index.js +0 -76
  43. package/lib/components/okr-excel-create/components/okr-type/base-okr-type/object-type.js +0 -275
  44. package/lib/components/okr-excel-create/components/okr-type/index.css +0 -30
  45. package/lib/components/okr-excel-create/components/okr-type/index.js +0 -196
  46. package/lib/components/okr-excel-create/components/okr-visibility/index.css +0 -53
  47. package/lib/components/okr-excel-create/components/okr-visibility/index.js +0 -236
  48. package/lib/components/okr-excel-create/components-new/kr-confidence/index.css +0 -18
  49. package/lib/components/okr-excel-create/components-new/kr-confidence/index.js +0 -71
  50. package/lib/components/okr-excel-create/components-new/kr-weight/index.css +0 -10
  51. package/lib/components/okr-excel-create/components-new/kr-weight/index.js +0 -123
  52. package/lib/components/okr-excel-create/components-new/okr-align/index.css +0 -49
  53. package/lib/components/okr-excel-create/components-new/okr-align/index.js +0 -139
  54. package/lib/components/okr-excel-create/components-new/okr-classify/index.css +0 -74
  55. package/lib/components/okr-excel-create/components-new/okr-classify/index.js +0 -125
  56. package/lib/components/okr-excel-create/components-new/okr-cycle/index.css +0 -40
  57. package/lib/components/okr-excel-create/components-new/okr-cycle/index.js +0 -99
  58. package/lib/components/okr-excel-create/components-new/okr-name/index.css +0 -48
  59. package/lib/components/okr-excel-create/components-new/okr-name/index.js +0 -133
  60. package/lib/components/okr-excel-create/components-new/okr-principal/index.css +0 -17
  61. package/lib/components/okr-excel-create/components-new/okr-principal/index.js +0 -116
  62. package/lib/components/okr-excel-create/components-new/okr-progress/components/kr-progress/index.css +0 -13
  63. package/lib/components/okr-excel-create/components-new/okr-progress/components/kr-progress/index.js +0 -46
  64. package/lib/components/okr-excel-create/components-new/okr-progress/components/o-progress/index.css +0 -13
  65. package/lib/components/okr-excel-create/components-new/okr-progress/components/o-progress/index.js +0 -47
  66. package/lib/components/okr-excel-create/components-new/okr-progress/components/okr-progress/index.css +0 -196
  67. package/lib/components/okr-excel-create/components-new/okr-progress/components/okr-progress/index.js +0 -319
  68. package/lib/components/okr-excel-create/components-new/okr-progress/components/okr-progress/request-api.js +0 -20
  69. package/lib/components/okr-excel-create/components-new/okr-progress/components/okr-progress/util.js +0 -134
  70. package/lib/components/okr-excel-create/components-new/okr-progress/index.css +0 -25
  71. package/lib/components/okr-excel-create/components-new/okr-progress/index.js +0 -90
  72. package/lib/components/okr-excel-create/components-new/okr-progress/interface.js +0 -5
  73. package/lib/components/okr-excel-create/components-new/okr-type/base-okr-type/confirm/buttonv2.js +0 -108
  74. package/lib/components/okr-excel-create/components-new/okr-type/base-okr-type/confirm/confirm.js +0 -166
  75. package/lib/components/okr-excel-create/components-new/okr-type/base-okr-type/index.css +0 -20
  76. package/lib/components/okr-excel-create/components-new/okr-type/base-okr-type/index.js +0 -76
  77. package/lib/components/okr-excel-create/components-new/okr-type/base-okr-type/object-type.js +0 -275
  78. package/lib/components/okr-excel-create/components-new/okr-type/index.css +0 -30
  79. package/lib/components/okr-excel-create/components-new/okr-type/index.js +0 -205
  80. package/lib/components/okr-excel-create/components-new/okr-visibility/index.css +0 -53
  81. package/lib/components/okr-excel-create/components-new/okr-visibility/index.js +0 -248
  82. package/lib/components/okr-excel-create/constant.js +0 -14
  83. package/lib/components/okr-excel-create/hooks.js +0 -314
  84. package/lib/components/okr-excel-create/img/base-info-add.svg +0 -19
  85. package/lib/components/okr-excel-create/img/desire.svg +0 -61
  86. package/lib/components/okr-excel-create/img/promise.svg +0 -61
  87. package/lib/components/okr-excel-create/index-old.js +0 -258
  88. package/lib/components/okr-excel-create/index.css +0 -69
  89. package/lib/components/okr-excel-create/index.js +0 -221
  90. package/lib/components/okr-excel-create/setting.js +0 -21
  91. package/lib/components/okr-excel-create/type.js +0 -5
  92. package/lib/components/okr-excel-create/utils.js +0 -179
  93. package/lib/components/table-excel-v2/index.css +0 -55
  94. package/lib/components/table-excel-v2/index.js +0 -472
  95. package/lib/components/table-excel-v2/utils.js +0 -20
  96. package/lib/utils/array.js +0 -26
@@ -1,472 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _web = require("@react-spring/web");
13
-
14
- var _react2 = require("@use-gesture/react");
15
-
16
- var _lodash = require("lodash");
17
-
18
- var _array = require("../../utils/array");
19
-
20
- require("./index.css");
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
-
28
- 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."); }
29
-
30
- 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); }
31
-
32
- 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; }
33
-
34
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
35
-
36
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
-
38
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
39
-
40
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
41
-
42
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
43
-
44
- var preCls = 'titaui-table-excel-v2';
45
-
46
- function slice(arr, start, end) {
47
- if (end > start) return arr.slice(start, end);else return arr.slice(end, start);
48
- }
49
-
50
- function columnsWidth(columns) {
51
- return columns.map(function (_ref) {
52
- var width = _ref.width;
53
- return width;
54
- }).reduce(function (prev, curv) {
55
- return prev + curv;
56
- }, 0);
57
- }
58
-
59
- var findFirstColumn = function findFirstColumn(columns) {
60
- return columns.find(function (_ref2) {
61
- var sortOrder = _ref2.sortOrder;
62
- return sortOrder === 0;
63
- });
64
- }; // 创建链表结构
65
-
66
-
67
- var createLink = function createLink(columns) {
68
- var columnsDic = (0, _array.arr2Dic)(columns, 'sortOrder');
69
- var firstColumn = findFirstColumn(columns);
70
-
71
- if (!firstColumn) {
72
- console.error('排序格式错误', columns);
73
- throw new Error('排序格式错误');
74
- } // @ts-ignore
75
-
76
-
77
- while (firstColumn) {
78
- // @ts-ignore
79
- var back = firstColumn.sortOrder === 0 ? null : columnsDic[firstColumn.sortOrder - 1][0]; // @ts-ignore
80
-
81
- var next = columnsDic[firstColumn.sortOrder + 1][0] || null; // @ts-ignore
82
-
83
- firstColumn.back = back;
84
- firstColumn.next = next;
85
- firstColumn = next;
86
- }
87
-
88
- return columns;
89
- };
90
-
91
- var columnsToOrderColumns = function columnsToOrderColumns(columns) {
92
- return (0, _lodash.orderBy)(columns, 'sortOrder');
93
- }; // 计算偏移
94
-
95
-
96
- var createX = function createX(columns) {
97
- var orderColumns = columnsToOrderColumns(columns);
98
- return columns.map(function (column, index) {
99
- // 如果是在移动中,使用 startSortOrder 作为排序位置计算偏移
100
- var orderIndex = column.moveing ? column.startSortOrder : orderColumns.findIndex(function (_ref3) {
101
- var key = _ref3.key;
102
- return key === column.key;
103
- });
104
- var offsetX = columnsWidth(slice(orderColumns, index, orderIndex));
105
- var x = orderIndex >= index ? offsetX : -offsetX;
106
- return _objectSpread(_objectSpread({}, column), {}, {
107
- x: x
108
- });
109
- });
110
- };
111
-
112
- var findOrderColumnIndex = function findOrderColumnIndex(orderColumns, columnKey) {
113
- return orderColumns.findIndex(function (_ref4) {
114
- var key = _ref4.key;
115
- return key === columnKey;
116
- });
117
- };
118
-
119
- var findColumnIndex = function findColumnIndex(columns, columnKey) {
120
- return columns.findIndex(function (_ref5) {
121
- var key = _ref5.key;
122
- return key === columnKey;
123
- });
124
- };
125
-
126
- var findColumn = function findColumn(columns, columnKey) {
127
- return columns.find(function (_ref6) {
128
- var key = _ref6.key;
129
- return key === columnKey;
130
- });
131
- }; // 计算边界值
132
-
133
-
134
- var getBoundary = function getBoundary(columns, colIndex, offsetIndex, direction) {
135
- var _orderColumns$boundar;
136
-
137
- var isRight = direction === 'right';
138
- var orderColumns = columnsToOrderColumns(columns);
139
- var currentColumn = columns[colIndex];
140
- var orderColumnIndex = findOrderColumnIndex(orderColumns, currentColumn.key);
141
- var currentColumnWidth = currentColumn.width;
142
- var boundaryColumnIndex = isRight ? orderColumnIndex + offsetIndex + 1 : orderColumnIndex - offsetIndex - 1;
143
- var boundaryColumnWidth = ((_orderColumns$boundar = orderColumns[boundaryColumnIndex]) === null || _orderColumns$boundar === void 0 ? void 0 : _orderColumns$boundar.width) || 0;
144
- var boundary = columnsWidth(slice(orderColumns, isRight ? orderColumnIndex : orderColumnIndex + 1, isRight ? boundaryColumnIndex + 1 : boundaryColumnIndex)) - currentColumnWidth / 2 - boundaryColumnWidth / 2;
145
- return isRight ? boundary : -boundary;
146
- };
147
-
148
- var getChangeColumnIndex = function getChangeColumnIndex(columns, colIndex, offsetIndex, direction) {
149
- var whileColumn = columns[colIndex];
150
-
151
- while (offsetIndex >= 0) {
152
- whileColumn = direction === 'right' ? whileColumn.next : whileColumn.back;
153
- offsetIndex--;
154
- }
155
-
156
- return findColumnIndex(columns, whileColumn.key);
157
- }; // 找到要移动的元素
158
-
159
-
160
- var getChangeColumn = function getChangeColumn(columns, colIndex, offsetIndex, direction) {
161
- var whileColumn = columns[colIndex];
162
-
163
- while (offsetIndex >= 0) {
164
- whileColumn = direction === 'right' ? whileColumn.next : whileColumn.back;
165
- offsetIndex--;
166
- }
167
-
168
- return whileColumn;
169
- };
170
-
171
- var log = function log(title, columns) {
172
- console.log(title);
173
- console.table((0, _lodash.cloneDeep)(columns.map(function (_ref7) {
174
- var title = _ref7.title,
175
- sortOrder = _ref7.sortOrder,
176
- moveing = _ref7.moveing,
177
- next = _ref7.next,
178
- back = _ref7.back,
179
- x = _ref7.x;
180
- return {
181
- title: title,
182
- moveing: moveing,
183
- sortOrder: sortOrder,
184
- x: x,
185
- back: (back === null || back === void 0 ? void 0 : back.title) || null,
186
- next: (next === null || next === void 0 ? void 0 : next.title) || null
187
- };
188
- })));
189
- };
190
-
191
- var TableExcelV2 = function TableExcelV2(_ref8) {
192
- var className = _ref8.className,
193
- style = _ref8.style,
194
- columns = _ref8.columns,
195
- dataSource = _ref8.dataSource,
196
- rowKey = _ref8.rowKey;
197
- var tableContentWidth = (0, _react.useMemo)(function () {
198
- return columnsWidth(columns);
199
- }, [columns]);
200
-
201
- var _useState = (0, _react.useState)([]),
202
- _useState2 = _slicedToArray(_useState, 2),
203
- renderColumns = _useState2[0],
204
- setRenderColumns = _useState2[1];
205
-
206
- var _useState3 = (0, _react.useState)([]),
207
- _useState4 = _slicedToArray(_useState3, 2),
208
- _columns = _useState4[0],
209
- setColumns = _useState4[1];
210
-
211
- var _useState5 = (0, _react.useState)([]),
212
- _useState6 = _slicedToArray(_useState5, 2),
213
- columnsSnapshot = _useState6[0],
214
- setColumnsSnapshot = _useState6[1];
215
-
216
- (0, _react.useEffect)(function () {
217
- log('_columns update', _columns);
218
- }, [_columns]);
219
- (0, _react.useEffect)(function () {
220
- var hasSortOrderColumns = columns.map(function (column, i) {
221
- return _objectSpread(_objectSpread({}, column), {}, {
222
- level: column.level || 1,
223
- sortOrder: column.sortOrder !== undefined ? column.sortOrder : i
224
- });
225
- });
226
- setColumns(createX(createLink(hasSortOrderColumns)));
227
- var levelColumnDic = (0, _array.arr2Dic)(hasSortOrderColumns, 'level', {
228
- alwaysArray: true
229
- });
230
- var levelColumnArr = Object.entries(levelColumnDic).map(function (_ref9) {
231
- var _ref10 = _slicedToArray(_ref9, 2),
232
- level = _ref10[0],
233
- columns = _ref10[1];
234
-
235
- return {
236
- level: level,
237
- columns: columns
238
- };
239
- });
240
- var renderColumns = (0, _lodash.orderBy)(levelColumnArr, 'level').map(function (_ref11) {
241
- var columns = _ref11.columns;
242
- return columns;
243
- });
244
- setRenderColumns(renderColumns);
245
- }, [columns]);
246
-
247
- var _useSprings = (0, _web.useSprings)(_columns.length, function (i) {
248
- var opsition = {
249
- x: _columns[i].x
250
- };
251
- return opsition;
252
- }),
253
- _useSprings2 = _slicedToArray(_useSprings, 2),
254
- positions = _useSprings2[0],
255
- api = _useSprings2[1];
256
-
257
- var nextColumnCenterPosition = (0, _react.useRef)();
258
- var bind = (0, _react2.useDrag)(function (_ref12) {
259
- var _ref12$movement = _slicedToArray(_ref12.movement, 1),
260
- mx = _ref12$movement[0],
261
- _ref12$args = _slicedToArray(_ref12.args, 1),
262
- colIndex = _ref12$args[0].colIndex,
263
- active = _ref12.active,
264
- direction = _ref12.direction;
265
-
266
- var isMoveRight = direction[0] > 0;
267
-
268
- if (!active) {
269
- _columns[colIndex].moveing = false;
270
- _columns[colIndex].startSortOrder = undefined;
271
- nextColumnCenterPosition.current = undefined;
272
- _columns = createX(createLink(_columns));
273
- setColumns(_columns);
274
- console.log('reset current', nextColumnCenterPosition.current);
275
- }
276
-
277
- if (active && mx !== 0) {
278
- var _direction = mx > 0 ? 'right' : 'left';
279
-
280
- var isRight = _direction === 'right'; // 初始化
281
- // 保存 columns 快照
282
- // 计算边界值
283
- // 存储当前状态
284
-
285
- if (!nextColumnCenterPosition.current) {
286
- var currentColumn = _columns[colIndex];
287
- var currentOrder = currentColumn.sortOrder;
288
- var boundaryColumn = isRight ? currentColumn.next : currentColumn.back;
289
-
290
- if (boundaryColumn) {
291
- var boundary = getBoundary(_columns, colIndex, 0, _direction);
292
- nextColumnCenterPosition.current = {
293
- colIndex: colIndex,
294
- offsetIndex: 0,
295
- boundary: boundary,
296
- direction: _direction,
297
- startOrder: currentOrder
298
- };
299
- }
300
-
301
- currentColumn.moveing = true;
302
- currentColumn.startSortOrder = currentOrder;
303
- setColumnsSnapshot((0, _lodash.cloneDeep)(_columns));
304
- setColumns(createX(createLink(_columns)));
305
- console.log('init current', _objectSpread({}, nextColumnCenterPosition.current));
306
- }
307
-
308
- if (nextColumnCenterPosition.current) {
309
- // let { offsetIndex, boundary } = nextColumnCenterPosition.current
310
- var _currentColumn = _columns[colIndex];
311
- var nextColumn = _currentColumn.next;
312
- console.log('nextColumn', nextColumn); // @ts-ignore
313
-
314
- if (isMoveRight && nextColumn && _currentColumn.sortOrder < nextColumn.sortOrder) {
315
- var changeColumn = findColumn(_columns, nextColumn.key);
316
- var currentColumnWidth = _currentColumn.width;
317
- var nextColumnWidth = changeColumn.width;
318
-
319
- if (mx > currentColumnWidth / 2 + nextColumnWidth / 2) {
320
- var newOrder = changeColumn.sortOrder;
321
- changeColumn.sortOrder = _currentColumn.sortOrder;
322
- _currentColumn.sortOrder = newOrder;
323
- setColumns(createX(createLink(_columns)));
324
- }
325
- } // 交换列
326
- // 更新 boundary
327
- // if (((isRight && mx > boundary) || (!isRight && mx < boundary)) && (isMoveRight === isRight)) {
328
- // const currentColumn = _columns[colIndex]
329
- // // 获取到快照中下一个需要移动的列
330
- // const changeSnapshotColumn = getChangeColumn(columnsSnapshot, colIndex, offsetIndex, direction)
331
- // if (changeSnapshotColumn) {
332
- // // 找到真实列表中对应的列
333
- // const changeColumn = findColumn(_columns, changeSnapshotColumn.key) as ColumnOption
334
- // // 移动拖动列
335
- // currentColumn.sortOrder = changeColumn.sortOrder
336
- // // 移动后面的列
337
- // // @ts-ignore
338
- // isRight ? changeColumn.sortOrder -= 1 : changeColumn.sortOrder += 1
339
- // // 增加偏移量
340
- // nextColumnCenterPosition.current.offsetIndex += 1
341
- // nextColumnCenterPosition.current.boundary = getBoundary(columnsSnapshot, colIndex, offsetIndex + 1, direction)
342
- // console.log('update current', {...nextColumnCenterPosition.current});
343
- // setColumns(createX(createLink(_columns)))
344
- // }
345
- // }
346
-
347
- }
348
- }
349
-
350
- api.start(function (i) {
351
- if (i === colIndex && active) {
352
- // @ts-ignore
353
- return {
354
- x: _columns[i].x + mx
355
- };
356
- } else {
357
- return {
358
- x: _columns[i].x
359
- };
360
- }
361
- });
362
- });
363
-
364
- var render = function render(data, _ref13, rowIdx, colIdx, rootData, rootIdx) {
365
- var render = _ref13.render,
366
- dataIndex = _ref13.dataIndex,
367
- width = _ref13.width,
368
- title = _ref13.title;
369
- var Render = render;
370
- return /*#__PURE__*/_react["default"].createElement(_web.animated.div, {
371
- className: "".concat(preCls, "__box"),
372
- style: {
373
- width: width,
374
- x: positions[colIdx].x
375
- }
376
- }, Render ? /*#__PURE__*/_react["default"].createElement(Render, {
377
- value: (0, _lodash.get)(data, dataIndex),
378
- data: data,
379
- rowIdx: rowIdx,
380
- rootData: rootData,
381
- rootIdx: rootIdx
382
- }) : (0, _lodash.get)(data, dataIndex));
383
- };
384
-
385
- var renderChilds = function renderChilds(childs, currentLevel, rootData, rootIdx) {
386
- return childs.map(function (data, rowIdx) {
387
- return /*#__PURE__*/_react["default"].createElement("div", {
388
- key: rowIdx,
389
- className: "".concat(preCls, "__row")
390
- }, renderRow({
391
- data: data,
392
- rowIdx: rowIdx,
393
- currentLevel: currentLevel + 1,
394
- rootData: rootData,
395
- rootIdx: rootIdx
396
- }));
397
- });
398
- };
399
-
400
- var renderBox = function renderBox(data, columnOption, currentLevel, rowIdx, colIdx, rootData, rootIdx) {
401
- if ((columnOption.level || 1) === currentLevel) {
402
- return render(data, columnOption, rowIdx, colIdx, rootData, rootIdx);
403
- } // if ((columnOption.level || 1) === currentLevel + 1) {
404
- // return (
405
- // <div className={`${preCls}__childs`}>
406
- // {data.childs ? (
407
- // renderChilds(data.childs, currentLevel)
408
- // ) : (
409
- // <animated.div
410
- // className={`${preCls}__box`}
411
- // style={{ width: columnOption.width, x: positions[colIdx].x }}
412
- // ></animated.div>
413
- // )}
414
- // </div>
415
- // )
416
- // }
417
-
418
-
419
- return '';
420
- };
421
-
422
- var renderRow = (0, _react.useCallback)(function (_ref14) {
423
- var data = _ref14.data,
424
- rowIdx = _ref14.rowIdx,
425
- _ref14$currentLevel = _ref14.currentLevel,
426
- currentLevel = _ref14$currentLevel === void 0 ? 1 : _ref14$currentLevel,
427
- rootData = _ref14.rootData,
428
- rootIdx = _ref14.rootIdx;
429
- if (!renderColumns[currentLevel - 1]) return;
430
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderColumns[currentLevel - 1].map(function (columnOption, colIdx) {
431
- return renderBox(data, columnOption, currentLevel, rowIdx, colIdx, rootData, rootIdx);
432
- }), renderColumns[currentLevel] && data.childs && /*#__PURE__*/_react["default"].createElement("div", {
433
- className: "".concat(preCls, "__childs")
434
- }, renderChilds(data.childs, currentLevel, rootData, rootIdx)));
435
- }, [renderColumns]);
436
- return /*#__PURE__*/_react["default"].createElement("div", {
437
- className: "".concat(preCls, " ").concat(className),
438
- style: style
439
- }, /*#__PURE__*/_react["default"].createElement("div", {
440
- className: "".concat(preCls, "__header")
441
- }, _columns.map(function (_ref15, i) {
442
- var width = _ref15.width,
443
- title = _ref15.title,
444
- key = _ref15.key;
445
- return /*#__PURE__*/_react["default"].createElement(_web.animated.div, {
446
- key: key // {...bind({ colIndex: i })}
447
- ,
448
- style: {
449
- width: width,
450
- x: positions[i].x
451
- }
452
- }, title);
453
- })), dataSource.map(function (data, rowIdx) {
454
- return /*#__PURE__*/_react["default"].createElement("div", {
455
- key: rowKey ? data[rowKey] : rowIdx,
456
- className: "".concat(preCls, "__row ").concat(preCls, "__row--root"),
457
- style: {
458
- width: tableContentWidth
459
- }
460
- }, renderRow({
461
- data: data,
462
- rowIdx: rowIdx,
463
- currentLevel: 1,
464
- rootData: data,
465
- rootIdx: rowIdx
466
- }));
467
- }));
468
- };
469
-
470
- var _default = /*#__PURE__*/_react["default"].memo(TableExcelV2);
471
-
472
- exports["default"] = _default;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.sortAscObjectItem = sortAscObjectItem;
7
-
8
- var _lodash = require("lodash");
9
-
10
- function sortAscObjectItem(arr, field) {
11
- function compare(path) {
12
- return function (a, b) {
13
- var value1 = path ? (0, _lodash.get)(a, path) : a;
14
- var value2 = path ? (0, _lodash.get)(b, path) : b;
15
- return value1 - value2;
16
- };
17
- }
18
-
19
- return arr.sort(compare(field));
20
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.arr2Dic = arr2Dic;
7
-
8
- function arr2Dic() {
9
- var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
10
- var field = arguments.length > 1 ? arguments[1] : undefined;
11
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12
- var _options$alwaysArray = options.alwaysArray,
13
- alwaysArray = _options$alwaysArray === void 0 ? false : _options$alwaysArray;
14
- var dic = {};
15
- arr.forEach(function (vo) {
16
- if (dic[vo[field]]) {
17
- if (!Array.isArray(dic[vo[field]])) dic[vo[field]] = [dic[vo[field]]];
18
- dic[vo[field]].push(vo);
19
- return;
20
- }
21
-
22
- dic[vo[field]] = alwaysArray ? [vo] : vo;
23
- }); // @ts-ignore
24
-
25
- return dic;
26
- }