@kdcloudjs/table 1.1.3-canary.2 → 1.1.3-canary.4

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.
@@ -7,6 +7,10 @@ import { FILL_COLUMN_CODE } from './autoFill';
7
7
  var stateKey = 'columnDrag';
8
8
  var SCROLL_SIZE = 30;
9
9
 
10
+ function disableSelect(event) {
11
+ event.preventDefault();
12
+ }
13
+
10
14
  function sortColumns(columns, sort) {
11
15
  var res = new Array(columns.length);
12
16
 
@@ -63,7 +67,9 @@ export function columnDrag() {
63
67
  onMouseDown: !isLeaf || path.length > 1 ? undefined : function (e) {
64
68
  if (e.button !== 0) {
65
69
  return;
66
- } // const cx = e.clientX
70
+ }
71
+
72
+ window.addEventListener('selectstart', disableSelect); // const cx = e.clientX
67
73
  // const width = col.width
68
74
  // const a = startIndex
69
75
  // const b = endIndex
@@ -72,7 +78,6 @@ export function columnDrag() {
72
78
  // let newStartIndex = startIndex
73
79
  // let endIdx = endIndex
74
80
 
75
-
76
81
  var columnMoved = false;
77
82
  var columns = pipeline.getColumns();
78
83
 
@@ -245,6 +250,7 @@ export function columnDrag() {
245
250
  e.stopPropagation();
246
251
  document.body.removeEventListener('mousemove', handleMouseMove);
247
252
  document.body.removeEventListener('mouseup', handleMouseUp);
253
+ window.removeEventListener('selectstart', disableSelect);
248
254
  window.requestAnimationFrame(function () {
249
255
  // 取消阻止列头点击事件
250
256
  currentTarget.removeEventListener('click', stopClickPropagation);
@@ -330,10 +336,6 @@ export function columnDrag() {
330
336
 
331
337
  document.body.addEventListener('mousemove', handleMouseMove);
332
338
  document.body.addEventListener('mouseup', handleMouseUp);
333
-
334
- document.body.onselectstart = function () {
335
- return false;
336
- };
337
339
  },
338
340
  style: style
339
341
  })
@@ -134,7 +134,7 @@ export function filter() {
134
134
  return [item.key, _extends({}, item)];
135
135
  }));
136
136
 
137
- function isMatchedFilterCondition(record) {
137
+ function isMatchedFilterCondition(record, rowIndex) {
138
138
  return !filtersKeys.some(function (key) {
139
139
  var _a, _b;
140
140
 
@@ -149,14 +149,15 @@ export function filter() {
149
149
  } else {
150
150
  console.warn("\u5217[".concat(key, "]\u672A\u914D\u7F6E\u7B5B\u9009\u51FD\u6570\uFF0C\u8BF7\u8BBE\u7F6E column.features.filterable \u6765\u4F5C\u4E3A\u8BE5\u5217\u7684\u7B5B\u9009\u51FD\u6570, \u76EE\u524D\u4F7F\u7528\u9ED8\u8BA4\u5305\u542B\u7B5B\u9009\u51FD\u6570"));
151
151
  comparisonFn = _filterInstanceProperty(defaultFilterOptionsMap.get('contain'));
152
- }
152
+ } // 不符合过滤条件,退出循环
153
153
 
154
- return !comparisonFn(_filterInstanceProperty(filterItem))(record[key]); //不符合过滤条件,退出循环
154
+
155
+ return !comparisonFn(_filterInstanceProperty(filterItem), filterItem)(internals.safeGetValue(columnsMap.get(key), record, rowIndex), record);
155
156
  });
156
157
  }
157
158
 
158
- return dataSource.reduce(function (pre, record) {
159
- if (isMatchedFilterCondition(record)) {
159
+ return dataSource.reduce(function (pre, record, rowIndex) {
160
+ if (isMatchedFilterCondition(record, rowIndex)) {
160
161
  return _concatInstanceProperty(pre).call(pre, [record]);
161
162
  }
162
163
 
@@ -22,6 +22,10 @@ var _autoFill = require("./autoFill");
22
22
  var stateKey = 'columnDrag';
23
23
  var SCROLL_SIZE = 30;
24
24
 
25
+ function disableSelect(event) {
26
+ event.preventDefault();
27
+ }
28
+
25
29
  function sortColumns(columns, sort) {
26
30
  var res = new Array(columns.length);
27
31
  var lastColumns = (0, _toConsumableArray2.default)(columns);
@@ -77,7 +81,9 @@ function columnDrag() {
77
81
  onMouseDown: !isLeaf || path.length > 1 ? undefined : function (e) {
78
82
  if (e.button !== 0) {
79
83
  return;
80
- } // const cx = e.clientX
84
+ }
85
+
86
+ window.addEventListener('selectstart', disableSelect); // const cx = e.clientX
81
87
  // const width = col.width
82
88
  // const a = startIndex
83
89
  // const b = endIndex
@@ -86,7 +92,6 @@ function columnDrag() {
86
92
  // let newStartIndex = startIndex
87
93
  // let endIdx = endIndex
88
94
 
89
-
90
95
  var columnMoved = false;
91
96
  var columns = pipeline.getColumns();
92
97
 
@@ -259,6 +264,7 @@ function columnDrag() {
259
264
  e.stopPropagation();
260
265
  document.body.removeEventListener('mousemove', handleMouseMove);
261
266
  document.body.removeEventListener('mouseup', handleMouseUp);
267
+ window.removeEventListener('selectstart', disableSelect);
262
268
  window.requestAnimationFrame(function () {
263
269
  // 取消阻止列头点击事件
264
270
  currentTarget.removeEventListener('click', stopClickPropagation);
@@ -343,10 +349,6 @@ function columnDrag() {
343
349
 
344
350
  document.body.addEventListener('mousemove', handleMouseMove);
345
351
  document.body.addEventListener('mouseup', handleMouseUp);
346
-
347
- document.body.onselectstart = function () {
348
- return false;
349
- };
350
352
  },
351
353
  style: style
352
354
  })
@@ -157,7 +157,7 @@ function filter() {
157
157
  return [item.key, (0, _extends2.default)({}, item)];
158
158
  }));
159
159
 
160
- function isMatchedFilterCondition(record) {
160
+ function isMatchedFilterCondition(record, rowIndex) {
161
161
  return !filtersKeys.some(function (key) {
162
162
  var _a, _b;
163
163
 
@@ -172,14 +172,15 @@ function filter() {
172
172
  } else {
173
173
  console.warn("\u5217[".concat(key, "]\u672A\u914D\u7F6E\u7B5B\u9009\u51FD\u6570\uFF0C\u8BF7\u8BBE\u7F6E column.features.filterable \u6765\u4F5C\u4E3A\u8BE5\u5217\u7684\u7B5B\u9009\u51FD\u6570, \u76EE\u524D\u4F7F\u7528\u9ED8\u8BA4\u5305\u542B\u7B5B\u9009\u51FD\u6570"));
174
174
  comparisonFn = (0, _filter.default)(defaultFilterOptionsMap.get('contain'));
175
- }
175
+ } // 不符合过滤条件,退出循环
176
176
 
177
- return !comparisonFn((0, _filter.default)(filterItem))(record[key]); //不符合过滤条件,退出循环
177
+
178
+ return !comparisonFn((0, _filter.default)(filterItem), filterItem)(_internals.internals.safeGetValue(columnsMap.get(key), record, rowIndex), record);
178
179
  });
179
180
  }
180
181
 
181
- return dataSource.reduce(function (pre, record) {
182
- if (isMatchedFilterCondition(record)) {
182
+ return dataSource.reduce(function (pre, record, rowIndex) {
183
+ if (isMatchedFilterCondition(record, rowIndex)) {
183
184
  return (0, _concat.default)(pre).call(pre, [record]);
184
185
  }
185
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/table",
3
- "version": "1.1.3-canary.2",
3
+ "version": "1.1.3-canary.4",
4
4
  "description": "金蝶 react table 组件",
5
5
  "title": "table",
6
6
  "keywords": [