iov-design 2.15.32 → 2.15.34

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.
@@ -11001,10 +11001,8 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11001
11001
  isCrossPageSelection: false,
11002
11002
  // 全选下拉出现/隐藏事件
11003
11003
  showSelectionDropdown: false,
11004
- // 1-全选当前页 2-取消全选当前页 3-全选所有页 4-取消全选所有页
11005
- selectionType: 0,
11006
11004
  // 已取消勾选的数据
11007
- unSelectedRow: [],
11005
+ unSelectionData: [],
11008
11006
 
11009
11007
  // 过滤
11010
11008
  filters: {}, // 不可响应的
@@ -11082,6 +11080,8 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11082
11080
  return selection.indexOf(row) > -1;
11083
11081
  },
11084
11082
  clearSelection: function clearSelection() {
11083
+ var emitChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
11084
+
11085
11085
  var states = this.states;
11086
11086
  states.isAllSelected = false;
11087
11087
  var oldSelection = states.selection;
@@ -11097,7 +11097,7 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11097
11097
  });
11098
11098
  if (oldSelection.length) {
11099
11099
  states.selection = isDisabledSelection;
11100
- this.table.$emit('selection-change', states.selection, false);
11100
+ emitChange && this.table.$emit('selection-change', states.selection, states.isCrossPageSelection);
11101
11101
  }
11102
11102
  },
11103
11103
  cleanSelection: function cleanSelection() {
@@ -11141,7 +11141,7 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11141
11141
  this.table.$emit('select', newSelection, row);
11142
11142
  }
11143
11143
  if (this.states.isCrossPageSelection) {
11144
- this.table.$emit('selection-change', this.states.unSelectedRow, true);
11144
+ this.table.$emit('selection-change', this.states.unSelectionData, true);
11145
11145
  } else {
11146
11146
  this.table.$emit('selection-change', newSelection, false);
11147
11147
  }
@@ -11149,6 +11149,71 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11149
11149
  },
11150
11150
 
11151
11151
 
