odant-work 1.0.103 → 1.0.104

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.
Files changed (38) hide show
  1. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +11 -1
  2. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +11 -1
  3. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/settings/$handler/class.js +292 -0
  4. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/skills/$handler/class.js +11 -1
  5. package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +14 -11
  6. package/$server/$folder/$file/$html/handlers/preview/$handler/preview.js +7 -0
  7. package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +11 -0
  8. package/$server/$folder/$file/$md/handlers/preview/$handler/preview.js +29 -8
  9. package/$server/$folder/$file/$office/handlers/preview/$handler/preview.js +6 -0
  10. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +34 -2
  11. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +14 -11
  12. package/$server/$folder/$file/$task/handlers/preview/$handler/preview.js +1 -0
  13. package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +9 -0
  14. package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +15 -0
  15. package/$server/$folder/handlers/pages/form/$handler/class.js +10 -2
  16. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +523 -25
  17. package/$server/$folder/lib/explorer/explorer.js +63 -0
  18. package/$server/$folder/lib/tree/tree.js +45 -14
  19. package/NODES/$node/handlers/pages/form/network/$handler/class.js +552 -36
  20. package/oda/components/icon/icon.js +20 -7
  21. package/package.json +1 -1
  22. package/sources/client.js +24 -0
  23. package/sources/host/websocket.js +17 -0
  24. package/sources/modules/agent/index.js +25 -6
  25. package/sources/modules/agent/permissions.js +4 -2
  26. package/sources/modules/agent/scope.js +72 -5
  27. package/sources/modules/agent/session.js +59 -6
  28. package/sources/modules/agent/tools/work/classes.js +16 -1
  29. package/sources/modules/license/index.js +120 -0
  30. package/sources/modules/nodes/registry.js +57 -7
  31. package/sources/modules/trainer/local-engine.js +22 -9
  32. package/sources/modules/user-profile/user-profile.js +0 -129
  33. package/sources/modules/user-profile/user-tokens.js +426 -85
  34. package/sources/server/access/gateway.js +1 -0
  35. package/sources/server/folder.js +5 -1
  36. package/sources/server/node.js +16 -0
  37. package/sources/server/server.js +14 -5
  38. package/sources/server/user.js +3 -0
