linkmore-design 1.0.37 → 1.0.40
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/dist/LmTable/demos/custom.d.ts +2 -0
- package/dist/LmTable/demos/tableSort.d.ts +2 -0
- package/dist/index.umd.js +1738 -25
- package/dist/index.umd.min.js +6 -14
- package/es/Button/style/style.css +4 -1
- package/es/CkFilter/style/style.css +2 -2
- package/es/CustomTableOption/index.js +5 -6
- package/es/LeftTable/style/style.css +1 -1
- package/es/LmSelect/GhostSelect.js +1 -1
- package/es/LmSelect/NormalSelect.js +1 -1
- package/es/LmSelect/useCheckboxOptions.js +1 -1
- package/es/LmTable/Table.js +85 -11
- package/es/LmTable/style/style.css +13 -0
- package/es/Radio/style/style.css +3 -4
- package/lib/Button/style/style.css +4 -1
- package/lib/CkFilter/style/style.css +2 -2
- package/lib/CustomTableOption/index.js +5 -6
- package/lib/LeftTable/style/style.css +1 -1
- package/lib/LmSelect/GhostSelect.js +1 -1
- package/lib/LmSelect/NormalSelect.js +1 -1
- package/lib/LmSelect/useCheckboxOptions.js +1 -1
- package/lib/LmTable/Table.js +85 -11
- package/lib/LmTable/style/style.css +13 -0
- package/lib/Radio/style/style.css +3 -4
- package/package.json +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -2238,6 +2238,19 @@
|
|
|
2238
2238
|
LoadingOutlined$1.displayName = 'LoadingOutlined';
|
|
2239
2239
|
var LoadingOutlined$2 = /*#__PURE__*/React.forwardRef(LoadingOutlined$1);
|
|
2240
2240
|
|
|
2241
|
+
// This icon file is generated automatically.
|
|
2242
|
+
var MenuOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z" } }] }, "name": "menu", "theme": "outlined" };
|
|
2243
|
+
|
|
2244
|
+
var MenuOutlined$1 = function MenuOutlined$1(props, ref) {
|
|
2245
|
+
return /*#__PURE__*/React.createElement(Icon, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2246
|
+
ref: ref,
|
|
2247
|
+
icon: MenuOutlined
|
|
2248
|
+
}));
|
|
2249
|
+
};
|
|
2250
|
+
|
|
2251
|
+
MenuOutlined$1.displayName = 'MenuOutlined';
|
|
2252
|
+
var MenuOutlined$2 = /*#__PURE__*/React.forwardRef(MenuOutlined$1);
|
|
2253
|
+
|
|
2241
2254
|
// This icon file is generated automatically.
|
|
2242
2255
|
var MessageOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z" } }] }, "name": "message", "theme": "outlined" };
|
|
2243
2256
|
|
|
@@ -56776,6 +56789,62 @@
|
|
|
56776
56789
|
return _extends$5.apply(this, arguments);
|
|
56777
56790
|
}
|
|
56778
56791
|
|
|
56792
|
+
function _objectSpread$7(target) {
|
|
56793
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
56794
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
56795
|
+
var ownKeys = Object.keys(source);
|
|
56796
|
+
|
|
56797
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
56798
|
+
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
56799
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
56800
|
+
}));
|
|
56801
|
+
}
|
|
56802
|
+
|
|
56803
|
+
ownKeys.forEach(function (key) {
|
|
56804
|
+
_defineProperty$1(target, key, source[key]);
|
|
56805
|
+
});
|
|
56806
|
+
}
|
|
56807
|
+
|
|
56808
|
+
return target;
|
|
56809
|
+
}
|
|
56810
|
+
|
|
56811
|
+
/**
|
|
56812
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
56813
|
+
*
|
|
56814
|
+
* This source code is licensed under the MIT license found in the
|
|
56815
|
+
* LICENSE file in the root directory of this source tree.
|
|
56816
|
+
*/
|
|
56817
|
+
|
|
56818
|
+
var invariant = function(condition, format, a, b, c, d, e, f) {
|
|
56819
|
+
{
|
|
56820
|
+
if (format === undefined) {
|
|
56821
|
+
throw new Error('invariant requires an error message argument');
|
|
56822
|
+
}
|
|
56823
|
+
}
|
|
56824
|
+
|
|
56825
|
+
if (!condition) {
|
|
56826
|
+
var error;
|
|
56827
|
+
if (format === undefined) {
|
|
56828
|
+
error = new Error(
|
|
56829
|
+
'Minified exception occurred; use the non-minified dev environment ' +
|
|
56830
|
+
'for the full error message and additional helpful warnings.'
|
|
56831
|
+
);
|
|
56832
|
+
} else {
|
|
56833
|
+
var args = [a, b, c, d, e, f];
|
|
56834
|
+
var argIndex = 0;
|
|
56835
|
+
error = new Error(
|
|
56836
|
+
format.replace(/%s/g, function() { return args[argIndex++]; })
|
|
56837
|
+
);
|
|
56838
|
+
error.name = 'Invariant Violation';
|
|
56839
|
+
}
|
|
56840
|
+
|
|
56841
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
56842
|
+
throw error;
|
|
56843
|
+
}
|
|
56844
|
+
};
|
|
56845
|
+
|
|
56846
|
+
var invariant_1 = invariant;
|
|
56847
|
+
|
|
56779
56848
|
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
56780
56849
|
|
|
56781
56850
|
|
|
@@ -57766,6 +57835,1583 @@
|
|
|
57766
57835
|
}
|
|
57767
57836
|
});
|
|
57768
57837
|
|
|
57838
|
+
var Manager = function () {
|
|
57839
|
+
function Manager() {
|
|
57840
|
+
_classCallCheck(this, Manager);
|
|
57841
|
+
|
|
57842
|
+
_defineProperty$1(this, "refs", {});
|
|
57843
|
+
}
|
|
57844
|
+
|
|
57845
|
+
_createClass(Manager, [{
|
|
57846
|
+
key: "add",
|
|
57847
|
+
value: function add(collection, ref) {
|
|
57848
|
+
if (!this.refs[collection]) {
|
|
57849
|
+
this.refs[collection] = [];
|
|
57850
|
+
}
|
|
57851
|
+
|
|
57852
|
+
this.refs[collection].push(ref);
|
|
57853
|
+
}
|
|
57854
|
+
}, {
|
|
57855
|
+
key: "remove",
|
|
57856
|
+
value: function remove(collection, ref) {
|
|
57857
|
+
var index = this.getIndex(collection, ref);
|
|
57858
|
+
|
|
57859
|
+
if (index !== -1) {
|
|
57860
|
+
this.refs[collection].splice(index, 1);
|
|
57861
|
+
}
|
|
57862
|
+
}
|
|
57863
|
+
}, {
|
|
57864
|
+
key: "isActive",
|
|
57865
|
+
value: function isActive() {
|
|
57866
|
+
return this.active;
|
|
57867
|
+
}
|
|
57868
|
+
}, {
|
|
57869
|
+
key: "getActive",
|
|
57870
|
+
value: function getActive() {
|
|
57871
|
+
var _this = this;
|
|
57872
|
+
|
|
57873
|
+
return this.refs[this.active.collection].find(function (_ref) {
|
|
57874
|
+
var node = _ref.node;
|
|
57875
|
+
return node.sortableInfo.index == _this.active.index;
|
|
57876
|
+
});
|
|
57877
|
+
}
|
|
57878
|
+
}, {
|
|
57879
|
+
key: "getIndex",
|
|
57880
|
+
value: function getIndex(collection, ref) {
|
|
57881
|
+
return this.refs[collection].indexOf(ref);
|
|
57882
|
+
}
|
|
57883
|
+
}, {
|
|
57884
|
+
key: "getOrderedRefs",
|
|
57885
|
+
value: function getOrderedRefs() {
|
|
57886
|
+
var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.active.collection;
|
|
57887
|
+
return this.refs[collection].sort(sortByIndex);
|
|
57888
|
+
}
|
|
57889
|
+
}]);
|
|
57890
|
+
|
|
57891
|
+
return Manager;
|
|
57892
|
+
}();
|
|
57893
|
+
|
|
57894
|
+
function sortByIndex(_ref2, _ref3) {
|
|
57895
|
+
var index1 = _ref2.node.sortableInfo.index;
|
|
57896
|
+
var index2 = _ref3.node.sortableInfo.index;
|
|
57897
|
+
return index1 - index2;
|
|
57898
|
+
}
|
|
57899
|
+
function omit$1(obj, keysToOmit) {
|
|
57900
|
+
return Object.keys(obj).reduce(function (acc, key) {
|
|
57901
|
+
if (keysToOmit.indexOf(key) === -1) {
|
|
57902
|
+
acc[key] = obj[key];
|
|
57903
|
+
}
|
|
57904
|
+
|
|
57905
|
+
return acc;
|
|
57906
|
+
}, {});
|
|
57907
|
+
}
|
|
57908
|
+
var events$1 = {
|
|
57909
|
+
end: ['touchend', 'touchcancel', 'mouseup'],
|
|
57910
|
+
move: ['touchmove', 'mousemove'],
|
|
57911
|
+
start: ['touchstart', 'mousedown']
|
|
57912
|
+
};
|
|
57913
|
+
var vendorPrefix = function () {
|
|
57914
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
|
57915
|
+
return '';
|
|
57916
|
+
}
|
|
57917
|
+
|
|
57918
|
+
var styles = window.getComputedStyle(document.documentElement, '') || ['-moz-hidden-iframe'];
|
|
57919
|
+
var pre = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || styles.OLink === '' && ['', 'o'])[1];
|
|
57920
|
+
|
|
57921
|
+
switch (pre) {
|
|
57922
|
+
case 'ms':
|
|
57923
|
+
return 'ms';
|
|
57924
|
+
|
|
57925
|
+
default:
|
|
57926
|
+
return pre && pre.length ? pre[0].toUpperCase() + pre.substr(1) : '';
|
|
57927
|
+
}
|
|
57928
|
+
}();
|
|
57929
|
+
function setInlineStyles(node, styles) {
|
|
57930
|
+
Object.keys(styles).forEach(function (key) {
|
|
57931
|
+
node.style[key] = styles[key];
|
|
57932
|
+
});
|
|
57933
|
+
}
|
|
57934
|
+
function setTranslate3d(node, translate) {
|
|
57935
|
+
node.style["".concat(vendorPrefix, "Transform")] = translate == null ? '' : "translate3d(".concat(translate.x, "px,").concat(translate.y, "px,0)");
|
|
57936
|
+
}
|
|
57937
|
+
function setTransitionDuration(node, duration) {
|
|
57938
|
+
node.style["".concat(vendorPrefix, "TransitionDuration")] = duration == null ? '' : "".concat(duration, "ms");
|
|
57939
|
+
}
|
|
57940
|
+
function closest(el, fn) {
|
|
57941
|
+
while (el) {
|
|
57942
|
+
if (fn(el)) {
|
|
57943
|
+
return el;
|
|
57944
|
+
}
|
|
57945
|
+
|
|
57946
|
+
el = el.parentNode;
|
|
57947
|
+
}
|
|
57948
|
+
|
|
57949
|
+
return null;
|
|
57950
|
+
}
|
|
57951
|
+
function limit(min, max, value) {
|
|
57952
|
+
return Math.max(min, Math.min(value, max));
|
|
57953
|
+
}
|
|
57954
|
+
|
|
57955
|
+
function getPixelValue(stringValue) {
|
|
57956
|
+
if (stringValue.substr(-2) === 'px') {
|
|
57957
|
+
return parseFloat(stringValue);
|
|
57958
|
+
}
|
|
57959
|
+
|
|
57960
|
+
return 0;
|
|
57961
|
+
}
|
|
57962
|
+
|
|
57963
|
+
function getElementMargin(element) {
|
|
57964
|
+
var style = window.getComputedStyle(element);
|
|
57965
|
+
return {
|
|
57966
|
+
bottom: getPixelValue(style.marginBottom),
|
|
57967
|
+
left: getPixelValue(style.marginLeft),
|
|
57968
|
+
right: getPixelValue(style.marginRight),
|
|
57969
|
+
top: getPixelValue(style.marginTop)
|
|
57970
|
+
};
|
|
57971
|
+
}
|
|
57972
|
+
function provideDisplayName(prefix, Component$$1) {
|
|
57973
|
+
var componentName = Component$$1.displayName || Component$$1.name;
|
|
57974
|
+
return componentName ? "".concat(prefix, "(").concat(componentName, ")") : prefix;
|
|
57975
|
+
}
|
|
57976
|
+
function getScrollAdjustedBoundingClientRect(node, scrollDelta) {
|
|
57977
|
+
var boundingClientRect = node.getBoundingClientRect();
|
|
57978
|
+
return {
|
|
57979
|
+
top: boundingClientRect.top + scrollDelta.top,
|
|
57980
|
+
left: boundingClientRect.left + scrollDelta.left
|
|
57981
|
+
};
|
|
57982
|
+
}
|
|
57983
|
+
function getPosition(event) {
|
|
57984
|
+
if (event.touches && event.touches.length) {
|
|
57985
|
+
return {
|
|
57986
|
+
x: event.touches[0].pageX,
|
|
57987
|
+
y: event.touches[0].pageY
|
|
57988
|
+
};
|
|
57989
|
+
} else if (event.changedTouches && event.changedTouches.length) {
|
|
57990
|
+
return {
|
|
57991
|
+
x: event.changedTouches[0].pageX,
|
|
57992
|
+
y: event.changedTouches[0].pageY
|
|
57993
|
+
};
|
|
57994
|
+
} else {
|
|
57995
|
+
return {
|
|
57996
|
+
x: event.pageX,
|
|
57997
|
+
y: event.pageY
|
|
57998
|
+
};
|
|
57999
|
+
}
|
|
58000
|
+
}
|
|
58001
|
+
function isTouchEvent$1(event) {
|
|
58002
|
+
return event.touches && event.touches.length || event.changedTouches && event.changedTouches.length;
|
|
58003
|
+
}
|
|
58004
|
+
function getEdgeOffset(node, parent) {
|
|
58005
|
+
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
58006
|
+
left: 0,
|
|
58007
|
+
top: 0
|
|
58008
|
+
};
|
|
58009
|
+
|
|
58010
|
+
if (!node) {
|
|
58011
|
+
return undefined;
|
|
58012
|
+
}
|
|
58013
|
+
|
|
58014
|
+
var nodeOffset = {
|
|
58015
|
+
left: offset.left + node.offsetLeft,
|
|
58016
|
+
top: offset.top + node.offsetTop
|
|
58017
|
+
};
|
|
58018
|
+
|
|
58019
|
+
if (node.parentNode === parent) {
|
|
58020
|
+
return nodeOffset;
|
|
58021
|
+
}
|
|
58022
|
+
|
|
58023
|
+
return getEdgeOffset(node.parentNode, parent, nodeOffset);
|
|
58024
|
+
}
|
|
58025
|
+
function getTargetIndex(newIndex, prevIndex, oldIndex) {
|
|
58026
|
+
if (newIndex < oldIndex && newIndex > prevIndex) {
|
|
58027
|
+
return newIndex - 1;
|
|
58028
|
+
} else if (newIndex > oldIndex && newIndex < prevIndex) {
|
|
58029
|
+
return newIndex + 1;
|
|
58030
|
+
} else {
|
|
58031
|
+
return newIndex;
|
|
58032
|
+
}
|
|
58033
|
+
}
|
|
58034
|
+
function getLockPixelOffset(_ref) {
|
|
58035
|
+
var lockOffset = _ref.lockOffset,
|
|
58036
|
+
width = _ref.width,
|
|
58037
|
+
height = _ref.height;
|
|
58038
|
+
var offsetX = lockOffset;
|
|
58039
|
+
var offsetY = lockOffset;
|
|
58040
|
+
var unit = 'px';
|
|
58041
|
+
|
|
58042
|
+
if (typeof lockOffset === 'string') {
|
|
58043
|
+
var match = /^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(lockOffset);
|
|
58044
|
+
invariant_1(match !== null, 'lockOffset value should be a number or a string of a ' + 'number followed by "px" or "%". Given %s', lockOffset);
|
|
58045
|
+
offsetX = parseFloat(lockOffset);
|
|
58046
|
+
offsetY = parseFloat(lockOffset);
|
|
58047
|
+
unit = match[1];
|
|
58048
|
+
}
|
|
58049
|
+
|
|
58050
|
+
invariant_1(isFinite(offsetX) && isFinite(offsetY), 'lockOffset value should be a finite. Given %s', lockOffset);
|
|
58051
|
+
|
|
58052
|
+
if (unit === '%') {
|
|
58053
|
+
offsetX = offsetX * width / 100;
|
|
58054
|
+
offsetY = offsetY * height / 100;
|
|
58055
|
+
}
|
|
58056
|
+
|
|
58057
|
+
return {
|
|
58058
|
+
x: offsetX,
|
|
58059
|
+
y: offsetY
|
|
58060
|
+
};
|
|
58061
|
+
}
|
|
58062
|
+
function getLockPixelOffsets(_ref2) {
|
|
58063
|
+
var height = _ref2.height,
|
|
58064
|
+
width = _ref2.width,
|
|
58065
|
+
lockOffset = _ref2.lockOffset;
|
|
58066
|
+
var offsets = Array.isArray(lockOffset) ? lockOffset : [lockOffset, lockOffset];
|
|
58067
|
+
invariant_1(offsets.length === 2, 'lockOffset prop of SortableContainer should be a single ' + 'value or an array of exactly two values. Given %s', lockOffset);
|
|
58068
|
+
|
|
58069
|
+
var _offsets = _slicedToArray$1(offsets, 2),
|
|
58070
|
+
minLockOffset = _offsets[0],
|
|
58071
|
+
maxLockOffset = _offsets[1];
|
|
58072
|
+
|
|
58073
|
+
return [getLockPixelOffset({
|
|
58074
|
+
height: height,
|
|
58075
|
+
lockOffset: minLockOffset,
|
|
58076
|
+
width: width
|
|
58077
|
+
}), getLockPixelOffset({
|
|
58078
|
+
height: height,
|
|
58079
|
+
lockOffset: maxLockOffset,
|
|
58080
|
+
width: width
|
|
58081
|
+
})];
|
|
58082
|
+
}
|
|
58083
|
+
|
|
58084
|
+
function isScrollable$1(el) {
|
|
58085
|
+
var computedStyle = window.getComputedStyle(el);
|
|
58086
|
+
var overflowRegex = /(auto|scroll)/;
|
|
58087
|
+
var properties = ['overflow', 'overflowX', 'overflowY'];
|
|
58088
|
+
return properties.find(function (property) {
|
|
58089
|
+
return overflowRegex.test(computedStyle[property]);
|
|
58090
|
+
});
|
|
58091
|
+
}
|
|
58092
|
+
|
|
58093
|
+
function getScrollingParent(el) {
|
|
58094
|
+
if (!(el instanceof HTMLElement)) {
|
|
58095
|
+
return null;
|
|
58096
|
+
} else if (isScrollable$1(el)) {
|
|
58097
|
+
return el;
|
|
58098
|
+
} else {
|
|
58099
|
+
return getScrollingParent(el.parentNode);
|
|
58100
|
+
}
|
|
58101
|
+
}
|
|
58102
|
+
function getContainerGridGap(element) {
|
|
58103
|
+
var style = window.getComputedStyle(element);
|
|
58104
|
+
|
|
58105
|
+
if (style.display === 'grid') {
|
|
58106
|
+
return {
|
|
58107
|
+
x: getPixelValue(style.gridColumnGap),
|
|
58108
|
+
y: getPixelValue(style.gridRowGap)
|
|
58109
|
+
};
|
|
58110
|
+
}
|
|
58111
|
+
|
|
58112
|
+
return {
|
|
58113
|
+
x: 0,
|
|
58114
|
+
y: 0
|
|
58115
|
+
};
|
|
58116
|
+
}
|
|
58117
|
+
var KEYCODE = {
|
|
58118
|
+
TAB: 9,
|
|
58119
|
+
ESC: 27,
|
|
58120
|
+
SPACE: 32,
|
|
58121
|
+
LEFT: 37,
|
|
58122
|
+
UP: 38,
|
|
58123
|
+
RIGHT: 39,
|
|
58124
|
+
DOWN: 40
|
|
58125
|
+
};
|
|
58126
|
+
var NodeType = {
|
|
58127
|
+
Anchor: 'A',
|
|
58128
|
+
Button: 'BUTTON',
|
|
58129
|
+
Canvas: 'CANVAS',
|
|
58130
|
+
Input: 'INPUT',
|
|
58131
|
+
Option: 'OPTION',
|
|
58132
|
+
Textarea: 'TEXTAREA',
|
|
58133
|
+
Select: 'SELECT'
|
|
58134
|
+
};
|
|
58135
|
+
function cloneNode(node) {
|
|
58136
|
+
var selector = 'input, textarea, select, canvas, [contenteditable]';
|
|
58137
|
+
var fields = node.querySelectorAll(selector);
|
|
58138
|
+
var clonedNode = node.cloneNode(true);
|
|
58139
|
+
|
|
58140
|
+
var clonedFields = _toConsumableArray$1(clonedNode.querySelectorAll(selector));
|
|
58141
|
+
|
|
58142
|
+
clonedFields.forEach(function (field, i) {
|
|
58143
|
+
if (field.type !== 'file') {
|
|
58144
|
+
field.value = fields[i].value;
|
|
58145
|
+
}
|
|
58146
|
+
|
|
58147
|
+
if (field.type === 'radio' && field.name) {
|
|
58148
|
+
field.name = "__sortableClone__".concat(field.name);
|
|
58149
|
+
}
|
|
58150
|
+
|
|
58151
|
+
if (field.tagName === NodeType.Canvas && fields[i].width > 0 && fields[i].height > 0) {
|
|
58152
|
+
var destCtx = field.getContext('2d');
|
|
58153
|
+
destCtx.drawImage(fields[i], 0, 0);
|
|
58154
|
+
}
|
|
58155
|
+
});
|
|
58156
|
+
return clonedNode;
|
|
58157
|
+
}
|
|
58158
|
+
|
|
58159
|
+
function sortableHandle(WrappedComponent) {
|
|
58160
|
+
var _class, _temp;
|
|
58161
|
+
|
|
58162
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
58163
|
+
withRef: false
|
|
58164
|
+
};
|
|
58165
|
+
return _temp = _class = function (_React$Component) {
|
|
58166
|
+
_inherits(WithSortableHandle, _React$Component);
|
|
58167
|
+
|
|
58168
|
+
function WithSortableHandle() {
|
|
58169
|
+
var _getPrototypeOf2;
|
|
58170
|
+
|
|
58171
|
+
var _this;
|
|
58172
|
+
|
|
58173
|
+
_classCallCheck(this, WithSortableHandle);
|
|
58174
|
+
|
|
58175
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
58176
|
+
args[_key] = arguments[_key];
|
|
58177
|
+
}
|
|
58178
|
+
|
|
58179
|
+
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(WithSortableHandle)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
58180
|
+
|
|
58181
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "wrappedInstance", React.createRef());
|
|
58182
|
+
|
|
58183
|
+
return _this;
|
|
58184
|
+
}
|
|
58185
|
+
|
|
58186
|
+
_createClass(WithSortableHandle, [{
|
|
58187
|
+
key: "componentDidMount",
|
|
58188
|
+
value: function componentDidMount() {
|
|
58189
|
+
var node = require$$2.findDOMNode(this);
|
|
58190
|
+
node.sortableHandle = true;
|
|
58191
|
+
}
|
|
58192
|
+
}, {
|
|
58193
|
+
key: "getWrappedInstance",
|
|
58194
|
+
value: function getWrappedInstance() {
|
|
58195
|
+
invariant_1(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call');
|
|
58196
|
+
return this.wrappedInstance.current;
|
|
58197
|
+
}
|
|
58198
|
+
}, {
|
|
58199
|
+
key: "render",
|
|
58200
|
+
value: function render() {
|
|
58201
|
+
var ref = config.withRef ? this.wrappedInstance : null;
|
|
58202
|
+
return React.createElement(WrappedComponent, _extends$5({
|
|
58203
|
+
ref: ref
|
|
58204
|
+
}, this.props));
|
|
58205
|
+
}
|
|
58206
|
+
}]);
|
|
58207
|
+
|
|
58208
|
+
return WithSortableHandle;
|
|
58209
|
+
}(React.Component), _defineProperty$1(_class, "displayName", provideDisplayName('sortableHandle', WrappedComponent)), _temp;
|
|
58210
|
+
}
|
|
58211
|
+
function isSortableHandle(node) {
|
|
58212
|
+
return node.sortableHandle != null;
|
|
58213
|
+
}
|
|
58214
|
+
|
|
58215
|
+
var AutoScroller = function () {
|
|
58216
|
+
function AutoScroller(container, onScrollCallback) {
|
|
58217
|
+
_classCallCheck(this, AutoScroller);
|
|
58218
|
+
|
|
58219
|
+
this.container = container;
|
|
58220
|
+
this.onScrollCallback = onScrollCallback;
|
|
58221
|
+
}
|
|
58222
|
+
|
|
58223
|
+
_createClass(AutoScroller, [{
|
|
58224
|
+
key: "clear",
|
|
58225
|
+
value: function clear() {
|
|
58226
|
+
if (this.interval == null) {
|
|
58227
|
+
return;
|
|
58228
|
+
}
|
|
58229
|
+
|
|
58230
|
+
clearInterval(this.interval);
|
|
58231
|
+
this.interval = null;
|
|
58232
|
+
}
|
|
58233
|
+
}, {
|
|
58234
|
+
key: "update",
|
|
58235
|
+
value: function update(_ref) {
|
|
58236
|
+
var _this = this;
|
|
58237
|
+
|
|
58238
|
+
var translate = _ref.translate,
|
|
58239
|
+
minTranslate = _ref.minTranslate,
|
|
58240
|
+
maxTranslate = _ref.maxTranslate,
|
|
58241
|
+
width = _ref.width,
|
|
58242
|
+
height = _ref.height;
|
|
58243
|
+
var direction = {
|
|
58244
|
+
x: 0,
|
|
58245
|
+
y: 0
|
|
58246
|
+
};
|
|
58247
|
+
var speed = {
|
|
58248
|
+
x: 1,
|
|
58249
|
+
y: 1
|
|
58250
|
+
};
|
|
58251
|
+
var acceleration = {
|
|
58252
|
+
x: 10,
|
|
58253
|
+
y: 10
|
|
58254
|
+
};
|
|
58255
|
+
var _this$container = this.container,
|
|
58256
|
+
scrollTop = _this$container.scrollTop,
|
|
58257
|
+
scrollLeft = _this$container.scrollLeft,
|
|
58258
|
+
scrollHeight = _this$container.scrollHeight,
|
|
58259
|
+
scrollWidth = _this$container.scrollWidth,
|
|
58260
|
+
clientHeight = _this$container.clientHeight,
|
|
58261
|
+
clientWidth = _this$container.clientWidth;
|
|
58262
|
+
var isTop = scrollTop === 0;
|
|
58263
|
+
var isBottom = scrollHeight - scrollTop - clientHeight === 0;
|
|
58264
|
+
var isLeft = scrollLeft === 0;
|
|
58265
|
+
var isRight = scrollWidth - scrollLeft - clientWidth === 0;
|
|
58266
|
+
|
|
58267
|
+
if (translate.y >= maxTranslate.y - height / 2 && !isBottom) {
|
|
58268
|
+
direction.y = 1;
|
|
58269
|
+
speed.y = acceleration.y * Math.abs((maxTranslate.y - height / 2 - translate.y) / height);
|
|
58270
|
+
} else if (translate.x >= maxTranslate.x - width / 2 && !isRight) {
|
|
58271
|
+
direction.x = 1;
|
|
58272
|
+
speed.x = acceleration.x * Math.abs((maxTranslate.x - width / 2 - translate.x) / width);
|
|
58273
|
+
} else if (translate.y <= minTranslate.y + height / 2 && !isTop) {
|
|
58274
|
+
direction.y = -1;
|
|
58275
|
+
speed.y = acceleration.y * Math.abs((translate.y - height / 2 - minTranslate.y) / height);
|
|
58276
|
+
} else if (translate.x <= minTranslate.x + width / 2 && !isLeft) {
|
|
58277
|
+
direction.x = -1;
|
|
58278
|
+
speed.x = acceleration.x * Math.abs((translate.x - width / 2 - minTranslate.x) / width);
|
|
58279
|
+
}
|
|
58280
|
+
|
|
58281
|
+
if (this.interval) {
|
|
58282
|
+
this.clear();
|
|
58283
|
+
this.isAutoScrolling = false;
|
|
58284
|
+
}
|
|
58285
|
+
|
|
58286
|
+
if (direction.x !== 0 || direction.y !== 0) {
|
|
58287
|
+
this.interval = setInterval(function () {
|
|
58288
|
+
_this.isAutoScrolling = true;
|
|
58289
|
+
var offset = {
|
|
58290
|
+
left: speed.x * direction.x,
|
|
58291
|
+
top: speed.y * direction.y
|
|
58292
|
+
};
|
|
58293
|
+
_this.container.scrollTop += offset.top;
|
|
58294
|
+
_this.container.scrollLeft += offset.left;
|
|
58295
|
+
|
|
58296
|
+
_this.onScrollCallback(offset);
|
|
58297
|
+
}, 5);
|
|
58298
|
+
}
|
|
58299
|
+
}
|
|
58300
|
+
}]);
|
|
58301
|
+
|
|
58302
|
+
return AutoScroller;
|
|
58303
|
+
}();
|
|
58304
|
+
|
|
58305
|
+
function defaultGetHelperDimensions(_ref) {
|
|
58306
|
+
var node = _ref.node;
|
|
58307
|
+
return {
|
|
58308
|
+
height: node.offsetHeight,
|
|
58309
|
+
width: node.offsetWidth
|
|
58310
|
+
};
|
|
58311
|
+
}
|
|
58312
|
+
|
|
58313
|
+
function defaultShouldCancelStart(event) {
|
|
58314
|
+
var interactiveElements = [NodeType.Input, NodeType.Textarea, NodeType.Select, NodeType.Option, NodeType.Button];
|
|
58315
|
+
|
|
58316
|
+
if (interactiveElements.indexOf(event.target.tagName) !== -1) {
|
|
58317
|
+
return true;
|
|
58318
|
+
}
|
|
58319
|
+
|
|
58320
|
+
if (closest(event.target, function (el) {
|
|
58321
|
+
return el.contentEditable === 'true';
|
|
58322
|
+
})) {
|
|
58323
|
+
return true;
|
|
58324
|
+
}
|
|
58325
|
+
|
|
58326
|
+
return false;
|
|
58327
|
+
}
|
|
58328
|
+
|
|
58329
|
+
var propTypes$1 = {
|
|
58330
|
+
axis: propTypes.oneOf(['x', 'y', 'xy']),
|
|
58331
|
+
contentWindow: propTypes.any,
|
|
58332
|
+
disableAutoscroll: propTypes.bool,
|
|
58333
|
+
distance: propTypes.number,
|
|
58334
|
+
getContainer: propTypes.func,
|
|
58335
|
+
getHelperDimensions: propTypes.func,
|
|
58336
|
+
helperClass: propTypes.string,
|
|
58337
|
+
helperContainer: propTypes.oneOfType([propTypes.func, typeof HTMLElement === 'undefined' ? propTypes.any : propTypes.instanceOf(HTMLElement)]),
|
|
58338
|
+
hideSortableGhost: propTypes.bool,
|
|
58339
|
+
keyboardSortingTransitionDuration: propTypes.number,
|
|
58340
|
+
lockAxis: propTypes.string,
|
|
58341
|
+
lockOffset: propTypes.oneOfType([propTypes.number, propTypes.string, propTypes.arrayOf(propTypes.oneOfType([propTypes.number, propTypes.string]))]),
|
|
58342
|
+
lockToContainerEdges: propTypes.bool,
|
|
58343
|
+
onSortEnd: propTypes.func,
|
|
58344
|
+
onSortMove: propTypes.func,
|
|
58345
|
+
onSortOver: propTypes.func,
|
|
58346
|
+
onSortStart: propTypes.func,
|
|
58347
|
+
pressDelay: propTypes.number,
|
|
58348
|
+
pressThreshold: propTypes.number,
|
|
58349
|
+
keyCodes: propTypes.shape({
|
|
58350
|
+
lift: propTypes.arrayOf(propTypes.number),
|
|
58351
|
+
drop: propTypes.arrayOf(propTypes.number),
|
|
58352
|
+
cancel: propTypes.arrayOf(propTypes.number),
|
|
58353
|
+
up: propTypes.arrayOf(propTypes.number),
|
|
58354
|
+
down: propTypes.arrayOf(propTypes.number)
|
|
58355
|
+
}),
|
|
58356
|
+
shouldCancelStart: propTypes.func,
|
|
58357
|
+
transitionDuration: propTypes.number,
|
|
58358
|
+
updateBeforeSortStart: propTypes.func,
|
|
58359
|
+
useDragHandle: propTypes.bool,
|
|
58360
|
+
useWindowAsScrollContainer: propTypes.bool
|
|
58361
|
+
};
|
|
58362
|
+
var defaultKeyCodes = {
|
|
58363
|
+
lift: [KEYCODE.SPACE],
|
|
58364
|
+
drop: [KEYCODE.SPACE],
|
|
58365
|
+
cancel: [KEYCODE.ESC],
|
|
58366
|
+
up: [KEYCODE.UP, KEYCODE.LEFT],
|
|
58367
|
+
down: [KEYCODE.DOWN, KEYCODE.RIGHT]
|
|
58368
|
+
};
|
|
58369
|
+
var defaultProps = {
|
|
58370
|
+
axis: 'y',
|
|
58371
|
+
disableAutoscroll: false,
|
|
58372
|
+
distance: 0,
|
|
58373
|
+
getHelperDimensions: defaultGetHelperDimensions,
|
|
58374
|
+
hideSortableGhost: true,
|
|
58375
|
+
lockOffset: '50%',
|
|
58376
|
+
lockToContainerEdges: false,
|
|
58377
|
+
pressDelay: 0,
|
|
58378
|
+
pressThreshold: 5,
|
|
58379
|
+
keyCodes: defaultKeyCodes,
|
|
58380
|
+
shouldCancelStart: defaultShouldCancelStart,
|
|
58381
|
+
transitionDuration: 300,
|
|
58382
|
+
useWindowAsScrollContainer: false
|
|
58383
|
+
};
|
|
58384
|
+
var omittedProps = Object.keys(propTypes$1);
|
|
58385
|
+
function validateProps(props) {
|
|
58386
|
+
invariant_1(!(props.distance && props.pressDelay), 'Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.');
|
|
58387
|
+
}
|
|
58388
|
+
|
|
58389
|
+
function _finallyRethrows(body, finalizer) {
|
|
58390
|
+
try {
|
|
58391
|
+
var result = body();
|
|
58392
|
+
} catch (e) {
|
|
58393
|
+
return finalizer(true, e);
|
|
58394
|
+
}
|
|
58395
|
+
|
|
58396
|
+
if (result && result.then) {
|
|
58397
|
+
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
|
58398
|
+
}
|
|
58399
|
+
|
|
58400
|
+
return finalizer(false, value);
|
|
58401
|
+
}
|
|
58402
|
+
var SortableContext$1 = React.createContext({
|
|
58403
|
+
manager: {}
|
|
58404
|
+
});
|
|
58405
|
+
function sortableContainer(WrappedComponent) {
|
|
58406
|
+
var _class, _temp;
|
|
58407
|
+
|
|
58408
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
58409
|
+
withRef: false
|
|
58410
|
+
};
|
|
58411
|
+
return _temp = _class = function (_React$Component) {
|
|
58412
|
+
_inherits(WithSortableContainer, _React$Component);
|
|
58413
|
+
|
|
58414
|
+
function WithSortableContainer(props) {
|
|
58415
|
+
var _this;
|
|
58416
|
+
|
|
58417
|
+
_classCallCheck(this, WithSortableContainer);
|
|
58418
|
+
|
|
58419
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(WithSortableContainer).call(this, props));
|
|
58420
|
+
|
|
58421
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "state", {});
|
|
58422
|
+
|
|
58423
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleStart", function (event) {
|
|
58424
|
+
var _this$props = _this.props,
|
|
58425
|
+
distance = _this$props.distance,
|
|
58426
|
+
shouldCancelStart = _this$props.shouldCancelStart;
|
|
58427
|
+
|
|
58428
|
+
if (event.button === 2 || shouldCancelStart(event)) {
|
|
58429
|
+
return;
|
|
58430
|
+
}
|
|
58431
|
+
|
|
58432
|
+
_this.touched = true;
|
|
58433
|
+
_this.position = getPosition(event);
|
|
58434
|
+
var node = closest(event.target, function (el) {
|
|
58435
|
+
return el.sortableInfo != null;
|
|
58436
|
+
});
|
|
58437
|
+
|
|
58438
|
+
if (node && node.sortableInfo && _this.nodeIsChild(node) && !_this.state.sorting) {
|
|
58439
|
+
var useDragHandle = _this.props.useDragHandle;
|
|
58440
|
+
var _node$sortableInfo = node.sortableInfo,
|
|
58441
|
+
index = _node$sortableInfo.index,
|
|
58442
|
+
collection = _node$sortableInfo.collection,
|
|
58443
|
+
disabled = _node$sortableInfo.disabled;
|
|
58444
|
+
|
|
58445
|
+
if (disabled) {
|
|
58446
|
+
return;
|
|
58447
|
+
}
|
|
58448
|
+
|
|
58449
|
+
if (useDragHandle && !closest(event.target, isSortableHandle)) {
|
|
58450
|
+
return;
|
|
58451
|
+
}
|
|
58452
|
+
|
|
58453
|
+
_this.manager.active = {
|
|
58454
|
+
collection: collection,
|
|
58455
|
+
index: index
|
|
58456
|
+
};
|
|
58457
|
+
|
|
58458
|
+
if (!isTouchEvent$1(event) && event.target.tagName === NodeType.Anchor) {
|
|
58459
|
+
event.preventDefault();
|
|
58460
|
+
}
|
|
58461
|
+
|
|
58462
|
+
if (!distance) {
|
|
58463
|
+
if (_this.props.pressDelay === 0) {
|
|
58464
|
+
_this.handlePress(event);
|
|
58465
|
+
} else {
|
|
58466
|
+
_this.pressTimer = setTimeout(function () {
|
|
58467
|
+
return _this.handlePress(event);
|
|
58468
|
+
}, _this.props.pressDelay);
|
|
58469
|
+
}
|
|
58470
|
+
}
|
|
58471
|
+
}
|
|
58472
|
+
});
|
|
58473
|
+
|
|
58474
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "nodeIsChild", function (node) {
|
|
58475
|
+
return node.sortableInfo.manager === _this.manager;
|
|
58476
|
+
});
|
|
58477
|
+
|
|
58478
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleMove", function (event) {
|
|
58479
|
+
var _this$props2 = _this.props,
|
|
58480
|
+
distance = _this$props2.distance,
|
|
58481
|
+
pressThreshold = _this$props2.pressThreshold;
|
|
58482
|
+
|
|
58483
|
+
if (!_this.state.sorting && _this.touched && !_this._awaitingUpdateBeforeSortStart) {
|
|
58484
|
+
var position = getPosition(event);
|
|
58485
|
+
var delta = {
|
|
58486
|
+
x: _this.position.x - position.x,
|
|
58487
|
+
y: _this.position.y - position.y
|
|
58488
|
+
};
|
|
58489
|
+
var combinedDelta = Math.abs(delta.x) + Math.abs(delta.y);
|
|
58490
|
+
_this.delta = delta;
|
|
58491
|
+
|
|
58492
|
+
if (!distance && (!pressThreshold || combinedDelta >= pressThreshold)) {
|
|
58493
|
+
clearTimeout(_this.cancelTimer);
|
|
58494
|
+
_this.cancelTimer = setTimeout(_this.cancel, 0);
|
|
58495
|
+
} else if (distance && combinedDelta >= distance && _this.manager.isActive()) {
|
|
58496
|
+
_this.handlePress(event);
|
|
58497
|
+
}
|
|
58498
|
+
}
|
|
58499
|
+
});
|
|
58500
|
+
|
|
58501
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleEnd", function () {
|
|
58502
|
+
_this.touched = false;
|
|
58503
|
+
|
|
58504
|
+
_this.cancel();
|
|
58505
|
+
});
|
|
58506
|
+
|
|
58507
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "cancel", function () {
|
|
58508
|
+
var distance = _this.props.distance;
|
|
58509
|
+
var sorting = _this.state.sorting;
|
|
58510
|
+
|
|
58511
|
+
if (!sorting) {
|
|
58512
|
+
if (!distance) {
|
|
58513
|
+
clearTimeout(_this.pressTimer);
|
|
58514
|
+
}
|
|
58515
|
+
|
|
58516
|
+
_this.manager.active = null;
|
|
58517
|
+
}
|
|
58518
|
+
});
|
|
58519
|
+
|
|
58520
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handlePress", function (event) {
|
|
58521
|
+
try {
|
|
58522
|
+
var active = _this.manager.getActive();
|
|
58523
|
+
|
|
58524
|
+
var _temp6 = function () {
|
|
58525
|
+
if (active) {
|
|
58526
|
+
var _temp7 = function _temp7() {
|
|
58527
|
+
var index = _node.sortableInfo.index;
|
|
58528
|
+
var margin = getElementMargin(_node);
|
|
58529
|
+
var gridGap = getContainerGridGap(_this.container);
|
|
58530
|
+
|
|
58531
|
+
var containerBoundingRect = _this.scrollContainer.getBoundingClientRect();
|
|
58532
|
+
|
|
58533
|
+
var dimensions = _getHelperDimensions({
|
|
58534
|
+
index: index,
|
|
58535
|
+
node: _node,
|
|
58536
|
+
collection: _collection
|
|
58537
|
+
});
|
|
58538
|
+
|
|
58539
|
+
_this.node = _node;
|
|
58540
|
+
_this.margin = margin;
|
|
58541
|
+
_this.gridGap = gridGap;
|
|
58542
|
+
_this.width = dimensions.width;
|
|
58543
|
+
_this.height = dimensions.height;
|
|
58544
|
+
_this.marginOffset = {
|
|
58545
|
+
x: _this.margin.left + _this.margin.right + _this.gridGap.x,
|
|
58546
|
+
y: Math.max(_this.margin.top, _this.margin.bottom, _this.gridGap.y)
|
|
58547
|
+
};
|
|
58548
|
+
_this.boundingClientRect = _node.getBoundingClientRect();
|
|
58549
|
+
_this.containerBoundingRect = containerBoundingRect;
|
|
58550
|
+
_this.index = index;
|
|
58551
|
+
_this.newIndex = index;
|
|
58552
|
+
_this.axis = {
|
|
58553
|
+
x: _axis.indexOf('x') >= 0,
|
|
58554
|
+
y: _axis.indexOf('y') >= 0
|
|
58555
|
+
};
|
|
58556
|
+
_this.offsetEdge = getEdgeOffset(_node, _this.container);
|
|
58557
|
+
|
|
58558
|
+
if (_isKeySorting) {
|
|
58559
|
+
_this.initialOffset = getPosition(_objectSpread$7({}, event, {
|
|
58560
|
+
pageX: _this.boundingClientRect.left,
|
|
58561
|
+
pageY: _this.boundingClientRect.top
|
|
58562
|
+
}));
|
|
58563
|
+
} else {
|
|
58564
|
+
_this.initialOffset = getPosition(event);
|
|
58565
|
+
}
|
|
58566
|
+
|
|
58567
|
+
_this.initialScroll = {
|
|
58568
|
+
left: _this.scrollContainer.scrollLeft,
|
|
58569
|
+
top: _this.scrollContainer.scrollTop
|
|
58570
|
+
};
|
|
58571
|
+
_this.initialWindowScroll = {
|
|
58572
|
+
left: window.pageXOffset,
|
|
58573
|
+
top: window.pageYOffset
|
|
58574
|
+
};
|
|
58575
|
+
_this.helper = _this.helperContainer.appendChild(cloneNode(_node));
|
|
58576
|
+
setInlineStyles(_this.helper, {
|
|
58577
|
+
boxSizing: 'border-box',
|
|
58578
|
+
height: "".concat(_this.height, "px"),
|
|
58579
|
+
left: "".concat(_this.boundingClientRect.left - margin.left, "px"),
|
|
58580
|
+
pointerEvents: 'none',
|
|
58581
|
+
position: 'fixed',
|
|
58582
|
+
top: "".concat(_this.boundingClientRect.top - margin.top, "px"),
|
|
58583
|
+
width: "".concat(_this.width, "px")
|
|
58584
|
+
});
|
|
58585
|
+
|
|
58586
|
+
if (_isKeySorting) {
|
|
58587
|
+
_this.helper.focus();
|
|
58588
|
+
}
|
|
58589
|
+
|
|
58590
|
+
if (_hideSortableGhost) {
|
|
58591
|
+
_this.sortableGhost = _node;
|
|
58592
|
+
setInlineStyles(_node, {
|
|
58593
|
+
opacity: 0,
|
|
58594
|
+
visibility: 'hidden'
|
|
58595
|
+
});
|
|
58596
|
+
}
|
|
58597
|
+
|
|
58598
|
+
_this.minTranslate = {};
|
|
58599
|
+
_this.maxTranslate = {};
|
|
58600
|
+
|
|
58601
|
+
if (_isKeySorting) {
|
|
58602
|
+
var _ref = _useWindowAsScrollContainer ? {
|
|
58603
|
+
top: 0,
|
|
58604
|
+
left: 0,
|
|
58605
|
+
width: _this.contentWindow.innerWidth,
|
|
58606
|
+
height: _this.contentWindow.innerHeight
|
|
58607
|
+
} : _this.containerBoundingRect,
|
|
58608
|
+
containerTop = _ref.top,
|
|
58609
|
+
containerLeft = _ref.left,
|
|
58610
|
+
containerWidth = _ref.width,
|
|
58611
|
+
containerHeight = _ref.height;
|
|
58612
|
+
|
|
58613
|
+
var containerBottom = containerTop + containerHeight;
|
|
58614
|
+
var containerRight = containerLeft + containerWidth;
|
|
58615
|
+
|
|
58616
|
+
if (_this.axis.x) {
|
|
58617
|
+
_this.minTranslate.x = containerLeft - _this.boundingClientRect.left;
|
|
58618
|
+
_this.maxTranslate.x = containerRight - (_this.boundingClientRect.left + _this.width);
|
|
58619
|
+
}
|
|
58620
|
+
|
|
58621
|
+
if (_this.axis.y) {
|
|
58622
|
+
_this.minTranslate.y = containerTop - _this.boundingClientRect.top;
|
|
58623
|
+
_this.maxTranslate.y = containerBottom - (_this.boundingClientRect.top + _this.height);
|
|
58624
|
+
}
|
|
58625
|
+
} else {
|
|
58626
|
+
if (_this.axis.x) {
|
|
58627
|
+
_this.minTranslate.x = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.left) - _this.boundingClientRect.left - _this.width / 2;
|
|
58628
|
+
_this.maxTranslate.x = (_useWindowAsScrollContainer ? _this.contentWindow.innerWidth : containerBoundingRect.left + containerBoundingRect.width) - _this.boundingClientRect.left - _this.width / 2;
|
|
58629
|
+
}
|
|
58630
|
+
|
|
58631
|
+
if (_this.axis.y) {
|
|
58632
|
+
_this.minTranslate.y = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.top) - _this.boundingClientRect.top - _this.height / 2;
|
|
58633
|
+
_this.maxTranslate.y = (_useWindowAsScrollContainer ? _this.contentWindow.innerHeight : containerBoundingRect.top + containerBoundingRect.height) - _this.boundingClientRect.top - _this.height / 2;
|
|
58634
|
+
}
|
|
58635
|
+
}
|
|
58636
|
+
|
|
58637
|
+
if (_helperClass) {
|
|
58638
|
+
_helperClass.split(' ').forEach(function (className) {
|
|
58639
|
+
return _this.helper.classList.add(className);
|
|
58640
|
+
});
|
|
58641
|
+
}
|
|
58642
|
+
|
|
58643
|
+
_this.listenerNode = event.touches ? event.target : _this.contentWindow;
|
|
58644
|
+
|
|
58645
|
+
if (_isKeySorting) {
|
|
58646
|
+
_this.listenerNode.addEventListener('wheel', _this.handleKeyEnd, true);
|
|
58647
|
+
|
|
58648
|
+
_this.listenerNode.addEventListener('mousedown', _this.handleKeyEnd, true);
|
|
58649
|
+
|
|
58650
|
+
_this.listenerNode.addEventListener('keydown', _this.handleKeyDown);
|
|
58651
|
+
} else {
|
|
58652
|
+
events$1.move.forEach(function (eventName) {
|
|
58653
|
+
return _this.listenerNode.addEventListener(eventName, _this.handleSortMove, false);
|
|
58654
|
+
});
|
|
58655
|
+
events$1.end.forEach(function (eventName) {
|
|
58656
|
+
return _this.listenerNode.addEventListener(eventName, _this.handleSortEnd, false);
|
|
58657
|
+
});
|
|
58658
|
+
}
|
|
58659
|
+
|
|
58660
|
+
_this.setState({
|
|
58661
|
+
sorting: true,
|
|
58662
|
+
sortingIndex: index
|
|
58663
|
+
});
|
|
58664
|
+
|
|
58665
|
+
if (_onSortStart) {
|
|
58666
|
+
_onSortStart({
|
|
58667
|
+
node: _node,
|
|
58668
|
+
index: index,
|
|
58669
|
+
collection: _collection,
|
|
58670
|
+
isKeySorting: _isKeySorting,
|
|
58671
|
+
nodes: _this.manager.getOrderedRefs(),
|
|
58672
|
+
helper: _this.helper
|
|
58673
|
+
}, event);
|
|
58674
|
+
}
|
|
58675
|
+
|
|
58676
|
+
if (_isKeySorting) {
|
|
58677
|
+
_this.keyMove(0);
|
|
58678
|
+
}
|
|
58679
|
+
};
|
|
58680
|
+
|
|
58681
|
+
var _this$props3 = _this.props,
|
|
58682
|
+
_axis = _this$props3.axis,
|
|
58683
|
+
_getHelperDimensions = _this$props3.getHelperDimensions,
|
|
58684
|
+
_helperClass = _this$props3.helperClass,
|
|
58685
|
+
_hideSortableGhost = _this$props3.hideSortableGhost,
|
|
58686
|
+
updateBeforeSortStart = _this$props3.updateBeforeSortStart,
|
|
58687
|
+
_onSortStart = _this$props3.onSortStart,
|
|
58688
|
+
_useWindowAsScrollContainer = _this$props3.useWindowAsScrollContainer;
|
|
58689
|
+
var _node = active.node,
|
|
58690
|
+
_collection = active.collection;
|
|
58691
|
+
var _isKeySorting = _this.manager.isKeySorting;
|
|
58692
|
+
|
|
58693
|
+
var _temp8 = function () {
|
|
58694
|
+
if (typeof updateBeforeSortStart === 'function') {
|
|
58695
|
+
_this._awaitingUpdateBeforeSortStart = true;
|
|
58696
|
+
|
|
58697
|
+
var _temp9 = _finallyRethrows(function () {
|
|
58698
|
+
var index = _node.sortableInfo.index;
|
|
58699
|
+
return Promise.resolve(updateBeforeSortStart({
|
|
58700
|
+
collection: _collection,
|
|
58701
|
+
index: index,
|
|
58702
|
+
node: _node,
|
|
58703
|
+
isKeySorting: _isKeySorting
|
|
58704
|
+
}, event)).then(function () {});
|
|
58705
|
+
}, function (_wasThrown, _result) {
|
|
58706
|
+
_this._awaitingUpdateBeforeSortStart = false;
|
|
58707
|
+
if (_wasThrown) throw _result;
|
|
58708
|
+
return _result;
|
|
58709
|
+
});
|
|
58710
|
+
|
|
58711
|
+
if (_temp9 && _temp9.then) return _temp9.then(function () {});
|
|
58712
|
+
}
|
|
58713
|
+
}();
|
|
58714
|
+
|
|
58715
|
+
return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
|
|
58716
|
+
}
|
|
58717
|
+
}();
|
|
58718
|
+
|
|
58719
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
58720
|
+
} catch (e) {
|
|
58721
|
+
return Promise.reject(e);
|
|
58722
|
+
}
|
|
58723
|
+
});
|
|
58724
|
+
|
|
58725
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleSortMove", function (event) {
|
|
58726
|
+
var onSortMove = _this.props.onSortMove;
|
|
58727
|
+
|
|
58728
|
+
if (typeof event.preventDefault === 'function' && event.cancelable) {
|
|
58729
|
+
event.preventDefault();
|
|
58730
|
+
}
|
|
58731
|
+
|
|
58732
|
+
_this.updateHelperPosition(event);
|
|
58733
|
+
|
|
58734
|
+
_this.animateNodes();
|
|
58735
|
+
|
|
58736
|
+
_this.autoscroll();
|
|
58737
|
+
|
|
58738
|
+
if (onSortMove) {
|
|
58739
|
+
onSortMove(event);
|
|
58740
|
+
}
|
|
58741
|
+
});
|
|
58742
|
+
|
|
58743
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleSortEnd", function (event) {
|
|
58744
|
+
var _this$props4 = _this.props,
|
|
58745
|
+
hideSortableGhost = _this$props4.hideSortableGhost,
|
|
58746
|
+
onSortEnd = _this$props4.onSortEnd;
|
|
58747
|
+
var _this$manager = _this.manager,
|
|
58748
|
+
collection = _this$manager.active.collection,
|
|
58749
|
+
isKeySorting = _this$manager.isKeySorting;
|
|
58750
|
+
|
|
58751
|
+
var nodes = _this.manager.getOrderedRefs();
|
|
58752
|
+
|
|
58753
|
+
if (_this.listenerNode) {
|
|
58754
|
+
if (isKeySorting) {
|
|
58755
|
+
_this.listenerNode.removeEventListener('wheel', _this.handleKeyEnd, true);
|
|
58756
|
+
|
|
58757
|
+
_this.listenerNode.removeEventListener('mousedown', _this.handleKeyEnd, true);
|
|
58758
|
+
|
|
58759
|
+
_this.listenerNode.removeEventListener('keydown', _this.handleKeyDown);
|
|
58760
|
+
} else {
|
|
58761
|
+
events$1.move.forEach(function (eventName) {
|
|
58762
|
+
return _this.listenerNode.removeEventListener(eventName, _this.handleSortMove);
|
|
58763
|
+
});
|
|
58764
|
+
events$1.end.forEach(function (eventName) {
|
|
58765
|
+
return _this.listenerNode.removeEventListener(eventName, _this.handleSortEnd);
|
|
58766
|
+
});
|
|
58767
|
+
}
|
|
58768
|
+
}
|
|
58769
|
+
|
|
58770
|
+
_this.helper.parentNode.removeChild(_this.helper);
|
|
58771
|
+
|
|
58772
|
+
if (hideSortableGhost && _this.sortableGhost) {
|
|
58773
|
+
setInlineStyles(_this.sortableGhost, {
|
|
58774
|
+
opacity: '',
|
|
58775
|
+
visibility: ''
|
|
58776
|
+
});
|
|
58777
|
+
}
|
|
58778
|
+
|
|
58779
|
+
for (var i = 0, len = nodes.length; i < len; i++) {
|
|
58780
|
+
var _node2 = nodes[i];
|
|
58781
|
+
var el = _node2.node;
|
|
58782
|
+
_node2.edgeOffset = null;
|
|
58783
|
+
_node2.boundingClientRect = null;
|
|
58784
|
+
setTranslate3d(el, null);
|
|
58785
|
+
setTransitionDuration(el, null);
|
|
58786
|
+
_node2.translate = null;
|
|
58787
|
+
}
|
|
58788
|
+
|
|
58789
|
+
_this.autoScroller.clear();
|
|
58790
|
+
|
|
58791
|
+
_this.manager.active = null;
|
|
58792
|
+
_this.manager.isKeySorting = false;
|
|
58793
|
+
|
|
58794
|
+
_this.setState({
|
|
58795
|
+
sorting: false,
|
|
58796
|
+
sortingIndex: null
|
|
58797
|
+
});
|
|
58798
|
+
|
|
58799
|
+
if (typeof onSortEnd === 'function') {
|
|
58800
|
+
onSortEnd({
|
|
58801
|
+
collection: collection,
|
|
58802
|
+
newIndex: _this.newIndex,
|
|
58803
|
+
oldIndex: _this.index,
|
|
58804
|
+
isKeySorting: isKeySorting,
|
|
58805
|
+
nodes: nodes
|
|
58806
|
+
}, event);
|
|
58807
|
+
}
|
|
58808
|
+
|
|
58809
|
+
_this.touched = false;
|
|
58810
|
+
});
|
|
58811
|
+
|
|
58812
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "autoscroll", function () {
|
|
58813
|
+
var disableAutoscroll = _this.props.disableAutoscroll;
|
|
58814
|
+
var isKeySorting = _this.manager.isKeySorting;
|
|
58815
|
+
|
|
58816
|
+
if (disableAutoscroll) {
|
|
58817
|
+
_this.autoScroller.clear();
|
|
58818
|
+
|
|
58819
|
+
return;
|
|
58820
|
+
}
|
|
58821
|
+
|
|
58822
|
+
if (isKeySorting) {
|
|
58823
|
+
var translate = _objectSpread$7({}, _this.translate);
|
|
58824
|
+
|
|
58825
|
+
var scrollX = 0;
|
|
58826
|
+
var scrollY = 0;
|
|
58827
|
+
|
|
58828
|
+
if (_this.axis.x) {
|
|
58829
|
+
translate.x = Math.min(_this.maxTranslate.x, Math.max(_this.minTranslate.x, _this.translate.x));
|
|
58830
|
+
scrollX = _this.translate.x - translate.x;
|
|
58831
|
+
}
|
|
58832
|
+
|
|
58833
|
+
if (_this.axis.y) {
|
|
58834
|
+
translate.y = Math.min(_this.maxTranslate.y, Math.max(_this.minTranslate.y, _this.translate.y));
|
|
58835
|
+
scrollY = _this.translate.y - translate.y;
|
|
58836
|
+
}
|
|
58837
|
+
|
|
58838
|
+
_this.translate = translate;
|
|
58839
|
+
setTranslate3d(_this.helper, _this.translate);
|
|
58840
|
+
_this.scrollContainer.scrollLeft += scrollX;
|
|
58841
|
+
_this.scrollContainer.scrollTop += scrollY;
|
|
58842
|
+
return;
|
|
58843
|
+
}
|
|
58844
|
+
|
|
58845
|
+
_this.autoScroller.update({
|
|
58846
|
+
height: _this.height,
|
|
58847
|
+
maxTranslate: _this.maxTranslate,
|
|
58848
|
+
minTranslate: _this.minTranslate,
|
|
58849
|
+
translate: _this.translate,
|
|
58850
|
+
width: _this.width
|
|
58851
|
+
});
|
|
58852
|
+
});
|
|
58853
|
+
|
|
58854
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "onAutoScroll", function (offset) {
|
|
58855
|
+
_this.translate.x += offset.left;
|
|
58856
|
+
_this.translate.y += offset.top;
|
|
58857
|
+
|
|
58858
|
+
_this.animateNodes();
|
|
58859
|
+
});
|
|
58860
|
+
|
|
58861
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function (event) {
|
|
58862
|
+
var keyCode = event.keyCode;
|
|
58863
|
+
var _this$props5 = _this.props,
|
|
58864
|
+
shouldCancelStart = _this$props5.shouldCancelStart,
|
|
58865
|
+
_this$props5$keyCodes = _this$props5.keyCodes,
|
|
58866
|
+
customKeyCodes = _this$props5$keyCodes === void 0 ? {} : _this$props5$keyCodes;
|
|
58867
|
+
|
|
58868
|
+
var keyCodes = _objectSpread$7({}, defaultKeyCodes, customKeyCodes);
|
|
58869
|
+
|
|
58870
|
+
if (_this.manager.active && !_this.manager.isKeySorting || !_this.manager.active && (!keyCodes.lift.includes(keyCode) || shouldCancelStart(event) || !_this.isValidSortingTarget(event))) {
|
|
58871
|
+
return;
|
|
58872
|
+
}
|
|
58873
|
+
|
|
58874
|
+
event.stopPropagation();
|
|
58875
|
+
event.preventDefault();
|
|
58876
|
+
|
|
58877
|
+
if (keyCodes.lift.includes(keyCode) && !_this.manager.active) {
|
|
58878
|
+
_this.keyLift(event);
|
|
58879
|
+
} else if (keyCodes.drop.includes(keyCode) && _this.manager.active) {
|
|
58880
|
+
_this.keyDrop(event);
|
|
58881
|
+
} else if (keyCodes.cancel.includes(keyCode)) {
|
|
58882
|
+
_this.newIndex = _this.manager.active.index;
|
|
58883
|
+
|
|
58884
|
+
_this.keyDrop(event);
|
|
58885
|
+
} else if (keyCodes.up.includes(keyCode)) {
|
|
58886
|
+
_this.keyMove(-1);
|
|
58887
|
+
} else if (keyCodes.down.includes(keyCode)) {
|
|
58888
|
+
_this.keyMove(1);
|
|
58889
|
+
}
|
|
58890
|
+
});
|
|
58891
|
+
|
|
58892
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "keyLift", function (event) {
|
|
58893
|
+
var target = event.target;
|
|
58894
|
+
var node = closest(target, function (el) {
|
|
58895
|
+
return el.sortableInfo != null;
|
|
58896
|
+
});
|
|
58897
|
+
var _node$sortableInfo2 = node.sortableInfo,
|
|
58898
|
+
index = _node$sortableInfo2.index,
|
|
58899
|
+
collection = _node$sortableInfo2.collection;
|
|
58900
|
+
_this.initialFocusedNode = target;
|
|
58901
|
+
_this.manager.isKeySorting = true;
|
|
58902
|
+
_this.manager.active = {
|
|
58903
|
+
index: index,
|
|
58904
|
+
collection: collection
|
|
58905
|
+
};
|
|
58906
|
+
|
|
58907
|
+
_this.handlePress(event);
|
|
58908
|
+
});
|
|
58909
|
+
|
|
58910
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "keyMove", function (shift) {
|
|
58911
|
+
var nodes = _this.manager.getOrderedRefs();
|
|
58912
|
+
|
|
58913
|
+
var lastIndex = nodes[nodes.length - 1].node.sortableInfo.index;
|
|
58914
|
+
var newIndex = _this.newIndex + shift;
|
|
58915
|
+
var prevIndex = _this.newIndex;
|
|
58916
|
+
|
|
58917
|
+
if (newIndex < 0 || newIndex > lastIndex) {
|
|
58918
|
+
return;
|
|
58919
|
+
}
|
|
58920
|
+
|
|
58921
|
+
_this.prevIndex = prevIndex;
|
|
58922
|
+
_this.newIndex = newIndex;
|
|
58923
|
+
var targetIndex = getTargetIndex(_this.newIndex, _this.prevIndex, _this.index);
|
|
58924
|
+
var target = nodes.find(function (_ref2) {
|
|
58925
|
+
var node = _ref2.node;
|
|
58926
|
+
return node.sortableInfo.index === targetIndex;
|
|
58927
|
+
});
|
|
58928
|
+
var targetNode = target.node;
|
|
58929
|
+
var scrollDelta = _this.containerScrollDelta;
|
|
58930
|
+
var targetBoundingClientRect = target.boundingClientRect || getScrollAdjustedBoundingClientRect(targetNode, scrollDelta);
|
|
58931
|
+
var targetTranslate = target.translate || {
|
|
58932
|
+
x: 0,
|
|
58933
|
+
y: 0
|
|
58934
|
+
};
|
|
58935
|
+
var targetPosition = {
|
|
58936
|
+
top: targetBoundingClientRect.top + targetTranslate.y - scrollDelta.top,
|
|
58937
|
+
left: targetBoundingClientRect.left + targetTranslate.x - scrollDelta.left
|
|
58938
|
+
};
|
|
58939
|
+
var shouldAdjustForSize = prevIndex < newIndex;
|
|
58940
|
+
var sizeAdjustment = {
|
|
58941
|
+
x: shouldAdjustForSize && _this.axis.x ? targetNode.offsetWidth - _this.width : 0,
|
|
58942
|
+
y: shouldAdjustForSize && _this.axis.y ? targetNode.offsetHeight - _this.height : 0
|
|
58943
|
+
};
|
|
58944
|
+
|
|
58945
|
+
_this.handleSortMove({
|
|
58946
|
+
pageX: targetPosition.left + sizeAdjustment.x,
|
|
58947
|
+
pageY: targetPosition.top + sizeAdjustment.y,
|
|
58948
|
+
ignoreTransition: shift === 0
|
|
58949
|
+
});
|
|
58950
|
+
});
|
|
58951
|
+
|
|
58952
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "keyDrop", function (event) {
|
|
58953
|
+
_this.handleSortEnd(event);
|
|
58954
|
+
|
|
58955
|
+
if (_this.initialFocusedNode) {
|
|
58956
|
+
_this.initialFocusedNode.focus();
|
|
58957
|
+
}
|
|
58958
|
+
});
|
|
58959
|
+
|
|
58960
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyEnd", function (event) {
|
|
58961
|
+
if (_this.manager.active) {
|
|
58962
|
+
_this.keyDrop(event);
|
|
58963
|
+
}
|
|
58964
|
+
});
|
|
58965
|
+
|
|
58966
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "isValidSortingTarget", function (event) {
|
|
58967
|
+
var useDragHandle = _this.props.useDragHandle;
|
|
58968
|
+
var target = event.target;
|
|
58969
|
+
var node = closest(target, function (el) {
|
|
58970
|
+
return el.sortableInfo != null;
|
|
58971
|
+
});
|
|
58972
|
+
return node && node.sortableInfo && !node.sortableInfo.disabled && (useDragHandle ? isSortableHandle(target) : target.sortableInfo);
|
|
58973
|
+
});
|
|
58974
|
+
|
|
58975
|
+
var manager = new Manager();
|
|
58976
|
+
validateProps(props);
|
|
58977
|
+
_this.manager = manager;
|
|
58978
|
+
_this.wrappedInstance = React.createRef();
|
|
58979
|
+
_this.sortableContextValue = {
|
|
58980
|
+
manager: manager
|
|
58981
|
+
};
|
|
58982
|
+
_this.events = {
|
|
58983
|
+
end: _this.handleEnd,
|
|
58984
|
+
move: _this.handleMove,
|
|
58985
|
+
start: _this.handleStart
|
|
58986
|
+
};
|
|
58987
|
+
return _this;
|
|
58988
|
+
}
|
|
58989
|
+
|
|
58990
|
+
_createClass(WithSortableContainer, [{
|
|
58991
|
+
key: "componentDidMount",
|
|
58992
|
+
value: function componentDidMount() {
|
|
58993
|
+
var _this2 = this;
|
|
58994
|
+
|
|
58995
|
+
var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer;
|
|
58996
|
+
var container = this.getContainer();
|
|
58997
|
+
Promise.resolve(container).then(function (containerNode) {
|
|
58998
|
+
_this2.container = containerNode;
|
|
58999
|
+
_this2.document = _this2.container.ownerDocument || document;
|
|
59000
|
+
var contentWindow = _this2.props.contentWindow || _this2.document.defaultView || window;
|
|
59001
|
+
_this2.contentWindow = typeof contentWindow === 'function' ? contentWindow() : contentWindow;
|
|
59002
|
+
_this2.scrollContainer = useWindowAsScrollContainer ? _this2.document.scrollingElement || _this2.document.documentElement : getScrollingParent(_this2.container) || _this2.container;
|
|
59003
|
+
_this2.autoScroller = new AutoScroller(_this2.scrollContainer, _this2.onAutoScroll);
|
|
59004
|
+
Object.keys(_this2.events).forEach(function (key) {
|
|
59005
|
+
return events$1[key].forEach(function (eventName) {
|
|
59006
|
+
return _this2.container.addEventListener(eventName, _this2.events[key], false);
|
|
59007
|
+
});
|
|
59008
|
+
});
|
|
59009
|
+
|
|
59010
|
+
_this2.container.addEventListener('keydown', _this2.handleKeyDown);
|
|
59011
|
+
});
|
|
59012
|
+
}
|
|
59013
|
+
}, {
|
|
59014
|
+
key: "componentWillUnmount",
|
|
59015
|
+
value: function componentWillUnmount() {
|
|
59016
|
+
var _this3 = this;
|
|
59017
|
+
|
|
59018
|
+
if (this.helper && this.helper.parentNode) {
|
|
59019
|
+
this.helper.parentNode.removeChild(this.helper);
|
|
59020
|
+
}
|
|
59021
|
+
|
|
59022
|
+
if (!this.container) {
|
|
59023
|
+
return;
|
|
59024
|
+
}
|
|
59025
|
+
|
|
59026
|
+
Object.keys(this.events).forEach(function (key) {
|
|
59027
|
+
return events$1[key].forEach(function (eventName) {
|
|
59028
|
+
return _this3.container.removeEventListener(eventName, _this3.events[key]);
|
|
59029
|
+
});
|
|
59030
|
+
});
|
|
59031
|
+
this.container.removeEventListener('keydown', this.handleKeyDown);
|
|
59032
|
+
}
|
|
59033
|
+
}, {
|
|
59034
|
+
key: "updateHelperPosition",
|
|
59035
|
+
value: function updateHelperPosition(event) {
|
|
59036
|
+
var _this$props6 = this.props,
|
|
59037
|
+
lockAxis = _this$props6.lockAxis,
|
|
59038
|
+
lockOffset = _this$props6.lockOffset,
|
|
59039
|
+
lockToContainerEdges = _this$props6.lockToContainerEdges,
|
|
59040
|
+
transitionDuration = _this$props6.transitionDuration,
|
|
59041
|
+
_this$props6$keyboard = _this$props6.keyboardSortingTransitionDuration,
|
|
59042
|
+
keyboardSortingTransitionDuration = _this$props6$keyboard === void 0 ? transitionDuration : _this$props6$keyboard;
|
|
59043
|
+
var isKeySorting = this.manager.isKeySorting;
|
|
59044
|
+
var ignoreTransition = event.ignoreTransition;
|
|
59045
|
+
var offset = getPosition(event);
|
|
59046
|
+
var translate = {
|
|
59047
|
+
x: offset.x - this.initialOffset.x,
|
|
59048
|
+
y: offset.y - this.initialOffset.y
|
|
59049
|
+
};
|
|
59050
|
+
translate.y -= window.pageYOffset - this.initialWindowScroll.top;
|
|
59051
|
+
translate.x -= window.pageXOffset - this.initialWindowScroll.left;
|
|
59052
|
+
this.translate = translate;
|
|
59053
|
+
|
|
59054
|
+
if (lockToContainerEdges) {
|
|
59055
|
+
var _getLockPixelOffsets = getLockPixelOffsets({
|
|
59056
|
+
height: this.height,
|
|
59057
|
+
lockOffset: lockOffset,
|
|
59058
|
+
width: this.width
|
|
59059
|
+
}),
|
|
59060
|
+
_getLockPixelOffsets2 = _slicedToArray$1(_getLockPixelOffsets, 2),
|
|
59061
|
+
minLockOffset = _getLockPixelOffsets2[0],
|
|
59062
|
+
maxLockOffset = _getLockPixelOffsets2[1];
|
|
59063
|
+
|
|
59064
|
+
var minOffset = {
|
|
59065
|
+
x: this.width / 2 - minLockOffset.x,
|
|
59066
|
+
y: this.height / 2 - minLockOffset.y
|
|
59067
|
+
};
|
|
59068
|
+
var maxOffset = {
|
|
59069
|
+
x: this.width / 2 - maxLockOffset.x,
|
|
59070
|
+
y: this.height / 2 - maxLockOffset.y
|
|
59071
|
+
};
|
|
59072
|
+
translate.x = limit(this.minTranslate.x + minOffset.x, this.maxTranslate.x - maxOffset.x, translate.x);
|
|
59073
|
+
translate.y = limit(this.minTranslate.y + minOffset.y, this.maxTranslate.y - maxOffset.y, translate.y);
|
|
59074
|
+
}
|
|
59075
|
+
|
|
59076
|
+
if (lockAxis === 'x') {
|
|
59077
|
+
translate.y = 0;
|
|
59078
|
+
} else if (lockAxis === 'y') {
|
|
59079
|
+
translate.x = 0;
|
|
59080
|
+
}
|
|
59081
|
+
|
|
59082
|
+
if (isKeySorting && keyboardSortingTransitionDuration && !ignoreTransition) {
|
|
59083
|
+
setTransitionDuration(this.helper, keyboardSortingTransitionDuration);
|
|
59084
|
+
}
|
|
59085
|
+
|
|
59086
|
+
setTranslate3d(this.helper, translate);
|
|
59087
|
+
}
|
|
59088
|
+
}, {
|
|
59089
|
+
key: "animateNodes",
|
|
59090
|
+
value: function animateNodes() {
|
|
59091
|
+
var _this$props7 = this.props,
|
|
59092
|
+
transitionDuration = _this$props7.transitionDuration,
|
|
59093
|
+
hideSortableGhost = _this$props7.hideSortableGhost,
|
|
59094
|
+
onSortOver = _this$props7.onSortOver;
|
|
59095
|
+
var containerScrollDelta = this.containerScrollDelta,
|
|
59096
|
+
windowScrollDelta = this.windowScrollDelta;
|
|
59097
|
+
var nodes = this.manager.getOrderedRefs();
|
|
59098
|
+
var sortingOffset = {
|
|
59099
|
+
left: this.offsetEdge.left + this.translate.x + containerScrollDelta.left,
|
|
59100
|
+
top: this.offsetEdge.top + this.translate.y + containerScrollDelta.top
|
|
59101
|
+
};
|
|
59102
|
+
var isKeySorting = this.manager.isKeySorting;
|
|
59103
|
+
var prevIndex = this.newIndex;
|
|
59104
|
+
this.newIndex = null;
|
|
59105
|
+
|
|
59106
|
+
for (var i = 0, len = nodes.length; i < len; i++) {
|
|
59107
|
+
var _node3 = nodes[i].node;
|
|
59108
|
+
var index = _node3.sortableInfo.index;
|
|
59109
|
+
var width = _node3.offsetWidth;
|
|
59110
|
+
var height = _node3.offsetHeight;
|
|
59111
|
+
var offset = {
|
|
59112
|
+
height: this.height > height ? height / 2 : this.height / 2,
|
|
59113
|
+
width: this.width > width ? width / 2 : this.width / 2
|
|
59114
|
+
};
|
|
59115
|
+
var mustShiftBackward = isKeySorting && index > this.index && index <= prevIndex;
|
|
59116
|
+
var mustShiftForward = isKeySorting && index < this.index && index >= prevIndex;
|
|
59117
|
+
var translate = {
|
|
59118
|
+
x: 0,
|
|
59119
|
+
y: 0
|
|
59120
|
+
};
|
|
59121
|
+
var edgeOffset = nodes[i].edgeOffset;
|
|
59122
|
+
|
|
59123
|
+
if (!edgeOffset) {
|
|
59124
|
+
edgeOffset = getEdgeOffset(_node3, this.container);
|
|
59125
|
+
nodes[i].edgeOffset = edgeOffset;
|
|
59126
|
+
|
|
59127
|
+
if (isKeySorting) {
|
|
59128
|
+
nodes[i].boundingClientRect = getScrollAdjustedBoundingClientRect(_node3, containerScrollDelta);
|
|
59129
|
+
}
|
|
59130
|
+
}
|
|
59131
|
+
|
|
59132
|
+
var nextNode = i < nodes.length - 1 && nodes[i + 1];
|
|
59133
|
+
var prevNode = i > 0 && nodes[i - 1];
|
|
59134
|
+
|
|
59135
|
+
if (nextNode && !nextNode.edgeOffset) {
|
|
59136
|
+
nextNode.edgeOffset = getEdgeOffset(nextNode.node, this.container);
|
|
59137
|
+
|
|
59138
|
+
if (isKeySorting) {
|
|
59139
|
+
nextNode.boundingClientRect = getScrollAdjustedBoundingClientRect(nextNode.node, containerScrollDelta);
|
|
59140
|
+
}
|
|
59141
|
+
}
|
|
59142
|
+
|
|
59143
|
+
if (index === this.index) {
|
|
59144
|
+
if (hideSortableGhost) {
|
|
59145
|
+
this.sortableGhost = _node3;
|
|
59146
|
+
setInlineStyles(_node3, {
|
|
59147
|
+
opacity: 0,
|
|
59148
|
+
visibility: 'hidden'
|
|
59149
|
+
});
|
|
59150
|
+
}
|
|
59151
|
+
|
|
59152
|
+
continue;
|
|
59153
|
+
}
|
|
59154
|
+
|
|
59155
|
+
if (transitionDuration) {
|
|
59156
|
+
setTransitionDuration(_node3, transitionDuration);
|
|
59157
|
+
}
|
|
59158
|
+
|
|
59159
|
+
if (this.axis.x) {
|
|
59160
|
+
if (this.axis.y) {
|
|
59161
|
+
if (mustShiftForward || index < this.index && (sortingOffset.left + windowScrollDelta.left - offset.width <= edgeOffset.left && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset.height || sortingOffset.top + windowScrollDelta.top + offset.height <= edgeOffset.top)) {
|
|
59162
|
+
translate.x = this.width + this.marginOffset.x;
|
|
59163
|
+
|
|
59164
|
+
if (edgeOffset.left + translate.x > this.containerBoundingRect.width - offset.width) {
|
|
59165
|
+
if (nextNode) {
|
|
59166
|
+
translate.x = nextNode.edgeOffset.left - edgeOffset.left;
|
|
59167
|
+
translate.y = nextNode.edgeOffset.top - edgeOffset.top;
|
|
59168
|
+
}
|
|
59169
|
+
}
|
|
59170
|
+
|
|
59171
|
+
if (this.newIndex === null) {
|
|
59172
|
+
this.newIndex = index;
|
|
59173
|
+
}
|
|
59174
|
+
} else if (mustShiftBackward || index > this.index && (sortingOffset.left + windowScrollDelta.left + offset.width >= edgeOffset.left && sortingOffset.top + windowScrollDelta.top + offset.height >= edgeOffset.top || sortingOffset.top + windowScrollDelta.top + offset.height >= edgeOffset.top + height)) {
|
|
59175
|
+
translate.x = -(this.width + this.marginOffset.x);
|
|
59176
|
+
|
|
59177
|
+
if (edgeOffset.left + translate.x < this.containerBoundingRect.left + offset.width) {
|
|
59178
|
+
if (prevNode) {
|
|
59179
|
+
translate.x = prevNode.edgeOffset.left - edgeOffset.left;
|
|
59180
|
+
translate.y = prevNode.edgeOffset.top - edgeOffset.top;
|
|
59181
|
+
}
|
|
59182
|
+
}
|
|
59183
|
+
|
|
59184
|
+
this.newIndex = index;
|
|
59185
|
+
}
|
|
59186
|
+
} else {
|
|
59187
|
+
if (mustShiftBackward || index > this.index && sortingOffset.left + windowScrollDelta.left + offset.width >= edgeOffset.left) {
|
|
59188
|
+
translate.x = -(this.width + this.marginOffset.x);
|
|
59189
|
+
this.newIndex = index;
|
|
59190
|
+
} else if (mustShiftForward || index < this.index && sortingOffset.left + windowScrollDelta.left <= edgeOffset.left + offset.width) {
|
|
59191
|
+
translate.x = this.width + this.marginOffset.x;
|
|
59192
|
+
|
|
59193
|
+
if (this.newIndex == null) {
|
|
59194
|
+
this.newIndex = index;
|
|
59195
|
+
}
|
|
59196
|
+
}
|
|
59197
|
+
}
|
|
59198
|
+
} else if (this.axis.y) {
|
|
59199
|
+
if (mustShiftBackward || index > this.index && sortingOffset.top + windowScrollDelta.top + offset.height >= edgeOffset.top) {
|
|
59200
|
+
translate.y = -(this.height + this.marginOffset.y);
|
|
59201
|
+
this.newIndex = index;
|
|
59202
|
+
} else if (mustShiftForward || index < this.index && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset.height) {
|
|
59203
|
+
translate.y = this.height + this.marginOffset.y;
|
|
59204
|
+
|
|
59205
|
+
if (this.newIndex == null) {
|
|
59206
|
+
this.newIndex = index;
|
|
59207
|
+
}
|
|
59208
|
+
}
|
|
59209
|
+
}
|
|
59210
|
+
|
|
59211
|
+
setTranslate3d(_node3, translate);
|
|
59212
|
+
nodes[i].translate = translate;
|
|
59213
|
+
}
|
|
59214
|
+
|
|
59215
|
+
if (this.newIndex == null) {
|
|
59216
|
+
this.newIndex = this.index;
|
|
59217
|
+
}
|
|
59218
|
+
|
|
59219
|
+
if (isKeySorting) {
|
|
59220
|
+
this.newIndex = prevIndex;
|
|
59221
|
+
}
|
|
59222
|
+
|
|
59223
|
+
var oldIndex = isKeySorting ? this.prevIndex : prevIndex;
|
|
59224
|
+
|
|
59225
|
+
if (onSortOver && this.newIndex !== oldIndex) {
|
|
59226
|
+
onSortOver({
|
|
59227
|
+
collection: this.manager.active.collection,
|
|
59228
|
+
index: this.index,
|
|
59229
|
+
newIndex: this.newIndex,
|
|
59230
|
+
oldIndex: oldIndex,
|
|
59231
|
+
isKeySorting: isKeySorting,
|
|
59232
|
+
nodes: nodes,
|
|
59233
|
+
helper: this.helper
|
|
59234
|
+
});
|
|
59235
|
+
}
|
|
59236
|
+
}
|
|
59237
|
+
}, {
|
|
59238
|
+
key: "getWrappedInstance",
|
|
59239
|
+
value: function getWrappedInstance() {
|
|
59240
|
+
invariant_1(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call');
|
|
59241
|
+
return this.wrappedInstance.current;
|
|
59242
|
+
}
|
|
59243
|
+
}, {
|
|
59244
|
+
key: "getContainer",
|
|
59245
|
+
value: function getContainer() {
|
|
59246
|
+
var getContainer = this.props.getContainer;
|
|
59247
|
+
|
|
59248
|
+
if (typeof getContainer !== 'function') {
|
|
59249
|
+
return require$$2.findDOMNode(this);
|
|
59250
|
+
}
|
|
59251
|
+
|
|
59252
|
+
return getContainer(config.withRef ? this.getWrappedInstance() : undefined);
|
|
59253
|
+
}
|
|
59254
|
+
}, {
|
|
59255
|
+
key: "render",
|
|
59256
|
+
value: function render() {
|
|
59257
|
+
var ref = config.withRef ? this.wrappedInstance : null;
|
|
59258
|
+
return React.createElement(SortableContext$1.Provider, {
|
|
59259
|
+
value: this.sortableContextValue
|
|
59260
|
+
}, React.createElement(WrappedComponent, _extends$5({
|
|
59261
|
+
ref: ref
|
|
59262
|
+
}, omit$1(this.props, omittedProps))));
|
|
59263
|
+
}
|
|
59264
|
+
}, {
|
|
59265
|
+
key: "helperContainer",
|
|
59266
|
+
get: function get() {
|
|
59267
|
+
var helperContainer = this.props.helperContainer;
|
|
59268
|
+
|
|
59269
|
+
if (typeof helperContainer === 'function') {
|
|
59270
|
+
return helperContainer();
|
|
59271
|
+
}
|
|
59272
|
+
|
|
59273
|
+
return this.props.helperContainer || this.document.body;
|
|
59274
|
+
}
|
|
59275
|
+
}, {
|
|
59276
|
+
key: "containerScrollDelta",
|
|
59277
|
+
get: function get() {
|
|
59278
|
+
var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer;
|
|
59279
|
+
|
|
59280
|
+
if (useWindowAsScrollContainer) {
|
|
59281
|
+
return {
|
|
59282
|
+
left: 0,
|
|
59283
|
+
top: 0
|
|
59284
|
+
};
|
|
59285
|
+
}
|
|
59286
|
+
|
|
59287
|
+
return {
|
|
59288
|
+
left: this.scrollContainer.scrollLeft - this.initialScroll.left,
|
|
59289
|
+
top: this.scrollContainer.scrollTop - this.initialScroll.top
|
|
59290
|
+
};
|
|
59291
|
+
}
|
|
59292
|
+
}, {
|
|
59293
|
+
key: "windowScrollDelta",
|
|
59294
|
+
get: function get() {
|
|
59295
|
+
return {
|
|
59296
|
+
left: this.contentWindow.pageXOffset - this.initialWindowScroll.left,
|
|
59297
|
+
top: this.contentWindow.pageYOffset - this.initialWindowScroll.top
|
|
59298
|
+
};
|
|
59299
|
+
}
|
|
59300
|
+
}]);
|
|
59301
|
+
|
|
59302
|
+
return WithSortableContainer;
|
|
59303
|
+
}(React.Component), _defineProperty$1(_class, "displayName", provideDisplayName('sortableList', WrappedComponent)), _defineProperty$1(_class, "defaultProps", defaultProps), _defineProperty$1(_class, "propTypes", propTypes$1), _temp;
|
|
59304
|
+
}
|
|
59305
|
+
|
|
59306
|
+
var propTypes$1$1 = {
|
|
59307
|
+
index: propTypes.number.isRequired,
|
|
59308
|
+
collection: propTypes.oneOfType([propTypes.number, propTypes.string]),
|
|
59309
|
+
disabled: propTypes.bool
|
|
59310
|
+
};
|
|
59311
|
+
var omittedProps$1 = Object.keys(propTypes$1$1);
|
|
59312
|
+
function sortableElement(WrappedComponent) {
|
|
59313
|
+
var _class, _temp;
|
|
59314
|
+
|
|
59315
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
59316
|
+
withRef: false
|
|
59317
|
+
};
|
|
59318
|
+
return _temp = _class = function (_React$Component) {
|
|
59319
|
+
_inherits(WithSortableElement, _React$Component);
|
|
59320
|
+
|
|
59321
|
+
function WithSortableElement() {
|
|
59322
|
+
var _getPrototypeOf2;
|
|
59323
|
+
|
|
59324
|
+
var _this;
|
|
59325
|
+
|
|
59326
|
+
_classCallCheck(this, WithSortableElement);
|
|
59327
|
+
|
|
59328
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
59329
|
+
args[_key] = arguments[_key];
|
|
59330
|
+
}
|
|
59331
|
+
|
|
59332
|
+
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(WithSortableElement)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
59333
|
+
|
|
59334
|
+
_defineProperty$1(_assertThisInitialized(_assertThisInitialized(_this)), "wrappedInstance", React.createRef());
|
|
59335
|
+
|
|
59336
|
+
return _this;
|
|
59337
|
+
}
|
|
59338
|
+
|
|
59339
|
+
_createClass(WithSortableElement, [{
|
|
59340
|
+
key: "componentDidMount",
|
|
59341
|
+
value: function componentDidMount() {
|
|
59342
|
+
this.register();
|
|
59343
|
+
}
|
|
59344
|
+
}, {
|
|
59345
|
+
key: "componentDidUpdate",
|
|
59346
|
+
value: function componentDidUpdate(prevProps) {
|
|
59347
|
+
if (this.node) {
|
|
59348
|
+
if (prevProps.index !== this.props.index) {
|
|
59349
|
+
this.node.sortableInfo.index = this.props.index;
|
|
59350
|
+
}
|
|
59351
|
+
|
|
59352
|
+
if (prevProps.disabled !== this.props.disabled) {
|
|
59353
|
+
this.node.sortableInfo.disabled = this.props.disabled;
|
|
59354
|
+
}
|
|
59355
|
+
}
|
|
59356
|
+
|
|
59357
|
+
if (prevProps.collection !== this.props.collection) {
|
|
59358
|
+
this.unregister(prevProps.collection);
|
|
59359
|
+
this.register();
|
|
59360
|
+
}
|
|
59361
|
+
}
|
|
59362
|
+
}, {
|
|
59363
|
+
key: "componentWillUnmount",
|
|
59364
|
+
value: function componentWillUnmount() {
|
|
59365
|
+
this.unregister();
|
|
59366
|
+
}
|
|
59367
|
+
}, {
|
|
59368
|
+
key: "register",
|
|
59369
|
+
value: function register() {
|
|
59370
|
+
var _this$props = this.props,
|
|
59371
|
+
collection = _this$props.collection,
|
|
59372
|
+
disabled = _this$props.disabled,
|
|
59373
|
+
index = _this$props.index;
|
|
59374
|
+
var node = require$$2.findDOMNode(this);
|
|
59375
|
+
node.sortableInfo = {
|
|
59376
|
+
collection: collection,
|
|
59377
|
+
disabled: disabled,
|
|
59378
|
+
index: index,
|
|
59379
|
+
manager: this.context.manager
|
|
59380
|
+
};
|
|
59381
|
+
this.node = node;
|
|
59382
|
+
this.ref = {
|
|
59383
|
+
node: node
|
|
59384
|
+
};
|
|
59385
|
+
this.context.manager.add(collection, this.ref);
|
|
59386
|
+
}
|
|
59387
|
+
}, {
|
|
59388
|
+
key: "unregister",
|
|
59389
|
+
value: function unregister() {
|
|
59390
|
+
var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.collection;
|
|
59391
|
+
this.context.manager.remove(collection, this.ref);
|
|
59392
|
+
}
|
|
59393
|
+
}, {
|
|
59394
|
+
key: "getWrappedInstance",
|
|
59395
|
+
value: function getWrappedInstance() {
|
|
59396
|
+
invariant_1(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call');
|
|
59397
|
+
return this.wrappedInstance.current;
|
|
59398
|
+
}
|
|
59399
|
+
}, {
|
|
59400
|
+
key: "render",
|
|
59401
|
+
value: function render() {
|
|
59402
|
+
var ref = config.withRef ? this.wrappedInstance : null;
|
|
59403
|
+
return React.createElement(WrappedComponent, _extends$5({
|
|
59404
|
+
ref: ref
|
|
59405
|
+
}, omit$1(this.props, omittedProps$1)));
|
|
59406
|
+
}
|
|
59407
|
+
}]);
|
|
59408
|
+
|
|
59409
|
+
return WithSortableElement;
|
|
59410
|
+
}(React.Component), _defineProperty$1(_class, "displayName", provideDisplayName('sortableElement', WrappedComponent)), _defineProperty$1(_class, "contextType", SortableContext$1), _defineProperty$1(_class, "propTypes", propTypes$1$1), _defineProperty$1(_class, "defaultProps", {
|
|
59411
|
+
collection: 0
|
|
59412
|
+
}), _temp;
|
|
59413
|
+
}
|
|
59414
|
+
|
|
57769
59415
|
var ProCardActions = function ProCardActions(props) {
|
|
57770
59416
|
var actions = props.actions,
|
|
57771
59417
|
prefixCls = props.prefixCls;
|
|
@@ -73993,8 +75639,26 @@
|
|
|
73993
75639
|
editConfig: editConfig
|
|
73994
75640
|
};
|
|
73995
75641
|
|
|
73996
|
-
var _excluded$$ = ["dataSource", "autoSize", "columns", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "customCheck", "rowSelection", "columnsState", "tableRowType"]
|
|
75642
|
+
var _excluded$$ = ["dataSource", "autoSize", "columns", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "customCheck", "rowSelection", "columnsState", "tableRowType"],
|
|
75643
|
+
_excluded2$h = ["className", "style"];
|
|
73997
75644
|
var Summary = ProviderWarp.Summary;
|
|
75645
|
+
var DragHandle = sortableHandle(function () {
|
|
75646
|
+
return /*#__PURE__*/React__default['default'].createElement(MenuOutlined$2, {
|
|
75647
|
+
style: {
|
|
75648
|
+
cursor: 'grab',
|
|
75649
|
+
color: '#999'
|
|
75650
|
+
}
|
|
75651
|
+
});
|
|
75652
|
+
});
|
|
75653
|
+
var sortDefaultColumnItem = {
|
|
75654
|
+
title: '排序',
|
|
75655
|
+
dataIndex: 'sort',
|
|
75656
|
+
width: 60,
|
|
75657
|
+
className: 'drag-visible',
|
|
75658
|
+
render: function render() {
|
|
75659
|
+
return /*#__PURE__*/React__default['default'].createElement(DragHandle, null);
|
|
75660
|
+
}
|
|
75661
|
+
};
|
|
73998
75662
|
var ResetTable = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
73999
75663
|
var dataSource = props.dataSource,
|
|
74000
75664
|
autoSize = props.autoSize,
|
|
@@ -74007,7 +75671,8 @@
|
|
|
74007
75671
|
hiddenPage = props.hiddenPage,
|
|
74008
75672
|
loading = props.loading,
|
|
74009
75673
|
_props$virtual = props.virtual,
|
|
74010
|
-
|
|
75674
|
+
_props$sortOpen = props.sortOpen,
|
|
75675
|
+
sortOpen = _props$sortOpen === void 0 ? false : _props$sortOpen,
|
|
74011
75676
|
customCheck = props.customCheck,
|
|
74012
75677
|
rowSelection = props.rowSelection,
|
|
74013
75678
|
columnsState = props.columnsState,
|
|
@@ -74041,7 +75706,49 @@
|
|
|
74041
75706
|
var _useState7 = React.useState(),
|
|
74042
75707
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
74043
75708
|
columnsStateMap = _useState8[0],
|
|
74044
|
-
setColumnsStateMap = _useState8[1];
|
|
75709
|
+
setColumnsStateMap = _useState8[1];
|
|
75710
|
+
|
|
75711
|
+
var SortableItem = sortableElement(function (props) {
|
|
75712
|
+
return /*#__PURE__*/React__default['default'].createElement("tr", props);
|
|
75713
|
+
});
|
|
75714
|
+
var SortContainer = sortableContainer(function (props) {
|
|
75715
|
+
return /*#__PURE__*/React__default['default'].createElement("tbody", props);
|
|
75716
|
+
});
|
|
75717
|
+
|
|
75718
|
+
var onSortEnd = function onSortEnd(_ref) {
|
|
75719
|
+
var oldIndex = _ref.oldIndex,
|
|
75720
|
+
newIndex = _ref.newIndex;
|
|
75721
|
+
|
|
75722
|
+
if (oldIndex !== newIndex) {
|
|
75723
|
+
var newData = arrayMove(dataSource, oldIndex, newIndex).filter(function (el) {
|
|
75724
|
+
return !!el;
|
|
75725
|
+
});
|
|
75726
|
+
console.log(newData, 'nnnnnn'); // setDataSource([...newData])
|
|
75727
|
+
}
|
|
75728
|
+
};
|
|
75729
|
+
|
|
75730
|
+
var DraggableContainer = function DraggableContainer(props) {
|
|
75731
|
+
return /*#__PURE__*/React__default['default'].createElement(SortContainer, _extends({
|
|
75732
|
+
useDragHandle: true,
|
|
75733
|
+
disableAutoscroll: true,
|
|
75734
|
+
helperClass: "row-dragging",
|
|
75735
|
+
onSortEnd: onSortEnd
|
|
75736
|
+
}, props));
|
|
75737
|
+
};
|
|
75738
|
+
|
|
75739
|
+
var DraggableBodyRow = function DraggableBodyRow(props) {
|
|
75740
|
+
var className = props.className,
|
|
75741
|
+
style = props.style,
|
|
75742
|
+
restProps = _objectWithoutProperties(props, _excluded2$h);
|
|
75743
|
+
|
|
75744
|
+
var index = dataSource.findIndex(function (x) {
|
|
75745
|
+
return x[rowKey || 'index'] === restProps['data-row-key'];
|
|
75746
|
+
});
|
|
75747
|
+
console.log(dataSource, restProps, 222, index);
|
|
75748
|
+
return /*#__PURE__*/React__default['default'].createElement(SortableItem, _extends({
|
|
75749
|
+
index: index
|
|
75750
|
+
}, restProps));
|
|
75751
|
+
}; // 原宽度,先宽度,序号
|
|
74045
75752
|
|
|
74046
75753
|
|
|
74047
75754
|
var handleResize = function handleResize(sc, size, index) {
|
|
@@ -74058,7 +75765,7 @@
|
|
|
74058
75765
|
};
|
|
74059
75766
|
|
|
74060
75767
|
var resetColumns = React.useCallback(function () {
|
|
74061
|
-
|
|
75768
|
+
var result = useColumns.filter(function (item) {
|
|
74062
75769
|
return item.show !== false;
|
|
74063
75770
|
}).map(function (col, index) {
|
|
74064
75771
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -74073,7 +75780,9 @@
|
|
|
74073
75780
|
}
|
|
74074
75781
|
});
|
|
74075
75782
|
});
|
|
74076
|
-
|
|
75783
|
+
console.log(sortOpen ? [sortDefaultColumnItem].concat(_toConsumableArray(result)) : result, sortOpen, 111);
|
|
75784
|
+
return sortOpen ? [sortDefaultColumnItem].concat(_toConsumableArray(result)) : result;
|
|
75785
|
+
}, [useColumns, sortOpen]);
|
|
74077
75786
|
React.useEffect(function () {
|
|
74078
75787
|
setColumns(columns);
|
|
74079
75788
|
}, [columns]); // 行点击事件
|
|
@@ -74211,10 +75920,10 @@
|
|
|
74211
75920
|
|
|
74212
75921
|
columns === null || columns === void 0 ? void 0 : columns.forEach(function (item) {
|
|
74213
75922
|
/** 目前支持三种 */
|
|
74214
|
-
var
|
|
74215
|
-
order =
|
|
74216
|
-
show =
|
|
74217
|
-
fixed =
|
|
75923
|
+
var _ref2 = obj[item.dataIndex || item.key] || {},
|
|
75924
|
+
order = _ref2.order,
|
|
75925
|
+
show = _ref2.show,
|
|
75926
|
+
fixed = _ref2.fixed;
|
|
74218
75927
|
|
|
74219
75928
|
obj[item.dataIndex || item.key] = {
|
|
74220
75929
|
fixed: fixed || item.fixed,
|
|
@@ -74282,7 +75991,12 @@
|
|
|
74282
75991
|
}, /*#__PURE__*/React__default['default'].createElement(ProviderWarp, _extends({}, config, {
|
|
74283
75992
|
loading: loading,
|
|
74284
75993
|
dataSource: dataSource,
|
|
74285
|
-
components:
|
|
75994
|
+
components: sortOpen ? {
|
|
75995
|
+
body: {
|
|
75996
|
+
wrapper: DraggableContainer,
|
|
75997
|
+
row: DraggableBodyRow
|
|
75998
|
+
}
|
|
75999
|
+
} : null,
|
|
74286
76000
|
tableClassName: "lm_protable",
|
|
74287
76001
|
summary: function summary(pageData) {
|
|
74288
76002
|
return _summary && _summary(pageData, resultColumns);
|
|
@@ -76731,7 +78445,7 @@
|
|
|
76731
78445
|
};
|
|
76732
78446
|
|
|
76733
78447
|
var _excluded$12 = ["item"],
|
|
76734
|
-
_excluded2$
|
|
78448
|
+
_excluded2$i = ["item"],
|
|
76735
78449
|
_excluded3$4 = ["type"];
|
|
76736
78450
|
|
|
76737
78451
|
var imgEmpty$1 = require('./icon_placeholder.png');
|
|
@@ -76913,7 +78627,7 @@
|
|
|
76913
78627
|
className: "filter_list"
|
|
76914
78628
|
}, function (_ref6) {
|
|
76915
78629
|
var item = _ref6.item,
|
|
76916
|
-
resetProps = _objectWithoutProperties(_ref6, _excluded2$
|
|
78630
|
+
resetProps = _objectWithoutProperties(_ref6, _excluded2$i);
|
|
76917
78631
|
|
|
76918
78632
|
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread(_objectSpread({}, resetProps), {}, {
|
|
76919
78633
|
className: classnames('filter_item', {
|
|
@@ -79970,7 +81684,7 @@
|
|
|
79970
81684
|
}
|
|
79971
81685
|
});
|
|
79972
81686
|
|
|
79973
|
-
var propTypes$
|
|
81687
|
+
var propTypes$2 = createCommonjsModule(function (module, exports) {
|
|
79974
81688
|
|
|
79975
81689
|
exports.__esModule = true;
|
|
79976
81690
|
exports.resizableProps = void 0;
|
|
@@ -80358,7 +82072,7 @@
|
|
|
80358
82072
|
}(React.Component);
|
|
80359
82073
|
|
|
80360
82074
|
exports.default = Resizable;
|
|
80361
|
-
Resizable.propTypes = propTypes$
|
|
82075
|
+
Resizable.propTypes = propTypes$2.resizableProps;
|
|
80362
82076
|
Resizable.defaultProps = {
|
|
80363
82077
|
axis: 'both',
|
|
80364
82078
|
handleSize: [20, 20],
|
|
@@ -80505,7 +82219,7 @@
|
|
|
80505
82219
|
}(React.Component);
|
|
80506
82220
|
|
|
80507
82221
|
exports.default = ResizableBox;
|
|
80508
|
-
ResizableBox.propTypes = _objectSpread(_objectSpread({}, propTypes$
|
|
82222
|
+
ResizableBox.propTypes = _objectSpread(_objectSpread({}, propTypes$2.resizableProps), {}, {
|
|
80509
82223
|
children: _propTypes.default.element
|
|
80510
82224
|
});
|
|
80511
82225
|
});
|
|
@@ -80514,7 +82228,7 @@
|
|
|
80514
82228
|
var ResizableBox = ResizableBox_1.default;
|
|
80515
82229
|
|
|
80516
82230
|
var _excluded$1e = ["width", "onResize", "children"],
|
|
80517
|
-
_excluded2$
|
|
82231
|
+
_excluded2$j = ["children"],
|
|
80518
82232
|
_excluded3$5 = ["children", "style"],
|
|
80519
82233
|
_excluded4$2 = ["children"],
|
|
80520
82234
|
_excluded5$1 = ["style", "children"],
|
|
@@ -80681,7 +82395,7 @@
|
|
|
80681
82395
|
|
|
80682
82396
|
var VCell = function VCell(props) {
|
|
80683
82397
|
var children = props.children,
|
|
80684
|
-
restProps = _objectWithoutProperties(props, _excluded2$
|
|
82398
|
+
restProps = _objectWithoutProperties(props, _excluded2$j);
|
|
80685
82399
|
|
|
80686
82400
|
return /*#__PURE__*/React__default['default'].createElement("td", restProps, children);
|
|
80687
82401
|
};
|
|
@@ -81882,7 +83596,7 @@
|
|
|
81882
83596
|
ResizeSize$2.Summary = Summary$1;
|
|
81883
83597
|
|
|
81884
83598
|
var _excluded$1i = ["children"],
|
|
81885
|
-
_excluded2$
|
|
83599
|
+
_excluded2$k = ["children", "size", "buttonStyle", "direction", "className"];
|
|
81886
83600
|
|
|
81887
83601
|
var LMRadio = function LMRadio(props) {
|
|
81888
83602
|
var children = props.children,
|
|
@@ -81901,7 +83615,7 @@
|
|
|
81901
83615
|
_props$direction = props.direction,
|
|
81902
83616
|
direction = _props$direction === void 0 ? 'row' : _props$direction,
|
|
81903
83617
|
className = props.className,
|
|
81904
|
-
restProps = _objectWithoutProperties(props, _excluded2$
|
|
83618
|
+
restProps = _objectWithoutProperties(props, _excluded2$k);
|
|
81905
83619
|
|
|
81906
83620
|
console.log(children, 'rrr');
|
|
81907
83621
|
return /*#__PURE__*/React__default['default'].createElement(_Radio__default['default'].Group, _extends({
|
|
@@ -82621,12 +84335,11 @@
|
|
|
82621
84335
|
setVisible(false);
|
|
82622
84336
|
};
|
|
82623
84337
|
|
|
82624
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(
|
|
82625
|
-
|
|
82626
|
-
|
|
82627
|
-
|
|
82628
|
-
}
|
|
82629
|
-
onClick: openSetting
|
|
84338
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(LMButton, {
|
|
84339
|
+
onClick: openSetting,
|
|
84340
|
+
icon: /*#__PURE__*/React__default['default'].createElement(IconFont$1, {
|
|
84341
|
+
type: 'lmweb-setting'
|
|
84342
|
+
})
|
|
82630
84343
|
}), /*#__PURE__*/React__default['default'].createElement(LMDrawer, {
|
|
82631
84344
|
className: classnames(className, prefixCls$b),
|
|
82632
84345
|
title: "\u4E2A\u6027\u5316\u8BBE\u7F6E",
|