linkmore-design 1.1.19 → 1.1.21

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.
Files changed (74) hide show
  1. package/dist/Descriptions/Cell.d.ts +1 -0
  2. package/dist/Descriptions/Item.d.ts +1 -0
  3. package/dist/LmDrag/LmDrag.d.ts +5 -0
  4. package/dist/LmDrag/components/DndContainer.d.ts +3 -0
  5. package/dist/LmDrag/components/sortableBox.d.ts +5 -0
  6. package/dist/LmDrag/components/sortableItem.d.ts +7 -0
  7. package/dist/LmDrag/demos/basic.d.ts +2 -0
  8. package/dist/LmDrag/index.d.ts +10 -0
  9. package/dist/LmDrag/style/index.d.ts +1 -0
  10. package/dist/LmDrag/style/variables.d.ts +1 -0
  11. package/dist/LmDrag/wrapper/Root.d.ts +3 -0
  12. package/dist/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.umd.js +524 -9
  15. package/dist/index.umd.min.js +8 -8
  16. package/es/Descriptions/Cell.d.ts +1 -0
  17. package/es/Descriptions/Cell.js +5 -2
  18. package/es/Descriptions/Item.d.ts +1 -0
  19. package/es/Descriptions/Row.js +6 -1
  20. package/es/LmDrag/LmDrag.d.ts +5 -0
  21. package/es/LmDrag/LmDrag.js +30 -0
  22. package/es/LmDrag/components/DndContainer.d.ts +3 -0
  23. package/es/LmDrag/components/DndContainer.js +121 -0
  24. package/es/LmDrag/components/sortableBox.d.ts +5 -0
  25. package/es/LmDrag/components/sortableBox.js +23 -0
  26. package/es/LmDrag/components/sortableItem.d.ts +7 -0
  27. package/es/LmDrag/components/sortableItem.js +41 -0
  28. package/es/LmDrag/index.d.ts +10 -0
  29. package/es/LmDrag/index.js +3 -0
  30. package/es/LmDrag/style/index.css +0 -0
  31. package/es/LmDrag/style/index.d.ts +1 -0
  32. package/es/LmDrag/style/index.js +1 -0
  33. package/es/LmDrag/style/variables.css +0 -0
  34. package/es/LmDrag/style/variables.d.ts +1 -0
  35. package/es/LmDrag/style/variables.js +1 -0
  36. package/es/LmDrag/wrapper/Root.d.ts +3 -0
  37. package/es/LmDrag/wrapper/Root.js +12 -0
  38. package/es/LmUpload/LmUpload.js +2 -1
  39. package/es/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
  40. package/es/LmUpload/UploadList/ItemPictureCard.js +9 -1
  41. package/es/LmUpload/UploadList/index.js +55 -2
  42. package/es/LmUpload/fns/index.js +2 -1
  43. package/es/index.d.ts +1 -0
  44. package/es/index.js +2 -1
  45. package/lib/Descriptions/Cell.d.ts +1 -0
  46. package/lib/Descriptions/Cell.js +5 -2
  47. package/lib/Descriptions/Item.d.ts +1 -0
  48. package/lib/Descriptions/Row.js +6 -1
  49. package/lib/LmDrag/LmDrag.d.ts +5 -0
  50. package/lib/LmDrag/LmDrag.js +44 -0
  51. package/lib/LmDrag/components/DndContainer.d.ts +3 -0
  52. package/lib/LmDrag/components/DndContainer.js +138 -0
  53. package/lib/LmDrag/components/sortableBox.d.ts +5 -0
  54. package/lib/LmDrag/components/sortableBox.js +37 -0
  55. package/lib/LmDrag/components/sortableItem.d.ts +7 -0
  56. package/lib/LmDrag/components/sortableItem.js +54 -0
  57. package/lib/LmDrag/index.d.ts +10 -0
  58. package/lib/LmDrag/index.js +19 -0
  59. package/lib/LmDrag/style/index.css +0 -0
  60. package/lib/LmDrag/style/index.d.ts +1 -0
  61. package/lib/LmDrag/style/index.js +3 -0
  62. package/lib/LmDrag/style/variables.css +0 -0
  63. package/lib/LmDrag/style/variables.d.ts +1 -0
  64. package/lib/LmDrag/style/variables.js +3 -0
  65. package/lib/LmDrag/wrapper/Root.d.ts +3 -0
  66. package/lib/LmDrag/wrapper/Root.js +26 -0
  67. package/lib/LmUpload/LmUpload.js +2 -1
  68. package/lib/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
  69. package/lib/LmUpload/UploadList/ItemPictureCard.js +9 -1
  70. package/lib/LmUpload/UploadList/index.js +56 -2
  71. package/lib/LmUpload/fns/index.js +2 -1
  72. package/lib/index.d.ts +1 -0
  73. package/lib/index.js +15 -1
  74. package/package.json +1 -1
