venus-design 0.8.6 → 0.8.8

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.
@@ -50,12 +50,13 @@ var VenusDesignTable = function VenusDesignTable(props) {
50
50
  });
51
51
  }
52
52
  }
53
- _context.next = 4;
53
+ params = _objectSpread(_objectSpread({}, params), props.params);
54
+ _context.next = 5;
54
55
  return LoadingDesignTableData(params, url.toLowerCase(), props.item.serverUrlId);
55
- case 4:
56
+ case 5:
56
57
  res = _context.sent;
57
58
  if (!(res && res.success)) {
58
- _context.next = 14;
59
+ _context.next = 15;
59
60
  break;
60
61
  }
61
62
  data = res.data || {};
@@ -64,9 +65,9 @@ var VenusDesignTable = function VenusDesignTable(props) {
64
65
  pageData.page = data.current;
65
66
  pageData.success = true;
66
67
  return _context.abrupt("return", pageData);
67
- case 14:
68
- return _context.abrupt("return", pageData);
69
68
  case 15:
69
+ return _context.abrupt("return", pageData);
70
+ case 16:
70
71
  case "end":
71
72
  return _context.stop();
72
73
  }
@@ -2,4 +2,4 @@
2
2
  * 渲染页面
3
3
  * @param item
4
4
  */
5
- export declare const renderFormDesign: (item: [], id: string, type: string, height: any) => any[];
5
+ export declare const renderFormDesign: (item: [], id: string, params: any, type: string, height: any) => any[];
@@ -4,7 +4,7 @@ import { VENUS_DESIGN_TYPE } from "./staticAttr";
4
4
  * 渲染页面
5
5
  * @param item
6
6
  */
7
- export var renderFormDesign = function renderFormDesign(item, id, type, height) {
7
+ export var renderFormDesign = function renderFormDesign(item, id, params, type, height) {
8
8
  var comList = [];
9
9
  for (var i = 0; i < item.length; i++) {
10
10
  //@ts-ignore
@@ -14,7 +14,7 @@ export var renderFormDesign = function renderFormDesign(item, id, type, height)
14
14
  var component = handleFormItemType(item[i], {
15
15
  id: id || "-1",
16
16
  type: type
17
- }, height);
17
+ }, params, height);
18
18
  comList.push(component);
19
19
  }
20
20
  return comList;
@@ -4,6 +4,7 @@ interface VenusDesignComType {
4
4
  id?: string;
5
5
  type?: "view" | "render";
6
6
  height?: any;
7
+ params?: any;
7
8
  }
8
9
  /**
9
10
  * 表单设计渲染
@@ -50,6 +50,6 @@ var VenusDesignCom = function VenusDesignCom(props) {
50
50
  style: {
51
51
  height: props.height || "100%"
52
52
  }
53
- }, items.length > 0 ? renderFormDesign(items, props.id || "-1", props.type || "render", props.height || winHeight) : null));
53
+ }, items.length > 0 ? renderFormDesign(items, props.id || "-1", props.params, props.type || "render", props.height || winHeight) : null));
54
54
  };
55
55
  export default VenusDesignCom;
@@ -6,24 +6,27 @@ import VenusDesignDetail from "./components/Detail";
6
6
  * 表单项的类型
7
7
  */
