bkui-vue 0.0.3-beta.2-8 → 0.0.3-beta.2-9

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.
@@ -5004,6 +5004,30 @@ function _isSlot(s) {
5004
5004
  if (!props.rowDraggable) {
5005
5005
  return {};
5006
5006
  }
5007
+ var placeDiv = document.createElement('div');
5008
+ placeDiv.style.setProperty('height', '20px');
5009
+ placeDiv.style.setProperty('width', '100%');
5010
+ placeDiv.style.setProperty('background', '#E2EDFF');
5011
+ placeDiv.style.setProperty('cursor', 'move');
5012
+ ['dragenter', 'dragover'].forEach(function (type) {
5013
+ placeDiv.addEventListener(type, function (event) {
5014
+ event.preventDefault();
5015
+ event.stopPropagation();
5016
+ event.dataTransfer.dropEffect = 'move';
5017
+ });
5018
+ });
5019
+ var lastDragRow = null;
5020
+ var insertPlaceDiv = function insertPlaceDiv(target, placement) {
5021
+ if (placement === '--top') {
5022
+ target.parentNode.insertBefore(placeDiv, target);
5023
+ return;
5024
+ }
5025
+ if (target.nextElementSibling === null) {
5026
+ target.parentNode.appendChild(placeDiv);
5027
+ return;
5028
+ }
5029
+ target.parentNode.insertBefore(placeDiv, target.nextElementSibling);
5030
+ };
5007
5031
  var beforeEventFire = function beforeEventFire(fn) {
5008
5032
  if (props.rowDraggable) {
5009
5033
  fn === null || fn === void 0 || fn();
@@ -5017,9 +5041,10 @@ function _isSlot(s) {
5017
5041
  var _target$getBoundingCl = target.getBoundingClientRect(),
5018
5042
  top = _target$getBoundingCl.top,
5019
5043
  bottom = _target$getBoundingCl.bottom;
5020
- var position = y - top > bottom - y ? '--bottom' : '--top';
5044
+ var placement = y - top > bottom - y ? '--bottom' : '--top';
5021
5045
  removeDragClass(target);
5022
- target.classList.add(position);
5046
+ target.classList.add(placement);
5047
+ insertPlaceDiv(target, placement);
5023
5048
  };
5024
5049
  var removeDragClass = function removeDragClass(target) {
5025
5050
  var classList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['--bottom', '--top'];
@@ -5030,19 +5055,25 @@ function _isSlot(s) {
5030
5055
  var onDragstart = function onDragstart(event) {
5031
5056
  beforeEventFire(function () {
5032
5057
  var target = getTargetRow(event);
5058
+ placeDiv.style.setProperty('height', "".concat(target.offsetHeight, "px"));
5059
+ placeDiv.style.setProperty('width', "".concat(target.offsetWidth, "px"));
5033
5060
  target.classList.add('--drag-start');
5061
+ event.dataTransfer.setDragImage(target, 0, 0);
5034
5062
  event.dataTransfer.setData('text/plain', null);
5035
- event.dataTransfer.dropEffect = 'copy';
5063
+ event.dataTransfer.dropEffect = 'move';
5036
5064
  var rowIndex = event.target.dataset.rowIndex;
5037
5065
  event.dataTransfer.setData('data-row-index', rowIndex);
5038
5066
  });
5039
5067
  };
5040
5068
  var onDragenter = function onDragenter(event) {
5069
+ var target = getTargetRow(event);
5070
+ event.preventDefault();
5071
+ event.stopPropagation();
5041
5072
  beforeEventFire(function () {
5042
5073
  event.dataTransfer.dropEffect = 'move';
5043
- var target = getTargetRow(event);
5044
5074
  target.classList.add('--drag-enter');
5045
5075
  setTargetRowPlacement(target, event);
5076
+ lastDragRow = target;
5046
5077
  });
5047
5078
  };
5048
5079
  var onDragleave = function onDragleave(event) {
@@ -5053,22 +5084,29 @@ function _isSlot(s) {
5053
5084
  };
5054
5085
  var onDragover = function onDragover(event) {
5055
5086
  event.preventDefault();
5087
+ event.stopPropagation();
5056
5088
  event.dataTransfer.dropEffect = 'move';
5057
5089
  var target = getTargetRow(event);
5058
5090
  setTargetRowPlacement(target, event);
5059
5091
  };
5060
- var onDrop = function onDrop(event) {
5092
+ var onDragend = function onDragend(event) {
5093
+ var _event$target$dataset;
5061
5094
  event.preventDefault();
5062
5095
  event.stopPropagation();
5063
- var target = getTargetRow(event);
5096
+ placeDiv.remove();
5097
+ if (!lastDragRow) {
5098
+ return;
5099
+ }
5100
+ var target = lastDragRow;
5064
5101
  var rowIndex = target.dataset.rowIndex;
5065
5102
  var targetIndex = Number(rowIndex);
5066
- var sourceIndex = event.dataTransfer.getData('data-row-index');
5103
+ var sourceIndex = (_event$target$dataset = event.target.dataset) === null || _event$target$dataset === void 0 ? void 0 : _event$target$dataset.rowIndex;
5067
5104
  if (target.classList.contains('--bottom')) {
5068
5105
  targetIndex = targetIndex + 1;
5069
5106
  }
5070
5107
  resp.changePageRowIndex(Number(sourceIndex), targetIndex);
5071
5108
  removeDragClass(target, ['--drag-enter', '--bottom', '--top']);
5109
+ lastDragRow = null;
5072
5110
  ctx.emit(EMIT_EVENTS.DRAG_END, {
5073
5111
  sourceEvent: event,
5074
5112
  data: resp.pageData
@@ -5079,7 +5117,7 @@ function _isSlot(s) {
5079
5117
  onDragleave: onDragleave,
5080
5118
  onDragstart: onDragstart,
5081
5119
  onDragover: onDragover,
5082
- onDrop: onDrop
5120
+ onDragend: onDragend
5083
5121
  };
5084
5122
  });
5085
5123
  ;// CONCATENATED MODULE: external "../input"
@@ -6,12 +6,12 @@ declare const _default: (props: TablePropTypes, resp: ITableResponse, ctx: Setup
6
6
  onDragleave?: undefined;
7
7
  onDragstart?: undefined;
8
8
  onDragover?: undefined;
9
- onDrop?: undefined;
9
+ onDragend?: undefined;
10
10
  } | {
11
11
  onDragenter: (event: DragEvent) => void;
12
12
  onDragleave: (event: DragEvent) => void;
13
13
  onDragstart: (event: DragEvent) => void;
14
14
  onDragover: (event: DragEvent) => void;
15
- onDrop: (event: DragEvent) => void;
15
+ onDragend: (event: DragEvent) => void;
16
16
  };
17
17
  export default _default;
@@ -1285,17 +1285,9 @@
1285
1285
  .bk-table .bk-table-body table tbody tr:hover.hover-highlight td:not(.empty-cell) {
1286
1286
  background: #f5f7fa;
1287
1287
  }
1288
- .bk-table .bk-table-head table tbody tr.--drag-enter.--bottom,
1289
- .bk-table .bk-table-body table tbody tr.--drag-enter.--bottom {
1290
- border-bottom: solid 1px #3785ff;
1291
- }
1292
- .bk-table .bk-table-head table tbody tr.--drag-enter.--top,
1293
- .bk-table .bk-table-body table tbody tr.--drag-enter.--top {
1294
- border-top: solid 1px #3785ff;
1295
- }
1296
- .bk-table .bk-table-head table tbody tr.--drag-start,
1297
- .bk-table .bk-table-body table tbody tr.--drag-start {
1298
- background: #fff;
1288
+ .bk-table .bk-table-head table tbody tr.--drag-start td,
1289
+ .bk-table .bk-table-body table tbody tr.--drag-start td {
1290
+ background: #fff !important;
1299
1291
  }
1300
1292
  .bk-table .bk-table-head {
1301
1293
  position: relative;
@@ -313,18 +313,21 @@
313
313
  }
314
314
  }
315
315
 
316
- &.--drag-enter {
317
- &.--bottom {
318
- border-bottom: solid 1px #3785ff;
319
- }
316
+ // &.--drag-enter {
317
+ // &.--bottom {
318
+ // border-bottom: solid 1px #3785ff;
319
+ // }
320
320
 
321
- &.--top {
322
- border-top: solid 1px #3785ff;
323
- }
324
- }
321
+ // &.--top {
322
+ // border-top: solid 1px #3785ff;
323
+ // }
324
+ // }
325
325
 
326
326
  &.--drag-start {
327
- background: #fff;
327
+
328
+ td {
329
+ background: #fff!important;
330
+ }
328
331
  }
329
332
  }
330
333
  }
@@ -1411,17 +1411,9 @@
1411
1411
  .bk-table .bk-table-body table tbody tr:hover.hover-highlight td:not(.empty-cell) {
1412
1412
  background: #f5f7fa;
1413
1413
  }
1414
- .bk-table .bk-table-head table tbody tr.--drag-enter.--bottom,
1415
- .bk-table .bk-table-body table tbody tr.--drag-enter.--bottom {
1416
- border-bottom: solid 1px #3785ff;
1417
- }
1418
- .bk-table .bk-table-head table tbody tr.--drag-enter.--top,
1419
- .bk-table .bk-table-body table tbody tr.--drag-enter.--top {
1420
- border-top: solid 1px #3785ff;
1421
- }
1422
- .bk-table .bk-table-head table tbody tr.--drag-start,
1423
- .bk-table .bk-table-body table tbody tr.--drag-start {
1424
- background: #fff;
1414
+ .bk-table .bk-table-head table tbody tr.--drag-start td,
1415
+ .bk-table .bk-table-body table tbody tr.--drag-start td {
1416
+ background: #fff !important;
1425
1417
  }
1426
1418
  .bk-table .bk-table-head {
1427
1419
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "0.0.3-beta.2-8",
3
+ "version": "0.0.3-beta.2-9",
4
4
  "workspaces": {
5
5
  "packages": [
6
6
  "packages/!(**.bak)*",