yootd 0.2.20 → 0.2.22
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/business-tree/components/dept.d.ts +13 -3
- package/dist/business-tree/components/dept.js +13 -5
- package/dist/business-tree/components/space.d.ts +13 -3
- package/dist/business-tree/components/space.js +13 -5
- package/dist/business-tree/index.d.ts +15 -3
- package/dist/business-tree/index.js +9 -5
- package/dist/index.d.ts +1 -0
- package/dist/upload/components/fileUpload.js +2 -1
- package/dist/upload/components/imageUpload.js +2 -1
- package/dist/with-search-form/index.js +9 -8
- package/dist/with-search-form/types/type.d.ts +1 -1
- package/package.json +1 -1
@@ -1,4 +1,14 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
declare const
|
4
|
-
|
2
|
+
import { TreeRefProps } from "../..";
|
3
|
+
declare const DeptTree: React.ForwardRefExoticComponent<import("antd").TreeProps<import("antd").TreeDataNode> & {
|
4
|
+
showChildNumbers?: boolean | undefined;
|
5
|
+
placeholder?: string | undefined;
|
6
|
+
showSearch?: boolean | undefined;
|
7
|
+
type?: string | undefined;
|
8
|
+
depth?: number | undefined;
|
9
|
+
notRequireSchool?: boolean | undefined;
|
10
|
+
areaType?: number | undefined;
|
11
|
+
areaSubType?: number | undefined;
|
12
|
+
requireLastLevel?: boolean | undefined;
|
13
|
+
} & React.RefAttributes<TreeRefProps>>;
|
14
|
+
export default DeptTree;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
4
|
-
import React, { useMemo } from 'react';
|
4
|
+
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
5
5
|
import { Tree } from "../..";
|
6
6
|
import { useRequest } from "../../hooks/useRequest";
|
7
|
-
var
|
7
|
+
var DeptTree = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
8
8
|
var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
9
9
|
var request = useRequest();
|
10
10
|
var _useQuery = useQuery({
|
@@ -19,7 +19,8 @@ var App = function App(_ref) {
|
|
19
19
|
});
|
20
20
|
}
|
21
21
|
}),
|
22
|
-
queryDepts = _useQuery.data
|
22
|
+
queryDepts = _useQuery.data,
|
23
|
+
refetch = _useQuery.refetch;
|
23
24
|
var treeData = useMemo(function () {
|
24
25
|
if (queryDepts !== null && queryDepts !== void 0 && queryDepts.content) {
|
25
26
|
var jsonStr = JSON.stringify(queryDepts.content);
|
@@ -27,9 +28,16 @@ var App = function App(_ref) {
|
|
27
28
|
return JSON.parse(formatted);
|
28
29
|
}
|
29
30
|
}, [queryDepts]);
|
31
|
+
useImperativeHandle(ref, function () {
|
32
|
+
return {
|
33
|
+
refetchData: function refetchData() {
|
34
|
+
refetch();
|
35
|
+
}
|
36
|
+
};
|
37
|
+
});
|
30
38
|
return /*#__PURE__*/React.createElement(Tree, _extends({
|
31
39
|
treeData: treeData,
|
32
40
|
showIcon: true
|
33
41
|
}, props));
|
34
|
-
};
|
35
|
-
export default
|
42
|
+
});
|
43
|
+
export default DeptTree;
|
@@ -1,4 +1,14 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
declare const
|
4
|
-
|
2
|
+
import { TreeRefProps } from "../..";
|
3
|
+
declare const SpaceTree: React.ForwardRefExoticComponent<import("antd").TreeProps<import("antd").TreeDataNode> & {
|
4
|
+
showChildNumbers?: boolean | undefined;
|
5
|
+
placeholder?: string | undefined;
|
6
|
+
showSearch?: boolean | undefined;
|
7
|
+
type?: string | undefined;
|
8
|
+
depth?: number | undefined;
|
9
|
+
notRequireSchool?: boolean | undefined;
|
10
|
+
areaType?: number | undefined;
|
11
|
+
areaSubType?: number | undefined;
|
12
|
+
requireLastLevel?: boolean | undefined;
|
13
|
+
} & React.RefAttributes<TreeRefProps>>;
|
14
|
+
export default SpaceTree;
|
@@ -2,10 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["depth", "notRequireSchool", "areaType", "areaSubType", "requireLastLevel"];
|
4
4
|
import { useQuery } from '@tanstack/react-query';
|
5
|
-
import React, { useMemo } from 'react';
|
5
|
+
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
6
6
|
import { Tree } from "../..";
|
7
7
|
import { useRequest } from "../../hooks/useRequest";
|
8
|
-
var
|
8
|
+
var SpaceTree = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
9
9
|
var depth = _ref.depth,
|
10
10
|
notRequireSchool = _ref.notRequireSchool,
|
11
11
|
areaType = _ref.areaType,
|
@@ -31,7 +31,8 @@ var App = function App(_ref) {
|
|
31
31
|
});
|
32
32
|
}
|
33
33
|
}),
|
34
|
-
queryAreas = _useQuery.data
|
34
|
+
queryAreas = _useQuery.data,
|
35
|
+
refetch = _useQuery.refetch;
|
35
36
|
var treeData = useMemo(function () {
|
36
37
|
if (queryAreas !== null && queryAreas !== void 0 && queryAreas.content) {
|
37
38
|
var jsonStr = JSON.stringify(queryAreas.content);
|
@@ -39,11 +40,18 @@ var App = function App(_ref) {
|
|
39
40
|
return JSON.parse(formatted);
|
40
41
|
}
|
41
42
|
}, [queryAreas]);
|
43
|
+
useImperativeHandle(ref, function () {
|
44
|
+
return {
|
45
|
+
refetchData: function refetchData() {
|
46
|
+
refetch();
|
47
|
+
}
|
48
|
+
};
|
49
|
+
});
|
42
50
|
return /*#__PURE__*/React.createElement(Tree, _extends({
|
43
51
|
treeData: treeData,
|
44
52
|
showIcon: true
|
45
53
|
}, props, {
|
46
54
|
notRequireSchool: notRequireSchool
|
47
55
|
}));
|
48
|
-
};
|
49
|
-
export default
|
56
|
+
});
|
57
|
+
export default SpaceTree;
|
@@ -1,3 +1,15 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
1
|
+
import React from 'react';
|
2
|
+
export interface TreeRefProps {
|
3
|
+
refetchData: () => void;
|
4
|
+
}
|
5
|
+
export declare const BusinessTree: React.ForwardRefExoticComponent<import("antd").TreeProps<import("antd").TreeDataNode> & {
|
6
|
+
showChildNumbers?: boolean | undefined;
|
7
|
+
placeholder?: string | undefined;
|
8
|
+
showSearch?: boolean | undefined;
|
9
|
+
type?: string | undefined;
|
10
|
+
depth?: number | undefined;
|
11
|
+
notRequireSchool?: boolean | undefined;
|
12
|
+
areaType?: number | undefined;
|
13
|
+
areaSubType?: number | undefined;
|
14
|
+
requireLastLevel?: boolean | undefined;
|
15
|
+
} & React.RefAttributes<TreeRefProps>>;
|
@@ -1,15 +1,19 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["type"];
|
4
|
-
import React from 'react';
|
4
|
+
import React, { forwardRef } from 'react';
|
5
5
|
import Departments from "./components/dept";
|
6
6
|
import Space from "./components/space";
|
7
|
-
export var BusinessTree = function
|
7
|
+
export var BusinessTree = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
8
8
|
var type = _ref.type,
|
9
9
|
props = _objectWithoutProperties(_ref, _excluded);
|
10
10
|
return /*#__PURE__*/React.createElement(React.Fragment, null, type === 'dept' ? /*#__PURE__*/React.createElement(Departments, _extends({
|
11
11
|
type: type
|
12
|
-
}, props
|
12
|
+
}, props, {
|
13
|
+
ref: ref
|
14
|
+
})) : null, type === 'area' ? /*#__PURE__*/React.createElement(Space, _extends({
|
13
15
|
type: type
|
14
|
-
}, props
|
15
|
-
|
16
|
+
}, props, {
|
17
|
+
ref: ref
|
18
|
+
})) : null);
|
19
|
+
});
|
package/dist/index.d.ts
CHANGED
@@ -70,6 +70,7 @@ export { ApprovalProcess } from './approval-process';
|
|
70
70
|
export { State } from './state';
|
71
71
|
export type { StateProps } from './state';
|
72
72
|
export { BusinessTree } from './business-tree';
|
73
|
+
export type { TreeRefProps } from './business-tree';
|
73
74
|
export { Table } from './table';
|
74
75
|
export type { ColumnGroupProps, ColumnProps, TableProps } from './table';
|
75
76
|
export { Typography } from './typography';
|
@@ -115,7 +115,8 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
115
115
|
url: item.filename,
|
116
116
|
uid: file.uid,
|
117
117
|
preview: item.filename,
|
118
|
-
status: 'done'
|
118
|
+
status: 'done',
|
119
|
+
size: file.size
|
119
120
|
});
|
120
121
|
});
|
121
122
|
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(filteredList), _list));
|
@@ -142,7 +142,8 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
142
142
|
url: item.filename,
|
143
143
|
uid: file.uid,
|
144
144
|
preview: item.filename,
|
145
|
-
status: 'done'
|
145
|
+
status: 'done',
|
146
|
+
size: file.size
|
146
147
|
});
|
147
148
|
});
|
148
149
|
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(fileList), _fileList));
|
@@ -6,6 +6,7 @@ import { useBem } from "../hooks/useBem";
|
|
6
6
|
import "./index.scss";
|
7
7
|
export var WithSearchForm = function WithSearchForm(_ref) {
|
8
8
|
var children = _ref.children;
|
9
|
+
var childrenArray = React.Children.toArray(children);
|
9
10
|
var mb = useBem('WithSearchForm');
|
10
11
|
// 外层dom实例
|
11
12
|
var formRef = useRef(null);
|
@@ -13,7 +14,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
13
14
|
var btnRef = useRef(null);
|
14
15
|
// 传进来的children dom数组实例
|
15
16
|
var childRefs = useRef([]);
|
16
|
-
var _useState = useState(
|
17
|
+
var _useState = useState(childrenArray.length),
|
17
18
|
_useState2 = _slicedToArray(_useState, 2),
|
18
19
|
visibleCount = _useState2[0],
|
19
20
|
setVisibleCount = _useState2[1];
|
@@ -23,7 +24,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
23
24
|
isExpanded = _useState4[0],
|
24
25
|
setIsExpanded = _useState4[1];
|
25
26
|
// 计算出应该显示的children数量
|
26
|
-
var _useState5 = useState(
|
27
|
+
var _useState5 = useState(childrenArray.length),
|
27
28
|
_useState6 = _slicedToArray(_useState5, 2),
|
28
29
|
calculatedCount = _useState6[0],
|
29
30
|
setCalculatedCount = _useState6[1];
|
@@ -70,7 +71,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
70
71
|
// 保存计算出的数量
|
71
72
|
setCalculatedCount(itemCount);
|
72
73
|
// 根据展开状态设置可见数量
|
73
|
-
setVisibleCount(isExpanded ?
|
74
|
+
setVisibleCount(isExpanded ? childrenArray.length : itemCount);
|
74
75
|
};
|
75
76
|
useEffect(function () {
|
76
77
|
// 创建 ResizeObserver 实例
|
@@ -85,12 +86,12 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
85
86
|
return function () {
|
86
87
|
resizeObserver.disconnect();
|
87
88
|
};
|
88
|
-
}, [
|
89
|
+
}, [childrenArray, isExpanded]);
|
89
90
|
|
90
91
|
// 处理展开/收起的点击事件
|
91
92
|
var handleExpandClick = function handleExpandClick() {
|
92
93
|
setIsExpanded(!isExpanded);
|
93
|
-
setVisibleCount(!isExpanded ?
|
94
|
+
setVisibleCount(!isExpanded ? childrenArray.length : calculatedCount);
|
94
95
|
};
|
95
96
|
return /*#__PURE__*/React.createElement("div", {
|
96
97
|
ref: formRef,
|
@@ -103,7 +104,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
103
104
|
flexWrap: 'wrap',
|
104
105
|
width: '100%'
|
105
106
|
}
|
106
|
-
},
|
107
|
+
}, childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.map(function (child, index) {
|
107
108
|
return /*#__PURE__*/React.createElement("div", {
|
108
109
|
key: "measure-".concat(index),
|
109
110
|
ref: function ref(el) {
|
@@ -113,7 +114,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
113
114
|
display: 'inline-block'
|
114
115
|
}
|
115
116
|
}, child);
|
116
|
-
})),
|
117
|
+
})), childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.slice(0, visibleCount), /*#__PURE__*/React.createElement("div", {
|
117
118
|
ref: btnRef
|
118
119
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
119
120
|
className: "mb-4"
|
@@ -123,7 +124,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
|
|
123
124
|
}, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
|
124
125
|
type: "default",
|
125
126
|
htmlType: "reset"
|
126
|
-
}, "\u91CD\u7F6E"), (
|
127
|
+
}, "\u91CD\u7F6E"), (childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length) > calculatedCount ? /*#__PURE__*/React.createElement("span", {
|
127
128
|
className: "".concat(mb.e('expanded')),
|
128
129
|
onClick: handleExpandClick
|
129
130
|
}, isExpanded ? '收起' : '展开', ' ', /*#__PURE__*/React.createElement(DownOutlined, {
|