@@ -114,8 +114,11 @@ export default {
114
114
  buttons.push({
115
115
  round: true,
116
116
  icon: 'eva:o-phone-call-outline',
117
+ default: '',
117
118
  title: 'Вернуться к звонку',
118
119
  rainbow: true,
120
+ errorInvert: false,
121
+ style: '',
119
122
  click: () => {
120
123
  this.showCall = true;
121
124
  },
@@ -126,10 +129,13 @@ export default {
126
129
  buttons.push({
127
130
  round: true,
128
131
  icon: 'icons:help',
132
+ default: '',
129
133
  title: supPending > 0
130
134
  ? `Служба поддержки (${supPending} уведомл.)`
131
135
  : 'Служба поддержки (скриншот, видео, удалённый экран)',
132
136
  rainbow: Boolean(this._supportRemotePending > 0 || this._supportUnread > 0),
137
+ errorInvert: false,
138
+ style: '',
133
139
  click: () => {
134
140
  this.openSupportPanel?.();
135
141
  },
@@ -139,6 +145,8 @@ export default {
139
145
  round: true,
140
146
  icon: userIcon,
141
147
  default: 'icons:account-circle',
148
+ title: user?.label || 'Профиль',
149
+ rainbow: false,
142
150
  style: `color: white; fill: white; background:${userColor}`,
143
151
  click: async () => {
144
152
  if (WORK?.uid) {
@@ -157,6 +165,11 @@ export default {
157
165
  buttons.push({
158
166
  round: true,
159
167
  icon: 'icons:apps',
168
+ default: '',
169
+ title: 'Главная',
170
+ rainbow: false,
171
+ errorInvert: false,
172
+ style: '',
160
173
  click: (e) => {
161
174
  e.stopPropagation();
162
175
  this.visibleMode = 'main';
@@ -664,6 +677,52 @@ export default {
664
677
  this._saveBookmarksState();
665
678
  history.replaceState(null, '', window.location.pathname);
666
679
  },
680
+ _handleNodeDeleted(detail) {
681
+ const delPath = String(detail?.path || '').replace(/\/+$/, '');
682
+ if (!delPath)
683
+ return;
684
+ const matchesDeleted = (bm) => {
685
+ const s = String(bm?.short || '').replace(/\/+$/, '');
686
+ if (s && (s === delPath || s.startsWith(delPath + '/')))
687
+ return true;
688
+ try {
689
+ const decoded = decodeURI(String(bm?.url || ''));
690
+ return decoded.includes(delPath + '/') || decoded.endsWith(delPath);
691
+ }
692
+ catch {
693
+ return false;
694
+ }
695
+ };
696
+ const currentList = this.bookmarks || [];
697
+ const removed = currentList.filter(matchesDeleted);
698
+ if (removed.length) {
699
+ const focusedWasRemoved = removed.some(b => b.url === this.focusedPage);
700
+ for (const b of removed)
701
+ this.pages.remove(b.url);
702
+ const nextList = currentList.filter(b => !matchesDeleted(b));
703
+ this.bookmarks = nextList;
704
+ if (focusedWasRemoved) {
705
+ const next = nextList.at(-1);
706
+ if (next)
707
+ this.activateBookmark(next);
708
+ else {
709
+ this.focusedPage = '';
710
+ this._saveBookmarksState();
711
+ history.replaceState(null, '', window.location.pathname);
712
+ if (typeof window.execute === 'function' && this.$item)
713
+ window.execute(this.$item);
714
+ }
715
+ }
716
+ else {
717
+ this._saveBookmarksState();
718
+ }
719
+ ODA.showMessage?.('Узел удалён');
720
+ }
721
+ for (const t of this.$$?.('item-tree') || []) {
722
+ t?.$item?.reset?.();
723
+ t?.render?.();
724
+ }
725
+ },
667
726
 
668
727
  load_page(explicitUrl = '') {
669
728
  let url = explicitUrl;
@@ -795,6 +854,10 @@ export default {
795
854
  this._syncExplorerTreeScope();
796
855
  this.render?.();
797
856
  });
857
+ if (!this._onNodeDeleted && WORK.chatEvents) {
858
+ this._onNodeDeleted = (ev) => this._handleNodeDeleted(ev?.detail);
859
+ WORK.chatEvents.addEventListener('node.deleted', this._onNodeDeleted);
860
+ }
798
861
  window.execute = async ($item, nav) => {
799
862
  if (!$item)
800
863
  return;
@@ -185,10 +185,29 @@ export default {
185
185
  set() {
186
186
  for (const node of this._mountedNodes || [])
187
187
  node?.invalidate?.('items', 'expanderIcon', 'knownHasItems');
188
- if (this.$item)
189
- this.getItems(this.$item, 1);
188
+ if (!this.$item || !this.items?.length)
189
+ return;
190
+ const root = this.$item;
191
+ this.getItems(root, 1).then(() => {
192
+ if (this.$item !== root)
193
+ return;
194
+ for (const node of this._mountedNodes || [])
195
+ node?.invalidate?.('items', 'expanderIcon', 'knownHasItems');
196
+ // Пересобираем корень ~for="items", чтобы гарантированно обновить дочерние узлы после смены фильтра
197
+ this.items = [];
198
+ queueMicrotask(() => {
199
+ if (this.$item === root) {
200
+ this.items = [root];
201
+ this.render?.();
202
+ }
203
+ });
204
+ }).catch(() => {});
190
205
  },
191
206
  },
207
+ restoreState: {
208
+ $def: true,
209
+ $type: Boolean,
210
+ },
192
211
  autoRun: true,
193
212
  hideFiles: false,
194
213
  onlyClasses: false, // только CORE.$class (site)
@@ -259,7 +278,7 @@ export default {
259
278
  _loadSavedTreeState(root = this.$item) {
260
279
  this._savedExpandedSet = new Set();
261
280
  this._savedFocusedKey = '';
262
- if (typeof localStorage === 'undefined')
281
+ if (!this.restoreState || typeof localStorage === 'undefined')
263
282
  return;
264
283
  try {
265
284
  const raw = localStorage.getItem(this._treeStorageKey(root));
@@ -294,7 +313,7 @@ export default {
294
313
  catch { /* ignore */ }
295
314
  },
296
315
  _persistTreeState() {
297
- if (typeof localStorage === 'undefined' || !this.$item)
316
+ if (!this.restoreState || typeof localStorage === 'undefined' || !this.$item)
298
317
  return;
299
318
  try {
300
319
  localStorage.setItem(this._treeStorageKey(this.$item), JSON.stringify({
@@ -305,6 +324,8 @@ export default {
305
324
  catch { /* ignore */ }
306
325
  },
307
326
  recordNodeExpanded(it, isExpanded) {
327
+ if (!this.restoreState)
328
+ return;
308
329
  const key = nodeStateKey(it);
309
330
  if (!key)
310
331
  return;
@@ -316,6 +337,8 @@ export default {
316
337
  this._persistTreeState();
317
338
  },
318
339
  recordNodeFocused(it) {
340
+ if (!this.restoreState)
341
+ return;
319
342
  const key = nodeStateKey(it);
320
343
  if (!key)
321
344
  return;
@@ -813,7 +836,8 @@ ODA({is: 'oda-tree-node',
813
836
  SEC_TREE_PROMISES.delete(k);
814
837
  SEC_NODES_MAP.delete(k);
815
838
  this.invalidate?.('hasSecurity', 'knownHasItems', 'items', 'expanderIcon');
816
- this.$item.expanded = true;
839
+ if (e?.detail?.value || this.$item.expanded || this.hideTops > 0 || this.hideRoots > 0)
840
+ this.$item.expanded = true;
817
841
  if (e?.detail?.value && typeof e.detail.value === 'string') {
818
842
  const found = (await this.items)?.find(f => f.id === e.detail.value);
819
843
  if (found && this.$pdp?.tree)
@@ -1063,20 +1087,26 @@ ODA({is: 'oda-tree-node',
1063
1087
  },
1064
1088
  async set(n) {
1065
1089
  if (this.$item && n !== undefined) {
1090
+ const want = Boolean(n);
1066
1091
  const tree = this.$pdp?.tree;
1067
- const scroller = !n ? tree?.$('div[style*="overflow: auto"]') : null;
1068
- const rowEl = !n ? this.$('.node') : null;
1092
+ const scroller = !want ? tree?.$('div[style*="overflow: auto"]') : null;
1093
+ const rowEl = !want ? this.$('.node') : null;
1069
1094
  const beforeVisualTop = rowEl ? rowEl.getBoundingClientRect().top : null;
1070
- const beforeHostTop = !n ? this.getBoundingClientRect().top : null;
1095
+ const beforeHostTop = !want ? this.getBoundingClientRect().top : null;
1096
+ const seq = (this._expSeq = (this._expSeq || 0) + 1);
1071
1097
 
1072
- if (n) {
1098
+ this.$item.expanded = want;
1099
+ if (this.hideTops < 1 && this.hideRoots < 1)
1100
+ tree?.recordNodeExpanded?.(this.$item, want);
1101
+ this.invalidate?.('expanded', 'expanderIcon');
1102
+ if (want) {
1073
1103
  await this.$pdp.getItems(this.$item, 1);
1104
+ if (seq !== this._expSeq)
1105
+ return;
1074
1106
  this.$item.expanded = true;
1107
+ this.invalidate?.('items', 'expanded', 'expanderIcon');
1075
1108
  }
1076
- this.$item.expanded = n;
1077
- if (this.hideTops < 1 && this.hideRoots < 1)
1078
- tree?.recordNodeExpanded?.(this.$item, !!n);
1079
- if (!n) {
1109
+ if (!want) {
1080
1110
  this.isStuck = false;
1081
1111
  if (scroller && beforeVisualTop !== null && beforeHostTop !== null && beforeHostTop < beforeVisualTop - 1) {
1082
1112
  scroller.scrollTop = Math.max(0, scroller.scrollTop + (beforeHostTop - beforeVisualTop));
@@ -1231,7 +1261,8 @@ ODA({is: 'oda-tree-node',
1231
1261
  this._secTree = null;
1232
1262
  if (this.$item)
1233
1263
  SEC_TREE_PROMISES.delete(rawItem(this.$item));
1234
- this.$item.expanded = true;
1264
+ if (e?.detail?.value || this.$item?.expanded || this.hideTops > 0 || this.hideRoots > 0)
1265
+ this.$item.expanded = true;
1235
1266
  if(e.detail.value){
1236
1267
  let item = (await this.items)?.find(f=>f.id === e.detail.value);
1237
1268
  if(item)