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/dist/index.js
CHANGED
|
@@ -1003,6 +1003,7 @@ var Drag = /*#__PURE__*/_createClass(function Drag() {
|
|
|
1003
1003
|
this.isStart = false;
|
|
1004
1004
|
this.current = void 0;
|
|
1005
1005
|
this.container = void 0;
|
|
1006
|
+
this.site = void 0;
|
|
1006
1007
|
});
|
|
1007
1008
|
|
|
1008
1009
|
var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
@@ -10173,7 +10174,7 @@ function Search() {
|
|
|
10173
10174
|
});
|
|
10174
10175
|
}
|
|
10175
10176
|
|
|
10176
|
-
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";
|
|
10177
|
+
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";
|
|
10177
10178
|
styleInject(css_248z$5);
|
|
10178
10179
|
|
|
10179
10180
|
function TableRow(props) {
|
|
@@ -10182,9 +10183,18 @@ function TableRow(props) {
|
|
|
10182
10183
|
var goodsMap = controller.useMemo(function (s) {
|
|
10183
10184
|
return s.goodsListState.goodsMap;
|
|
10184
10185
|
}, []);
|
|
10186
|
+
/** 当前拖动中的货品索引 */
|
|
10187
|
+
|
|
10185
10188
|
var current = controller.useMemo(function (s) {
|
|
10186
10189
|
return s.goodsListState.drag.current;
|
|
10187
10190
|
}, []);
|
|
10191
|
+
/** 当前拖动中的货品索引 */
|
|
10192
|
+
|
|
10193
|
+
var site = controller.useMemo(function (s) {
|
|
10194
|
+
return s.goodsListState.drag.site;
|
|
10195
|
+
}, []);
|
|
10196
|
+
/** 准备插入的货物索引 */
|
|
10197
|
+
|
|
10188
10198
|
var container = controller.useMemo(function (s) {
|
|
10189
10199
|
return s.goodsListState.drag.container;
|
|
10190
10200
|
}, []);
|
|
@@ -10218,7 +10228,7 @@ function TableRow(props) {
|
|
|
10218
10228
|
bottom: 0
|
|
10219
10229
|
}
|
|
10220
10230
|
})) : React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
10221
|
-
className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container' : undefined)
|
|
10231
|
+
className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container-' + site : undefined)
|
|
10222
10232
|
}));
|
|
10223
10233
|
}
|
|
10224
10234
|
|
|
@@ -12040,64 +12050,57 @@ function Drag$1(props) {
|
|
|
12040
12050
|
var currentGood = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
12041
12051
|
return e.$index === record.$index;
|
|
12042
12052
|
})[0];
|
|
12043
|
-
mounting(React__default['default'].createElement(DragDiv, _objectSpread2({}, currentGood)));
|
|
12044
|
-
|
|
12053
|
+
mounting(React__default['default'].createElement(DragDiv, _objectSpread2({}, currentGood)));
|
|
12045
12054
|
rowList.forEach(function (e) {
|
|
12046
|
-
e.addEventListener('
|
|
12055
|
+
e.addEventListener('mousemove', onMousemove);
|
|
12047
12056
|
});
|
|
12048
12057
|
|
|
12049
|
-
function
|
|
12058
|
+
function onMousemove(e) {
|
|
12050
12059
|
controller.run( /*#__PURE__*/function () {
|
|
12051
12060
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
12052
|
-
var
|
|
12061
|
+
var _rowDom$dataset;
|
|
12053
12062
|
|
|
12054
|
-
var
|
|
12063
|
+
var rowDom, container, row, currentGood, currentIndex, containerIndex, _currentIndex, _containerIndex, t, rect, mouseY;
|
|
12055
12064
|
|
|
12056
12065
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
12057
12066
|
while (1) {
|
|
12058
12067
|
switch (_context2.prev = _context2.next) {
|
|
12059
12068
|
case 0:
|
|
12060
|
-
|
|
12069
|
+
rowDom = getRow(e.target);
|
|
12070
|
+
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;
|
|
12071
|
+
/** 准备插入的货物 */
|
|
12072
|
+
|
|
12073
|
+
row = s.goodsListState.goodsMap.get(container);
|
|
12061
12074
|
|
|
12062
|
-
if (
|
|
12063
|
-
_context2.next =
|
|
12075
|
+
if (row) {
|
|
12076
|
+
_context2.next = 5;
|
|
12064
12077
|
break;
|
|
12065
12078
|
}
|
|
12066
12079
|
|
|
12067
12080
|
return _context2.abrupt("return");
|
|
12068
12081
|
|
|
12069
|
-
case
|
|
12082
|
+
case 5:
|
|
12070
12083
|
if (!(container === s.goodsListState.drag.current)) {
|
|
12071
|
-
_context2.next =
|
|
12084
|
+
_context2.next = 7;
|
|
12072
12085
|
break;
|
|
12073
12086
|
}
|
|
12074
12087
|
|
|
12075
|
-
s.goodsListState.drag.container = undefined;
|
|
12076
|
-
return _context2.abrupt("return");
|
|
12088
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
12077
12089
|
|
|
12078
|
-
case
|
|
12090
|
+
case 7:
|
|
12091
|
+
/** 当前拖动中的货品 */
|
|
12079
12092
|
currentGood = s.goodsListState.drag.current && s.goodsListState.goodsMap.get(s.goodsListState.drag.current);
|
|
12080
12093
|
|
|
12081
12094
|
if (currentGood) {
|
|
12082
|
-
_context2.next =
|
|
12095
|
+
_context2.next = 10;
|
|
12083
12096
|
break;
|
|
12084
12097
|
}
|
|
12085
12098
|
|
|
12086
12099
|
return _context2.abrupt("return");
|
|
12087
12100
|
|
|
12088
|
-
case
|
|
12089
|
-
row = s.goodsListState.goodsMap.get(container);
|
|
12090
|
-
|
|
12091
|
-
if (row) {
|
|
12092
|
-
_context2.next = 12;
|
|
12093
|
-
break;
|
|
12094
|
-
}
|
|
12095
|
-
|
|
12096
|
-
return _context2.abrupt("return");
|
|
12097
|
-
|
|
12098
|
-
case 12:
|
|
12101
|
+
case 10:
|
|
12099
12102
|
if (!(currentGood.lineAttribute === LineAttributeType$1.折扣行)) {
|
|
12100
|
-
_context2.next =
|
|
12103
|
+
_context2.next = 15;
|
|
12101
12104
|
break;
|
|
12102
12105
|
}
|
|
12103
12106
|
|
|
@@ -12109,16 +12112,15 @@ function Drag$1(props) {
|
|
|
12109
12112
|
}).indexOf(row.$index);
|
|
12110
12113
|
|
|
12111
12114
|
if (!(currentIndex - 1 === containerIndex)) {
|
|
12112
|
-
_context2.next =
|
|
12115
|
+
_context2.next = 15;
|
|
12113
12116
|
break;
|
|
12114
12117
|
}
|
|
12115
12118
|
|
|
12116
|
-
s.goodsListState.drag.container = undefined;
|
|
12117
|
-
return _context2.abrupt("return");
|
|
12119
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
12118
12120
|
|
|
12119
|
-
case
|
|
12121
|
+
case 15:
|
|
12120
12122
|
if (!(currentGood.lineAttribute === LineAttributeType$1.被折扣行)) {
|
|
12121
|
-
_context2.next =
|
|
12123
|
+
_context2.next = 20;
|
|
12122
12124
|
break;
|
|
12123
12125
|
}
|
|
12124
12126
|
|
|
@@ -12130,23 +12132,29 @@ function Drag$1(props) {
|
|
|
12130
12132
|
}).indexOf(row.$index);
|
|
12131
12133
|
|
|
12132
12134
|
if (!(_currentIndex + 1 === _containerIndex)) {
|
|
12133
|
-
_context2.next =
|
|
12135
|
+
_context2.next = 20;
|
|
12134
12136
|
break;
|
|
12135
12137
|
}
|
|
12136
12138
|
|
|
12137
|
-
s.goodsListState.drag.container = undefined;
|
|
12138
|
-
return _context2.abrupt("return");
|
|
12139
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
12139
12140
|
|
|
12140
|
-
case
|
|
12141
|
+
case 20:
|
|
12141
12142
|
// 折扣行 拖动的 相当于 自己的 被折扣行
|
|
12142
12143
|
if (row.lineAttribute === LineAttributeType$1.折扣行) {
|
|
12143
12144
|
t = s.goodsListState.goodsList.map(function (e) {
|
|
12144
12145
|
return e.$index;
|
|
12145
12146
|
}).indexOf(container) - 1;
|
|
12146
12147
|
s.goodsListState.drag.container = s.goodsListState.goodsList[t].$index;
|
|
12148
|
+
s.goodsListState.drag.site = 'u';
|
|
12149
|
+
} else if (row.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
12150
|
+
s.goodsListState.drag.site = 'd';
|
|
12151
|
+
} else {
|
|
12152
|
+
rect = rowDom.getBoundingClientRect();
|
|
12153
|
+
mouseY = e.clientY - rect.top;
|
|
12154
|
+
s.goodsListState.drag.site = mouseY > 15 ? 'd' : 'u';
|
|
12147
12155
|
}
|
|
12148
12156
|
|
|
12149
|
-
case
|
|
12157
|
+
case 21:
|
|
12150
12158
|
case "end":
|
|
12151
12159
|
return _context2.stop();
|
|
12152
12160
|
}
|
|
@@ -12199,7 +12207,7 @@ function Drag$1(props) {
|
|
|
12199
12207
|
}());
|
|
12200
12208
|
window.removeEventListener('mouseup', onMouseup);
|
|
12201
12209
|
rowList.forEach(function (e) {
|
|
12202
|
-
e.removeEventListener('
|
|
12210
|
+
e.removeEventListener('mousemove', onMousemove);
|
|
12203
12211
|
}); // window.document.body.removeChild(rowDiv);
|
|
12204
12212
|
} // 开始插入
|
|
12205
12213
|
|
|
@@ -12208,13 +12216,13 @@ function Drag$1(props) {
|
|
|
12208
12216
|
mounting(React__default['default'].createElement(React__default['default'].Fragment, null));
|
|
12209
12217
|
controller.run( /*#__PURE__*/function () {
|
|
12210
12218
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
|
|
12211
|
-
var _s$goodsListState$dra, container, current, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
12219
|
+
var _s$goodsListState$dra, container, current, site, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
12212
12220
|
|
|
12213
12221
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
12214
12222
|
while (1) {
|
|
12215
12223
|
switch (_context4.prev = _context4.next) {
|
|
12216
12224
|
case 0:
|
|
12217
|
-
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current;
|
|
12225
|
+
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current, site = _s$goodsListState$dra.site;
|
|
12218
12226
|
|
|
12219
12227
|
if (!(!container || !current)) {
|
|
12220
12228
|
_context4.next = 3;
|
|
@@ -12247,9 +12255,11 @@ function Drag$1(props) {
|
|
|
12247
12255
|
var g = s.goodsListState.goodsList.filter(function (e) {
|
|
12248
12256
|
return moveGoods.indexOf(e.$index) < 0;
|
|
12249
12257
|
});
|
|
12250
|
-
var t = g.map(function (e) {
|
|
12258
|
+
var t = site === 'u' ? g.map(function (e) {
|
|
12251
12259
|
return e.$index;
|
|
12252
|
-
}).indexOf(container)
|
|
12260
|
+
}).indexOf(container) : g.map(function (e) {
|
|
12261
|
+
return e.$index;
|
|
12262
|
+
}).indexOf(container) + 1;
|
|
12253
12263
|
var m = moveGoods.map(function (e) {
|
|
12254
12264
|
return goodsMap.get(e);
|
|
12255
12265
|
}).filter(function (e) {
|
|
@@ -16759,7 +16769,7 @@ function Search$1() {
|
|
|
16759
16769
|
});
|
|
16760
16770
|
}
|
|
16761
16771
|
|
|
16762
|
-
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";
|
|
16772
|
+
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";
|
|
16763
16773
|
styleInject(css_248z$l);
|
|
16764
16774
|
|
|
16765
16775
|
function TableRow$1(props) {
|
|
@@ -16768,6 +16778,11 @@ function TableRow$1(props) {
|
|
|
16768
16778
|
var goodsMap = controller.useMemo(function (s) {
|
|
16769
16779
|
return s.goodsListState.goodsMap;
|
|
16770
16780
|
}, []);
|
|
16781
|
+
/** 当前拖动中的货品索引 */
|
|
16782
|
+
|
|
16783
|
+
var site = controller.useMemo(function (s) {
|
|
16784
|
+
return s.goodsListState.drag.site;
|
|
16785
|
+
}, []);
|
|
16771
16786
|
var current = controller.useMemo(function (s) {
|
|
16772
16787
|
return s.goodsListState.drag.current;
|
|
16773
16788
|
}, []);
|
|
@@ -16799,8 +16814,9 @@ function TableRow$1(props) {
|
|
|
16799
16814
|
position: 'absolute',
|
|
16800
16815
|
bottom: 0
|
|
16801
16816
|
}
|
|
16802
|
-
})) :
|
|
16803
|
-
|
|
16817
|
+
})) : // <tr {...props} className={classnames(props.className, discount, (rowKey === container && current) ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')} />
|
|
16818
|
+
React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
16819
|
+
className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container-' + site : undefined)
|
|
16804
16820
|
}));
|
|
16805
16821
|
}
|
|
16806
16822
|
|
|
@@ -17995,6 +18011,12 @@ styleInject(css_248z$n);
|
|
|
17995
18011
|
|
|
17996
18012
|
function Drag$2(props) {
|
|
17997
18013
|
var record = props.record;
|
|
18014
|
+
|
|
18015
|
+
var _React$useState = React__default['default'].useState(false),
|
|
18016
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18017
|
+
open = _React$useState2[0],
|
|
18018
|
+
setOpen = _React$useState2[1];
|
|
18019
|
+
|
|
17998
18020
|
var controller = Invoice.useInvoiceController();
|
|
17999
18021
|
var editGood = controller.useMemo(function (s) {
|
|
18000
18022
|
return s.goodsListState.editGood;
|
|
@@ -18003,7 +18025,7 @@ function Drag$2(props) {
|
|
|
18003
18025
|
return !!editGood;
|
|
18004
18026
|
}, [editGood]);
|
|
18005
18027
|
var onMouseDown = React__default['default'].useCallback(function () {
|
|
18006
|
-
if (!controller || !record) return;
|
|
18028
|
+
if (!controller || !record || disabled) return;
|
|
18007
18029
|
controller.run( /*#__PURE__*/function () {
|
|
18008
18030
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
18009
18031
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -18028,64 +18050,57 @@ function Drag$2(props) {
|
|
|
18028
18050
|
var currentGood = controller.state.goodsListState.goodsList.filter(function (e) {
|
|
18029
18051
|
return e.$index === record.$index;
|
|
18030
18052
|
})[0];
|
|
18031
|
-
mounting(React__default['default'].createElement(DragDiv$1, _objectSpread2({}, currentGood)));
|
|
18032
|
-
|
|
18053
|
+
mounting(React__default['default'].createElement(DragDiv$1, _objectSpread2({}, currentGood)));
|
|
18033
18054
|
rowList.forEach(function (e) {
|
|
18034
|
-
e.addEventListener('
|
|
18055
|
+
e.addEventListener('mousemove', onMousemove);
|
|
18035
18056
|
});
|
|
18036
18057
|
|
|
18037
|
-
function
|
|
18058
|
+
function onMousemove(e) {
|
|
18038
18059
|
controller.run( /*#__PURE__*/function () {
|
|
18039
18060
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
18040
|
-
var
|
|
18061
|
+
var _rowDom$dataset;
|
|
18041
18062
|
|
|
18042
|
-
var
|
|
18063
|
+
var rowDom, container, row, currentGood, currentIndex, containerIndex, _currentIndex, _containerIndex, t, rect, mouseY;
|
|
18043
18064
|
|
|
18044
18065
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
18045
18066
|
while (1) {
|
|
18046
18067
|
switch (_context2.prev = _context2.next) {
|
|
18047
18068
|
case 0:
|
|
18048
|
-
|
|
18069
|
+
rowDom = getRow(e.target);
|
|
18070
|
+
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;
|
|
18071
|
+
/** 准备插入的货物 */
|
|
18049
18072
|
|
|
18050
|
-
|
|
18051
|
-
|
|
18073
|
+
row = s.goodsListState.goodsMap.get(container);
|
|
18074
|
+
|
|
18075
|
+
if (row) {
|
|
18076
|
+
_context2.next = 5;
|
|
18052
18077
|
break;
|
|
18053
18078
|
}
|
|
18054
18079
|
|
|
18055
18080
|
return _context2.abrupt("return");
|
|
18056
18081
|
|
|
18057
|
-
case
|
|
18082
|
+
case 5:
|
|
18058
18083
|
if (!(container === s.goodsListState.drag.current)) {
|
|
18059
|
-
_context2.next =
|
|
18084
|
+
_context2.next = 7;
|
|
18060
18085
|
break;
|
|
18061
18086
|
}
|
|
18062
18087
|
|
|
18063
|
-
s.goodsListState.drag.container = undefined;
|
|
18064
|
-
return _context2.abrupt("return");
|
|
18088
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
18065
18089
|
|
|
18066
|
-
case
|
|
18090
|
+
case 7:
|
|
18091
|
+
/** 当前拖动中的货品 */
|
|
18067
18092
|
currentGood = s.goodsListState.drag.current && s.goodsListState.goodsMap.get(s.goodsListState.drag.current);
|
|
18068
18093
|
|
|
18069
18094
|
if (currentGood) {
|
|
18070
|
-
_context2.next =
|
|
18095
|
+
_context2.next = 10;
|
|
18071
18096
|
break;
|
|
18072
18097
|
}
|
|
18073
18098
|
|
|
18074
18099
|
return _context2.abrupt("return");
|
|
18075
18100
|
|
|
18076
|
-
case
|
|
18077
|
-
row = s.goodsListState.goodsMap.get(container);
|
|
18078
|
-
|
|
18079
|
-
if (row) {
|
|
18080
|
-
_context2.next = 12;
|
|
18081
|
-
break;
|
|
18082
|
-
}
|
|
18083
|
-
|
|
18084
|
-
return _context2.abrupt("return");
|
|
18085
|
-
|
|
18086
|
-
case 12:
|
|
18101
|
+
case 10:
|
|
18087
18102
|
if (!(currentGood.lineAttribute === LineAttributeType$1.折扣行)) {
|
|
18088
|
-
_context2.next =
|
|
18103
|
+
_context2.next = 15;
|
|
18089
18104
|
break;
|
|
18090
18105
|
}
|
|
18091
18106
|
|
|
@@ -18097,16 +18112,15 @@ function Drag$2(props) {
|
|
|
18097
18112
|
}).indexOf(row.$index);
|
|
18098
18113
|
|
|
18099
18114
|
if (!(currentIndex - 1 === containerIndex)) {
|
|
18100
|
-
_context2.next =
|
|
18115
|
+
_context2.next = 15;
|
|
18101
18116
|
break;
|
|
18102
18117
|
}
|
|
18103
18118
|
|
|
18104
|
-
s.goodsListState.drag.container = undefined;
|
|
18105
|
-
return _context2.abrupt("return");
|
|
18119
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
18106
18120
|
|
|
18107
|
-
case
|
|
18121
|
+
case 15:
|
|
18108
18122
|
if (!(currentGood.lineAttribute === LineAttributeType$1.被折扣行)) {
|
|
18109
|
-
_context2.next =
|
|
18123
|
+
_context2.next = 20;
|
|
18110
18124
|
break;
|
|
18111
18125
|
}
|
|
18112
18126
|
|
|
@@ -18118,23 +18132,29 @@ function Drag$2(props) {
|
|
|
18118
18132
|
}).indexOf(row.$index);
|
|
18119
18133
|
|
|
18120
18134
|
if (!(_currentIndex + 1 === _containerIndex)) {
|
|
18121
|
-
_context2.next =
|
|
18135
|
+
_context2.next = 20;
|
|
18122
18136
|
break;
|
|
18123
18137
|
}
|
|
18124
18138
|
|
|
18125
|
-
s.goodsListState.drag.container = undefined;
|
|
18126
|
-
return _context2.abrupt("return");
|
|
18139
|
+
return _context2.abrupt("return", s.goodsListState.drag.container = undefined);
|
|
18127
18140
|
|
|
18128
|
-
case
|
|
18141
|
+
case 20:
|
|
18129
18142
|
// 折扣行 拖动的 相当于 自己的 被折扣行
|
|
18130
18143
|
if (row.lineAttribute === LineAttributeType$1.折扣行) {
|
|
18131
18144
|
t = s.goodsListState.goodsList.map(function (e) {
|
|
18132
18145
|
return e.$index;
|
|
18133
18146
|
}).indexOf(container) - 1;
|
|
18134
18147
|
s.goodsListState.drag.container = s.goodsListState.goodsList[t].$index;
|
|
18148
|
+
s.goodsListState.drag.site = 'u';
|
|
18149
|
+
} else if (row.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
18150
|
+
s.goodsListState.drag.site = 'd';
|
|
18151
|
+
} else {
|
|
18152
|
+
rect = rowDom.getBoundingClientRect();
|
|
18153
|
+
mouseY = e.clientY - rect.top;
|
|
18154
|
+
s.goodsListState.drag.site = mouseY > 25 ? 'd' : 'u';
|
|
18135
18155
|
}
|
|
18136
18156
|
|
|
18137
|
-
case
|
|
18157
|
+
case 21:
|
|
18138
18158
|
case "end":
|
|
18139
18159
|
return _context2.stop();
|
|
18140
18160
|
}
|
|
@@ -18187,7 +18207,7 @@ function Drag$2(props) {
|
|
|
18187
18207
|
}());
|
|
18188
18208
|
window.removeEventListener('mouseup', onMouseup);
|
|
18189
18209
|
rowList.forEach(function (e) {
|
|
18190
|
-
e.removeEventListener('
|
|
18210
|
+
e.removeEventListener('mousemove', onMousemove);
|
|
18191
18211
|
}); // window.document.body.removeChild(rowDiv);
|
|
18192
18212
|
} // 开始插入
|
|
18193
18213
|
|
|
@@ -18196,13 +18216,13 @@ function Drag$2(props) {
|
|
|
18196
18216
|
mounting(React__default['default'].createElement(React__default['default'].Fragment, null));
|
|
18197
18217
|
controller.run( /*#__PURE__*/function () {
|
|
18198
18218
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
|
|
18199
|
-
var _s$goodsListState$dra, container, current, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
18219
|
+
var _s$goodsListState$dra, container, current, site, goodsList, goodsMap, _currentGood, currentIndex, moveGoods;
|
|
18200
18220
|
|
|
18201
18221
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
18202
18222
|
while (1) {
|
|
18203
18223
|
switch (_context4.prev = _context4.next) {
|
|
18204
18224
|
case 0:
|
|
18205
|
-
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current;
|
|
18225
|
+
_s$goodsListState$dra = s.goodsListState.drag, container = _s$goodsListState$dra.container, current = _s$goodsListState$dra.current, site = _s$goodsListState$dra.site;
|
|
18206
18226
|
|
|
18207
18227
|
if (!(!container || !current)) {
|
|
18208
18228
|
_context4.next = 3;
|
|
@@ -18235,9 +18255,11 @@ function Drag$2(props) {
|
|
|
18235
18255
|
var g = s.goodsListState.goodsList.filter(function (e) {
|
|
18236
18256
|
return moveGoods.indexOf(e.$index) < 0;
|
|
18237
18257
|
});
|
|
18238
|
-
var t = g.map(function (e) {
|
|
18258
|
+
var t = site === 'u' ? g.map(function (e) {
|
|
18259
|
+
return e.$index;
|
|
18260
|
+
}).indexOf(container) : g.map(function (e) {
|
|
18239
18261
|
return e.$index;
|
|
18240
|
-
}).indexOf(container);
|
|
18262
|
+
}).indexOf(container) + 1;
|
|
18241
18263
|
var m = moveGoods.map(function (e) {
|
|
18242
18264
|
return goodsMap.get(e);
|
|
18243
18265
|
}).filter(function (e) {
|
|
@@ -18268,33 +18290,44 @@ function Drag$2(props) {
|
|
|
18268
18290
|
};
|
|
18269
18291
|
}());
|
|
18270
18292
|
}
|
|
18271
|
-
}, [controller, record]);
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18293
|
+
}, [controller, record, disabled]);
|
|
18294
|
+
var renderButton = React__default['default'].useMemo(function () {
|
|
18295
|
+
return React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
18296
|
+
type: 'link',
|
|
18297
|
+
style: {
|
|
18298
|
+
padding: 0
|
|
18299
|
+
},
|
|
18300
|
+
onMouseDown: onMouseDown,
|
|
18301
|
+
onClick: function onClick(e) {
|
|
18302
|
+
e.stopPropagation();
|
|
18303
|
+
},
|
|
18304
|
+
className: "kts-invoice-operate-goods-list-itemName-drag",
|
|
18305
|
+
onMouseOver: controller.saveEditGood
|
|
18306
|
+
}, React__default['default'].createElement(Icon, {
|
|
18307
|
+
component: SvgI001$1
|
|
18308
|
+
}));
|
|
18309
|
+
}, [onMouseDown, controller]);
|
|
18310
|
+
|
|
18311
|
+
if (disabled) {
|
|
18312
|
+
return React__default['default'].createElement(ktsXui.Popover, {
|
|
18313
|
+
content: '您还有未编辑完成的商品',
|
|
18314
|
+
trigger: 'focus'
|
|
18315
|
+
}, renderButton);
|
|
18316
|
+
} else {
|
|
18317
|
+
return renderButton;
|
|
18318
|
+
}
|
|
18286
18319
|
}
|
|
18287
18320
|
|
|
18288
18321
|
function DragDiv$1(props) {
|
|
18289
|
-
var _React$
|
|
18290
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18291
|
-
x = _React$useState2[0],
|
|
18292
|
-
setX = _React$useState2[1];
|
|
18293
|
-
|
|
18294
|
-
var _React$useState3 = React__default['default'].useState(-110),
|
|
18322
|
+
var _React$useState3 = React__default['default'].useState(0),
|
|
18295
18323
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
18296
|
-
|
|
18297
|
-
|
|
18324
|
+
x = _React$useState4[0],
|
|
18325
|
+
setX = _React$useState4[1];
|
|
18326
|
+
|
|
18327
|
+
var _React$useState5 = React__default['default'].useState(-110),
|
|
18328
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
18329
|
+
y = _React$useState6[0],
|
|
18330
|
+
setY = _React$useState6[1];
|
|
18298
18331
|
|
|
18299
18332
|
var div = React__default['default'].useMemo(function () {
|
|
18300
18333
|
return window.document.querySelector("[data-row-key=\"".concat(props.$index, "\"]"));
|
|
@@ -18309,7 +18342,7 @@ function DragDiv$1(props) {
|
|
|
18309
18342
|
|
|
18310
18343
|
React__default['default'].useEffect(function () {
|
|
18311
18344
|
function onMousemove(e) {
|
|
18312
|
-
setY(e.clientY -
|
|
18345
|
+
setY(e.clientY - 15);
|
|
18313
18346
|
}
|
|
18314
18347
|
window.addEventListener('mousemove', onMousemove);
|
|
18315
18348
|
return function () {
|
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ export default () => {
|
|
|
53
53
|
<Switch checkedChildren="预制" unCheckedChildren="默认" onChange={e => { e ? setController(controller2) : setController(controller1) }} ></Switch>
|
|
54
54
|
<Button onClick={controller.pipeline(async s => { s.goodsListState.endowCode.getReadOnlyTaxRate = s.goodsListState.endowCode.readOnlyTaxRateMap.DRAFT })} >税率(草稿)</Button>
|
|
55
55
|
<Button onClick={controller.pipeline(async s => { s.goodsListState.endowCode.getReadOnlyTaxRate = () => true })} >税率(预制)</Button>
|
|
56
|
-
<Invoice controller={controller} />
|
|
56
|
+
<Invoice controller={controller} invoiceType='digtal' />
|
|
57
57
|
</div>
|
|
58
58
|
);
|
|
59
59
|
};
|
|
@@ -34,32 +34,30 @@ export default function Drag(props: IDragProps) {
|
|
|
34
34
|
const currentGood = controller.state.goodsListState.goodsList.filter(e => e.$index === record.$index)[0];
|
|
35
35
|
mounting(<DragDiv {...currentGood} />)
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function onMouseover(e: MouseEvent) {
|
|
37
|
+
rowList.forEach(e => { e.addEventListener('mousemove', onMousemove) });
|
|
38
|
+
function onMousemove(e: MouseEvent) {
|
|
40
39
|
controller.run(async s => {
|
|
41
|
-
const
|
|
42
|
-
|
|
40
|
+
const rowDom = getRow(e.target);
|
|
41
|
+
const container = s.goodsListState.drag.container = rowDom?.dataset?.rowKey;
|
|
42
|
+
|
|
43
|
+
/** 准备插入的货物 */
|
|
44
|
+
const row = s.goodsListState.goodsMap.get(container); if (!row) return;
|
|
43
45
|
|
|
44
46
|
// 不可以插入自己
|
|
45
47
|
if (container === s.goodsListState.drag.current) {
|
|
46
|
-
s.goodsListState.drag.container = undefined;
|
|
47
|
-
return;
|
|
48
|
+
return s.goodsListState.drag.container = undefined;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
if (!currentGood) return;
|
|
52
|
-
|
|
53
|
-
const row = s.goodsListState.goodsMap.get(container);
|
|
54
|
-
if (!row) return;
|
|
51
|
+
/** 当前拖动中的货品 */
|
|
52
|
+
const currentGood = s.goodsListState.drag.current && s.goodsListState.goodsMap.get(s.goodsListState.drag.current); if (!currentGood) return;
|
|
55
53
|
|
|
56
54
|
// 折扣行 不可以插入 自己的被折扣行
|
|
57
55
|
if (currentGood.lineAttribute === LineAttributeType.折扣行) {
|
|
58
56
|
const currentIndex = s.goodsListState.goodsList.map(e => e.$index).indexOf(currentGood.$index)
|
|
59
57
|
const containerIndex = s.goodsListState.goodsList.map(e => e.$index).indexOf(row.$index)
|
|
60
58
|
if (currentIndex - 1 === containerIndex) {
|
|
61
|
-
s.goodsListState.drag.container = undefined;
|
|
62
|
-
|
|
59
|
+
return s.goodsListState.drag.container = undefined;
|
|
60
|
+
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -68,8 +66,7 @@ export default function Drag(props: IDragProps) {
|
|
|
68
66
|
const currentIndex = s.goodsListState.goodsList.map(e => e.$index).indexOf(currentGood.$index)
|
|
69
67
|
const containerIndex = s.goodsListState.goodsList.map(e => e.$index).indexOf(row.$index)
|
|
70
68
|
if (currentIndex + 1 === containerIndex) {
|
|
71
|
-
s.goodsListState.drag.container = undefined;
|
|
72
|
-
return;
|
|
69
|
+
return s.goodsListState.drag.container = undefined;
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
72
|
|
|
@@ -77,9 +74,15 @@ export default function Drag(props: IDragProps) {
|
|
|
77
74
|
if (row.lineAttribute === LineAttributeType.折扣行) {
|
|
78
75
|
const t = s.goodsListState.goodsList.map(e => e.$index).indexOf(container) - 1;
|
|
79
76
|
s.goodsListState.drag.container = s.goodsListState.goodsList[t].$index;
|
|
77
|
+
s.goodsListState.drag.site = 'u'
|
|
78
|
+
} else if (row.lineAttribute === LineAttributeType.被折扣行) {
|
|
79
|
+
s.goodsListState.drag.site = 'd'
|
|
80
|
+
} else {
|
|
81
|
+
const rect = rowDom.getBoundingClientRect();
|
|
82
|
+
const mouseY = e.clientY - rect.top;
|
|
83
|
+
s.goodsListState.drag.site = mouseY > 15 ? 'd' : 'u';
|
|
80
84
|
}
|
|
81
|
-
})
|
|
82
|
-
|
|
85
|
+
})
|
|
83
86
|
|
|
84
87
|
const getRow = (t: any): any => {
|
|
85
88
|
try {
|
|
@@ -100,7 +103,7 @@ export default function Drag(props: IDragProps) {
|
|
|
100
103
|
insert();
|
|
101
104
|
controller.run(async s => s.goodsListState.drag.current = undefined);
|
|
102
105
|
window.removeEventListener('mouseup', onMouseup);
|
|
103
|
-
rowList.forEach(e => { e.removeEventListener('
|
|
106
|
+
rowList.forEach(e => { e.removeEventListener('mousemove', onMousemove) });
|
|
104
107
|
// window.document.body.removeChild(rowDiv);
|
|
105
108
|
}
|
|
106
109
|
|
|
@@ -108,7 +111,7 @@ export default function Drag(props: IDragProps) {
|
|
|
108
111
|
function insert() {
|
|
109
112
|
mounting(<></>);
|
|
110
113
|
controller.run(async s => {
|
|
111
|
-
const { container, current } = s.goodsListState.drag;
|
|
114
|
+
const { container, current, site } = s.goodsListState.drag;
|
|
112
115
|
if (!container || !current) return;
|
|
113
116
|
if (container !== current) {
|
|
114
117
|
const goodsList = s.goodsListState.goodsList;
|
|
@@ -126,7 +129,7 @@ export default function Drag(props: IDragProps) {
|
|
|
126
129
|
|
|
127
130
|
(() => {
|
|
128
131
|
const g = s.goodsListState.goodsList.filter(e => moveGoods.indexOf(e.$index) < 0);
|
|
129
|
-
const t = g.map(e => e.$index).indexOf(container);
|
|
132
|
+
const t = site === 'u' ? g.map(e => e.$index).indexOf(container) : g.map(e => e.$index).indexOf(container) + 1;
|
|
130
133
|
const m = moveGoods.map(e => goodsMap.get(e)).filter(e => !!e) as IGood[];
|
|
131
134
|
s.goodsListState.goodsList = (g.splice.apply(g, [t, 0, ...m]), g);
|
|
132
135
|
})()
|