@kdcloudjs/table 1.1.6-canary.3 → 1.1.6-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.
@@ -4,10 +4,11 @@ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
4
4
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
5
5
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
6
6
  import _Map from "@babel/runtime-corejs3/core-js-stable/map";
7
+ import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
7
8
  import { getLeftNestedLockCount } from '../../base/calculations';
8
9
  import { isLeafNode, makeRecursiveMapper } from '../../utils';
9
10
  import { Classes } from '../../base/styles';
10
- import { COLUMN_SIZE_KEY, RESIZED_COLUMN_KEY } from './columnResizeWidth';
11
+ import { COLUMN_SIZE_KEY, LAST_RESIZED_COLUMN_KEY, RESIZED_COLUMN_KEY } from './columnResizeWidth';
11
12
  export var FILL_COLUMN_CODE = '$_fill_column_&';
12
13
  export var tableWidthKey = 'tableWidth';
13
14
 
@@ -134,6 +135,23 @@ function getTableRemainingWidth(pipeline) {
134
135
  return remainingWidth > 0 ? remainingWidth : 0;
135
136
  }
136
137
 
138
+ function isAfterLastResizeCol(column, pipeline) {
139
+ var _context, _context2;
140
+
141
+ var lastResizedColumnCode = pipeline.getFeatureOptions(LAST_RESIZED_COLUMN_KEY);
142
+ if (lastResizedColumnCode === undefined) return true;
143
+
144
+ var lastResizedColumnIndex = _findIndexInstanceProperty(_context = pipeline.getColumns()).call(_context, function (col) {
145
+ return col.code === lastResizedColumnCode;
146
+ });
147
+
148
+ var colIndex = _findIndexInstanceProperty(_context2 = pipeline.getColumns()).call(_context2, function (col) {
149
+ return col.code === column.code;
150
+ });
151
+
152
+ return colIndex > lastResizedColumnIndex;
153
+ }
154
+
137
155
  function isValidFlexColumn(col, pipeline) {
138
156
  var _a;
139
157
 
@@ -144,7 +162,7 @@ function isValidFlexColumn(col, pipeline) {
144
162
  }
145
163
 
146
164
  var flex = (_a = col.features) === null || _a === void 0 ? void 0 : _a.flex;
147
- return typeof flex === 'number' && flex > 0;
165
+ return typeof flex === 'number' && flex > 0 && isAfterLastResizeCol(col, pipeline);
148
166
  }
149
167
 
