@aloudata/aloudata-design 2.13.8 → 2.13.9

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.
@@ -4,6 +4,9 @@ export declare enum EUserType {
4
4
  USER = "USER",
5
5
  USER_GROUP = "USER_GROUP"
6
6
  }
7
+ export declare enum EUserSource {
8
+ ALOUDATA = "Aloudata"
9
+ }
7
10
  export interface IUser {
8
11
  type: EUserType.USER;
9
12
  userId: string;
@@ -11,7 +14,11 @@ export interface IUser {
11
14
  nickname?: string;
12
15
  photo?: string;
13
16
  name: string;
17
+ ban?: boolean;
14
18
  [key: string]: unknown;
19
+ email?: string;
20
+ phone?: string;
21
+ userSource?: EUserSource;
15
22
  }
16
23
  export interface IUserGroup {
17
24
  type: EUserType.USER_GROUP;
@@ -4,6 +4,10 @@ export var EUserType = /*#__PURE__*/function (EUserType) {
4
4
  EUserType["USER_GROUP"] = "USER_GROUP";
5
5
  return EUserType;
6
6
  }({});
7
+ export var EUserSource = /*#__PURE__*/function (EUserSource) {
8
+ EUserSource["ALOUDATA"] = "Aloudata";
9
+ return EUserSource;
10
+ }({});
7
11
  var GetUserListContext = /*#__PURE__*/React.createContext({});
8
12
  export var SizeContextProvider = function SizeContextProvider(_ref) {
9
13
  var children = _ref.children,
@@ -0,0 +1,11 @@
1
+ import type { SVGProps } from 'react';
2
+ import * as React from 'react';
3
+ interface SVGRProps {
4
+ size?: number | string;
5
+ title?: string;
6
+ titleId?: string;
7
+ desc?: string;
8
+ descId?: string;
9
+ }
10
+ declare const Memo: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<SVGProps<SVGSVGElement> & SVGRProps, "ref"> & React.RefAttributes<SVGSVGElement>>>;
11
+ export default Memo;
@@ -0,0 +1,35 @@
1
+ var _excluded = ["title", "titleId", "desc", "descId"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import * as React from 'react';
6
+ import { forwardRef, memo } from 'react';
7
+ var DragLightLine = function DragLightLine(_ref, ref) {
8
+ var title = _ref.title,
9
+ titleId = _ref.titleId,
10
+ desc = _ref.desc,
11
+ descId = _ref.descId,
12
+ props = _objectWithoutProperties(_ref, _excluded);
13
+ return /*#__PURE__*/React.createElement("svg", _extends({
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ width: props.width || props.size || 16,
16
+ height: props.height || props.size || 16,
17
+ fill: "none",
18
+ viewBox: "0 0 16 16",
19
+ ref: ref,
20
+ "aria-labelledby": titleId,
21
+ "aria-describedby": descId
22
+ }, props), desc ? /*#__PURE__*/React.createElement("desc", {
23
+ id: descId
24
+ }, desc) : null, title ? /*#__PURE__*/React.createElement("title", {
25
+ id: titleId
26
+ }, title) : null, /*#__PURE__*/React.createElement("path", {
27
+ fill: "#6B7280",
28
+ fillRule: "evenodd",
29
+ d: "M6 4a.667.667 0 1 0 0-1.334.667.667 0 0 0 0 1.333Zm0 4.666a.667.667 0 1 0 0-1.333.667.667 0 0 0 0 1.333Zm.667 4a.667.667 0 1 1-1.334 0 .667.667 0 0 1 1.334 0ZM10 3.999a.667.667 0 1 0 0-1.333A.667.667 0 0 0 10 4Zm0 4.667a.667.667 0 1 0 0-1.333.667.667 0 0 0 0 1.333Zm.667 4a.667.667 0 1 1-1.333 0 .667.667 0 0 1 1.333 0Z",
30
+ clipRule: "evenodd"
31
+ }));
32
+ };
33
+ var ForwardRef = /*#__PURE__*/forwardRef(DragLightLine);
34
+ var Memo = /*#__PURE__*/memo(ForwardRef);
35
+ export default Memo;
@@ -22,6 +22,7 @@ export { default as CloseLLine } from './components/CloseLLine';
22
22
  export { default as CloseLightLine } from './components/CloseLightLine';
23
23
  export { default as CloseMLine } from './components/CloseMLine';
24
24
  export { default as DangerFill } from './components/DangerFill';
25
+ export { default as DragLightLine } from './components/DragLightLine';
25
26
  export { default as DragLine } from './components/DragLine';
26
27
  export { default as Ellipsis } from './components/Ellipsis';
27
28
  export { default as EyeOffLine } from './components/EyeOffLine';
@@ -22,6 +22,7 @@ export { default as CloseLLine } from "./components/CloseLLine";
22
22
  export { default as CloseLightLine } from "./components/CloseLightLine";
23
23
  export { default as CloseMLine } from "./components/CloseMLine";
24
24
  export { default as DangerFill } from "./components/DangerFill";
25
+ export { default as DragLightLine } from "./components/DragLightLine";
25
26
  export { default as DragLine } from "./components/DragLine";
26
27
  export { default as Ellipsis } from "./components/Ellipsis";
27
28
  export { default as EyeOffLine } from "./components/EyeOffLine";
@@ -0,0 +1,5 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id=" Icon / Light / Interface / drag-light-line">
3
+ <path id="Icon" fill-rule="evenodd" clip-rule="evenodd" d="M6.00016 3.99935C6.36835 3.99935 6.66683 3.70087 6.66683 3.33268C6.66683 2.96449 6.36835 2.66602 6.00016 2.66602C5.63197 2.66602 5.3335 2.96449 5.3335 3.33268C5.3335 3.70087 5.63197 3.99935 6.00016 3.99935ZM6.00016 8.66602C6.36835 8.66602 6.66683 8.36754 6.66683 7.99935C6.66683 7.63116 6.36835 7.33268 6.00016 7.33268C5.63197 7.33268 5.3335 7.63116 5.3335 7.99935C5.3335 8.36754 5.63197 8.66602 6.00016 8.66602ZM6.66683 12.666C6.66683 13.0342 6.36835 13.3327 6.00016 13.3327C5.63197 13.3327 5.3335 13.0342 5.3335 12.666C5.3335 12.2978 5.63197 11.9993 6.00016 11.9993C6.36835 11.9993 6.66683 12.2978 6.66683 12.666ZM10.0002 3.99935C10.3684 3.99935 10.6668 3.70087 10.6668 3.33268C10.6668 2.96449 10.3684 2.66602 10.0002 2.66602C9.63197 2.66602 9.3335 2.96449 9.3335 3.33268C9.3335 3.70087 9.63197 3.99935 10.0002 3.99935ZM10.0002 8.66602C10.3684 8.66602 10.6668 8.36754 10.6668 7.99935C10.6668 7.63116 10.3684 7.33268 10.0002 7.33268C9.63197 7.33268 9.3335 7.63116 9.3335 7.99935C9.3335 8.36754 9.63197 8.66602 10.0002 8.66602ZM10.6668 12.666C10.6668 13.0342 10.3684 13.3327 10.0002 13.3327C9.63197 13.3327 9.3335 13.0342 9.3335 12.666C9.3335 12.2978 9.63197 11.9993 10.0002 11.9993C10.3684 11.9993 10.6668 12.2978 10.6668 12.666Z" fill="#6B7280"/>
4
+ </g>
5
+ </svg>
@@ -9,6 +9,10 @@ interface IProps<T> {
9
9
  changeRecordData: (id: string, data: T) => void;
10
10
  changeRelation: (id: string, logicType: ELogicType) => void;
11
11
  renderCondition: TRenderCondition<T>;
12
+ onDragEnd: (dragId: string, hoverId: string) => void;
13
+ hoverId: string;
14
+ setHoverId: (id: string) => void;
15
+ isRoot?: boolean;
12
16
  }
13
- export default function LogicItem<T>({ value, addCondition, addRelation, changeRecordData, remove, changeRelation, renderCondition, }: IProps<T>): React.JSX.Element;
17
+ export default function LogicItem<T>({ value, addCondition, addRelation, changeRecordData, remove, changeRelation, renderCondition, onDragEnd, isRoot, hoverId, setHoverId, }: IProps<T>): React.JSX.Element;
14
18
  export {};
@@ -4,8 +4,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import classNames from 'classnames';
7
8
  import _ from 'lodash';
8
- import React, { useContext, useState } from 'react';
9
+ import React, { useContext, useRef, useState } from 'react';
10
+ import { useDrag, useDrop } from 'react-dnd';
11
+ import DragLightLine from "../../../Icon/components/DragLightLine";
9
12
  import PlusIcon from "../../../Icon/components/SignLightLine";
10
13
  import CloseIcon from "../../../Icon/components/TimesLightLine";
11
14
  import IconButton from "../../../IconButton";
@@ -21,7 +24,12 @@ export default function LogicItem(_ref) {
21
24
  changeRecordData = _ref.changeRecordData,
22
25
  remove = _ref.remove,
23
26
  changeRelation = _ref.changeRelation,
24
- renderCondition = _ref.renderCondition;
27
+ renderCondition = _ref.renderCondition,
28
+ onDragEnd = _ref.onDragEnd,
29
+ _ref$isRoot = _ref.isRoot,
30
+ isRoot = _ref$isRoot === void 0 ? false : _ref$isRoot,
31
+ hoverId = _ref.hoverId,
32
+ setHoverId = _ref.setHoverId;
25
33
  var _useState = useState(0),
26
34
  _useState2 = _slicedToArray(_useState, 2),
27
35
  firstNodeHight = _useState2[0],
@@ -41,6 +49,55 @@ export default function LogicItem(_ref) {
41
49
  label: t.LogicTree.select.or
42
50
  }];
43
51
  var type = value.type;
52
+ var ref = useRef(null);
53
+ var _useDrag = useDrag({
54
+ type: 'LOGIC_ITEM',
55
+ item: {
56
+ id: value.id
57
+ },
58
+ collect: function collect(monitor) {
59
+ return {
60
+ isDragging: monitor.isDragging()
61
+ };
62
+ },
63
+ canDrag: !isRoot
64
+ }),
65
+ _useDrag2 = _slicedToArray(_useDrag, 2),
66
+ isDragging = _useDrag2[0].isDragging,
67
+ drag = _useDrag2[1];
68
+ var _useDrop = useDrop({
69
+ accept: 'LOGIC_ITEM',
70
+ drop: function drop(item, monitor) {
71
+ if (!ref.current) {
72
+ return;
73
+ }
74
+ var dragId = item.id;
75
+ var hoverId = value.id;
76
+ if (dragId === hoverId) {
77
+ return;
78
+ }
79
+ // 检查是否为最顶层的放置目标
80
+ if (monitor.didDrop()) {
81
+ return;
82
+ }
83
+ onDragEnd(dragId, hoverId);
84
+ },
85
+ collect: function collect(monitor) {
86
+ return {
87
+ isOver: monitor.isOver({
88
+ shallow: true
89
+ }),
90
+ canDrop: monitor.canDrop()
91
+ };
92
+ }
93
+ }),
94
+ _useDrop2 = _slicedToArray(_useDrop, 2),
95
+ _useDrop2$ = _useDrop2[0],
96
+ isOver = _useDrop2$.isOver,
97
+ canDrop = _useDrop2$.canDrop,
98
+ drop = _useDrop2[1];
99
+ drag(drop(ref));
100
+ var isDragOver = isOver && canDrop && !isRoot;
44
101
  var firstRefCallback = function firstRefCallback(e) {
45
102
  if (e) {
46
103
  setFirstNodeHight(e.clientHeight);
@@ -74,9 +131,25 @@ export default function LogicItem(_ref) {
74
131
  if (type === ENodeType.LOGIC) {
75
132
  var nodes = value.nodes,
76
133
  _logicType = value.logicType;
77
- var verticalLineHeight = nodes.length > 1 ? "calc(100% - ".concat(firstNodeHight / TWO, "px - ").concat(lastNodeHight / TWO, "px - 40px)") : "30px";
134
+ var verticalLineHeight = nodes.length > 1 ? "calc(100% - ".concat(firstNodeHight / TWO, "px - ").concat(lastNodeHight / TWO, "px - 42px)") : "30px";
78
135
  return /*#__PURE__*/React.createElement("div", {
79
- className: "ald-logic-tree-logic-node"
136
+ className: classNames('ald-logic-tree-logic-node', {
137
+ 'is-over': isDragOver,
138
+ 'is-hover': hoverId === value.id,
139
+ 'is-dragging': isDragging
140
+ }),
141
+ ref: ref,
142
+ onMouseMove: function onMouseMove(e) {
143
+ e.stopPropagation();
144
+ setHoverId(value.id);
145
+ },
146
+ onMouseOut: function onMouseOut(e) {
147
+ e.stopPropagation();
148
+ setHoverId(value.id);
149
+ },
150
+ style: {
151
+ opacity: isDragging ? 0.5 : 1
152
+ }
80
153
  }, _.map(nodes, function (node, index) {
81
154
  var ref = null;
82
155
  if (index === 0) {
@@ -98,7 +171,10 @@ export default function LogicItem(_ref) {
98
171
  remove: remove,
99
172
  changeRelation: changeRelation,
100
173
  renderCondition: renderCondition,
101
- changeRecordData: changeRecordData
174
+ changeRecordData: changeRecordData,
175
+ hoverId: hoverId,
176
+ setHoverId: setHoverId,
177
+ onDragEnd: onDragEnd
102
178
  }));
103
179
  }), /*#__PURE__*/React.createElement("div", {
104
180
  className: "ald-logic-tree-operation"
@@ -118,8 +194,12 @@ export default function LogicItem(_ref) {
118
194
  className: "ald-logic-tree-logic-vertical-line",
119
195
  style: {
120
196
  height: verticalLineHeight,
121
- top: "".concat(firstNodeHight / TWO, "px")
197
+ top: "".concat(firstNodeHight / TWO + 4, "px")
122
198
  }
199
+ }), !isRoot && (hoverId === value.id || isDragging) && /*#__PURE__*/React.createElement(DragLightLine, {
200
+ size: 16,
201
+ color: "#6B7280",
202
+ className: "ald-logic-tree-node-drag-icon"
123
203
  }), /*#__PURE__*/React.createElement(Select, {
124
204
  options: logicOptions,
125
205
  className: "ald-logic-tree-select-relation",
@@ -130,8 +210,28 @@ export default function LogicItem(_ref) {
130
210
  }));
131
211
  }
132
212
  return /*#__PURE__*/React.createElement("div", {
133
- className: "ald-logic-tree-record-node"
134
- }, /*#__PURE__*/React.createElement("div", {
213
+ className: classNames('ald-logic-tree-record-node', {
214
+ 'is-over': isDragOver,
215
+ 'is-hover': hoverId === value.id,
216
+ 'is-dragging': isDragging
217
+ }),
218
+ ref: ref,
219
+ onMouseMove: function onMouseMove(e) {
220
+ e.stopPropagation();
221
+ setHoverId(value.id);
222
+ },
223
+ onMouseOut: function onMouseOut(e) {
224
+ e.stopPropagation();
225
+ setHoverId(value.id);
226
+ },
227
+ style: {
228
+ opacity: isDragging ? 0.5 : 1
229
+ }
230
+ }, (hoverId === value.id || isDragging) && /*#__PURE__*/React.createElement(DragLightLine, {
231
+ size: 16,
232
+ color: "#6B7280",
233
+ className: "ald-logic-tree-record-node-drag-icon"
234
+ }), /*#__PURE__*/React.createElement("div", {
135
235
  className: "ald-logic-tree-render-condition-wrap"
136
236
  }, renderCondition(value.data, {
137
237
  changeData: onChangeRecordData
@@ -1,4 +1,6 @@
1
- import { ELogicType, TNode } from './type';
1
+ import { ELogicType, ILogicNode, TNode } from './type';
2
+ export declare function findNodeById<T>(nodeId: string, currentNodes: TNode<T>): TNode<T> | undefined;
3
+ export declare function findParentNodeById<T>(nodeId: string, currentNodes: TNode<T>): ILogicNode<T> | undefined;
2
4
  export declare function addLogicNode<T>(nodeId: string, rootNode: TNode<T>, newInitializationData: T): TNode<T>;
3
5
  export declare function addRecordNode<T>(nodeId: string, rootNode: TNode<T>, newInitializationData: T): TNode<T>;
4
6
  export declare function removeNode<T>(nodeId: string, rootNode: TNode<T>, initialNode: TNode<T>, rootNodeAllowedEmpty?: boolean): TNode<T>;
@@ -6,7 +6,7 @@ import { getUniqId } from "../_utils/getUniqId";
6
6
  import { ELogicType, ENodeType } from "./type";
7
7
 
8
8
  // 递归查找节点
9
- function findNodeById(nodeId, currentNodes) {
9
+ export function findNodeById(nodeId, currentNodes) {
10
10
  if (nodeId === currentNodes.id) {
11
11
  return currentNodes;
12
12
  }
@@ -32,7 +32,7 @@ function findNodeById(nodeId, currentNodes) {
32
32
  }
33
33
 
34
34
  // 递归查找父节点
35
- function findParentNodeById(nodeId, currentNodes) {
35
+ export function findParentNodeById(nodeId, currentNodes) {
36
36
  if (currentNodes.type === ENodeType.LOGIC) {
37
37
  var childrenNodes = currentNodes.nodes;
38
38
  var _iterator2 = _createForOfIteratorHelper(childrenNodes),
@@ -6,11 +6,14 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { useControllableValue } from 'ahooks';
8
8
  import classNames from 'classnames';
9
- import React from 'react';
9
+ import _ from 'lodash';
10
+ import React, { useCallback, useState } from 'react';
11
+ import { DndProvider } from 'react-dnd';
12
+ import { HTML5Backend } from 'react-dnd-html5-backend';
10
13
  import { getUniqId } from "../_utils/getUniqId";
11
14
  import DisplayLogicTree from "./DisplayLogicTree";
12
15
  import LogicItem from "./components/LogicItem";
13
- import { addLogicNode, addRecordNode, changeRecordData, changeRelation, removeNode } from "./helper";
16
+ import { addLogicNode, addRecordNode, changeRecordData, changeRelation, findNodeById, findParentNodeById, removeNode } from "./helper";
14
17
  import { ELogicType, ENodeType } from "./type";
15
18
  export { DisplayLogicTree, ELogicType, ENodeType };
16
19
  export default function LogicTree(props) {
@@ -37,10 +40,14 @@ export default function LogicTree(props) {
37
40
  _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
38
41
  innerValue = _useControllableValue2[0],
39
42
  setInnerValue = _useControllableValue2[1];
40
- var changeInnerValue = function changeInnerValue(newValue) {
43
+ var _useState = useState(''),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ hoverItemId = _useState2[0],
46
+ setHoverItemId = _useState2[1];
47
+ var changeInnerValue = useCallback(function (newValue) {
41
48
  setInnerValue(newValue);
42
49
  propsOnChange(newValue);
43
- };
50
+ }, [propsOnChange, setInnerValue]);
44
51
  var onAddCondition = function onAddCondition(id) {
45
52
  var newRootNode = addRecordNode(id, innerValue, newInitializationData);
46
53
  changeInnerValue(newRootNode);
@@ -61,10 +68,50 @@ export default function LogicTree(props) {
61
68
  var newRootNode = changeRecordData(id, data, innerValue);
62
69
  changeInnerValue(newRootNode);
63
70
  };
71
+ var moveNode = useCallback(function (dragId, hoverId) {
72
+ var newRootNode = _.cloneDeep(innerValue);
73
+ var dragNode = findNodeById(dragId, newRootNode);
74
+ var hoverNode = findNodeById(hoverId, newRootNode);
75
+ if (dragNode && hoverNode) {
76
+ var dragParent = findParentNodeById(dragId, newRootNode);
77
+ var hoverParent = findParentNodeById(hoverId, newRootNode);
78
+ if (dragParent && hoverParent) {
79
+ var tempDragParentNodes = dragParent.nodes.filter(function (node) {
80
+ return node.id !== dragId;
81
+ });
82
+
83
+ // 如果 tempDragParentNodes 为空的话,则删除dragParent结点
84
+ if (tempDragParentNodes.length === 0) {
85
+ var grandParent = findParentNodeById(dragParent.id, newRootNode);
86
+ if (grandParent) {
87
+ grandParent.nodes = grandParent.nodes.filter(function (node) {
88
+ return node.id !== dragParent.id;
89
+ });
90
+ } else {
91
+ // 如果 dragParent 是根节点,则不删除,只清空其 nodes
92
+ dragParent.nodes = [];
93
+ }
94
+ } else {
95
+ dragParent.nodes = tempDragParentNodes;
96
+ }
97
+
98
+ // 插入到新位置
99
+ var hoverIndex = hoverParent.nodes.findIndex(function (node) {
100
+ return node.id === hoverId;
101
+ });
102
+ hoverParent.nodes.splice(hoverIndex + 1, 0, dragNode);
103
+
104
+ // 直接更新状态
105
+ changeInnerValue(newRootNode);
106
+ }
107
+ }
108
+ }, [innerValue, changeInnerValue]);
64
109
  if (!innerValue) {
65
110
  return null;
66
111
  }
67
- return /*#__PURE__*/React.createElement("div", {
112
+ return /*#__PURE__*/React.createElement(DndProvider, {
113
+ backend: HTML5Backend
114
+ }, /*#__PURE__*/React.createElement("div", {
68
115
  className: classNames('ald-logic-tree-wrap', className)
69
116
  }, /*#__PURE__*/React.createElement(LogicItem, {
70
117
  value: innerValue,
@@ -73,6 +120,10 @@ export default function LogicTree(props) {
73
120
  remove: onRemove,
74
121
  changeRecordData: onChangeRecordData,
75
122
  renderCondition: renderCondition,
76
- changeRelation: onChangeRelation
77
- }));
123
+ changeRelation: onChangeRelation,
124
+ onDragEnd: moveNode,
125
+ hoverId: hoverItemId,
126
+ setHoverId: setHoverItemId,
127
+ isRoot: true // 将最顶层的LogicItem标记为根节点
128
+ })));
78
129
  }
@@ -1,12 +1,36 @@
1
- @recordLineWidth: 32px;
1
+ @recordLineWidth: 48px;
2
2
  @selectWidth: 48px;
3
+ @dragIConWidth: 16px;
4
+
5
+ .ald-logic-tree-wrap > .ald-logic-tree-logic-node {
6
+ &.is-hover {
7
+ background: rgba(255, 255, 255, 0);
8
+ }
9
+ }
3
10
 
4
11
  .ald-logic-tree-logic-node {
5
12
  display: flex;
6
13
  flex-direction: column;
7
- gap: 8px;
8
- padding-left: calc(@recordLineWidth + @selectWidth / 2);
14
+ padding-left: calc(@recordLineWidth + @selectWidth / 2 + @dragIConWidth);
9
15
  position: relative;
16
+ cursor: pointer;
17
+ border-radius: 6px;
18
+ margin-left: -16px;
19
+
20
+ &.is-hover {
21
+ background: rgba(244, 244, 245);
22
+ }
23
+
24
+ &.is-dragging {
25
+ background: var(--alias-colors-bg-selected-default, #e8f2fe);
26
+ }
27
+
28
+ .ald-logic-tree-node-drag-icon {
29
+ position: absolute;
30
+ top: calc(50% + 5px);
31
+ left: 0;
32
+ transform: translateY(-50%);
33
+ }
10
34
 
11
35
  .ald-logic-tree-node-wrap {
12
36
  position: relative;
@@ -22,6 +46,7 @@
22
46
 
23
47
  .ald-logic-tree-operation {
24
48
  height: 32px;
49
+ padding: 4px 0;
25
50
  display: flex;
26
51
  align-items: center;
27
52
  gap: 10px;
@@ -33,20 +58,20 @@
33
58
  height: calc(50% - 16px);
34
59
  width: @recordLineWidth;
35
60
  top: 50%;
36
- left: calc(@selectWidth / 2);
61
+ left: calc(@selectWidth / 2 + @dragIConWidth);
37
62
  }
38
63
  }
39
64
 
40
65
  .ald-logic-tree-logic-vertical-line {
41
66
  position: absolute;
42
67
  border-left: 1px solid #d1d5db;
43
- left: calc(@selectWidth / 2);
68
+ left: calc(@selectWidth / 2 + @dragIConWidth);
44
69
  }
45
70
 
46
71
  .ald-logic-tree-select-relation {
47
72
  position: absolute !important;
48
- top: calc(50% - 14px);
49
- left: 0;
73
+ top: calc(50% - 10px);
74
+ left: 16px;
50
75
  z-index: 1;
51
76
  width: @selectWidth !important;
52
77
  background: #fff !important;
@@ -70,6 +95,30 @@
70
95
  display: flex;
71
96
  align-items: center;
72
97
  gap: 6px;
98
+ cursor: pointer;
99
+ padding-left: 16px;
100
+ margin-left: -16px;
101
+
102
+ &.is-hover {
103
+ display: flex;
104
+ align-items: center;
105
+ border-radius: 6px;
106
+ background: rgba(244, 244, 245);
107
+ }
108
+
109
+ &.is-dragging {
110
+ display: flex;
111
+ align-items: center;
112
+ border-radius: 6px;
113
+ background: var(--alias-colors-bg-selected-default, #e8f2fe);
114
+ }
115
+
116
+ .ald-logic-tree-record-node-drag-icon {
117
+ position: absolute;
118
+ top: calc(50%);
119
+ left: 0;
120
+ transform: translateY(-50%);
121
+ }
73
122
 
74
123
  .ald-logic-tree-render-condition-wrap {
75
124
  display: flex;
@@ -77,3 +126,21 @@
77
126
  flex: 0 0 fit-content;
78
127
  }
79
128
  }
129
+
130
+ .ald-logic-tree-logic-node,
131
+ .ald-logic-tree-record-node {
132
+ position: relative;
133
+ padding-top: 4px;
134
+ padding-bottom: 4px;
135
+ }
136
+
137
+ .ald-logic-tree-logic-node.is-over:last-child::after,
138
+ .ald-logic-tree-record-node.is-over:last-child::after {
139
+ content: '';
140
+ position: absolute;
141
+ bottom: -1px;
142
+ left: 16px;
143
+ width: calc(100% - 16px);
144
+ height: 2px;
145
+ background-color: #126fdd;
146
+ }
@@ -15,7 +15,6 @@ import Spin from "../../Spin";
15
15
  import { LocaleContext, getTranslator } from "../../locale/default";
16
16
  import { isUser } from "../utils/getUsersWithUserId";
17
17
  import MultipleOption from "./MultipleOption";
18
- import { userDisplayNameIsRepeated } from "./Panel";
19
18
  import SingleOption from "./SingleOption";
20
19
  export var OPTION_HEIGHT = 36;
21
20
  export var WRAPPER_HEIGHT = 300;
@@ -121,7 +120,7 @@ export default function MemberSelection(props) {
121
120
  user: user,
122
121
  disabled: disabled,
123
122
  selected: isSelected,
124
- showUserId: userDisplayNameIsRepeated(userList, user.nickname),
123
+ showUserId: true,
125
124
  onChange: function onChange(selected, user) {
126
125
  if (isUser(user)) _onChange(selected, user);
127
126
  }
@@ -129,7 +128,7 @@ export default function MemberSelection(props) {
129
128
  key: user.userId,
130
129
  user: user,
131
130
  selected: isSelected,
132
- showUserId: userDisplayNameIsRepeated(userList, user.nickname),
131
+ showUserId: true,
133
132
  onChange: function onChange(selected, user) {
134
133
  if (isUser(user)) _onChange(selected, user);
135
134
  }
@@ -4,12 +4,13 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
4
4
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
5
  import classnames from 'classnames';
6
6
  import React, { useContext } from 'react';
7
+ import Badge from "../../Badge";
7
8
  import Checkbox from "../../Checkbox";
8
9
  import { EUserType } from "../../ConfigProvider/getUserList";
9
10
  import TextLink from "../../TextLink/index";
10
11
  import { LocaleContext, getTranslator } from "../../locale/default";
11
12
  import { getAccount, getId, getPhoto } from "../utils";
12
- import { isUserGroup } from "../utils/getUsersWithUserId";
13
+ import { isUser, isUserGroup } from "../utils/getUsersWithUserId";
13
14
  import NickLabel from "./NickLabel";
14
15
  export default function MultipleList(params) {
15
16
  var _useContext = useContext(LocaleContext),
@@ -49,6 +50,9 @@ export default function MultipleList(params) {
49
50
  addonBefore: showUserId && user.type === EUserType.USER && /*#__PURE__*/React.createElement("span", {
50
51
  className: 'ald-member-picker-option-id'
51
52
  }, user.userId)
53
+ }), isUser(user) && user.ban && /*#__PURE__*/React.createElement(Badge, {
54
+ status: "default",
55
+ count: t.MemberPicker.ban
52
56
  }))), isUserGroup(user) && hasNextLevel && /*#__PURE__*/React.createElement(TextLink, {
53
57
  className: "ald-member-picker-btn",
54
58
  size: "small",
@@ -1,19 +1,19 @@
1
1
  import classNames from 'classnames';
2
2
  import _ from 'lodash';
3
3
  import React, { useContext } from 'react';
4
+ import Badge from "../../Badge";
4
5
  import { CloseMLine } from "../../Icon";
5
6
  import ScrollArea from "../../ScrollArea";
6
7
  import { LocaleContext, getTranslator } from "../../locale/default";
7
8
  import { getAccount, getId, getPhoto } from "../utils";
9
+ import { isUser } from "../utils/getUsersWithUserId";
8
10
  import NickLabel from "./NickLabel";
9
- import { userDisplayNameIsRepeated } from "./Panel";
10
11
  export default function SelectedMemberTags(props) {
11
12
  var className = props.className,
12
13
  selectedUsers = props.selectedUsers,
13
14
  width = props.width,
14
15
  _props$lockedIds = props.lockedIds,
15
- lockedIds = _props$lockedIds === void 0 ? [] : _props$lockedIds,
16
- userList = props.userList;
16
+ lockedIds = _props$lockedIds === void 0 ? [] : _props$lockedIds;
17
17
  var _useContext = useContext(LocaleContext),
18
18
  locale = _useContext.locale;
19
19
  var t = getTranslator(locale);
@@ -30,7 +30,6 @@ export default function SelectedMemberTags(props) {
30
30
  }
31
31
  }, selectedUsers.map(function (user) {
32
32
  var hasLocked = false;
33
- var isDisplayNameRepeat = false;
34
33
  if (user && user.hasOwnProperty('groupId')) {
35
34
  var index = _.findIndex(lockedIds, {
36
35
  groupId: user.groupId,
@@ -42,7 +41,6 @@ export default function SelectedMemberTags(props) {
42
41
  userId: user.userId,
43
42
  type: user.type
44
43
  });
45
- isDisplayNameRepeat = userDisplayNameIsRepeated(userList, user.nickname);
46
44
  hasLocked = _index !== -1;
47
45
  }
48
46
  return /*#__PURE__*/React.createElement("div", {
@@ -56,10 +54,13 @@ export default function SelectedMemberTags(props) {
56
54
  name: user.name,
57
55
  photo: getPhoto(user),
58
56
  account: getAccount(user),
59
- addonBefore: isDisplayNameRepeat && user.type === 'USER' && /*#__PURE__*/React.createElement("span", {
57
+ addonBefore: user.type === 'USER' && /*#__PURE__*/React.createElement("span", {
60
58
  className: "ald-member-picker-option-id"
61
59
  }, user.userId)
62
- })), !hasLocked && /*#__PURE__*/React.createElement(CloseMLine, {
60
+ })), isUser(user) && user.ban && /*#__PURE__*/React.createElement(Badge, {
61
+ status: "default",
62
+ count: t.MemberPicker.ban
63
+ }), !hasLocked && /*#__PURE__*/React.createElement(CloseMLine, {
63
64
  size: 20,
64
65
  className: 'ald-member-picker-close',
65
66
  color: "#98A2B3",