@voplus/morpho-document 1.0.0-dev198 → 1.0.0-dev200
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/changelog.md +3 -0
- package/es/components/AvatarList/AvatarItem/index.d.ts +14 -0
- package/es/components/AvatarList/AvatarItem/index.js +35 -0
- package/es/components/AvatarList/AvatarItem/index.js.map +1 -0
- package/es/components/AvatarList/AvatarItem/index.less +14 -0
- package/es/components/AvatarList/index.d.ts +4 -1
- package/es/components/AvatarList/index.js +72 -79
- package/es/components/AvatarList/index.js.map +1 -1
- package/es/components/AvatarList/index.less +23 -29
- package/es/components/AvatarList/state.d.ts +16 -2
- package/es/components/AvatarList/state.js +15 -6
- package/es/components/AvatarList/state.js.map +1 -1
- package/es/components/DocumentItem/index.js +8 -5
- package/es/components/DocumentItem/index.js.map +1 -1
- package/es/components/DocumentItem/state.d.ts +0 -3
- package/es/components/DocumentItem/state.js +1 -14
- package/es/components/DocumentItem/state.js.map +1 -1
- package/es/components/DocumentList/index.js +2 -1
- package/es/components/DocumentList/index.js.map +1 -1
- package/es/components/DocumentListView/index.js +2 -1
- package/es/components/DocumentListView/index.js.map +1 -1
- package/es/components/DocumentName/index.js +2 -2
- package/es/components/DocumentName/index.js.map +1 -1
- package/es/components/FileViewer/Preview.d.ts +1 -0
- package/es/components/FileViewer/Preview.js +22 -6
- package/es/components/FileViewer/Preview.js.map +1 -1
- package/es/components/FileViewer/index.less +8 -0
- package/es/components/Links/Item.js +1 -3
- package/es/components/Links/Item.js.map +1 -1
- package/es/components/QuickAccessPanel/index.d.ts +3 -0
- package/es/components/QuickAccessPanel/index.js +7 -0
- package/es/components/QuickAccessPanel/index.js.map +1 -0
- package/es/components/QuickAccessSearch/ObjectItem/index.d.ts +8 -0
- package/es/components/QuickAccessSearch/ObjectItem/index.js +13 -0
- package/es/components/QuickAccessSearch/ObjectItem/index.js.map +1 -0
- package/es/components/QuickAccessSearch/ObjectItem/index.less +21 -0
- package/es/components/QuickAccessSearch/ObjectList/index.d.ts +5 -0
- package/es/components/QuickAccessSearch/ObjectList/index.js +42 -0
- package/es/components/QuickAccessSearch/ObjectList/index.js.map +1 -0
- package/es/components/QuickAccessSearch/ObjectList/index.less +10 -0
- package/es/components/QuickAccessSearch/ObjectList/state.d.ts +40 -0
- package/es/components/QuickAccessSearch/ObjectList/state.js +61 -0
- package/es/components/QuickAccessSearch/ObjectList/state.js.map +1 -0
- package/es/components/QuickAccessSearch/index.d.ts +3 -0
- package/es/components/QuickAccessSearch/index.js +47 -0
- package/es/components/QuickAccessSearch/index.js.map +1 -0
- package/es/components/QuickAccessSearch/index.less +22 -0
- package/es/components/QuickAccessSearch/state.d.ts +22 -0
- package/es/components/QuickAccessSearch/state.js +69 -0
- package/es/components/QuickAccessSearch/state.js.map +1 -0
- package/es/components/QuickViewDialog/QuickSubTab/index.d.ts +15 -0
- package/es/components/QuickViewDialog/QuickSubTab/index.js +37 -0
- package/es/components/QuickViewDialog/QuickSubTab/index.js.map +1 -0
- package/es/components/QuickViewDialog/QuickSubTab/index.less +34 -0
- package/es/components/QuickViewDialog/index.js +4 -25
- package/es/components/QuickViewDialog/index.js.map +1 -1
- package/es/components/QuickViewDialog/index.less +1 -31
- package/es/components/SortableTreeDocumentTheme/node-content-renderer.js +1 -1
- package/es/components/SortableTreeDocumentTheme/node-content-renderer.js.map +1 -1
- package/es/components/TagView/index.js +1 -1
- package/es/components/TagView/index.js.map +1 -1
- package/es/controls/DocumentTypeFilter/index.d.ts +0 -0
- package/es/controls/DocumentTypeFilter/index.js +54 -0
- package/es/controls/DocumentTypeFilter/index.js.map +1 -0
- package/es/controls/Panable/index.d.ts +6 -0
- package/es/controls/Panable/index.js +54 -0
- package/es/controls/Panable/index.js.map +1 -0
- package/es/controls/Panable/index.less +27 -0
- package/es/controls/Panable/state.d.ts +8 -0
- package/es/controls/Panable/state.js +31 -0
- package/es/controls/Panable/state.js.map +1 -0
- package/es/controls/QuickDataIcon/UserQuickIcon/index.js +13 -5
- package/es/controls/QuickDataIcon/UserQuickIcon/index.js.map +1 -1
- package/es/controls/ToolBar/index.js +14 -4
- package/es/controls/ToolBar/index.js.map +1 -1
- package/es/controls/ToolBar/state.d.ts +1 -0
- package/es/data/DocumentStore/DocumentStore.d.ts +1 -0
- package/es/data/DocumentStore/DocumentStore.js.map +1 -1
- package/es/data/DocumentTypeStore.js +7 -1
- package/es/data/DocumentTypeStore.js.map +1 -1
- package/es/pages/TreeViewPage/index.js +26 -2
- package/es/pages/TreeViewPage/index.js.map +1 -1
- package/es/pages/TreeViewPage/index.less +22 -0
- package/package.json +3 -3
package/changelog.md
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./index.less";
|
|
3
|
+
declare const AvatarItem: {
|
|
4
|
+
(props: {
|
|
5
|
+
id: string;
|
|
6
|
+
index?: number | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
showName?: boolean | undefined;
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
defaultProps: {
|
|
11
|
+
showName: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default AvatarItem;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "./index.less";
|
|
2
|
+
import { Avatar, Tooltip } from "@voplus/antd";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { useContact } from "@voplus/morpho-org";
|
|
6
|
+
import { useObserver } from "mobx-react-lite";
|
|
7
|
+
const colorList = ["#765FEE", "#fe4066", "#FFC832", "#FF8F5E", "#3AC43A", "#FFC832"];
|
|
8
|
+
const AvatarItem = (props) => {
|
|
9
|
+
const { id, index, disabled, showName } = props;
|
|
10
|
+
const contact = useContact(id, { reload: false });
|
|
11
|
+
return useObserver(() => (React.createElement(React.Fragment, null, !!showName ? (React.createElement("div", { className: classnames({ "avatar-item-disabled": !!disabled }, "avatar-item") },
|
|
12
|
+
React.createElement(Avatar
|
|
13
|
+
// src={contact.url}
|
|
14
|
+
, {
|
|
15
|
+
// src={contact.url}
|
|
16
|
+
size: "small", className: "avatar-item-img", style: { backgroundColor: colorList[(index || 0) % 6] } }, setName(contact.name)),
|
|
17
|
+
contact.name)) : (React.createElement(Tooltip, { title: contact.name },
|
|
18
|
+
React.createElement(Avatar
|
|
19
|
+
// src={contact.url}
|
|
20
|
+
, {
|
|
21
|
+
// src={contact.url}
|
|
22
|
+
size: "small", className: "avatar-item-img", style: { backgroundColor: colorList[(index || 0) % 6] } }, setName(contact.name)))))));
|
|
23
|
+
function setName(name) {
|
|
24
|
+
let str = "";
|
|
25
|
+
name === null || name === void 0 ? void 0 : name.split(" ").forEach(r => {
|
|
26
|
+
str += r.substr(0, 1);
|
|
27
|
+
});
|
|
28
|
+
return str;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
AvatarItem.defaultProps = {
|
|
32
|
+
showName: true
|
|
33
|
+
};
|
|
34
|
+
export default AvatarItem;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/AvatarList/AvatarItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAErF,MAAM,UAAU,GAAG,CAAC,KAKnB,EAAE,EAAE;IACJ,MAAM,EAAE,EAAE,EAAE,KAAK,EA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QACvB,CAAC,EAAE;QACH,OAAO,GAAG,CAAC;IACZ,CAAC;AACF,CAAC,CAAC;AACF,UAAU,CAAC,YAAY,GAAG;IACzB,QAAQ,EAAE,IAAI;CACd,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const AvatarList: {
|
|
3
3
|
(props: {
|
|
4
|
-
list?: any;
|
|
4
|
+
list?: any[] | undefined;
|
|
5
5
|
className?: string | undefined;
|
|
6
6
|
onChange?: ((ids?: any[] | undefined, members?: any[] | undefined) => void) | undefined;
|
|
7
7
|
editable?: boolean | undefined;
|
|
8
|
+
num?: number | undefined;
|
|
8
9
|
size?: number | "small" | "default" | "large" | undefined;
|
|
10
|
+
icon?: any;
|
|
9
11
|
multiple?: boolean | undefined;
|
|
10
12
|
}): JSX.Element;
|
|
11
13
|
defaultProps: {
|
|
12
14
|
editable: boolean;
|
|
13
15
|
size: string;
|
|
16
|
+
num: number;
|
|
14
17
|
};
|
|
15
18
|
};
|
|
16
19
|
export default AvatarList;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Avatar, Dropdown, Input
|
|
1
|
+
import { Avatar, Button, Dropdown, Input } from "@voplus/antd";
|
|
2
2
|
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
import AvatarItem from "./AvatarItem";
|
|
3
4
|
import { FontAwesomeIcon as FAIcon } from "@fortawesome/react-fontawesome";
|
|
4
5
|
import { LoadingOutlined } from "@ant-design/icons";
|
|
6
|
+
import Scrollbars from "react-custom-scrollbars";
|
|
5
7
|
import { State } from "./state";
|
|
6
8
|
import classnames from "classnames";
|
|
7
9
|
import { faCheck } from "@fortawesome/pro-light-svg-icons";
|
|
@@ -9,18 +11,57 @@ import styles from "./index.less";
|
|
|
9
11
|
import { useContactListEffect } from "@voplus/morpho-org";
|
|
10
12
|
import { useObserver } from "mobx-react-lite";
|
|
11
13
|
const AvatarList = (props) => {
|
|
12
|
-
const { multiple, list, size, editable, className } = props;
|
|
14
|
+
const { multiple, list, size, editable, num, className } = props;
|
|
13
15
|
const [state] = useState(new State());
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
useContactListEffect(list => {
|
|
17
|
+
state.list = list;
|
|
18
|
+
});
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
state.items = [];
|
|
21
|
+
state.keyword = "";
|
|
22
|
+
load();
|
|
23
|
+
}, [state.visible]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
state.members = list || [];
|
|
26
|
+
const total = (list && list.length) || 0;
|
|
27
|
+
const parentWidth = ref.current ? ref.current.parentNode.offsetWidth : 0;
|
|
28
|
+
const totalNum = props.num || Math.round(parentWidth / 30) - 1;
|
|
29
|
+
// 最多显示10个
|
|
30
|
+
const num = totalNum > 9 && !multiple ? 9 : totalNum;
|
|
31
|
+
state.hasMore = !!(num && num < total);
|
|
32
|
+
state.num = num || total;
|
|
33
|
+
}, [JSON.stringify(list)]);
|
|
34
|
+
const ref = useRef(null);
|
|
35
|
+
return useObserver(() => (React.createElement("div", { ref: ref, className: classnames("avatar-list", className) },
|
|
36
|
+
state.members &&
|
|
37
|
+
state.members
|
|
38
|
+
.slice(0, multiple ? state.members.length : state.num)
|
|
39
|
+
.map((member, index) => (React.createElement(React.Fragment, { key: member.id },
|
|
40
|
+
React.createElement(AvatarItem, { key: member.id, id: member.id, disabled: member.disabled, index: index, showName: false })))),
|
|
41
|
+
(editable || state.hasMore) && (React.createElement(Dropdown, { onVisibleChange: visibleChange, visible: state.visible, overlay: React.createElement("div", { className: styles["member-menu-list"] },
|
|
42
|
+
React.createElement("div", { className: "avatar-search" },
|
|
43
|
+
React.createElement(Input.Search, { value: state.keyword, autoFocus: true, onSearch: searchByKeWord, onChange: e => searchByKeWord(e.target.value) })),
|
|
44
|
+
React.createElement("div", { style: { flex: 1 } },
|
|
45
|
+
React.createElement(Scrollbars, { autoHide: true }, state.items.map((item, index) => (React.createElement("div", { key: item.id, className: "member-menu-item", onClick: () => onTick(item, !item.checked) },
|
|
46
|
+
React.createElement(AvatarItem, { id: item.id, disabled: item.disabled, index: index }),
|
|
47
|
+
item.checked && (React.createElement(FAIcon, { icon: faCheck, className: classnames("icon-check", { disabled: item.disabled }) })),
|
|
48
|
+
item.loading && React.createElement(LoadingOutlined, { className: "icon-check" })))))),
|
|
49
|
+
multiple && (React.createElement("div", { className: "multiple-footer-btn" },
|
|
50
|
+
React.createElement(Button, { type: "link", onClick: () => visibleChange(false) }, "Ok")))), trigger: editable ? ["click"] : ["hover"] }, props.icon ? (React.createElement("span", null,
|
|
51
|
+
props.icon,
|
|
52
|
+
state.hasMore ? state.members.length - state.num : "")) : (React.createElement(Avatar, { size: size, className: "avatar-text" },
|
|
53
|
+
"+",
|
|
54
|
+
state.hasMore ? state.members.length - state.num : "")))))));
|
|
55
|
+
function onTick(item, checked) {
|
|
56
|
+
if (item.disabled || !editable)
|
|
16
57
|
return;
|
|
17
|
-
state.
|
|
18
|
-
|
|
19
|
-
|
|
58
|
+
state.checkedIds = checked
|
|
59
|
+
? [...state.checkedIds, item.id]
|
|
60
|
+
: state.checkedIds.filter(id => id !== item.id);
|
|
20
61
|
if (props.onChange) {
|
|
21
|
-
|
|
22
|
-
props.onChange(
|
|
23
|
-
|
|
62
|
+
item.loading = true;
|
|
63
|
+
props.onChange(state.checkedIds, item);
|
|
64
|
+
item.loading = false;
|
|
24
65
|
item.checked = !item.checked;
|
|
25
66
|
if (!multiple)
|
|
26
67
|
state.visible = false;
|
|
@@ -29,85 +70,37 @@ const AvatarList = (props) => {
|
|
|
29
70
|
state.members = checked
|
|
30
71
|
? [...state.members, item]
|
|
31
72
|
: state.members.filter(({ id }) => id !== item.id);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
73
|
+
}
|
|
74
|
+
function searchByKeWord(keyWord) {
|
|
75
|
+
state.keyword = keyWord;
|
|
76
|
+
state.items = state.list.filter(({ name }) => name
|
|
77
|
+
.toLowerCase()
|
|
78
|
+
.replace(/\s*/g, "")
|
|
79
|
+
.indexOf(keyWord.toLowerCase().replace(/\s*/g, "")) !== -1);
|
|
80
|
+
}
|
|
81
|
+
function visibleChange(visible) {
|
|
37
82
|
state.visible = visible;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const avatar = avatarList.find(({ id }) => item.id === id);
|
|
83
|
+
}
|
|
84
|
+
function load() {
|
|
85
|
+
const oList = state.list.map(item => {
|
|
86
|
+
const avatar = state.members.find(({ id }) => item.id === id);
|
|
43
87
|
return {
|
|
44
88
|
...item,
|
|
45
89
|
checked: !!(avatar && avatar.id),
|
|
46
90
|
disabled: !!(avatar && avatar.disabled)
|
|
47
91
|
};
|
|
48
92
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return str;
|
|
56
|
-
};
|
|
57
|
-
useContactListEffect(list => {
|
|
58
|
-
state.list = list;
|
|
59
|
-
}, { reload: false });
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
state.items = [];
|
|
62
|
-
load();
|
|
63
|
-
}, [state.visible]);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
state.members = list || [];
|
|
66
|
-
if (!multiple) {
|
|
67
|
-
const parentWidth = ref.current ? ref.current.parentNode.offsetWidth : 0;
|
|
68
|
-
const num = Math.round(parentWidth / 30) - 1;
|
|
69
|
-
const total = (list && list.length) || 0;
|
|
70
|
-
state.hasMore = !!(num && num < total);
|
|
71
|
-
state.num = num || total;
|
|
72
|
-
}
|
|
73
|
-
}, [list]);
|
|
74
|
-
const ref = useRef(null);
|
|
75
|
-
const colorList = ["#765FEE", "#fe4066", "#FFC832", "#FF8F5E", "#3AC43A", "#FFC832"];
|
|
76
|
-
return useObserver(() => (React.createElement("div", { ref: ref, className: classnames(styles["avatar-list"], className) },
|
|
77
|
-
state.members &&
|
|
78
|
-
state.members
|
|
79
|
-
.slice(0, multiple ? state.members.length : state.num)
|
|
80
|
-
.map((member, index) => (React.createElement(Tooltip, { key: index, title: member.name },
|
|
81
|
-
React.createElement(Avatar, { src: member.url, size: size, className: "avatar-img", style: member.url
|
|
82
|
-
? {}
|
|
83
|
-
: { backgroundColor: colorList[index % 6], opacity: member.disabled ? 0.7 : 1 } }, setName(member.name))))),
|
|
84
|
-
editable ? (React.createElement(Dropdown, { onVisibleChange: visibleChange, visible: state.visible, overlay: React.createElement(Menu, null,
|
|
85
|
-
React.createElement("div", { className: "avatar-search" },
|
|
86
|
-
React.createElement(Input.Search, { onSearch: searchByKeWord })),
|
|
87
|
-
state.items.map((item, index) => (React.createElement(Menu.Item, { key: item.id },
|
|
88
|
-
React.createElement("div", { className: "avatar-item", onClick: () => onTick(item, !item.checked) },
|
|
89
|
-
React.createElement(Avatar, { src: item.url, size: size, className: "avatar-img", style: { backgroundColor: colorList[index % 6] } }),
|
|
90
|
-
React.createElement("span", { className: classnames({ "name-disabled": item.disabled }) }, item.name),
|
|
91
|
-
item.checked && (React.createElement(FAIcon, { icon: faCheck, className: classnames("icon-check", { disabled: item.disabled }) })),
|
|
92
|
-
state.loading && state.itemId === item.id && (React.createElement(LoadingOutlined, { className: "icon-check" }))))))), overlayClassName: styles["avatar-dropdown"],
|
|
93
|
-
// placement="bottomCenter"
|
|
94
|
-
trigger: ["click"], getPopupContainer: (triggerNode) => triggerNode.parentElement },
|
|
95
|
-
React.createElement(Avatar, { size: size, className: "avatar-text" },
|
|
96
|
-
"+",
|
|
97
|
-
state.hasMore ? state.members.length - state.num : ""))) : state.hasMore ? (React.createElement(Dropdown, { overlayClassName: styles["avatar-dropdown"],
|
|
98
|
-
// placement="bottomCenter"
|
|
99
|
-
getPopupContainer: (triggerNode) => triggerNode.parentElement, overlay: React.createElement(Menu, null, state.members.map((item, index) => (React.createElement(Menu.Item, { key: item.id },
|
|
100
|
-
React.createElement("div", { className: "avatar-item" },
|
|
101
|
-
React.createElement(Avatar, { src: item.url, size: size, className: "avatar-img", style: { backgroundColor: colorList[index % 6] } }),
|
|
102
|
-
React.createElement("span", { className: classnames({ "name-disabled": item.disabled }) }, item.name),
|
|
103
|
-
item.checked && (React.createElement(FAIcon, { icon: faCheck, className: classnames("icon-check", { disabled: item.disabled }) }))))))) },
|
|
104
|
-
React.createElement(Avatar, { size: size, className: "avatar-text" },
|
|
105
|
-
"+",
|
|
106
|
-
state.members.length - state.num))) : (""))));
|
|
93
|
+
state.checkedIds = state.list
|
|
94
|
+
.filter(item => state.members.some(m => m.id === item.id))
|
|
95
|
+
.map(({ id }) => id);
|
|
96
|
+
state.list = oList;
|
|
97
|
+
state.items = oList;
|
|
98
|
+
}
|
|
107
99
|
};
|
|
108
100
|
AvatarList.defaultProps = {
|
|
109
101
|
editable: true,
|
|
110
|
-
size: "small"
|
|
102
|
+
size: "small",
|
|
103
|
+
num: 0
|
|
111
104
|
};
|
|
112
105
|
export default AvatarList;
|
|
113
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AvatarList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AvatarList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAW,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,IAAI,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,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,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;aACzD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;AACF,CAAC,CAAC;AACF,UAAU,CAAC,YAAY,GAAG;IACzB,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,CAAC;CACN,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
@import "~@voplus/antd/es/style/themes/default.less";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.avatar-img {
|
|
6
|
-
margin-right: 5px;
|
|
7
|
-
font-size: 14px !important;
|
|
8
|
-
}
|
|
2
|
+
:global {
|
|
3
|
+
.avatar-list {
|
|
4
|
+
display: inline-block;
|
|
9
5
|
.avatar-text {
|
|
10
6
|
font-size: 14px !important;
|
|
11
7
|
background: #fff;
|
|
@@ -20,34 +16,24 @@
|
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
|
-
.
|
|
24
|
-
|
|
19
|
+
.member-menu-list {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
height: 60vh;
|
|
23
|
+
background: #fff;
|
|
24
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
25
|
+
overflow: hidden;
|
|
25
26
|
:global {
|
|
26
|
-
// .ant-dropdown-menu {
|
|
27
|
-
// max-height: 450px;
|
|
28
|
-
// overflow: auto;
|
|
29
|
-
// }
|
|
30
27
|
.avatar-search {
|
|
31
28
|
padding: 10px 10px 5px 10px;
|
|
32
|
-
.ant-input {
|
|
33
|
-
// width: 160px;
|
|
34
|
-
height: 28px;
|
|
35
|
-
line-height: 28px;
|
|
29
|
+
.ant-input-affix-wrapper {
|
|
36
30
|
border-radius: 20px;
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
padding: 5px 28px 5px 12px;
|
|
44
|
-
.avatar-img {
|
|
45
|
-
margin-right: 5px;
|
|
46
|
-
}
|
|
47
|
-
.name-disabled {
|
|
48
|
-
color: #999;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
33
|
+
.member-menu-item {
|
|
34
|
+
position: relative;
|
|
35
|
+
padding: 0 26px 0 15px;
|
|
36
|
+
cursor: pointer;
|
|
51
37
|
.icon-check {
|
|
52
38
|
position: absolute;
|
|
53
39
|
right: 12px;
|
|
@@ -58,5 +44,13 @@
|
|
|
58
44
|
}
|
|
59
45
|
}
|
|
60
46
|
}
|
|
47
|
+
|
|
48
|
+
.multiple-footer-btn {
|
|
49
|
+
border-top: 1px solid #d9d9dd;
|
|
50
|
+
text-align: right;
|
|
51
|
+
.ant-btn {
|
|
52
|
+
height: 30px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
61
55
|
}
|
|
62
56
|
}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
export declare type AvatarListProps = {
|
|
2
|
+
list?: any[];
|
|
3
|
+
className?: string;
|
|
4
|
+
onChange?: (ids?: any[], members?: any[]) => void;
|
|
5
|
+
editable?: boolean;
|
|
6
|
+
num?: number;
|
|
7
|
+
size?: number | "large" | "small" | "default";
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** color of member of random display for no url */
|
|
11
|
+
export declare const colorList: string[];
|
|
1
12
|
export declare class State {
|
|
2
13
|
avatarList: any[];
|
|
3
14
|
members: any[];
|
|
4
15
|
list: any[];
|
|
5
16
|
items: any[];
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
/** checked of id of members */
|
|
18
|
+
checkedIds: string[];
|
|
8
19
|
visible: boolean;
|
|
9
20
|
num: number;
|
|
10
21
|
hasMore: boolean;
|
|
22
|
+
/** Keword of member */
|
|
23
|
+
keyword: string;
|
|
24
|
+
reload: boolean;
|
|
11
25
|
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { observable } from "mobx";
|
|
3
|
+
/** color of member of random display for no url */
|
|
4
|
+
export const colorList = ["#765FEE", "#fe4066", "#FFC832", "#FF8F5E", "#3AC43A", "#FFC832"];
|
|
3
5
|
export class State {
|
|
4
6
|
constructor() {
|
|
5
7
|
this.avatarList = [];
|
|
6
8
|
this.members = [];
|
|
7
9
|
this.list = [];
|
|
8
10
|
this.items = [];
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
+
/** checked of id of members */
|
|
12
|
+
this.checkedIds = [];
|
|
13
|
+
// @observable public loading = false;
|
|
11
14
|
this.visible = false;
|
|
12
15
|
this.num = 0;
|
|
13
16
|
this.hasMore = false;
|
|
17
|
+
/** Keword of member */
|
|
18
|
+
this.keyword = "";
|
|
19
|
+
this.reload = false;
|
|
14
20
|
}
|
|
15
21
|
}
|
|
16
22
|
__decorate([
|
|
@@ -27,10 +33,7 @@ __decorate([
|
|
|
27
33
|
], State.prototype, "items", void 0);
|
|
28
34
|
__decorate([
|
|
29
35
|
observable
|
|
30
|
-
], State.prototype, "
|
|
31
|
-
__decorate([
|
|
32
|
-
observable
|
|
33
|
-
], State.prototype, "loading", void 0);
|
|
36
|
+
], State.prototype, "checkedIds", void 0);
|
|
34
37
|
__decorate([
|
|
35
38
|
observable
|
|
36
39
|
], State.prototype, "visible", void 0);
|
|
@@ -40,4 +43,10 @@ __decorate([
|
|
|
40
43
|
__decorate([
|
|
41
44
|
observable
|
|
42
45
|
], State.prototype, "hasMore", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
observable
|
|
48
|
+
], State.prototype, "keyword", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
observable
|
|
51
|
+
], State.prototype, "reload", void 0);
|
|
43
52
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/components/AvatarList/state.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/components/AvatarList/state.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAYlC,mDAAmD;AACnD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE5F,MAAM,OAAO,KAAK;IAAlB;QACoB,eAAU,GAAU,EAAE,CAAC;QACvB,YAAO,GAAU,EAAE,CAAC;QACpB,SAAI,GAAU,EAAE,CAAC;QACjB,UAAK,GAAU,EAAE,CAAC;QACrC,+BAA+B;QACZ,eAAU,GAAa,EAAE,CAAC;QAC7C,sCAAsC;QACnB,YAAO,GAAG,KAAK,CAAC;QAChB,QAAG,GAAG,CAAC,CAAC;QACR,YAAO,GAAG,KAAK,CAAC;QACnC,uBAAuB;QACJ,YAAO,GAAG,EAAE,CAAC;QACb,WAAM,GAAG,KAAK,CAAC;IACnC,CAAC;CAAA;AAbY;IAAX,UAAU;yCAA+B;AAC9B;IAAX,UAAU;sCAA4B;AAC3B;IAAX,UAAU;mCAAyB;AACxB;IAAX,UAAU;oCAA0B;AAEzB;IAAX,UAAU;yCAAkC;AAEjC;IAAX,UAAU;sCAAwB;AACvB;IAAX,UAAU;kCAAgB;AACf;IAAX,UAAU;sCAAwB;AAEvB;IAAX,UAAU;sCAAqB;AACpB;IAAX,UAAU;qCAAuB"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Checkbox, Modal } from "@voplus/antd";
|
|
2
2
|
import { State } from "./state";
|
|
3
|
+
import { DocumentListContext, DocumentListContextState, useDocumentListContext } from "../../data/contexts/DocumentListContext";
|
|
3
4
|
import React, { useState } from "react";
|
|
4
5
|
import { useDocument, useDocumentStore } from "../../data";
|
|
5
6
|
import DocumentList from "../DocumentList";
|
|
6
7
|
import DocumentName from "../DocumentName";
|
|
7
|
-
import DocumentQuickViewDialog from "../DocumentQuickViewDialog";
|
|
8
8
|
import QuickDataIcon from "../../controls/QuickDataIcon";
|
|
9
9
|
import ToolBar from "../../controls/ToolBar";
|
|
10
10
|
import classnames from "classnames";
|
|
11
11
|
import { getRouteByType } from "../helper";
|
|
12
12
|
import styles from "./index.less";
|
|
13
|
-
import { useDocumentListContext } from "../../data/contexts/DocumentListContext";
|
|
14
13
|
import { useObserver } from "mobx-react-lite";
|
|
15
14
|
const DocumentItem = (props) => {
|
|
16
15
|
/**DocumentListView props(type onDriveClick)*/
|
|
@@ -18,11 +17,16 @@ const DocumentItem = (props) => {
|
|
|
18
17
|
const { id, type, multiple, includes } = props;
|
|
19
18
|
const docStore = useDocumentStore();
|
|
20
19
|
const [state] = useState(new State(docStore));
|
|
20
|
+
/** DocumentItem store.type="drive-sub"时双击(onDriveClick()),DocumentListView(Drive)会进入子文件
|
|
21
|
+
* 设置listoptions.type=props.type,避免DocumentItem>DocumentList>DocumentItem执行onDriveClick(),出现错误
|
|
22
|
+
*/
|
|
23
|
+
const [listoptions] = useState(new DocumentListContextState());
|
|
24
|
+
listoptions.type = props.type;
|
|
21
25
|
state.props = props;
|
|
22
|
-
state.item = useDocument(props.id, { reload: !!props.reload, includes:
|
|
26
|
+
state.item = useDocument(props.id, { reload: i => !i.tags || !!props.reload, includes: "tags" });
|
|
23
27
|
const iconList = (React.createElement("div", { className: "document-other" },
|
|
24
28
|
React.createElement(QuickDataIcon, { id: id, includes: includes, onClick: () => (state.visible = true) })));
|
|
25
|
-
return useObserver(() => (React.createElement(
|
|
29
|
+
return useObserver(() => (React.createElement(DocumentListContext.Provider, { value: listoptions },
|
|
26
30
|
React.createElement("div", { className: styles[type === "detail" ? "document-type-detail" : "document-type-list"] },
|
|
27
31
|
!type ||
|
|
28
32
|
(type === "drive" && (React.createElement("div", { className: "document-item", onDoubleClick: onDriveClick },
|
|
@@ -49,7 +53,6 @@ const DocumentItem = (props) => {
|
|
|
49
53
|
React.createElement("div", { className: "file-info" },
|
|
50
54
|
React.createElement(DocumentName, { id: props.id, includes: includes, showIcon: true, status: false, quickView: false }),
|
|
51
55
|
iconList)))),
|
|
52
|
-
state.visibleQuickView && (React.createElement(DocumentQuickViewDialog, { id: state.item.id, doc: state.item, visible: true, onCancel: () => state.onQuickView() })),
|
|
53
56
|
state.visible && (React.createElement(Modal, { width: 600, title: "sub - Documents", visible: state.visible, footer: null, onCancel: () => (state.visible = false), className: styles["document-document-modal"] },
|
|
54
57
|
React.createElement(DocumentList, { id: state.item.id, header: false, disabled: true }))))));
|
|
55
58
|
/**Drive 用戶雙擊文件*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DocumentItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAW,MAAM,cAAc,CAAC;AACxD,OAAO,EAAqB,KAAK,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE3D,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DocumentItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAW,MAAM,cAAc,CAAC;AACxD,OAAO,EAAqB,KAAK,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EACN,mBAAmB,EACnB,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AlB,KAAK,EAAgB;oBACrB,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;oBACjB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;oBACrB,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,UAAU,EAAE,KAAK,CAAC,UAAU;iBAC3B,EACH,CAAC,OAAC,KAAK,CAAC,YAAY,+CAAlB,KAAK,EAAgB,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACxE,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -22,11 +22,8 @@ export declare class State {
|
|
|
22
22
|
isHover: boolean;
|
|
23
23
|
loading: boolean;
|
|
24
24
|
visible: boolean;
|
|
25
|
-
visibleQuickView: boolean;
|
|
26
25
|
modalType: string;
|
|
27
26
|
reload: boolean;
|
|
28
27
|
constructor(documentStore: DocumentStore);
|
|
29
|
-
/**show close QuickViewDialog*/
|
|
30
|
-
onQuickView(): void;
|
|
31
28
|
get readonly(): boolean;
|
|
32
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { computed, observable } from "mobx";
|
|
3
3
|
export class State {
|
|
4
4
|
constructor(documentStore) {
|
|
5
5
|
this.documentStore = documentStore;
|
|
@@ -8,16 +8,9 @@ export class State {
|
|
|
8
8
|
this.isHover = false;
|
|
9
9
|
this.loading = false;
|
|
10
10
|
this.visible = false;
|
|
11
|
-
this.visibleQuickView = false;
|
|
12
11
|
this.modalType = "";
|
|
13
12
|
this.reload = false;
|
|
14
13
|
}
|
|
15
|
-
/**show close QuickViewDialog*/
|
|
16
|
-
onQuickView() {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
this.visibleQuickView = !this.visibleQuickView;
|
|
19
|
-
(_b = (_a = this.props).onChangeDisabled) === null || _b === void 0 ? void 0 : _b.call(_a, this.visibleQuickView);
|
|
20
|
-
}
|
|
21
14
|
get readonly() {
|
|
22
15
|
return this.item.readonly;
|
|
23
16
|
}
|
|
@@ -43,18 +36,12 @@ __decorate([
|
|
|
43
36
|
__decorate([
|
|
44
37
|
observable
|
|
45
38
|
], State.prototype, "visible", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
observable
|
|
48
|
-
], State.prototype, "visibleQuickView", void 0);
|
|
49
39
|
__decorate([
|
|
50
40
|
observable
|
|
51
41
|
], State.prototype, "modalType", void 0);
|
|
52
42
|
__decorate([
|
|
53
43
|
observable
|
|
54
44
|
], State.prototype, "reload", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
action
|
|
57
|
-
], State.prototype, "onQuickView", null);
|
|
58
45
|
__decorate([
|
|
59
46
|
computed
|
|
60
47
|
], State.prototype, "readonly", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/components/DocumentItem/state.ts"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/components/DocumentItem/state.ts"],"names":[],"mappings":";AACA,OAAO,EAAU,QAAQ,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAiBpD,MAAM,OAAO,KAAK;IAWjB,YAA2B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QARpC,OAAE,GAAG,EAAE,CAAC;QACR,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAAG,KAAK,CAAC;QAChB,YAAO,GAAG,KAAK,CAAC;QAChB,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,EAAE,CAAC;QACf,WAAM,GAAG,KAAK,CAAC;IAEwB,CAAC;IAG3D,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC3B,CAAC;CACD;AAhBY;IAAX,UAAU;oCAAiC;AAChC;IAAX,UAAU;mCAAwB;AACvB;IAAX,UAAU;iCAAgB;AACf;IAAX,UAAU;uCAAyB;AACxB;IAAX,UAAU;sCAAwB;AACvB;IAAX,UAAU;sCAAwB;AACvB;IAAX,UAAU;sCAAwB;AACvB;IAAX,UAAU;wCAAuB;AACtB;IAAX,UAAU;qCAAuB;AAKlC;IADC,QAAQ;qCAGR"}
|