odant-work 1.0.102 → 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 (56) 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/chat/$handler/chat-task.js +17 -6
  6. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +24 -2
  7. package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +14 -11
  8. package/$server/$folder/$file/$html/handlers/preview/$handler/preview.js +7 -0
  9. package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +11 -0
  10. package/$server/$folder/$file/$md/handlers/preview/$handler/preview.js +29 -8
  11. package/$server/$folder/$file/$office/handlers/preview/$handler/preview.js +6 -0
  12. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +65 -10
  13. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +14 -11
  14. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/util.js +32 -0
  15. package/$server/$folder/$file/$task/handlers/preview/$handler/preview.js +1 -0
  16. package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +9 -0
  17. package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +15 -0
  18. package/$server/$folder/handlers/pages/form/$handler/class.js +10 -2
  19. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +523 -25
  20. package/$server/$folder/lib/consultant/consultant.js +80 -3
  21. package/$server/$folder/lib/explorer/explorer.js +63 -0
  22. package/$server/$folder/lib/tree/tree.js +47 -16
  23. package/NODES/$node/handlers/pages/form/network/$handler/class.js +552 -36
  24. package/autostart.bat +28 -0
  25. package/autostart.sh +17 -0
  26. package/oda/components/icon/icon.js +20 -7
  27. package/package.json +1 -1
  28. package/run.mjs +19 -0
  29. package/scripts/autostart.mjs +281 -0
  30. package/scripts/watchdog.mjs +496 -0
  31. package/sources/client.js +146 -2
  32. package/sources/host/auth-methods.js +2 -0
  33. package/sources/host/auto-updater.js +23 -1
  34. package/sources/host/http-server.js +5 -3
  35. package/sources/host/push.js +43 -14
  36. package/sources/host/websocket.js +69 -3
  37. package/sources/modules/agent/index.js +50 -19
  38. package/sources/modules/agent/permissions.js +4 -2
  39. package/sources/modules/agent/scope.js +72 -5
  40. package/sources/modules/agent/session.js +97 -14
  41. package/sources/modules/agent/tools/work/classes.js +16 -1
  42. package/sources/modules/license/index.js +120 -0
  43. package/sources/modules/nodes/registry.js +57 -7
  44. package/sources/modules/trainer/local-engine.js +22 -9
  45. package/sources/modules/user-profile/user-tokens.js +426 -85
  46. package/sources/server/access/gateway.js +3 -1
  47. package/sources/server/class/feed.js +6 -0
  48. package/sources/server/folder.js +5 -1
  49. package/sources/server/node.js +16 -0
  50. package/sources/server/server.js +59 -1
  51. package/sources/server/user.js +48 -0
  52. package/start.bat +25 -0
  53. package/start.sh +27 -0
  54. package/stop.bat +25 -0
  55. package/stop.sh +16 -0
  56. package/sw.js +3 -11
@@ -1,3 +1,13 @@
1
1
  export default {
2
- enabled: false,
2
+ async allowUse($context, params) {
3
+ if (!$context?.id || $context?.DATA?.usersContainer)
4
+ return false;
5
+ const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
6
+ if (uid && $context.id === uid)
7
+ return true;
8
+ if (globalThis.WORK?.DEV_MODE)
9
+ return true;
10
+ const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
11
+ return Array.isArray(roles) && roles.includes('BOSS');
12
+ },
3
13
  };
@@ -1,3 +1,13 @@
1
1
  export default {
2
- enabled: false,
2
+ async allowUse($context, params) {
3
+ if (!$context?.id || $context?.DATA?.usersContainer)
4
+ return false;
5
+ const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
6
+ if (uid && $context.id === uid)
7
+ return true;
8
+ if (globalThis.WORK?.DEV_MODE)
9
+ return true;
10
+ const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
11
+ return Array.isArray(roles) && roles.includes('BOSS');
12
+ },
3
13
  };
