dlt-for-react 1.1.16 → 1.1.17
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 +17 -1
- package/assets/HqCheckButton/index.less +13 -0
- package/assets/HqImage/index.less +11 -0
- package/assets/HqInputPicker/index.less +8 -0
- package/assets/selector/resultview/index.less +53 -0
- package/assets/selector/selectormodal/index.less +15 -0
- package/assets/selector/table/index.less +211 -0
- package/assets/selector/tree/index.less +138 -0
- package/assets/stuSelector/index.less +24 -0
- package/assets/teaSelector/index.less +4 -0
- package/lib/components/HqCascader/index.js +306 -0
- package/lib/components/HqCheckBox/index.js +375 -0
- package/lib/components/HqCheckButton/index.js +284 -0
- package/lib/components/HqConfirm/index.js +81 -0
- package/lib/components/HqFormItem/FormRules.js +27 -0
- package/lib/components/HqFormItem/index.js +309 -0
- package/lib/components/HqImage/index.js +553 -0
- package/lib/components/HqInputPicker/edit-page.js +585 -0
- package/lib/components/HqInputPicker/index.js +226 -0
- package/lib/components/HqInputPicker/input-const.js +134 -0
- package/lib/components/HqInputPicker/render.js +2496 -0
- package/lib/components/HqInputPicker/setting-checkbox.js +853 -0
- package/lib/components/HqInputPicker/setting-datepicker.js +430 -0
- package/lib/components/HqInputPicker/setting-datetimepicker.js +443 -0
- package/lib/components/HqInputPicker/setting-input.js +555 -0
- package/lib/components/HqInputPicker/setting-inputNumber.js +658 -0
- package/lib/components/HqInputPicker/setting-monthpicker.js +434 -0
- package/lib/components/HqInputPicker/setting-multiSelect.js +533 -0
- package/lib/components/HqInputPicker/setting-nhcascader.js +588 -0
- package/lib/components/HqInputPicker/setting-old-upload.js +428 -0
- package/lib/components/HqInputPicker/setting-radio.js +468 -0
- package/lib/components/HqInputPicker/setting-rangepicker.js +466 -0
- package/lib/components/HqInputPicker/setting-select.js +534 -0
- package/lib/components/HqInputPicker/setting-stu-selector.js +508 -0
- package/lib/components/HqInputPicker/setting-switch.js +274 -0
- package/lib/components/HqInputPicker/setting-tea-selector.js +508 -0
- package/lib/components/HqInputPicker/setting-textarea.js +619 -0
- package/lib/components/HqInputPicker/setting-timepicker.js +437 -0
- package/lib/components/HqInputPicker/setting-upload.js +795 -0
- package/lib/components/HqMultiSelect/index.js +495 -0
- package/lib/components/HqOldUpload/index.js +350 -0
- package/lib/components/HqSelect/getSelectName.js +20 -0
- package/lib/components/HqSelect/index.js +495 -0
- package/lib/components/HqSelector/HqLsrySelector/index.js +269 -267
- package/lib/components/HqSelector/HqRySelector/index.js +4 -2
- package/lib/components/HqSelector/HqWzSelector/index.js +4 -2
- package/lib/components/HqStuSelector/index.js +267 -0
- package/lib/components/HqTeaSelector/index.js +221 -0
- package/lib/components/KyCollapse/index.js +23 -24
- package/lib/components/KyContainerFrame/index.js +2 -2
- package/lib/components/KyEditableTable/component.js +38 -38
- package/lib/components/KyEditableTable/index.js +203 -181
- package/lib/components/KyExcel/index.js +191 -153
- package/lib/components/KyModal/index.js +43 -33
- package/lib/components/KyTable/AddFieldsModal.js +66 -59
- package/lib/components/KyTable/checkButtons.js +3 -13
- package/lib/components/KyTable/index.js +2 -2
- package/lib/components/KyTableCardList/AddFieldsModal.js +280 -282
- package/lib/components/KyTableCardList/index.js +2 -2
- package/lib/components/KyTree/index.js +7 -7
- package/lib/components/KyUpload/index.js +170 -165
- package/lib/components/NHSelector/ListSort/index.js +411 -0
- package/lib/components/NHSelector/index.js +636 -0
- package/lib/components/NHSelector/resultview/index.js +408 -0
- package/lib/components/NHSelector/selectormodal/index.js +303 -0
- package/lib/components/NHSelector/table/index.js +784 -0
- package/lib/components/NHSelector/tree/index.js +554 -0
- package/lib/index.js +146 -36
- package/lib/layouts/LeftMenu/index.js +6 -6
- package/lib/layouts/Login/index-pre.js +107 -103
- package/lib/layouts/Login/index.js +2 -2
- package/lib/layouts/Login/login.js +178 -172
- package/lib/layouts/NavigationBar/index.js +67 -67
- package/lib/layouts/Top/editPassWord.js +84 -64
- package/lib/layouts/Top/index.js +117 -117
- package/lib/layouts/TopMenu/index.js +53 -53
- package/lib/layouts/layout/index.js +115 -118
- package/lib/layouts/mixTop/index.js +95 -95
- package/lib/layouts/settingDrawer/index.js +96 -96
- package/lib/routes/AuthorizedRoute.js +33 -32
- package/lib/utils/NHCore.js +65 -65
- package/package.json +3 -3
- package/lib/utils/createUuid.js +0 -40
- package/lib/utils/getLoginUser.js +0 -10
- package/lib/utils/getSize.js +0 -27
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = undefined;
|
|
7
|
+
|
|
8
|
+
var _extends2 = require('babel-runtime/helpers/extends');
|
|
9
|
+
|
|
10
|
+
var _extends3 = _interopRequireDefault(_extends2);
|
|
11
|
+
|
|
12
|
+
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
|
13
|
+
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
17
|
+
|
|
18
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
19
|
+
|
|
20
|
+
var _createClass2 = require('babel-runtime/helpers/createClass');
|
|
21
|
+
|
|
22
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
25
|
+
|
|
26
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
27
|
+
|
|
28
|
+
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
29
|
+
|
|
30
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
31
|
+
|
|
32
|
+
var _react = require('react');
|
|
33
|
+
|
|
34
|
+
var _react2 = _interopRequireDefault(_react);
|
|
35
|
+
|
|
36
|
+
var _reactDom = require('react-dom');
|
|
37
|
+
|
|
38
|
+
var _reactDom2 = _interopRequireDefault(_reactDom);
|
|
39
|
+
|
|
40
|
+
var _rcTweenOne = require('rc-tween-one');
|
|
41
|
+
|
|
42
|
+
var _rcTweenOne2 = _interopRequireDefault(_rcTweenOne);
|
|
43
|
+
|
|
44
|
+
var _rcQueueAnim = require('rc-queue-anim');
|
|
45
|
+
|
|
46
|
+
var _rcQueueAnim2 = _interopRequireDefault(_rcQueueAnim);
|
|
47
|
+
|
|
48
|
+
var _propTypes = require('prop-types');
|
|
49
|
+
|
|
50
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
51
|
+
|
|
52
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
|
+
|
|
54
|
+
function toArrayChildren(children) {
|
|
55
|
+
var ret = [];
|
|
56
|
+
_react2.default.Children.forEach(children, function (c) {
|
|
57
|
+
ret.push(c);
|
|
58
|
+
});
|
|
59
|
+
return ret;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function findChildInChildrenByKey(children, key) {
|
|
63
|
+
var ret = null;
|
|
64
|
+
if (children) {
|
|
65
|
+
children.forEach(function (c) {
|
|
66
|
+
if (ret || !c) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (c.key === key) {
|
|
70
|
+
ret = c;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return ret;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function mergeChildren(prev, next) {
|
|
78
|
+
var ret = [];
|
|
79
|
+
// 保存更改后的顺序,新增的在新增时的位置插入。
|
|
80
|
+
prev.forEach(function (c) {
|
|
81
|
+
if (!c) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
var newChild = findChildInChildrenByKey(next, c.key);
|
|
85
|
+
if (newChild) {
|
|
86
|
+
ret.push(newChild);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
next.forEach(function (c, i) {
|
|
91
|
+
if (!c) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
var newChild = findChildInChildrenByKey(prev, c.key);
|
|
95
|
+
if (!newChild) {
|
|
96
|
+
ret.splice(i, 0, c);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return ret;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var ListSort = function (_React$Component) {
|
|
103
|
+
(0, _inherits3.default)(ListSort, _React$Component);
|
|
104
|
+
|
|
105
|
+
function ListSort(props) {
|
|
106
|
+
(0, _classCallCheck3.default)(this, ListSort);
|
|
107
|
+
|
|
108
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (ListSort.__proto__ || (0, _getPrototypeOf2.default)(ListSort)).call(this, props));
|
|
109
|
+
|
|
110
|
+
_this.onMouseDown = function (i, e) {
|
|
111
|
+
if (_this.isDrage) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var rect = _this.dom.getBoundingClientRect();
|
|
115
|
+
var mouseX = e.touches === undefined ? e.clientX : e.touches[0].clientX;
|
|
116
|
+
//如果是点击在了右边20px的访问之内,不能进行推拖拉排序
|
|
117
|
+
if (mouseX + 20 > rect.x + rect.width) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
document.body.style.overflow = 'hidden';
|
|
121
|
+
_this.props.onEventChange(e, 'down');
|
|
122
|
+
var style = {
|
|
123
|
+
height: rect.height + 'px',
|
|
124
|
+
userSelect: 'none',
|
|
125
|
+
WebkitUserSelect: 'none',
|
|
126
|
+
MozUserSelect: 'none',
|
|
127
|
+
MsUserSelect: 'none'
|
|
128
|
+
};
|
|
129
|
+
_this.children = Array.prototype.slice.call(_this.dom.children);
|
|
130
|
+
_this.childStyle = [];
|
|
131
|
+
var childStyle = _this.children.map(function (item, ii) {
|
|
132
|
+
var cItem = _this.children[ii + 1];
|
|
133
|
+
var marginHeight = void 0;
|
|
134
|
+
var marginWidth = void 0;
|
|
135
|
+
if (cItem) {
|
|
136
|
+
marginHeight = cItem.offsetTop - item.offsetTop - item.clientHeight;
|
|
137
|
+
marginWidth = cItem.offsetLeft - item.offsetLeft - item.clientWidth;
|
|
138
|
+
} else {
|
|
139
|
+
var parentHeight = item.parentNode.clientHeight - parseFloat(getComputedStyle(item.parentNode).getPropertyValue('padding-bottom'));
|
|
140
|
+
var parentWidth = item.parentNode.clientWidth - parseFloat(getComputedStyle(item.parentNode).getPropertyValue('padding-right'));
|
|
141
|
+
marginHeight = parentHeight - item.offsetTop - item.clientHeight;
|
|
142
|
+
marginWidth = parentWidth - item.offsetLeft - item.clientWidth;
|
|
143
|
+
}
|
|
144
|
+
var d = {
|
|
145
|
+
width: item.clientWidth,
|
|
146
|
+
height: item.clientHeight,
|
|
147
|
+
top: item.offsetTop,
|
|
148
|
+
left: item.offsetLeft,
|
|
149
|
+
margin: 'auto',
|
|
150
|
+
marginHeight: marginHeight,
|
|
151
|
+
marginWidth: marginWidth,
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
zIndex: ii === i ? 1 : 0
|
|
154
|
+
};
|
|
155
|
+
_this.childStyle.push((0, _extends3.default)({}, d));
|
|
156
|
+
return d;
|
|
157
|
+
});
|
|
158
|
+
var animation = _this.children.map(function (item, ii) {
|
|
159
|
+
return i === ii && (!_this.props.dragClassName ? { scale: 1.2, boxShadow: '0 10px 10px rgba(0,0,0,0.15)' } : null) || null;
|
|
160
|
+
});
|
|
161
|
+
_this.index = i;
|
|
162
|
+
_this.swapIndex = i;
|
|
163
|
+
_this.mouseXY = {
|
|
164
|
+
startX: e.touches === undefined ? e.clientX : e.touches[0].clientX,
|
|
165
|
+
startY: e.touches === undefined ? e.clientY : e.touches[0].clientY,
|
|
166
|
+
top: childStyle[i].top,
|
|
167
|
+
left: childStyle[i].left
|
|
168
|
+
};
|
|
169
|
+
if (_this.props.dragClassName) {
|
|
170
|
+
_this.listDom = e.currentTarget;
|
|
171
|
+
_this.listDom.className = _this.listDom.className.replace(_this.props.dragClassName, '').trim() + ' ' + _this.props.dragClassName;
|
|
172
|
+
}
|
|
173
|
+
_this.isDrage = true;
|
|
174
|
+
_this.setState({
|
|
175
|
+
style: style,
|
|
176
|
+
childStyle: childStyle,
|
|
177
|
+
animation: animation
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
_this.onMouseUp = function (e) {
|
|
182
|
+
if (!_this.mouseXY) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
_this.mouseXY = null;
|
|
186
|
+
document.body.style.overflow = null;
|
|
187
|
+
_this.props.onEventChange(e, 'up');
|
|
188
|
+
var animation = _this.state.animation.map(function (item, i) {
|
|
189
|
+
if (_this.index === i) {
|
|
190
|
+
var animate = {};
|
|
191
|
+
var height = 0;
|
|
192
|
+
if (_this.props.animType === 'y') {
|
|
193
|
+
if (_this.swapIndex > _this.index) {
|
|
194
|
+
var start = _this.index + 1;
|
|
195
|
+
var end = _this.swapIndex + 1;
|
|
196
|
+
_this.childStyle.slice(start, end).forEach(function (_item) {
|
|
197
|
+
height += _item.height + _item.marginHeight;
|
|
198
|
+
});
|
|
199
|
+
animate.top = height + _this.childStyle[_this.index].top;
|
|
200
|
+
} else {
|
|
201
|
+
animate.top = _this.childStyle[_this.swapIndex].top;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var dragScale = !_this.props.dragClassName && {
|
|
205
|
+
scale: 1,
|
|
206
|
+
boxShadow: '0 0px 0px rgba(0,0,0,0)'
|
|
207
|
+
};
|
|
208
|
+
return (0, _extends3.default)({}, dragScale, animate, {
|
|
209
|
+
onComplete: function onComplete() {
|
|
210
|
+
var children = _this.sortArray(_this.state.children, _this.swapIndex, _this.index);
|
|
211
|
+
var callbackBool = _this.index !== _this.swapIndex;
|
|
212
|
+
_this.index = null;
|
|
213
|
+
_this.childStyle = [];
|
|
214
|
+
_this.swapIndex = null;
|
|
215
|
+
_this.setState({
|
|
216
|
+
style: {},
|
|
217
|
+
childStyle: [],
|
|
218
|
+
children: children,
|
|
219
|
+
animation: []
|
|
220
|
+
}, function () {
|
|
221
|
+
_this.isDrage = false;
|
|
222
|
+
if (callbackBool) {
|
|
223
|
+
_this.props.onChange(children);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return item;
|
|
230
|
+
});
|
|
231
|
+
if (_this.props.dragClassName) {
|
|
232
|
+
_this.listDom.className = '' + _this.listDom.className.replace(_this.props.dragClassName, '').trim();
|
|
233
|
+
}
|
|
234
|
+
_this.setState({ animation: animation });
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
_this.onMouseMove = function (e) {
|
|
238
|
+
if (!_this.mouseXY) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
_this.mouseXY.x = e.touches === undefined ? e.clientX : e.touches[0].clientX;
|
|
242
|
+
_this.mouseXY.y = e.touches === undefined ? e.clientY : e.touches[0].clientY;
|
|
243
|
+
var childStyle = _this.state.childStyle;
|
|
244
|
+
var animation = _this.state.animation;
|
|
245
|
+
|
|
246
|
+
if (_this.props.animType === 'x') {
|
|
247
|
+
// 懒得写现在没用。。。做成组件后加
|
|
248
|
+
childStyle[_this.index].left = _this.mouseXY.x - _this.mouseXY.startX + _this.mouseXY.left;
|
|
249
|
+
} else {
|
|
250
|
+
childStyle[_this.index].top = _this.mouseXY.y - _this.mouseXY.startY + _this.mouseXY.top;
|
|
251
|
+
_this.swapIndex = childStyle[_this.index].top < _this.childStyle[_this.index].top ? 0 : _this.index;
|
|
252
|
+
_this.swapIndex = childStyle[_this.index].top > _this.childStyle[_this.index].top + _this.childStyle[_this.index].height ? childStyle.length - 1 : _this.swapIndex;
|
|
253
|
+
|
|
254
|
+
var top = childStyle[_this.index].top;
|
|
255
|
+
_this.childStyle.forEach(function (item, i) {
|
|
256
|
+
var cTop = item.top;
|
|
257
|
+
var cHeight = item.height + item.marginHeight;
|
|
258
|
+
if (top > cTop && top < cTop + cHeight) {
|
|
259
|
+
_this.swapIndex = i;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
animation = animation.map(function (item, i) {
|
|
263
|
+
// 到顶端
|
|
264
|
+
var height = _this.childStyle[_this.index].height;
|
|
265
|
+
if (_this.index < _this.swapIndex) {
|
|
266
|
+
if (i > _this.index && i <= _this.swapIndex && _this.swapIndex !== _this.index) {
|
|
267
|
+
var start = _this.index + 1;
|
|
268
|
+
var end = i;
|
|
269
|
+
height = 0;
|
|
270
|
+
_this.childStyle.slice(start, end).forEach(function (_item) {
|
|
271
|
+
height += _item.height + _item.marginHeight;
|
|
272
|
+
});
|
|
273
|
+
return { top: _this.childStyle[_this.index].top + height };
|
|
274
|
+
} else if ((i > _this.swapIndex || _this.swapIndex === _this.index) && i !== _this.index) {
|
|
275
|
+
return { top: _this.childStyle[i].top };
|
|
276
|
+
}
|
|
277
|
+
} else if (_this.index > _this.swapIndex) {
|
|
278
|
+
if (i < _this.index && i >= _this.swapIndex && _this.swapIndex !== _this.index) {
|
|
279
|
+
height = _this.childStyle[_this.index].height + _this.childStyle[_this.index].marginHeight;
|
|
280
|
+
return { top: _this.childStyle[i].top + height };
|
|
281
|
+
} else if ((i < _this.swapIndex || _this.swapIndex === _this.index) && i !== _this.index) {
|
|
282
|
+
return { top: _this.childStyle[i].top };
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (i !== _this.index) {
|
|
286
|
+
return { top: _this.childStyle[i].top };
|
|
287
|
+
}
|
|
288
|
+
if (item == null) {
|
|
289
|
+
return {};
|
|
290
|
+
}
|
|
291
|
+
return item;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
_this.setState({ childStyle: childStyle, animation: animation });
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
_this.getChildren = function (item, i) {
|
|
298
|
+
var onMouseDown = _this.onMouseDown.bind(_this, i);
|
|
299
|
+
var style = (0, _extends3.default)({}, _this.state.childStyle[i]);
|
|
300
|
+
return _react2.default.createElement(_rcTweenOne2.default, (0, _extends3.default)({}, item.props, {
|
|
301
|
+
onMouseDown: onMouseDown,
|
|
302
|
+
onTouchStart: onMouseDown,
|
|
303
|
+
style: (0, _extends3.default)({}, item.style, style),
|
|
304
|
+
key: item.key,
|
|
305
|
+
animation: _this.state.animation[i],
|
|
306
|
+
component: item.type
|
|
307
|
+
}));
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
_this.sortArray = function (_array, nextNum, num) {
|
|
311
|
+
var current = _array[num];
|
|
312
|
+
var array = _array.map(function (item) {
|
|
313
|
+
return item;
|
|
314
|
+
});
|
|
315
|
+
array.splice(num, 1);
|
|
316
|
+
array.splice(nextNum, 0, current);
|
|
317
|
+
return array;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
_this.state = {
|
|
321
|
+
children: _this.props.children,
|
|
322
|
+
style: {},
|
|
323
|
+
childStyle: [],
|
|
324
|
+
animation: []
|
|
325
|
+
};
|
|
326
|
+
_this.index = null;
|
|
327
|
+
_this.swapIndex = null;
|
|
328
|
+
_this.mouseXY = null;
|
|
329
|
+
_this.childStyle = [];
|
|
330
|
+
_this.children = [];
|
|
331
|
+
_this.isDrage = false;
|
|
332
|
+
return _this;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
(0, _createClass3.default)(ListSort, [{
|
|
336
|
+
key: 'componentDidMount',
|
|
337
|
+
value: function componentDidMount() {
|
|
338
|
+
this.dom = _reactDom2.default.findDOMNode(this);
|
|
339
|
+
|
|
340
|
+
if (window.addEventListener) {
|
|
341
|
+
window.addEventListener('mousemove', this.onMouseMove);
|
|
342
|
+
window.addEventListener('touchmove', this.onMouseMove);
|
|
343
|
+
window.addEventListener('mouseup', this.onMouseUp);
|
|
344
|
+
window.addEventListener('touchend', this.onMouseUp);
|
|
345
|
+
} else {
|
|
346
|
+
window.attachEvent('onmousemove', this.onMouseMove);
|
|
347
|
+
window.attachEvent('ontouchmove', this.onMouseMove);
|
|
348
|
+
window.attachEvent('onmouseup', this.onMouseUp);
|
|
349
|
+
window.attachEvent('ontouchend', this.onMouseUp);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}, {
|
|
353
|
+
key: 'UNSAFE_componentWillReceiveProps',
|
|
354
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
355
|
+
var currentChildren = this.state.children;
|
|
356
|
+
var nextChildren = nextProps.children;
|
|
357
|
+
var newChildren = mergeChildren(currentChildren, nextChildren);
|
|
358
|
+
this.setState({ children: newChildren });
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: 'componentWillUnmount',
|
|
362
|
+
value: function componentWillUnmount() {
|
|
363
|
+
if (window.addEventListener) {
|
|
364
|
+
window.removeEventListener('mousemove', this.onMouseMove);
|
|
365
|
+
window.removeEventListener('touchmove', this.onMouseMove);
|
|
366
|
+
window.removeEventListener('mouseup', this.onMouseUp);
|
|
367
|
+
window.removeEventListener('touchend', this.onMouseUp);
|
|
368
|
+
} else {
|
|
369
|
+
window.detachEvent('onmousemove', this.onMouseMove);
|
|
370
|
+
window.detachEvent('ontouchmove', this.onMouseMove);
|
|
371
|
+
window.detachEvent('onmouseup', this.onMouseUp);
|
|
372
|
+
window.detachEvent('ontouchend', this.onMouseUp);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}, {
|
|
376
|
+
key: 'render',
|
|
377
|
+
value: function render() {
|
|
378
|
+
var childrenToRender = toArrayChildren(this.state.children).map(this.getChildren);
|
|
379
|
+
var props = (0, _extends3.default)({}, this.props);
|
|
380
|
+
['component', 'animType', 'dragClassName', 'appearAnim', 'onEventChange'].forEach(function (key) {
|
|
381
|
+
return delete props[key];
|
|
382
|
+
});
|
|
383
|
+
if (this.props.appearAnim) {
|
|
384
|
+
return _react2.default.createElement(_rcQueueAnim2.default, (0, _extends3.default)({}, props, this.props.appearAnim, {
|
|
385
|
+
style: (0, _extends3.default)({}, this.state.style)
|
|
386
|
+
}), childrenToRender);
|
|
387
|
+
}
|
|
388
|
+
return _react2.default.createElement(this.props.component, (0, _extends3.default)({}, props, {
|
|
389
|
+
style: (0, _extends3.default)({}, this.state.style)
|
|
390
|
+
}), childrenToRender);
|
|
391
|
+
}
|
|
392
|
+
}]);
|
|
393
|
+
return ListSort;
|
|
394
|
+
}(_react2.default.Component);
|
|
395
|
+
|
|
396
|
+
ListSort.propTypes = {
|
|
397
|
+
component: _propTypes2.default.any,
|
|
398
|
+
children: _propTypes2.default.any,
|
|
399
|
+
animType: _propTypes2.default.string,
|
|
400
|
+
onChange: _propTypes2.default.any,
|
|
401
|
+
dragClassName: _propTypes2.default.string,
|
|
402
|
+
appearAnim: _propTypes2.default.object,
|
|
403
|
+
onEventChange: _propTypes2.default.any
|
|
404
|
+
};
|
|
405
|
+
ListSort.defaultProps = {
|
|
406
|
+
component: 'div',
|
|
407
|
+
animType: 'y',
|
|
408
|
+
onChange: function onChange() {},
|
|
409
|
+
onEventChange: function onEventChange() {}
|
|
410
|
+
};
|
|
411
|
+
exports.default = ListSort;
|