odant-work 1.0.65 → 1.0.67
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/#system/package-manifest.json +56 -59
- package/{PROJECTS → $server/$folder/$class}/$domain/handlers/methods/restore/$handler/class.js +40 -24
- package/$server/$folder/$class/$structure/$server/handlers/methods/distro/$handler/class.js +0 -2
- package/$server/$folder/$class/$structure/handlers/methods/archive/$handler/class.js +27 -0
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +9 -0
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +310 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +160 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/class.js +10 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/system.js +233 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/agent.js +289 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/{search/$handler → system/$handler/tabs}/search.js +4 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/{staff/$handler → system/$handler/tabs}/staff.js +122 -14
- package/$server/$folder/$class/handlers/pages/form/editor/$handler/class.js +3 -0
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +10 -6
- package/$server/$folder/handlers/pages/form/$handler/form.js +27 -2
- package/$server/$folder/lib/dot/dot-math.js +1 -1
- package/$server/$folder/lib/dot/dot.js +19 -5
- package/$server/$folder/lib/explorer/explorer.js +29 -15
- package/$server/$folder/lib/node/node.js +49 -4
- package/$server/$folder/lib/security/users/users.js +68 -3
- package/$server/$folder/lib/tools/tools.js +3 -3
- package/$server/$folder/lib/tree/tree.js +29 -13
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +293 -1
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +234 -1
- package/ORGANIZATIONS/$domain/class.js +1 -0
- package/PROJECTS/$domain/class.js +1 -0
- package/package.json +1 -1
- package/sources/client/handler.js +27 -11
- package/sources/client.js +36 -0
- package/sources/data/api.js +25 -5
- package/sources/data/db.js +39 -0
- package/sources/data/scope.js +2 -1
- package/sources/host/websocket.js +22 -0
- package/sources/modules/agent/index.js +11 -1
- package/sources/modules/agent/node-rules.js +171 -0
- package/sources/modules/agent/resources.js +1 -0
- package/sources/modules/agent/scheduler.js +75 -17
- package/sources/modules/agent/triggers.js +486 -198
- package/sources/modules/agent/twin-bus.js +163 -0
- package/sources/server/access/gateway.js +3 -0
- package/sources/server/access/links.js +8 -4
- package/sources/server/access/policy.js +7 -2
- package/sources/server/access/workplaces.js +14 -5
- package/sources/server/chat-threads.js +640 -0
- package/sources/server/class/archive.js +4 -3
- package/sources/server/class/feed.js +59 -0
- package/sources/server/class/security.js +18 -3
- package/sources/server/handler.js +1 -2
- package/$server/$folder/$class/$structure/$base/handlers/methods/archive/$handler/class.js +0 -23
- package/$server/$folder/$class/$structure/$project/handlers/methods/archive/$handler/class.js +0 -23
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/license/$handler/class.js +0 -9
- package/$server/$folder/$class/$structure/handlers/pages/form/database/$handler/class.js +0 -9
- package/$server/$folder/$class/$structure/handlers/pages/form/gantt/$handler/class.js +0 -27
- package/$server/$folder/$class/$structure/handlers/pages/form/gantt/$handler/gantt.js +0 -293
- package/$server/$folder/$class/$structure/handlers/pages/form/messengers/$handler/class.js +0 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/scheduler/$handler/class.js +0 -27
- package/$server/$folder/$class/$structure/handlers/pages/form/scheduler/$handler/scheduler.js +0 -234
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +0 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/staff/$handler/class.js +0 -5
- package/ORGANIZATIONS/$domain/handlers/methods/restore/$handler/class.js +0 -173
- /package/$server/$folder/$class/$structure/handlers/pages/form/{database/$handler → system/$handler/tabs}/database.js +0 -0
- /package/$server/$folder/$class/$structure/{$server/handlers/pages/form/license/$handler → handlers/pages/form/system/$handler/tabs}/license.js +0 -0
- /package/$server/$folder/$class/$structure/handlers/pages/form/{messengers/$handler → system/$handler/tabs}/messengers.js +0 -0
|
@@ -60,6 +60,42 @@ export default {
|
|
|
60
60
|
color: var(--content-color);
|
|
61
61
|
font-size: 13px;
|
|
62
62
|
}
|
|
63
|
+
.user-chip.clickable {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
.user-chip.clickable:hover {
|
|
67
|
+
filter: brightness(0.95);
|
|
68
|
+
}
|
|
69
|
+
.badge {
|
|
70
|
+
font-size: 11px;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
padding: 2px 7px;
|
|
73
|
+
border-radius: 10px;
|
|
74
|
+
background: var(--accent-soft);
|
|
75
|
+
color: var(--accent-color);
|
|
76
|
+
}
|
|
77
|
+
.badge.external {
|
|
78
|
+
background: light-dark(#fef3c7, #422006);
|
|
79
|
+
color: light-dark(#92400e, #fcd34d);
|
|
80
|
+
}
|
|
81
|
+
.ext-toggle {
|
|
82
|
+
@apply --horizontal;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 5px;
|
|
85
|
+
font-size: 12px;
|
|
86
|
+
color: var(--muted-color);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
user-select: none;
|
|
89
|
+
}
|
|
90
|
+
.link-title {
|
|
91
|
+
flex: 1;
|
|
92
|
+
font-weight: 500;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
.link-title:hover {
|
|
96
|
+
color: var(--accent-color);
|
|
97
|
+
text-decoration: underline;
|
|
98
|
+
}
|
|
63
99
|
.user-chip .rm {
|
|
64
100
|
cursor: pointer;
|
|
65
101
|
font-weight: bold;
|
|
@@ -125,7 +161,11 @@ export default {
|
|
|
125
161
|
<div class="card-header">
|
|
126
162
|
<oda-icon icon="odant:workplace" icon-size="22"></oda-icon>
|
|
127
163
|
<span>Рабочие места подразделения ({{flatPlaces.length}})</span>
|
|
128
|
-
<div ~if="canEdit" class="horizontal" style="margin-left:auto;gap:
|
|
164
|
+
<div ~if="canEdit" class="horizontal" style="margin-left:auto;gap:8px;align-items:center;">
|
|
165
|
+
<label class="ext-toggle" title="Внешний клиент (CLIENT) без доступа к внутренним файлам и чату отдела">
|
|
166
|
+
<input type="checkbox" :checked="newPlaceExternal" @change="newPlaceExternal = $event.target.checked">
|
|
167
|
+
<span>Клиент</span>
|
|
168
|
+
</label>
|
|
129
169
|
<input type="text" placeholder="Название нового рабочего места…" :value="newPlaceLabel" @input="newPlaceLabel = $event.target.value" style="width:220px;">
|
|
130
170
|
<oda-button icon="icons:add" @tap="addPlace('')">Добавить место</oda-button>
|
|
131
171
|
</div>
|
|
@@ -133,12 +173,18 @@ export default {
|
|
|
133
173
|
|
|
134
174
|
<div ~if="!flatPlaces.length" class="muted">В этом подразделении ещё нет рабочих мест.</div>
|
|
135
175
|
|
|
136
|
-
<div ~for="flatPlaces" class="place-card" ~class="{'active-place': focusedTrail === $for.item.trail}" :style="'margin-left:' + ($for.item.depth * 24) + 'px'">
|
|
176
|
+
<div ~for="flatPlaces" class="place-card" ~class="{'active-place': focusedTrail === $for.item.trail || $for.item.mine}" :style="'margin-left:' + ($for.item.depth * 24) + 'px'">
|
|
137
177
|
<div class="card-header">
|
|
138
|
-
<oda-icon icon="fontawesome:s-user-tie" icon-size="20"></oda-icon>
|
|
178
|
+
<oda-icon :icon="$for.item.external ? 'icons:public' : 'fontawesome:s-user-tie'" icon-size="20"></oda-icon>
|
|
139
179
|
<span>{{$for.item.node.label || $for.item.node.id}}</span>
|
|
140
180
|
<span class="muted">({{$for.item.trail}})</span>
|
|
141
|
-
<
|
|
181
|
+
<span ~if="$for.item.mine" class="badge">Ваше место</span>
|
|
182
|
+
<span ~if="$for.item.external" class="badge external" title="Внешний клиент: только клиентские ссылки без внутренних файлов и чата">Клиент</span>
|
|
183
|
+
<div ~if="canEdit" class="horizontal" style="margin-left:auto;gap:6px;align-items:center;">
|
|
184
|
+
<label class="ext-toggle" title="Пометить место как контур внешнего клиента (CLIENT)">
|
|
185
|
+
<input type="checkbox" :checked="$for.item.external" @change="togglePlaceExternal($for.item.trail, $event.target.checked)">
|
|
186
|
+
<span>Клиент</span>
|
|
187
|
+
</label>
|
|
142
188
|
<oda-button icon="icons:send" title="Пригласить сотрудника по ссылке, Email, Telegram или MAX" @tap="openInvite($for.item.trail)">Пригласить</oda-button>
|
|
143
189
|
<oda-button icon="icons:add" title="Добавить подчинённое рабочее место" @tap="promptSubPlace($for.item.trail)">Подчинённое место</oda-button>
|
|
144
190
|
<oda-button icon="icons:delete" title="Удалить рабочее место" @tap="removePlace($for.item.trail)"></oda-button>
|
|
@@ -171,10 +217,10 @@ export default {
|
|
|
171
217
|
|
|
172
218
|
<div class="role-row">
|
|
173
219
|
<span class="role-title">Сотрудники места:</span>
|
|
174
|
-
<div class="user-chip" ~for="$for.item.users">
|
|
220
|
+
<div class="user-chip clickable" ~for="$for.item.users" title="Открыть диалог с пользователем" @tap="openUser($for.$for.item)">
|
|
175
221
|
<oda-icon icon="icons:person" icon-size="14"></oda-icon>
|
|
176
222
|
<span>{{userLabel($for.$for.item)}}</span>
|
|
177
|
-
<span ~if="canEdit" class="rm" title="Снять с рабочего места" @tap="removePlaceUser($for.item.trail, $for.$for.item)">×</span>
|
|
223
|
+
<span ~if="canEdit" class="rm" title="Снять с рабочего места" @tap.stop="removePlaceUser($for.item.trail, $for.$for.item)">×</span>
|
|
178
224
|
</div>
|
|
179
225
|
<span ~if="!$for.item.users.length" class="muted">сотрудники не назначены</span>
|
|
180
226
|
<select ~if="canEdit" @change="addPlaceUser($for.item.trail, $event)">
|
|
@@ -195,7 +241,7 @@ export default {
|
|
|
195
241
|
</div>
|
|
196
242
|
<div class="link-row" ~for="$for.item.links">
|
|
197
243
|
<oda-icon icon="odant:class" icon-size="16"></oda-icon>
|
|
198
|
-
<span
|
|
244
|
+
<span class="link-title" title="Открыть класс" @tap="openClass($for.$for.item.id)">{{classTitle($for.$for.item.id)}}</span>
|
|
199
245
|
<select :disabled="!canEdit" @change="updatePlaceLinkAccess($for.item.trail, $for.$for.item.id, $event.target.value)">
|
|
200
246
|
<option value="read" :selected="$for.$for.item.access === 'read'">Чтение (R)</option>
|
|
201
247
|
<option value="write" :selected="$for.$for.item.access === 'write'">Запись (A)</option>
|
|
@@ -226,7 +272,7 @@ export default {
|
|
|
226
272
|
</div>
|
|
227
273
|
</div>
|
|
228
274
|
</div>
|
|
229
|
-
<oda-messenger-settings :$item="$item" :can-edit="canEdit" :user-map="userMap"></oda-messenger-settings>
|
|
275
|
+
<oda-messenger-settings ~if="canEdit" :$item="$item" :can-edit="canEdit" :user-map="userMap"></oda-messenger-settings>
|
|
230
276
|
<div ~if="error" style="color:var(--error-color, #c00);">{{error}}</div>
|
|
231
277
|
`,
|
|
232
278
|
security: null,
|
|
@@ -237,6 +283,7 @@ export default {
|
|
|
237
283
|
canEdit: false,
|
|
238
284
|
focusedTrail: '',
|
|
239
285
|
newPlaceLabel: '',
|
|
286
|
+
newPlaceExternal: false,
|
|
240
287
|
inviteTrail: '',
|
|
241
288
|
inviteChannel: 'link',
|
|
242
289
|
inviteRecipient: '',
|
|
@@ -267,6 +314,8 @@ export default {
|
|
|
267
314
|
trail,
|
|
268
315
|
depth,
|
|
269
316
|
node: r,
|
|
317
|
+
mine: Boolean(r.mine),
|
|
318
|
+
external: Boolean(r.external),
|
|
270
319
|
users: Array.isArray(r.USERS) ? [...r.USERS] : [],
|
|
271
320
|
links: Array.isArray(r.LINKS) ? [...r.LINKS] : [],
|
|
272
321
|
});
|
|
@@ -293,16 +342,55 @@ export default {
|
|
|
293
342
|
return;
|
|
294
343
|
try {
|
|
295
344
|
this.canEdit = !!(WORK?.DEV_MODE || await this.$item.isAdmin);
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
345
|
+
if (this.canEdit) {
|
|
346
|
+
const body = await this.$item.body;
|
|
347
|
+
this.security = JSON.parse(JSON.stringify(body?.['#security'] || {}));
|
|
348
|
+
await Promise.all([this.loadUsers(), this.loadAvailableClasses(), this.loadInvites()]);
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
const [bossList, placesRes] = await Promise.all([
|
|
352
|
+
Promise.resolve(this.$item.bosses).catch(() => []),
|
|
353
|
+
this.$item.fetch('places').catch(() => ({ places: [] })),
|
|
354
|
+
this.loadUsers(),
|
|
355
|
+
]);
|
|
356
|
+
const toRoles = (list) => (Array.isArray(list) ? list : []).map(p => ({
|
|
357
|
+
id: p.id,
|
|
358
|
+
label: p.label || p.id,
|
|
359
|
+
icon: p.icon || '',
|
|
360
|
+
...(p.external ? { external: true } : {}),
|
|
361
|
+
...(p.mine ? { mine: true } : {}),
|
|
362
|
+
USERS: Array.isArray(p.users) ? p.users : [],
|
|
363
|
+
LINKS: Array.isArray(p.links) ? p.links.map(l => ({ id: l.id, access: l.access || 'read', scope: l.scope || '' })) : [],
|
|
364
|
+
ROLES: toRoles(p.roles),
|
|
365
|
+
}));
|
|
366
|
+
this.security = {
|
|
367
|
+
BOSS: Array.isArray(bossList) ? bossList.map(u => u?.id || u).filter(Boolean) : [],
|
|
368
|
+
ROLES: toRoles(placesRes?.places),
|
|
369
|
+
};
|
|
370
|
+
this.availableClasses = [];
|
|
371
|
+
this.invitesList = [];
|
|
372
|
+
}
|
|
301
373
|
}
|
|
302
374
|
catch (e) {
|
|
303
375
|
this.error = String(e?.message || e);
|
|
304
376
|
}
|
|
305
377
|
},
|
|
378
|
+
async openUser(uid) {
|
|
379
|
+
if (!uid || uid === 'USERS' || uid === 'GUESTS' || uid === 'GUEST')
|
|
380
|
+
return;
|
|
381
|
+
if (typeof window?.execute !== 'function')
|
|
382
|
+
return;
|
|
383
|
+
const target = await WORK.get_item(`/USERS/${uid}`).catch(() => null);
|
|
384
|
+
if (target)
|
|
385
|
+
window.execute(target);
|
|
386
|
+
},
|
|
387
|
+
async openClass(clsPath) {
|
|
388
|
+
if (!clsPath || typeof window?.execute !== 'function')
|
|
389
|
+
return;
|
|
390
|
+
const target = await WORK.get_item(clsPath).catch(() => null);
|
|
391
|
+
if (target)
|
|
392
|
+
window.execute(target);
|
|
393
|
+
},
|
|
306
394
|
async loadUsers() {
|
|
307
395
|
try {
|
|
308
396
|
const uRoot = (await WORK.get_item('/USERS')) || (await WORK.get_item('/users'));
|
|
@@ -407,11 +495,19 @@ export default {
|
|
|
407
495
|
return;
|
|
408
496
|
const id = label.toLowerCase().replace(/[^a-zа-яё0-9_-]+/gi, '_').replace(/^_+|_+$/g, '') || ('place_' + Date.now());
|
|
409
497
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
410
|
-
const newNode = {
|
|
498
|
+
const newNode = {
|
|
499
|
+
id,
|
|
500
|
+
label,
|
|
501
|
+
...(this.newPlaceExternal && !parentTrail ? { external: true } : {}),
|
|
502
|
+
USERS: [],
|
|
503
|
+
LINKS: [],
|
|
504
|
+
};
|
|
411
505
|
if (parentTrail) {
|
|
412
506
|
const parent = this._findPlaceMut(sec, parentTrail);
|
|
413
507
|
if (!parent)
|
|
414
508
|
return;
|
|
509
|
+
if (parent.external)
|
|
510
|
+
newNode.external = true;
|
|
415
511
|
parent.ROLES = Array.isArray(parent.ROLES) ? parent.ROLES : [];
|
|
416
512
|
if (!parent.ROLES.some(r => r.id === id))
|
|
417
513
|
parent.ROLES.push(newNode);
|
|
@@ -421,9 +517,21 @@ export default {
|
|
|
421
517
|
if (!sec.ROLES.some(r => r.id === id))
|
|
422
518
|
sec.ROLES.push(newNode);
|
|
423
519
|
this.newPlaceLabel = '';
|
|
520
|
+
this.newPlaceExternal = false;
|
|
424
521
|
}
|
|
425
522
|
await this.persist(sec);
|
|
426
523
|
},
|
|
524
|
+
async togglePlaceExternal(trail, checked) {
|
|
525
|
+
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
526
|
+
const node = this._findPlaceMut(sec, trail);
|
|
527
|
+
if (!node)
|
|
528
|
+
return;
|
|
529
|
+
if (checked)
|
|
530
|
+
node.external = true;
|
|
531
|
+
else
|
|
532
|
+
delete node.external;
|
|
533
|
+
await this.persist(sec);
|
|
534
|
+
},
|
|
427
535
|
async promptSubPlace(parentTrail) {
|
|
428
536
|
const name = window.prompt?.('Название подчинённого рабочего места:');
|
|
429
537
|
if (name && name.trim())
|
|
@@ -13,6 +13,9 @@ export default {
|
|
|
13
13
|
* @returns {Promise<boolean>} Есть ли поля для редактора
|
|
14
14
|
*/
|
|
15
15
|
async allowUse($context) {
|
|
16
|
+
const t = $context?.type;
|
|
17
|
+
if (t === '$server' || t === '$base' || t === '$project' || t === '$structure' || t === '$user')
|
|
18
|
+
return false;
|
|
16
19
|
const md = await $context?.METADATA;
|
|
17
20
|
const raw = md?.STATIC?.length ? md.STATIC : md?.FIELDS;
|
|
18
21
|
const list = Array.isArray(raw) ? raw : (Array.isArray(raw?.fields) ? raw.fields : []);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
/** Мета хендлера form/folder. Визуалка — folder.js. */
|
|
2
|
-
export default {
|
|
3
|
-
icon: 'fontawesome:r-folder-open',
|
|
4
|
-
label: 'Файлы',
|
|
5
|
-
roles: ['BOSS'],
|
|
6
|
-
|
|
1
|
+
/** Мета хендлера form/folder. Визуалка — folder.js. */
|
|
2
|
+
export default {
|
|
3
|
+
icon: 'fontawesome:r-folder-open',
|
|
4
|
+
label: 'Файлы',
|
|
5
|
+
roles: ['BOSS'],
|
|
6
|
+
allowUse($context) {
|
|
7
|
+
const t = $context?.type;
|
|
8
|
+
return t !== '$server' && t !== '$base' && t !== '$project' && t !== '$structure' && t !== '$user';
|
|
9
|
+
},
|
|
10
|
+
}
|
|
@@ -184,6 +184,7 @@ ODA({is: 'work-form',
|
|
|
184
184
|
<div :flex="ODA.states?.mobileMode"></div>
|
|
185
185
|
<item-node-explorer no-flex :$item="rootItem"></item-node-explorer>
|
|
186
186
|
<div flex></div>
|
|
187
|
+
<oda-button ~if="canOpenDataPage" shadow icon="carbon:data-base" @tap="openDataPage" title="Открыть проводник данных узла" label="Данные" :icon-size info-invert style="border-radius: 999px; padding: 0 10px; margin-right: 8px; flex-shrink: 0;"></oda-button>
|
|
187
188
|
<oda-button id="consultantBtn" shadow icon="bootstrap:robot" @tap="askConsultant" title="Спросить ИИ-консультанта по текущей форме" :icon-size info-invert style="border-radius: 50%; margin-right: 8px; flex-shrink: 0;"></oda-button>
|
|
188
189
|
<oda-button shadow icon="communication:call" @tap="call" title="Call..." :icon-size success style="border-radius: 50%;margin-right:32px;"></oda-button>
|
|
189
190
|
<slot name="top-panel"></slot>
|
|
@@ -730,6 +731,10 @@ ODA({is: 'work-form',
|
|
|
730
731
|
this._pendingInitialNav = nav;
|
|
731
732
|
return;
|
|
732
733
|
}
|
|
734
|
+
if (nav.noClassTree) {
|
|
735
|
+
this._noClassTreeFlag = true;
|
|
736
|
+
this._initClassTreeDrawer();
|
|
737
|
+
}
|
|
733
738
|
if (nav.targetClassPath || nav.create || nav.copyFrom || (nav.id && this.hasClassTree)) {
|
|
734
739
|
await this._handleNavigationTarget(nav, { isInitial: false });
|
|
735
740
|
return;
|
|
@@ -818,7 +823,10 @@ ODA({is: 'work-form',
|
|
|
818
823
|
const ownDefault = (views || []).find(v => v.id === $item?.form);
|
|
819
824
|
if (ownDefault)
|
|
820
825
|
return ownDefault;
|
|
821
|
-
const
|
|
826
|
+
const isStruct = ['$server', '$base', '$project', '$structure', '$user'].includes($item?.type);
|
|
827
|
+
const preferred = isStruct
|
|
828
|
+
? ['chat', 'calendar', 'email', 'system']
|
|
829
|
+
: ['objects', 'virtual', 'sheet', 'turnovers', 'postings', 'map', 'bpmn'];
|
|
822
830
|
for (const prefId of preferred) {
|
|
823
831
|
const hit = (views || []).find(v => v.id === prefId);
|
|
824
832
|
if (hit)
|
|
@@ -867,9 +875,11 @@ ODA({is: 'work-form',
|
|
|
867
875
|
this._initializingItem = false;
|
|
868
876
|
}
|
|
869
877
|
this._applyRoleColor(n, this._appliedRole);
|
|
870
|
-
this._initClassTreeDrawer();
|
|
871
878
|
const nav = this._takeNav(n.short || n.path) || this._pendingInitialNav;
|
|
872
879
|
this._pendingInitialNav = null;
|
|
880
|
+
if (nav?.noClassTree || (typeof location !== 'undefined' && new URLSearchParams(location.search).get('noTree') === '1'))
|
|
881
|
+
this._noClassTreeFlag = true;
|
|
882
|
+
this._initClassTreeDrawer();
|
|
873
883
|
if (nav) {
|
|
874
884
|
if (nav.view === 'objects' && nav.id)
|
|
875
885
|
nav.view = 'object';
|
|
@@ -896,7 +906,22 @@ ODA({is: 'work-form',
|
|
|
896
906
|
_appliedRole: '',
|
|
897
907
|
_syncingClassTreeFocus: false,
|
|
898
908
|
view_control: null,
|
|
909
|
+
_noClassTreeFlag: false,
|
|
910
|
+
get canOpenDataPage() {
|
|
911
|
+
const t = this.currentItem?.type;
|
|
912
|
+
return t === '$base' || t === '$project' || t === '$structure';
|
|
913
|
+
},
|
|
914
|
+
openDataPage() {
|
|
915
|
+
const target = this.currentItem;
|
|
916
|
+
const execFn = (typeof window !== 'undefined' && (window.top?.execute || window.execute)) || null;
|
|
917
|
+
if (target && execFn)
|
|
918
|
+
execFn(target, { page: 'data' });
|
|
919
|
+
},
|
|
899
920
|
get hasClassTree() {
|
|
921
|
+
if (this._noClassTreeFlag)
|
|
922
|
+
return false;
|
|
923
|
+
if (typeof location !== 'undefined' && new URLSearchParams(location.search).get('noTree') === '1')
|
|
924
|
+
return false;
|
|
900
925
|
const root = this._rootItem || this.$item;
|
|
901
926
|
if (!root)
|
|
902
927
|
return false;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
export const STATES = ['idle', 'listening', 'hearing', 'thinking', 'speaking', 'waiting', 'done', 'error', 'muted'];
|
|
8
8
|
export const EYES = ['round', 'sleepy', 'happy'];
|
|
9
|
-
export const ACCESSORIES = ['none', 'glasses', 'cap'];
|
|
9
|
+
export const ACCESSORIES = ['none', 'glasses', 'cap', 'wrench', 'tie', 'calc', 'headphones'];
|
|
10
10
|
export const POINTS = 12;
|
|
11
11
|
|
|
12
12
|
/** Лицо по состоянию: openness глаз (0..1.3), взгляд, рот, брови, дыхание, колыхание, чувствительность к громкости. */
|
|
@@ -184,11 +184,25 @@ ODA({ is: 'work-dot',
|
|
|
184
184
|
// аксессуар
|
|
185
185
|
if (this._accKey !== this.accessory) {
|
|
186
186
|
this._accKey = this.accessory;
|
|
187
|
-
el('acc').innerHTML = this.accessory
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
el('acc').innerHTML = this._accessorySvg(this.accessory);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
_accessorySvg(acc) {
|
|
191
|
+
switch (acc) {
|
|
192
|
+
case 'glasses':
|
|
193
|
+
return '<circle class="glasses" cx="-16" cy="-5" r="11"></circle><circle class="glasses" cx="16" cy="-5" r="11"></circle><line class="glasses" x1="-5" y1="-5" x2="5" y2="-5"></line>';
|
|
194
|
+
case 'cap':
|
|
195
|
+
return '<path class="cap-top" d="M-30 -22Q0 -62 30 -22Z"></path><path class="cap-brim" d="M12 -24L44 -20"></path>';
|
|
196
|
+
case 'wrench':
|
|
197
|
+
return '<path class="stroke" d="M22 -30L36 -16" stroke-width="4.2"></path><circle class="glasses" cx="20" cy="-32" r="5.5"></circle><path class="stroke" d="M33 -19L39 -13" stroke-width="4.5"></path>';
|
|
198
|
+
case 'tie':
|
|
199
|
+
return '<path class="cap-top" d="M-5 24L5 24L3 33L7 47L0 54L-7 47L-3 33Z"></path>';
|
|
200
|
+
case 'calc':
|
|
201
|
+
return '<rect class="glasses" x="18" y="14" width="18" height="22" rx="3"></rect><line class="glasses" x1="22" y1="20" x2="32" y2="20"></line><circle class="ink" cx="23" cy="26" r="1.5"></circle><circle class="ink" cx="29" cy="26" r="1.5"></circle><circle class="ink" cx="23" cy="31" r="1.5"></circle><circle class="ink" cx="29" cy="31" r="1.5"></circle>';
|
|
202
|
+
case 'headphones':
|
|
203
|
+
return '<path class="stroke" d="M-38 -4C-38 -36 38 -36 38 -4"></path><rect class="cap-top" x="-44" y="-12" width="10" height="20" rx="5"></rect><rect class="cap-top" x="34" y="-12" width="10" height="20" rx="5"></rect>';
|
|
204
|
+
default:
|
|
205
|
+
return '';
|
|
192
206
|
}
|
|
193
207
|
},
|
|
194
208
|
});
|
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
3
|
imports: 'oda//app-layout.js, oda//tabs.js, oda//icon, oda//button, ~/lib//tree.js, ~/lib//node-explorer.js, ~/lib//consultant.js, ~/lib//class-picker.js',
|
|
4
4
|
extends: 'oda-app-layout',
|
|
5
5
|
template: /*html*/`
|
|
6
|
-
<item-tree order="0" slot='left-panel' allow-search :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item style="height: 0"></item-tree>
|
|
6
|
+
<item-tree order="0" slot='left-panel' allow-search clean-structure :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item style="height: 0"></item-tree>
|
|
7
7
|
<item-consultant order="3" slot='left-panel' id="consultant" label="ИИ" icon="bootstrap:robot" :$item hidden style="height: 0"></item-consultant>
|
|
8
8
|
<div flex vertical slot='main' style="overflow: hidden; position: relative;">
|
|
9
9
|
<call-form ~if="showCall" id="callForm"></call-form>
|
|
@@ -373,7 +373,7 @@ export default {
|
|
|
373
373
|
}
|
|
374
374
|
catch { /* ignore */ }
|
|
375
375
|
},
|
|
376
|
-
_upsertBookmarkForUrl(pageUrl, $item = null) {
|
|
376
|
+
_upsertBookmarkForUrl(pageUrl, $item = null, pagePrefix = '', pageIcon = '') {
|
|
377
377
|
if (!pageUrl)
|
|
378
378
|
return null;
|
|
379
379
|
const short = $item?.short || $item?.path || this._extractShortFromUrl(pageUrl);
|
|
@@ -384,7 +384,8 @@ export default {
|
|
|
384
384
|
if (!bm) {
|
|
385
385
|
const lastSeg = String(short || '').split('/').filter(Boolean).pop() || '';
|
|
386
386
|
const dated = CORE?.$file?.formatDatedFileLabel?.($item?.id || lastSeg, $item?.DATA?.label);
|
|
387
|
-
const
|
|
387
|
+
const baseLabel = dated || $item?.DATA?.label || $item?.label || this._defaultLabelForShort(short);
|
|
388
|
+
const label = pagePrefix ? `${pagePrefix} · ${baseLabel}` : baseLabel;
|
|
388
389
|
bm = {
|
|
389
390
|
url: pageUrl,
|
|
390
391
|
hash,
|
|
@@ -392,15 +393,17 @@ export default {
|
|
|
392
393
|
stateKey: itemStateKey,
|
|
393
394
|
label,
|
|
394
395
|
title: `${label} (${short})`,
|
|
395
|
-
icon: this._defaultIconForItem($item, short),
|
|
396
|
+
icon: pageIcon || this._defaultIconForItem($item, short),
|
|
396
397
|
};
|
|
397
398
|
list.push(bm);
|
|
398
399
|
this.bookmarks = list;
|
|
399
|
-
|
|
400
|
+
if (!pagePrefix)
|
|
401
|
+
setTimeout(() => this._hydrateBookmarkMeta(bm, { cachedOnly: true }), 800);
|
|
400
402
|
}
|
|
401
403
|
else if ($item) {
|
|
402
|
-
const
|
|
403
|
-
const
|
|
404
|
+
const baseLabel = $item?.DATA?.label || $item?.label || bm.label;
|
|
405
|
+
const label = pagePrefix ? `${pagePrefix} · ${baseLabel}` : baseLabel;
|
|
406
|
+
const icon = pageIcon || this._defaultIconForItem($item, short);
|
|
404
407
|
if (itemStateKey)
|
|
405
408
|
bm.stateKey = itemStateKey;
|
|
406
409
|
if (bm.label !== label || bm.icon !== icon) {
|
|
@@ -673,22 +676,30 @@ export default {
|
|
|
673
676
|
window.execute = async ($item, nav) => {
|
|
674
677
|
if (!$item)
|
|
675
678
|
return;
|
|
679
|
+
let pageHandlerMeta = null;
|
|
676
680
|
if ($item.type === '$handler') {
|
|
677
681
|
const rawHPath = String($item.path || $item.short || '');
|
|
678
|
-
const
|
|
682
|
+
const mPage = rawHPath.match(/^(.*?)\/(?:~|\$[^/]+(?:\/\$[^/]+)*)\/handlers\/pages\/([^/$]+)(?:\/([^/$]+))?/);
|
|
679
683
|
const rawSelf = $item[R]?.target || $item;
|
|
680
684
|
const ctx = (Object.prototype.hasOwnProperty.call(rawSelf, '$context') || Object.prototype.hasOwnProperty.call($item, '$context'))
|
|
681
685
|
? await $item.$context
|
|
682
686
|
: null;
|
|
683
687
|
if (ctx && ctx.type !== '$handler') {
|
|
684
|
-
const
|
|
688
|
+
const pageName = mPage?.[2] || 'form';
|
|
689
|
+
const viewId = pageName === 'form' ? (mPage?.[3] || ($item.id && $item.id !== 'form' ? $item.id : '')) : '';
|
|
690
|
+
pageHandlerMeta = pageName !== 'form'
|
|
691
|
+
? { page: pageName, label: $item.DATA?.label || $item.label || pageName, icon: $item.DATA?.icon || $item.icon || '' }
|
|
692
|
+
: null;
|
|
685
693
|
$item = ctx;
|
|
686
|
-
|
|
687
|
-
|
|
694
|
+
nav = {
|
|
695
|
+
...(nav && typeof nav === 'object' ? nav : {}),
|
|
696
|
+
...(pageName !== 'form' ? { page: pageName } : (viewId ? { view: viewId } : {})),
|
|
697
|
+
};
|
|
688
698
|
}
|
|
689
699
|
}
|
|
700
|
+
const pageName = ($item.type !== '$handler' && nav?.page) ? String(nav.page) : ($item.page || 'form');
|
|
690
701
|
const short = $item?.short ?? $item?.path ?? '';
|
|
691
|
-
const dataRoot = ($item?.type !== '$handler') ? this._resolveDataRootPath(short, $item) : '';
|
|
702
|
+
const dataRoot = ($item?.type !== '$handler' && pageName === 'form') ? this._resolveDataRootPath(short, $item) : '';
|
|
692
703
|
const openShort = dataRoot || short;
|
|
693
704
|
const navKey = openShort || '/';
|
|
694
705
|
const effectiveNav = dataRoot
|
|
@@ -703,10 +714,13 @@ export default {
|
|
|
703
714
|
}
|
|
704
715
|
let hash = '#' + openShort;
|
|
705
716
|
if ($item.type !== '$handler')
|
|
706
|
-
hash += '/~/handlers/pages/' +
|
|
717
|
+
hash += '/~/handlers/pages/' + pageName;
|
|
707
718
|
history.replaceState(null, '', window.location.pathname + hash);
|
|
708
|
-
const fullUrl = encodeURI(window.location.origin + openShort + ($item.type !== '$handler' ? '/~/handlers/pages/' +
|
|
709
|
-
const
|
|
719
|
+
const fullUrl = encodeURI(window.location.origin + openShort + ($item.type !== '$handler' ? '/~/handlers/pages/' + pageName : '') + '/index.html');
|
|
720
|
+
const pageLabelPrefix = pageName !== 'form'
|
|
721
|
+
? (pageHandlerMeta?.label || ({ data: 'Данные', site: 'Сайт', storage: 'Хранилище', explorer: 'Проводник' }[pageName]) || pageName)
|
|
722
|
+
: '';
|
|
723
|
+
const bm = this._upsertBookmarkForUrl(fullUrl, openShort === short ? $item : null, pageLabelPrefix, pageHandlerMeta?.icon || (pageName === 'data' ? 'carbon:data-base' : ''));
|
|
710
724
|
if (openShort !== short && bm) {
|
|
711
725
|
const itemStateKey = ($item && ('_stateKey' in Object($item)) && $item._stateKey) ? String($item._stateKey) : '';
|
|
712
726
|
if (itemStateKey && itemStateKey.includes('#place:') && itemStateKey.includes('->')) {
|
|
@@ -102,6 +102,21 @@ export default {
|
|
|
102
102
|
align-self: center;
|
|
103
103
|
opacity: .85;
|
|
104
104
|
}
|
|
105
|
+
.unread-badge{
|
|
106
|
+
@apply --no-flex;
|
|
107
|
+
min-width: 18px;
|
|
108
|
+
height: 18px;
|
|
109
|
+
padding: 0 5px;
|
|
110
|
+
border-radius: 999px;
|
|
111
|
+
background: var(--accent-color, #2563eb);
|
|
112
|
+
color: #fff;
|
|
113
|
+
font-size: 11px;
|
|
114
|
+
font-weight: 700;
|
|
115
|
+
line-height: 18px;
|
|
116
|
+
text-align: center;
|
|
117
|
+
align-self: center;
|
|
118
|
+
margin-right: 4px;
|
|
119
|
+
}
|
|
105
120
|
</style>
|
|
106
121
|
<div horizontal flex style="align-items: center; min-width: 0; width: 100%;">
|
|
107
122
|
<div vertical flex style="min-width: 0;">
|
|
@@ -112,6 +127,7 @@ export default {
|
|
|
112
127
|
<span class="history-time" ~if="historyTime" ~show="!hideLabel">{{historyTime}}</span>
|
|
113
128
|
</div>
|
|
114
129
|
</div>
|
|
130
|
+
<span class="unread-badge" ~if="unreadCount > 0">{{unreadCount > 99 ? '99+' : unreadCount}}</span>
|
|
115
131
|
<span class="obj-count" ~if="objectCount">{{objectCount}}</span>
|
|
116
132
|
<span class="size" ~if="showSize && !($item instanceof CORE.$class) && !isPlace" ~show="$item?.size">{{$item?.size}}</span>
|
|
117
133
|
<slot></slot>
|
|
@@ -241,10 +257,8 @@ export default {
|
|
|
241
257
|
return 24;
|
|
242
258
|
const t = this.$item?.type;
|
|
243
259
|
const isNetServer = t === '$node' && this.$item?.id !== 'NODES';
|
|
244
|
-
if(this.isUser || t === '$user' || t === '$base' || t === '$project' || t === '$server' || isNetServer)
|
|
260
|
+
if(this.isUser || t === '$user' || t === '$base' || t === '$project' || t === '$structure' || t === '$server' || isNetServer)
|
|
245
261
|
return 48;
|
|
246
|
-
if(t === '$structure')
|
|
247
|
-
return 32;
|
|
248
262
|
if(this.isStructureLike)
|
|
249
263
|
return 28;
|
|
250
264
|
if(!this.showStatus)
|
|
@@ -257,5 +271,36 @@ export default {
|
|
|
257
271
|
return 24;
|
|
258
272
|
}
|
|
259
273
|
},
|
|
260
|
-
showStatus: false
|
|
274
|
+
showStatus: false,
|
|
275
|
+
_unreadVer: 0,
|
|
276
|
+
attached() {
|
|
277
|
+
if (!this._onChatUnreadEvt && globalThis.WORK) {
|
|
278
|
+
globalThis.WORK.chatEvents ??= new EventTarget();
|
|
279
|
+
this._onChatUnreadEvt = () => { this._unreadVer++; };
|
|
280
|
+
globalThis.WORK.chatEvents.addEventListener('chat:message', this._onChatUnreadEvt);
|
|
281
|
+
globalThis.WORK.chatEvents.addEventListener('chat:read', this._onChatUnreadEvt);
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
detached() {
|
|
285
|
+
if (this._onChatUnreadEvt && globalThis.WORK?.chatEvents) {
|
|
286
|
+
globalThis.WORK.chatEvents.removeEventListener('chat:message', this._onChatUnreadEvt);
|
|
287
|
+
globalThis.WORK.chatEvents.removeEventListener('chat:read', this._onChatUnreadEvt);
|
|
288
|
+
this._onChatUnreadEvt = null;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
get unreadCount() {
|
|
292
|
+
void this._unreadVer;
|
|
293
|
+
if (this.isLink)
|
|
294
|
+
return 0;
|
|
295
|
+
const u = globalThis.WORK?.chatUnread;
|
|
296
|
+
if (!u)
|
|
297
|
+
return 0;
|
|
298
|
+
const it = this.$item;
|
|
299
|
+
if (!it)
|
|
300
|
+
return 0;
|
|
301
|
+
if (this.isUser || it.type === '$user')
|
|
302
|
+
return Number(u.byPeer?.[it.id]) || 0;
|
|
303
|
+
const p = String(it.path || '/').replace(/\/+$/, '') || '/';
|
|
304
|
+
return Number(u.byNode?.[p]) || 0;
|
|
305
|
+
},
|
|
261
306
|
}
|