bk-magic-vue 2.5.9-beta.20 → 2.5.9-beta.22

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.
@@ -9147,7 +9147,8 @@ span.bk-date-picker-cells-cell-disabled.bk-date-picker-cells-cell-selected em{
9147
9147
  top:0;
9148
9148
  bottom:0;
9149
9149
  background-color:#fff;
9150
- overflow-y:auto
9150
+ overflow-y:auto;
9151
+ pointer-events:all
9151
9152
  }
9152
9153
  .bk-sideslider-wrapper.left{
9153
9154
  left:0;
@@ -14306,6 +14307,11 @@ th.bk-table-column-selection .cell, th.bk-table-column-expand .cell, td.bk-table
14306
14307
  width:100%;
14307
14308
  height:100%;
14308
14309
  }
14310
+ .bk-big-tree .fixed-width{
14311
+ width:-webkit-max-content;
14312
+ width:-moz-max-content;
14313
+ width:max-content;
14314
+ }
14309
14315
  .bk-big-tree .bk-big-tree-empty{
14310
14316
  text-align:center;
14311
14317
  font-size:14px;
@@ -40352,9 +40352,23 @@
40352
40352
  this.table.$emit('current-change', row, oldCurrentRow);
40353
40353
  }
40354
40354
  },
40355
- rowSelectedChanged: function rowSelectedChanged(states, row) {
40355
+ rowSelectedChanged: function rowSelectedChanged(states, row, index) {
40356
+ var _this5 = this;
40356
40357
  var changed = _toggleRowSelection(states, row);
40357
40358
  var selection = states.selection;
40359
+ if (this.table.shiftMulti.setStore(row, index)) {
40360
+ var _this$table$shiftMult = this.table.shiftMulti.getStore(),
40361
+ start = _this$table$shiftMult.start,
40362
+ end = _this$table$shiftMult.end;
40363
+ (this.table.data.slice(start.index, end.index + 1) || []).forEach(function (child) {
40364
+ if (!states.selection.includes(child)) {
40365
+ states.selection.push(child);
40366
+ }
40367
+ });
40368
+ setTimeout(function () {
40369
+ _this5.table.$el.style.setProperty('user-select', 'inherit');
40370
+ });
40371
+ }
40358
40372
  if (changed) {
40359
40373
  var table = this.table;
40360
40374
  table.$emit('selection-change', selection ? selection.slice() : []);
@@ -40424,13 +40438,13 @@
40424
40438
  }, {
40425
40439
  key: "isAllSelectionDisabled",
40426
40440
  get: function get() {
40427
- var _this5 = this;
40441
+ var _this6 = this;
40428
40442
  if (!this.states.selectable) {
40429
40443
  return false;
40430
40444
  }
40431
40445
  var isEmpty = this.states.data && this.states.data.length === 0;
40432
40446
  var isDisabled = this.states.data.every(function (row, index) {
40433
- return !_this5.states.selectable(row, index);
40447
+ return !_this6.states.selectable(row, index);
40434
40448
  });
40435
40449
  return isEmpty || isDisabled;
40436
40450
  }
@@ -40918,7 +40932,7 @@
40918
40932
  var rows = this.table.$refs.tableBody.$refs.row || [];
40919
40933
  var rowsHeight = rows.reduce(function (accumulator, row) {
40920
40934
  var key = row.getAttribute('data-table-row');
40921
- accumulator[key] = row.offsetHeight;
40935
+ accumulator[key] = row.getBoundingClientRect().height;
40922
40936
  return accumulator;
40923
40937
  }, {});
40924
40938
  if (isShallowEqual(rowsHeight, this.rowsHeight)) return;
@@ -42790,6 +42804,81 @@
42790
42804
  }
42791
42805
  };
42792
42806
 
42807
+ var shiftMultiSelect = (function (props) {
42808
+ var isShiftKeyDown = false;
42809
+ var store = {
42810
+ start: null,
42811
+ end: null
42812
+ };
42813
+ var handleKeyDown = function handleKeyDown(e) {
42814
+ if (e.key === 'Shift') {
42815
+ isShiftKeyDown = true;
42816
+ }
42817
+ };
42818
+ var handleKeyUp = function handleKeyUp(e) {
42819
+ if (e.key === 'Shift') {
42820
+ isShiftKeyDown = false;
42821
+ clearStore();
42822
+ }
42823
+ };
42824
+ var setStore = function setStore(row, index) {
42825
+ if (!isShiftKeyDown) {
42826
+ return false;
42827
+ }
42828
+ if (store.start === null && store.end === null) {
42829
+ store.start = {
42830
+ index: index,
42831
+ row: row
42832
+ };
42833
+ return false;
42834
+ }
42835
+ store.end = {
42836
+ index: index,
42837
+ row: row
42838
+ };
42839
+ return true;
42840
+ };
42841
+ var clearStore = function clearStore() {
42842
+ store.start = null;
42843
+ store.end = null;
42844
+ };
42845
+ var init = function init() {
42846
+ if (props.shiftMultiChecked) {
42847
+ window.addEventListener('keydown', handleKeyDown);
42848
+ window.addEventListener('keyup', handleKeyUp);
42849
+ }
42850
+ };
42851
+ var getStore = function getStore() {
42852
+ var start = store.start,
42853
+ end = store.end;
42854
+ var startRow = start.index < end.index ? start : end;
42855
+ var endRow = start.index < end.index ? end : start;
42856
+ return {
42857
+ start: startRow,
42858
+ end: endRow
42859
+ };
42860
+ };
42861
+ var onUnmounted = function onUnmounted() {
42862
+ if (props.shiftMultiChecked) {
42863
+ window.removeEventListener('keydown', handleKeyDown);
42864
+ window.removeEventListener('keyup', handleKeyUp);
42865
+ clearStore();
42866
+ }
42867
+ };
42868
+ var isShift = function isShift() {
42869
+ return isShiftKeyDown;
42870
+ };
42871
+ return {
42872
+ isShiftKeyDown: isShiftKeyDown,
42873
+ isShift: isShift,
42874
+ onUnmounted: onUnmounted,
42875
+ setStore: setStore,
42876
+ getStore: getStore,
42877
+ clearStore: clearStore,
42878
+ init: init
42879
+ };
42880
+ });
42881
+
42793
42882
  var tableIdSeed = 1;
42794
42883
  var script$12 = {
42795
42884
  name: 'bk-table',
@@ -42938,6 +43027,10 @@
42938
43027
  default: function _default() {
42939
43028
  return {};
42940
43029
  }
43030
+ },
43031
+ shiftMultiChecked: {
43032
+ type: Boolean,
43033
+ default: false
42941
43034
  }
42942
43035
  },
