odant-work 1.0.36 → 1.0.37

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "packageName": "odant-work",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "createdAt": 1794658837090,
5
- "updatedAt": 1794908817545,
5
+ "updatedAt": 1794911721125,
6
6
  "files": {
7
7
  "run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
8
- "package.json": "3e282b562d7d705c8b6d245f6e857c0f20d44cdd085674a7759ce33f8f8e7d99",
9
- "package-lock.json": "df0e81fcd439ada7ea2862d7d3f25a9d3d8bb5ae2a4e53471eab5523cdf4ee16",
8
+ "package.json": "87334f6e97427f70d531031d6e4d676b6f9f69adca3370182a1c57008087d910",
9
+ "package-lock.json": "5b4215124067c229d284e23f2f9200e4604a76adb042c03be25660a4161e2ea3",
10
10
  "sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
11
11
  "sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
12
12
  "sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
@@ -26,7 +26,7 @@
26
26
  "sources/data/objects.js": "23f51d5b00cd766fe27879b874738bc9bd9056bd6e27285fb7a52926c0dbc6a8",
27
27
  "sources/data/posting.js": "6595bb9ec632539ae7629504db327d25a491e61c1cdc598bb43d08ea0d45548d",
28
28
  "sources/data/print.js": "704f0f2fc80c6466a4196e4650d763150cf9b592eab14ea67ece85d51100107c",
29
- "sources/data/progress.md": "d926bc075ec47b6fa12f11679e8277be479fd8f55335fec532299825638f6780",
29
+ "sources/data/progress.md": "7d51ae4d341c16a192cf02fd4be7de67841954509d4d2ef9b0fabd5ba647264b",
30
30
  "sources/data/readme.md": "593fa2ae07aa91bc26d7542275da6953a9cd419240a9a49e00cb62fb9d5d8e36",
31
31
  "sources/data/reports.js": "0330f404860fe2589a7d46a2f0fe690ca23249bd841a062a26718742d4fd11d6",
32
32
  "sources/data/schema.js": "1c994f9adb76c156dc86601dd6b1046376b66549b041e1a58aa1727b5476bdbe",
@@ -238,7 +238,7 @@
238
238
  "oda/components/containers/containers.js": "d06f477bae0eb3458d293ada70d202e532841c9917974cdca0384d79bfd7b40c",
239
239
  "oda/components/containers/index.html": "a8f49a46c1d943964398d435de76dffb9fc5672c4ee9fe0ca87ae759e65662e8",
240
240
  "oda/components/containers/popover/index.html": "6f98e4f79bdcaf4022fb23cc203e472d9f2ad69f781781be4d239cda9c4cb0c6",
241
- "oda/components/containers/popover/popover.js": "0d4454ea0efdec502342bce1158a023860442c840df0a1e1e0286dd2cb532c17",
241
+ "oda/components/containers/popover/popover.js": "db26f38e4d5f6c4fdd207e08b0ed4c6ad21d3313ceb56b6b6fda52f3216df5aa",
242
242
  "oda/components/containers/popover/readme.md": "5f6103e60d876359708fff5137fa58aa218bcd3866dd7a747809dbe4a536a3fe",
243
243
  "oda/components/containers/readme.md": "278966b92475282e63529e5d3d14b65cfa9b727ab9b66fb79bd524c20dce1a8c",
244
244
  "oda/components/editors/code-editor/code-editor.js": "8dda974df151d7014d0d4bc8338823722a41627cc3bc9cc0d218331b4bf947f6",
@@ -475,10 +475,10 @@
475
475
  "oda/core/directives.js": "13fdfbbf7bd33114a3dda3bfaae5bf725d4a8ab7fffa5597dbb37ab555ea1c1c",
476
476
  "oda/core/events.js": "794181ebfe875f46719ce4aef403feb71d6a98d3960aa4bbef7af95bfc44a9db",
477
477
  "oda/core/observers.js": "7ac36549051d31729756202fddebe63507f0590ffa58630faeba7f19a0d7df1b",
478
- "oda/core/shared.js": "13e2dd22bb07df48262a217346c4f6ea27e4bcd8431edacf6ebf92ff5d951060",
478
+ "oda/core/shared.js": "3976274c992bffd5651c427343d8954cf333654575c501fc6e98189d5d6e745a",
479
479
  "oda/core/vnode.js": "c2e44cbfd27547aa5baa11c596f58d7f6bd797fa51a7f055e099f025ccad5bc2",
480
480
  "oda/index.html": "ad9d92cdf93e3a8b41652865b6485412dcd445c8a47a6ab1dbf83974a6e2c7fe",
481
- "oda/oda.js": "78ae64b7ba165c04b73725326d8294f4b0ccb3e14755050c791a039917b73b96",
481
+ "oda/oda.js": "b1bc570f7207320ffa32886f04c953cfb94b65b90b6162f38cbcaa6ac0b42859",
482
482
  "oda/progress.md": "d44fc1fce43b6b65d58628a20278716b5a17cbff690d12f913093ab03a9e341f",
483
483
  "oda/readme.md": "314ee10ac3e607c5aed907d930666039d3c26b2ed8c2c24cce8ce22479b7a33a",
484
484
  "oda/tools/icons/icon.png": "9b296cb2930479832642ee5f1b06b6ef73b887b0031ffbac36012dfa25431890",
@@ -804,7 +804,7 @@
804
804
  "$server/$folder/lib/prompt-bar/beep-end.mp3": "617bd6134765d0ac9ef807bfba9096a812a7ca4c10ed270b1972586e7ff7be4d",
805
805
  "$server/$folder/lib/prompt-bar/beep-start.mp3": "24004a82dd5274b852de766ef2b2ac035ca2d6b2aefc72086800968b4a98e77d",
806
806
  "$server/$folder/lib/prompt-bar/progress.md": "c2ef67ebaae6f7211007a37563319856bf27c57b9ea68cabfb08f4bc0a53e6d2",
807
- "$server/$folder/lib/prompt-bar/prompt-bar.js": "780de443261aa0ac7ba2994486c64a5f9245b3a4c7e988bbec6dfb4f774a2e61",
807
+ "$server/$folder/lib/prompt-bar/prompt-bar.js": "73a0642f93f039907f7acfbbf8530889deaedb3eca143991e1734a598a931fc7",
808
808
  "$server/$folder/lib/prompt-bar/readme.md": "add5e4608da3a2efe446efec383a2ba5d017eb63635296976760c15dd6d43bec",
809
809
  "$server/$folder/lib/readme.md": "dec19f4353a3fe9381bcfd6b1759273eb85dd542b2536f34655bc18916900f47",
810
810
  "$server/$folder/lib/role/role.js": "3345f8fedf28703f2a4a7138f696fbd86b15837038a91728d0b12d84ae43492f",
@@ -422,7 +422,7 @@ ODA({ is: 'work-prompt-bar',
422
422
  </button>
423
423
  <item-user ~for="receivers" border no-flex :$item="$for.item" :icon-size="22" title="Снять получателя" @tap.stop="toggleReceiver($for.item)"></item-user>
424
424
  <div flex></div>
425
- <button class="pill" ~if="ai" :title="modelTitle" @pointerdown.stop="selectModel($event)">
425
+ <button class="pill" id="model-pill" ~if="ai" :title="modelTitle" @tap.stop="selectModel($event)">
426
426
  <oda-icon :icon="modelIcon" :icon-size="16"></oda-icon><span>{{modelName}}</span><oda-icon icon="carbon:chevron-down" :icon-size="12"></oda-icon>
427
427
  </button>
428
428
  <span class="timer" ~if="recording">⏺ {{timer}}</span>
@@ -822,9 +822,10 @@ ODA({ is: 'work-prompt-bar',
822
822
  this.fire('send');
823
823
  },
824
824
  async _menu(e, options, value) {
825
+ const anchor = e?.currentTarget || (e?.nodeType === 1 ? e : null) || e?.target || this;
825
826
  const el = ODA.createComponent('work-prompt-menu', { options, value });
826
827
  try {
827
- return await WORK.showDropdown(el, {}, e.currentTarget || e.target);
828
+ return await WORK.showDropdown(el, { placement: 'top' }, anchor);
828
829
  }
829
830
  catch (err) {
830
831
  if (err instanceof WORK.CancelError)
@@ -892,7 +893,7 @@ ODA({ is: 'work-prompt-bar',
892
893
  },
893
894
  });
894
895
  try {
895
- await WORK.showDropdown(el, { TITLE: { label: 'Получатели подразделения' } }, anchor);
896
+ await WORK.showDropdown(el, { TITLE: { label: 'Получатели подразделения' }, placement: 'top' }, anchor);
896
897
  }
897
898
  catch (err) {
898
899
  if (!(err instanceof WORK.CancelError))
@@ -926,6 +927,7 @@ ODA({ is: 'work-prompt-bar',
926
927
  this.focusInput();
927
928
  },
928
929
  async selectModel(e) {
930
+ const anchor = e?.currentTarget || (e?.nodeType === 1 ? e : null) || e?.target?.closest?.('button.pill') || this.$('#model-pill') || this;
929
931
  const modelsRoot = await WORK.get_item('/MODELS');
930
932
  try {
931
933
  if (modelsRoot?.[R]?.cache)
@@ -940,12 +942,12 @@ ODA({ is: 'work-prompt-bar',
940
942
  execute(item) {
941
943
  if (!isChatModel(item))
942
944
  return;
943
- this.parentElement.close(item);
945
+ (this.parentElement?.close ? this.parentElement : tree.parentElement)?.close?.(item);
944
946
  },
945
947
  });
946
948
  let item;
947
949
  try {
948
- item = await WORK.showDropdown(tree, { TITLE: { label: 'Модель' } }, e.currentTarget || e);
950
+ item = await WORK.showDropdown(tree, { TITLE: { label: 'Модель' }, placement: 'top' }, anchor);
949
951
  }
950
952
  catch (err) {
951
953
  if (err instanceof WORK.CancelError)
@@ -1,212 +1,225 @@
1
- /**
2
- * oda-popover — оболочка всплывающего окна (top layer, нативный popover):
3
- * заголовок (TITLE / слот title), содержимое (светлый потомок или message), подвал диалога (OK / CANCEL / BUTTONS).
4
- * Показ и стек — ODA.showPopover (containers.js). Содержимое закрывает окно через parentElement.close(result) / ok().
5
- */
6
- ODA({
7
- is: 'oda-popover',
8
- imports: '/oda/components/button/button.js',
9
- template: /*html*/`
10
- <style>
11
- :host {
12
- border: none;
13
- visibility: hidden;
14
- max-width: 100%;
15
- transition: opacity var(--duration) ease-in;
16
- opacity: 1;
17
- position: absolute;
18
- margin: {{position ? '0px' : 'auto'}} !important;
19
- min-width: {{width === undefined ? 'min-content' : width + 'px'}};
20
- max-height: {{height === undefined ? '100% !important' : height + 'px'}};
21
- padding: 0;
22
- overflow: hidden;
23
- box-shadow: var(--elevation-3);
24
- @apply --vertical;
25
- {{left < 0 ? '' : 'left:' + left + 'px;'}}
26
- {{top < 0 ? '' : 'top:' + top + 'px;'}}
27
- bottom: 0;
28
- right: 0;
29
- @apply --content;
30
- }
31
- :host([visible]) {
32
- visibility: visible;
33
- }
34
- .title {
35
- align-items: center;
36
- gap: var(--space-s);
37
- padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-m);
38
- }
39
- .title label {
40
- font-weight: bold;
41
- text-overflow: ellipsis;
42
- white-space: nowrap;
43
- overflow: hidden;
44
- }
45
- .footer {
46
- align-items: center;
47
- gap: var(--space-m);
48
- padding: var(--space-m);
49
- }
50
- .btn {
51
- border-radius: var(--control-radius);
52
- padding: var(--space-s) var(--space-m);
53
- box-shadow: var(--elevation-1);
54
- }
55
- ::slotted(:not([slot])) {
56
- @apply --flex;
57
- }
58
- .message {
59
- margin: var(--space-l);
60
- }
61
- </style>
62
- <div no-flex ~if="hasTitle" accent-invert horizontal class="title">
63
- <div vertical flex>
64
- <slot name="title"></slot>
65
- <div ~if="TITLE?.label" flex horizontal style="align-items: center; gap: var(--space-s);">
66
- <oda-icon ~if="TITLE.icon" :icon="TITLE.icon"></oda-icon>
67
- <label flex>{{TITLE.label}}</label>
68
- </div>
69
- </div>
70
- <oda-button ~if="allowClose" no-flex error icon="icons:close" @pointerdown="close()"></oda-button>
71
- </div>
72
- <slot>
73
- <label flex ~if="message" class="message">{{message}}</label>
74
- </slot>
75
- <div ~if="popoverType === 'dialog'" horizontal no-flex header class="footer">
76
- <div flex horizontal style="gap: var(--space-m);">
77
- <oda-button ~for="BUTTONS" ~is="$for.item.is || 'oda-button'" class="btn" no-flex
78
- :icon="$for.item.icon" :label="$for.item.label" :title="$for.item.title || ''"
79
- :disabled="!!$for.item.disabled" :color-mode="$for.item.colorMode"
80
- :tabindex="$for.index + 2"
81
- @tap="$for.item.tap ? $for.item.tap($event) : ok($for.index + 1)"></oda-button>
82
- </div>
83
- <oda-button ~if="OK" tabindex="0" class="btn bold" :icon="OK.icon" :hide-icon="!OK.icon" :icon-size="OK.iconSize || iconSize"
84
- :label="OK.label" :color-mode="OK.colorMode" :disabled="!enable" @tap="ok()"></oda-button>
85
- <oda-button ~if="CANCEL" tabindex="1" class="btn" :icon="CANCEL.icon" :hide-icon="!CANCEL.icon" :icon-size="CANCEL.iconSize || iconSize"
86
- :label="CANCEL.label" :color-mode="CANCEL.colorMode" @tap="close()"></oda-button>
87
- </div>
88
- `,
89
- message: '',
90
- BUTTONS: [],
91
- OK: {
92
- label: 'OK',
93
- icon: 'icons:check',
94
- result: 'ok',
95
- colorMode: 'info-invert'
96
- },
97
- CANCEL: {
98
- label: 'Отмена',
99
- icon: 'icons:close',
100
- colorMode: 'info'
101
- },
102
- TITLE: {
103
- icon: '',
104
- label: '',
105
- deep: 0
106
- },
107
- allowClose: false,
108
- /** modal | dialog | dropdown | menu */
109
- popoverType: '',
110
- position: undefined,
111
- visible: {
112
- $def: false,
113
- $attr: true
114
- },
115
- iconSize: 24,
116
- left: -1,
117
- top: -1,
118
- width: undefined,
119
- height: undefined,
120
- get hasTitle() {
121
- return !!this.TITLE?.label;
122
- },
123
- /** доступность OK: переопределяется наследниками/содержимым */
124
- get enable() {
125
- return true;
126
- },
127
- $listeners: {
128
- resize() {
129
- this.async(() => this._show());
130
- },
131
- keydown(e) {
132
- if (e.defaultPrevented)
133
- return;
134
- if (e.key === 'Escape') {
135
- e.stopPropagation();
136
- this.close();
137
- }
138
- else if (e.key === 'Enter' && this.popoverType === 'dialog' && this.enable && !e.composedPath()[0].matches?.('textarea, button, [contenteditable], [contenteditable] *')) {
139
- e.preventDefault();
140
- this.ok();
141
- }
142
- }
143
- },
144
- set control(n) {
145
- if (n)
146
- this.appendChild(n);
147
- },
148
- layout() {
149
- const pos = this.position;
150
- if (!pos)
151
- return;
152
- let left, top, width, height;
153
- if (pos.tagName) {
154
- const r = pos.getBoundingClientRect();
155
- left = r.left;
156
- width = r.width;
157
- const below = window.innerHeight - r.bottom;
158
- // не влезает под якорем и сверху места больше — открыться над ним, не поверх
159
- if (this.offsetHeight > below && r.top > below) {
160
- top = Math.max(0, r.top - this.offsetHeight);
161
- height = r.top;
162
- }
163
- else {
164
- top = r.bottom;
165
- height = below;
166
- }
167
- }
168
- else if (typeof pos.clientX === 'number') {
169
- left = pos.clientX;
170
- top = pos.clientY;
171
- }
172
- else {
173
- left = pos.x ?? pos.left ?? 0;
174
- top = pos.y ?? pos.top ?? 0;
175
- }
176
- left = Math.max(0, Math.min(left, window.innerWidth - this.offsetWidth));
177
- top = Math.max(0, Math.min(top, window.innerHeight - this.offsetHeight));
178
- // гейты: layout зовётся из resize-наблюдателя, а каждая запись пропа — это
179
- // notify + ререндер + новый замер; без гейтов размер гуляет и круг не рвётся
180
- if (width !== undefined && !Object.is(this.width, width))
181
- this.width = width;
182
- if (height !== undefined && !Object.is(this.height, height))
183
- this.height = height;
184
- if (!Object.is(this.left, left))
185
- this.left = left;
186
- if (!Object.is(this.top, top))
187
- this.top = top;
188
- },
189
- _show() {
190
- this.layout();
191
- clearTimeout(this._visibleTimer);
192
- // раскрытие после стабилизации размеров содержимого (асинхронный рендер потомков)
193
- this._visibleTimer = setTimeout(() => this._reveal(), 250);
194
- this._safetyTimer ??= setTimeout(() => this._reveal(), 1500);
195
- },
196
- _reveal() {
197
- if (this.visible)
198
- return;
199
- clearTimeout(this._visibleTimer);
200
- clearTimeout(this._safetyTimer);
201
- this.visible = true;
202
- this.style.maxWidth = this.getBoundingClientRect().width + 'px';
203
- },
204
- ok(result) {
205
- this.close(result ?? this.OK?.result ?? 'ok');
206
- },
207
- close(result = '') {
208
- clearTimeout(this._visibleTimer);
209
- clearTimeout(this._safetyTimer);
210
- this.fire('close', result);
211
- }
212
- });
1
+ /**
2
+ * oda-popover — оболочка всплывающего окна (top layer, нативный popover):
3
+ * заголовок (TITLE / слот title), содержимое (светлый потомок или message), подвал диалога (OK / CANCEL / BUTTONS).
4
+ * Показ и стек — ODA.showPopover (containers.js). Содержимое закрывает окно через parentElement.close(result) / ok().
5
+ */
6
+ ODA({
7
+ is: 'oda-popover',
8
+ imports: '/oda/components/button/button.js',
9
+ template: /*html*/`
10
+ <style>
11
+ :host {
12
+ border: none;
13
+ visibility: hidden;
14
+ max-width: 100%;
15
+ transition: opacity var(--duration) ease-in;
16
+ opacity: 1;
17
+ position: absolute;
18
+ margin: {{position ? '0px' : 'auto'}} !important;
19
+ min-width: {{width === undefined ? 'min-content' : width + 'px'}};
20
+ max-height: {{height === undefined ? '100% !important' : height + 'px'}};
21
+ padding: 0;
22
+ overflow: hidden;
23
+ box-shadow: var(--elevation-3);
24
+ @apply --vertical;
25
+ {{left < 0 ? '' : 'left:' + left + 'px;'}}
26
+ {{top < 0 ? '' : 'top:' + top + 'px;'}}
27
+ {{position ? 'bottom: auto; right: auto;' : 'bottom: 0; right: 0;'}}
28
+ @apply --content;
29
+ }
30
+ :host([visible]) {
31
+ visibility: visible;
32
+ }
33
+ .title {
34
+ align-items: center;
35
+ gap: var(--space-s);
36
+ padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-m);
37
+ }
38
+ .title label {
39
+ font-weight: bold;
40
+ text-overflow: ellipsis;
41
+ white-space: nowrap;
42
+ overflow: hidden;
43
+ }
44
+ .footer {
45
+ align-items: center;
46
+ gap: var(--space-m);
47
+ padding: var(--space-m);
48
+ }
49
+ .btn {
50
+ border-radius: var(--control-radius);
51
+ padding: var(--space-s) var(--space-m);
52
+ box-shadow: var(--elevation-1);
53
+ }
54
+ ::slotted(:not([slot])) {
55
+ @apply --flex;
56
+ }
57
+ .message {
58
+ margin: var(--space-l);
59
+ }
60
+ </style>
61
+ <div no-flex ~if="hasTitle" accent-invert horizontal class="title">
62
+ <div vertical flex>
63
+ <slot name="title"></slot>
64
+ <div ~if="TITLE?.label" flex horizontal style="align-items: center; gap: var(--space-s);">
65
+ <oda-icon ~if="TITLE.icon" :icon="TITLE.icon"></oda-icon>
66
+ <label flex>{{TITLE.label}}</label>
67
+ </div>
68
+ </div>
69
+ <oda-button ~if="allowClose" no-flex error icon="icons:close" @pointerdown="close()"></oda-button>
70
+ </div>
71
+ <slot>
72
+ <label flex ~if="message" class="message">{{message}}</label>
73
+ </slot>
74
+ <div ~if="popoverType === 'dialog'" horizontal no-flex header class="footer">
75
+ <div flex horizontal style="gap: var(--space-m);">
76
+ <oda-button ~for="BUTTONS" ~is="$for.item.is || 'oda-button'" class="btn" no-flex
77
+ :icon="$for.item.icon" :label="$for.item.label" :title="$for.item.title || ''"
78
+ :disabled="!!$for.item.disabled" :color-mode="$for.item.colorMode"
79
+ :tabindex="$for.index + 2"
80
+ @tap="$for.item.tap ? $for.item.tap($event) : ok($for.index + 1)"></oda-button>
81
+ </div>
82
+ <oda-button ~if="OK" tabindex="0" class="btn bold" :icon="OK.icon" :hide-icon="!OK.icon" :icon-size="OK.iconSize || iconSize"
83
+ :label="OK.label" :color-mode="OK.colorMode" :disabled="!enable" @tap="ok()"></oda-button>
84
+ <oda-button ~if="CANCEL" tabindex="1" class="btn" :icon="CANCEL.icon" :hide-icon="!CANCEL.icon" :icon-size="CANCEL.iconSize || iconSize"
85
+ :label="CANCEL.label" :color-mode="CANCEL.colorMode" @tap="close()"></oda-button>
86
+ </div>
87
+ `,
88
+ message: '',
89
+ BUTTONS: [],
90
+ OK: {
91
+ label: 'OK',
92
+ icon: 'icons:check',
93
+ result: 'ok',
94
+ colorMode: 'info-invert'
95
+ },
96
+ CANCEL: {
97
+ label: 'Отмена',
98
+ icon: 'icons:close',
99
+ colorMode: 'info'
100
+ },
101
+ TITLE: {
102
+ icon: '',
103
+ label: '',
104
+ deep: 0
105
+ },
106
+ allowClose: false,
107
+ /** modal | dialog | dropdown | menu */
108
+ popoverType: '',
109
+ position: undefined,
110
+ /** '' | 'top' | 'bottom' — предпочтительное направление раскрытия относительно якоря */
111
+ placement: '',
112
+ visible: {
113
+ $def: false,
114
+ $attr: true
115
+ },
116
+ iconSize: 24,
117
+ left: -1,
118
+ top: -1,
119
+ width: undefined,
120
+ height: undefined,
121
+ get hasTitle() {
122
+ return !!this.TITLE?.label;
123
+ },
124
+ /** доступность OK: переопределяется наследниками/содержимым */
125
+ get enable() {
126
+ return true;
127
+ },
128
+ $listeners: {
129
+ resize() {
130
+ this.async(() => this._show());
131
+ },
132
+ keydown(e) {
133
+ if (e.defaultPrevented)
134
+ return;
135
+ if (e.key === 'Escape') {
136
+ e.stopPropagation();
137
+ this.close();
138
+ }
139
+ else if (e.key === 'Enter' && this.popoverType === 'dialog' && this.enable && !e.composedPath()[0].matches?.('textarea, button, [contenteditable], [contenteditable] *')) {
140
+ e.preventDefault();
141
+ this.ok();
142
+ }
143
+ }
144
+ },
145
+ set control(n) {
146
+ if (n)
147
+ this.appendChild(n);
148
+ },
149
+ layout(finalize = false) {
150
+ const pos = this.position;
151
+ if (!pos)
152
+ return;
153
+ let left, top, width, height;
154
+ if (pos.tagName) {
155
+ const r = pos.getBoundingClientRect();
156
+ left = r.left;
157
+ width = r.width;
158
+ const below = Math.max(0, window.innerHeight - r.bottom);
159
+ const above = Math.max(0, r.top);
160
+ const maxAvail = Math.max(above, below);
161
+ let openUp;
162
+ if (this.placement === 'top') {
163
+ openUp = above >= 80 || above >= below;
164
+ }
165
+ else if (this.placement === 'bottom') {
166
+ openUp = false;
167
+ }
168
+ else {
169
+ openUp = this.offsetHeight > below && above > below;
170
+ }
171
+ if (openUp) {
172
+ height = above;
173
+ top = Math.max(0, r.top - Math.min(this.offsetHeight, above));
174
+ }
175
+ else {
176
+ top = r.bottom;
177
+ height = (this.placement === 'bottom' || finalize || this.visible || above <= below) ? below : maxAvail;
178
+ }
179
+ }
180
+ else if (typeof pos.clientX === 'number') {
181
+ left = pos.clientX;
182
+ top = pos.clientY;
183
+ }
184
+ else {
185
+ left = pos.x ?? pos.left ?? 0;
186
+ top = pos.y ?? pos.top ?? 0;
187
+ }
188
+ left = Math.max(0, Math.min(left, window.innerWidth - this.offsetWidth));
189
+ top = Math.max(0, Math.min(top, window.innerHeight - this.offsetHeight));
190
+ // гейты: layout зовётся из resize-наблюдателя, а каждая запись пропа — это
191
+ // notify + ререндер + новый замер; без гейтов размер гуляет и круг не рвётся
192
+ if (width !== undefined && !Object.is(this.width, width))
193
+ this.width = width;
194
+ if (height !== undefined && !Object.is(this.height, height))
195
+ this.height = height;
196
+ if (!Object.is(this.left, left))
197
+ this.left = left;
198
+ if (!Object.is(this.top, top))
199
+ this.top = top;
200
+ },
201
+ _show() {
202
+ this.layout();
203
+ clearTimeout(this._visibleTimer);
204
+ // раскрытие после стабилизации размеров содержимого (асинхронный рендер потомков)
205
+ this._visibleTimer = setTimeout(() => this._reveal(), 250);
206
+ this._safetyTimer ??= setTimeout(() => this._reveal(), 1500);
207
+ },
208
+ _reveal() {
209
+ if (this.visible)
210
+ return;
211
+ clearTimeout(this._visibleTimer);
212
+ clearTimeout(this._safetyTimer);
213
+ this.layout(true);
214
+ this.visible = true;
215
+ this.style.maxWidth = this.getBoundingClientRect().width + 'px';
216
+ },
217
+ ok(result) {
218
+ this.close(result ?? this.OK?.result ?? 'ok');
219
+ },
220
+ close(result = '') {
221
+ clearTimeout(this._visibleTimer);
222
+ clearTimeout(this._safetyTimer);
223
+ this.fire('close', result);
224
+ }
225
+ });
@@ -12,7 +12,7 @@ export function componentCounter() {
12
12
  componentCounter.counter = 0;
13
13
 
14
14
  export function setAttribute(name, value) {
15
- if (typeof value !== 'object') {
15
+ if (typeof value !== 'object' && typeof value !== 'function') {
16
16
  try {
17
17
  if (value || value === 0) {
18
18
  this.setAttribute(name, value === true ? '' : value);
package/oda/oda.js CHANGED
@@ -151,8 +151,10 @@ Node:{
151
151
  const reentering = Reactor._collectorTarget === target && Reactor._collectorKey === p;
152
152
  const owner = pdpOwner(reentering ? target.host : target, p);
153
153
  if (!owner) return undefined;
154
- if (owner[R])
155
- return Reactor.get(owner, p);
154
+ if (owner[R]) {
155
+ const value = Reactor.get(owner, p);
156
+ return typeof value === 'function' ? value.bind(owner) : value;
157
+ }
156
158
  const value = owner[p];
157
159
  return typeof value === 'function' ? value.bind(owner) : value;
158
160
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -1,6 +1,9 @@
1
1
  # Прогресс: sources/data
2
2
 
3
3
  ## Последние изменения
4
+ - [13:35, 17.11] Исправление выбора модели в `work-prompt-bar` и раскрытия выпадающих списков вверх над якорем (`oda/core/shared.js`, `oda/oda.js`, `oda/components/containers/popover/popover.js`, `$server/$folder/lib/prompt-bar/prompt-bar.js`, `tests/ui/{oda-core,voice-ui}.html`, `odant-work@1.0.37`):
5
+ - **Выбор модели кликом по узлу дерева (`oda/core/shared.js`, `oda/oda.js`):** в `setAttribute` исключена сериализация функций (`typeof value !== 'function'`) в наблюдаемые HTML-атрибуты (иначе `$public`-функция `execute` у `item-tree` перезаписывалась строкой через `attributeChangedCallback`), а в `$pdp.get` для `owner[R]` функции из `Reactor.get` привязываются к `owner`.
6
+ - **Позиционирование списка вверх над контролом (`popover.js`, `prompt-bar.js`):** в `selectModel` якорный элемент `#model-pill` сохраняется до `await WORK.get_item('/MODELS')`, в `oda-popover` добавлена поддержка `placement: 'top'` и сброс `bottom: auto; right: auto` при заданном `position`, а выбор модели/режима/получателей/действий `+` из нижней панели ввода открывается вверх над кнопкой.
4
7
  - [12:46, 17.11] Передача `post` в поднятые `$method` и POST-тело в тесте модели `form/trainer` (`sources/server/folder.js`, `MODELS/$ai/$folder/$class/$ai/{class.js,handlers/pages/form/trainer/$handler/trainer.js}`, `tests/{exec-item-method,ai-stream}.test.js`, `odant-work@1.0.36`):
5
8
  - **Устранена ошибка `400 missing_messages` (`'messages' must be a non-empty array`) при «Быстрой проверке ответа»:** в `trainer.js` (`runTestPrompt`) тело `{ messages }` теперь передаётся 3-м аргументом (`this.$item.fetch('chat', {}, { messages })`) как POST-тело, а в `folder.js` (`_liftMethods`) второй аргумент `post` пробрасывается в `handler.execute(params, post)` вместо отбрасывания.
6
9
  - **Защита `streamChat` от пустого `post = {}`:** при пустом `post` берутся `params`, чтобы `options.messages` не терялись.