@@ -0,0 +1,292 @@
1
+ export default {
2
+ label: 'Настройки',
3
+ icon: 'icons:tune',
4
+ order: 16,
5
+ async allowUse($context, params) {
6
+ if (!$context?.id || $context?.DATA?.usersContainer)
7
+ return false;
8
+ const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
9
+ if (uid && $context.id === uid)
10
+ return true;
11
+ if (globalThis.WORK?.DEV_MODE)
12
+ return true;
13
+ const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
14
+ return Array.isArray(roles) && roles.includes('BOSS');
15
+ },
16
+ component: {
17
+ imports: 'oda//icon, oda//button',
18
+ template: /* html */`
19
+ <style>
20
+ :host {
21
+ display: flex;
22
+ flex-direction: column;
23
+ flex: 1;
24
+ min-height: 0;
25
+ overflow: auto;
26
+ padding: 20px 24px 32px;
27
+ box-sizing: border-box;
28
+ background: var(--content-background, #ffffff);
29
+ color: var(--content-color, #1f2937);
30
+ font-family: var(--font-family, system-ui, -apple-system, sans-serif);
31
+ }
32
+ .page {
33
+ width: min(760px, 100%);
34
+ margin: 0 auto;
35
+ display: flex;
36
+ flex-direction: column;
37
+ gap: 16px;
38
+ }
39
+ .header {
40
+ display: flex;
41
+ align-items: center;
42
+ gap: 12px;
43
+ }
44
+ .title-ico {
45
+ width: 40px;
46
+ height: 40px;
47
+ border-radius: 10px;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ background: color-mix(in srgb, var(--accent-color, #2563eb) 14%, transparent);
52
+ color: var(--accent-color, #2563eb);
53
+ flex-shrink: 0;
54
+ }
55
+ h2 {
56
+ margin: 0;
57
+ font-size: 18px;
58
+ font-weight: 700;
59
+ }
60
+ .subtitle {
61
+ margin: 3px 0 0;
62
+ font-size: 13px;
63
+ opacity: 0.75;
64
+ }
65
+ .card {
66
+ border: 1px solid var(--subtle-border, var(--border-color, rgba(128, 128, 128, 0.25)));
67
+ border-radius: 12px;
68
+ background: var(--subtle-background, rgba(128, 128, 128, 0.03));
69
+ padding: 16px 18px;
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: 14px;
73
+ }
74
+ .card-title {
75
+ font-size: 15px;
76
+ font-weight: 600;
77
+ }
78
+ .field {
79
+ display: flex;
80
+ flex-direction: column;
81
+ gap: 6px;
82
+ }
83
+ .field-label {
84
+ font-size: 13.5px;
85
+ font-weight: 600;
86
+ }
87
+ .field-hint {
88
+ font-size: 12.5px;
89
+ opacity: 0.72;
90
+ line-height: 1.4;
91
+ }
92
+ .select {
93
+ width: 100%;
94
+ padding: 9px 12px;
95
+ border-radius: 8px;
96
+ border: 1px solid var(--control-border-color, var(--border-color, #cbd5e1));
97
+ background: var(--content-background, #ffffff);
98
+ color: var(--content-color, #1f2937);
99
+ font: inherit;
100
+ font-size: 13.5px;
101
+ box-sizing: border-box;
102
+ }
103
+ .toggle-row {
104
+ display: flex;
105
+ align-items: flex-start;
106
+ gap: 12px;
107
+ padding: 12px 14px;
108
+ border-radius: 10px;
109
+ border: 1px solid var(--subtle-border, var(--border-color, rgba(128, 128, 128, 0.22)));
110
+ background: var(--content-background, #ffffff);
111
+ cursor: pointer;
112
+ }
113
+ .toggle-row input {
114
+ width: 18px;
115
+ height: 18px;
116
+ margin: 2px 0 0;
117
+ flex-shrink: 0;
118
+ cursor: pointer;
119
+ }
120
+ .status {
121
+ font-size: 13px;
122
+ font-weight: 500;
123
+ color: #059669;
124
+ }
125
+ .status[error] {
126
+ color: var(--error-color, #dc2626);
127
+ }
128
+ </style>
129
+
130
+ <div class="page">
131
+ <div class="header">
132
+ <div class="title-ico">
133
+ <oda-icon icon="icons:tune" icon-size="22"></oda-icon>
134
+ </div>
135
+ <div>
136
+ <h2>Личные настройки</h2>
137
+ <p class="subtitle">{{targetTitle}} · Индивидуальные параметры интерфейса и работы ИИ-ассистента.</p>
138
+ </div>
139
+ </div>
140
+
141
+ <div class="card">
142
+ <div class="card-title">Искусственный интеллект</div>
143
+ <div class="field">
144
+ <label class="field-label" for="aiModelSelect">Главная модель ИИ</label>
145
+ <select id="aiModelSelect" class="select" @change="_onModelChange($event)">
146
+ <option value="" :selected="!settingModel">{{defaultOptionLabel}}</option>
147
+ <option ~for="chatModels" :value="$for.item.path" :selected="$for.item.path === settingModel">{{$for.item.label}}</option>
148
+ </select>
149
+ <div class="field-hint">
150
+ Используется по умолчанию во всех новых чатах на любом устройстве и синхронизируется при смене модели в строке чата.
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <div class="card">
156
+ <div class="card-title">Интерфейс и уведомления</div>
157
+ <label class="toggle-row">
158
+ <input type="checkbox" :checked="settingChatSound" @change="_onSoundChange($event)">
159
+ <div>
160
+ <div class="field-label">Звуковой щелчок по завершении ответа</div>
161
+ <div class="field-hint">Короткий тихий сигнал, когда открытый на экране чат завершил ответ или ждёт вашего подтверждения.</div>
162
+ </div>
163
+ </label>
164
+ </div>
165
+
166
+ <div class="status" ~if="statusText" :error="!!statusError">{{statusText}}</div>
167
+ </div>
168
+ `,
169
+ $item: {
170
+ $def: null,
171
+ set(n) {
172
+ if (n) this.reload();
173
+ }
174
+ },
175
+ chatModels: [],
176
+ systemDefaultModel: '',
177
+ settingModel: '',
178
+ settingChatSound: true,
179
+ statusText: '',
180
+ statusError: false,
181
+ get targetUid() {
182
+ return this.$item?.id || WORK?.uid || '';
183
+ },
184
+ get isSelf() {
185
+ return Boolean(WORK?.uid && this.targetUid === WORK.uid);
186
+ },
187
+ get targetTitle() {
188
+ return this.$item?.DATA?.label || this.$item?.label || this.targetUid || 'Пользователь';
189
+ },
190
+ get defaultOptionLabel() {
191
+ const defItem = (this.chatModels || []).find(m => m.path === this.systemDefaultModel);
192
+ if (defItem)
193
+ return `По умолчанию системы (${defItem.label})`;
194
+ return 'По умолчанию системы';
195
+ },
196
+ attached() {
197
+ this._onUserSettings = () => {
198
+ if (this.isSelf) {
199
+ const s = WORK.userSettings || {};
200
+ this.settingModel = typeof s.aiModel === 'string' ? s.aiModel : '';
201
+ this.settingChatSound = s.chatSound !== false;
202
+ this._syncSelectDom();
203
+ }
204
+ };
205
+ WORK.authEvents?.addEventListener?.('user-settings', this._onUserSettings);
206
+ this.reload();
207
+ },
208
+ detached() {
209
+ if (this._onUserSettings)
210
+ WORK.authEvents?.removeEventListener?.('user-settings', this._onUserSettings);
211
+ },
212
+ _syncSelectDom() {
213
+ this.async(() => {
214
+ const sel = this.$?.('#aiModelSelect');
215
+ if (sel && sel.value !== this.settingModel)
216
+ sel.value = this.settingModel || '';
217
+ }, 20);
218
+ },
219
+ async reload() {
220
+ if (!WORK?.uid || typeof WORK?.fetch !== 'function')
221
+ return;
222
+ const uid = this.targetUid;
223
+ try {
224
+ const [settings, models, defPath] = await Promise.all([
225
+ WORK.fetch('/', 'user_settings_get', uid ? { uid } : {}),
226
+ WORK.fetch('/', 'agent_chat_models').catch(() => []),
227
+ WORK.fetch('/', 'agent_default_model', { nodePath: this.$item?.path || '/' }).catch(() => ''),
228
+ ]);
229
+ if (Array.isArray(models))
230
+ this.chatModels = models;
231
+ this.systemDefaultModel = typeof defPath === 'string' ? defPath : '';
232
+ if (settings && typeof settings === 'object') {
233
+ this.settingModel = typeof settings.aiModel === 'string' ? settings.aiModel : '';
234
+ this.settingChatSound = settings.chatSound !== false;
235
+ if (this.isSelf)
236
+ WORK._applyUserSettings?.(settings, { broadcast: false });
237
+ }
238
+ this._syncSelectDom();
239
+ }
240
+ catch (e) {
241
+ this.statusError = true;
242
+ this.statusText = e?.message || 'Не удалось загрузить настройки';
243
+ }
244
+ },
245
+ async _savePatch(patch) {
246
+ this.statusError = false;
247
+ this.statusText = '';
248
+ try {
249
+ const payload = { ...patch, ...(!this.isSelf && this.targetUid ? { uid: this.targetUid } : {}) };
250
+ let saved;
251
+ if (this.isSelf && typeof WORK.saveUserSettings === 'function') {
252
+ saved = await WORK.saveUserSettings(patch);
253
+ }
254
+ else {
255
+ saved = await WORK.fetch('/', 'user_settings_save', {}, payload);
256
+ }
257
+ if (saved && typeof saved === 'object') {
258
+ this.settingModel = typeof saved.aiModel === 'string' ? saved.aiModel : '';
259
+ this.settingChatSound = saved.chatSound !== false;
260
+ }
261
+ if (this.isSelf && 'aiModel' in patch && patch.aiModel && typeof BroadcastChannel !== 'undefined') {
262
+ try { new BroadcastChannel('work-user-ai-model').postMessage({ model: patch.aiModel }); } catch {}
263
+ }
264
+ this._syncSelectDom();
265
+ this.statusText = 'Сохранено';
266
+ clearTimeout(this._stTimer);
267
+ this._stTimer = setTimeout(() => { this.statusText = ''; }, 2000);
268
+ }
269
+ catch (e) {
270
+ this.statusError = true;
271
+ this.statusText = e?.message || 'Ошибка сохранения';
272
+ }
273
+ },
274
+ _onModelChange(e) {
275
+ const val = String(e?.target?.value || '');
276
+ this.settingModel = val;
277
+ if (this.isSelf && !val && typeof localStorage !== 'undefined') {
278
+ try {
279
+ const uid = WORK.uid || this.targetUid || 'default';
280
+ localStorage.removeItem('work.user.ai:' + uid + ':model');
281
+ localStorage.removeItem('work.user.ai:default:model');
282
+ } catch {}
283
+ }
284
+ this._savePatch({ aiModel: val });
285
+ },
286
+ _onSoundChange(e) {
287
+ const checked = Boolean(e?.target?.checked);
288
+ this.settingChatSound = checked;
289
+ this._savePatch({ chatSound: checked });
290
+ },
291
+ }
292
+ };
@@ -1,3 +1,13 @@
1
1
  export default {
2
- enabled: false,
2
+ async allowUse($context, params) {
3
+ if (!$context?.id || $context?.DATA?.usersContainer)
4
+ return false;
5
+ const uid = $context?.constructor?.resolveUid?.(params) || params?.session?.uid || '';
6
+ if (uid && $context.id === uid)
7
+ return true;
8
+ if (globalThis.WORK?.DEV_MODE)
9
+ return true;
10
+ const roles = await globalThis.WORK?.roles?.(params).catch(() => []);
11
+ return Array.isArray(roles) && roles.includes('BOSS');
12
+ },
3
13
  };
