@bitrix24/b24ui-nuxt 2.1.11 → 2.1.15
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/.nuxt/b24ui.css +2 -0
- package/README-AI.md +1 -1
- package/dist/meta.d.mts +98705 -785
- package/dist/meta.mjs +98705 -785
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/air-design-tokens/003_b24_context_light.css +1 -1
- package/dist/runtime/air-design-tokens/004_b24_context_dark.css +1 -1
- package/dist/runtime/air-design-tokens/components/popup.css +1 -1
- package/dist/runtime/air-design-tokens/tw-style/font-size.css +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +6 -2
- package/dist/runtime/components/ContextMenu.vue.d.ts +6 -2
- package/dist/runtime/components/ContextMenuContent.vue +3 -2
- package/dist/runtime/components/DropdownMenu.d.vue.ts +6 -2
- package/dist/runtime/components/DropdownMenu.vue +2 -2
- package/dist/runtime/components/DropdownMenu.vue.d.ts +6 -2
- package/dist/runtime/components/DropdownMenuContent.vue +5 -4
- package/dist/runtime/components/Editor.d.vue.ts +87 -0
- package/dist/runtime/components/Editor.vue +185 -0
- package/dist/runtime/components/Editor.vue.d.ts +87 -0
- package/dist/runtime/components/EditorDragHandle.d.vue.ts +60 -0
- package/dist/runtime/components/EditorDragHandle.vue +128 -0
- package/dist/runtime/components/EditorDragHandle.vue.d.ts +60 -0
- package/dist/runtime/components/EditorEmojiMenu.d.vue.ts +35 -0
- package/dist/runtime/components/EditorEmojiMenu.vue +70 -0
- package/dist/runtime/components/EditorEmojiMenu.vue.d.ts +35 -0
- package/dist/runtime/components/EditorMentionMenu.d.vue.ts +39 -0
- package/dist/runtime/components/EditorMentionMenu.vue +74 -0
- package/dist/runtime/components/EditorMentionMenu.vue.d.ts +39 -0
- package/dist/runtime/components/EditorSuggestionMenu.d.vue.ts +52 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue +79 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue.d.ts +52 -0
- package/dist/runtime/components/EditorToolbar.d.vue.ts +80 -0
- package/dist/runtime/components/EditorToolbar.vue +241 -0
- package/dist/runtime/components/EditorToolbar.vue.d.ts +80 -0
- package/dist/runtime/components/FormField.vue +2 -2
- package/dist/runtime/components/InputMenu.d.vue.ts +2 -0
- package/dist/runtime/components/InputMenu.vue +14 -1
- package/dist/runtime/components/InputMenu.vue.d.ts +2 -0
- package/dist/runtime/components/PageCard.vue +2 -1
- package/dist/runtime/components/Pagination.d.vue.ts +0 -1
- package/dist/runtime/components/Pagination.vue.d.ts +0 -1
- package/dist/runtime/components/Select.d.vue.ts +2 -0
- package/dist/runtime/components/Select.vue +14 -1
- package/dist/runtime/components/Select.vue.d.ts +2 -0
- package/dist/runtime/components/SelectMenu.d.vue.ts +2 -0
- package/dist/runtime/components/SelectMenu.vue +14 -1
- package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
- package/dist/runtime/components/User.vue +0 -1
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/runtime/components/locale/LocaleSelect.vue +6 -3
- package/dist/runtime/components/prose/Accordion.vue +1 -1
- package/dist/runtime/components/prose/Callout.vue +0 -1
- package/dist/runtime/components/prose/Card.vue +0 -1
- package/dist/runtime/composables/defineShortcuts.d.ts +2 -1
- package/dist/runtime/composables/defineShortcuts.js +62 -15
- package/dist/runtime/composables/useEditorMenu.d.ts +64 -0
- package/dist/runtime/composables/useEditorMenu.js +448 -0
- package/dist/runtime/dictionary/icons.d.ts +1 -0
- package/dist/runtime/dictionary/icons.js +5 -3
- package/dist/runtime/locale/in.d.ts +3 -0
- package/dist/runtime/locale/in.js +136 -0
- package/dist/runtime/locale/index.d.ts +25 -23
- package/dist/runtime/locale/index.js +11 -10
- package/dist/runtime/types/editor.d.ts +69 -0
- package/dist/runtime/types/editor.js +0 -0
- package/dist/runtime/types/index.d.ts +7 -0
- package/dist/runtime/types/index.js +7 -0
- package/dist/runtime/types/prose.d.ts +2 -0
- package/dist/runtime/types/prose.js +2 -0
- package/dist/runtime/utils/editor.d.ts +69 -0
- package/dist/runtime/utils/editor.js +364 -0
- package/dist/runtime/utils/tv.js +2 -1
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/shared/{b24ui-nuxt.Dh5A-7HA.mjs → b24ui-nuxt.BYDi-4ID.mjs} +323 -132
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +22 -8
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { ref, h, computed, unref } from "vue";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
import { useFilter } from "reka-ui";
|
|
4
|
+
import { computePosition } from "@floating-ui/dom";
|
|
5
|
+
import { VueRenderer } from "@tiptap/vue-3";
|
|
6
|
+
import Suggestion from "@tiptap/suggestion";
|
|
7
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
8
|
+
import { buildFloatingUIMiddleware } from "../utils/editor.js";
|
|
9
|
+
import { get, isArrayOfArray } from "../utils/index.js";
|
|
10
|
+
export function useEditorMenu(options) {
|
|
11
|
+
const filteredItems = ref([]);
|
|
12
|
+
const selectedIndex = ref(0);
|
|
13
|
+
const menuState = ref("closed");
|
|
14
|
+
let renderer = null;
|
|
15
|
+
let element = null;
|
|
16
|
+
let handleMouseDown = null;
|
|
17
|
+
let commandFn = null;
|
|
18
|
+
let keyDownHandler = null;
|
|
19
|
+
let globalKeyHandler = null;
|
|
20
|
+
let blurHandler = null;
|
|
21
|
+
let triggerClientRect = null;
|
|
22
|
+
let handleHover = null;
|
|
23
|
+
let scrollHandler = null;
|
|
24
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
25
|
+
const cleanupMenu = () => {
|
|
26
|
+
if (menuState.value === "closed") return;
|
|
27
|
+
menuState.value = "closed";
|
|
28
|
+
if (globalKeyHandler) {
|
|
29
|
+
document.removeEventListener("keydown", globalKeyHandler, true);
|
|
30
|
+
globalKeyHandler = null;
|
|
31
|
+
}
|
|
32
|
+
if (blurHandler) {
|
|
33
|
+
options.editor.view.dom.removeEventListener("blur", blurHandler);
|
|
34
|
+
blurHandler = null;
|
|
35
|
+
}
|
|
36
|
+
if (scrollHandler) {
|
|
37
|
+
window.removeEventListener("scroll", scrollHandler, true);
|
|
38
|
+
scrollHandler = null;
|
|
39
|
+
}
|
|
40
|
+
if (element && handleMouseDown) {
|
|
41
|
+
element.removeEventListener("mousedown", handleMouseDown);
|
|
42
|
+
handleMouseDown = null;
|
|
43
|
+
}
|
|
44
|
+
if (renderer) {
|
|
45
|
+
renderer.destroy();
|
|
46
|
+
renderer = null;
|
|
47
|
+
}
|
|
48
|
+
if (element) {
|
|
49
|
+
element.remove();
|
|
50
|
+
element = null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const filterFields = options.filterFields ?? ["label"];
|
|
54
|
+
const defaultFilter = (items2, query) => {
|
|
55
|
+
if (!query) return items2;
|
|
56
|
+
return items2.filter((item) => {
|
|
57
|
+
return filterFields.some((field) => {
|
|
58
|
+
const value = get(item, field);
|
|
59
|
+
if (value === void 0 || value === null) return false;
|
|
60
|
+
const stringValue = Array.isArray(value) ? value.join(" ") : String(value);
|
|
61
|
+
return contains(stringValue, query) || contains(stringValue.replace(/[\s_-]/g, ""), query);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const filter = options.filter || defaultFilter;
|
|
66
|
+
const limit = options.limit ?? 42;
|
|
67
|
+
const groups = computed(() => {
|
|
68
|
+
const items2 = unref(options.items);
|
|
69
|
+
return items2?.length ? isArrayOfArray(items2) ? items2 : [items2] : [];
|
|
70
|
+
});
|
|
71
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
72
|
+
const filteredGroups = computed(() => {
|
|
73
|
+
if (!filteredItems.value.length) return [];
|
|
74
|
+
return groups.value.map((group) => group.filter((item) => filteredItems.value.includes(item))).filter((group) => group.length > 0);
|
|
75
|
+
});
|
|
76
|
+
const selectableItems = computed(() => {
|
|
77
|
+
return filteredItems.value.filter((item) => {
|
|
78
|
+
return item.type !== "label" && item.type !== "separator";
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
const floatingUIOptions = defu(options.options, {
|
|
82
|
+
strategy: "absolute",
|
|
83
|
+
placement: "bottom-start",
|
|
84
|
+
offset: 8,
|
|
85
|
+
flip: {},
|
|
86
|
+
shift: { padding: 8 },
|
|
87
|
+
size: false,
|
|
88
|
+
autoPlacement: false,
|
|
89
|
+
hide: false,
|
|
90
|
+
inline: false
|
|
91
|
+
});
|
|
92
|
+
const middleware = buildFloatingUIMiddleware(floatingUIOptions);
|
|
93
|
+
const updatePosition = (element2) => {
|
|
94
|
+
if (!triggerClientRect) return;
|
|
95
|
+
const rect = triggerClientRect();
|
|
96
|
+
if (!rect) return;
|
|
97
|
+
const virtualElement = {
|
|
98
|
+
getBoundingClientRect: () => rect
|
|
99
|
+
};
|
|
100
|
+
computePosition(virtualElement, element2, {
|
|
101
|
+
placement: floatingUIOptions.placement,
|
|
102
|
+
strategy: floatingUIOptions.strategy,
|
|
103
|
+
middleware
|
|
104
|
+
}).then(({ x, y, strategy }) => {
|
|
105
|
+
element2.style.width = "max-content";
|
|
106
|
+
element2.style.position = strategy;
|
|
107
|
+
element2.style.top = "0";
|
|
108
|
+
element2.style.left = "0";
|
|
109
|
+
element2.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const MenuComponent = {
|
|
113
|
+
props: {
|
|
114
|
+
groups: { type: Array, required: true },
|
|
115
|
+
selectedIndex: { type: Number, required: true },
|
|
116
|
+
onSelect: { type: Function, required: true },
|
|
117
|
+
onHover: { type: Function, required: true },
|
|
118
|
+
state: { type: String, required: true }
|
|
119
|
+
},
|
|
120
|
+
setup(menuProps) {
|
|
121
|
+
function handleClick(e, item, selectableIndex) {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
menuProps.onSelect(item, selectableIndex);
|
|
124
|
+
}
|
|
125
|
+
function handleMouseEnter(selectableIndex) {
|
|
126
|
+
menuProps.onHover(selectableIndex);
|
|
127
|
+
}
|
|
128
|
+
return () => {
|
|
129
|
+
const groupsData = menuProps.groups;
|
|
130
|
+
const selectableIndexMap = /* @__PURE__ */ new Map();
|
|
131
|
+
let selectableCounter = 0;
|
|
132
|
+
for (const group of groupsData) {
|
|
133
|
+
for (const item of group) {
|
|
134
|
+
const itemData = item;
|
|
135
|
+
if (itemData.type !== "label" && itemData.type !== "separator") {
|
|
136
|
+
selectableIndexMap.set(item, selectableCounter++);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return h("div", {
|
|
141
|
+
"class": options.b24ui.value.content(),
|
|
142
|
+
"role": "listbox",
|
|
143
|
+
"data-state": menuProps.state
|
|
144
|
+
}, [
|
|
145
|
+
h("div", {
|
|
146
|
+
class: options.b24ui.value.viewport(),
|
|
147
|
+
role: "presentation"
|
|
148
|
+
}, groupsData.map(
|
|
149
|
+
(group, groupIndex) => h("div", {
|
|
150
|
+
key: `group-${groupIndex}`,
|
|
151
|
+
class: options.b24ui.value.group(),
|
|
152
|
+
role: "group"
|
|
153
|
+
}, group.map((item, itemInGroupIndex) => {
|
|
154
|
+
const itemData = item;
|
|
155
|
+
if (itemData.type === "label") {
|
|
156
|
+
return h("div", {
|
|
157
|
+
key: `label-${groupIndex}-${itemInGroupIndex}`,
|
|
158
|
+
class: options.b24ui.value.label({ class: itemData.class })
|
|
159
|
+
}, options.renderItem(item, options.b24ui));
|
|
160
|
+
}
|
|
161
|
+
if (itemData.type === "separator") {
|
|
162
|
+
return h("div", {
|
|
163
|
+
key: `separator-${groupIndex}-${itemInGroupIndex}`,
|
|
164
|
+
class: options.b24ui.value.separator({ class: itemData.class }),
|
|
165
|
+
role: "separator"
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const selectableIndex = selectableIndexMap.get(item);
|
|
169
|
+
const isHighlighted = selectableIndex === menuProps.selectedIndex;
|
|
170
|
+
return h("div", {
|
|
171
|
+
"key": `item-${selectableIndex}`,
|
|
172
|
+
"class": options.b24ui.value.item({ class: itemData.class, active: false }),
|
|
173
|
+
"role": "option",
|
|
174
|
+
"aria-selected": isHighlighted,
|
|
175
|
+
"data-highlighted": isHighlighted ? "" : void 0,
|
|
176
|
+
"data-disabled": itemData.disabled ? "" : void 0,
|
|
177
|
+
"onMousedown": (e) => handleClick(e, item, selectableIndex),
|
|
178
|
+
"onMouseenter": () => handleMouseEnter(selectableIndex),
|
|
179
|
+
"ref": (el) => {
|
|
180
|
+
if (el && isHighlighted) {
|
|
181
|
+
el.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, options.renderItem(item, options.b24ui));
|
|
185
|
+
}))
|
|
186
|
+
))
|
|
187
|
+
]);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const pluginKeyInstance = typeof options.pluginKey === "string" ? new PluginKey(options.pluginKey) : options.pluginKey;
|
|
192
|
+
const plugin = Suggestion({
|
|
193
|
+
pluginKey: pluginKeyInstance,
|
|
194
|
+
editor: options.editor,
|
|
195
|
+
char: options.char,
|
|
196
|
+
items: ({ query }) => {
|
|
197
|
+
const filtered = filter(items.value, query);
|
|
198
|
+
return filtered.slice(0, limit);
|
|
199
|
+
},
|
|
200
|
+
command: ({ editor, range, props }) => {
|
|
201
|
+
options.onSelect(editor, range, props);
|
|
202
|
+
},
|
|
203
|
+
render: () => {
|
|
204
|
+
keyDownHandler = (props) => {
|
|
205
|
+
const { event } = props;
|
|
206
|
+
if (!renderer || !selectableItems.value.length) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
if (event.key === "Escape") {
|
|
210
|
+
cleanupMenu();
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
if (event.key === "ArrowUp") {
|
|
214
|
+
selectedIndex.value = (selectedIndex.value + selectableItems.value.length - 1) % selectableItems.value.length;
|
|
215
|
+
renderer?.updateProps({
|
|
216
|
+
groups: filteredGroups.value,
|
|
217
|
+
selectedIndex: selectedIndex.value,
|
|
218
|
+
onSelect: commandFn,
|
|
219
|
+
onHover: handleHover,
|
|
220
|
+
state: menuState.value
|
|
221
|
+
});
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
if (event.key === "ArrowDown") {
|
|
225
|
+
selectedIndex.value = (selectedIndex.value + 1) % selectableItems.value.length;
|
|
226
|
+
renderer?.updateProps({
|
|
227
|
+
groups: filteredGroups.value,
|
|
228
|
+
selectedIndex: selectedIndex.value,
|
|
229
|
+
onSelect: commandFn,
|
|
230
|
+
onHover: handleHover,
|
|
231
|
+
state: menuState.value
|
|
232
|
+
});
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
236
|
+
const selectedItem = selectableItems.value[selectedIndex.value];
|
|
237
|
+
if (selectedItem && commandFn) {
|
|
238
|
+
commandFn(selectedItem);
|
|
239
|
+
}
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
return false;
|
|
243
|
+
};
|
|
244
|
+
const handlers = {
|
|
245
|
+
onStart: (suggestionProps) => {
|
|
246
|
+
filteredItems.value = suggestionProps.items;
|
|
247
|
+
selectedIndex.value = 0;
|
|
248
|
+
commandFn = (item) => suggestionProps.command(item);
|
|
249
|
+
triggerClientRect = suggestionProps.clientRect;
|
|
250
|
+
if (!filteredItems.value.length) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
menuState.value = "open";
|
|
254
|
+
globalKeyHandler = (e) => {
|
|
255
|
+
if (keyDownHandler) {
|
|
256
|
+
const handled = keyDownHandler({ event: e });
|
|
257
|
+
if (handled) {
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
document.addEventListener("keydown", globalKeyHandler, true);
|
|
264
|
+
blurHandler = () => {
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
if (menuState.value === "open") {
|
|
267
|
+
const tr = suggestionProps.editor.view.state.tr.setMeta(pluginKeyInstance, { exit: true });
|
|
268
|
+
suggestionProps.editor.view.dispatch(tr);
|
|
269
|
+
}
|
|
270
|
+
}, 0);
|
|
271
|
+
};
|
|
272
|
+
suggestionProps.editor.view.dom.addEventListener("blur", blurHandler);
|
|
273
|
+
scrollHandler = () => {
|
|
274
|
+
if (element) {
|
|
275
|
+
updatePosition(element);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
window.addEventListener("scroll", scrollHandler, true);
|
|
279
|
+
handleHover = (index) => {
|
|
280
|
+
selectedIndex.value = index;
|
|
281
|
+
if (renderer) {
|
|
282
|
+
renderer.updateProps({
|
|
283
|
+
groups: filteredGroups.value,
|
|
284
|
+
selectedIndex: index,
|
|
285
|
+
onSelect: commandFn,
|
|
286
|
+
onHover: handleHover,
|
|
287
|
+
state: menuState.value
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
renderer = new VueRenderer(MenuComponent, {
|
|
292
|
+
props: {
|
|
293
|
+
groups: filteredGroups.value,
|
|
294
|
+
selectedIndex: selectedIndex.value,
|
|
295
|
+
onSelect: commandFn,
|
|
296
|
+
onHover: handleHover,
|
|
297
|
+
state: menuState.value
|
|
298
|
+
},
|
|
299
|
+
editor: suggestionProps.editor
|
|
300
|
+
});
|
|
301
|
+
element = document.createElement("div");
|
|
302
|
+
element.style.position = floatingUIOptions.strategy;
|
|
303
|
+
element.style.zIndex = "50";
|
|
304
|
+
handleMouseDown = (e) => {
|
|
305
|
+
e.preventDefault();
|
|
306
|
+
};
|
|
307
|
+
element.addEventListener("mousedown", handleMouseDown);
|
|
308
|
+
const appendToElement = typeof options.appendTo === "function" ? options.appendTo() : options.appendTo;
|
|
309
|
+
(appendToElement ?? suggestionProps.editor.view.dom.parentElement)?.appendChild(element);
|
|
310
|
+
if (renderer.element) {
|
|
311
|
+
element.appendChild(renderer.element);
|
|
312
|
+
}
|
|
313
|
+
updatePosition(element);
|
|
314
|
+
},
|
|
315
|
+
onUpdate: (suggestionProps) => {
|
|
316
|
+
filteredItems.value = suggestionProps.items;
|
|
317
|
+
commandFn = (item) => suggestionProps.command(item);
|
|
318
|
+
if (selectedIndex.value >= selectableItems.value.length) {
|
|
319
|
+
selectedIndex.value = Math.max(0, selectableItems.value.length - 1);
|
|
320
|
+
}
|
|
321
|
+
if (!filteredItems.value.length) {
|
|
322
|
+
cleanupMenu();
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (!renderer) {
|
|
326
|
+
menuState.value = "open";
|
|
327
|
+
if (!globalKeyHandler) {
|
|
328
|
+
globalKeyHandler = (e) => {
|
|
329
|
+
if (keyDownHandler) {
|
|
330
|
+
const handled = keyDownHandler({ event: e });
|
|
331
|
+
if (handled) {
|
|
332
|
+
e.preventDefault();
|
|
333
|
+
e.stopPropagation();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
document.addEventListener("keydown", globalKeyHandler, true);
|
|
338
|
+
}
|
|
339
|
+
if (!blurHandler) {
|
|
340
|
+
blurHandler = () => {
|
|
341
|
+
setTimeout(() => {
|
|
342
|
+
if (menuState.value === "open") {
|
|
343
|
+
const tr = suggestionProps.editor.view.state.tr.setMeta(pluginKeyInstance, { exit: true });
|
|
344
|
+
suggestionProps.editor.view.dispatch(tr);
|
|
345
|
+
}
|
|
346
|
+
}, 0);
|
|
347
|
+
};
|
|
348
|
+
suggestionProps.editor.view.dom.addEventListener("blur", blurHandler);
|
|
349
|
+
}
|
|
350
|
+
if (!scrollHandler) {
|
|
351
|
+
scrollHandler = () => {
|
|
352
|
+
if (element) {
|
|
353
|
+
updatePosition(element);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
window.addEventListener("scroll", scrollHandler, true);
|
|
357
|
+
}
|
|
358
|
+
handleHover = (index) => {
|
|
359
|
+
selectedIndex.value = index;
|
|
360
|
+
if (renderer) {
|
|
361
|
+
renderer.updateProps({
|
|
362
|
+
groups: filteredGroups.value,
|
|
363
|
+
selectedIndex: index,
|
|
364
|
+
onSelect: commandFn,
|
|
365
|
+
onHover: handleHover,
|
|
366
|
+
state: menuState.value
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
renderer = new VueRenderer(MenuComponent, {
|
|
371
|
+
props: {
|
|
372
|
+
groups: filteredGroups.value,
|
|
373
|
+
selectedIndex: selectedIndex.value,
|
|
374
|
+
onSelect: commandFn,
|
|
375
|
+
onHover: handleHover,
|
|
376
|
+
state: menuState.value
|
|
377
|
+
},
|
|
378
|
+
editor: suggestionProps.editor
|
|
379
|
+
});
|
|
380
|
+
element = document.createElement("div");
|
|
381
|
+
element.style.position = floatingUIOptions.strategy;
|
|
382
|
+
element.style.zIndex = "50";
|
|
383
|
+
handleMouseDown = (e) => {
|
|
384
|
+
e.preventDefault();
|
|
385
|
+
};
|
|
386
|
+
element.addEventListener("mousedown", handleMouseDown);
|
|
387
|
+
const appendToElement = typeof options.appendTo === "function" ? options.appendTo() : options.appendTo;
|
|
388
|
+
(appendToElement ?? suggestionProps.editor.view.dom.parentElement)?.appendChild(element);
|
|
389
|
+
if (renderer.element) {
|
|
390
|
+
element.appendChild(renderer.element);
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
renderer.updateProps({
|
|
394
|
+
groups: filteredGroups.value,
|
|
395
|
+
selectedIndex: selectedIndex.value,
|
|
396
|
+
onSelect: commandFn,
|
|
397
|
+
onHover: (index) => {
|
|
398
|
+
selectedIndex.value = index;
|
|
399
|
+
},
|
|
400
|
+
state: menuState.value
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
if (element) {
|
|
404
|
+
updatePosition(element);
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
onKeyDown: keyDownHandler,
|
|
408
|
+
onExit: () => {
|
|
409
|
+
cleanupMenu();
|
|
410
|
+
triggerClientRect = null;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
return handlers;
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
const destroy = () => {
|
|
417
|
+
menuState.value = "closed";
|
|
418
|
+
if (globalKeyHandler) {
|
|
419
|
+
document.removeEventListener("keydown", globalKeyHandler, true);
|
|
420
|
+
globalKeyHandler = null;
|
|
421
|
+
}
|
|
422
|
+
if (blurHandler) {
|
|
423
|
+
options.editor.view.dom.removeEventListener("blur", blurHandler);
|
|
424
|
+
blurHandler = null;
|
|
425
|
+
}
|
|
426
|
+
if (scrollHandler) {
|
|
427
|
+
window.removeEventListener("scroll", scrollHandler, true);
|
|
428
|
+
scrollHandler = null;
|
|
429
|
+
}
|
|
430
|
+
if (element && handleMouseDown) {
|
|
431
|
+
element.removeEventListener("mousedown", handleMouseDown);
|
|
432
|
+
handleMouseDown = null;
|
|
433
|
+
}
|
|
434
|
+
if (renderer) {
|
|
435
|
+
renderer.destroy();
|
|
436
|
+
renderer = null;
|
|
437
|
+
}
|
|
438
|
+
if (element) {
|
|
439
|
+
element.remove();
|
|
440
|
+
element = null;
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
return {
|
|
444
|
+
plugin,
|
|
445
|
+
destroy,
|
|
446
|
+
filteredItems
|
|
447
|
+
};
|
|
448
|
+
}
|
|
@@ -40,5 +40,6 @@ declare const _default: {
|
|
|
40
40
|
arrowUp: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
41
41
|
stop: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
42
42
|
reload: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
43
|
+
drag: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
43
44
|
};
|
|
44
45
|
export default _default;
|
|
@@ -8,7 +8,6 @@ import DoubleShevronsRightIcon from "@bitrix24/b24icons-vue/actions/DoubleShevro
|
|
|
8
8
|
import DoubleShevronsLeftIcon from "@bitrix24/b24icons-vue/actions/DoubleShevronsLeftIcon";
|
|
9
9
|
import CrossMIcon from "@bitrix24/b24icons-vue/outline/CrossMIcon";
|
|
10
10
|
import DotsIcon from "@bitrix24/b24icons-vue/button/DotsIcon";
|
|
11
|
-
import OpenIn50Icon from "@bitrix24/b24icons-vue/actions/OpenIn50Icon";
|
|
12
11
|
import Refresh6Icon from "@bitrix24/b24icons-vue/actions/Refresh6Icon";
|
|
13
12
|
import Minus30Icon from "@bitrix24/b24icons-vue/actions/Minus30Icon";
|
|
14
13
|
import Plus30Icon from "@bitrix24/b24icons-vue/actions/Plus30Icon";
|
|
@@ -32,6 +31,8 @@ import ArrowTopLIcon from "@bitrix24/b24icons-vue/outline/ArrowTopLIcon";
|
|
|
32
31
|
import StopLIcon from "@bitrix24/b24icons-vue/outline/StopLIcon";
|
|
33
32
|
import RefreshIcon from "@bitrix24/b24icons-vue/outline/RefreshIcon";
|
|
34
33
|
import SendIcon from "@bitrix24/b24icons-vue/main/SendIcon";
|
|
34
|
+
import DragLIcon from "@bitrix24/b24icons-vue/outline/DragLIcon";
|
|
35
|
+
import GoToLIcon from "@bitrix24/b24icons-vue/outline/GoToLIcon";
|
|
35
36
|
export default {
|
|
36
37
|
arrowLeft: ArrowToTheLeftIcon,
|
|
37
38
|
arrowRight: ArrowToTheRightIcon,
|
|
@@ -44,7 +45,7 @@ export default {
|
|
|
44
45
|
chevronUp: ChevronTopLIcon,
|
|
45
46
|
close: CrossMIcon,
|
|
46
47
|
ellipsis: DotsIcon,
|
|
47
|
-
external:
|
|
48
|
+
external: GoToLIcon,
|
|
48
49
|
file: FileIcon,
|
|
49
50
|
loading: LoaderWaitIcon,
|
|
50
51
|
refresh: Refresh6Icon,
|
|
@@ -67,5 +68,6 @@ export default {
|
|
|
67
68
|
arrowDown: ArrowDownLIcon,
|
|
68
69
|
arrowUp: ArrowTopLIcon,
|
|
69
70
|
stop: StopLIcon,
|
|
70
|
-
reload: RefreshIcon
|
|
71
|
+
reload: RefreshIcon,
|
|
72
|
+
drag: DragLIcon
|
|
71
73
|
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { defineLocale } from "../composables/defineLocale.js";
|
|
2
|
+
export default defineLocale({
|
|
3
|
+
name: "Indian",
|
|
4
|
+
code: "in",
|
|
5
|
+
locale: "hi_IN",
|
|
6
|
+
messages: {
|
|
7
|
+
alert: {
|
|
8
|
+
close: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902"
|
|
9
|
+
},
|
|
10
|
+
authForm: {
|
|
11
|
+
hidePassword: "\u092A\u093E\u0938\u0935\u0930\u094D\u0921 \u091B\u093F\u092A\u093E\u090F\u0902",
|
|
12
|
+
showPassword: "\u092A\u093E\u0938\u0935\u0930\u094D\u0921 \u0926\u093F\u0916\u093E\u090F\u0902",
|
|
13
|
+
submit: "\u091C\u093E\u0930\u0940 \u0930\u0916\u0947\u0902"
|
|
14
|
+
},
|
|
15
|
+
banner: {
|
|
16
|
+
close: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902"
|
|
17
|
+
},
|
|
18
|
+
calendar: {
|
|
19
|
+
nextMonth: "\u0905\u0917\u0932\u093E \u092E\u0939\u0940\u0928\u093E",
|
|
20
|
+
nextYear: "\u0905\u0917\u0932\u093E \u0938\u093E\u0932",
|
|
21
|
+
prevMonth: "\u092A\u093F\u091B\u0932\u093E \u092E\u0939\u0940\u0928\u093E",
|
|
22
|
+
prevYear: "\u092A\u093F\u091B\u0932\u093E \u0938\u093E\u0932"
|
|
23
|
+
},
|
|
24
|
+
carousel: {
|
|
25
|
+
dots: "\u0926\u093F\u0916\u093E\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u0938\u094D\u0932\u093E\u0907\u0921 \u091A\u0941\u0928\u0947\u0902",
|
|
26
|
+
goto: "{slide} \u092A\u0930 \u091C\u093E\u090F\u0902",
|
|
27
|
+
next: "\u0905\u0917\u0932\u093E",
|
|
28
|
+
prev: "\u092A\u093F\u091B\u0932\u093E"
|
|
29
|
+
},
|
|
30
|
+
chatPrompt: {
|
|
31
|
+
placeholder: "\u0905\u092A\u0928\u093E \u0938\u0902\u0926\u0947\u0936 \u092F\u0939\u093E\u0901 \u0926\u0930\u094D\u091C \u0915\u0930\u0947\u0902..."
|
|
32
|
+
},
|
|
33
|
+
chatPromptSubmit: {
|
|
34
|
+
label: "\u092D\u0947\u091C\u0947\u0902"
|
|
35
|
+
},
|
|
36
|
+
colorMode: {
|
|
37
|
+
dark: "\u0921\u093E\u0930\u094D\u0915",
|
|
38
|
+
light: "\u0932\u093E\u0907\u091F",
|
|
39
|
+
switchToDark: "\u0921\u093E\u0930\u094D\u0915 \u092E\u094B\u0921 \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902",
|
|
40
|
+
switchToLight: "\u0932\u093E\u0907\u091F \u092E\u094B\u0921 \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902",
|
|
41
|
+
system: "\u0938\u093F\u0938\u094D\u091F\u092E"
|
|
42
|
+
},
|
|
43
|
+
commandPalette: {
|
|
44
|
+
back: "\u0935\u093E\u092A\u0938",
|
|
45
|
+
close: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
46
|
+
noData: "\u0915\u094B\u0908 \u0921\u0947\u091F\u093E \u0928\u0939\u0940\u0902",
|
|
47
|
+
noMatch: "\u0915\u094B\u0908 \u092E\u0948\u091A \u0928\u0939\u0940\u0902 \u092E\u093F\u0932\u093E",
|
|
48
|
+
placeholder: "\u0915\u092E\u093E\u0902\u0921 \u0926\u0930\u094D\u091C \u0915\u0930\u0947\u0902 \u092F\u093E \u0916\u094B\u091C\u0947\u0902..."
|
|
49
|
+
},
|
|
50
|
+
contentSearch: {
|
|
51
|
+
links: "\u092A\u0930\u093F\u0923\u093E\u092E",
|
|
52
|
+
theme: "\u0925\u0940\u092E"
|
|
53
|
+
},
|
|
54
|
+
contentSearchButton: {
|
|
55
|
+
label: "\u0916\u094B\u091C\u0947\u0902..."
|
|
56
|
+
},
|
|
57
|
+
contentToc: {
|
|
58
|
+
title: "\u0907\u0938 \u092A\u0947\u091C \u092A\u0930"
|
|
59
|
+
},
|
|
60
|
+
dashboardSearch: {
|
|
61
|
+
theme: "\u0925\u0940\u092E"
|
|
62
|
+
},
|
|
63
|
+
dashboardSearchButton: {
|
|
64
|
+
label: "\u0916\u094B\u091C\u0947\u0902..."
|
|
65
|
+
},
|
|
66
|
+
dashboardSidebarCollapse: {
|
|
67
|
+
collapse: "\u0938\u093E\u0907\u0921\u092C\u093E\u0930 \u0938\u0902\u0915\u0941\u091A\u093F\u0924 \u0915\u0930\u0947\u0902",
|
|
68
|
+
expand: "\u0938\u093E\u0907\u0921\u092C\u093E\u0930 \u0935\u093F\u0938\u094D\u0924\u0943\u0924 \u0915\u0930\u0947\u0902"
|
|
69
|
+
},
|
|
70
|
+
dashboardSidebarToggle: {
|
|
71
|
+
close: "\u0938\u093E\u0907\u0921\u092C\u093E\u0930 \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
72
|
+
open: "\u0938\u093E\u0907\u0921\u092C\u093E\u0930 \u0916\u094B\u0932\u0947\u0902"
|
|
73
|
+
},
|
|
74
|
+
error: {
|
|
75
|
+
clear: "\u092A\u0941\u0928\u0903 \u092A\u094D\u0930\u092F\u093E\u0938 \u0915\u0930\u0947\u0902"
|
|
76
|
+
},
|
|
77
|
+
fileUpload: {
|
|
78
|
+
removeFile: "{filename} \u0939\u091F\u093E\u090F\u0902"
|
|
79
|
+
},
|
|
80
|
+
header: {
|
|
81
|
+
close: "\u092E\u0947\u0928\u0942 \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
82
|
+
open: "\u092E\u0947\u0928\u0942 \u0916\u094B\u0932\u0947\u0902"
|
|
83
|
+
},
|
|
84
|
+
inputMenu: {
|
|
85
|
+
create: '"{label}" \u092C\u0928\u093E\u090F\u0902',
|
|
86
|
+
noData: "\u0915\u094B\u0908 \u0921\u0947\u091F\u093E \u0928\u0939\u0940\u0902",
|
|
87
|
+
noMatch: "\u0915\u094B\u0908 \u092E\u0948\u091A \u0928\u0939\u0940\u0902 \u092E\u093F\u0932\u093E"
|
|
88
|
+
},
|
|
89
|
+
inputNumber: {
|
|
90
|
+
decrement: "\u0918\u091F\u093E\u090F\u0902",
|
|
91
|
+
increment: "\u092C\u0922\u093C\u093E\u090F\u0902"
|
|
92
|
+
},
|
|
93
|
+
modal: {
|
|
94
|
+
close: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902"
|
|
95
|
+
},
|
|
96
|
+
pricingTable: {
|
|
97
|
+
caption: "\u092E\u0942\u0932\u094D\u092F \u0928\u093F\u0930\u094D\u0927\u093E\u0930\u0923 \u092F\u094B\u091C\u0928\u093E\u0913\u0902 \u0915\u0940 \u0924\u0941\u0932\u0928\u093E"
|
|
98
|
+
},
|
|
99
|
+
prose: {
|
|
100
|
+
codeCollapse: {
|
|
101
|
+
closeText: "\u091B\u093F\u092A\u093E\u090F\u0902",
|
|
102
|
+
name: "\u0915\u094B\u0921",
|
|
103
|
+
openText: "\u0926\u093F\u0916\u093E\u090F\u0902"
|
|
104
|
+
},
|
|
105
|
+
collapsible: {
|
|
106
|
+
closeText: "\u091B\u093F\u092A\u093E\u090F\u0902",
|
|
107
|
+
name: "\u0917\u0941\u0923",
|
|
108
|
+
openText: "\u0926\u093F\u0916\u093E\u090F\u0902"
|
|
109
|
+
},
|
|
110
|
+
pre: {
|
|
111
|
+
copy: "\u0915\u0949\u092A\u0940 \u0915\u0930\u0947\u0902"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
selectMenu: {
|
|
115
|
+
create: '"{label}" \u092C\u0928\u093E\u090F\u0902',
|
|
116
|
+
noData: "\u0915\u094B\u0908 \u0921\u0947\u091F\u093E \u0928\u0939\u0940\u0902",
|
|
117
|
+
noMatch: "\u0915\u094B\u0908 \u092E\u0948\u091A \u0928\u0939\u0940\u0902 \u092E\u093F\u0932\u093E",
|
|
118
|
+
search: "\u0916\u094B\u091C\u0947\u0902..."
|
|
119
|
+
},
|
|
120
|
+
slideover: {
|
|
121
|
+
close: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902"
|
|
122
|
+
},
|
|
123
|
+
table: {
|
|
124
|
+
noData: "\u0915\u094B\u0908 \u0921\u0947\u091F\u093E \u0928\u0939\u0940\u0902"
|
|
125
|
+
},
|
|
126
|
+
toast: {
|
|
127
|
+
close: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902"
|
|
128
|
+
},
|
|
129
|
+
sidebarLayout: {
|
|
130
|
+
open: "\u0928\u0947\u0935\u093F\u0917\u0947\u0936\u0928 \u0916\u094B\u0932\u0947\u0902",
|
|
131
|
+
close: "\u0928\u0947\u0935\u093F\u0917\u0947\u0936\u0928 \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
132
|
+
slideoverTitle: "\u0928\u0947\u0935\u093F\u0917\u0947\u0936\u0928",
|
|
133
|
+
slideoverDescription: "\u0938\u093E\u092E\u0917\u094D\u0930\u0940 \u0928\u0947\u0935\u093F\u0917\u0947\u0936\u0928"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|