42943
43036
  data: function data() {
@@ -42953,6 +43046,7 @@
42953
43046
  showHeader: this.showHeader
42954
43047
  });
42955
43048
  this.pagination.showTotalCount = !!this.showPaginationInfo;
43049
+ var shiftMulti = shiftMultiSelect(this);
42956
43050
  return {
42957
43051
  layout: layout,
42958
43052
  store: store,
@@ -42965,7 +43059,8 @@
42965
43059
  },
42966
43060
  isGroup: false,
42967
43061
  scrollPosition: 'left',
42968
- scrollThrottle: false
43062
+ scrollThrottle: false,
43063
+ shiftMulti: shiftMulti
42969
43064
  };
42970
43065
  },
42971
43066
  computed: {
@@ -43146,6 +43241,7 @@
43146
43241
  this.debouncedUpdateLayout = debounce(50, function () {
43147
43242
  return _this2.doLayout();
43148
43243
  });
43244
+ this.shiftMulti.init();
43149
43245
  },
43150
43246
  mounted: function mounted() {
43151
43247
  var _this3 = this;
@@ -43170,6 +43266,7 @@
43170
43266
  },
43171
43267
  beforeDestroy: function beforeDestroy() {
43172
43268
  this.$destroyed = true;
43269
+ this.shiftMulti.onUnmounted();
43173
43270
  if (this.resizeListener) removeResizeListener(this.$el, this.resizeListener);
43174
43271
  },