@@ -121,6 +121,13 @@ export function normalizeModelPath(modelPath) {
121
121
  }
122
122
 
123
123
  export function getUserPreferredModel() {
124
+ const serverModel = normalizeModelPath(
125
+ globalThis.WORK?.userSettings?.aiModel
126
+ || globalThis.WORK?.USER?.DATA?.settings?.aiModel
127
+ || ''
128
+ );
129
+ if (serverModel && !NON_CHAT_MODEL_RE.test(serverModel))
130
+ return serverModel;
124
131
  if (typeof localStorage === 'undefined')
125
132
  return '';
126
133
  try {
@@ -137,19 +144,23 @@ export function getUserPreferredModel() {
137
144
  }
138
145
  }
139
146
 
140
- export function setUserPreferredModel(modelPath) {
147
+ export function setUserPreferredModel(modelPath, { syncServer = true } = {}) {
141
148
  const clean = normalizeModelPath(modelPath);
142
- if (!clean || typeof localStorage === 'undefined')
143
- return;
144
- if (NON_CHAT_MODEL_RE.test(clean))
149
+ if (!clean || NON_CHAT_MODEL_RE.test(clean))
145
150
  return;
146
151
  try {
147
- localStorage.setItem(userAiStorageKey('model'), clean);
148
- localStorage.setItem('work.user.ai:default:model', clean);
152
+ if (typeof localStorage !== 'undefined') {
153
+ localStorage.setItem(userAiStorageKey('model'), clean);
154
+ localStorage.setItem('work.user.ai:default:model', clean);
155
+ }
149
156
  if (typeof BroadcastChannel !== 'undefined')
150
157
  new BroadcastChannel('work-user-ai-model').postMessage({ model: clean });
151
158
  }
152
159
  catch { /* ignore */ }
160
+ if (syncServer && globalThis.WORK?.uid && typeof globalThis.WORK?.saveUserSettings === 'function') {
161
+ if (normalizeModelPath(globalThis.WORK?.userSettings?.aiModel || '') !== clean)
162
+ globalThis.WORK.saveUserSettings({ aiModel: clean }).catch?.(() => {});
163
+ }
153
164
  }
154
165
 
155
166
  /**
@@ -71,10 +71,25 @@ ODA({
71
71
  this._modelBc = new BroadcastChannel('work-user-ai-model');
72
72
  this._modelBc.onmessage = ev => {
73
73
  const m = ev?.data?.model;
74
- if (m && m !== this.model) this.model = m;
74
+ if (m && m !== this.model) {
75
+ this._settingModelFromSync = true;
76
+ this.model = m;
77
+ this._settingModelFromSync = false;
78
+ }
75
79
  };
76
80
  } catch {/* ignore */}
77
81
  }