150
168
  function clamp(min, x, max) {
@@ -22,5 +22,6 @@ export interface ColumnResizeOptions {
22
22
  }
23
23
  export declare const COLUMN_SIZE_KEY = "columnResize";
24
24
  export declare const RESIZED_COLUMN_KEY = "resizedColumn";
25
+ export declare const LAST_RESIZED_COLUMN_KEY = "lastResizedColumn";
25
26
  export declare function columnResize(opts?: ColumnResizeOptions): (pipeline: TablePipeline) => TablePipeline;
26
27
  export {};
@@ -27,6 +27,7 @@ function disableSelect(event) {
27
27
  var stateKey = 'columnResize';
28
28
  export var COLUMN_SIZE_KEY = 'columnResize';
29
29
  export var RESIZED_COLUMN_KEY = 'resizedColumn';
30
+ export var LAST_RESIZED_COLUMN_KEY = 'lastResizedColumn';
30
31
  export function columnResize() {
31
32
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
33
 
@@ -134,6 +135,7 @@ export function columnResize() {
134
135
  });
135
136
 
136
137
  pipeline.setFeatureOptions(RESIZED_COLUMN_KEY, resizedColumnSet);
138
+ pipeline.setFeatureOptions(LAST_RESIZED_COLUMN_KEY, code);
137
139
  },
138
140
  complete: function complete() {
139
141
  var _context;
@@ -19,6 +19,8 @@ var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
19
19
 
20
20
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
21
21
 
22
+ var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
23
+
22
24
  var _calculations = require("../../base/calculations");
23
25
 
24
26
  var _utils = require("../../utils");
@@ -153,6 +155,20 @@ function getTableRemainingWidth(pipeline) {
153
155
  return remainingWidth > 0 ? remainingWidth : 0;
154
156
  }
155
157
 
158
+ function isAfterLastResizeCol(column, pipeline) {
159
+ var _context, _context2;
160
+
161
+ var lastResizedColumnCode = pipeline.getFeatureOptions(_columnResizeWidth.LAST_RESIZED_COLUMN_KEY);
162
+ if (lastResizedColumnCode === undefined) return true;
163
+ var lastResizedColumnIndex = (0, _findIndex.default)(_context = pipeline.getColumns()).call(_context, function (col) {
164
+ return col.code === lastResizedColumnCode;
165
+ });
166
+ var colIndex = (0, _findIndex.default)(_context2 = pipeline.getColumns()).call(_context2, function (col) {
167
+ return col.code === column.code;
168
+ });
169
+ return colIndex > lastResizedColumnIndex;
170
+ }
171
+
156
172
  function isValidFlexColumn(col, pipeline) {
157
173
  var _a;
158
174
 
@@ -163,7 +179,7 @@ function isValidFlexColumn(col, pipeline) {
163
179
  }
164
180
 
165
181
  var flex = (_a = col.features) === null || _a === void 0 ? void 0 : _a.flex;
166
- return typeof flex === 'number' && flex > 0;
182
+ return typeof flex === 'number' && flex > 0 && isAfterLastResizeCol(col, pipeline);
167
183
  }
168
184
 
169
185
  function clamp(min, x, max) {
@@ -22,5 +22,6 @@ export interface ColumnResizeOptions {
22
22
  }
23
23
  export declare const COLUMN_SIZE_KEY = "columnResize";
24
24
  export declare const RESIZED_COLUMN_KEY = "resizedColumn";
25
+ export declare const LAST_RESIZED_COLUMN_KEY = "lastResizedColumn";
25
26
  export declare function columnResize(opts?: ColumnResizeOptions): (pipeline: TablePipeline) => TablePipeline;
26
27
  export {};
@@ -11,7 +11,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
11
11
  Object.defineProperty(exports, "__esModule", {
12
12
  value: true
13
13
  });
14
- exports.RESIZED_COLUMN_KEY = exports.COLUMN_SIZE_KEY = void 0;
14
+ exports.RESIZED_COLUMN_KEY = exports.LAST_RESIZED_COLUMN_KEY = exports.COLUMN_SIZE_KEY = void 0;
15
15
  exports.columnResize = columnResize;
16
16
 
17
17
  var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
@@ -61,6 +61,8 @@ var COLUMN_SIZE_KEY = 'columnResize';
61
61
  exports.COLUMN_SIZE_KEY = COLUMN_SIZE_KEY;
62
62
  var RESIZED_COLUMN_KEY = 'resizedColumn';
63
63
  exports.RESIZED_COLUMN_KEY = RESIZED_COLUMN_KEY;
64
+ var LAST_RESIZED_COLUMN_KEY = 'lastResizedColumn';
65
+ exports.LAST_RESIZED_COLUMN_KEY = LAST_RESIZED_COLUMN_KEY;
64
66
 
65
67
  function columnResize() {
66
68
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -165,6 +167,7 @@ function columnResize() {
165
167
  resizedColumnSet.add(code, changedColumnSize[code]);
166
168
  });
167
169
  pipeline.setFeatureOptions(RESIZED_COLUMN_KEY, resizedColumnSet);
170
+ pipeline.setFeatureOptions(LAST_RESIZED_COLUMN_KEY, code);
168
171
  },
169
172
  complete: function complete() {
170
173
  var _context;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/table",
3
- "version": "1.1.6-canary.3",
3
+ "version": "1.1.6-canary.4",
4
4
  "description": "金蝶 react table 组件",
5
5
  "title": "table",
6
6
  "keywords": [