@arim-aisdc/public-components 0.0.21 → 0.0.23

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.
@@ -193,24 +193,7 @@ table {
193
193
  height: 300px;
194
194
  width: 2px;
195
195
  position: fixed;
196
- // z-index: 99999;
196
+ z-index: 99999;
197
197
  background-color: #000;
198
- // float: right;
199
- // display: inline-block;
200
- // float: right;
201
198
  }
202
199
 
203
- .column-divide-line {
204
- height: 300px;
205
- width: 2px;
206
- // z-index: 999;
207
- background-color: #000;
208
- // float: right;
209
- position: fixed;
210
- // float: right;
211
- display: none;
212
- // z-index: 99999;
213
- // display: inline-block;
214
-
215
- // display: none;
216
- }
@@ -97,6 +97,23 @@ var SettingItem = function SettingItem(_ref) {
97
97
  return [];
98
98
  }
99
99
  };
100
+
101
+ // 从左侧固定列中删除某一列
102
+ var deleteFromLeft = function deleteFromLeft() {
103
+ var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
104
+ var toDeleteId = arguments.length > 1 ? arguments[1] : undefined;
105
+ var newLeft = _toConsumableArray(left);
106
+ var index = newLeft.findIndex(function (item) {
107
+ return item === toDeleteId;
108
+ });
109
+ newLeft.splice(index, 1);
110
+ if (newLeft.length === [getRowCanExpand(), canSelection && !selectionWithoutChecked].filter(function (item) {
111
+ return item === true;
112
+ }).length) {
113
+ return [];
114
+ }
115
+ return newLeft;
116
+ };
100
117
  var columnPinningChange = function columnPinningChange(value) {
101
118
  console.log(value);
102
119
  var _ref2 = table.getState().columnPinning || {
@@ -106,42 +123,52 @@ var SettingItem = function SettingItem(_ref) {
106
123
  left = _ref2.left,
107
124
  right = _ref2.right;
108
125
  if (value === 'right') {
126
+ // 固定到右侧
109
127
  right.unshift(column.id);
128
+
129
+ // 如果之前是固定在左侧了,就从left中删掉
130
+ var newLeft = left;
131
+ if (left && left.includes(column.id)) {
132
+ newLeft = deleteFromLeft(left, column.id);
133
+ }
110
134
  table.setColumnPinning({
111
- left: left,
135
+ left: newLeft,
112
136
  right: cloneDeep(right)
113
137
  });
114
- return;
115
- }
116
- if (value === 'left') {
138
+ } else if (value === 'left') {
139
+ // 固定到左侧
117
140
  if (left.length === 0) {
118
- column.id !== ColumnType.Expander && getRowCanExpand() && left.push(ColumnType.Expander);
119
- column.id !== ColumnType.Selection && canSelection && !selectionWithoutChecked && left.push(ColumnType.Selection);
141
+ if (column.id !== ColumnType.Expander && getRowCanExpand()) {
142
+ left.push(ColumnType.Expander);
143
+ }
144
+ if (column.id !== ColumnType.Selection && canSelection && !selectionWithoutChecked) {
145
+ left.push(ColumnType.Selection);
146
+ }
120
147
  }
121
148
  left.push(column.id);
149
+
150
+ // 如果已经是固定在右侧了,就从右侧中删掉
151
+ if (right && right.includes(column.id)) {
152
+ var indexInRight = right.findIndex(function (item) {
153
+ return item === column.id;
154
+ });
155
+ right.splice(indexInRight, 1);
156
+ }
122
157
  table.setColumnPinning({
123
158
  left: cloneDeep(left),
124
- right: right
159
+ right: cloneDeep(right)
125
160
  });
126
- return;
127
- }
128
- if (value === false) {
161
+ } else if (value === false) {
129
162
  if (right && right.includes(column.id)) {
130
163
  column.pin(false);
131
164
  return;
132
165
  }
133
166
  if (left && left.includes(column.id)) {
134
- var index = left.findIndex(function (item) {
135
- return item === column.id;
136
- });
137
- left.splice(index, 1);
167
+ var _newLeft = deleteFromLeft(left, column.id);
138
168
  table.setColumnPinning({
139
- left: left.length === [getRowCanExpand(), canSelection || selectionWithoutChecked].filter(function (item) {
140
- return item === true;
141
- }).length ? [] : cloneDeep(left),
169
+ left: _newLeft,
142
170
  right: right
143
171
  });
144
- return;
145
172
  }
146
173
  }
147
174
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",