82
+ if (!this._onUserSettings && globalThis.WORK?.authEvents) {
83
+ this._onUserSettings = ev => {
84
+ const m = ev?.detail?.aiModel;
85
+ if (m && m !== this.model) {
86
+ this._settingModelFromSync = true;
87
+ this.model = m;
88
+ this._settingModelFromSync = false;
89
+ }
90
+ };
91
+ globalThis.WORK.authEvents.addEventListener('user-settings', this._onUserSettings);
92
+ }
78
93
  await this._hydrateModel();
79
94
  if (this._initialNav) {
80
95
  const nav = this._initialNav;
@@ -107,6 +122,10 @@ ODA({
107
122
  this._modelBc?.close?.();
108
123
  this._modelBc = null;
109
124
  } catch {/* ignore */}
125
+ if (this._onUserSettings) {
126
+ globalThis.WORK?.authEvents?.removeEventListener?.('user-settings', this._onUserSettings);
127
+ this._onUserSettings = null;
128
+ }
110
129
  },
111
130
  last: {
112
131
  $def: 0,
@@ -115,13 +134,16 @@ ODA({
115
134
  model: {
116
135
  $def: '',
117
136
  set(n) {
118
- if (n) setUserPreferredModel(n);
137
+ if (n) setUserPreferredModel(n, { syncServer: !this._settingModelFromSync });
119
138
  }
120
139
  },
121
140
  get $saveKey() {
122
141
  return this.$item?.short;
123
142
  },
124
143
  async _hydrateModel() {
144
+ if (WORK?.uid && !WORK._userSettingsLoaded && typeof WORK.loadUserSettings === 'function') {
145
+ await WORK.loadUserSettings().catch(() => {});
146
+ }
125
147
  let userModel = getUserPreferredModel();
126
148
  if (userModel && typeof WORK?.get_item === 'function') {
127
149
  const existing = await WORK.get_item(userModel).catch(() => null);
@@ -170,6 +170,11 @@ export default {
170
170
  color: var(--accent-color, #2563eb);
171
171
  font-weight: 600;
172
172
  }
173
+ oda-button[label] {
174
+ padding: 5px 12px;
175
+ gap: 6px;
176
+ border-radius: 6px;
177
+ }
173
178
  .inherited-box {
174
179
  @apply --vertical;
175
180
  gap: 6px;
@@ -246,9 +251,7 @@ export default {
246
251
  <input type="checkbox" :checked="auditEnabled" @change="saveAuditSettings({ enabled: $event.target.checked })">
247
252
  <span>Включён</span>
248
253
  </label>
249
- <oda-button icon="icons:play-arrow" info-invert :disabled="auditRunning" @tap="runAuditNow()">
250
- {{auditRunning ? 'Проверяю…' : 'Запустить аудит сейчас'}}
251
- </oda-button>
254
+ <oda-button icon="av:play-arrow" info-invert :disabled="auditRunning" :label="auditRunning ? 'Проверяю…' : 'Запустить аудит сейчас'" @tap="runAuditNow()"></oda-button>
252
255
  </div>
253
256
  </div>
254
257
  <div class="row">
@@ -274,17 +277,17 @@ export default {
274
277
  </div>
275
278
  <div class="row" style="justify-content:space-between;" ~if="auditLastText || auditResultText">
276
279
  <span class="muted">{{auditResultText || auditLastText}}</span>
277
- <oda-button ~if="auditLastTask" icon="icons:open-in-new" @tap="openAuditTask()">Открыть задачу</oda-button>
280
+ <oda-button ~if="auditLastTask" icon="icons:open-in-new" label="Открыть задачу" @tap="openAuditTask()"></oda-button>
278
281
  </div>
279
282
  </div>
280
283
 
281
284
  <!-- 2. Автоматические реакции на события -->
282
285
  <div class="card">
283
286
  <div class="card-head">
284
- <oda-icon icon="icons:notifications-active" icon-size="20"></oda-icon>
287
+ <oda-icon icon="social:notifications-active" icon-size="20"></oda-icon>
285
288
  <span>Автоматические реакции ({{triggerCards.length}})</span>
286
289
  <div class="row" style="margin-left:auto;">
287
- <oda-button icon="icons:add" @tap="openNewRule()">Добавить</oda-button>
290
+ <oda-button icon="icons:add" label="Добавить" @tap="openNewRule()"></oda-button>
288
291
  </div>
289
292
  </div>
290
293
 
@@ -381,8 +384,8 @@ export default {
381
384
  </div>
382
385
 
383
386
  <div class="row" style="justify-content:flex-end;">
384
- <oda-button icon="icons:check" info-invert :disabled="!canSaveRule" @tap="saveRule()">Сохранить</oda-button>
385
- <oda-button icon="icons:close" @tap="editing = false">Отмена</oda-button>
387
+ <oda-button icon="icons:check" info-invert :disabled="!canSaveRule" label="Сохранить" @tap="saveRule()"></oda-button>
388
+ <oda-button icon="icons:close" label="Отмена" @tap="editing = false"></oda-button>
386
389
  </div>
387
390
  </div>
388
391
 
@@ -396,7 +399,7 @@ export default {
396
399
  <span ~if="$for.item.approval" class="badge">подтверждение</span>
397
400
  <span class="badge" ~class="{ off: !$for.item.enabled }">{{$for.item.enabled ? 'вкл' : 'выкл'}}</span>
398
401
  <div class="row" style="margin-left:auto;">
399
- <oda-button icon="editor:mode-edit" @tap="editRule($for.item.raw)">Изменить</oda-button>
402
+ <oda-button icon="editor:mode-edit" label="Изменить" @tap="editRule($for.item.raw)"></oda-button>
400
403
  <oda-button ~if="$for.item.own" icon="icons:delete" @tap="deleteRule($for.item.name)"></oda-button>
401
404
  </div>
402
405
  </div>
@@ -460,7 +463,7 @@ export default {
460
463
  ::value="schedPrompt" style="min-height:52px;"></textarea>
461
464
 
462
465
  <div class="row" style="justify-content:flex-end;">
463
- <oda-button icon="icons:add" info-invert @tap="addSchedule()">Добавить</oda-button>
466
+ <oda-button icon="icons:add" info-invert label="Добавить" @tap="addSchedule()"></oda-button>
464
467
  </div>
465
468
  </div>
466
469
 
@@ -472,7 +475,7 @@ export default {
472
475
  <span ~if="$for.item.rule?.mask" class="muted" style="font-family:monospace;">{{$for.item.rule.mask}}</span>
473
476
  <span class="badge" ~class="{ off: !$for.item.enabled }">{{$for.item.enabled ? 'активно' : 'пауза'}}</span>
474
477
  <div class="row" style="margin-left:auto;">
475
- <oda-button @tap="toggleSched($for.item)">{{$for.item.enabled ? 'Пауза' : 'Включить'}}</oda-button>
478
+ <oda-button :label="$for.item.enabled ? 'Пауза' : 'Включить'" @tap="toggleSched($for.item)"></oda-button>
476
479
  <oda-button icon="icons:delete" @tap="deleteSched($for.item)"></oda-button>
477
480
  </div>
478
481
  </div>
@@ -12,6 +12,13 @@ export default {
12
12
  background: white;
13
13
  display: block;
14
14
  }
15
+ :host([full-height]) {
16
+ height: 100%;
17
+ }
18
+ :host([full-height]) iframe {
19
+ flex: 1;
20
+ height: 100%;
21
+ }
15
22
  </style>
16
23
  <!-- sandbox: скрипты работают в изолированном источнике без доступа
17
24
  к родителю; топ-навигация и формы запрещены -->
@@ -21,6 +21,17 @@ export default{
21
21
  min-width: 0;
22
22
  @apply --flex;
23
23
  }
24
+ :host([full-height]) {
25
+ width: 100%;
26
+ height: 100%;
27
+ justify-content: center;
28
+ align-items: center;
29
+ overflow: hidden;
30
+ }
31
+ :host([full-height]) img {
32
+ max-width: 100%;
33
+ max-height: 100%;
34
+ }
24
35
  </style>
25
36
  <img @tap="$item.execute()" loading="lazy" :src/>
26
37
  `,
@@ -5,6 +5,12 @@ export default {
5
5
  :host{
6
6
  @apply --vertical;
7
7
  }
8
+ :host([full-height]) {
9
+ height: 100%;
10
+ padding: 8px 14px;
11
+ box-sizing: border-box;
12
+ overflow: auto;
13
+ }
8
14
  oda-markdown-viewer{
9
15
  max-width: 100%;
10
16
  overflow-x: auto;
@@ -18,18 +24,33 @@ export default {
18
24
  })
19
25
  },
20
26
  set $item(n){
21
- if(n){
22
- n.load().then(content=>{
27
+ const seq = (this._mdSeq = (this._mdSeq || 0) + 1);
28
+ if (!n) {
29
+ this.value = '';
30
+ return;
31
+ }
32
+ n.load().then(content=>{
33
+ if (seq !== this._mdSeq) return;
34
+ const apply = text => {
35
+ if (seq !== this._mdSeq) return;
23
36
  const base = n.short || n.path || '';
24
37
  const File = CORE.$file || n.constructor;
25
- let text = content;
38
+ let s = String(text ?? '');
26
39
  if (typeof File.fixWorkMdLinks === 'function')
27
- text = File.fixWorkMdLinks(text, base);
40
+ s = File.fixWorkMdLinks(s, base);
28
41
  if (typeof File.fixMdHistoryLinks === 'function')
29
- text = File.fixMdHistoryLinks(text);
30
- this.value = text;
31
- })
32
- }
42
+ s = File.fixMdHistoryLinks(s);
43
+ this.value = s;
44
+ };
45
+ if (content?.DATA instanceof Blob) {
46
+ content.DATA.text().then(apply);
47
+ } else {
48
+ apply(content);
49
+ }
50
+ }).catch(() => {
51
+ if (seq === this._mdSeq)
52
+ this.value = '';
53
+ });
33
54
  },
34
55
  value: '',
35
56
 
@@ -14,6 +14,12 @@ export default {
14
14
  max-height: 360px;
15
15
  overflow: hidden;
16
16
  }
17
+ :host([full-height]) {
18
+ min-width: 0;
19
+ min-height: 0;
20
+ max-height: none;
21
+ height: 100%;
22
+ }
17
23
  oda-office-editor {
18
24
  flex: 1;
19
25
  min-height: 0;