odant-work 1.0.43 → 1.0.44
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 +22 -22
- package/$server/$folder/$class/$structure/handlers/pages/form/database/$handler/database.js +18 -43
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +21 -26
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +1 -1
- package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +16 -8
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/dock.js +17 -26
- package/$server/$folder/handlers/pages/form/$handler/form.js +199 -129
- package/$server/$folder/lib/explorer/explorer.js +104 -11
- package/$server/$folder/lib/local-models-transfer/local-models-transfer.js +17 -37
- package/$server/$folder/lib/tools/tools.js +24 -6
- package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js +18 -43
- package/oda/components/layouts/app-layout/app-layout.js +4 -1
- package/oda/components/layouts/tabs/tabs.js +784 -395
- package/oda/components/packets/packets.js +25 -20
- package/oda/components/table/row.js +6 -4
- package/oda/components/table/table.js +2 -2
- package/package.json +1 -1
- package/sources/data/progress.md +7 -0
- package/sources/modules/trainer/local-engine.js +38 -16
- package/sources/modules/trainer/worker/local_infer_worker.py +27 -6
|
@@ -41,55 +41,35 @@ export default {
|
|
|
41
41
|
#tools {
|
|
42
42
|
gap: 4px;
|
|
43
43
|
overflow-x: auto;
|
|
44
|
+
align-items: center;
|
|
45
|
+
padding: 2px;
|
|
44
46
|
}
|
|
45
|
-
#tools
|
|
47
|
+
#tools item-node {
|
|
46
48
|
flex-shrink: 0;
|
|
49
|
+
border-radius: 10px;
|
|
50
|
+
padding: 3px 8px;
|
|
51
|
+
min-height: 30px;
|
|
52
|
+
align-items: center;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
opacity: 0.86;
|
|
55
|
+
transition: background-color var(--duration-fast) var(--easing), box-shadow var(--duration-fast) var(--easing), opacity var(--duration-fast) var(--easing);
|
|
47
56
|
}
|
|
48
|
-
#tools
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
#tools item-node:not([light]):hover {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
background: color-mix(in oklch, var(--accent-back) 14%, transparent);
|
|
51
60
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
width: 100%;
|
|
58
|
-
overflow-x: auto;
|
|
59
|
-
overflow-y: hidden;
|
|
60
|
-
scrollbar-width: thin;
|
|
61
|
-
padding: 2px 6px 0 6px;
|
|
62
|
-
box-sizing: border-box;
|
|
61
|
+
#tools item-node[light] {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
padding: 3px 10px;
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
box-shadow: 0 2px 6px var(--shadow-color);
|
|
63
66
|
}
|
|
64
|
-
.form-tabs-bar[hidden],
|
|
65
67
|
#formTabsBar[hidden],
|
|
66
68
|
#formToolbar[hidden],
|
|
67
69
|
#formFooter[hidden],
|
|
68
70
|
[slot="main"][hidden] {
|
|
69
71
|
display: none !important;
|
|
70
72
|
}
|
|
71
|
-
.form-tab {
|
|
72
|
-
@apply --horizontal-center;
|
|
73
|
-
@apply --no-flex;
|
|
74
|
-
@apply --border;
|
|
75
|
-
gap: 6px;
|
|
76
|
-
max-width: 240px;
|
|
77
|
-
padding: 3px 8px;
|
|
78
|
-
border-radius: 8px 8px 0 0;
|
|
79
|
-
font-size: small;
|
|
80
|
-
white-space: nowrap !important;
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
user-select: none;
|
|
83
|
-
box-sizing: border-box;
|
|
84
|
-
}
|
|
85
|
-
.form-tab:hover {
|
|
86
|
-
@apply --hover;
|
|
87
|
-
}
|
|
88
|
-
.form-tab .tab-label {
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
text-overflow: ellipsis;
|
|
91
|
-
white-space: nowrap !important;
|
|
92
|
-
}
|
|
93
73
|
.obj-footer-actions {
|
|
94
74
|
@apply --horizontal-center;
|
|
95
75
|
@apply --no-flex;
|
|
@@ -121,57 +101,47 @@ export default {
|
|
|
121
101
|
}
|
|
122
102
|
}
|
|
123
103
|
ODA({is: 'work-form',
|
|
124
|
-
imports: 'oda//icon, oda//button, oda//app-layout, ~/lib//node-explorer, ~/lib//confirm.js, ~/lib//tree, ~/lib//tools, ~/lib//class-picker',
|
|
104
|
+
imports: 'oda//icon, oda//button, oda//tabs, oda//app-layout, ~/lib//node-explorer, ~/lib//confirm.js, ~/lib//tree, ~/lib//tools, ~/lib//class-picker',
|
|
125
105
|
extends: 'oda-app-layout',
|
|
126
106
|
template: /* html */`
|
|
127
107
|
<style>
|
|
128
|
-
.view-enter {
|
|
129
|
-
animation: view-fade-in 0.5s ease;
|
|
130
|
-
}
|
|
131
|
-
@keyframes view-fade-in {
|
|
132
|
-
from { opacity: 0; }
|
|
133
|
-
to { opacity: 1; }
|
|
134
|
-
}
|
|
135
|
-
.form-tabs-bar {
|
|
136
|
-
@apply --horizontal-center;
|
|
137
|
-
@apply --footer;
|
|
138
|
-
@apply --border-bottom;
|
|
139
|
-
gap: 4px;
|
|
140
|
-
width: 100%;
|
|
141
|
-
overflow-x: auto;
|
|
142
|
-
overflow-y: hidden;
|
|
143
|
-
scrollbar-width: thin;
|
|
144
|
-
padding: 2px 6px 0 6px;
|
|
145
|
-
box-sizing: border-box;
|
|
146
|
-
}
|
|
147
|
-
.form-tabs-bar[hidden],
|
|
148
108
|
#formTabsBar[hidden],
|
|
149
109
|
#formToolbar[hidden],
|
|
150
110
|
#formFooter[hidden],
|
|
151
111
|
[slot="main"][hidden] {
|
|
152
112
|
display: none !important;
|
|
153
113
|
}
|
|
154
|
-
.form-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
114
|
+
.form-tabs-bar oda-button#classTreeToggleBtn {
|
|
115
|
+
border-radius: 9px !important;
|
|
116
|
+
min-width: 30px;
|
|
117
|
+
min-height: 30px;
|
|
118
|
+
transition: background-color var(--duration-fast) var(--easing), box-shadow var(--duration-fast) var(--easing);
|
|
119
|
+
}
|
|
120
|
+
.form-tabs-bar oda-button#classTreeToggleBtn:not([light]):hover {
|
|
121
|
+
background: color-mix(in oklch, var(--accent-back) 14%, transparent);
|
|
122
|
+
}
|
|
123
|
+
.form-tabs-bar oda-button#classTreeToggleBtn[light] {
|
|
124
|
+
box-shadow: 0 2px 6px var(--shadow-color);
|
|
125
|
+
}
|
|
126
|
+
#tools item-node {
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
border-radius: 10px;
|
|
160
129
|
padding: 3px 8px;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
white-space: nowrap !important;
|
|
164
|
-
cursor: pointer;
|
|
165
|
-
user-select: none;
|
|
130
|
+
min-height: 30px;
|
|
131
|
+
align-items: center;
|
|
166
132
|
box-sizing: border-box;
|
|
133
|
+
opacity: 0.86;
|
|
134
|
+
transition: background-color var(--duration-fast) var(--easing), box-shadow var(--duration-fast) var(--easing), opacity var(--duration-fast) var(--easing);
|
|
167
135
|
}
|
|
168
|
-
|
|
169
|
-
|
|
136
|
+
#tools item-node:not([light]):hover {
|
|
137
|
+
opacity: 1;
|
|
138
|
+
background: color-mix(in oklch, var(--accent-back) 14%, transparent);
|
|
170
139
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
140
|
+
#tools item-node[light] {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
padding: 3px 10px;
|
|
143
|
+
font-weight: 700;
|
|
144
|
+
box-shadow: 0 2px 6px var(--shadow-color);
|
|
175
145
|
}
|
|
176
146
|
.obj-footer-actions {
|
|
177
147
|
@apply --horizontal-center;
|
|
@@ -182,19 +152,32 @@ ODA({is: 'work-form',
|
|
|
182
152
|
min-height: 28px;
|
|
183
153
|
padding: 4px 12px;
|
|
184
154
|
gap: 6px;
|
|
185
|
-
font-size:
|
|
155
|
+
font-size: 12.5px;
|
|
186
156
|
font-weight: 500;
|
|
187
|
-
border-radius:
|
|
188
|
-
|
|
157
|
+
border-radius: 8px;
|
|
158
|
+
border: 1px solid var(--subtle-border);
|
|
159
|
+
background: var(--content-background);
|
|
160
|
+
color: var(--content-color);
|
|
161
|
+
box-shadow: var(--elevation-1);
|
|
189
162
|
box-sizing: border-box;
|
|
163
|
+
transition: background-color var(--duration-fast) var(--easing), border-color var(--duration-fast) var(--easing), color var(--duration-fast) var(--easing);
|
|
190
164
|
}
|
|
191
165
|
oda-button.obj-footer-btn:hover:not([disabled]) {
|
|
166
|
+
background: var(--accent-soft);
|
|
192
167
|
border-color: var(--accent-color);
|
|
168
|
+
color: var(--accent-color);
|
|
193
169
|
}
|
|
194
170
|
oda-button.obj-footer-btn.primary {
|
|
195
171
|
font-weight: 700;
|
|
196
172
|
min-width: 72px;
|
|
197
173
|
}
|
|
174
|
+
.view-enter {
|
|
175
|
+
animation: view-fade-in 0.5s ease;
|
|
176
|
+
}
|
|
177
|
+
@keyframes view-fade-in {
|
|
178
|
+
from { opacity: 0; }
|
|
179
|
+
to { opacity: 1; }
|
|
180
|
+
}
|
|
198
181
|
</style>
|
|
199
182
|
<div id="formHeader" ~show="!fullScreen" accent-invert slot="header" shadow horizontal flex style="padding: 2px; gap: 4px; align-items: center;">
|
|
200
183
|
<div center flex horizontal style="overflow: hidden; flex-wrap: balance; gap: 4px; margin: 4px;">
|
|
@@ -234,15 +217,13 @@ ODA({is: 'work-form',
|
|
|
234
217
|
></oda-button>
|
|
235
218
|
|
|
236
219
|
</div>
|
|
237
|
-
<div id="tools"
|
|
220
|
+
<div id="tools" no-flex horizontal style="min-height: 32px; align-items: center; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; border-bottom: 2px solid color-mix(in oklch, var(--accent-back) 65%, transparent);">
|
|
238
221
|
<item-node
|
|
239
222
|
~for="visibleFormViews"
|
|
240
223
|
:$item="$for.item"
|
|
241
224
|
:hide-label="view?.id !== $for.item.id"
|
|
242
225
|
:icon-size
|
|
243
|
-
:
|
|
244
|
-
:raised="view?.id === $for.item.id"
|
|
245
|
-
~style="{ opacity: view?.id === $for.item.id ? 1 : 0.9, borderRadius: '4px' }"
|
|
226
|
+
:light="view?.id === $for.item.id"
|
|
246
227
|
@tap.stop="switchView($for.item, $event)"
|
|
247
228
|
@pointerdown.stop="view?.id === $for.item.id && openView($event)"
|
|
248
229
|
>
|
|
@@ -255,25 +236,24 @@ ODA({is: 'work-form',
|
|
|
255
236
|
<oda-button @tap="toggleFullscreen" ~if="currentItem?.type === '$file'" :icon-size content icon="icons:fullscreen" style="border-radius: 50%;"></oda-button>
|
|
256
237
|
<oda-button @tap="close" error :icon-size content-invert icon="icons:close" style="border-radius: 50%; margin: 4px; align-self: flex-start;"></oda-button>
|
|
257
238
|
</div>
|
|
258
|
-
<div id="formTabsBar" slot="top" class="form-tabs-bar"
|
|
259
|
-
<oda-button id="classTreeToggleBtn" ~if="hasClassTree" no-flex allow-toggle
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
<oda-button class="tabs-close-all" no-flex ~if="formTabs?.length > 1" icon="icons:close" :icon-size="16" title="Закрыть все дополнительные вкладки" @tap.stop="closeAllTabs($event)"></oda-button>
|
|
239
|
+
<div id="formTabsBar" slot="top" class="form-tabs-bar" accent-invert horizontal-center no-flex :hidden="!showTabsBar" ~show="showTabsBar" style="width: 100%; padding: 0 4px 0 8px; gap: 6px; box-sizing: border-box; min-height: 38px;">
|
|
240
|
+
<oda-button id="classTreeToggleBtn" ~if="hasClassTree" no-flex allow-toggle
|
|
241
|
+
:light="!classTreeClosed"
|
|
242
|
+
icon="icons:tree-structure" :icon-size="18"
|
|
243
|
+
:title="classTreeClosed ? 'Показать дерево классов' : 'Скрыть дерево классов'"
|
|
244
|
+
@tap.stop="toggleClassTree($event)"
|
|
245
|
+
style="border-radius: 9px; min-width: 30px; min-height: 30px;"></oda-button>
|
|
246
|
+
<oda-tabs flex variant="rail" allow-close allow-drag
|
|
247
|
+
:items="formTabItems" :focused-index="formFocusedTabIndex"
|
|
248
|
+
@tab-select="onFormTabSelect($event)"
|
|
249
|
+
@tab-close="onFormTabClose($event)"
|
|
250
|
+
@close-others="onFormCloseOthers($event)"
|
|
251
|
+
@close-right="onFormCloseRight($event)"
|
|
252
|
+
@close-all="closeAllTabs($event)"
|
|
253
|
+
@reorder="onFormTabsReorder($event)"
|
|
254
|
+
style="min-width: 0; padding-left: 0; padding-right: 4px;"></oda-tabs>
|
|
275
255
|
</div>
|
|
276
|
-
<div id="formToolbar" slot="main-top" :hidden="!hasToolbar" ~show="hasToolbar"
|
|
256
|
+
<div id="formToolbar" slot="main-top" :hidden="!hasToolbar" ~show="hasToolbar" horizontal-center no-flex style="background: var(--subtle-background); color: var(--content-color); border-bottom: 1px solid var(--subtle-border); padding: 5px 10px; gap: 8px; min-height: 38px; box-sizing: border-box;">
|
|
277
257
|
<div class="toolbar-zone left" horizontal-center no-flex style="gap: 6px;">
|
|
278
258
|
<item-tools id="topMainTools" :$item="currentItem" :state-version="focusedStateVersion" filter="button" ::tool-items="topMainToolItems" @tools-changed="onToolsListChanged('topMainToolItems', $event)" show-labels></item-tools>
|
|
279
259
|
<item-tools id="topFocusedTools" focused-only :target-item="focusedItem" :fallback-item="fallbackFocusedItem" :$item="focusedItem" :state-version="focusedStateVersion" filter="button" ::tool-items="topFocusedToolItems" @tools-changed="onToolsListChanged('topFocusedToolItems', $event)" show-labels></item-tools>
|
|
@@ -1120,6 +1100,119 @@ ODA({is: 'work-form',
|
|
|
1120
1100
|
_mountSeq: 0,
|
|
1121
1101
|
formTabs: [],
|
|
1122
1102
|
activeTabKey: '',
|
|
1103
|
+
get formTabItems() {
|
|
1104
|
+
void this.focusedStateVersion;
|
|
1105
|
+
const list = Array.isArray(this.formTabs) ? this.formTabs : [];
|
|
1106
|
+
return list.map((t, idx) => {
|
|
1107
|
+
const ctrl = t.control || this.controls[`${t.key}::${t.viewId}`];
|
|
1108
|
+
const isActive = t.key === this.activeTabKey;
|
|
1109
|
+
const isDirty = isActive
|
|
1110
|
+
? Boolean(this.allowSave && this.isViewChanged)
|
|
1111
|
+
: Boolean(ctrl && typeof ctrl.isDirty === 'function' && ctrl.isDirty());
|
|
1112
|
+
return {
|
|
1113
|
+
key: t.key,
|
|
1114
|
+
label: t.label,
|
|
1115
|
+
title: t.label,
|
|
1116
|
+
icon: t.icon || 'icons:dashboard',
|
|
1117
|
+
closable: list.length > 1 && t.closable !== false,
|
|
1118
|
+
dirty: isDirty,
|
|
1119
|
+
_index: idx,
|
|
1120
|
+
};
|
|
1121
|
+
});
|
|
1122
|
+
},
|
|
1123
|
+
get formFocusedTabIndex() {
|
|
1124
|
+
const list = Array.isArray(this.formTabs) ? this.formTabs : [];
|
|
1125
|
+
return list.findIndex(t => t.key === this.activeTabKey);
|
|
1126
|
+
},
|
|
1127
|
+
_notifyParentDirty() {
|
|
1128
|
+
if (typeof window === 'undefined' || window.parent === window)
|
|
1129
|
+
return;
|
|
1130
|
+
try {
|
|
1131
|
+
const anyDirty = this.formTabItems.some(t => t.dirty) || Boolean(this.allowSave && this.isViewChanged);
|
|
1132
|
+
window.parent.postMessage({
|
|
1133
|
+
type: 'work:form-dirty',
|
|
1134
|
+
url: window.location.href,
|
|
1135
|
+
dirty: anyDirty,
|
|
1136
|
+
}, window.location.origin);
|
|
1137
|
+
}
|
|
1138
|
+
catch { /* ignore */ }
|
|
1139
|
+
},
|
|
1140
|
+
onFormTabSelect(e) {
|
|
1141
|
+
const idx = e?.detail?.index;
|
|
1142
|
+
const tab = Number.isInteger(idx) ? this.formTabs?.[idx] : null;
|
|
1143
|
+
if (tab)
|
|
1144
|
+
this.activateTab(tab);
|
|
1145
|
+
},
|
|
1146
|
+
onFormTabClose(e) {
|
|
1147
|
+
e?.preventDefault?.();
|
|
1148
|
+
const idx = e?.detail?.index;
|
|
1149
|
+
const tab = Number.isInteger(idx) ? this.formTabs?.[idx] : null;
|
|
1150
|
+
if (tab)
|
|
1151
|
+
this.closeTab(tab, e);
|
|
1152
|
+
},
|
|
1153
|
+
onFormTabsReorder(e) {
|
|
1154
|
+
const nextItems = e?.detail?.items;
|
|
1155
|
+
if (!Array.isArray(nextItems))
|
|
1156
|
+
return;
|
|
1157
|
+
const byKey = new Map((this.formTabs || []).map(t => [t.key, t]));
|
|
1158
|
+
const reordered = nextItems.map(it => byKey.get(it?.key)).filter(Boolean);
|
|
1159
|
+
if (reordered.length === (this.formTabs || []).length)
|
|
1160
|
+
this.formTabs = reordered;
|
|
1161
|
+
},
|
|
1162
|
+
async _closeTabSubset(pred) {
|
|
1163
|
+
const list = Array.isArray(this.formTabs) ? [...this.formTabs] : [];
|
|
1164
|
+
const targets = [];
|
|
1165
|
+
for (let i = 0; i < list.length; i++) {
|
|
1166
|
+
const t = list[i];
|
|
1167
|
+
if (t.closable === false)
|
|
1168
|
+
continue;
|
|
1169
|
+
if (pred(t, i))
|
|
1170
|
+
targets.push(t);
|
|
1171
|
+
}
|
|
1172
|
+
if (!targets.length)
|
|
1173
|
+
return;
|
|
1174
|
+
for (const t of targets) {
|
|
1175
|
+
const ctrl = t.control || this.controls[`${t.key}::${t.viewId}`];
|
|
1176
|
+
if (ctrl && typeof ctrl.isDirty === 'function' && ctrl.isDirty()) {
|
|
1177
|
+
if (typeof ctrl.confirmClose === 'function') {
|
|
1178
|
+
const canClose = await ctrl.confirmClose();
|
|
1179
|
+
if (!canClose)
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
const removeKeys = new Set(targets.map(t => t.key));
|
|
1185
|
+
for (const t of targets) {
|
|
1186
|
+
for (const k of Object.keys(this.controls)) {
|
|
1187
|
+
if (k === t.key || k.startsWith(t.key + '::')) {
|
|
1188
|
+
const c = this.controls[k];
|
|
1189
|
+
if (c && this.contains(c))
|
|
1190
|
+
this.removeChild(c);
|
|
1191
|
+
delete this.controls[k];
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
const remaining = list.filter(t => !removeKeys.has(t.key));
|
|
1196
|
+
if (!remaining.length)
|
|
1197
|
+
return;
|
|
1198
|
+
this.formTabs = remaining;
|
|
1199
|
+
if (!remaining.some(t => t.key === this.activeTabKey)) {
|
|
1200
|
+
await this.activateTab(remaining[remaining.length - 1]);
|
|
1201
|
+
}
|
|
1202
|
+
this._notifyParentDirty();
|
|
1203
|
+
},
|
|
1204
|
+
async onFormCloseOthers(e) {
|
|
1205
|
+
e?.preventDefault?.();
|
|
1206
|
+
const keepKey = e?.detail?.item?.key || this.formTabs?.[e?.detail?.index]?.key;
|
|
1207
|
+
if (keepKey)
|
|
1208
|
+
await this._closeTabSubset(t => t.key !== keepKey);
|
|
1209
|
+
},
|
|
1210
|
+
async onFormCloseRight(e) {
|
|
1211
|
+
e?.preventDefault?.();
|
|
1212
|
+
const idx = e?.detail?.index;
|
|
1213
|
+
if (Number.isInteger(idx) && idx >= 0)
|
|
1214
|
+
await this._closeTabSubset((_, i) => i > idx);
|
|
1215
|
+
},
|
|
1123
1216
|
_newObjSeq: 0,
|
|
1124
1217
|
topMainToolItems: [],
|
|
1125
1218
|
topFocusedToolItems: [],
|
|
@@ -1205,6 +1298,7 @@ ODA({is: 'work-form',
|
|
|
1205
1298
|
}
|
|
1206
1299
|
}
|
|
1207
1300
|
this.async(() => this._wakeBars(), 10);
|
|
1301
|
+
this._notifyParentDirty();
|
|
1208
1302
|
},
|
|
1209
1303
|
get $focusedItem() {
|
|
1210
1304
|
return this.focusedItem;
|
|
@@ -1547,37 +1641,12 @@ ODA({is: 'work-form',
|
|
|
1547
1641
|
const nextTab = list[Math.max(0, idx - 1)];
|
|
1548
1642
|
await this.activateTab(nextTab);
|
|
1549
1643
|
}
|
|
1644
|
+
this._notifyParentDirty();
|
|
1550
1645
|
},
|
|
1551
1646
|
async closeAllTabs(e) {
|
|
1647
|
+
e?.preventDefault?.();
|
|
1552
1648
|
e?.stopPropagation?.();
|
|
1553
|
-
|
|
1554
|
-
if (list.length <= 1)
|
|
1555
|
-
return;
|
|
1556
|
-
for (let i = list.length - 1; i >= 1; i--) {
|
|
1557
|
-
const t = list[i];
|
|
1558
|
-
const ctrl = t.control || this.controls[`${t.key}::${t.viewId}`];
|
|
1559
|
-
if (ctrl && typeof ctrl.isDirty === 'function' && ctrl.isDirty()) {
|
|
1560
|
-
if (typeof ctrl.confirmClose === 'function') {
|
|
1561
|
-
const canClose = await ctrl.confirmClose();
|
|
1562
|
-
if (!canClose)
|
|
1563
|
-
return;
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
for (let i = list.length - 1; i >= 1; i--) {
|
|
1568
|
-
const t = list[i];
|
|
1569
|
-
for (const k of Object.keys(this.controls)) {
|
|
1570
|
-
if (k === t.key || k.startsWith(t.key + '::')) {
|
|
1571
|
-
const c = this.controls[k];
|
|
1572
|
-
if (c && this.contains(c))
|
|
1573
|
-
this.removeChild(c);
|
|
1574
|
-
delete this.controls[k];
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
const rootTab = list[0];
|
|
1579
|
-
this.formTabs = [rootTab];
|
|
1580
|
-
await this.activateTab(rootTab);
|
|
1649
|
+
await this._closeTabSubset(() => true);
|
|
1581
1650
|
},
|
|
1582
1651
|
async closeActiveTab(reloadPrevious = false) {
|
|
1583
1652
|
const list = Array.isArray(this.formTabs) ? [...this.formTabs] : [];
|
|
@@ -1602,6 +1671,7 @@ ODA({is: 'work-form',
|
|
|
1602
1671
|
await nextTab.control.reload();
|
|
1603
1672
|
}
|
|
1604
1673
|
}
|
|
1674
|
+
this._notifyParentDirty();
|
|
1605
1675
|
},
|
|
1606
1676
|
async reloadSiblingLists() {
|
|
1607
1677
|
const list = Array.isArray(this.formTabs) ? this.formTabs : [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
icon: 'odant:structure',
|
|
3
|
-
imports: 'oda//app-layout.js, oda//icon, oda//button, ~/lib//tree.js, ~/lib//node-explorer.js, ~/lib//consultant.js, ~/lib//class-picker.js',
|
|
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
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>
|
|
@@ -13,16 +13,17 @@ export default {
|
|
|
13
13
|
<iframe ~show="focusedPage === $for.item" style="border: none;" flex ~for="pages" :src="$for.item"></iframe>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
<oda-tabs id="bookmarksBar" slot="footer" class="pe-no-print" variant="rail" allow-close allow-drag
|
|
17
|
+
:hidden="!hasBookmarks" ~show="hasBookmarks"
|
|
18
|
+
:items="bookmarkTabItems" :focused-index="bookmarkFocusedIndex"
|
|
19
|
+
@tab-select="onBookmarkSelect($event)"
|
|
20
|
+
@tab-close="onBookmarkClose($event)"
|
|
21
|
+
@close-others="onBookmarkCloseOthers($event)"
|
|
22
|
+
@close-right="onBookmarkCloseRight($event)"
|
|
23
|
+
@close-all="closeAllBookmarks($event)"
|
|
24
|
+
@reorder="onBookmarksReorder($event)"
|
|
25
|
+
style="z-index: 2;">
|
|
26
|
+
</oda-tabs>
|
|
26
27
|
`,
|
|
27
28
|
visibleMode: 'main',
|
|
28
29
|
showSize: false,
|
|
@@ -32,6 +33,18 @@ export default {
|
|
|
32
33
|
get hasBookmarks() {
|
|
33
34
|
return !this.mobile && Array.isArray(this.bookmarks) && this.bookmarks.length > 0 && this.visibleMode === 'main';
|
|
34
35
|
},
|
|
36
|
+
get bookmarkTabItems() {
|
|
37
|
+
return (this.bookmarks || []).map(b => ({
|
|
38
|
+
...b,
|
|
39
|
+
closable: true,
|
|
40
|
+
dirty: Boolean(b.dirty),
|
|
41
|
+
}));
|
|
42
|
+
},
|
|
43
|
+
get bookmarkFocusedIndex() {
|
|
44
|
+
if (this.visibleMode !== 'main' || !this.focusedPage)
|
|
45
|
+
return -1;
|
|
46
|
+
return (this.bookmarks || []).findIndex(b => b.url === this.focusedPage);
|
|
47
|
+
},
|
|
35
48
|
isActiveBookmark(bm) {
|
|
36
49
|
return Boolean(bm && this.focusedPage === bm.url && this.visibleMode === 'main');
|
|
37
50
|
},
|
|
@@ -433,6 +446,67 @@ export default {
|
|
|
433
446
|
await matchedTree.revealPath(clean);
|
|
434
447
|
}
|
|
435
448
|
},
|
|
449
|
+
onBookmarkSelect(e) {
|
|
450
|
+
const idx = e?.detail?.index;
|
|
451
|
+
const bm = Number.isInteger(idx) ? this.bookmarks?.[idx] : e?.detail?.item;
|
|
452
|
+
if (bm)
|
|
453
|
+
this.activateBookmark(bm);
|
|
454
|
+
},
|
|
455
|
+
onBookmarkClose(e) {
|
|
456
|
+
e?.preventDefault?.();
|
|
457
|
+
const idx = e?.detail?.index;
|
|
458
|
+
const bm = Number.isInteger(idx) ? this.bookmarks?.[idx] : e?.detail?.item;
|
|
459
|
+
if (bm)
|
|
460
|
+
this.closeBookmark(bm, e);
|
|
461
|
+
},
|
|
462
|
+
onBookmarkCloseOthers(e) {
|
|
463
|
+
e?.preventDefault?.();
|
|
464
|
+
const keepUrl = e?.detail?.item?.url || this.bookmarks?.[e?.detail?.index]?.url;
|
|
465
|
+
if (!keepUrl)
|
|
466
|
+
return;
|
|
467
|
+
const keepBm = (this.bookmarks || []).find(b => b.url === keepUrl);
|
|
468
|
+
if (!keepBm)
|
|
469
|
+
return;
|
|
470
|
+
for (const b of this.bookmarks || []) {
|
|
471
|
+
if (b.url !== keepUrl)
|
|
472
|
+
this.pages.remove(b.url);
|
|
473
|
+
}
|
|
474
|
+
this.bookmarks = [keepBm];
|
|
475
|
+
if (this.focusedPage !== keepUrl)
|
|
476
|
+
this.activateBookmark(keepBm);
|
|
477
|
+
else
|
|
478
|
+
this._saveBookmarksState();
|
|
479
|
+
},
|
|
480
|
+
onBookmarkCloseRight(e) {
|
|
481
|
+
e?.preventDefault?.();
|
|
482
|
+
const idx = e?.detail?.index;
|
|
483
|
+
if (!Number.isInteger(idx) || idx < 0)
|
|
484
|
+
return;
|
|
485
|
+
const list = [...(this.bookmarks || [])];
|
|
486
|
+
const removed = list.splice(idx + 1);
|
|
487
|
+
for (const b of removed)
|
|
488
|
+
this.pages.remove(b.url);
|
|
489
|
+
this.bookmarks = list;
|
|
490
|
+
if (removed.some(b => b.url === this.focusedPage)) {
|
|
491
|
+
const next = list.at(-1);
|
|
492
|
+
if (next)
|
|
493
|
+
this.activateBookmark(next);
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
this._saveBookmarksState();
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
onBookmarksReorder(e) {
|
|
500
|
+
const nextItems = e?.detail?.items;
|
|
501
|
+
if (!Array.isArray(nextItems))
|
|
502
|
+
return;
|
|
503
|
+
const byUrl = new Map((this.bookmarks || []).map(b => [b.url, b]));
|
|
504
|
+
const reordered = nextItems.map(it => byUrl.get(it?.url)).filter(Boolean);
|
|
505
|
+
if (reordered.length === (this.bookmarks || []).length) {
|
|
506
|
+
this.bookmarks = reordered;
|
|
507
|
+
this._saveBookmarksState();
|
|
508
|
+
}
|
|
509
|
+
},
|
|
436
510
|
activateBookmark(bm) {
|
|
437
511
|
if (!bm?.url)
|
|
438
512
|
return;
|
|
@@ -473,6 +547,7 @@ export default {
|
|
|
473
547
|
}
|
|
474
548
|
},
|
|
475
549
|
closeAllBookmarks(e) {
|
|
550
|
+
e?.preventDefault?.();
|
|
476
551
|
e?.stopPropagation?.();
|
|
477
552
|
this.pages.splice(0, this.pages.length);
|
|
478
553
|
this.bookmarks = [];
|
|
@@ -540,6 +615,24 @@ export default {
|
|
|
540
615
|
}
|
|
541
616
|
})
|
|
542
617
|
window.explorer = this;
|
|
618
|
+
if (!this._dirtyMsgBound && typeof window !== 'undefined') {
|
|
619
|
+
this._dirtyMsgBound = true;
|
|
620
|
+
window.addEventListener('message', (ev) => {
|
|
621
|
+
if (ev.origin !== window.location.origin)
|
|
622
|
+
return;
|
|
623
|
+
const d = ev.data;
|
|
624
|
+
if (d?.type !== 'work:form-dirty' || !d.url)
|
|
625
|
+
return;
|
|
626
|
+
const norm = (u) => { try { return decodeURI(String(u)); } catch { return String(u); } };
|
|
627
|
+
const targetUrl = norm(d.url);
|
|
628
|
+
const list = this.bookmarks || [];
|
|
629
|
+
const bm = list.find(b => b.url === d.url || norm(b.url) === targetUrl);
|
|
630
|
+
if (bm && Boolean(bm.dirty) !== Boolean(d.dirty)) {
|
|
631
|
+
bm.dirty = Boolean(d.dirty);
|
|
632
|
+
this.bookmarks = [...list];
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
}
|
|
543
636
|
this._refreshLeftButtons();
|
|
544
637
|
this._initTopLicenseBanner();
|
|
545
638
|
WORK.authEvents?.addEventListener('auth', () => {
|
|
@@ -25,32 +25,6 @@ const TRANSFER_STYLE = /*css*/`
|
|
|
25
25
|
.between {
|
|
26
26
|
justify-content: space-between;
|
|
27
27
|
}
|
|
28
|
-
.tabs {
|
|
29
|
-
display: flex;
|
|
30
|
-
gap: 4px;
|
|
31
|
-
border-bottom: 1px solid var(--border-color, #cbd5e1);
|
|
32
|
-
}
|
|
33
|
-
.tab-btn {
|
|
34
|
-
appearance: none;
|
|
35
|
-
border: none;
|
|
36
|
-
border-bottom: 2px solid transparent;
|
|
37
|
-
background: transparent;
|
|
38
|
-
color: inherit;
|
|
39
|
-
opacity: 0.72;
|
|
40
|
-
padding: 7px 14px;
|
|
41
|
-
font-size: 13px;
|
|
42
|
-
font-weight: 600;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
display: inline-flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
gap: 6px;
|
|
47
|
-
}
|
|
48
|
-
.tab-btn:hover { opacity: 1; }
|
|
49
|
-
.tab-btn.active {
|
|
50
|
-
opacity: 1;
|
|
51
|
-
color: var(--accent-color, #2563eb);
|
|
52
|
-
border-bottom-color: var(--accent-color, #2563eb);
|
|
53
|
-
}
|
|
54
28
|
.pill {
|
|
55
29
|
appearance: none;
|
|
56
30
|
display: inline-flex;
|
|
@@ -253,7 +227,7 @@ function fmtEta(sec) {
|
|
|
253
227
|
|
|
254
228
|
ODA({
|
|
255
229
|
is: 'item-local-models-transfer',
|
|
256
|
-
imports: 'oda//icon',
|
|
230
|
+
imports: 'oda//icon, oda//tabs',
|
|
257
231
|
template: /*html*/`
|
|
258
232
|
<style>${TRANSFER_STYLE}</style>
|
|
259
233
|
|
|
@@ -298,16 +272,7 @@ ODA({
|
|
|
298
272
|
|
|
299
273
|
<!-- Вкладки Выгрузка / Загрузка -->
|
|
300
274
|
<div class="row between">
|
|
301
|
-
<
|
|
302
|
-
<button type="button" class="tab-btn" ~class="{'active': mode === 'export'}" @tap="switchMode('export')">
|
|
303
|
-
<oda-icon icon="carbon:upload" icon-size="16"></oda-icon>
|
|
304
|
-
<span>Выгрузить (Бэкап)</span>
|
|
305
|
-
</button>
|
|
306
|
-
<button type="button" class="tab-btn" ~class="{'active': mode === 'import'}" @tap="switchMode('import')">
|
|
307
|
-
<oda-icon icon="carbon:download" icon-size="16"></oda-icon>
|
|
308
|
-
<span>Загрузить (Восстановить)</span>
|
|
309
|
-
</button>
|
|
310
|
-
</div>
|
|
275
|
+
<oda-tabs variant="pills" :allow-list="false" :items="transferTabItems" :focused-index="transferTabIndex" @tab-select="onTransferTabSelect($event)"></oda-tabs>
|
|
311
276
|
<div class="row">
|
|
312
277
|
<button type="button" class="pill" ~class="{'active': transport === 'disk'}" @tap="transport = 'disk'">
|
|
313
278
|
<oda-icon icon="carbon:usb" icon-size="14"></oda-icon>
|
|
@@ -565,6 +530,21 @@ ODA({
|
|
|
565
530
|
|
|
566
531
|
$item: null,
|
|
567
532
|
mode: 'export',
|
|
533
|
+
get transferTabItems() {
|
|
534
|
+
return [
|
|
535
|
+
{ id: 'export', label: 'Выгрузить (Бэкап)', icon: 'carbon:upload' },
|
|
536
|
+
{ id: 'import', label: 'Загрузить (Восстановить)', icon: 'carbon:download' },
|
|
537
|
+
];
|
|
538
|
+
},
|
|
539
|
+
get transferTabIndex() {
|
|
540
|
+
const idx = this.transferTabItems.findIndex(t => t.id === this.mode);
|
|
541
|
+
return idx >= 0 ? idx : 0;
|
|
542
|
+
},
|
|
543
|
+
onTransferTabSelect(e) {
|
|
544
|
+
const id = e?.detail?.item?.id;
|
|
545
|
+
if (id)
|
|
546
|
+
this.switchMode(id);
|
|
547
|
+
},
|
|
568
548
|
transport: 'disk',
|
|
569
549
|
roots: [],
|
|
570
550
|
dirInfo: null,
|