@zw-team/react-lib 1.0.2 → 1.0.4
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/components/AccessReport/index.d.ts +1 -1
- package/dist/components/Block/Block.js +4 -2
- package/dist/components/Block/types.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +2 -0
- package/dist/components/ConfigProvider/types.d.ts +2 -0
- package/dist/components/Modal/types.d.ts +2 -0
- package/dist/components/NavbarTool/components/index.css +4 -7
- package/dist/components/NoticeCenter/NoticeCenter.js +132 -40
- package/dist/components/NoticeCenter/noticeCenter.scss +39 -6
- package/dist/components/SystemLink/SystemLink.js +31 -28
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.js +14 -14
- package/dist/components/Table/useHeaderPopper.d.ts +1 -1
- package/dist/components/Table/useHeaderPopper.js +26 -23
- package/dist/components/TableHeaderPopper/EditBox.js +16 -10
- package/dist/components/TaskCenter/TaskCenter.js +9 -5
- package/dist/config/theme/index.d.ts +5 -362
- package/dist/config/theme/index.js +5 -362
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/useAccessReport.d.ts +4 -0
- package/dist/hooks/useAccessReport.js +15 -0
- package/dist/utils/advisory.d.ts +15 -0
- package/dist/utils/advisory.js +240 -0
- package/dist/utils/svgIcon/index.js +1 -0
- package/package.json +16 -14
|
@@ -7,7 +7,7 @@ declare class AccessReport {
|
|
|
7
7
|
authorization?: string | undefined;
|
|
8
8
|
env?: string | undefined;
|
|
9
9
|
});
|
|
10
|
-
report(router: string, page: string): void;
|
|
10
|
+
report(router: string, page: string | string[]): void;
|
|
11
11
|
loginReport(): void;
|
|
12
12
|
accessReportSavev(data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
13
13
|
browserType(): {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "../../utils/classNames.js";
|
|
2
3
|
import "./Block.css";
|
|
3
4
|
const Block = (props)=>{
|
|
4
|
-
const { children } = props;
|
|
5
|
+
const { children, className, style } = props;
|
|
5
6
|
return /*#__PURE__*/ jsx("div", {
|
|
6
|
-
className:
|
|
7
|
+
className: classNames('block-box', className),
|
|
8
|
+
style: style,
|
|
7
9
|
children: children
|
|
8
10
|
});
|
|
9
11
|
};
|
|
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ConfigProvider } from "antd";
|
|
3
3
|
import js_cookie from "js-cookie";
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
5
|
+
import { initProdEnvWarning } from "../../utils/advisory.js";
|
|
5
6
|
import { loadIconMock, loadSvg } from "../../utils/svgIcon/index.js";
|
|
6
7
|
import AccessReport from "../AccessReport/index.js";
|
|
7
8
|
import { ConfigContext, defaultConfig } from "./ConfigContext.js";
|
|
@@ -31,6 +32,7 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
|
|
|
31
32
|
window.$BiSystem = contextValue.system;
|
|
32
33
|
js_cookie.set('$BiEnv', contextValue.env);
|
|
33
34
|
js_cookie.set('$BiSystem', contextValue.system);
|
|
35
|
+
initProdEnvWarning(contextValue.env || 'production');
|
|
34
36
|
loadSvg(contextValue.system, contextValue.env || 'production');
|
|
35
37
|
if (contextValue.needIcon) loadIconMock(contextValue.env || 'production', (data)=>{
|
|
36
38
|
updateConfig({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ConfigProviderProps as AntdConfigProviderProps } from 'antd';
|
|
2
|
+
import type AccessReport from '../AccessReport';
|
|
2
3
|
export interface ContextValue {
|
|
3
4
|
env: string;
|
|
4
5
|
system: string;
|
|
@@ -7,6 +8,7 @@ export interface ContextValue {
|
|
|
7
8
|
iconInit: boolean;
|
|
8
9
|
iconList: Record<string, any>;
|
|
9
10
|
componentsKeys: string | number;
|
|
11
|
+
$AccessReport?: AccessReport;
|
|
10
12
|
[key: string]: any;
|
|
11
13
|
}
|
|
12
14
|
export interface ConfigProviderValue {
|
|
@@ -32,13 +32,10 @@
|
|
|
32
32
|
max-width: 100%;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.ant-drawer .ant-drawer-header {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.ant-drawer .ant-drawer-body {
|
|
41
|
-
padding-top: unset;
|
|
35
|
+
.ant-drawer .ant-drawer-header .ant-drawer-title {
|
|
36
|
+
color: #000000d9;
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
font-weight: 500;
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
/* 占位样式(你后面做真正的 Box / TaskCenterBox 时可以删掉) */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./noticeCenter.scss";
|
|
3
2
|
import { BellOutlined } from "@ant-design/icons";
|
|
4
3
|
import { Badge, Button, Card, Drawer, Modal, Popover, Space } from "antd";
|
|
5
4
|
import { useState } from "react";
|
|
@@ -7,6 +6,7 @@ import react_infinite_scroller from "react-infinite-scroller";
|
|
|
7
6
|
import request from "../../utils/request/index.js";
|
|
8
7
|
import { diffTime } from "../../utils/time/index.js";
|
|
9
8
|
import { getEnv } from "../../utils/tools.js";
|
|
9
|
+
import "./noticeCenter.scss";
|
|
10
10
|
const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
11
11
|
const [detailData, setDetailData] = useState({
|
|
12
12
|
_id: {
|
|
@@ -16,7 +16,9 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
16
16
|
send_time: '',
|
|
17
17
|
content: "",
|
|
18
18
|
is_read: 0,
|
|
19
|
-
describe: ''
|
|
19
|
+
describe: '',
|
|
20
|
+
user_name: '',
|
|
21
|
+
extra_id: ''
|
|
20
22
|
});
|
|
21
23
|
const [noticeList, setNoticeList] = useState([]);
|
|
22
24
|
const [last_id, setLastId] = useState('');
|
|
@@ -28,7 +30,10 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
28
30
|
const [openNotice, setOpenNotice] = useState({
|
|
29
31
|
id: '',
|
|
30
32
|
title: '',
|
|
31
|
-
content: ""
|
|
33
|
+
content: "",
|
|
34
|
+
user_name: '',
|
|
35
|
+
send_time: '',
|
|
36
|
+
extra_id: ''
|
|
32
37
|
});
|
|
33
38
|
const [noMore, setNoMore] = useState(false);
|
|
34
39
|
const handleNoticeRead = async (msg_id)=>{
|
|
@@ -61,7 +66,7 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
61
66
|
});
|
|
62
67
|
setNoticeList(arr);
|
|
63
68
|
};
|
|
64
|
-
const loadMore = async (
|
|
69
|
+
const loadMore = async (_page)=>{
|
|
65
70
|
fetchData();
|
|
66
71
|
};
|
|
67
72
|
const detail = (item)=>{
|
|
@@ -69,9 +74,39 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
69
74
|
...item,
|
|
70
75
|
is_read: 1
|
|
71
76
|
});
|
|
72
|
-
|
|
77
|
+
popupNotice({
|
|
78
|
+
id: item._id.oid,
|
|
79
|
+
title: item.title,
|
|
80
|
+
content: item.content,
|
|
81
|
+
user_name: item.user_name,
|
|
82
|
+
send_time: item.send_time,
|
|
83
|
+
extra_id: item.extra_id
|
|
84
|
+
}, true);
|
|
73
85
|
handleNoticeRead(item._id.oid);
|
|
74
86
|
};
|
|
87
|
+
const popupNotice = (data, onlyRead = false)=>{
|
|
88
|
+
setOpenNotice({
|
|
89
|
+
id: data.id,
|
|
90
|
+
title: data.title,
|
|
91
|
+
content: data.content,
|
|
92
|
+
user_name: data.user_name,
|
|
93
|
+
send_time: data.send_time,
|
|
94
|
+
extra_id: data.extra_id
|
|
95
|
+
});
|
|
96
|
+
setDialogVisible(true);
|
|
97
|
+
true !== onlyRead && noticePoped(openNotice.id);
|
|
98
|
+
};
|
|
99
|
+
const noticePoped = async (msg_id)=>{
|
|
100
|
+
await request({
|
|
101
|
+
env: getEnv(),
|
|
102
|
+
system: 'service_center',
|
|
103
|
+
api: '/api/admin/message/setPopup',
|
|
104
|
+
data: {
|
|
105
|
+
system: system,
|
|
106
|
+
msg_id
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
75
110
|
const initUnreadNum = async ()=>{
|
|
76
111
|
const res = await request({
|
|
77
112
|
env: getEnv(),
|
|
@@ -87,32 +122,36 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
87
122
|
setBadgeNum(Number(unread_num));
|
|
88
123
|
};
|
|
89
124
|
const fetchData = async ()=>{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
try {
|
|
126
|
+
if (noMore) return;
|
|
127
|
+
const res = await request({
|
|
128
|
+
env: getEnv(),
|
|
129
|
+
system: 'service_center',
|
|
130
|
+
api: '/api/admin/message/getSystemMessage',
|
|
131
|
+
data: {
|
|
132
|
+
system: system,
|
|
133
|
+
last_id: last_id,
|
|
134
|
+
last_send_time: last_send_time
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
if (1 === res.status_code) if (res.data.length) {
|
|
138
|
+
const arr = [
|
|
139
|
+
...noticeList,
|
|
140
|
+
...res.data
|
|
141
|
+
];
|
|
142
|
+
const maps = new Map();
|
|
143
|
+
for (const item of arr)maps.set(item._id.oid, item);
|
|
144
|
+
const resNoticeList = Array.from(maps.values()).sort((a, b)=>diffTime(a.create_time, b.create_time));
|
|
145
|
+
setNoticeList(resNoticeList);
|
|
146
|
+
setNoMore(false);
|
|
147
|
+
if (resNoticeList.length && resNoticeList[resNoticeList.length - 1]) {
|
|
148
|
+
setLastId(resNoticeList[resNoticeList.length - 1]._id.oid);
|
|
149
|
+
setLastSendTime(resNoticeList[resNoticeList.length - 1].send_time);
|
|
150
|
+
}
|
|
151
|
+
} else setNoMore(true);
|
|
152
|
+
} catch {
|
|
153
|
+
setNoMore(true);
|
|
154
|
+
}
|
|
116
155
|
};
|
|
117
156
|
const handleShow = ()=>{
|
|
118
157
|
setBadgeNum(0);
|
|
@@ -133,13 +172,29 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
133
172
|
const closeDrawer = ()=>{
|
|
134
173
|
setDetailVisible(false);
|
|
135
174
|
};
|
|
175
|
+
const noticeClose = (id)=>{
|
|
176
|
+
setDialogVisible(false);
|
|
177
|
+
noticeRead(id);
|
|
178
|
+
};
|
|
179
|
+
const noticeRead = async (id)=>{
|
|
180
|
+
await request({
|
|
181
|
+
env: getEnv(),
|
|
182
|
+
system: 'zq',
|
|
183
|
+
api: '/api/system_notice/close',
|
|
184
|
+
data: {
|
|
185
|
+
id
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
};
|
|
136
189
|
const NoticeModal = /*#__PURE__*/ jsx(Modal, {
|
|
137
190
|
title: "提示",
|
|
138
191
|
open: dialogVisible,
|
|
139
192
|
width: 680,
|
|
193
|
+
onCancel: ()=>setDialogVisible(false),
|
|
140
194
|
style: {
|
|
141
|
-
top: '
|
|
195
|
+
top: '38px'
|
|
142
196
|
},
|
|
197
|
+
footer: null,
|
|
143
198
|
wrapClassName: "notice-open-dialog",
|
|
144
199
|
children: /*#__PURE__*/ jsxs("div", {
|
|
145
200
|
className: "notice-open-container",
|
|
@@ -159,11 +214,36 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
159
214
|
}),
|
|
160
215
|
/*#__PURE__*/ jsx("div", {
|
|
161
216
|
className: "notice-open-box-scrollbar",
|
|
162
|
-
children: /*#__PURE__*/
|
|
217
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
163
218
|
className: "notice-open-content",
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
219
|
+
children: [
|
|
220
|
+
/*#__PURE__*/ jsxs("div", {
|
|
221
|
+
className: "notice-open-content-info",
|
|
222
|
+
children: [
|
|
223
|
+
/*#__PURE__*/ jsxs("div", {
|
|
224
|
+
children: [
|
|
225
|
+
"产品负责人: ",
|
|
226
|
+
/*#__PURE__*/ jsx("span", {
|
|
227
|
+
children: openNotice.user_name || '-'
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
}),
|
|
231
|
+
/*#__PURE__*/ jsxs("div", {
|
|
232
|
+
children: [
|
|
233
|
+
"发送时间: ",
|
|
234
|
+
/*#__PURE__*/ jsx("span", {
|
|
235
|
+
children: openNotice.send_time
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
}),
|
|
241
|
+
/*#__PURE__*/ jsx("div", {
|
|
242
|
+
dangerouslySetInnerHTML: {
|
|
243
|
+
__html: openNotice.content
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
]
|
|
167
247
|
})
|
|
168
248
|
}),
|
|
169
249
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -171,7 +251,7 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
171
251
|
children: /*#__PURE__*/ jsx(Button, {
|
|
172
252
|
type: "primary",
|
|
173
253
|
onClick: ()=>{
|
|
174
|
-
|
|
254
|
+
noticeClose(openNotice.extra_id);
|
|
175
255
|
},
|
|
176
256
|
children: "知道了"
|
|
177
257
|
})
|
|
@@ -238,9 +318,21 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
238
318
|
})
|
|
239
319
|
]
|
|
240
320
|
}),
|
|
241
|
-
/*#__PURE__*/
|
|
242
|
-
className: "content",
|
|
243
|
-
children:
|
|
321
|
+
/*#__PURE__*/ jsxs("div", {
|
|
322
|
+
className: "notice-content-box",
|
|
323
|
+
children: [
|
|
324
|
+
/*#__PURE__*/ jsx("div", {
|
|
325
|
+
className: "content",
|
|
326
|
+
children: item.describe
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ jsxs("div", {
|
|
329
|
+
className: "username",
|
|
330
|
+
children: [
|
|
331
|
+
"产品负责人: ",
|
|
332
|
+
item.user_name || '-'
|
|
333
|
+
]
|
|
334
|
+
})
|
|
335
|
+
]
|
|
244
336
|
})
|
|
245
337
|
]
|
|
246
338
|
}, `notice_${index}`)),
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
.bi-notice > span {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
9
|
.notice-button {
|
|
10
10
|
padding: 5px;
|
|
11
11
|
width: 32px;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
cursor: pointer;
|
|
83
83
|
|
|
84
84
|
&.unread::before {
|
|
85
|
-
content:
|
|
85
|
+
content: " ";
|
|
86
86
|
position: absolute;
|
|
87
87
|
width: 8px;
|
|
88
88
|
height: 8px;
|
|
@@ -102,12 +102,32 @@
|
|
|
102
102
|
font-weight: 500;
|
|
103
103
|
color: #323335;
|
|
104
104
|
margin: 0;
|
|
105
|
+
overflow: hidden;
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
text-overflow: ellipsis;
|
|
108
|
+
flex: 1;
|
|
105
109
|
}
|
|
106
110
|
.time {
|
|
107
111
|
font-size: 14px;
|
|
108
112
|
font-weight: 400;
|
|
109
113
|
color: #86909c;
|
|
110
114
|
margin: 0;
|
|
115
|
+
flex: 0 0 auto;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.notice-content-box {
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: space-between;
|
|
121
|
+
align-items: center;
|
|
122
|
+
gap: 10px;
|
|
123
|
+
.content {
|
|
124
|
+
flex: 0 0 auto;
|
|
125
|
+
}
|
|
126
|
+
.username {
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
font-weight: 400;
|
|
129
|
+
color: #86909c;
|
|
130
|
+
margin: 0;
|
|
111
131
|
}
|
|
112
132
|
}
|
|
113
133
|
.content {
|
|
@@ -175,6 +195,19 @@
|
|
|
175
195
|
li {
|
|
176
196
|
list-style: inherit;
|
|
177
197
|
}
|
|
198
|
+
.notice-open-content-info {
|
|
199
|
+
display: flex;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
align-items: center;
|
|
202
|
+
margin-bottom: 10px;
|
|
203
|
+
color: #86909c;
|
|
204
|
+
gap: 30px;
|
|
205
|
+
margin-bottom: 20px;
|
|
206
|
+
span {
|
|
207
|
+
font-weight: 400;
|
|
208
|
+
color: #323335;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
178
211
|
}
|
|
179
212
|
.notice-open-button {
|
|
180
213
|
box-shadow: 0px -1px 0px 0px #f2f3f5;
|
|
@@ -229,4 +262,4 @@
|
|
|
229
262
|
.ant-card-body {
|
|
230
263
|
padding: 12px;
|
|
231
264
|
}
|
|
232
|
-
}
|
|
265
|
+
}
|
|
@@ -36,30 +36,29 @@ const SystemLink = ()=>{
|
|
|
36
36
|
const url = buildSystemUrl(system.link);
|
|
37
37
|
window.open(url, '_blank');
|
|
38
38
|
};
|
|
39
|
-
const renderSystemItem = (item)=>/*#__PURE__*/ jsxs("div", {
|
|
40
|
-
className: "system-item",
|
|
41
|
-
onClick: ()=>goSystem(item),
|
|
42
|
-
children: [
|
|
43
|
-
/*#__PURE__*/ jsx("div", {
|
|
44
|
-
className: "system-logo",
|
|
45
|
-
children: /*#__PURE__*/ jsx("img", {
|
|
46
|
-
src: item.logo_path,
|
|
47
|
-
alt: item.short_name
|
|
48
|
-
})
|
|
49
|
-
}),
|
|
50
|
-
/*#__PURE__*/ jsx("p", {
|
|
51
|
-
className: "system-name",
|
|
52
|
-
children: item.short_name
|
|
53
|
-
}),
|
|
54
|
-
/*#__PURE__*/ jsx("p", {
|
|
55
|
-
className: "go-system",
|
|
56
|
-
children: "前往平台"
|
|
57
|
-
})
|
|
58
|
-
]
|
|
59
|
-
}, item.id);
|
|
60
39
|
const popoverContent = /*#__PURE__*/ jsx("div", {
|
|
61
40
|
className: "system-list",
|
|
62
|
-
children: systemList.map(
|
|
41
|
+
children: systemList.map((item)=>/*#__PURE__*/ jsxs("div", {
|
|
42
|
+
className: "system-item",
|
|
43
|
+
onClick: ()=>goSystem(item),
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsx("div", {
|
|
46
|
+
className: "system-logo",
|
|
47
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
48
|
+
src: item.logo_path,
|
|
49
|
+
alt: item.short_name
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ jsx("p", {
|
|
53
|
+
className: "system-name",
|
|
54
|
+
children: item.short_name
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ jsx("p", {
|
|
57
|
+
className: "go-system",
|
|
58
|
+
children: "前往平台"
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
}, item.id))
|
|
63
62
|
});
|
|
64
63
|
return /*#__PURE__*/ jsx("div", {
|
|
65
64
|
className: "bi-system-link",
|
|
@@ -68,14 +67,18 @@ const SystemLink = ()=>{
|
|
|
68
67
|
trigger: "hover",
|
|
69
68
|
overlayClassName: "system-link-popper",
|
|
70
69
|
content: popoverContent,
|
|
71
|
-
destroyTooltipOnHide: true,
|
|
72
70
|
children: /*#__PURE__*/ jsx(Button, {
|
|
73
|
-
type: "text",
|
|
74
71
|
className: "system-link-button",
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
className: "
|
|
78
|
-
|
|
72
|
+
type: "text",
|
|
73
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
74
|
+
className: "iconpark-icon",
|
|
75
|
+
style: {
|
|
76
|
+
width: 24,
|
|
77
|
+
height: 24
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/ jsx("use", {
|
|
80
|
+
href: "#el-icon-more1"
|
|
81
|
+
})
|
|
79
82
|
})
|
|
80
83
|
})
|
|
81
84
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { BiTableProps } from './types';
|
|
3
2
|
import './index.scss';
|
|
3
|
+
import type { BiTableProps } from './types';
|
|
4
4
|
export declare const useBiTable: () => Record<string, any>;
|
|
5
5
|
type BiTableComponent = React.FC<BiTableProps> & {
|
|
6
6
|
Resizable: React.FC<BiTableProps>;
|
|
@@ -3,9 +3,9 @@ import { Empty, Table, Typography } from "antd";
|
|
|
3
3
|
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { isNumeric } from "../../utils/index.js";
|
|
5
5
|
import { TableHeaderEditBox, TableHeaderPopper } from "../TableHeaderPopper/index.js";
|
|
6
|
+
import "./index.scss";
|
|
6
7
|
import ResizableTitle from "./ResizableTitle.js";
|
|
7
8
|
import { useHeaderPopper } from "./useHeaderPopper.js";
|
|
8
|
-
import "./index.scss";
|
|
9
9
|
const BiTableContext = /*#__PURE__*/ createContext(null);
|
|
10
10
|
const useBiTable = ()=>{
|
|
11
11
|
const context = useContext(BiTableContext);
|
|
@@ -31,6 +31,11 @@ const BiTable = (props)=>{
|
|
|
31
31
|
if (TableHeaderEditBoxRef.current && headerPopper && headerPopper.editEnabled && prop) TableHeaderEditBoxRef.current.show(prop);
|
|
32
32
|
};
|
|
33
33
|
const formatColumns = useMemo(()=>{
|
|
34
|
+
const headerStyle = headerPopper.editEnabled ? {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'center'
|
|
38
|
+
} : void 0;
|
|
34
39
|
const formatFn = (columnData)=>{
|
|
35
40
|
const column = Object.assign({}, columnData);
|
|
36
41
|
if ('function' == typeof column.width) column.width = column.width();
|
|
@@ -38,11 +43,7 @@ const BiTable = (props)=>{
|
|
|
38
43
|
const originalTitle = column.title;
|
|
39
44
|
column.title = 'function' == typeof originalTitle && null != originalTitle ? (props)=>/*#__PURE__*/ jsxs("div", {
|
|
40
45
|
onDoubleClick: ()=>handleTableHeaderDbClick(column.dataIndex),
|
|
41
|
-
style:
|
|
42
|
-
display: 'flex',
|
|
43
|
-
alignItems: 'center',
|
|
44
|
-
justifyContent: 'center'
|
|
45
|
-
},
|
|
46
|
+
style: headerStyle,
|
|
46
47
|
children: [
|
|
47
48
|
originalTitle(props),
|
|
48
49
|
headerPopperType && /*#__PURE__*/ jsx(TableHeaderPopper, {
|
|
@@ -51,11 +52,7 @@ const BiTable = (props)=>{
|
|
|
51
52
|
]
|
|
52
53
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
53
54
|
onDoubleClick: ()=>handleTableHeaderDbClick(column.dataIndex),
|
|
54
|
-
style:
|
|
55
|
-
display: 'flex',
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
justifyContent: 'center'
|
|
58
|
-
},
|
|
55
|
+
style: headerStyle,
|
|
59
56
|
children: [
|
|
60
57
|
originalTitle,
|
|
61
58
|
headerPopperType && /*#__PURE__*/ jsx(TableHeaderPopper, {
|
|
@@ -68,7 +65,8 @@ const BiTable = (props)=>{
|
|
|
68
65
|
};
|
|
69
66
|
return column.map((col)=>formatFn(col));
|
|
70
67
|
}, [
|
|
71
|
-
column
|
|
68
|
+
column,
|
|
69
|
+
headerPopper.editEnabled
|
|
72
70
|
]);
|
|
73
71
|
const formatSticky = useMemo(()=>stickyTop ? {
|
|
74
72
|
offsetHeader: stickyTop
|
|
@@ -91,7 +89,6 @@ const BiTable = (props)=>{
|
|
|
91
89
|
} else for(const key in columnMap)pageData.forEach((item)=>{
|
|
92
90
|
if (item[key] && isNumeric(item[key])) columnMap[key].val += parseFloat(item[key]);
|
|
93
91
|
});
|
|
94
|
-
console.log(columnMap, 123123123);
|
|
95
92
|
return /*#__PURE__*/ jsx(Table.Summary, {
|
|
96
93
|
fixed: true,
|
|
97
94
|
children: /*#__PURE__*/ jsxs(Table.Summary.Row, {
|
|
@@ -140,7 +137,10 @@ const BiTable = (props)=>{
|
|
|
140
137
|
}
|
|
141
138
|
},
|
|
142
139
|
description: /*#__PURE__*/ jsx("div", {
|
|
143
|
-
className: "bi-table-empty"
|
|
140
|
+
className: "bi-table-empty",
|
|
141
|
+
style: loading ? {
|
|
142
|
+
backgroundImage: 'none'
|
|
143
|
+
} : void 0
|
|
144
144
|
})
|
|
145
145
|
}),
|
|
146
146
|
...locale
|
|
@@ -2,7 +2,7 @@ export declare const useHeaderPopper: (moduleName?: string) => {
|
|
|
2
2
|
popperData: Record<string, unknown>[];
|
|
3
3
|
editEnabled: boolean;
|
|
4
4
|
findPopperData: (prop: string) => Record<string, unknown> | undefined;
|
|
5
|
-
savePopperData: (params: any) => Promise<
|
|
5
|
+
savePopperData: (params: any) => Promise<any>;
|
|
6
6
|
delPopperItem: (id: string) => Promise<void>;
|
|
7
7
|
reload: () => Promise<void>;
|
|
8
8
|
};
|
|
@@ -3,7 +3,7 @@ import request from "../../utils/request/index.js";
|
|
|
3
3
|
import { getEnv, getSystem } from "../../utils/tools.js";
|
|
4
4
|
const useHeaderPopper = (moduleName)=>{
|
|
5
5
|
const [popperData, setPopperData] = useState([]);
|
|
6
|
-
const [editEnabled, setEditEnabled] = useState(
|
|
6
|
+
const [editEnabled, setEditEnabled] = useState(false);
|
|
7
7
|
const system = getSystem() || '';
|
|
8
8
|
const $BiEnv = getEnv() || '';
|
|
9
9
|
const getPopperList = useCallback(async ()=>{
|
|
@@ -36,31 +36,34 @@ const useHeaderPopper = (moduleName)=>{
|
|
|
36
36
|
}, [
|
|
37
37
|
getPopperList
|
|
38
38
|
]);
|
|
39
|
-
const savePopperData = useCallback(async (params)=>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
const savePopperData = useCallback(async (params)=>{
|
|
40
|
+
if (!editEnabled) return true;
|
|
41
|
+
const obj = {
|
|
42
|
+
module: moduleName,
|
|
43
|
+
prop: params.prop,
|
|
44
|
+
label: '',
|
|
45
|
+
content: params.content,
|
|
46
|
+
imgs: params.imgs || []
|
|
47
|
+
};
|
|
48
|
+
if (params.id) obj.id = params.id;
|
|
49
|
+
const res = await request({
|
|
50
|
+
env: $BiEnv,
|
|
51
|
+
system: 'zq',
|
|
52
|
+
api: '/common/table_head/save',
|
|
53
|
+
data: obj,
|
|
54
|
+
headers: {
|
|
55
|
+
System: system,
|
|
56
|
+
Authkey: ''
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (1 === res.status_code) await getPopperList();
|
|
60
|
+
return res;
|
|
61
|
+
}, [
|
|
60
62
|
editEnabled,
|
|
61
63
|
moduleName,
|
|
62
64
|
$BiEnv,
|
|
63
|
-
system
|
|
65
|
+
system,
|
|
66
|
+
getPopperList
|
|
64
67
|
]);
|
|
65
68
|
const delPopperItem = useCallback(async (id)=>{
|
|
66
69
|
await request({
|