yootd 0.2.11 → 0.2.12
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.
@@ -30,7 +30,11 @@ var SortableItem = function SortableItem(_ref) {
|
|
30
30
|
_onClick = _ref.onClick,
|
31
31
|
onEdit = _ref.onEdit,
|
32
32
|
onDel = _ref.onDel,
|
33
|
-
onSwitch = _ref.onSwitch
|
33
|
+
onSwitch = _ref.onSwitch,
|
34
|
+
subId = _ref.subId,
|
35
|
+
isSubNode = _ref.isSubNode,
|
36
|
+
subNode = _ref.subNode,
|
37
|
+
onSubClick = _ref.onSubClick;
|
34
38
|
var _useSortable = useSortable({
|
35
39
|
id: id
|
36
40
|
}),
|
@@ -49,12 +53,13 @@ var SortableItem = function SortableItem(_ref) {
|
|
49
53
|
zIndex: 9999
|
50
54
|
} : {});
|
51
55
|
var mb = useBem('SortableItem');
|
52
|
-
var top = mb.b('content').b('top');
|
56
|
+
var top = isSubNode === true ? mb.b('content-no-bg').b('top') : mb.b('content').b('top');
|
57
|
+
var subTop = mb.b('sub-content').b('top');
|
53
58
|
return /*#__PURE__*/React.createElement("div", {
|
54
59
|
style: style,
|
55
60
|
className: "".concat(mb)
|
56
61
|
}, /*#__PURE__*/React.createElement("div", {
|
57
|
-
className: "".concat(mb.b('content'), " ").concat(id === activeKey ? "".concat(mb.e('content-active')) : '', " ").concat(mb.b(statusColor[status !== null && status !== void 0 ? status : ''])),
|
62
|
+
className: "".concat(isSubNode === true ? "".concat(mb.b('content-no-bg')) : "".concat(mb.b('content')), " ").concat(id === activeKey && isSubNode === false ? "".concat(mb.e('content-active')) : '', " ").concat(mb.b(statusColor[status !== null && status !== void 0 ? status : ''])),
|
58
63
|
key: id,
|
59
64
|
onClick: function onClick() {
|
60
65
|
_onClick === null || _onClick === void 0 || _onClick(id, {
|
@@ -80,7 +85,7 @@ var SortableItem = function SortableItem(_ref) {
|
|
80
85
|
})), /*#__PURE__*/React.createElement("div", {
|
81
86
|
className: "".concat(top.b('top-left').b('top-title-wrap'))
|
82
87
|
}, /*#__PURE__*/React.createElement("span", {
|
83
|
-
className: "".concat(top.b('top-left').b('top-title-wrap').e('top-title')),
|
88
|
+
className: "".concat(top.b('top-left').b('top-title-wrap').e('top-title'), " ").concat(id === activeKey ? "".concat(top.b('top-left').b('top-title-wrap').e('top-title-active')) : ''),
|
84
89
|
style: {
|
85
90
|
marginRight: editBtnIcon || delBtnIcon ? '12px' : '0',
|
86
91
|
marginLeft: dragBtnIcon ? '6px' : '0'
|
@@ -150,6 +155,35 @@ var SortableItem = function SortableItem(_ref) {
|
|
150
155
|
}
|
151
156
|
}, /*#__PURE__*/React.createElement("span", {
|
152
157
|
className: "".concat(mb.b('content').b('bottom').e('extra'))
|
153
|
-
}, extra))))
|
158
|
+
}, extra))), subNode === null || subNode === void 0 ? void 0 : subNode.map(function (item, index) {
|
159
|
+
return /*#__PURE__*/React.createElement("div", {
|
160
|
+
key: index,
|
161
|
+
className: "".concat(mb.b('sub-content'), " ").concat(id === activeKey && subId === item.key ? "".concat(mb.e('sub-content-active')) : '', " ").concat(mb.b(statusColor[status !== null && status !== void 0 ? status : ''])),
|
162
|
+
onClick: function onClick() {
|
163
|
+
console.log(id, item.key, _objectSpread({}, item));
|
164
|
+
onSubClick === null || onSubClick === void 0 || onSubClick(id, item.key, _objectSpread({}, item));
|
165
|
+
}
|
166
|
+
}, /*#__PURE__*/React.createElement("div", {
|
167
|
+
className: "".concat(subTop)
|
168
|
+
}, /*#__PURE__*/React.createElement("div", {
|
169
|
+
className: "".concat(subTop.b('top-left'))
|
170
|
+
}, /*#__PURE__*/React.createElement("div", {
|
171
|
+
className: "".concat(subTop.b('top-left').b('top-title-wrap'))
|
172
|
+
}, /*#__PURE__*/React.createElement("span", {
|
173
|
+
className: "".concat(subTop.b('top-left').b('top-title-wrap').e('top-title'), " ").concat(subId === item.key ? "".concat(subTop.b('top-left').b('top-title-wrap').e('top-title-active')) : ''),
|
174
|
+
style: {
|
175
|
+
marginRight: editBtnIcon || delBtnIcon ? '12px' : '0',
|
176
|
+
marginLeft: dragBtnIcon ? '6px' : '0'
|
177
|
+
}
|
178
|
+
}, item.title)))), /*#__PURE__*/React.createElement("div", {
|
179
|
+
className: "".concat(mb.b('content').b('bottom')),
|
180
|
+
style: {
|
181
|
+
marginLeft: dragBtnIcon ? '22px' : '0'
|
182
|
+
}
|
183
|
+
}, /*#__PURE__*/React.createElement("span", {
|
184
|
+
className: "".concat(mb.b('content').b('bottom').e('extra'))
|
185
|
+
}, item.extra)));
|
186
|
+
}));
|
154
187
|
};
|
155
|
-
export default SortableItem;
|
188
|
+
export default SortableItem;
|
189
|
+
/*#__PURE__*/React.createElement("div", null);
|
@@ -66,6 +66,76 @@
|
|
66
66
|
}
|
67
67
|
}
|
68
68
|
}
|
69
|
+
&-content-no-bg {
|
70
|
+
position: relative;
|
71
|
+
padding: 12px 16px;
|
72
|
+
box-sizing: border-box;
|
73
|
+
cursor: pointer;
|
74
|
+
background-color: #fff;
|
75
|
+
&-top {
|
76
|
+
display: flex;
|
77
|
+
justify-content: space-between;
|
78
|
+
align-items: start;
|
79
|
+
&-top-left {
|
80
|
+
display: flex;
|
81
|
+
align-items: start;
|
82
|
+
&-top-drag-btn-icon {
|
83
|
+
cursor: move;
|
84
|
+
&__drag-btn-icon-svg {
|
85
|
+
display: inline-block;
|
86
|
+
vertical-align: middle;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
&-top-title-wrap {
|
90
|
+
display: flex;
|
91
|
+
align-items: center;
|
92
|
+
justify-content: center;
|
93
|
+
&__top-title {
|
94
|
+
font-size: 16px;
|
95
|
+
font-weight: 400;
|
96
|
+
line-height: 1.5em;
|
97
|
+
overflow: hidden;
|
98
|
+
display: -webkit-box; //将元素设为盒子伸缩模型显示
|
99
|
+
-webkit-box-orient: vertical; //伸缩方向设为垂直方向
|
100
|
+
-webkit-line-clamp: 2; //超出2行隐藏,并显示省略号
|
101
|
+
line-clamp: 2;
|
102
|
+
}
|
103
|
+
&__top-title-active{
|
104
|
+
font-weight: bold;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
&-top-middle {
|
109
|
+
display: flex;
|
110
|
+
align-items: center;
|
111
|
+
&-top-edit-btn-icon {
|
112
|
+
cursor: pointer;
|
113
|
+
&__edit-btn-icon-svg {
|
114
|
+
display: inline-block;
|
115
|
+
vertical-align: middle;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
&-top-del-btn-icon {
|
119
|
+
cursor: pointer;
|
120
|
+
margin-left: 12px;
|
121
|
+
&__del-btn-icon-svg {
|
122
|
+
display: inline-block;
|
123
|
+
vertical-align: middle;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
&-bottom {
|
129
|
+
text-overflow: ellipsis;
|
130
|
+
overflow: hidden;
|
131
|
+
white-space: nowrap;
|
132
|
+
&__extra {
|
133
|
+
font-size: 12px;
|
134
|
+
font-weight: 400;
|
135
|
+
color: rgba(0, 0, 0, 0.45);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
69
139
|
&-content:hover {
|
70
140
|
background-color: var(--ant-color-primary-border);
|
71
141
|
transition: all 0.05s ease;
|
@@ -108,4 +178,98 @@
|
|
108
178
|
border: 4px solid var(--ant-color-error);
|
109
179
|
z-index: 999;
|
110
180
|
}
|
181
|
+
&-sub-content {
|
182
|
+
position: relative;
|
183
|
+
padding: 12px 16px 12px 32px;
|
184
|
+
box-sizing: border-box;
|
185
|
+
cursor: pointer;
|
186
|
+
background-color: #fff;
|
187
|
+
border-bottom:1 px solid ;
|
188
|
+
&-top {
|
189
|
+
display: flex;
|
190
|
+
justify-content: space-between;
|
191
|
+
align-items: start;
|
192
|
+
&-top-left {
|
193
|
+
display: flex;
|
194
|
+
align-items: start;
|
195
|
+
&-top-drag-btn-icon {
|
196
|
+
cursor: move;
|
197
|
+
&__drag-btn-icon-svg {
|
198
|
+
display: inline-block;
|
199
|
+
vertical-align: middle;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
&-top-title-wrap {
|
203
|
+
display: flex;
|
204
|
+
align-items: center;
|
205
|
+
justify-content: center;
|
206
|
+
&__top-title {
|
207
|
+
font-size: 16px;
|
208
|
+
font-weight: 400;
|
209
|
+
line-height: 1.5em;
|
210
|
+
overflow: hidden;
|
211
|
+
display: -webkit-box; //将元素设为盒子伸缩模型显示
|
212
|
+
-webkit-box-orient: vertical; //伸缩方向设为垂直方向
|
213
|
+
-webkit-line-clamp: 2; //超出2行隐藏,并显示省略号
|
214
|
+
line-clamp: 2;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
&-top-middle {
|
219
|
+
display: flex;
|
220
|
+
align-items: center;
|
221
|
+
&-top-edit-btn-icon {
|
222
|
+
cursor: pointer;
|
223
|
+
&__edit-btn-icon-svg {
|
224
|
+
display: inline-block;
|
225
|
+
vertical-align: middle;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
&-top-del-btn-icon {
|
229
|
+
cursor: pointer;
|
230
|
+
margin-left: 12px;
|
231
|
+
&__del-btn-icon-svg {
|
232
|
+
display: inline-block;
|
233
|
+
vertical-align: middle;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
&-bottom {
|
239
|
+
text-overflow: ellipsis;
|
240
|
+
overflow: hidden;
|
241
|
+
white-space: nowrap;
|
242
|
+
&__extra {
|
243
|
+
font-size: 12px;
|
244
|
+
font-weight: 400;
|
245
|
+
color: rgba(0, 0, 0, 0.45);
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
&-sub-content:hover {
|
250
|
+
background-color: var(--ant-color-primary-border);
|
251
|
+
transition: all 0.05s ease;
|
252
|
+
}
|
253
|
+
&-sub-content::before {
|
254
|
+
content: '';
|
255
|
+
position: absolute;
|
256
|
+
bottom: -0.5px;
|
257
|
+
left: 16px;
|
258
|
+
right: 16px;
|
259
|
+
height: 1px;
|
260
|
+
background-color: #e5e5e5;
|
261
|
+
z-index: 100;
|
262
|
+
}
|
263
|
+
&__sub-content-active {
|
264
|
+
background-color: var(--ant-color-primary-border);
|
265
|
+
}
|
266
|
+
&__sub-content-active::after {
|
267
|
+
content: '';
|
268
|
+
position: absolute;
|
269
|
+
bottom: 0;
|
270
|
+
left: 0;
|
271
|
+
width: 4px;
|
272
|
+
height: 100%;
|
273
|
+
background-color: var(--ant-color-primary);
|
274
|
+
}
|
111
275
|
}
|
package/dist/aside/index.js
CHANGED
@@ -38,7 +38,10 @@ export var Aside = function Aside(_ref) {
|
|
38
38
|
onDragEnd = _ref.onDragEnd,
|
39
39
|
onScrollBottom = _ref.onScrollBottom,
|
40
40
|
_ref$bottomThreshold = _ref.bottomThreshold,
|
41
|
-
bottomThreshold = _ref$bottomThreshold === void 0 ? 50 : _ref$bottomThreshold
|
41
|
+
bottomThreshold = _ref$bottomThreshold === void 0 ? 50 : _ref$bottomThreshold,
|
42
|
+
_ref$isSubNode = _ref.isSubNode,
|
43
|
+
isSubNode = _ref$isSubNode === void 0 ? false : _ref$isSubNode,
|
44
|
+
onSubClick = _ref.onSubClick;
|
42
45
|
var mb = useBem('aside');
|
43
46
|
var asideRef = useRef(null);
|
44
47
|
// 当前选择的key
|
@@ -46,11 +49,16 @@ export var Aside = function Aside(_ref) {
|
|
46
49
|
_useState2 = _slicedToArray(_useState, 2),
|
47
50
|
key = _useState2[0],
|
48
51
|
setKey = _useState2[1];
|
49
|
-
//
|
50
|
-
var _useState3 = useState(
|
52
|
+
// 当前选择的key
|
53
|
+
var _useState3 = useState(),
|
51
54
|
_useState4 = _slicedToArray(_useState3, 2),
|
52
|
-
|
53
|
-
|
55
|
+
subKey = _useState4[0],
|
56
|
+
setSubKey = _useState4[1];
|
57
|
+
// 缓存传入的数据
|
58
|
+
var _useState5 = useState([]),
|
59
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
60
|
+
dataValue = _useState6[0],
|
61
|
+
setDataValue = _useState6[1];
|
54
62
|
var sensors = useSensors(useSensor(PointerSensor, {
|
55
63
|
activationConstraint: {
|
56
64
|
delay: 50,
|
@@ -62,10 +70,22 @@ export var Aside = function Aside(_ref) {
|
|
62
70
|
// 切换选中项
|
63
71
|
var handleClick = function handleClick(key, e) {
|
64
72
|
if (key != null) {
|
73
|
+
var _e$children$0$key, _e$children;
|
65
74
|
setKey(key);
|
75
|
+
setSubKey((_e$children$0$key = e === null || e === void 0 || (_e$children = e.children) === null || _e$children === void 0 || (_e$children = _e$children[0]) === null || _e$children === void 0 ? void 0 : _e$children.key) !== null && _e$children$0$key !== void 0 ? _e$children$0$key : '');
|
66
76
|
onClick === null || onClick === void 0 || onClick(key, e);
|
67
77
|
}
|
68
78
|
};
|
79
|
+
// 切换选中项
|
80
|
+
var handleSubClick = function handleSubClick(key, subKey, e) {
|
81
|
+
if (key != null) {
|
82
|
+
setKey(key);
|
83
|
+
if (subKey != null) {
|
84
|
+
setSubKey(subKey);
|
85
|
+
onSubClick === null || onSubClick === void 0 || onSubClick(key, subKey, e);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
};
|
69
89
|
// 添加
|
70
90
|
var handleAdd = function handleAdd() {
|
71
91
|
onAdd === null || onAdd === void 0 || onAdd();
|
@@ -188,7 +208,7 @@ export var Aside = function Aside(_ref) {
|
|
188
208
|
}),
|
189
209
|
strategy: verticalListSortingStrategy
|
190
210
|
}, dataValue === null || dataValue === void 0 ? void 0 : dataValue.map(function (item) {
|
191
|
-
var _dataValue
|
211
|
+
var _dataValue$, _item$children;
|
192
212
|
return /*#__PURE__*/React.createElement(SortableItem, {
|
193
213
|
key: item.key,
|
194
214
|
activeKey: key !== null && key !== void 0 ? key : dataValue === null || dataValue === void 0 || (_dataValue$ = dataValue[0]) === null || _dataValue$ === void 0 ? void 0 : _dataValue$.key,
|
@@ -204,8 +224,12 @@ export var Aside = function Aside(_ref) {
|
|
204
224
|
onEdit: handleEdit,
|
205
225
|
onDel: handleDel,
|
206
226
|
onSwitch: handleSwitch,
|
227
|
+
onSubClick: handleSubClick,
|
207
228
|
data: item.data,
|
208
|
-
status: item.status
|
229
|
+
status: item.status,
|
230
|
+
subId: subKey !== null && subKey !== void 0 ? subKey : (_item$children = item.children) === null || _item$children === void 0 || (_item$children = _item$children[0]) === null || _item$children === void 0 ? void 0 : _item$children.key,
|
231
|
+
isSubNode: isSubNode,
|
232
|
+
subNode: item.children
|
209
233
|
});
|
210
234
|
})))));
|
211
235
|
};
|
@@ -5,6 +5,14 @@ type IdataItem = {
|
|
5
5
|
checked?: boolean;
|
6
6
|
status?: string;
|
7
7
|
data?: any;
|
8
|
+
children?: Array<{
|
9
|
+
key: string;
|
10
|
+
title: string;
|
11
|
+
extra?: string;
|
12
|
+
checked?: boolean;
|
13
|
+
status?: string;
|
14
|
+
data?: any;
|
15
|
+
}>;
|
8
16
|
};
|
9
17
|
export type AsideProps = {
|
10
18
|
width?: number;
|
@@ -31,6 +39,8 @@ export type AsideProps = {
|
|
31
39
|
onDragEnd?: (data: IdataItem[]) => void;
|
32
40
|
onScrollBottom?: () => void;
|
33
41
|
bottomThreshold?: number;
|
42
|
+
isSubNode: boolean;
|
43
|
+
onSubClick?: (key: string, subKey: string, e: IdataItem) => void;
|
34
44
|
};
|
35
45
|
export type AsideItemProps = {
|
36
46
|
activeKey: string;
|
@@ -44,8 +54,19 @@ export type AsideItemProps = {
|
|
44
54
|
extra?: string;
|
45
55
|
status?: string;
|
46
56
|
data?: any;
|
47
|
-
onClick?: (key: string, e: IdataItem) => void;
|
57
|
+
onClick?: (key: string | undefined, e: IdataItem) => void;
|
48
58
|
onEdit?: (key: string, e: IdataItem) => void;
|
49
59
|
onDel?: (key: string, e: IdataItem) => void;
|
50
60
|
onSwitch?: (key: string, e: boolean) => void;
|
61
|
+
subId?: string;
|
62
|
+
isSubNode?: boolean;
|
63
|
+
subNode?: Array<{
|
64
|
+
key: string;
|
65
|
+
title: string;
|
66
|
+
extra?: string;
|
67
|
+
checked?: boolean;
|
68
|
+
status?: string;
|
69
|
+
data?: any;
|
70
|
+
}>;
|
71
|
+
onSubClick?: (key, subKey: string | undefined, e: IdataItem) => void;
|
51
72
|
};
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export interface WithSearchFormProps {
|
2
|
-
children: ReactNode[];
|
3
|
-
}
|
1
|
+
export interface WithSearchFormProps {
|
2
|
+
children: ReactNode[];
|
3
|
+
}
|