collabdocchat 2.0.4 → 2.0.5
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/package.json +1 -1
- package/scripts/generate-docs.js +1 -0
- package/scripts/pre-publish-check.js +1 -0
- package/src/components/knowledge-modal.js +15 -17
- package/src/components/optimized-poll-detail.js +17 -20
- package/src/main.js +1 -1
- package/src/pages/admin-dashboard.js +281 -324
- package/src/pages/login.js +7 -7
- package/src/pages/optimized-backup-view.js +32 -35
- package/src/pages/optimized-knowledge-view.js +34 -41
- package/src/pages/optimized-task-detail.js +36 -42
- package/src/pages/optimized-workflow-view.js +64 -81
- package/src/pages/simplified-workflows.js +66 -66
- package/src/pages/user-dashboard.js +95 -111
- package/src/services/api.js +3 -6
- package/src/services/websocket.js +11 -14
- package/src/styles/collaboration-modern.js +8 -10
- package/src/utils/ai-assistant.js +74 -89
- package/src/utils/chat-enhancements.js +18 -18
- package/src/utils/collaboration-enhancer.js +84 -126
- package/src/utils/feature-integrator.js +78 -93
- package/src/utils/onboarding-guide.js +82 -93
- package/src/utils/performance.js +9 -9
- package/src/utils/permission-manager.js +39 -58
- package/src/utils/responsive-handler.js +22 -22
- package/src/utils/theme-manager.js +37 -49
- package/src/utils/ui-enhancements-loader.js +30 -40
|
@@ -53,13 +53,11 @@ export class PermissionManager {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
//
|
|
57
|
-
this.customPermissions = this.loadCustomPermissions();
|
|
56
|
+
// 自定义权�? this.customPermissions = this.loadCustomPermissions();
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
/**
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
60
|
+
* 检查权�? */
|
|
63
61
|
hasPermission(userRole, resource, action) {
|
|
64
62
|
// 检查基础权限
|
|
65
63
|
if (this.permissions[resource] && this.permissions[resource][action]) {
|
|
@@ -78,21 +76,17 @@ export class PermissionManager {
|
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
/**
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
79
|
+
* 检查文档权�? */
|
|
83
80
|
canAccessDocument(user, document) {
|
|
84
|
-
//
|
|
85
|
-
if (user.role === 'admin') {
|
|
81
|
+
// 管理员可以访问所有文�? if (user.role === 'admin') {
|
|
86
82
|
return true;
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
//
|
|
90
|
-
if (document.creator === user.id) {
|
|
85
|
+
// 文档创建者可以访�? if (document.creator === user.id) {
|
|
91
86
|
return true;
|
|
92
87
|
}
|
|
93
88
|
|
|
94
|
-
//
|
|
95
|
-
if (document.permission === 'public') {
|
|
89
|
+
// 检查文档权限设�? if (document.permission === 'public') {
|
|
96
90
|
return true;
|
|
97
91
|
}
|
|
98
92
|
|
|
@@ -109,16 +103,13 @@ export class PermissionManager {
|
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
/**
|
|
112
|
-
*
|
|
113
|
-
*/
|
|
106
|
+
* 检查文档编辑权�? */
|
|
114
107
|
canEditDocument(user, document) {
|
|
115
|
-
//
|
|
116
|
-
if (user.role === 'admin') {
|
|
108
|
+
// 管理员可以编辑所有文�? if (user.role === 'admin') {
|
|
117
109
|
return true;
|
|
118
110
|
}
|
|
119
111
|
|
|
120
|
-
//
|
|
121
|
-
if (document.creator === user.id) {
|
|
112
|
+
// 文档创建者可以编�? if (document.creator === user.id) {
|
|
122
113
|
return true;
|
|
123
114
|
}
|
|
124
115
|
|
|
@@ -136,11 +127,9 @@ export class PermissionManager {
|
|
|
136
127
|
}
|
|
137
128
|
|
|
138
129
|
/**
|
|
139
|
-
*
|
|
140
|
-
*/
|
|
130
|
+
* 检查群组权�? */
|
|
141
131
|
canAccessGroup(user, group) {
|
|
142
|
-
//
|
|
143
|
-
if (user.role === 'admin') {
|
|
132
|
+
// 管理员可以访问所有群�? if (user.role === 'admin') {
|
|
144
133
|
return true;
|
|
145
134
|
}
|
|
146
135
|
|
|
@@ -158,15 +147,13 @@ export class PermissionManager {
|
|
|
158
147
|
}
|
|
159
148
|
|
|
160
149
|
/**
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
150
|
+
* 检查是否是群组管理�? */
|
|
163
151
|
isGroupAdmin(user, group) {
|
|
164
152
|
return user.role === 'admin' || group.admin === user.id;
|
|
165
153
|
}
|
|
166
154
|
|
|
167
155
|
/**
|
|
168
|
-
*
|
|
169
|
-
*/
|
|
156
|
+
* 添加自定义权�? */
|
|
170
157
|
addCustomPermission(resource, action, roles) {
|
|
171
158
|
const key = `${resource}.${action}`;
|
|
172
159
|
this.customPermissions[key] = roles;
|
|
@@ -174,8 +161,7 @@ export class PermissionManager {
|
|
|
174
161
|
}
|
|
175
162
|
|
|
176
163
|
/**
|
|
177
|
-
*
|
|
178
|
-
*/
|
|
164
|
+
* 移除自定义权�? */
|
|
179
165
|
removeCustomPermission(resource, action) {
|
|
180
166
|
const key = `${resource}.${action}`;
|
|
181
167
|
delete this.customPermissions[key];
|
|
@@ -183,15 +169,13 @@ export class PermissionManager {
|
|
|
183
169
|
}
|
|
184
170
|
|
|
185
171
|
/**
|
|
186
|
-
*
|
|
187
|
-
*/
|
|
172
|
+
* 保存自定义权�? */
|
|
188
173
|
saveCustomPermissions() {
|
|
189
174
|
localStorage.setItem('customPermissions', JSON.stringify(this.customPermissions));
|
|
190
175
|
}
|
|
191
176
|
|
|
192
177
|
/**
|
|
193
|
-
*
|
|
194
|
-
*/
|
|
178
|
+
* 加载自定义权�? */
|
|
195
179
|
loadCustomPermissions() {
|
|
196
180
|
const saved = localStorage.getItem('customPermissions');
|
|
197
181
|
return saved ? JSON.parse(saved) : {};
|
|
@@ -211,8 +195,7 @@ export class PermissionManager {
|
|
|
211
195
|
});
|
|
212
196
|
});
|
|
213
197
|
|
|
214
|
-
//
|
|
215
|
-
Object.entries(this.customPermissions).forEach(([key, roles]) => {
|
|
198
|
+
// 添加自定义权�? Object.entries(this.customPermissions).forEach(([key, roles]) => {
|
|
216
199
|
if (roles.includes(userRole)) {
|
|
217
200
|
permissions.push(key);
|
|
218
201
|
}
|
|
@@ -222,11 +205,10 @@ export class PermissionManager {
|
|
|
222
205
|
}
|
|
223
206
|
|
|
224
207
|
/**
|
|
225
|
-
*
|
|
226
|
-
*/
|
|
208
|
+
* 渲染权限管理界面(优化后�? */
|
|
227
209
|
renderPermissionManager(container, currentUser) {
|
|
228
210
|
if (currentUser.role !== 'admin') {
|
|
229
|
-
container.innerHTML = '<div class="error-state"
|
|
211
|
+
container.innerHTML = '<div class="error-state">只有管理员可以管理权�?/div>';
|
|
230
212
|
return;
|
|
231
213
|
}
|
|
232
214
|
|
|
@@ -237,7 +219,7 @@ export class PermissionManager {
|
|
|
237
219
|
<div class="settings-header-modern">
|
|
238
220
|
<div class="settings-icon-large">🔒</div>
|
|
239
221
|
<h2>权限管理</h2>
|
|
240
|
-
<p
|
|
222
|
+
<p>配置不同角色的系统访问权�?/p>
|
|
241
223
|
</div>
|
|
242
224
|
|
|
243
225
|
<div class="permission-tabs-modern">
|
|
@@ -302,8 +284,7 @@ export class PermissionManager {
|
|
|
302
284
|
<span>💾</span> 保存权限设置
|
|
303
285
|
</button>
|
|
304
286
|
<button class="btn-secondary-large" id="resetPermissions">
|
|
305
|
-
<span>🔄</span>
|
|
306
|
-
</button>
|
|
287
|
+
<span>🔄</span> 重置为默�? </button>
|
|
307
288
|
</div>
|
|
308
289
|
</div>
|
|
309
290
|
`;
|
|
@@ -366,7 +347,7 @@ export class PermissionManager {
|
|
|
366
347
|
if (confirm('确定要重置为默认权限设置吗?')) {
|
|
367
348
|
this.resetPermissions();
|
|
368
349
|
this.renderPermissionManager(container, currentUser);
|
|
369
|
-
alert('
|
|
350
|
+
alert('权限已重置为默认设置�?);
|
|
370
351
|
}
|
|
371
352
|
});
|
|
372
353
|
}
|
|
@@ -399,7 +380,7 @@ export class PermissionManager {
|
|
|
399
380
|
*/
|
|
400
381
|
getRoleName(role) {
|
|
401
382
|
const names = {
|
|
402
|
-
admin: '
|
|
383
|
+
admin: '管理�?,
|
|
403
384
|
user: '用户',
|
|
404
385
|
guest: '访客'
|
|
405
386
|
};
|
|
@@ -417,12 +398,12 @@ export class PermissionManager {
|
|
|
417
398
|
delete: '删除',
|
|
418
399
|
share: '分享',
|
|
419
400
|
export: '导出',
|
|
420
|
-
invite: '
|
|
401
|
+
invite: '邀�?,
|
|
421
402
|
remove: '移除',
|
|
422
403
|
assign: '分配',
|
|
423
404
|
upload: '上传',
|
|
424
405
|
download: '下载',
|
|
425
|
-
send: '
|
|
406
|
+
send: '发�?,
|
|
426
407
|
recall: '撤回',
|
|
427
408
|
mute: '禁言',
|
|
428
409
|
viewLogs: '查看日志',
|
|
@@ -453,7 +434,7 @@ export class PermissionManager {
|
|
|
453
434
|
getResourceDescription(resource) {
|
|
454
435
|
const descriptions = {
|
|
455
436
|
document: '管理文档的创建、查看、编辑和删除权限',
|
|
456
|
-
group: '
|
|
437
|
+
group: '控制群组的创建、管理和成员邀请权�?,
|
|
457
438
|
task: '设置任务的创建、分配和管理权限',
|
|
458
439
|
file: '配置文件的上传、下载和删除权限',
|
|
459
440
|
chat: '管理聊天消息的发送、撤回和禁言权限',
|
|
@@ -467,14 +448,14 @@ export class PermissionManager {
|
|
|
467
448
|
*/
|
|
468
449
|
getActionIcon(action) {
|
|
469
450
|
const icons = {
|
|
470
|
-
create: '
|
|
471
|
-
read: '
|
|
451
|
+
create: '�?,
|
|
452
|
+
read: '👁�?,
|
|
472
453
|
update: '✏️',
|
|
473
|
-
delete: '
|
|
454
|
+
delete: '🗑�?,
|
|
474
455
|
share: '🔗',
|
|
475
456
|
export: '📤',
|
|
476
457
|
invite: '📨',
|
|
477
|
-
remove: '
|
|
458
|
+
remove: '�?,
|
|
478
459
|
assign: '👤',
|
|
479
460
|
upload: '⬆️',
|
|
480
461
|
download: '⬇️',
|
|
@@ -493,18 +474,18 @@ export class PermissionManager {
|
|
|
493
474
|
*/
|
|
494
475
|
getActionDescription(action) {
|
|
495
476
|
const descriptions = {
|
|
496
|
-
create: '
|
|
497
|
-
read: '
|
|
498
|
-
update: '
|
|
477
|
+
create: '允许创建新内�?,
|
|
478
|
+
read: '允许查看和访�?,
|
|
479
|
+
update: '允许修改和更�?,
|
|
499
480
|
delete: '允许删除内容',
|
|
500
|
-
share: '
|
|
481
|
+
share: '允许分享给他�?,
|
|
501
482
|
export: '允许导出数据',
|
|
502
483
|
invite: '允许邀请新成员',
|
|
503
484
|
remove: '允许移除成员',
|
|
504
485
|
assign: '允许分配任务',
|
|
505
486
|
upload: '允许上传文件',
|
|
506
487
|
download: '允许下载文件',
|
|
507
|
-
send: '
|
|
488
|
+
send: '允许发送消�?,
|
|
508
489
|
recall: '允许撤回消息',
|
|
509
490
|
mute: '允许禁言用户',
|
|
510
491
|
viewLogs: '允许查看系统日志',
|
|
@@ -535,12 +516,12 @@ export class PermissionManager {
|
|
|
535
516
|
const style = document.createElement('style');
|
|
536
517
|
style.id = 'permission-manager-styles';
|
|
537
518
|
style.textContent = `
|
|
538
|
-
/*
|
|
519
|
+
/* 权限管理现代化样�?*/
|
|
539
520
|
.permission-manager-modern {
|
|
540
521
|
animation: fadeInUp 0.5s ease;
|
|
541
522
|
}
|
|
542
523
|
|
|
543
|
-
/*
|
|
524
|
+
/* 权限标签�?*/
|
|
544
525
|
.permission-tabs-modern {
|
|
545
526
|
display: flex;
|
|
546
527
|
gap: 12px;
|
|
@@ -740,7 +721,7 @@ export class PermissionManager {
|
|
|
740
721
|
}
|
|
741
722
|
|
|
742
723
|
.permission-checkbox:checked + .checkbox-custom::after {
|
|
743
|
-
content: '
|
|
724
|
+
content: '�?;
|
|
744
725
|
position: absolute;
|
|
745
726
|
top: 50%;
|
|
746
727
|
left: 50%;
|
|
@@ -833,7 +814,7 @@ export class PermissionManager {
|
|
|
833
814
|
font-size: 20px;
|
|
834
815
|
}
|
|
835
816
|
|
|
836
|
-
/*
|
|
817
|
+
/* 响应�?*/
|
|
837
818
|
@media (max-width: 768px) {
|
|
838
819
|
.permission-tabs-modern {
|
|
839
820
|
flex-direction: column;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 响应式处理器
|
|
3
|
-
*
|
|
3
|
+
* 处理不同设备的交互优�?
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export class ResponsiveHandler {
|
|
@@ -14,7 +14,7 @@ export class ResponsiveHandler {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 初始�?
|
|
18
18
|
*/
|
|
19
19
|
init() {
|
|
20
20
|
this.detectDevice();
|
|
@@ -23,7 +23,7 @@ export class ResponsiveHandler {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* 检测设备类�?
|
|
27
27
|
*/
|
|
28
28
|
detectDevice() {
|
|
29
29
|
const width = window.innerWidth;
|
|
@@ -46,7 +46,7 @@ export class ResponsiveHandler {
|
|
|
46
46
|
|
|
47
47
|
document.body.classList.add(this.orientation);
|
|
48
48
|
|
|
49
|
-
console.log('
|
|
49
|
+
console.log('设备检�?', {
|
|
50
50
|
isMobile: this.isMobile,
|
|
51
51
|
isTablet: this.isTablet,
|
|
52
52
|
isDesktop: this.isDesktop,
|
|
@@ -77,7 +77,7 @@ export class ResponsiveHandler {
|
|
|
77
77
|
}, 100);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
//
|
|
80
|
+
// 移动端菜单切�?
|
|
81
81
|
if (this.isMobile) {
|
|
82
82
|
this.setupMobileMenu();
|
|
83
83
|
}
|
|
@@ -97,15 +97,15 @@ export class ResponsiveHandler {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
100
|
+
* 移动端优�?
|
|
101
101
|
*/
|
|
102
102
|
optimizeForMobile() {
|
|
103
|
-
console.log('
|
|
103
|
+
console.log('应用移动端优�?);
|
|
104
104
|
|
|
105
105
|
// 优化触摸滚动
|
|
106
106
|
this.enableSmoothScrolling();
|
|
107
107
|
|
|
108
|
-
//
|
|
108
|
+
// 优化输入�?
|
|
109
109
|
this.optimizeInputs();
|
|
110
110
|
|
|
111
111
|
// 优化模态框
|
|
@@ -137,7 +137,7 @@ export class ResponsiveHandler {
|
|
|
137
137
|
optimizeForDesktop() {
|
|
138
138
|
console.log('应用桌面优化');
|
|
139
139
|
|
|
140
|
-
//
|
|
140
|
+
// 移除移动端特定元�?
|
|
141
141
|
const backToTop = document.getElementById('backToTopBtn');
|
|
142
142
|
if (backToTop) {
|
|
143
143
|
backToTop.remove();
|
|
@@ -158,10 +158,10 @@ export class ResponsiveHandler {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
*
|
|
161
|
+
* 优化输入�?
|
|
162
162
|
*/
|
|
163
163
|
optimizeInputs() {
|
|
164
|
-
//
|
|
164
|
+
// 防止输入框放�?
|
|
165
165
|
const inputs = document.querySelectorAll('input, textarea, select');
|
|
166
166
|
inputs.forEach(input => {
|
|
167
167
|
if (!input.style.fontSize || parseInt(input.style.fontSize) < 16) {
|
|
@@ -199,7 +199,7 @@ export class ResponsiveHandler {
|
|
|
199
199
|
// 禁止背景滚动
|
|
200
200
|
document.body.style.overflow = 'hidden';
|
|
201
201
|
|
|
202
|
-
//
|
|
202
|
+
// 模态框关闭时恢复滚�?
|
|
203
203
|
const closeModal = () => {
|
|
204
204
|
document.body.style.overflow = '';
|
|
205
205
|
modal.removeEventListener('click', handleClick);
|
|
@@ -224,7 +224,7 @@ export class ResponsiveHandler {
|
|
|
224
224
|
|
|
225
225
|
const button = document.createElement('button');
|
|
226
226
|
button.id = 'backToTopBtn';
|
|
227
|
-
button.innerHTML = '
|
|
227
|
+
button.innerHTML = '�?;
|
|
228
228
|
button.style.cssText = `
|
|
229
229
|
position: fixed;
|
|
230
230
|
bottom: 20px;
|
|
@@ -281,7 +281,7 @@ export class ResponsiveHandler {
|
|
|
281
281
|
* 优化表格显示
|
|
282
282
|
*/
|
|
283
283
|
optimizeTables() {
|
|
284
|
-
//
|
|
284
|
+
// 为表格添加横向滚动容�?
|
|
285
285
|
const tables = document.querySelectorAll('.audit-table, .members-table, .backups-table');
|
|
286
286
|
tables.forEach(table => {
|
|
287
287
|
if (!table.parentElement.classList.contains('table-scroll-wrapper')) {
|
|
@@ -300,14 +300,14 @@ export class ResponsiveHandler {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
303
|
+
* 设置移动端菜�?
|
|
304
304
|
*/
|
|
305
305
|
setupMobileMenu() {
|
|
306
306
|
// 添加菜单切换按钮(如果需要)
|
|
307
307
|
const sidebar = document.querySelector('.sidebar');
|
|
308
308
|
if (!sidebar) return;
|
|
309
309
|
|
|
310
|
-
//
|
|
310
|
+
// 可以添加汉堡菜单按钮�?
|
|
311
311
|
// 这里保持简单,使用横向滚动菜单
|
|
312
312
|
}
|
|
313
313
|
|
|
@@ -346,7 +346,7 @@ export class ResponsiveHandler {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* 检测网络状�?
|
|
350
350
|
*/
|
|
351
351
|
getNetworkStatus() {
|
|
352
352
|
if ('connection' in navigator) {
|
|
@@ -381,7 +381,7 @@ export class ResponsiveHandler {
|
|
|
381
381
|
|
|
382
382
|
images.forEach(img => imageObserver.observe(img));
|
|
383
383
|
} else {
|
|
384
|
-
//
|
|
384
|
+
// 降级方案:直接加载所有图�?
|
|
385
385
|
images.forEach(img => {
|
|
386
386
|
img.src = img.dataset.src;
|
|
387
387
|
img.removeAttribute('data-src');
|
|
@@ -410,7 +410,7 @@ export class ResponsiveHandler {
|
|
|
410
410
|
* 处理滑动手势
|
|
411
411
|
*/
|
|
412
412
|
handleSwipe(startX, endX, onSwipeLeft, onSwipeRight) {
|
|
413
|
-
const threshold = 50; //
|
|
413
|
+
const threshold = 50; // 最小滑动距�?
|
|
414
414
|
const diff = startX - endX;
|
|
415
415
|
|
|
416
416
|
if (Math.abs(diff) > threshold) {
|
|
@@ -437,7 +437,7 @@ export class ResponsiveHandler {
|
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
|
-
*
|
|
440
|
+
* 显示设备信息(调试用�?
|
|
441
441
|
*/
|
|
442
442
|
showDeviceInfo() {
|
|
443
443
|
const info = this.getDeviceInfo();
|
|
@@ -462,7 +462,7 @@ export class ResponsiveHandler {
|
|
|
462
462
|
类型: ${this.isMobile ? '手机' : this.isTablet ? '平板' : '桌面'}<br>
|
|
463
463
|
方向: ${this.orientation}<br>
|
|
464
464
|
尺寸: ${info.width}x${info.height}<br>
|
|
465
|
-
触摸: ${info.touchSupport ? '
|
|
465
|
+
触摸: ${info.touchSupport ? '�? : '�?}
|
|
466
466
|
`;
|
|
467
467
|
|
|
468
468
|
document.body.appendChild(infoDiv);
|
|
@@ -472,7 +472,7 @@ export class ResponsiveHandler {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
//
|
|
475
|
+
// 自动初始�?
|
|
476
476
|
let responsiveHandler;
|
|
477
477
|
|
|
478
478
|
if (typeof window !== 'undefined') {
|