-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbasic_callbacks.js
More file actions
70 lines (68 loc) · 2.44 KB
/
basic_callbacks.js
File metadata and controls
70 lines (68 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// 改造console.error()以隐藏无关痛痒的警告信息
const originalConsoleError = console.error;
console.error = function (...args) {
// 检查args中是否包含需要过滤的内容
const shouldFilter = args.some(arg => typeof arg === 'string' && arg.includes('Warning:'));
if (!shouldFilter) {
originalConsoleError.apply(console, args);
}
};
window.dash_clientside = Object.assign({}, window.dash_clientside, {
clientside_basic: {
// 处理核心页面侧边栏展开/收起
handleSideCollapse: (nClicks, originIcon, originHeaderSideStyle, coreConfig) => {
// 若先前为展开状态
if (originIcon === 'antd-menu-fold') {
return [
// 更新图标
'antd-menu-unfold',
// 更新页首侧边容器样式
{
...originHeaderSideStyle,
width: 110
},
// 更新页首标题样式
{
display: 'none'
},
// 更新侧边菜单容器样式
{
width: 110
},
// 更新侧边菜单折叠状态
true
]
} else {
return [
// 更新图标
'antd-menu-fold',
// 更新页首侧边容器样式
{
...originHeaderSideStyle,
width: coreConfig.core_side_width
},
// 更新页首标题样式
{},
// 更新侧边菜单容器样式
{
width: coreConfig.core_side_width
},
// 更新侧边菜单折叠状态
false
]
}
},
// 控制页面搜索切换页面的功能
handleCorePageSearch: (value) => {
if (value) {
let pathname = value.split('|')[0]
// 更新pathname
window.location.pathname = pathname
}
},
// 控制ctrl+k快捷键触发页面搜索框聚焦
handleCorePageSearchFocus: (pressedCounts) => {
return [true, pressedCounts.toString()]
}
}
});