8
8
  export var VENUS_DESIGN_TYPE = {
9
- "form": function form(item, conf, height) {
9
+ "form": function form(item, conf, params, height) {
10
10
  return /*#__PURE__*/React.createElement(VenusDesignForm, {
11
11
  item: item,
12
12
  conf: conf,
13
+ params: params,
13
14
  height: height
14
15
  });
15
16
  },
16
- "grid": function grid(item, conf, height) {
17
+ "grid": function grid(item, conf, params, height) {
17
18
  return /*#__PURE__*/React.createElement(VenusDesignTable, {
18
19
  item: item,
19
20
  conf: conf,
21
+ params: params,
20
22
  height: height
21
23
  });
22
24
  },
23
- "detail": function detail(item, conf, height) {
25
+ "detail": function detail(item, conf, params, height) {
24
26
  return /*#__PURE__*/React.createElement(VenusDesignDetail, {
25
27
  item: item,
26
28
  conf: conf,
29
+ params: params,
27
30
  height: height
28
31
  });
29
32
  }
@@ -3,15 +3,23 @@ export default class DragGhost {
3
3
  private ctx;
4
4
  private dragIndex;
5
5
  private ghostEl;
6
- private lineEl;
7
- private dragRow;
6
+ private animId;
7
+ private startTime;
8
+ private startX;
9
+ private startY;
10
+ private targetX;
11
+ private targetY;
8
12
  private flatData;
9
13
  constructor(ctx: Context);
10
14
  private onMouseDown;
11
15
  private createGhost;
12
- private createLine;
16
+ private lastMoveTime;
17
+ private slideTimer;
18
+ private hasMoved;
13
19
  private onMouseMove;
14
20
  private onMouseUp;
15
- private showLineAt;
21
+ private animateBounce;
22
+ private easeOutBack;
23
+ private cleanup;
16
24
  private getCellFromEvent;
17
25
  }
@@ -1,7 +1,11 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
5
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
11
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -15,69 +19,113 @@ var DragGhost = /*#__PURE__*/function () {
15
19
  _defineProperty(this, "ctx", void 0);
16
20
  _defineProperty(this, "dragIndex", -1);
17
21
  _defineProperty(this, "ghostEl", null);
18
- _defineProperty(this, "lineEl", null);
19
- /* 飞书拖拽:用“标记位”代替占位符,序号永不错位 */
20
- _defineProperty(this, "dragRow", null);
22
+ /* 动画相关 */
23
+ _defineProperty(this, "animId", 0);
24
+ _defineProperty(this, "startTime", 0);
25
+ _defineProperty(this, "startX", 0);
26
+ _defineProperty(this, "startY", 0);
27
+ _defineProperty(this, "targetX", 0);
28
+ _defineProperty(this, "targetY", 0);
21
29
  _defineProperty(this, "flatData", []);
22
- /* ---------- 鼠标移动:只移动“标记” ---------- */
30
+ _defineProperty(this, "lastMoveTime", 0);
31
+ _defineProperty(this, "slideTimer", 0);
32
+ _defineProperty(this, "hasMoved", false);
33
+ // ★ 第一次放行
23
34
  _defineProperty(this, "onMouseMove", function (e) {
24
35
  if (!_this.ghostEl) return;
25
36
  e.preventDefault();
26
37
 
27
- /* 幽灵行跟随鼠标 */
28
- _this.ghostEl.style.left = "".concat(e.clientX + 12, "px");
29
- _this.ghostEl.style.top = "".concat(e.clientY - 12, "px");
38
+ /* 1. 16ms 节流,但第一次必放行 */
39
+ var now = performance.now();
40
+ if (_this.hasMoved && now - _this.lastMoveTime < 16) return;
41
+ _this.lastMoveTime = now;
42
+ _this.hasMoved = true;
30
43
 
31
- /* 计算插入索引(用完整数据长度) */
32
- var canvasY = e.clientY - _this.ctx.containerElement.getBoundingClientRect().top + _this.ctx.scrollY;
33
- var insertIndex = _this.flatData.length;
34
- for (var i = 0; i < _this.flatData.length; i++) {
35
- var _this$ctx$database$ge = _this.ctx.database.getPositionForRowIndex(i),
36
- top = _this$ctx$database$ge.top,
37
- height = _this$ctx$database$ge.height;
38
- if (canvasY < top + height / 2) {
39
- insertIndex = i;
40
- break;
41
- }
42
- }
44
+ /* 2. 幽灵行跟随(不变) */
45
+ var curX = e.clientX + 12;
46
+ var curY = e.clientY - 12;
47
+ _this.ghostEl.style.left = "".concat(curX, "px");
48
+ _this.ghostEl.style.top = "".concat(curY, "px");
43
49
 
44
- /* 把“_dragging”标记换到新位置 */
45
- if (insertIndex !== _this.ctx.placeholderIndex) {
46
- /* 把标记换到新位置 */
47
- var oldItem = _this.flatData[_this.ctx.placeholderIndex];
48
- var newItem = _this.flatData[insertIndex];
49
- if (oldItem) oldItem._dragging = false;
50
- if (newItem) newItem._dragging = true;
51
- _this.ctx.placeholderIndex = insertIndex;
52
- _this.ctx.emit('draw'); // 重绘 → 空位平滑推/顶
50
+ /* 3. 死区交换逻辑(不变) */
51
+ var rect = _this.ctx.containerElement.getBoundingClientRect();
52
+ var mouseY = e.clientY - rect.top + _this.ctx.scrollY;
53
+ var deadBand = 8;
54
+ var insertIndex = _this.ctx.placeholderIndex;
55
+ if (_this.ctx.placeholderIndex < _this.flatData.length - 1) {
56
+ var next = _this.ctx.database.getPositionForRowIndex(_this.ctx.placeholderIndex + 1);
57
+ if (mouseY >= next.top + deadBand) insertIndex = _this.ctx.placeholderIndex + 1;
58
+ }
59
+ if (_this.ctx.placeholderIndex > 0) {
60
+ var curr = _this.ctx.database.getPositionForRowIndex(_this.ctx.placeholderIndex);
61
+ if (mouseY <= curr.top + curr.height - deadBand) insertIndex = _this.ctx.placeholderIndex - 1;
53
62
  }
54
- _this.showLineAt(canvasY);
63
+ var oldIndex = _this.ctx.placeholderIndex;
64
+ if (insertIndex === oldIndex) return;
65
+
66
+ /* 4. 清旧动画 + 滑动(150ms) */
67
+ if (_this.slideTimer) clearTimeout(_this.slideTimer);
68
+ var oldRow = _this.ctx.body.renderRows.find(function (r) {
69
+ return r.rowIndex === oldIndex;
70
+ });
71
+ var newRow = _this.ctx.body.renderRows.find(function (r) {
72
+ return r.rowIndex === insertIndex;
73
+ });
74
+ if (!oldRow || !newRow) return;
75
+ var dy = newRow.y - oldRow.y;
76
+ oldRow.setSlideOffset(dy);
77
+ newRow.setSlideOffset(-dy);
78
+ _this.ctx.emit('draw');
79
+
80
+ /* 数据交换 */
81
+ var _this$flatData$splice = _this.flatData.splice(oldIndex, 1),
82
+ _this$flatData$splice2 = _slicedToArray(_this$flatData$splice, 1),
83
+ movedRow = _this$flatData$splice2[0];
84
+ _this.flatData.splice(insertIndex, 0, movedRow);
85
+ _this.ctx.placeholderIndex = insertIndex;
86
+ _this.dragIndex = insertIndex;
87
+
88
+ /* ★ 立即更新 renderRows 引用 + 重绘 */
89
+ _this.ctx.database.setData(_this.flatData);
90
+ _this.ctx.body.renderRows = _this.ctx.body.renderRows.slice(); // 新引用
91
+ _this.ctx.emit('draw');
55
92
  });
56
- /* ---------- 抬起 ---------- */
93
+ /* ---------- 松手 ---------- */
57
94
  _defineProperty(this, "onMouseUp", function () {
58
- /* 幽灵行消失动画 */
59
- if (_this.ghostEl) {
60
- _this.ghostEl.style.transform = 'scale(0.9)';
61
- _this.ghostEl.style.opacity = '0';
95
+ if (!_this.ghostEl) return;
96
+ var targetRow = _this.ctx.body.renderRows.find(function (r) {
97
+ return r.rowIndex === _this.ctx.placeholderIndex;
98
+ });
99
+ if (!targetRow) {
100
+ _this.cleanup();
101
+ return;
62
102
  }
63
-
64
- /* 清标记 */
65
- if (_this.ctx.placeholderIndex !== -1) {
66
- _this.flatData[_this.ctx.placeholderIndex]._dragging = false;
103
+ var rect = _this.ctx.containerElement.getBoundingClientRect();
104
+ _this.targetX = rect.left + targetRow.cells[0].drawX;
105
+ _this.targetY = rect.top + targetRow.cells[0].drawY;
106
+ var ghost = _this.ghostEl;
107
+ _this.startX = parseFloat(ghost.style.left);
108
+ _this.startY = parseFloat(ghost.style.top);
109
+ _this.startTime = performance.now();
110
+ _this.animId = requestAnimationFrame(_this.animateBounce);
111
+ });
112
+ /* ---------- 回弹动画 ---------- */
113
+ _defineProperty(this, "animateBounce", function (now) {
114
+ var duration = 250;
115
+ var t = Math.min((now - _this.startTime) / duration, 1);
116
+ var eased = _this.easeOutBack(t);
117
+ var ghost = _this.ghostEl;
118
+ var curLeft = _this.startX + (_this.targetX - _this.startX) * eased;
119
+ var curTop = _this.startY + (_this.targetY - _this.startY) * eased;
120
+ var scale = 1 - (1 - eased) * 0.15;
121
+ ghost.style.left = "".concat(curLeft, "px");
122
+ ghost.style.top = "".concat(curTop, "px");
123
+ ghost.style.transform = "scale(".concat(scale, ")");
124
+ if (t < 1) {
125
+ _this.animId = requestAnimationFrame(_this.animateBounce);
126
+ } else {
127
+ _this.cleanup();
67
128
  }
68
- _this.ctx.pickedRowIndex = -1;
69
- _this.ctx.placeholderIndex = -1;
70
- var item = _this.flatData[_this.ctx.placeholderIndex];
71
- if (item) item._dragging = false;
72
- _this.ctx.emit('draw');
73
- setTimeout(function () {
74
- var _this$ghostEl, _this$lineEl;
75
- (_this$ghostEl = _this.ghostEl) === null || _this$ghostEl === void 0 || _this$ghostEl.remove();
76
- (_this$lineEl = _this.lineEl) === null || _this$lineEl === void 0 || _this$lineEl.remove();
77
- _this.ghostEl = null;
78
- _this.lineEl = null;
79
- }, 250);
80
- document.removeEventListener('mousemove', _this.onMouseMove);
81
129
  });
82
130
  this.ctx = ctx;
83
131
  this.ctx.on('mousedown', function (e) {
@@ -89,7 +137,8 @@ var DragGhost = /*#__PURE__*/function () {
89
137
  _createClass(DragGhost, [{
90
138
  key: "onMouseDown",
91
139
  value: function onMouseDown(e) {
92
- var _this2 = this;
140
+ var _this2 = this,
141
+ _row$cells$find;
93
142
  if (e.button !== 0) return;
94
143
  var cell = this.getCellFromEvent(e);
95
144
  if (!cell || cell.type !== 'drag-handle') return;
@@ -99,16 +148,14 @@ var DragGhost = /*#__PURE__*/function () {
99
148
  return _this2.ctx.database.getRowKeyByItem(r) === cell.rowKey;
100
149
  });
101
150
  if (this.dragIndex === -1) return;
102
-
103
- /* 1. 打标记 2. 不删数据 3. 立即重绘 → 渲染层跳过内容但留高度 */
104
- this.dragRow = this.flatData[this.dragIndex];
105
- var target = this.flatData[this.dragIndex];
106
- if (!target) return; // ✅防错退出
107
- this.dragRow = target;
108
- target._dragging = true;
109
- this.ctx.emit('draw');
110
- this.createGhost(cell);
111
- this.createLine();
151
+ var row = this.ctx.body.renderRows.find(function (r) {
152
+ return r.rowIndex === cell.rowIndex;
153
+ });
154
+ var nameCell = (_row$cells$find = row === null || row === void 0 ? void 0 : row.cells.find(function (c) {
155
+ return c.column.key === 'name';
156
+ })) !== null && _row$cells$find !== void 0 ? _row$cells$find : cell;
157
+ this.createGhost(nameCell);
158
+ this.ctx.placeholderIndex = this.dragIndex;
112
159
  document.addEventListener('mousemove', this.onMouseMove, {
113
160
  passive: false
114
161
  });
@@ -117,23 +164,23 @@ var DragGhost = /*#__PURE__*/function () {
117
164
  });
118
165
  }
119
166
 
120
- /* ---------- 幽灵行 ---------- */
167
+ /* ---------- 创建幽灵行 ---------- */
121
168
  }, {
122
169
  key: "createGhost",
123
- value: function createGhost(cell) {
170
+ value: function createGhost(sourceCell) {
124
171
  var rect = this.ctx.containerElement.getBoundingClientRect();
125
172
  this.ghostEl = document.createElement('div');
126
- this.ghostEl.innerText = cell.getText() || ' ';
173
+ this.ghostEl.innerText = sourceCell.displayText || sourceCell.getText() || ' ';
127
174
  Object.assign(this.ghostEl.style, {
128
175
  position: 'absolute',
129
- left: "".concat(rect.left + cell.drawX, "px"),
130
- top: "".concat(rect.top + cell.drawY, "px"),
131
- width: "".concat(cell.width, "px"),
132
- height: "".concat(cell.height, "px"),
176
+ left: "".concat(rect.left + sourceCell.drawX, "px"),
177
+ top: "".concat(rect.top + sourceCell.drawY, "px"),
178
+ width: "".concat(sourceCell.width, "px"),
179
+ height: "".concat(sourceCell.height, "px"),
133
180
  background: '#fff',
134
181
  border: '1px solid #e0e0e0',
135
182
  borderRadius: '8px',
136
- boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
183
+ boxShadow: '0 4px 12px rgba(0,0,0,.15)',
137
184
  pointerEvents: 'none',
138
185
  zIndex: '2000',
139
186
  display: 'flex',
@@ -142,37 +189,30 @@ var DragGhost = /*#__PURE__*/function () {
142
189
  fontSize: '14px',
143
190
  color: '#333',
144
191
  transform: 'scale(1)',
145
- transition: 'transform 0.25s ease-out'
192
+ willChange: 'transform, left, top'
146
193
  });
147
194
  document.body.appendChild(this.ghostEl);
148
195
  }
149
-
150
- /* ---------- 蓝线 ---------- */
151
196
  }, {
152
- key: "createLine",
153
- value: function createLine() {
154
- this.lineEl = document.createElement('div');
155
- Object.assign(this.lineEl.style, {
156
- position: 'absolute',
157
- height: '2px',
158
- background: '#3370ff',
159
- borderRadius: '2px',
160
- zIndex: '2001',
161
- pointerEvents: 'none',
162
- display: 'none'
163
- });
164
- document.body.appendChild(this.lineEl);
197
+ key: "easeOutBack",
198
+ value: /* 弹性缓动 */
199
+ function easeOutBack(t) {
200
+ var c1 = 1.70158,
201
+ c3 = c1 + 1;
202
+ return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
165
203
  }
204
+
205
+ /* ---------- 清理 ---------- */
166
206
  }, {
167
- key: "showLineAt",
168
- value: /* ---------- 蓝线 ---------- */
169
- function showLineAt(y) {
170
- if (!this.lineEl) return;
171
- var rect = this.ctx.containerElement.getBoundingClientRect();
172
- this.lineEl.style.left = "".concat(rect.left, "px");
173
- this.lineEl.style.top = "".concat(rect.top + y - this.ctx.scrollY, "px");
174
- this.lineEl.style.width = "".concat(this.ctx.stageWidth, "px");
175
- this.lineEl.style.display = 'block';
207
+ key: "cleanup",
208
+ value: function cleanup() {
209
+ var _this$ghostEl;
210
+ cancelAnimationFrame(this.animId);
211
+ (_this$ghostEl = this.ghostEl) === null || _this$ghostEl === void 0 || _this$ghostEl.remove();
212
+ this.ghostEl = null;
213
+ this.ctx.pickedRowIndex = -1;
214
+ this.ctx.placeholderIndex = -1;
215
+ document.removeEventListener('mousemove', this.onMouseMove);
176
216
  }
177
217
 
178
218
  /* ---------- 工具 ---------- */
@@ -192,9 +232,7 @@ var DragGhost = /*#__PURE__*/function () {
192
232
  try {
193
233
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
194
234
  var c = _step2.value;
195
- if (offsetX >= c.drawX && offsetX <= c.drawX + c.width && offsetY >= c.drawY && offsetY <= c.drawY + c.height) {
196
- return c;
197
- }
235
+ if (offsetX >= c.drawX && offsetX <= c.drawX + c.width && offsetY >= c.drawY && offsetY <= c.drawY + c.height) return c;
198
236
  }
199
237
  } catch (err) {
200
238
  _iterator2.e(err);
@@ -16,6 +16,9 @@ export default class Row {
16
16
  rowType: RowType;
17
17
  data: any;
18
18
  calculatedHeight: number;
19
+ private slideOffsetY;
20
+ /** 对外暴露:设置本次动画的偏移量 */
21
+ setSlideOffset(dy: number): void;
19
22
  constructor(ctx: Context, rowIndex: number, x: number | undefined, y: number | undefined, width: number | undefined, height: number | undefined, data: any, rowType?: RowType);
20
23
  update(): void;
21
24
  updateCalculatedHeight(): void;
@@ -35,6 +35,8 @@ var Row = /*#__PURE__*/function () {
35
35
  _defineProperty(this, "rowType", 'body');
36
36
  _defineProperty(this, "data", void 0);
37
37
  _defineProperty(this, "calculatedHeight", -1);
38
+ /* Row.ts 新增 */
39
+ _defineProperty(this, "slideOffsetY", 0);
38
40
  this.ctx = ctx;
39
41
  this.x = x;
40
42
  this.y = y;
@@ -47,6 +49,17 @@ var Row = /*#__PURE__*/function () {
47
49
  this.update();
48
50
  }
49
51
  _createClass(Row, [{
52
+ key: "setSlideOffset",
53
+ value:
54
+ // 像素偏移
55
+
56
+ /** 对外暴露:设置本次动画的偏移量 */
57
+ function setSlideOffset(dy) {
58
+ this.slideOffsetY = dy;
59
+ // 标记用途
60
+ this.data._slideOffset = dy;
61
+ }
62
+ }, {
50
63
  key: "update",
51
64
  value: function update() {
52
65
  var _this = this;
@@ -83,16 +96,12 @@ var Row = /*#__PURE__*/function () {
83
96
  }, {
84
97
  key: "drawCenter",
85
98
  value: function drawCenter() {
86
- if (this.data._dragging) {
87
- this.ctx.paint.drawRect(this.x, this.y - this.ctx.scrollY, this.width, this.height, {
88
- fillColor: this.ctx.config.BODY_BG_COLOR,
89
- borderColor: this.ctx.config.BORDER_COLOR
90
- });
91
- return; // 跳过内容
92
- }
93
- this.noFixedCells.forEach(function (cell) {
94
- cell.draw();
99
+ if (this.slideOffsetY !== 0) this.ctx.paint.save();
100
+ if (this.slideOffsetY !== 0) this.ctx.paint.translate(0, this.slideOffsetY);
101
+ this.noFixedCells.forEach(function (c) {
102
+ return c.draw();
95
103
  });
104
+ if (this.slideOffsetY !== 0) this.ctx.paint.restore();
96
105
  }
97
106
  }, {
98
107
  key: "drawFixed",
@@ -271,4 +271,33 @@
271
271
  .e-virt-table-filter-panel .ev-date-foot {
272
272
  margin-top: 8px;
273
273
  text-align: right;
274
- }
274
+ }
275
+ .e-virt-table-row-slide {
276
+ transition: transform 0.25s ease-out;
277
+ transform: translateY(var(--slide-dy));
278
+ }
279
+ /* 幽灵行 */
280
+ .drag-ghost {
281
+ position: fixed;
282
+ pointer-events: none;
283
+ z-index: 2000;
284
+ background: #f0f7ff;
285
+ border: 1px solid #d0d7de;
286
+ border-radius: 6px;
287
+ box-shadow: 0 4px 12px rgba(0,0,0,.15);
288
+ display: flex;
289
+ align-items: center;
290
+ padding-left: 12px;
291
+ font-size: 14px;
292
+ color: #333;
293
+ transition: none; /* 跟随鼠标时不插值 */
294
+ }
295
+ .drag-ghost.bounce-out {
296
+ transition: transform .2s ease-out, opacity .2s ease-out;
297
+ transform: scale(0.95) !important;
298
+ opacity: 0;
299
+ }
300
+
301
+ /* 普通行在拖拽中的平移 */
302
+ .row-shift-up { transform: translateY(-100%); }
303
+ .row-shift-down { transform: translateY(100%); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venus-design",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
4
4
  "description": "venus all compoments",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",