43175
43272
  methods: {
@@ -43753,44 +43850,49 @@
43753
43850
  store = _ref2.store,
43754
43851
  $index = _ref2.$index;
43755
43852
  var disabled = column.selectable ? !column.selectable.call(null, row, $index) : false;
43853
+ var beforeChange = function beforeChange() {
43854
+ if (store.table.shiftMulti.isShift()) {
43855
+ return !store.isSelected(row);
43856
+ }
43857
+ return column.beforeSelectChange(store.isSelected(row), {
43858
+ row: row,
43859
+ column: column,
43860
+ store: store,
43861
+ $index: $index
43862
+ });
43863
+ };
43756
43864
  return h("bk-checkbox", {
43757
43865
  "attrs": {
43758
43866
  "checked": store.isSelected(row),
43759
43867
  "disabled": disabled,
43760
- "before-change": function beforeChange() {
43761
- return column.beforeSelectChange(store.isSelected(row), {
43762
- row: row,
43763
- column: column,
43764
- store: store,
43765
- $index: $index
43766
- });
43767
- }
43868
+ "before-change": beforeChange
43768
43869
  },
43769
43870
  "nativeOn": {
43770
43871
  "click": function () {
43771
43872
  var _click2 = _asyncToGenerator( _regeneratorRuntime().mark(function _callee2(event) {
43772
- var result;
43873
+ var isShift, result;
43773
43874
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
43774
43875
  while (1) switch (_context2.prev = _context2.next) {
43775
43876
  case 0:
43776
43877
  event.stopPropagation();
43878
+ event.preventDefault();
43879
+ event.stopImmediatePropagation();
43777
43880
  if (!disabled) {
43778
- _context2.next = 3;
43881
+ _context2.next = 5;
43779
43882
  break;
43780
43883
  }
43781
43884
  return _context2.abrupt("return");
43782
- case 3:
43783
- _context2.next = 5;
43784
- return column.beforeSelectChange(store.isSelected(row), {
43785
- row: row,
43786
- column: column,
43787
- store: store,
43788
- $index: $index
43789
- });
43790
43885
  case 5:
43886
+ isShift = store.table.shiftMulti.isShift();
43887
+ if (isShift) {
43888
+ store.table.$el.style.setProperty('user-select', 'none');
43889
+ }
43890
+ _context2.next = 9;
43891
+ return beforeChange();
43892
+ case 9:
43791
43893
  result = _context2.sent;
43792
- result !== false && store.commit('rowSelectedChanged', row);
43793
- case 7:
43894
+ result !== false && store.commit('rowSelectedChanged', row, $index);
43895
+ case 11:
43794
43896
  case "end":
43795
43897
  return _context2.stop();
43796
43898
  }
@@ -54812,6 +54914,10 @@
54812
54914
  return {};
54813
54915
  }
54814
54916
  },
54917
+ fixedWidth: {
54918
+ type: Boolean,
54919
+ default: false
54920
+ },
54815
54921
  lazyMethod: Function,
54816
54922
  lazyDisabled: [Boolean, Function],
54817
54923
  selectable: Boolean,
@@ -55513,6 +55619,10 @@
55513
55619
  style: {
55514
55620
  height: _vm.treeHeight
55515
55621
  }
55622
+ }, [_c('div', {
55623
+ class: ['tree-wrapper', {
55624
+ 'fixed-width': _vm.fixedWidth
55625
+ }]
55516
55626
  }, [_vm.height ? _c('bk-virtual-scroll', {
55517
55627
  ref: "virtualScroll",
55518
55628
  attrs: {
@@ -55549,8 +55659,8 @@
55549
55659
  }), (_vm.$slots.empty || _vm.useDefaultEmpty) && _vm.isSearchEmpty ? _c('div', {
55550
55660
  staticClass: "bk-big-tree-empty"
55551
55661
  }, [_vm._t("empty", function () {
55552
- return [_vm._v("\n " + _vm._s(_vm.t('bk.bigTree.emptyText')) + "\n ")];
55553
- })], 2) : _vm._e()], 2);
55662
+ return [_vm._v("\n " + _vm._s(_vm.t('bk.bigTree.emptyText')) + "\n ")];
55663
+ })], 2) : _vm._e()], 2)]);
55554
55664
  };
55555
55665
  var __vue_staticRenderFns__$1l = [];
55556
55666