kts-component-invoice-operate 3.2.60 → 3.2.61
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.
- package/README.md +4 -1
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/Drag/index.d.ts +2 -0
- package/dist/index.esm.js +147 -114
- package/dist/index.js +147 -114
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/Drag/index.ts +3 -0
- package/src/Invoice/_test/endowCode/index.tsx +1 -1
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/Drag/index.tsx +24 -21
- package/src/Invoice/ui/default/GoodsList/ui/TableRow/index.less +16 -1
- package/src/Invoice/ui/default/GoodsList/ui/TableRow/index.tsx +12 -1
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/Drag/index.tsx +56 -37
- package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.less +16 -1
- package/src/Invoice/ui/digtal/GoodsList/ui/TableRow/index.tsx +14 -1
package/README.md
CHANGED
|
@@ -3,4 +3,7 @@
|
|
|
3
3
|
文档地址:http://kts-component-invoice-operate.dev.kingxunlian.com/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
南湖:https://lanhuapp.com/web/#/item/project/detailDetach?pid=7daf94b0-9aa7-4372-89a7-226f389b021d&project_id=7daf94b0-9aa7-4372-89a7-226f389b021d&image_id=3bc42812-5718-4aa5-b088-5bc7e0c9a62f&fromEditor=true
|
|
6
|
+
南湖:https://lanhuapp.com/web/#/item/project/detailDetach?pid=7daf94b0-9aa7-4372-89a7-226f389b021d&project_id=7daf94b0-9aa7-4372-89a7-226f389b021d&image_id=3bc42812-5718-4aa5-b088-5bc7e0c9a62f&fromEditor=true
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
node 16.20.2
|
package/dist/index.esm.js
CHANGED
|
@@ -993,6 +993,7 @@ var Drag = /*#__PURE__*/_createClass(function Drag() {
|
|
|
993
993
|
this.isStart = false;
|
|
994
994
|
this.current = void 0;
|
|
995
995
|
this.container = void 0;
|
|
996
|
+
this.site = void 0;
|
|
996
997
|
});
|
|
997
998
|
|
|
998
999
|
var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
@@ -10163,7 +10164,7 @@ function Search() {
|
|
|
10163
10164
|
});
|
|
10164
10165
|
}
|
|
10165
10166
|
|
|
10166
|
-
var css_248z$5 = ".kts-invoice-operate-goods-list-itemName-drag-container {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 9999;\n}\n";
|
|
10167
|
+
var css_248z$5 = ".kts-invoice-operate-goods-list-itemName-drag-container-u {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-u::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 9999;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n bottom: 0;\n z-index: 9999;\n}\n";
|
|
10167
10168
|
styleInject(css_248z$5);
|
|
10168
10169
|
|
|
10169
10170
|
function TableRow(props) {
|
|
@@ -10172,9 +10173,18 @@ function TableRow(props) {
|
|
|
10172
10173
|
var goodsMap = controller.useMemo(function (s) {
|
|
10173
10174
|
return s.goodsListState.goodsMap;
|
|
10174
10175
|
}, []);
|
|
10176
|
+
/** 当前拖动中的货品索引 */
|
|
10177
|
+
|
|
10175
10178
|
var current = controller.useMemo(function (s) {
|
|
10176
10179
|
return s.goodsListState.drag.current;
|
|
10177
10180
|
}, []);
|
|
10181
|
+
/** 当前拖动中的货品索引 */
|
|
10182
|
+
|
|
10183
|
+
var site = controller.useMemo(function (s) {
|
|
10184
|
+
return s.goodsListState.drag.site;
|
|
10185
|
+
}, []);
|
|
10186
|
+
/** 准备插入的货物索引 */
|
|
10187
|
+
|
|
10178
10188
|
var container = controller.useMemo(function (s) {
|
|
10179
10189
|
return s.goodsListState.drag.container;
|
|
10180
10190
|
}, []);
|
|
@@ -10208,7 +10218,7 @@ function TableRow(props) {
|
|
|
10208
10218
|
bottom: 0
|
|
10209
10219
|
}
|
|
10210
10220
|
})) : React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
10211
|
-
className: classNames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : undefined)
|
|
10221
|
+
className: classNames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container-' + site : undefined)
|
|
10212
10222
|
}));
|
|
10213
10223
|
}
|
|
10214
10224
|
|
|
@@ -12030,64 +12040,57 @@ function Drag$1(props) {
|
|
|
12030
12040
|
var currentGood = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
12031
12041
|
return e.$index === record.$index;
|
|
12032
12042
|
})[0];
|
|
12033
|
-
mounting(React.createElement(DragDiv, _objectSpread2({}, currentGood)));
|
|
12034
|
-
|
|
12043
|
+
mounting(React.createElement(DragDiv, _objectSpread2({}, currentGood)));
|
|
12035
12044
|
rowList.forEach(function (e) {
|
|
12036
|
-
e.addEventListener('
|
|
12045
|
+
e.addEventListener('mousemove', onMousemove);
|
|
12037
12046
|
});
|
|
12038
12047
|
|
|
12039
|
-
function
|
|
12048
|
+
function onMousemove(e) {
|
|
12040
12049
|
controller.run( /*#__PURE__*/function () {
|
|
12041
12050
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
12042
|
-
var
|
|
12051
|
+
var _rowDom$dataset;
|
|
12043
12052
|
|
|
12044
|
-
var
|
|
12053
|
+
var rowDom, container, row, currentGood, currentIndex, containerIndex, _currentIndex, _containerIndex, t, rect, mouseY;
|
|
12045
12054
|
|
|
12046
12055
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
12047
12056
|
while (1) {
|
|
12048
12057
|
switch (_context2.prev = _context2.next) {
|
|
12049
12058
|
case 0:
|
|
12050
|
-
|
|
12059
|
+
rowDom = getRow(e.target);
|
|
12060
|
+
container = s.goodsListState.drag.container = rowDom === null || rowDom === void 0 ? void 0 : (_rowDom$dataset = rowDom.dataset) === null || _rowDom$dataset === void 0 ? void 0 : _rowDom$dataset.rowKey;
|
|
12061
|
+
/** 准备插入的货物 */
|
|
12062
|
+
|
|
12063
|
+
row = s.goodsListState.goodsMap.get(container);
|
|
12051
12064
|
|
|
12052
|
-
if (
|
|
12053
|
-
_context2.next =
|
|
12065
|
+
if (row) {
|
|
12066
|
+
_context2.next = 5;
|
|
12054
12067
|
break;
|
|
12055
12068
|
}
|
|
12056
12069
|
|
|
12057
12070
|
return _context2.abrupt("return");
|
|
12058
12071
|
|
|
12059
|
-
case
|
|
12072
|
+
case 5:
|
|
12060
12073
|
if (!(container === s.goodsListState.drag.current)) {
|
|
12061
|
-
_context2.next =
|
|
12074
|
+
_context2.next = 7;
|
|
12062
12075
|
break;
|
|
12063
12076
|
}
|
|
12064
12077
|
|
|
12065
|
-
s.goodsListState.drag.container = undefined;
|
|
12066
|
-
return _context2.abrupt("return");
|
|
12078
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
12067
12079
|
|
|
12068
|
-
case
|
|
12080
|
+
case 7:
|
|
12081
|
+
/** 当前拖动中的货品 */
|
|
12069
12082
|
currentGood = s.goodsListState.drag.current && s.goodsListState.goodsMap.get(s.goodsListState.drag.current);
|
|
12070
12083
|
|
|
12071
12084
|
if (currentGood) {
|
|
12072
|
-
_context2.next =
|
|
12085
|
+
_context2.next = 10;
|
|
12073
12086
|
break;
|
|
12074
12087
|
}
|
|
12075
12088
|
|
|
12076
12089
|
return _context2.abrupt("return");
|
|
12077
12090
|
|
|
12078
|
-
case
|
|
12079
|
-
row = s.goodsListState.goodsMap.get(container);
|
|
12080
|
-
|
|
12081
|
-
if (row) {
|
|
12082
|
-
_context2.next = 12;
|
|
12083
|
-
break;
|
|
12084
|
-
}
|
|
12085
|
-
|
|
12086
|
-
return _context2.abrupt("return");
|
|
12087
|
-
|
|
12088
|
-
case 12:
|
|
12091
|
+
case 10:
|
|
12089
12092
|
if (!(currentGood.lineAttribute === LineAttributeType$1.折扣行)) {
|
|
12090
|
-
_context2.next =
|
|
12093
|
+
_context2.next = 15;
|
|
12091
12094
|
break;
|
|
12092
12095
|
}
|
|
12093
12096
|
|
|
@@ -12099,16 +12102,15 @@ function Drag$1(props) {
|
|
|
12099
12102
|
}).indexOf(row.$index);
|
|
12100
12103
|
|
|
12101
12104
|
if (!(currentIndex - 1 === containerIndex)) {
|
|
12102
|
-
_context2.next =
|
|
12105
|
+
_context2.next = 15;
|
|
12103
12106
|
break;
|
|
12104
12107
|
}
|
|
12105
12108
|
|
|
12106
|
-
s.goodsListState.drag.container = undefined;
|
|
12107
|
-
return _context2.abrupt("return");
|
|
12109
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
12108
12110
|
|
|
12109
|
-
case
|
|
12111
|
+
case 15:
|
|
12110
12112
|
if (!(currentGood.lineAttribute === LineAttributeType$1.被折扣行)) {
|
|
12111
|
-
_context2.next =
|
|
12113
|
+
_context2.next = 20;
|
|
12112
12114
|
break;
|
|
12113
12115
|
}
|
|
12114
12116
|
|
|
@@ -12120,23 +12122,29 @@ function Drag$1(props) {
|
|
|
12120
12122
|
}).indexOf(row.$index);
|
|
12121
12123
|
|
|
12122
12124
|
if (!(_currentIndex + 1 === _containerIndex)) {
|
|
12123
|
-
_context2.next =
|
|
12125
|
+
_context2.next = 20;
|
|
12124
12126
|
break;
|
|
12125
12127
|
}
|
|
12126
12128
|
|
|
12127
|
-
s.goodsListState.drag.container = undefined;
|
|
12128
|
-
return _context2.abrupt("return");
|
|
12129
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
12129
12130
|
|
|
12130
|
-
case
|
|
12131
|
+
case 20:
|
|
12131
12132
|
// 折扣行 拖动的 相当于 自己的 被折扣行
|
|
12132
12133
|
if (row.lineAttribute === LineAttributeType$1.折扣行) {
|
|
12133
12134
|
t = s.goodsListState.goodsList.map(function (e) {
|
|
12134
12135
|
return e.$index;
|
|
12135
12136
|
}).indexOf(container) - 1;
|
|
12136
12137
|
s.goodsListState.drag.container = s.goodsListState.goodsList[t].$index;
|
|
12138
|
+
s.goodsListState.drag.site = 'u';
|
|
12139
|
+
} else if (row.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
12140
|
+
s.goodsListState.drag.site = 'd';
|
|
12141
|
+
} else {
|
|
12142
|
+
rect = rowDom.getBoundingClientRect();
|
|
12143
|
+
mouseY = e.clientY - rect.top;
|
|
12144
|
+
s.goodsListState.drag.site = mouseY > 15 ? 'd' : 'u';
|
|
12137
12145
|
}
|
|
12138
12146
|
|
|
12139
|
-
case
|
|
12147
|
+
case 21:
|
|
12140
12148
|
case "end":
|
|
12141
12149
|
return _context2.stop();
|
|
12142
12150
|
}
|
|
@@ -12189,7 +12197,7 @@ function Drag$1(props) {
|
|
|
12189
12197
|
}());
|
|
12190
12198
|
window.removeEventListener('mouseup', onMouseup);
|
|
12191
12199
|
rowList.forEach(function (e) {
|
|
12192
|
-
e.removeEventListener('
|
|
12200
|
+
e.removeEventListener('mousemove', onMousemove);
|
|
12193
12201
|
}); // window.document.body.removeChild(rowDiv);
|
|
12194
12202
|
} // 开始插入
|
|
12195
12203
|
|
|
@@ -12198,13 +12206,13 @@ function Drag$1(props) {
|
|
|
12198
12206
|
mounting(React.createElement(React.Fragment, null));
|
|
12199
12207
|
controller.run( /*#__PURE__*/function () {
|
|
12200
12208
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
|
|
12201
|
-
var _s$goodsListState$dra, container, current, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
12209
|
+
var _s$goodsListState$dra, container, current, site, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
12202
12210
|
|
|
12203
12211
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
12204
12212
|
while (1) {
|
|
12205
12213
|
switch (_context4.prev = _context4.next) {
|
|
12206
12214
|
case 0:
|
|
12207
|
-
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current;
|
|
12215
|
+
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current, site = _s$goodsListState$dra.site;
|
|
12208
12216
|
|
|
12209
12217
|
if (!(!container || !current)) {
|
|
12210
12218
|
_context4.next = 3;
|
|
@@ -12237,9 +12245,11 @@ function Drag$1(props) {
|
|
|
12237
12245
|
var g = s.goodsListState.goodsList.filter(function (e) {
|
|
12238
12246
|
return moveGoods.indexOf(e.$index) < 0;
|
|
12239
12247
|
});
|
|
12240
|
-
var t = g.map(function (e) {
|
|
12248
|
+
var t = site === 'u' ? g.map(function (e) {
|
|
12241
12249
|
return e.$index;
|
|
12242
|
-
}).indexOf(container)
|
|
12250
|
+
}).indexOf(container) : g.map(function (e) {
|
|
12251
|
+
return e.$index;
|
|
12252
|
+
}).indexOf(container) + 1;
|
|
12243
12253
|
var m = moveGoods.map(function (e) {
|
|
12244
12254
|
return goodsMap.get(e);
|
|
12245
12255
|
}).filter(function (e) {
|
|
@@ -16749,7 +16759,7 @@ function Search$1() {
|
|
|
16749
16759
|
});
|
|
16750
16760
|
}
|
|
16751
16761
|
|
|
16752
|
-
var css_248z$l = ".kts-invoice-operate-goods-list-itemName-drag-container {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 9999;\n}\n";
|
|
16762
|
+
var css_248z$l = ".kts-invoice-operate-goods-list-itemName-drag-container-u {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-u::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 9999;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n bottom: 0;\n z-index: 9999;\n}\n";
|
|
16753
16763
|
styleInject(css_248z$l);
|
|
16754
16764
|
|
|
16755
16765
|
function TableRow$1(props) {
|
|
@@ -16758,6 +16768,11 @@ function TableRow$1(props) {
|
|
|
16758
16768
|
var goodsMap = controller.useMemo(function (s) {
|
|
16759
16769
|
return s.goodsListState.goodsMap;
|
|
16760
16770
|
}, []);
|
|
16771
|
+
/** 当前拖动中的货品索引 */
|
|
16772
|
+
|
|
16773
|
+
var site = controller.useMemo(function (s) {
|
|
16774
|
+
return s.goodsListState.drag.site;
|
|
16775
|
+
}, []);
|
|
16761
16776
|
var current = controller.useMemo(function (s) {
|
|
16762
16777
|
return s.goodsListState.drag.current;
|
|
16763
16778
|
}, []);
|
|
@@ -16789,8 +16804,9 @@ function TableRow$1(props) {
|
|
|
16789
16804
|
position: 'absolute',
|
|
16790
16805
|
bottom: 0
|
|
16791
16806
|
}
|
|
16792
|
-
})) :
|
|
16793
|
-
|
|
16807
|
+
})) : // <tr {...props} className={classnames(props.className, discount, (rowKey === container && current) ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')} />
|
|
16808
|
+
React.createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
16809
|
+
className: classNames(props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container-' + site : undefined)
|
|
16794
16810
|
}));
|
|
16795
16811
|
}
|
|
16796
16812
|
|
|
@@ -17985,6 +18001,12 @@ styleInject(css_248z$n);
|
|
|
17985
18001
|
|
|
17986
18002
|
function Drag$2(props) {
|
|
17987
18003
|
var record = props.record;
|
|
18004
|
+
|
|
18005
|
+
var _React$useState = React.useState(false),
|
|
18006
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18007
|
+
open = _React$useState2[0],
|
|
18008
|
+
setOpen = _React$useState2[1];
|
|
18009
|
+
|
|
17988
18010
|
var controller = Invoice.useInvoiceController();
|
|
17989
18011
|
var editGood = controller.useMemo(function (s) {
|
|
17990
18012
|
return s.goodsListState.editGood;
|
|
@@ -17993,7 +18015,7 @@ function Drag$2(props) {
|
|
|
17993
18015
|
return !!editGood;
|
|
17994
18016
|
}, [editGood]);
|
|
17995
18017
|
var onMouseDown = React.useCallback(function () {
|
|
17996
|
-
if (!controller || !record) return;
|
|
18018
|
+
if (!controller || !record || disabled) return;
|
|
17997
18019
|
controller.run( /*#__PURE__*/function () {
|
|
17998
18020
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
17999
18021
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -18018,64 +18040,57 @@ function Drag$2(props) {
|
|
|
18018
18040
|
var currentGood = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
18019
18041
|
return e.$index === record.$index;
|
|
18020
18042
|
})[0];
|
|
18021
|
-
mounting(React.createElement(DragDiv$1, _objectSpread2({}, currentGood)));
|
|
18022
|
-
|
|
18043
|
+
mounting(React.createElement(DragDiv$1, _objectSpread2({}, currentGood)));
|
|
18023
18044
|
rowList.forEach(function (e) {
|
|
18024
|
-
e.addEventListener('
|
|
18045
|
+
e.addEventListener('mousemove', onMousemove);
|
|
18025
18046
|
});
|
|
18026
18047
|
|
|
18027
|
-
function
|
|
18048
|
+
function onMousemove(e) {
|
|
18028
18049
|
controller.run( /*#__PURE__*/function () {
|
|
18029
18050
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
18030
|
-
var
|
|
18051
|
+
var _rowDom$dataset;
|
|
18031
18052
|
|
|
18032
|
-
var
|
|
18053
|
+
var rowDom, container, row, currentGood, currentIndex, containerIndex, _currentIndex, _containerIndex, t, rect, mouseY;
|
|
18033
18054
|
|
|
18034
18055
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
18035
18056
|
while (1) {
|
|
18036
18057
|
switch (_context2.prev = _context2.next) {
|
|
18037
18058
|
case 0:
|
|
18038
|
-
|
|
18059
|
+
rowDom = getRow(e.target);
|
|
18060
|
+
container = s.goodsListState.drag.container = rowDom === null || rowDom === void 0 ? void 0 : (_rowDom$dataset = rowDom.dataset) === null || _rowDom$dataset === void 0 ? void 0 : _rowDom$dataset.rowKey;
|
|
18061
|
+
/** 准备插入的货物 */
|
|
18039
18062
|
|
|
18040
|
-
|
|
18041
|
-
|
|
18063
|
+
row = s.goodsListState.goodsMap.get(container);
|
|
18064
|
+
|
|
18065
|
+
if (row) {
|
|
18066
|
+
_context2.next = 5;
|
|
18042
18067
|
break;
|
|
18043
18068
|
}
|
|
18044
18069
|
|
|
18045
18070
|
return _context2.abrupt("return");
|
|
18046
18071
|
|
|
18047
|
-
case
|
|
18072
|
+
case 5:
|
|
18048
18073
|
if (!(container === s.goodsListState.drag.current)) {
|
|
18049
|
-
_context2.next =
|
|
18074
|
+
_context2.next = 7;
|
|
18050
18075
|
break;
|
|
18051
18076
|
}
|
|
18052
18077
|
|
|
18053
|
-
s.goodsListState.drag.container = undefined;
|
|
18054
|
-
return _context2.abrupt("return");
|
|
18078
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
18055
18079
|
|
|
18056
|
-
case
|
|
18080
|
+
case 7:
|
|
18081
|
+
/** 当前拖动中的货品 */
|
|
18057
18082
|
currentGood = s.goodsListState.drag.current && s.goodsListState.goodsMap.get(s.goodsListState.drag.current);
|
|
18058
18083
|
|
|
18059
18084
|
if (currentGood) {
|
|
18060
|
-
_context2.next =
|
|
18085
|
+
_context2.next = 10;
|
|
18061
18086
|
break;
|
|
18062
18087
|
}
|
|
18063
18088
|
|
|
18064
18089
|
return _context2.abrupt("return");
|
|
18065
18090
|
|
|
18066
|
-
case
|
|
18067
|
-
row = s.goodsListState.goodsMap.get(container);
|
|
18068
|
-
|
|
18069
|
-
if (row) {
|
|
18070
|
-
_context2.next = 12;
|
|
18071
|
-
break;
|
|
18072
|
-
}
|
|
18073
|
-
|
|
18074
|
-
return _context2.abrupt("return");
|
|
18075
|
-
|
|
18076
|
-
case 12:
|
|
18091
|
+
case 10:
|
|
18077
18092
|
if (!(currentGood.lineAttribute === LineAttributeType$1.折扣行)) {
|
|
18078
|
-
_context2.next =
|
|
18093
|
+
_context2.next = 15;
|
|
18079
18094
|
break;
|
|
18080
18095
|
}
|
|
18081
18096
|
|
|
@@ -18087,16 +18102,15 @@ function Drag$2(props) {
|
|
|
18087
18102
|
}).indexOf(row.$index);
|
|
18088
18103
|
|
|
18089
18104
|
if (!(currentIndex - 1 === containerIndex)) {
|
|
18090
|
-
_context2.next =
|
|
18105
|
+
_context2.next = 15;
|
|
18091
18106
|
break;
|
|
18092
18107
|
}
|
|
18093
18108
|
|
|
18094
|
-
s.goodsListState.drag.container = undefined;
|
|
18095
|
-
return _context2.abrupt("return");
|
|
18109
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
18096
18110
|
|
|
18097
|
-
case
|
|
18111
|
+
case 15:
|
|
18098
18112
|
if (!(currentGood.lineAttribute === LineAttributeType$1.被折扣行)) {
|
|
18099
|
-
_context2.next =
|
|
18113
|
+
_context2.next = 20;
|
|
18100
18114
|
break;
|
|
18101
18115
|
}
|
|
18102
18116
|
|
|
@@ -18108,23 +18122,29 @@ function Drag$2(props) {
|
|
|
18108
18122
|
}).indexOf(row.$index);
|
|
18109
18123
|
|
|
18110
18124
|
if (!(_currentIndex + 1 === _containerIndex)) {
|
|
18111
|
-
_context2.next =
|
|
18125
|
+
_context2.next = 20;
|
|
18112
18126
|
break;
|
|
18113
18127
|
}
|
|
18114
18128
|
|
|
18115
|
-
s.goodsListState.drag.container = undefined;
|
|
18116
|
-
return _context2.abrupt("return");
|
|
18129
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
18117
18130
|
|
|
18118
|
-
case
|
|
18131
|
+
case 20:
|
|
18119
18132
|
// 折扣行 拖动的 相当于 自己的 被折扣行
|
|
18120
18133
|
if (row.lineAttribute === LineAttributeType$1.折扣行) {
|
|
18121
18134
|
t = s.goodsListState.goodsList.map(function (e) {
|
|
18122
18135
|
return e.$index;
|
|
18123
18136
|
}).indexOf(container) - 1;
|
|
18124
18137
|
s.goodsListState.drag.container = s.goodsListState.goodsList[t].$index;
|
|
18138
|
+
s.goodsListState.drag.site = 'u';
|
|
18139
|
+
} else if (row.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
18140
|
+
s.goodsListState.drag.site = 'd';
|
|
18141
|
+
} else {
|
|
18142
|
+
rect = rowDom.getBoundingClientRect();
|
|
18143
|
+
mouseY = e.clientY - rect.top;
|
|
18144
|
+
s.goodsListState.drag.site = mouseY > 25 ? 'd' : 'u';
|
|
18125
18145
|
}
|
|
18126
18146
|
|
|
18127
|
-
case
|
|
18147
|
+
case 21:
|
|
18128
18148
|
case "end":
|
|
18129
18149
|
return _context2.stop();
|
|
18130
18150
|
}
|
|
@@ -18177,7 +18197,7 @@ function Drag$2(props) {
|
|
|
18177
18197
|
}());
|
|
18178
18198
|
window.removeEventListener('mouseup', onMouseup);
|
|
18179
18199
|
rowList.forEach(function (e) {
|
|
18180
|
-
e.removeEventListener('
|
|
18200
|
+
e.removeEventListener('mousemove', onMousemove);
|
|
18181
18201
|
}); // window.document.body.removeChild(rowDiv);
|
|
18182
18202
|
} // 开始插入
|
|
18183
18203
|
|
|
@@ -18186,13 +18206,13 @@ function Drag$2(props) {
|
|
|
18186
18206
|
mounting(React.createElement(React.Fragment, null));
|
|
18187
18207
|
controller.run( /*#__PURE__*/function () {
|
|
18188
18208
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
|
|
18189
|
-
var _s$goodsListState$dra, container, current, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
18209
|
+
var _s$goodsListState$dra, container, current, site, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
18190
18210
|
|
|
18191
18211
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
18192
18212
|
while (1) {
|
|
18193
18213
|
switch (_context4.prev = _context4.next) {
|
|
18194
18214
|
case 0:
|
|
18195
|
-
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current;
|
|
18215
|
+
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current, site = _s$goodsListState$dra.site;
|
|
18196
18216
|
|
|
18197
18217
|
if (!(!container || !current)) {
|
|
18198
18218
|
_context4.next = 3;
|
|
@@ -18225,9 +18245,11 @@ function Drag$2(props) {
|
|
|
18225
18245
|
var g = s.goodsListState.goodsList.filter(function (e) {
|
|
18226
18246
|
return moveGoods.indexOf(e.$index) < 0;
|
|
18227
18247
|
});
|
|
18228
|
-
var t = g.map(function (e) {
|
|
18248
|
+
var t = site === 'u' ? g.map(function (e) {
|
|
18249
|
+
return e.$index;
|
|
18250
|
+
}).indexOf(container) : g.map(function (e) {
|
|
18229
18251
|
return e.$index;
|
|
18230
|
-
}).indexOf(container);
|
|
18252
|
+
}).indexOf(container) + 1;
|
|
18231
18253
|
var m = moveGoods.map(function (e) {
|
|
18232
18254
|
return goodsMap.get(e);
|
|
18233
18255
|
}).filter(function (e) {
|
|
@@ -18258,33 +18280,44 @@ function Drag$2(props) {
|
|
|
18258
18280
|
};
|
|
18259
18281
|
}());
|
|
18260
18282
|
}
|
|
18261
|
-
}, [controller, record]);
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18283
|
+
}, [controller, record, disabled]);
|
|
18284
|
+
var renderButton = React.useMemo(function () {
|
|
18285
|
+
return React.createElement(Button, {
|
|
18286
|
+
type: 'link',
|
|
18287
|
+
style: {
|
|
18288
|
+
padding: 0
|
|
18289
|
+
},
|
|
18290
|
+
onMouseDown: onMouseDown,
|
|
18291
|
+
onClick: function onClick(e) {
|
|
18292
|
+
e.stopPropagation();
|
|
18293
|
+
},
|
|
18294
|
+
className: "kts-invoice-operate-goods-list-itemName-drag",
|
|
18295
|
+
onMouseOver: controller.saveEditGood
|
|
18296
|
+
}, React.createElement(Icon, {
|
|
18297
|
+
component: SvgI001$1
|
|
18298
|
+
}));
|
|
18299
|
+
}, [onMouseDown, controller]);
|
|
18300
|
+
|
|
18301
|
+
if (disabled) {
|
|
18302
|
+
return React.createElement(Popover, {
|
|
18303
|
+
content: '您还有未编辑完成的商品',
|
|
18304
|
+
trigger: 'focus'
|
|
18305
|
+
}, renderButton);
|
|
18306
|
+
} else {
|
|
18307
|
+
return renderButton;
|
|
18308
|
+
}
|
|
18276
18309
|
}
|
|
18277
18310
|
|
|
18278
18311
|
function DragDiv$1(props) {
|
|
18279
|
-
var _React$
|
|
18280
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18281
|
-
x = _React$useState2[0],
|
|
18282
|
-
setX = _React$useState2[1];
|
|
18283
|
-
|
|
18284
|
-
var _React$useState3 = React.useState(-110),
|
|
18312
|
+
var _React$useState3 = React.useState(0),
|
|
18285
18313
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
18286
|
-
|
|
18287
|
-
|
|
18314
|
+
x = _React$useState4[0],
|
|
18315
|
+
setX = _React$useState4[1];
|
|
18316
|
+
|
|
18317
|
+
var _React$useState5 = React.useState(-110),
|
|
18318
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
18319
|
+
y = _React$useState6[0],
|
|
18320
|
+
setY = _React$useState6[1];
|
|
18288
18321
|
|
|
18289
18322
|
var div = React.useMemo(function () {
|
|
18290
18323
|
return window.document.querySelector("[data-row-key=\"".concat(props.$index, "\"]"));
|
|
@@ -18299,7 +18332,7 @@ function DragDiv$1(props) {
|
|
|
18299
18332
|
|
|
18300
18333
|
React.useEffect(function () {
|
|
18301
18334
|
function onMousemove(e) {
|
|
18302
|
-
setY(e.clientY -
|
|
18335
|
+
setY(e.clientY - 15);
|
|
18303
18336
|
}
|
|
18304
18337
|
window.addEventListener('mousemove', onMousemove);
|
|
18305
18338
|
return function () {
|