11152
+ /**
11153
+ * 选择数据事件
11154
+ * @param {num} command 选择事件类型 1-全选当前页 2-清空当前页 3-全选所有页 4-清空所有页
11155
+ */
11156
+ onSelectionChange: function onSelectionChange(command) {
11157
+ switch (command) {
11158
+ // 全选当前页
11159
+ case 1:
11160
+ this.onChangeCurrentPage(true, command);
11161
+ break;
11162
+ // 清空当前页
11163
+ case 2:
11164
+ this.onChangeCurrentPage(false, command);
11165
+ break;
11166
+ // 全选所有页
11167
+ case 3:
11168
+ this.states.isCrossPageSelection = true;
11169
+ this.onChangeCurrentPage(true, command);
11170
+ break;
11171
+ // 清空所有页
11172
+ case 4:
11173
+ this.onChangeCurrentPage(false, command);
11174
+ break;
11175
+ default:
11176
+ break;
11177
+ }
11178
+ },
11179
+ onChangeCurrentPage: function onChangeCurrentPage(selected, command) {
11180
+ var states = this.states;
11181
+ var _states$data = states.data,
11182
+ data = _states$data === undefined ? [] : _states$data,
11183
+ selection = states.selection;
11184
+
11185
+ data.forEach(function (row, index) {
11186
+ if (states.selectable) {
11187
+ if (states.selectable.call(null, row, index)) {
11188
+ toggleRowStatus(selection, row, selected);
11189
+ }
11190
+ } else {
11191
+ toggleRowStatus(selection, row, selected);
11192
+ }
11193
+ });
11194
+ this.updateAllSelected();
11195
+
11196
+ // 先点击跨页全选,再点击清空当前页/取消几条勾选数据, 最后点击全选当前页
11197
+ if (states.isCrossPageSelection) {
11198
+ // 重新计算未选中数据
11199
+ this.getUnSelectedRow(states.selection);
11200
+ }
11201
+
11202
+ if (command === 4) {
11203
+ states.isCrossPageSelection = false;
11204
+ this.clearSelection(false);
11205
+ states.unSelectionData = [];
11206
+ }
11207
+
11208
+ // 触发el-table的'selection-change'事件
11209
+ if (states.isCrossPageSelection) {
11210
+ this.table.$listeners['selection-change'](states.unSelectionData, states.isCrossPageSelection);
11211
+ } else {
11212
+ this.table.$listeners['selection-change'](states.selection, states.isCrossPageSelection);
11213
+ }
11214
+ },
11215
+
11216
+
11152
11217
  /**
11153
11218
  * 获取取消勾选数据项
11154
11219
  * @param {arr} selection 当前已选择所有数据项
@@ -11158,17 +11223,17 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11158
11223
 
11159
11224
  if (!this.states.isCrossPageSelection) return;
11160
11225
 
11161
- var rowKey = this.table.rowKey;
11226
+ var rowKey = this.states.rowKey;
11162
11227
 
11163
11228
  // 从全部勾选数据中过滤出当前页勾选的数据
11164
11229
 
11165
- var selected = this.table.data.filter(function (item) {
11230
+ var selected = this.states.data.filter(function (item) {
11166
11231
  return selection.some(function (row) {
11167
11232
  return row[rowKey] === item[rowKey];
11168
11233
  });
11169
11234
  });
11170
11235
  // 通过当前页数据与当前页已勾选的数据, 过滤出当前页未勾选的数据
11171
- var unselected = this.table.data.filter(function (item) {
11236
+ var unselected = this.states.data.filter(function (item) {
11172
11237
  return !selected.some(function (row) {
11173
11238
  return row[rowKey] === item[rowKey];
11174
11239
  });
@@ -11176,30 +11241,30 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11176
11241
 
11177
11242
  // 取消勾选数据中是否存在当页面已勾选的数据项, 如有则删除
11178
11243
  var index = [];
11179
- this.states.unSelectedRow.forEach(function (item, i) {
11244
+ this.states.unSelectionData.forEach(function (item, i) {
11180
11245
  if (selected.some(function (s) {
11181
11246
  return s[rowKey] === item[rowKey];
11182
11247
  })) {
11183
11248
  index.push(i);
11184
11249
  }
11185
11250
  });
11186
- this.states.unSelectedRow = this.states.unSelectedRow.filter(function (item, i) {
11251
+ this.states.unSelectionData = this.states.unSelectionData.filter(function (item, i) {
11187
11252
  return !index.includes(i);
11188
11253
  });
11189
11254
 
11190
11255
  // 取消勾选数据中如果不存在当前页未勾选的数据, 则将当前未勾选的数据添push到取消勾选数据中
11191
11256
  unselected.forEach(function (item) {
11192
- if (!_this.states.unSelectedRow.some(function (s) {
11257
+ if (!_this.states.unSelectionData.some(function (s) {
11193
11258
  return s[rowKey] === item[rowKey];
11194
11259
  })) {
11195
- _this.states.unSelectedRow.push(item);
11260
+ _this.states.unSelectionData.push(item);
11196
11261
  }
11197
11262
  });
11198
11263
  },
11199
11264
  _toggleAllSelection: function _toggleAllSelection() {
11200
11265
  var states = this.states;
11201
- var _states$data = states.data,
11202
- data = _states$data === undefined ? [] : _states$data,
11266
+ var _states$data2 = states.data,
11267
+ data = _states$data2 === undefined ? [] : _states$data2,
11203
11268
  selection = states.selection;
11204
11269
  // when only some rows are selected (but not all), select or deselect all of them
11205
11270
  // depending on the value of selectOnIndeterminate
@@ -11225,7 +11290,7 @@ var doFlattenColumns = function doFlattenColumns(columns) {
11225
11290
  if (selectionChanged) {
11226
11291
  if (states.isCrossPageSelection) {
11227
11292
  this.getUnSelectedRow(newSelection);
11228
- this.table.$emit('selection-change', states.unSelectedRow || [], true);
11293
+ this.table.$emit('selection-change', states.unSelectionData || [], true);
11229
11294
  } else {
11230
11295
  this.table.$emit('selection-change', selection ? selection.slice() : [], false);
11231
11296
  }
@@ -13218,52 +13283,47 @@ var convertToRows = function convertToRows(originColumns) {
13218
13283
  var states = this.store.states;
13219
13284
  var _states$data = states.data,
13220
13285
  data = _states$data === undefined ? [] : _states$data,
13221
- selection = states.selection;
13222
- var rowKey = this.table.rowKey;
13223
- // 全选所有页
13286
+ selection = states.selection,
13287
+ unSelectionData = states.unSelectionData,
13288
+ rowKey = states.rowKey;
13224
13289
 
13290
+ var selectionRowKeys = selection.map(function (item) {
13291
+ return item[rowKey];
13292
+ });
13293
+ var unSelectionRowKeys = unSelectionData.map(function (item) {
13294
+ return item[rowKey];
13295
+ });
13296
+ // console.log(data, 'data');
13297
+ // console.log(selection, unSelectionRowKeys, 'selection');
13298
+ // 全选所有页
13225
13299
  if (this.store.states.isCrossPageSelection) {
13226
-
13227
- states.isAllSelected = true;
13228
-
13229
13300
  data.forEach(function (row, index) {
13230
13301
  if (states.selectable) {
13231
13302
  if (states.selectable.call(null, row, index)) {
13232
13303
  // 如果已勾选数据中不包含当前页数据(如跳转至新的一页), 则勾选
13233
- if (!selection.some(function (o) {
13234
- return o[rowKey] === row[rowKey];
13235
- })) {
13304
+ if (!selectionRowKeys.includes(row[rowKey])) {
13236
13305
  toggleRowStatus(selection, row, true);
13237
13306
  }
13238
- if (states.unSelectedRow.some(function (o) {
13239
- return o[rowKey] === row[rowKey];
13240
- })) {
13241
- // 如果取消勾选数据中包含当前页数据项, 则取消勾选
13307
+ // 如果取消勾选数据中包含当前页数据项, 则取消勾选
13308
+ if (unSelectionRowKeys.includes(row[rowKey])) {
13242
13309
  toggleRowStatus(selection, row, false);
13243
- states.isAllSelected = false;
13244
13310
  }
13245
13311
  }
13246
13312
  } else {
13247
13313
  // 如果已勾选数据中不包含当前页数据(如跳转至新的一页), 则勾选
13248
- if (!selection.some(function (o) {
13249
- return o[rowKey] === row[rowKey];
13250
- })) {
13314
+ if (!selectionRowKeys.includes(row[rowKey])) {
13251
13315
  toggleRowStatus(selection, row, true);
13252
13316
  }
13253
13317
  // 如果取消勾选数据中包含当前页数据项, 则取消勾选
13254
- if (states.unSelectedRow.some(function (o) {
13255
- return o[rowKey] === row[rowKey];
13256
- })) {
13318
+ if (unSelectionRowKeys.includes(row[rowKey])) {
13257
13319
  toggleRowStatus(selection, row, false);
13258
- states.isAllSelected = false;
13259
13320
  }
13260
13321
  }
13261
13322
  });
13262
- // console.log(states, 'states===========================');
13263
- } else {
13264
- // states.isAllSelected = false;
13265
- states.selection = [];
13266
13323
  }
13324
+ this.store.getUnSelectedRow(states.selection);
13325
+ this.store.updateAllSelected();
13326
+ console.log('isAllSelected', states.isAllSelected);
13267
13327
  },
13268
13328
 
13269
13329
  deep: true
@@ -13391,97 +13451,8 @@ var convertToRows = function convertToRows(originColumns) {
13391
13451
  * 选择数据事件
13392
13452
  * @param {num} command 选择事件类型 1-全选当前页 2-清空当前页 3-全选所有页 4-清空所有页
13393
13453
  */