package/dist/index.umd.js CHANGED
@@ -181483,10 +181483,11 @@
181483
181483
  }, [uid]); // 从对象中读取存在的指定属性
181484
181484
 
181485
181485
  var getFileHasValue = React.useCallback(function (obj) {
181486
+ if (!obj) return '';
181486
181487
  var extend = [uid, 'fileName'];
181487
181488
  var val = '';
181488
181489
  extend.forEach(function (v) {
181489
- if (!val) val = obj[v];
181490
+ if (!val && obj[v]) val = obj[v];
181490
181491
  });
181491
181492
  return val;
181492
181493
  }, [uid]); // 获取当前的文件列表
@@ -182185,7 +182186,8 @@
182185
182186
  var PictureItem$1 = function PictureItem(_ref) {
182186
182187
  var file = _ref.file,
182187
182188
  index = _ref.index,
182188
- instance = _ref.instance;
182189
+ instance = _ref.instance,
182190
+ listeners = _ref.listeners;
182189
182191
  var dispatch = instance.dispatch,
182190
182192
  readOnly = instance.readOnly,
182191
182193
  size = instance.size,
@@ -182269,6 +182271,13 @@
182269
182271
  style: {
182270
182272
  fontSize: resetSize.fontSize
182271
182273
  }
182274
+ })), /*#__PURE__*/React__default['default'].createElement("div", _objectSpread({
182275
+ className: "action_preview"
182276
+ }, listeners), /*#__PURE__*/React__default['default'].createElement(IconFont, {
182277
+ type: "lmweb-drag",
182278
+ style: {
182279
+ fontSize: resetSize.fontSize
182280
+ }
182272
182281
  })), !readOnly && /*#__PURE__*/React__default['default'].createElement("div", {
182273
182282
  className: "action_delete",
182274
182283
  onClick: function onClick() {
@@ -182300,11 +182309,15 @@
182300
182309
 
182301
182310
  var LmUploadList = function LmUploadList(_ref) {
182302
182311
  var instance = _ref.instance;
182303
- var getFileHasValue = instance.getFileHasValue,
182312
+ var uid = instance.uid,
182313
+ dispatch = instance.dispatch,
182314
+ getFileHasValue = instance.getFileHasValue,
182304
182315
  getFileList = instance.getFileList,
182305
182316
  itemRender = instance.itemRender,
182306
182317
  listType = instance.listType,
182307
- showUploadList = instance.showUploadList;
182318
+ showUploadList = instance.showUploadList,
182319
+ enableDrag = instance.enableDrag,
182320
+ fileNames = instance.fileNames;
182308
182321
  if (!showUploadList) return null;
182309
182322
  var fileList = React.useMemo(function () {
182310
182323
  var _getFileList;
@@ -182313,6 +182326,54 @@
182313
182326
  return a.seq - b.seq;
182314
182327
  });
182315
182328
  }, [getFileList]);
182329
+
182330
+ var handleMove = function handleMove(active, over, fileList) {
182331
+ try {
182332
+ var fileMap = fileList.map(function (v) {
182333
+ if (getFileHasValue(v) === getFileHasValue(active)) {
182334
+ return _objectSpread(_objectSpread({}, v), {}, {
182335
+ seq: over[fileNames.seq]
182336
+ });
182337
+ }
182338
+
182339
+ if (getFileHasValue(v) === getFileHasValue(over)) {
182340
+ return _objectSpread(_objectSpread({}, v), {}, {
182341
+ seq: active[fileNames.seq]
182342
+ });
182343
+ }
182344
+
182345
+ return v;
182346
+ });
182347
+ dispatch({
182348
+ type: 'changeFileList',
182349
+ fileList: fileMap
182350
+ });
182351
+ } catch (error) {
182352
+ console.log('移动出现了错误', error);
182353
+ }
182354
+ };
182355
+
182356
+ if (enableDrag) {
182357
+ return /*#__PURE__*/React__default['default'].createElement(LmDrag$1, {
182358
+ options: fileList,
182359
+ rowKey: uid,
182360
+ move: handleMove
182361
+ }, function (_ref2) {
182362
+ var item = _ref2.item,
182363
+ listeners = _ref2.listeners,
182364
+ index = _ref2.index;
182365
+ return render$1(itemRender || RenderItem, {
182366
+ type: listType,
182367
+ key: getFileHasValue(item) || index,
182368
+ index: index,
182369
+ file: item,
182370
+ fileList: fileList,
182371
+ instance: instance,
182372
+ listeners: listeners
182373
+ });
182374
+ });
182375
+ }
182376
+
182316
182377
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, fileList === null || fileList === void 0 ? void 0 : fileList.map(function (file, idx) {
182317
182378
  return render$1(itemRender || RenderItem, {
182318
182379
  type: listType,
@@ -182543,7 +182604,7 @@
182543
182604
  size: 100,
182544
182605
  fileSize: 10,
182545
182606
  fileSizeType: 'M',
182546
- uid: 'uid',
182607
+ uid: 'fileName',
182547
182608
  accept: '',
182548
182609
  type: ['jpg', 'jpeg', 'png'],
182549
182610
  listType: 'card',
@@ -182558,6 +182619,7 @@
182558
182619
  itemRender: null,
182559
182620
  enabledPreview: true,
182560
182621
  enabledCrop: false,
182622
+ enableDrag: false,
182561
182623
  enabledOss: false,
182562
182624
  // oss配置
182563
182625
  ossConfig: function ossConfig() {
@@ -227257,6 +227319,20 @@
227257
227319
  return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
227258
227320
  }
227259
227321
 
227322
+ function getRelativeTransformOrigin(event, rect) {
227323
+ const eventCoordinates = getEventCoordinates(event);
227324
+
227325
+ if (!eventCoordinates) {
227326
+ return '0 0';
227327
+ }
227328
+
227329
+ const transformOrigin = {
227330
+ x: (eventCoordinates.x - rect.left) / rect.width * 100,
227331
+ y: (eventCoordinates.y - rect.top) / rect.height * 100
227332
+ };
227333
+ return `${transformOrigin.x}% ${transformOrigin.y}%`;
227334
+ }
227335
+
227260
227336
  /**
227261
227337
  * Sort collisions from smallest to greatest value
227262
227338
  */
@@ -229650,6 +229726,237 @@
229650
229726
  };
229651
229727
  }
229652
229728
 
229729
+ const defaultDropAnimation = {
229730
+ duration: 250,
229731
+ easing: 'ease',
229732
+ dragSourceOpacity: 0
229733
+ };
229734
+ function useDropAnimation({
229735
+ animate,
229736
+ adjustScale,
229737
+ activeId,
229738
+ draggableNodes,
229739
+ duration,
229740
+ dragSourceOpacity,
229741
+ easing,
229742
+ node,
229743
+ transform
229744
+ }) {
229745
+ const [dropAnimationComplete, setDropAnimationComplete] = React.useState(false);
229746
+ useIsomorphicLayoutEffect$a(() => {
229747
+ var _draggableNodes$activ;
229748
+
229749
+ if (!animate || !activeId || !easing || !duration) {
229750
+ if (animate) {
229751
+ setDropAnimationComplete(true);
229752
+ }
229753
+
229754
+ return;
229755
+ }
229756
+
229757
+ const finalNode = (_draggableNodes$activ = draggableNodes[activeId]) == null ? void 0 : _draggableNodes$activ.node.current;
229758
+
229759
+ if (transform && node && finalNode && finalNode.parentNode !== null) {
229760
+ const fromNode = getMeasurableNode(node);
229761
+
229762
+ if (fromNode) {
229763
+ const from = fromNode.getBoundingClientRect();
229764
+ const to = getTransformAgnosticClientRect(finalNode);
229765
+ const delta = {
229766
+ x: from.left - to.left,
229767
+ y: from.top - to.top
229768
+ };
229769
+
229770
+ if (Math.abs(delta.x) || Math.abs(delta.y)) {
229771
+ const scaleDelta = {
229772
+ scaleX: adjustScale ? to.width * transform.scaleX / from.width : 1,
229773
+ scaleY: adjustScale ? to.height * transform.scaleY / from.height : 1
229774
+ };
229775
+ const finalTransform = CSS.Transform.toString({
229776
+ x: transform.x - delta.x,
229777
+ y: transform.y - delta.y,
229778
+ ...scaleDelta
229779
+ });
229780
+ const originalOpacity = finalNode.style.opacity;
229781
+
229782
+ if (dragSourceOpacity != null) {
229783
+ finalNode.style.opacity = `${dragSourceOpacity}`;
229784
+ }
229785
+
229786
+ const nodeAnimation = node.animate([{
229787
+ transform: CSS.Transform.toString(transform)
229788
+ }, {
229789
+ transform: finalTransform
229790
+ }], {
229791
+ easing,
229792
+ duration
229793
+ });
229794
+
229795
+ nodeAnimation.onfinish = () => {
229796
+ node.style.display = 'none';
229797
+ setDropAnimationComplete(true);
229798
+
229799
+ if (finalNode && dragSourceOpacity != null) {
229800
+ finalNode.style.opacity = originalOpacity;
229801
+ }
229802
+ };
229803
+
229804
+ return;
229805
+ }
229806
+ }
229807
+ }
229808
+
229809
+ setDropAnimationComplete(true);
229810
+ }, [animate, activeId, adjustScale, draggableNodes, duration, easing, dragSourceOpacity, node, transform]);
229811
+ useIsomorphicLayoutEffect$a(() => {
229812
+ if (dropAnimationComplete) {
229813
+ setDropAnimationComplete(false);
229814
+ }
229815
+ }, [dropAnimationComplete]);
229816
+ return dropAnimationComplete;
229817
+ }
229818
+
229819
+ const defaultTransform = {
229820
+ x: 0,
229821
+ y: 0,
229822
+ scaleX: 1,
229823
+ scaleY: 1
229824
+ };
229825
+
229826
+ const defaultTransition = activatorEvent => {
229827
+ const isKeyboardActivator = isKeyboardEvent(activatorEvent);
229828
+ return isKeyboardActivator ? 'transform 250ms ease' : undefined;
229829
+ };
229830
+
229831
+ const DragOverlay = /*#__PURE__*/React__default['default'].memo(({
229832
+ adjustScale = false,
229833
+ children,
229834
+ dropAnimation = defaultDropAnimation,
229835
+ style: styleProp,
229836
+ transition = defaultTransition,
229837
+ modifiers,
229838
+ wrapperElement = 'div',
229839
+ className,
229840
+ zIndex = 999
229841
+ }) => {
229842
+ var _active$id, _attributesSnapshot$c;
229843
+
229844
+ const {
229845
+ active,
229846
+ activeNodeRect,
229847
+ containerNodeRect,
229848
+ draggableNodes,
229849
+ activatorEvent,
229850
+ over,
229851
+ dragOverlay,
229852
+ scrollableAncestors,
229853
+ scrollableAncestorRects,
229854
+ windowRect
229855
+ } = useDndContext();
229856
+ const transform = React.useContext(ActiveDraggableContext);
229857
+ const modifiedTransform = applyModifiers(modifiers, {
229858
+ activatorEvent,
229859
+ active,
229860
+ activeNodeRect,
229861
+ containerNodeRect,
229862
+ draggingNodeRect: dragOverlay.rect,
229863
+ over,
229864
+ overlayNodeRect: dragOverlay.rect,
229865
+ scrollableAncestors,
229866
+ scrollableAncestorRects,
229867
+ transform,
229868
+ windowRect
229869
+ });
229870
+ const isDragging = active !== null;
229871
+ const finalTransform = adjustScale ? modifiedTransform : { ...modifiedTransform,
229872
+ scaleX: 1,
229873
+ scaleY: 1
229874
+ };
229875
+ const initialRect = useLazyMemo(previousValue => {
229876
+ if (isDragging) {
229877
+ if (previousValue) {
229878
+ return previousValue;
229879
+ }
229880
+
229881
+ if (!activeNodeRect) {
229882
+ return null;
229883
+ }
229884
+
229885
+ return { ...activeNodeRect
229886
+ };
229887
+ }
229888
+
229889
+ return null;
229890
+ }, [isDragging, activeNodeRect]);
229891
+ const style = initialRect ? {
229892
+ position: 'fixed',
229893
+ width: initialRect.width,
229894
+ height: initialRect.height,
229895
+ top: initialRect.top,
229896
+ left: initialRect.left,
229897
+ zIndex,
229898
+ transform: CSS.Transform.toString(finalTransform),
229899
+ touchAction: 'none',
229900
+ transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, initialRect) : undefined,
229901
+ transition: typeof transition === 'function' ? transition(activatorEvent) : transition,
229902
+ ...styleProp
229903
+ } : undefined;
229904
+ const attributes = isDragging ? {
229905
+ style,
229906
+ children,
229907
+ className,
229908
+ transform: finalTransform
229909
+ } : undefined;
229910
+ const attributesSnapshot = React.useRef(attributes);
229911
+ const derivedAttributes = attributes != null ? attributes : attributesSnapshot.current;
229912
+ const {
229913
+ children: finalChildren,
229914
+ transform: _,
229915
+ ...otherAttributes
229916
+ } = derivedAttributes != null ? derivedAttributes : {};
229917
+ const prevActiveId = React.useRef((_active$id = active == null ? void 0 : active.id) != null ? _active$id : null);
229918
+ const dropAnimationComplete = useDropAnimation({
229919
+ animate: Boolean(dropAnimation && prevActiveId.current && !active),
229920
+ adjustScale,
229921
+ activeId: prevActiveId.current,
229922
+ draggableNodes,
229923
+ duration: dropAnimation == null ? void 0 : dropAnimation.duration,
229924
+ easing: dropAnimation == null ? void 0 : dropAnimation.easing,
229925
+ dragSourceOpacity: dropAnimation == null ? void 0 : dropAnimation.dragSourceOpacity,
229926
+ node: dragOverlay.nodeRef.current,
229927
+ transform: (_attributesSnapshot$c = attributesSnapshot.current) == null ? void 0 : _attributesSnapshot$c.transform
229928
+ });
229929
+ const shouldRender = Boolean(finalChildren && (children || dropAnimation && !dropAnimationComplete));
229930
+ React.useEffect(() => {
229931
+ if ((active == null ? void 0 : active.id) !== prevActiveId.current) {
229932
+ var _active$id2;
229933
+
229934
+ prevActiveId.current = (_active$id2 = active == null ? void 0 : active.id) != null ? _active$id2 : null;
229935
+ }
229936
+
229937
+ if (active && attributesSnapshot.current !== attributes) {
229938
+ attributesSnapshot.current = attributes;
229939
+ }
229940
+ }, [active, attributes]);
229941
+ React.useEffect(() => {
229942
+ if (dropAnimationComplete) {
229943
+ attributesSnapshot.current = undefined;
229944
+ }
229945
+ }, [dropAnimationComplete]);
229946
+
229947
+ if (!shouldRender) {
229948
+ return null;
229949
+ }
229950
+
229951
+ return React__default['default'].createElement(InternalContext.Provider, {
229952
+ value: defaultInternalContext
229953
+ }, React__default['default'].createElement(ActiveDraggableContext.Provider, {
229954
+ value: defaultTransform
229955
+ }, React__default['default'].createElement(wrapperElement, { ...otherAttributes,
229956
+ ref: dragOverlay.setRef
229957
+ }, finalChildren)));
229958
+ });
229959
+
229653
229960
  /**
229654
229961
  * Move an array item to a different position. Returns a new array with the item moved to the new position.
229655
229962
  */
@@ -229939,7 +230246,7 @@
229939
230246
 
229940
230247
  return newIndex !== index && containerId === previousContainerId;
229941
230248
  };
229942
- const defaultTransition = {
230249
+ const defaultTransition$1 = {
229943
230250
  duration: 200,
229944
230251
  easing: 'ease'
229945
230252
  };
@@ -230010,7 +230317,7 @@
230010
230317
  id,
230011
230318
  strategy: localStrategy,
230012
230319
  resizeObserverConfig,
230013
- transition = defaultTransition
230320
+ transition = defaultTransition$1
230014
230321
  }) {
230015
230322
  const {
230016
230323
  items,
@@ -321488,6 +321795,7 @@
321488
321795
  var itemPrefixCls = _ref.itemPrefixCls,
321489
321796
  component = _ref.component,
321490
321797
  span = _ref.span,
321798
+ rowSpan = _ref.rowSpan,
321491
321799
  className = _ref.className,
321492
321800
  style = _ref.style,
321493
321801
  labelStyle = _ref.labelStyle,
@@ -321504,7 +321812,8 @@
321504
321812
  return /*#__PURE__*/React.createElement(Component, {
321505
321813
  className: classnames((_classNames = {}, _defineProperty$1(_classNames, "".concat(itemPrefixCls, "-item-label"), notEmpty(label)), _defineProperty$1(_classNames, "".concat(itemPrefixCls, "-item-content"), notEmpty(content)), _classNames), className),
321506
321814
  style: style,
321507
- colSpan: span
321815
+ colSpan: span,
321816
+ rowSpan: rowSpan
321508
321817
  }, notEmpty(label) && /*#__PURE__*/React.createElement("span", {
321509
321818
  style: labelStyle
321510
321819
  }, label), notEmpty(content) && /*#__PURE__*/React.createElement("span", {
@@ -321515,7 +321824,8 @@
321515
321824
  return /*#__PURE__*/React.createElement(Component, {
321516
321825
  className: classnames("".concat(itemPrefixCls, "-item"), className),
321517
321826
  style: style,
321518
- colSpan: span
321827
+ colSpan: span,
321828
+ rowSpan: rowSpan
321519
321829
  }, /*#__PURE__*/React.createElement("div", {
321520
321830
  className: "".concat(itemPrefixCls, "-item-container")
321521
321831
  }, (label || label === 0) && /*#__PURE__*/React.createElement("span", {
@@ -321549,6 +321859,8 @@
321549
321859
  contentStyle = _ref3$props.contentStyle,
321550
321860
  _ref3$props$span = _ref3$props.span,
321551
321861
  span = _ref3$props$span === void 0 ? 1 : _ref3$props$span,
321862
+ _ref3$props$rowSpan = _ref3$props.rowSpan,
321863
+ rowSpan = _ref3$props$rowSpan === void 0 ? 1 : _ref3$props$rowSpan,
321552
321864
  key = _ref3.key;
321553
321865
 
321554
321866
  if (typeof component === 'string') {
@@ -321559,6 +321871,7 @@
321559
321871
  labelStyle: _objectSpread(_objectSpread({}, rootLabelStyle), labelStyle),
321560
321872
  contentStyle: _objectSpread(_objectSpread({}, rootContentStyle), contentStyle),
321561
321873
  span: span,
321874
+ rowSpan: rowSpan,
321562
321875
  colon: colon,
321563
321876
  component: component,
321564
321877
  itemPrefixCls: itemPrefixCls,
@@ -321573,6 +321886,7 @@
321573
321886
  className: className,
321574
321887
  style: _objectSpread(_objectSpread(_objectSpread({}, rootLabelStyle), style), labelStyle),
321575
321888
  span: 1,
321889
+ rowSpan: rowSpan,
321576
321890
  colon: colon,
321577
321891
  component: component[0],
321578
321892
  itemPrefixCls: itemPrefixCls,
@@ -321583,6 +321897,7 @@
321583
321897
  className: className,
321584
321898
  style: _objectSpread(_objectSpread(_objectSpread({}, rootContentStyle), style), contentStyle),
321585
321899
  span: span * 2 - 1,
321900
+ rowSpan: rowSpan,
321586
321901
  component: component[1],
321587
321902
  itemPrefixCls: itemPrefixCls,
321588
321903
  bordered: bordered,
@@ -324672,6 +324987,205 @@
324672
324987
 
324673
324988
  var LmImageViewer$1 = /*#__PURE__*/React.forwardRef(LmImageViewer);
324674
324989
 
324990
+ var SortableItem$3 = function SortableItem(_ref) {
324991
+ var index = _ref.index,
324992
+ item = _ref.item,
324993
+ instance = _ref.instance;
324994
+ var children = instance.children,
324995
+ rowKey = instance.rowKey;
324996
+
324997
+ var _useSortable = useSortable({
324998
+ id: item[rowKey] || index,
324999
+ data: {
325000
+ item: item
325001
+ }
325002
+ }),
325003
+ attributes = _useSortable.attributes,
325004
+ listeners = _useSortable.listeners,
325005
+ setNodeRef = _useSortable.setNodeRef,
325006
+ transform = _useSortable.transform,
325007
+ transition = _useSortable.transition;
325008
+
325009
+ var resetStyle = React.useMemo(function () {
325010
+ return {
325011
+ transform: CSS.Transform.toString(transform),
325012
+ transition: transition
325013
+ };
325014
+ }, [transform, transition]);
325015
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", _objectSpread({
325016
+ className: "lm_drag_item",
325017
+ ref: setNodeRef,
325018
+ style: resetStyle
325019
+ }, attributes), children === null || children === void 0 ? void 0 : children({
325020
+ item: item,
325021
+ listeners: listeners,
325022
+ index: index
325023
+ })));
325024
+ };
325025
+
325026
+ var SortableItem$4 = /*#__PURE__*/React__default['default'].memo(SortableItem$3);
325027
+
325028
+ var SortableBox$3 = function SortableBox(_ref) {
325029
+ var instance = _ref.instance;
325030
+ var items = instance.items,
325031
+ rowKey = instance.rowKey,
325032
+ options = instance.options;
325033
+ return /*#__PURE__*/React__default['default'].createElement(SortableContext$1, {
325034
+ items: items,
325035
+ strategy: rectSortingStrategy
325036
+ }, options === null || options === void 0 ? void 0 : options.map(function (item, idx) {
325037
+ return /*#__PURE__*/React__default['default'].createElement(SortableItem$4, {
325038
+ instance: instance,
325039
+ index: idx,
325040
+ key: item[rowKey] || idx,
325041
+ item: item
325042
+ });
325043
+ }));
325044
+ };
325045
+
325046
+ var SortableBox$4 = /*#__PURE__*/React__default['default'].memo(SortableBox$3);
325047
+
325048
+ var DragOver = /*#__PURE__*/React__default['default'].memo(function (_ref) {
325049
+ var instance = _ref.instance;
325050
+ var isDragging = instance.isDragging,
325051
+ activeId = instance.activeId,
325052
+ rowKey = instance.rowKey,
325053
+ children = instance.children,
325054
+ options = instance.options;
325055
+ var item = activeId && options.find(function (v) {
325056
+ return v[rowKey] === activeId;
325057
+ });
325058
+ return /*#__PURE__*/React__default['default'].createElement(DragOverlay, {
325059
+ adjustScale: false
325060
+ }, isDragging ? children({
325061
+ item: item,
325062
+ listeners: {}
325063
+ }) : null);
325064
+ });
325065
+ /*
325066
+ * restrictToParentElement 拖拽限制在父元素内
325067
+ */
325068
+ // 可拖拽容器
325069
+
325070
+ var DndContainer$2 = function DndContainer(_ref2) {
325071
+ var options = _ref2.options,
325072
+ rowKey = _ref2.rowKey,
325073
+ children = _ref2.children,
325074
+ move = _ref2.move;
325075
+
325076
+ var _React$useState = React__default['default'].useState(false),
325077
+ _React$useState2 = _slicedToArray$1(_React$useState, 2),
325078
+ isDragging = _React$useState2[0],
325079
+ setIsDragging = _React$useState2[1]; // 是否拖拽中
325080
+
325081
+
325082
+ var _React$useState3 = React__default['default'].useState(null),
325083
+ _React$useState4 = _slicedToArray$1(_React$useState3, 2),
325084
+ activeId = _React$useState4[0],
325085
+ setActiveId = _React$useState4[1]; // 是否拖拽中
325086
+
325087
+
325088
+ var sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
325089
+ coordinateGetter: sortableKeyboardCoordinates
325090
+ }));
325091
+
325092
+ var handleMove = function handleMove(activeItem, overItem) {
325093
+ var fileMap = options.map(function (v) {
325094
+ if (v[rowKey] === activeItem[rowKey]) {
325095
+ return _objectSpread({}, overItem);
325096
+ }
325097
+
325098
+ if (v[rowKey] === overItem[rowKey]) {
325099
+ return _objectSpread({}, activeItem);
325100
+ }
325101
+
325102
+ return v;
325103
+ });
325104
+ move === null || move === void 0 ? void 0 : move(activeItem, overItem, fileMap);
325105
+ }; // 开始拖拽
325106
+
325107
+
325108
+ var handleDragStart = function handleDragStart(_ref3) {
325109
+ var active = _ref3.active;
325110
+ setIsDragging(true);
325111
+
325112
+ if (!active) {
325113
+ return;
325114
+ }
325115
+
325116
+ setActiveId(active.id);
325117
+ }; // 拖拽结束
325118
+
325119
+
325120
+ var handleDragEnd = function handleDragEnd(event) {
325121
+ var active = event.active,
325122
+ over = event.over;
325123
+ setActiveId(null); // 未移入时触发
325124
+
325125
+ if (!(over === null || over === void 0 ? void 0 : over.id)) {
325126
+ return;
325127
+ } // 移入时触发更新数据
325128
+
325129
+
325130
+ if (active.id !== over.id) {
325131
+ handleMove(active.data.current.item, over.data.current.item);
325132
+ }
325133
+ };
325134
+
325135
+ var instance = {
325136
+ isDragging: isDragging,
325137
+ activeId: activeId,
325138
+ options: options,
325139
+ rowKey: rowKey,
325140
+ children: children,
325141
+ move: move,
325142
+ items: options === null || options === void 0 ? void 0 : options.map(function (v) {
325143
+ return v[rowKey];
325144
+ })
325145
+ };
325146
+ return /*#__PURE__*/React__default['default'].createElement(DndContext, {
325147
+ sensors: sensors,
325148
+ onDragStart: handleDragStart,
325149
+ onDragEnd: handleDragEnd,
325150
+ onDragCancel: function onDragCancel() {
325151
+ return setActiveId(null);
325152
+ },
325153
+ modifiers: [restrictToParentElement],
325154
+ collisionDetection: closestCenter
325155
+ }, /*#__PURE__*/React__default['default'].createElement(SortableBox$4, {
325156
+ instance: instance
325157
+ }), /*#__PURE__*/React__default['default'].createElement(DragOver, {
325158
+ instance: instance
325159
+ }));
325160
+ };
325161
+
325162
+ var Root$1 = function Root(props, ref) {
325163
+ // 向外暴露出的方法
325164
+ React.useImperativeHandle(ref, function () {
325165
+ return {};
325166
+ });
325167
+ return /*#__PURE__*/React__default['default'].createElement(DndContainer$2, _objectSpread({}, props));
325168
+ };
325169
+
325170
+ var Root$2 = /*#__PURE__*/React.forwardRef(Root$1);
325171
+
325172
+ var LmDrag = function LmDrag(_ref, ref) {
325173
+ var resetProps = _extends$2({}, _ref);
325174
+
325175
+ var defaultRef = React.useRef(null);
325176
+
325177
+ var defaultProps = _objectSpread({
325178
+ options: [],
325179
+ rowKey: 'id'
325180
+ }, resetProps);
325181
+
325182
+ return /*#__PURE__*/React__default['default'].createElement(Root$2, _objectSpread({
325183
+ ref: ref || defaultRef
325184
+ }, defaultProps));
325185
+ };
325186
+
325187
+ var LmDrag$1 = /*#__PURE__*/React.forwardRef(LmDrag);
325188
+
324675
325189
  exports.Alert = Alert$1;
324676
325190
  exports.Approval = LMApproval;
324677
325191
  exports.AutoComplete = RefAutoComplete$1;
@@ -324714,6 +325228,7 @@
324714
325228
  exports.Layout = Layout$1;
324715
325229
  exports.LeftTable = LeftSide;
324716
325230
  exports.List = List$2;
325231
+ exports.LmDrag = LmDrag$1;
324717
325232
  exports.LmEditTable = LmEditTable;
324718
325233
  exports.LmFilter = LmFilter$1;
324719
325234
  exports.LmImgList = LmImgList;