yootd 0.0.59 → 0.0.61
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/Preview/index.js +1 -1
- package/dist/areas/index.js +1 -1
- package/dist/areas-treeSelect/index.js +1 -1
- package/dist/aside/components/SortableItem.js +28 -5
- package/dist/aside/components/SortableItem.scss +3 -0
- package/dist/aside/index.js +40 -9
- package/dist/aside/index.scss +23 -2
- package/dist/aside/types/types.d.ts +47 -44
- package/dist/export/index.js +1 -1
- package/dist/school/index.js +1 -1
- package/dist/year-term/index.js +1 -1
- package/package.json +1 -1
package/dist/Preview/index.js
CHANGED
@@ -14,11 +14,11 @@ import { Background, ReactFlow } from '@xyflow/react';
|
|
14
14
|
import '@xyflow/react/dist/style.css';
|
15
15
|
import React, { useEffect, useState } from 'react';
|
16
16
|
import { useBem } from "../hooks/useBem";
|
17
|
+
import "./index.scss";
|
17
18
|
import Phone from "./components/preview/phone";
|
18
19
|
import Web from "./components/preview/web";
|
19
20
|
import Controls from "./components/reactflow/Controls";
|
20
21
|
import TopPreview from "./components/reactflow/TopPreview";
|
21
|
-
import "./index.scss";
|
22
22
|
export var Preview = function Preview(_ref) {
|
23
23
|
var _ref$controls = _ref.controls,
|
24
24
|
controls = _ref$controls === void 0 ? true : _ref$controls,
|
package/dist/areas/index.js
CHANGED
@@ -7,8 +7,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useQuery } from '@tanstack/react-query';
|
8
8
|
import React, { useEffect, useMemo, useState } from 'react';
|
9
9
|
import { Select } from "./..";
|
10
|
-
import { useRequest } from "../hooks/useRequest";
|
11
10
|
import { useBem } from "../hooks/useBem";
|
11
|
+
import { useRequest } from "../hooks/useRequest";
|
12
12
|
import "./index.scss";
|
13
13
|
export var Areas = function Areas(_ref) {
|
14
14
|
var style = _ref.style,
|
@@ -15,10 +15,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
15
15
|
import { useQuery } from '@tanstack/react-query';
|
16
16
|
import { TreeSelect } from 'antd';
|
17
17
|
import React, { useMemo, useState } from 'react';
|
18
|
+
var SHOW_PARENT = TreeSelect.SHOW_PARENT;
|
18
19
|
import { useBem } from "../hooks/useBem";
|
19
20
|
import { useRequest } from "../hooks/useRequest";
|
20
21
|
import "./index.scss";
|
21
|
-
var SHOW_PARENT = TreeSelect.SHOW_PARENT;
|
22
22
|
export var AreasTreeSelect = function AreasTreeSelect(_ref) {
|
23
23
|
var _ref$depth = _ref.depth,
|
24
24
|
depth = _ref$depth === void 0 ? 5 : _ref$depth,
|
@@ -53,7 +53,12 @@ var SortableItem = function SortableItem(_ref) {
|
|
53
53
|
className: "".concat(mb.b('content'), " ").concat(id === activeKey ? "".concat(mb.e('content-active')) : ''),
|
54
54
|
key: id,
|
55
55
|
onClick: function onClick() {
|
56
|
-
_onClick === null || _onClick === void 0 || _onClick(id
|
56
|
+
_onClick === null || _onClick === void 0 || _onClick(id, {
|
57
|
+
key: id,
|
58
|
+
title: title,
|
59
|
+
extra: extra,
|
60
|
+
checked: checked
|
61
|
+
});
|
57
62
|
}
|
58
63
|
}, /*#__PURE__*/React.createElement("div", {
|
59
64
|
className: "".concat(top)
|
@@ -86,8 +91,17 @@ var SortableItem = function SortableItem(_ref) {
|
|
86
91
|
opacity: id === activeKey ? 1 : 0,
|
87
92
|
display: editBtnIcon ? 'block' : 'none'
|
88
93
|
},
|
89
|
-
onClick: function onClick() {
|
90
|
-
|
94
|
+
onClick: function onClick(e) {
|
95
|
+
if (id !== activeKey) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
e.stopPropagation();
|
99
|
+
onEdit === null || onEdit === void 0 || onEdit(id, {
|
100
|
+
key: id,
|
101
|
+
title: title,
|
102
|
+
extra: extra,
|
103
|
+
checked: checked
|
104
|
+
});
|
91
105
|
}
|
92
106
|
}, /*#__PURE__*/React.createElement(EditBtnIcon, {
|
93
107
|
className: "".concat(top.b('top-middle').b('top-edit-btn-icon').e('edit-btn-icon-svg'))
|
@@ -97,8 +111,17 @@ var SortableItem = function SortableItem(_ref) {
|
|
97
111
|
opacity: id === activeKey ? 1 : 0,
|
98
112
|
display: delBtnIcon ? 'block' : 'none'
|
99
113
|
},
|
100
|
-
onClick: function onClick() {
|
101
|
-
|
114
|
+
onClick: function onClick(e) {
|
115
|
+
if (id !== activeKey) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
e.stopPropagation();
|
119
|
+
onDel === null || onDel === void 0 || onDel(id, {
|
120
|
+
key: id,
|
121
|
+
title: title,
|
122
|
+
extra: extra,
|
123
|
+
checked: checked
|
124
|
+
});
|
102
125
|
}
|
103
126
|
}, /*#__PURE__*/React.createElement(DelBtnIcon, {
|
104
127
|
className: "".concat(top.b('top-middle').b('top-del-btn-icon').e('del-btn-icon-svg'))
|
@@ -4,6 +4,7 @@
|
|
4
4
|
padding: 12px 16px;
|
5
5
|
box-sizing: border-box;
|
6
6
|
cursor: pointer;
|
7
|
+
background-color: #fff;
|
7
8
|
&-top {
|
8
9
|
display: flex;
|
9
10
|
justify-content: space-between;
|
@@ -77,6 +78,7 @@
|
|
77
78
|
right: 16px;
|
78
79
|
height: 1px;
|
79
80
|
background-color: #e5e5e5;
|
81
|
+
z-index: 100;
|
80
82
|
}
|
81
83
|
&__content-active {
|
82
84
|
background-color: #d1eaff;
|
@@ -89,5 +91,6 @@
|
|
89
91
|
width: 4px;
|
90
92
|
height: 100%;
|
91
93
|
background-color: #4d8de2;
|
94
|
+
|
92
95
|
}
|
93
96
|
}
|
package/dist/aside/index.js
CHANGED
@@ -12,7 +12,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
13
13
|
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from '@dnd-kit/core';
|
14
14
|
import { SortableContext, arrayMove, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
15
|
-
import React, { useEffect, useState } from 'react';
|
15
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
16
16
|
import { useBem } from "../hooks/useBem";
|
17
17
|
import { AddBtnIcon } from "./components/AddBtnIcon";
|
18
18
|
import SortableItem from "./components/SortableItem";
|
@@ -26,6 +26,8 @@ export var Aside = function Aside(_ref) {
|
|
26
26
|
activeKey = _ref.activeKey,
|
27
27
|
title = _ref.title,
|
28
28
|
data = _ref.data,
|
29
|
+
_ref$overflow = _ref.overflow,
|
30
|
+
overflow = _ref$overflow === void 0 ? false : _ref$overflow,
|
29
31
|
_ref$titleShow = _ref.titleShow,
|
30
32
|
titleShow = _ref$titleShow === void 0 ? true : _ref$titleShow,
|
31
33
|
_ref$addBtnIcon = _ref.addBtnIcon,
|
@@ -43,8 +45,12 @@ export var Aside = function Aside(_ref) {
|
|
43
45
|
onEdit = _ref.onEdit,
|
44
46
|
onDel = _ref.onDel,
|
45
47
|
onSwitch = _ref.onSwitch,
|
46
|
-
onDragEnd = _ref.onDragEnd
|
48
|
+
onDragEnd = _ref.onDragEnd,
|
49
|
+
onScrollBottom = _ref.onScrollBottom,
|
50
|
+
_ref$bottomThreshold = _ref.bottomThreshold,
|
51
|
+
bottomThreshold = _ref$bottomThreshold === void 0 ? 50 : _ref$bottomThreshold;
|
47
52
|
var mb = useBem('aside');
|
53
|
+
var asideRef = useRef(null);
|
48
54
|
// 当前选择的key
|
49
55
|
var _useState = useState(),
|
50
56
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -64,10 +70,10 @@ export var Aside = function Aside(_ref) {
|
|
64
70
|
coordinateGetter: sortableKeyboardCoordinates
|
65
71
|
}));
|
66
72
|
// 切换选中项
|
67
|
-
var handleClick = function handleClick(key) {
|
73
|
+
var handleClick = function handleClick(key, e) {
|
68
74
|
if (key != null) {
|
69
75
|
setKey(key);
|
70
|
-
onClick === null || onClick === void 0 || onClick(key);
|
76
|
+
onClick === null || onClick === void 0 || onClick(key, e);
|
71
77
|
}
|
72
78
|
};
|
73
79
|
// 添加
|
@@ -75,12 +81,12 @@ export var Aside = function Aside(_ref) {
|
|
75
81
|
onAdd === null || onAdd === void 0 || onAdd();
|
76
82
|
};
|
77
83
|
// 编辑
|
78
|
-
var handleEdit = function handleEdit(key) {
|
79
|
-
onEdit === null || onEdit === void 0 || onEdit(key);
|
84
|
+
var handleEdit = function handleEdit(key, e) {
|
85
|
+
onEdit === null || onEdit === void 0 || onEdit(key, e);
|
80
86
|
};
|
81
87
|
// 删除
|
82
|
-
var handleDel = function handleDel(key) {
|
83
|
-
onDel === null || onDel === void 0 || onDel(key);
|
88
|
+
var handleDel = function handleDel(key, e) {
|
89
|
+
onDel === null || onDel === void 0 || onDel(key, e);
|
84
90
|
};
|
85
91
|
// 开关
|
86
92
|
var handleSwitch = function handleSwitch(key, e) {
|
@@ -121,6 +127,28 @@ export var Aside = function Aside(_ref) {
|
|
121
127
|
}
|
122
128
|
};
|
123
129
|
|
130
|
+
// 添加滚动处理函数
|
131
|
+
var handleScroll = useCallback(function () {
|
132
|
+
if (!asideRef.current || !onScrollBottom) return;
|
133
|
+
var _asideRef$current = asideRef.current,
|
134
|
+
scrollTop = _asideRef$current.scrollTop,
|
135
|
+
scrollHeight = _asideRef$current.scrollHeight,
|
136
|
+
clientHeight = _asideRef$current.clientHeight;
|
137
|
+
if (scrollTop + clientHeight + bottomThreshold >= scrollHeight) {
|
138
|
+
onScrollBottom();
|
139
|
+
}
|
140
|
+
}, [onScrollBottom, bottomThreshold]);
|
141
|
+
|
142
|
+
// 添加滚动监听
|
143
|
+
useEffect(function () {
|
144
|
+
var asideElement = asideRef.current;
|
145
|
+
if (!asideElement || !overflow) return;
|
146
|
+
asideElement.addEventListener('scroll', handleScroll);
|
147
|
+
return function () {
|
148
|
+
asideElement.removeEventListener('scroll', handleScroll);
|
149
|
+
};
|
150
|
+
}, [handleScroll, overflow]);
|
151
|
+
|
124
152
|
// 给key设置初始值
|
125
153
|
useEffect(function () {
|
126
154
|
if (activeKey) {
|
@@ -137,10 +165,13 @@ export var Aside = function Aside(_ref) {
|
|
137
165
|
}
|
138
166
|
}, [data]);
|
139
167
|
return /*#__PURE__*/React.createElement("div", {
|
168
|
+
ref: asideRef,
|
140
169
|
className: "".concat(mb),
|
141
170
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
142
171
|
width: width,
|
143
|
-
height: height
|
172
|
+
height: height,
|
173
|
+
overflowX: overflow ? 'hidden' : 'visible',
|
174
|
+
overflowY: overflow ? 'auto' : 'visible'
|
144
175
|
})
|
145
176
|
}, titleShow && /*#__PURE__*/React.createElement("div", {
|
146
177
|
className: "".concat(mb.b('title'))
|
package/dist/aside/index.scss
CHANGED
@@ -4,12 +4,15 @@
|
|
4
4
|
box-sizing: border-box;
|
5
5
|
&-title {
|
6
6
|
border-bottom: 1px solid #e5e5e5;
|
7
|
-
padding: 16px
|
8
|
-
margin: 0px 16px;
|
7
|
+
padding: 16px 16px;
|
9
8
|
box-sizing: border-box;
|
10
9
|
display: flex;
|
11
10
|
align-items: start;
|
12
11
|
justify-content: space-between;
|
12
|
+
background-color: #fff;
|
13
|
+
position: sticky;
|
14
|
+
top: 0;
|
15
|
+
z-index: 999;
|
13
16
|
&__title-text {
|
14
17
|
font-size: 18px;
|
15
18
|
font-weight: bold;
|
@@ -23,3 +26,21 @@
|
|
23
26
|
}
|
24
27
|
}
|
25
28
|
}
|
29
|
+
// 滚动条宽度
|
30
|
+
.yot-aside::-webkit-scrollbar {
|
31
|
+
width: 6px;
|
32
|
+
height: 10px;
|
33
|
+
}
|
34
|
+
// 滚动条轨道
|
35
|
+
.yot-aside::-webkit-scrollbar-track {
|
36
|
+
background: white;
|
37
|
+
border-radius: 2px;
|
38
|
+
height: 10px;
|
39
|
+
}
|
40
|
+
// 小滑块
|
41
|
+
.yot-aside::-webkit-scrollbar-thumb {
|
42
|
+
background: rgba(0, 0, 0, 0.15);
|
43
|
+
border-radius: 10px;
|
44
|
+
height: 10px;
|
45
|
+
}
|
46
|
+
|
@@ -1,44 +1,47 @@
|
|
1
|
-
type IdataItem = {
|
2
|
-
key: string;
|
3
|
-
title: string;
|
4
|
-
extra?: string;
|
5
|
-
checked?: boolean;
|
6
|
-
};
|
7
|
-
export type AsideProps = {
|
8
|
-
width?: number;
|
9
|
-
height?: number | string;
|
10
|
-
style?: React.CSSProperties;
|
11
|
-
activeKey?: string;
|
12
|
-
title?: string;
|
13
|
-
data: IdataItem[];
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
type IdataItem = {
|
2
|
+
key: string;
|
3
|
+
title: string;
|
4
|
+
extra?: string;
|
5
|
+
checked?: boolean;
|
6
|
+
};
|
7
|
+
export type AsideProps = {
|
8
|
+
width?: number;
|
9
|
+
height?: number | string;
|
10
|
+
style?: React.CSSProperties;
|
11
|
+
activeKey?: string;
|
12
|
+
title?: string;
|
13
|
+
data: IdataItem[];
|
14
|
+
overflow?: boolean;
|
15
|
+
titleShow?: boolean;
|
16
|
+
addBtnIcon?: boolean;
|
17
|
+
editBtnIcon?: boolean;
|
18
|
+
delBtnIcon?: boolean;
|
19
|
+
switchBtnIcon?: boolean;
|
20
|
+
dragBtnIcon?: boolean;
|
21
|
+
onClick?: (key: string, e: IdataItem) => void;
|
22
|
+
onAdd?: () => void;
|
23
|
+
onEdit?: (key: string, e: IdataItem) => void;
|
24
|
+
onDel?: (key: string, e: IdataItem) => void;
|
25
|
+
onSwitch?: (
|
26
|
+
changeValue: { key: string; checked: boolean },
|
27
|
+
data: IdataItem[],
|
28
|
+
) => void;
|
29
|
+
onDragEnd?: (data: IdataItem[]) => void;
|
30
|
+
onScrollBottom?: () => void;
|
31
|
+
bottomThreshold?: number;
|
32
|
+
};
|
33
|
+
export type AsideItemProps = {
|
34
|
+
activeKey: string;
|
35
|
+
id: string;
|
36
|
+
title: string;
|
37
|
+
editBtnIcon?: boolean;
|
38
|
+
delBtnIcon?: boolean;
|
39
|
+
switchBtnIcon?: boolean;
|
40
|
+
dragBtnIcon?: boolean;
|
41
|
+
checked?: boolean;
|
42
|
+
extra?: string;
|
43
|
+
onClick?: (key: string, e: IdataItem) => void;
|
44
|
+
onEdit?: (key: string, e: IdataItem) => void;
|
45
|
+
onDel?: (key: string, e: IdataItem) => void;
|
46
|
+
onSwitch?: (key: string, e: boolean) => void;
|
47
|
+
};
|
package/dist/export/index.js
CHANGED
@@ -7,9 +7,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { Dropdown } from 'antd';
|
8
8
|
import React, { useState } from 'react';
|
9
9
|
import { useBem } from "../hooks/useBem";
|
10
|
+
import "./index.scss";
|
10
11
|
import { DownIcon } from "./components/DownIcon";
|
11
12
|
import { UpIcon } from "./components/UpIcon";
|
12
|
-
import "./index.scss";
|
13
13
|
export var Export = function Export(_ref) {
|
14
14
|
var _ref$items = _ref.items,
|
15
15
|
items = _ref$items === void 0 ? [{
|
package/dist/school/index.js
CHANGED
@@ -17,8 +17,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
17
17
|
import { useQuery } from '@tanstack/react-query';
|
18
18
|
import React, { useEffect, useMemo, useState } from 'react';
|
19
19
|
import { Select } from "./..";
|
20
|
-
import { useRequest } from "../hooks/useRequest";
|
21
20
|
import { useBem } from "../hooks/useBem";
|
21
|
+
import { useRequest } from "../hooks/useRequest";
|
22
22
|
import "./index.scss";
|
23
23
|
export var School = function School(_ref) {
|
24
24
|
var _ref$type = _ref.type,
|
package/dist/year-term/index.js
CHANGED
@@ -11,8 +11,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
11
11
|
import { useQuery } from '@tanstack/react-query';
|
12
12
|
import React, { useEffect, useMemo, useState } from 'react';
|
13
13
|
import { Select } from "./..";
|
14
|
-
import { useRequest } from "../hooks/useRequest";
|
15
14
|
import { useBem } from "../hooks/useBem";
|
15
|
+
import { useRequest } from "../hooks/useRequest";
|
16
16
|
import "./index.scss";
|
17
17
|
export var YearTerm = function YearTerm(_ref) {
|
18
18
|
var _ref$type = _ref.type,
|