13394
- onCommand: function onCommand(command) {
13395
- this.store.states.selectionType = command;
13396
- var states = this.store.states;
13397
- var _states$data2 = states.data,
13398
- data = _states$data2 === undefined ? [] : _states$data2,
13399
- selection = states.selection;
13400
- // console.log(this, 'this===========================');
13401
-
13402
- switch (command) {
13403
- // 全选当前页
13404
- case 1:
13405
- states.isAllSelected = true;
13406
- data.forEach(function (row, index) {
13407
- if (states.selectable) {
13408
- if (states.selectable.call(null, row, index)) {
13409
- toggleRowStatus(selection, row, true);
13410
- }
13411
- } else {
13412
- toggleRowStatus(selection, row, true);
13413
- }
13414
- });
13415
- // console.log(states, 'states1===========================');
13416
- // 先点击跨页全选,再点击清空当前页/取消几条勾选数据, 最后点击全选当前页
13417
- if (states.isCrossPageSelection) {
13418
- // 重新计算未选中数据
13419
- this.store.getUnSelectedRow(states.selection);
13420
- // 触发el-table的'selection-change'事件
13421
- this.table.$listeners['selection-change'](states.unSelectedRow, true);
13422
- } else {
13423
- this.table.$listeners['selection-change'](this.table.selection, false);
13424
- }
13425
- break;
13426
- // 清空当前页
13427
- case 2:
13428
- // 先点击跨页选择,再点击清空当前页
13429
- if (states.isCrossPageSelection) {
13430
- // 标记当前页未选中, 如果有选中的数据,清空选中数据
13431
- states.isAllSelected = false;
13432
- var oldSelection = states.selection;
13433
- // 表格中有选中的数据项是disabled状态时,清空时保留该数据
13434
- var isDisabledSelection = states.data.filter(function (row, index) {
13435
- // 判断selectable是不可选中状态, 且当前数据项已被选中
13436
- if (states.selectable && !states.selectable.call(null, row, index) && oldSelection.some(function (item) {
13437
- return item[states.rowKey] === row[states.rowKey];
13438
- })) {
13439
- return row;
13440
- }
13441
- });
13442
- if (oldSelection.length) {
13443
- states.selection = isDisabledSelection;
13444
- }
13445
- // 重新计算未选中数据
13446
- this.store.getUnSelectedRow(states.selection);
13447
- // 触发el-table的'selection-change'事件
13448
- this.table.$listeners['selection-change'](states.unSelectedRow, true);
13449
- } else {
13450
- states.unSelectedRow = [];
13451
- this.table.clearSelection();
13452
- }
13453
- // console.log(states, 'states2===========================');
13454
- break;
13455
- // 全选所有页
13456
- case 3:
13457
- states.isCrossPageSelection = true;
13458
- states.unSelectedRow = [];
13459
- states.isAllSelected = true;
13460
- data.forEach(function (row, index) {
13461
- if (states.selectable) {
13462
- if (states.selectable.call(null, row, index)) {
13463
- toggleRowStatus(selection, row, true);
13464
- }
13465
- } else {
13466
- toggleRowStatus(selection, row, true);
13467
- }
13468
- });
13469
- // console.log(states, 'states3===========================');
13470
- // 重新计算未选中数据
13471
- this.store.getUnSelectedRow(states.selection);
13472
- // 触发el-table的'selection-change'事件
13473
- this.table.$listeners['selection-change'](states.unSelectedRow, true);
13474
- break;
13475
- // 清空所有页
13476
- case 4:
13477
- states.isCrossPageSelection = false;
13478
- states.unSelectedRow = [];
13479
- // console.log(states, 'states4===========================');
13480
- this.table.clearSelection();
13481
- break;
13482
- default:
13483
- break;
13484
- }
13454
+ onSelectionChange: function onSelectionChange(command) {
13455
+ this.store.onSelectionChange(command);
13485
13456
  },
13486
13457
  handleFilterClick: function handleFilterClick(event, column) {
13487
13458
  event.stopPropagation();
@@ -14660,16 +14631,14 @@ var cellForced = {
14660
14631
  var _this = this;
14661
14632
 
14662
14633
  var store = _ref.store;
14663
-
14664
- // console.log(store, 'store===========');
14665
14634
  var _store$states = store.states,
14666
- isCrossPageSelection = _store$states.isCrossPageSelection,
14667
14635
  selection = _store$states.selection,
14668
14636
  data = _store$states.data,
14669
14637
  rowKey = _store$states.rowKey;
14670
14638
 
14671
14639
  var indeterminate = selection.length > 0 && !(selection.length === data.length);
14672
- if (isCrossPageSelection) {
14640
+
14641
+ if (rowKey) {
14673
14642
  // 全选: v-model - true, indeterminate - false
14674
14643
  // 半选: v-model - false, indeterminate - true
14675
14644
  // 不选:v-model - false, indeterminate - false
@@ -14685,7 +14654,6 @@ var cellForced = {
14685
14654
  });
14686
14655
  });
14687
14656
  }
14688
- // console.log(indeterminate, 'indeterminate===========');
14689
14657
  return [h('el-checkbox', {
14690
14658
  attrs: {
14691
14659
  disabled: data && data.length === 0,
@@ -14704,7 +14672,7 @@ var cellForced = {
14704
14672
  },
14705
14673
  on: {
14706
14674
  'command': function command(_command) {
14707
- return _this.onCommand(_command, _this.scope);
14675
+ return _this.onSelectionChange(_command, _this.scope);
14708
14676
  },
14709
14677
  'visible-change': this.onVisibleChange
14710
14678
  }
@@ -14715,25 +14683,25 @@ var cellForced = {
14715
14683
  [h(
14716
14684
  'el-dropdown-item',
14717
14685
  {
14718
- attrs: { command: 1 }
14686
+ attrs: { disabled: data && data.length === 0, command: 1 }
14719
14687
  },
14720
14688
  ['\u5168\u9009\u5F53\u9875']
14721
14689
  ), h(
14722
14690
  'el-dropdown-item',
14723
14691
  {
14724
- attrs: { command: 3 }
14692
+ attrs: { disabled: data && data.length === 0, command: 3 }
14725
14693
  },
14726
14694
  ['\u5168\u9009\u6240\u6709\u9875']
14727
14695
  ), h(
14728
14696
  'el-dropdown-item',
14729
14697
  {
14730
- attrs: { command: 2 }
14698
+ attrs: { disabled: data && data.length === 0, command: 2 }
14731
14699
  },
14732
14700
  ['\u6E05\u7A7A\u5F53\u9875']
14733
14701
  ), h(
14734
14702
  'el-dropdown-item',
14735
14703
  {
14736
- attrs: { command: 4 }
14704
+ attrs: { disabled: data && data.length === 0, command: 4 }
14737
14705
  },
14738
14706
  ['\u6E05\u7A7A\u6240\u6709\u9875']
14739
14707
  )]
@@ -25311,7 +25279,6 @@ tab_pane.install = function (Vue) {
25311
25279
  type: String,
25312
25280
  hit: Boolean,
25313
25281
  dot: Boolean,
25314
- disableTransitions: Boolean,
25315
25282
  color: String,
25316
25283
  size: String,
25317
25284
  icon: String,
@@ -25368,13 +25335,7 @@ tab_pane.install = function (Vue) {
25368
25335
  )]
25369
25336
  );
25370
25337
 
25371
- return this.disableTransitions ? tagEl : h(
25372
- 'transition',
25373
- {
25374
- attrs: { name: 'el-zoom-in-center' }
25375
- },
25376
- [tagEl]
25377
- );
25338
+ return tagEl;
25378
25339
  }
25379
25340
  });
25380
25341
  // CONCATENATED MODULE: ./packages/tag/src/tag.vue?vue&type=script&lang=js&
@@ -44046,7 +44007,7 @@ if (typeof window !== 'undefined' && window.Vue) {
44046
44007
  }
44047
44008
 
44048
44009
  /* harmony default export */ var src_0 = __webpack_exports__["default"] = ({
44049
- version: '2.15.32',
44010
+ version: '2.15.34',
44050
44011
  locale: lib_locale_default.a.use,
44051
44012
  i18n: lib_locale_default.a.i18n,
44052
44013
  install: src_install,
@@ -131,16 +131,14 @@ var cellForced = {
131
131
  var _this = this;
132
132
 
133
133
  var store = _ref.store;
134
-
135
- // console.log(store, 'store===========');
136
134
  var _store$states = store.states,
137
- isCrossPageSelection = _store$states.isCrossPageSelection,
138
135
  selection = _store$states.selection,
139
136
  data = _store$states.data,
140
137
  rowKey = _store$states.rowKey;
141
138
 
142
139
  var indeterminate = selection.length > 0 && !(selection.length === data.length);
143
- if (isCrossPageSelection) {
140
+
141
+ if (rowKey) {
144
142
  // 全选: v-model - true, indeterminate - false
145
143
  // 半选: v-model - false, indeterminate - true
146
144
  // 不选:v-model - false, indeterminate - false
@@ -156,7 +154,6 @@ var cellForced = {
156
154
  });
157
155
  });
158
156
  }
159
- // console.log(indeterminate, 'indeterminate===========');
160
157
  return [h('el-checkbox', {
161
158
  attrs: {
162
159
  disabled: data && data.length === 0,
@@ -175,7 +172,7 @@ var cellForced = {
175
172
  },
176
173
  on: {
177
174
  'command': function command(_command) {
178
- return _this.onCommand(_command, _this.scope);
175
+ return _this.onSelectionChange(_command, _this.scope);
179
176
  },
180
177
  'visible-change': this.onVisibleChange
181
178
  }
@@ -186,25 +183,25 @@ var cellForced = {
186
183
  [h(
187
184
  'el-dropdown-item',
188
185
  {
189
- attrs: { command: 1 }
186
+ attrs: { disabled: data && data.length === 0, command: 1 }
190
187
  },
191
188
  ['\u5168\u9009\u5F53\u9875']
192
189
  ), h(
193
190
  'el-dropdown-item',
194
191
  {
195
- attrs: { command: 3 }
192
+ attrs: { disabled: data && data.length === 0, command: 3 }
196
193
  },
197
194
  ['\u5168\u9009\u6240\u6709\u9875']
198
195
  ), h(
199
196
  'el-dropdown-item',
200
197
  {
201
- attrs: { command: 2 }
198
+ attrs: { disabled: data && data.length === 0, command: 2 }
202
199
  },
203
200
  ['\u6E05\u7A7A\u5F53\u9875']
204
201
  ), h(
205
202
  'el-dropdown-item',
206
203
  {
207
- attrs: { command: 4 }
204
+ attrs: { disabled: data && data.length === 0, command: 4 }
208
205
  },
209
206
  ['\u6E05\u7A7A\u6240\u6709\u9875']
210
207
  )]