完全跑通1.0版本
This commit is contained in:
9
frontend/node_modules/element-plus/es/components/mention/index.d.ts
generated
vendored
Normal file
9
frontend/node_modules/element-plus/es/components/mention/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { SFCWithInstall } from "../../utils/vue/typescript.js";
|
||||
import { MentionOption } from "./src/types.js";
|
||||
import { MentionEmits, MentionInstance, MentionOptionProps, MentionProps, MentionPropsPublic, mentionDefaultProps, mentionEmits, mentionProps } from "./src/mention.js";
|
||||
import _default from "./src/mention.vue.js";
|
||||
|
||||
//#region ../../packages/components/mention/index.d.ts
|
||||
declare const ElMention: SFCWithInstall<typeof _default>;
|
||||
//#endregion
|
||||
export { ElMention, ElMention as default, MentionEmits, MentionInstance, MentionOption, MentionOptionProps, MentionProps, MentionPropsPublic, mentionDefaultProps, mentionEmits, mentionProps };
|
||||
9
frontend/node_modules/element-plus/es/components/mention/index.mjs
generated
vendored
Normal file
9
frontend/node_modules/element-plus/es/components/mention/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { withInstall } from "../../utils/vue/install.mjs";
|
||||
import { mentionDefaultProps, mentionEmits, mentionProps } from "./src/mention.mjs";
|
||||
import mention_default from "./src/mention2.mjs";
|
||||
//#region ../../packages/components/mention/index.ts
|
||||
const ElMention = withInstall(mention_default);
|
||||
//#endregion
|
||||
export { ElMention, ElMention as default, mentionDefaultProps, mentionEmits, mentionProps };
|
||||
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","names":["Mention"],"sources":["../../../../../packages/components/mention/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Mention from './src/mention.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElMention: SFCWithInstall<typeof Mention> = withInstall(Mention)\nexport default ElMention\n\nexport * from './src/mention'\n"],"mappings":";;;;AAKA,MAAa,YAA4C,YAAYA,gBAAQ"}
|
||||
36
frontend/node_modules/element-plus/es/components/mention/src/helper.d.ts
generated
vendored
Normal file
36
frontend/node_modules/element-plus/es/components/mention/src/helper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { MentionCtx, MentionOption } from "./types.js";
|
||||
|
||||
//#region ../../packages/components/mention/src/helper.d.ts
|
||||
declare const filterOption: <T extends MentionOption = MentionOption>(pattern: string, option: T & MentionOption) => boolean;
|
||||
declare const getMentionCtx: (inputEl: HTMLInputElement | HTMLTextAreaElement, prefix: string | string[], split: string) => MentionCtx | undefined;
|
||||
/**
|
||||
* fork from textarea-caret-position
|
||||
* https://github.com/component/textarea-caret-position
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2015 Jonathan Ong me@jongleberry.com
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
declare const getCursorPosition: (element: HTMLInputElement | HTMLTextAreaElement, options?: {
|
||||
debug: boolean;
|
||||
useSelectionEnd: boolean;
|
||||
}) => {
|
||||
top: number;
|
||||
left: number;
|
||||
height: number;
|
||||
};
|
||||
//#endregion
|
||||
export { filterOption, getCursorPosition, getMentionCtx };
|
||||
147
frontend/node_modules/element-plus/es/components/mention/src/helper.mjs
generated
vendored
Normal file
147
frontend/node_modules/element-plus/es/components/mention/src/helper.mjs
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
import { isFirefox } from "../../../utils/browser.mjs";
|
||||
import { ensureArray } from "../../../utils/arrays.mjs";
|
||||
//#region ../../packages/components/mention/src/helper.ts
|
||||
const filterOption = (pattern, option) => {
|
||||
const lowerCase = pattern.toLowerCase();
|
||||
return (option.label || option.value || "").toLowerCase().includes(lowerCase);
|
||||
};
|
||||
const getMentionCtx = (inputEl, prefix, split) => {
|
||||
const { selectionEnd } = inputEl;
|
||||
if (selectionEnd === null) return;
|
||||
const inputValue = inputEl.value;
|
||||
const prefixArray = ensureArray(prefix);
|
||||
let splitIndex = -1;
|
||||
let mentionCtx;
|
||||
for (let i = selectionEnd - 1; i >= 0; --i) {
|
||||
const char = inputValue[i];
|
||||
if (splitIndex === -1 && (char === split || char === "\n" || char === "\r")) {
|
||||
splitIndex = i;
|
||||
continue;
|
||||
}
|
||||
if (prefixArray.includes(char)) {
|
||||
const end = splitIndex === -1 ? selectionEnd : splitIndex;
|
||||
mentionCtx = {
|
||||
pattern: inputValue.slice(i + 1, end),
|
||||
start: i + 1,
|
||||
end,
|
||||
prefix: char,
|
||||
prefixIndex: i,
|
||||
splitIndex,
|
||||
selectionEnd
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mentionCtx;
|
||||
};
|
||||
/**
|
||||
* fork from textarea-caret-position
|
||||
* https://github.com/component/textarea-caret-position
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2015 Jonathan Ong me@jongleberry.com
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
const getCursorPosition = (element, options = {
|
||||
debug: false,
|
||||
useSelectionEnd: false
|
||||
}) => {
|
||||
const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
|
||||
const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
|
||||
const position = options.useSelectionEnd ? selectionEnd : selectionStart;
|
||||
const properties = [
|
||||
"direction",
|
||||
"boxSizing",
|
||||
"width",
|
||||
"height",
|
||||
"overflowX",
|
||||
"overflowY",
|
||||
"borderTopWidth",
|
||||
"borderRightWidth",
|
||||
"borderBottomWidth",
|
||||
"borderLeftWidth",
|
||||
"borderStyle",
|
||||
"paddingTop",
|
||||
"paddingRight",
|
||||
"paddingBottom",
|
||||
"paddingLeft",
|
||||
"fontStyle",
|
||||
"fontVariant",
|
||||
"fontWeight",
|
||||
"fontStretch",
|
||||
"fontSize",
|
||||
"fontSizeAdjust",
|
||||
"lineHeight",
|
||||
"fontFamily",
|
||||
"textAlign",
|
||||
"textTransform",
|
||||
"textIndent",
|
||||
"textDecoration",
|
||||
"letterSpacing",
|
||||
"wordSpacing",
|
||||
"tabSize",
|
||||
"MozTabSize"
|
||||
];
|
||||
if (options.debug) {
|
||||
const el = document.querySelector("#input-textarea-caret-position-mirror-div");
|
||||
if (el?.parentNode) el.parentNode.removeChild(el);
|
||||
}
|
||||
const div = document.createElement("div");
|
||||
div.id = "input-textarea-caret-position-mirror-div";
|
||||
document.body.appendChild(div);
|
||||
const style = div.style;
|
||||
const computed = window.getComputedStyle(element);
|
||||
const isInput = element.nodeName === "INPUT";
|
||||
style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
|
||||
if (!isInput) style.wordWrap = "break-word";
|
||||
style.position = "absolute";
|
||||
if (!options.debug) style.visibility = "hidden";
|
||||
properties.forEach((prop) => {
|
||||
if (isInput && prop === "lineHeight") if (computed.boxSizing === "border-box") {
|
||||
const height = Number.parseInt(computed.height);
|
||||
const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
|
||||
const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
|
||||
if (height > targetHeight) style.lineHeight = `${height - outerHeight}px`;
|
||||
else if (height === targetHeight) style.lineHeight = computed.lineHeight;
|
||||
else style.lineHeight = "0";
|
||||
} else style.lineHeight = computed.height;
|
||||
else style[prop] = computed[prop];
|
||||
});
|
||||
if (isFirefox()) {
|
||||
if (element.scrollHeight > Number.parseInt(computed.height)) style.overflowY = "scroll";
|
||||
} else style.overflow = "hidden";
|
||||
div.textContent = element.value.slice(0, Math.max(0, position));
|
||||
if (isInput && div.textContent) div.textContent = div.textContent.replace(/\s/g, "\xA0");
|
||||
const span = document.createElement("span");
|
||||
span.textContent = element.value.slice(Math.max(0, position)) || ".";
|
||||
span.style.position = "relative";
|
||||
span.style.left = `${-element.scrollLeft}px`;
|
||||
span.style.top = `${-element.scrollTop}px`;
|
||||
div.appendChild(span);
|
||||
const relativePosition = {
|
||||
top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
|
||||
left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
|
||||
height: Number.parseInt(computed.fontSize) * 1.5
|
||||
};
|
||||
if (options.debug) span.style.backgroundColor = "#aaa";
|
||||
else document.body.removeChild(div);
|
||||
if (relativePosition.left >= element.clientWidth) relativePosition.left = element.clientWidth;
|
||||
return relativePosition;
|
||||
};
|
||||
//#endregion
|
||||
export { filterOption, getCursorPosition, getMentionCtx };
|
||||
|
||||
//# sourceMappingURL=helper.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/helper.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/helper.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.d.ts
generated
vendored
Normal file
26
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
|
||||
import { MentionOption } from "./types.js";
|
||||
|
||||
//#region ../../packages/components/mention/src/mention-dropdown.d.ts
|
||||
interface MentionDropdownProps {
|
||||
options?: MentionOption[];
|
||||
loading?: boolean;
|
||||
disabled?: boolean;
|
||||
contentId?: string;
|
||||
ariaLabel?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `MentionDropdownProps` instead.
|
||||
*/
|
||||
declare const mentionDropdownProps: {
|
||||
options: EpPropFinalized<(new (...args: any[]) => MentionOption[]) | (() => MentionOption[]) | (((new (...args: any[]) => MentionOption[]) | (() => MentionOption[])) | null)[], unknown, unknown, () => never[], boolean>;
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
contentId: StringConstructor;
|
||||
ariaLabel: StringConstructor;
|
||||
};
|
||||
declare const mentionDropdownEmits: {
|
||||
select: (option: MentionOption) => boolean;
|
||||
};
|
||||
//#endregion
|
||||
export { MentionDropdownProps, mentionDropdownEmits, mentionDropdownProps };
|
||||
21
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.mjs
generated
vendored
Normal file
21
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { isString } from "../../../utils/types.mjs";
|
||||
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
|
||||
//#region ../../packages/components/mention/src/mention-dropdown.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `MentionDropdownProps` instead.
|
||||
*/
|
||||
const mentionDropdownProps = buildProps({
|
||||
options: {
|
||||
type: definePropType(Array),
|
||||
default: () => []
|
||||
},
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
contentId: String,
|
||||
ariaLabel: String
|
||||
});
|
||||
const mentionDropdownEmits = { select: (option) => isString(option.value) };
|
||||
//#endregion
|
||||
export { mentionDropdownEmits, mentionDropdownProps };
|
||||
|
||||
//# sourceMappingURL=mention-dropdown.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mention-dropdown.mjs","names":[],"sources":["../../../../../../packages/components/mention/src/mention-dropdown.ts"],"sourcesContent":["import { buildProps, definePropType, isString } from '@element-plus/utils'\n\nimport type { MentionOption } from './types'\n\nexport interface MentionDropdownProps {\n options?: MentionOption[]\n loading?: boolean\n disabled?: boolean\n contentId?: string\n ariaLabel?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `MentionDropdownProps` instead.\n */\nexport const mentionDropdownProps = buildProps({\n options: {\n type: definePropType<MentionOption[]>(Array),\n default: () => [],\n },\n loading: Boolean,\n disabled: Boolean,\n contentId: String,\n ariaLabel: String,\n})\n\nexport const mentionDropdownEmits = {\n select: (option: MentionOption) => isString(option.value),\n}\n"],"mappings":";;;;;;AAeA,MAAa,uBAAuB,WAAW;CAC7C,SAAS;EACP,MAAM,eAAgC,MAAM;EAC5C,eAAe,EAAE;EAClB;CACD,SAAS;CACT,UAAU;CACV,WAAW;CACX,WAAW;CACZ,CAAC;AAEF,MAAa,uBAAuB,EAClC,SAAS,WAA0B,SAAS,OAAO,MAAM,EAC1D"}
|
||||
39
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.vue.d.ts
generated
vendored
Normal file
39
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { MentionOption } from "./types.js";
|
||||
import { MentionDropdownProps } from "./mention-dropdown.js";
|
||||
import * as _$vue from "vue";
|
||||
|
||||
//#region ../../packages/components/mention/src/mention-dropdown.vue.d.ts
|
||||
declare var __VLS_1: {}, __VLS_11: {
|
||||
item: MentionOption;
|
||||
index: number;
|
||||
}, __VLS_13: {}, __VLS_15: {};
|
||||
type __VLS_Slots = {} & {
|
||||
header?: (props: typeof __VLS_1) => any;
|
||||
} & {
|
||||
label?: (props: typeof __VLS_11) => any;
|
||||
} & {
|
||||
loading?: (props: typeof __VLS_13) => any;
|
||||
} & {
|
||||
footer?: (props: typeof __VLS_15) => any;
|
||||
};
|
||||
declare const __VLS_base: _$vue.DefineComponent<MentionDropdownProps, {
|
||||
hoveringIndex: _$vue.Ref<number, number>;
|
||||
navigateOptions: (direction: "next" | "prev") => void;
|
||||
selectHoverOption: () => void;
|
||||
hoverOption: _$vue.ComputedRef<MentionOption>;
|
||||
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
|
||||
select: (option: MentionOption) => void;
|
||||
}, string, _$vue.PublicProps, Readonly<MentionDropdownProps> & Readonly<{
|
||||
onSelect?: ((option: MentionOption) => any) | undefined;
|
||||
}>, {
|
||||
options: MentionOption[];
|
||||
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
|
||||
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
||||
declare const _default: typeof __VLS_export;
|
||||
type __VLS_WithSlots<T, S> = T & {
|
||||
new (): {
|
||||
$slots: S;
|
||||
};
|
||||
};
|
||||
//#endregion
|
||||
export { _default as default };
|
||||
146
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
146
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
import { scrollIntoView } from "../../../utils/dom/scroll.mjs";
|
||||
import { useLocale } from "../../../hooks/use-locale/index.mjs";
|
||||
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
|
||||
import { ElScrollbar } from "../../scrollbar/index.mjs";
|
||||
import { mentionDropdownEmits, mentionDropdownProps } from "./mention-dropdown.mjs";
|
||||
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, unref, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
|
||||
//#region ../../packages/components/mention/src/mention-dropdown.vue?vue&type=script&setup=true&lang.ts
|
||||
const _hoisted_1 = [
|
||||
"id",
|
||||
"aria-disabled",
|
||||
"aria-selected",
|
||||
"onMousemove",
|
||||
"onClick"
|
||||
];
|
||||
var mention_dropdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
||||
name: "ElMentionDropdown",
|
||||
__name: "mention-dropdown",
|
||||
props: mentionDropdownProps,
|
||||
emits: mentionDropdownEmits,
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const ns = useNamespace("mention");
|
||||
const { t } = useLocale();
|
||||
const hoveringIndex = ref(-1);
|
||||
const scrollbarRef = ref();
|
||||
const optionRefs = ref();
|
||||
const dropdownRef = ref();
|
||||
const optionkls = (item, index) => [
|
||||
ns.be("dropdown", "item"),
|
||||
ns.is("hovering", hoveringIndex.value === index),
|
||||
ns.is("disabled", item.disabled || props.disabled)
|
||||
];
|
||||
const handleSelect = (item) => {
|
||||
if (item.disabled || props.disabled) return;
|
||||
emit("select", item);
|
||||
};
|
||||
const handleMouseEnter = (index) => {
|
||||
hoveringIndex.value = index;
|
||||
};
|
||||
const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
|
||||
const hoverOption = computed(() => props.options[hoveringIndex.value]);
|
||||
const selectHoverOption = () => {
|
||||
if (!hoverOption.value || hoverOption.value.disabled || props.disabled) return;
|
||||
emit("select", hoverOption.value);
|
||||
};
|
||||
const navigateOptions = (direction) => {
|
||||
const { options } = props;
|
||||
if (options.length === 0 || filteredAllDisabled.value) return;
|
||||
if (direction === "next") {
|
||||
hoveringIndex.value++;
|
||||
if (hoveringIndex.value === options.length) hoveringIndex.value = 0;
|
||||
} else if (direction === "prev") {
|
||||
hoveringIndex.value--;
|
||||
if (hoveringIndex.value < 0) hoveringIndex.value = options.length - 1;
|
||||
}
|
||||
const option = options[hoveringIndex.value];
|
||||
if (option.disabled) {
|
||||
navigateOptions(direction);
|
||||
return;
|
||||
}
|
||||
nextTick(() => scrollToOption(option));
|
||||
};
|
||||
const scrollToOption = (option) => {
|
||||
const { options } = props;
|
||||
const index = options.findIndex((item) => item.value === option.value);
|
||||
const target = optionRefs.value?.[index];
|
||||
if (target) {
|
||||
const menu = dropdownRef.value?.querySelector?.(`.${ns.be("dropdown", "wrap")}`);
|
||||
if (menu) scrollIntoView(menu, target);
|
||||
}
|
||||
scrollbarRef.value?.handleScroll();
|
||||
};
|
||||
const resetHoveringIndex = () => {
|
||||
if (filteredAllDisabled.value || props.options.length === 0) hoveringIndex.value = -1;
|
||||
else hoveringIndex.value = props.options.findIndex((item) => !item.disabled);
|
||||
};
|
||||
watch(() => props.options, resetHoveringIndex, { immediate: true });
|
||||
__expose({
|
||||
hoveringIndex,
|
||||
navigateOptions,
|
||||
selectHoverOption,
|
||||
hoverOption
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
ref_key: "dropdownRef",
|
||||
ref: dropdownRef,
|
||||
class: normalizeClass(unref(ns).b("dropdown"))
|
||||
}, [
|
||||
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
||||
key: 0,
|
||||
class: normalizeClass(unref(ns).be("dropdown", "header"))
|
||||
}, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
|
||||
withDirectives(createVNode(unref(ElScrollbar), {
|
||||
id: __props.contentId,
|
||||
ref_key: "scrollbarRef",
|
||||
ref: scrollbarRef,
|
||||
tag: "ul",
|
||||
"wrap-class": unref(ns).be("dropdown", "wrap"),
|
||||
"view-class": unref(ns).be("dropdown", "list"),
|
||||
role: "listbox",
|
||||
"aria-label": __props.ariaLabel,
|
||||
"aria-orientation": "vertical"
|
||||
}, {
|
||||
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
|
||||
return openBlock(), createElementBlock("li", {
|
||||
id: `${__props.contentId}-${index}`,
|
||||
ref_for: true,
|
||||
ref_key: "optionRefs",
|
||||
ref: optionRefs,
|
||||
key: index,
|
||||
class: normalizeClass(optionkls(item, index)),
|
||||
role: "option",
|
||||
"aria-disabled": item.disabled || __props.disabled || void 0,
|
||||
"aria-selected": hoveringIndex.value === index,
|
||||
onMousemove: ($event) => handleMouseEnter(index),
|
||||
onClick: withModifiers(($event) => handleSelect(item), ["stop"])
|
||||
}, [renderSlot(_ctx.$slots, "label", {
|
||||
item,
|
||||
index
|
||||
}, () => [createElementVNode("span", null, toDisplayString(item.label ?? item.value), 1)])], 42, _hoisted_1);
|
||||
}), 128))]),
|
||||
_: 3
|
||||
}, 8, [
|
||||
"id",
|
||||
"wrap-class",
|
||||
"view-class",
|
||||
"aria-label"
|
||||
]), [[vShow, __props.options.length > 0 && !__props.loading]]),
|
||||
__props.loading ? (openBlock(), createElementBlock("div", {
|
||||
key: 1,
|
||||
class: normalizeClass(unref(ns).be("dropdown", "loading"))
|
||||
}, [renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)])], 2)) : createCommentVNode("v-if", true),
|
||||
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
|
||||
key: 2,
|
||||
class: normalizeClass(unref(ns).be("dropdown", "footer"))
|
||||
}, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
|
||||
], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
export { mention_dropdown_vue_vue_type_script_setup_true_lang_default as default };
|
||||
|
||||
//# sourceMappingURL=mention-dropdown.vue_vue_type_script_setup_true_lang.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown2.mjs
generated
vendored
Normal file
7
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown2.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import mention_dropdown_vue_vue_type_script_setup_true_lang_default from "./mention-dropdown.vue_vue_type_script_setup_true_lang.mjs";
|
||||
//#region ../../packages/components/mention/src/mention-dropdown.vue
|
||||
var mention_dropdown_default = mention_dropdown_vue_vue_type_script_setup_true_lang_default;
|
||||
//#endregion
|
||||
export { mention_dropdown_default as default };
|
||||
|
||||
//# sourceMappingURL=mention-dropdown2.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown2.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/mention-dropdown2.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mention-dropdown2.mjs","names":[],"sources":["../../../../../../packages/components/mention/src/mention-dropdown.vue"],"sourcesContent":["<template>\n <div ref=\"dropdownRef\" :class=\"ns.b('dropdown')\">\n <div v-if=\"$slots.header\" :class=\"ns.be('dropdown', 'header')\">\n <slot name=\"header\" />\n </div>\n <el-scrollbar\n v-show=\"options.length > 0 && !loading\"\n :id=\"contentId\"\n ref=\"scrollbarRef\"\n tag=\"ul\"\n :wrap-class=\"ns.be('dropdown', 'wrap')\"\n :view-class=\"ns.be('dropdown', 'list')\"\n role=\"listbox\"\n :aria-label=\"ariaLabel\"\n aria-orientation=\"vertical\"\n >\n <li\n v-for=\"(item, index) in options\"\n :id=\"`${contentId}-${index}`\"\n ref=\"optionRefs\"\n :key=\"index\"\n :class=\"optionkls(item, index)\"\n role=\"option\"\n :aria-disabled=\"item.disabled || disabled || undefined\"\n :aria-selected=\"hoveringIndex === index\"\n @mousemove=\"handleMouseEnter(index)\"\n @click.stop=\"handleSelect(item)\"\n >\n <slot name=\"label\" :item=\"item\" :index=\"index\">\n <span>{{ item.label ?? item.value }}</span>\n </slot>\n </li>\n </el-scrollbar>\n <div v-if=\"loading\" :class=\"ns.be('dropdown', 'loading')\">\n <slot name=\"loading\"> {{ t('el.mention.loading') }} </slot>\n </div>\n <div v-if=\"$slots.footer\" :class=\"ns.be('dropdown', 'footer')\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { scrollIntoView } from '@element-plus/utils'\nimport ElScrollbar from '@element-plus/components/scrollbar'\nimport { mentionDropdownEmits } from './mention-dropdown'\n\nimport type { MentionDropdownProps } from './mention-dropdown'\nimport type { MentionOption } from './types'\n\ndefineOptions({\n name: 'ElMentionDropdown',\n})\n\nconst props = withDefaults(defineProps<MentionDropdownProps>(), {\n options: () => [],\n})\nconst emit = defineEmits(mentionDropdownEmits)\n\nconst ns = useNamespace('mention')\nconst { t } = useLocale()\nconst hoveringIndex = ref(-1)\n\nconst scrollbarRef = ref<InstanceType<typeof ElScrollbar>>()\nconst optionRefs = ref<HTMLElement[]>()\nconst dropdownRef = ref<HTMLElement>()\n\nconst optionkls = (item: MentionOption, index: number) => [\n ns.be('dropdown', 'item'),\n ns.is('hovering', hoveringIndex.value === index),\n ns.is('disabled', item.disabled || props.disabled),\n]\n\nconst handleSelect = (item: MentionOption) => {\n if (item.disabled || props.disabled) return\n emit('select', item)\n}\n\nconst handleMouseEnter = (index: number) => {\n hoveringIndex.value = index\n}\n\nconst filteredAllDisabled = computed(\n () => props.disabled || props.options.every((item) => item.disabled)\n)\n\nconst hoverOption = computed(() => props.options[hoveringIndex.value])\n\nconst selectHoverOption = () => {\n if (!hoverOption.value || hoverOption.value.disabled || props.disabled) return\n emit('select', hoverOption.value)\n}\n\nconst navigateOptions = (direction: 'next' | 'prev') => {\n const { options } = props\n if (options.length === 0 || filteredAllDisabled.value) return\n\n if (direction === 'next') {\n hoveringIndex.value++\n if (hoveringIndex.value === options.length) {\n hoveringIndex.value = 0\n }\n } else if (direction === 'prev') {\n hoveringIndex.value--\n if (hoveringIndex.value < 0) {\n hoveringIndex.value = options.length - 1\n }\n }\n const option = options[hoveringIndex.value]\n if (option.disabled) {\n navigateOptions(direction)\n return\n }\n nextTick(() => scrollToOption(option))\n}\n\nconst scrollToOption = (option: MentionOption) => {\n const { options } = props\n\n const index = options.findIndex((item) => item.value === option.value)\n const target = optionRefs.value?.[index]\n\n if (target) {\n const menu = dropdownRef.value?.querySelector?.(\n `.${ns.be('dropdown', 'wrap')}`\n )\n if (menu) {\n scrollIntoView(menu as HTMLElement, target)\n }\n }\n scrollbarRef.value?.handleScroll()\n}\n\nconst resetHoveringIndex = () => {\n if (filteredAllDisabled.value || props.options.length === 0) {\n hoveringIndex.value = -1\n } else {\n hoveringIndex.value = props.options.findIndex((item) => !item.disabled)\n }\n}\n\nwatch(() => props.options, resetHoveringIndex, {\n immediate: true,\n})\n\ndefineExpose({\n hoveringIndex,\n navigateOptions,\n selectHoverOption,\n hoverOption,\n})\n</script>\n"],"mappings":""}
|
||||
318
frontend/node_modules/element-plus/es/components/mention/src/mention.d.ts
generated
vendored
Normal file
318
frontend/node_modules/element-plus/es/components/mention/src/mention.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
124
frontend/node_modules/element-plus/es/components/mention/src/mention.mjs
generated
vendored
Normal file
124
frontend/node_modules/element-plus/es/components/mention/src/mention.mjs
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
import { UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
|
||||
import { isFunction, isObject, isString } from "../../../utils/types.mjs";
|
||||
import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
|
||||
import { useTooltipContentProps } from "../../tooltip/src/content.mjs";
|
||||
import { inputProps } from "../../input/src/input.mjs";
|
||||
import { filterOption } from "./helper.mjs";
|
||||
//#region ../../packages/components/mention/src/mention.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `MentionProps` instead.
|
||||
*/
|
||||
const mentionProps = buildProps({
|
||||
...inputProps,
|
||||
/**
|
||||
* @description mention options list
|
||||
*/
|
||||
options: {
|
||||
type: definePropType(Array),
|
||||
default: () => []
|
||||
},
|
||||
/**
|
||||
* @description prefix character to trigger mentions. The string length must be exactly 1.
|
||||
*/
|
||||
prefix: {
|
||||
type: definePropType([String, Array]),
|
||||
default: "@",
|
||||
validator: (val) => {
|
||||
if (isString(val)) return val.length === 1;
|
||||
return val.every((v) => isString(v) && v.length === 1);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description character to split mentions. The string length must be exactly 1.
|
||||
*/
|
||||
split: {
|
||||
type: String,
|
||||
default: " ",
|
||||
validator: (val) => val.length === 1
|
||||
},
|
||||
/**
|
||||
* @description customize filter option logic.
|
||||
*/
|
||||
filterOption: {
|
||||
type: definePropType([Boolean, Function]),
|
||||
default: () => filterOption,
|
||||
validator: (val) => {
|
||||
if (val === false) return true;
|
||||
return isFunction(val);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description set popup placement
|
||||
*/
|
||||
placement: {
|
||||
type: definePropType(String),
|
||||
default: "bottom"
|
||||
},
|
||||
/**
|
||||
* @description whether the dropdown panel has an arrow
|
||||
*/
|
||||
showArrow: Boolean,
|
||||
/**
|
||||
* @description offset of the dropdown panel
|
||||
*/
|
||||
offset: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
/**
|
||||
* @description when backspace is pressed to delete, whether the mention content is deleted as a whole
|
||||
*/
|
||||
whole: Boolean,
|
||||
/**
|
||||
* @description when backspace is pressed to delete, check if the mention is a whole
|
||||
*/
|
||||
checkIsWhole: { type: definePropType(Function) },
|
||||
/**
|
||||
* @description input value
|
||||
*/
|
||||
modelValue: String,
|
||||
/**
|
||||
* @description whether the dropdown panel of mentions is in a loading state.
|
||||
*/
|
||||
loading: Boolean,
|
||||
/**
|
||||
* @description custom class name for dropdown panel
|
||||
*/
|
||||
popperClass: useTooltipContentProps.popperClass,
|
||||
/**
|
||||
* @description custom style for dropdown panel
|
||||
*/
|
||||
popperStyle: useTooltipContentProps.popperStyle,
|
||||
/**
|
||||
* @description [popper.js](https://popper.js.org/docs/v2/) parameters
|
||||
*/
|
||||
popperOptions: {
|
||||
type: definePropType(Object),
|
||||
default: () => ({})
|
||||
},
|
||||
/**
|
||||
* @description configuration options
|
||||
*/
|
||||
props: {
|
||||
type: definePropType(Object),
|
||||
default: () => mentionDefaultProps
|
||||
}
|
||||
});
|
||||
const mentionEmits = {
|
||||
[UPDATE_MODEL_EVENT]: (value) => isString(value),
|
||||
"whole-remove": (pattern, prefix) => isString(pattern) && isString(prefix),
|
||||
input: (value) => isString(value),
|
||||
search: (pattern, prefix) => isString(pattern) && isString(prefix),
|
||||
select: (option, prefix) => isObject(option) && isString(prefix),
|
||||
focus: (evt) => evt instanceof FocusEvent,
|
||||
blur: (evt) => evt instanceof FocusEvent
|
||||
};
|
||||
const mentionDefaultProps = {
|
||||
value: "value",
|
||||
label: "label",
|
||||
disabled: "disabled"
|
||||
};
|
||||
//#endregion
|
||||
export { mentionDefaultProps, mentionEmits, mentionProps };
|
||||
|
||||
//# sourceMappingURL=mention.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/mention.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/mention.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
56
frontend/node_modules/element-plus/es/components/mention/src/mention.vue.d.ts
generated
vendored
Normal file
56
frontend/node_modules/element-plus/es/components/mention/src/mention.vue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import { InputInstance } from "../../input/src/instance.js";
|
||||
import { TooltipInstance } from "../../tooltip/src/tooltip.js";
|
||||
import { MentionOption } from "./types.js";
|
||||
import { MentionProps } from "./mention.js";
|
||||
import * as _$vue from "vue";
|
||||
|
||||
//#region ../../packages/components/mention/src/mention.vue.d.ts
|
||||
declare const __VLS_export: <T extends MentionOption = MentionOption>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
||||
props: _$vue.PublicProps & __VLS_PrettifyLocal<MentionProps<T> & {
|
||||
onSelect?: ((option: MentionOption, prefix: string) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
||||
onInput?: ((value: string) => any) | undefined;
|
||||
onFocus?: ((evt: FocusEvent) => any) | undefined;
|
||||
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
||||
onSearch?: ((pattern: string, prefix: string) => any) | undefined;
|
||||
"onWhole-remove"?: ((pattern: string, prefix: string) => any) | undefined;
|
||||
}> & (typeof globalThis extends {
|
||||
__VLS_PROPS_FALLBACK: infer P;
|
||||
} ? P : {});
|
||||
expose: (exposed: _$vue.ShallowUnwrapRef<{
|
||||
input: _$vue.Ref<InputInstance | undefined, InputInstance | undefined>;
|
||||
tooltip: _$vue.Ref<TooltipInstance | undefined, TooltipInstance | undefined>;
|
||||
dropdownVisible: _$vue.ComputedRef<boolean>;
|
||||
}>) => void;
|
||||
attrs: any;
|
||||
slots: Readonly<{
|
||||
[name: string]: _$vue.Slot<any> | undefined;
|
||||
}> & {
|
||||
prepend?: (props: {}) => any;
|
||||
} & {
|
||||
prefix?: (props: {}) => any;
|
||||
} & {
|
||||
suffix?: (props: {}) => any;
|
||||
} & {
|
||||
'password-icon'?: (props: {
|
||||
visible: boolean;
|
||||
}) => any;
|
||||
} & {
|
||||
append?: (props: {}) => any;
|
||||
} & {
|
||||
header?: () => any;
|
||||
footer?: () => any;
|
||||
loading?: () => any;
|
||||
label?: (props: {
|
||||
item: T & MentionOption;
|
||||
index: number;
|
||||
}) => any;
|
||||
};
|
||||
emit: ((event: "select", option: MentionOption, prefix: string) => void) & ((event: "update:modelValue", value: string) => void) & ((event: "input", value: string) => void) & ((event: "focus", evt: FocusEvent) => void) & ((event: "blur", evt: FocusEvent) => void) & ((event: "search", pattern: string, prefix: string) => void) & ((event: "whole-remove", pattern: string, prefix: string) => void);
|
||||
}>) => _$vue.VNode & {
|
||||
__ctx?: Awaited<typeof __VLS_setup>;
|
||||
};
|
||||
declare const _default: typeof __VLS_export;
|
||||
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
|
||||
//#endregion
|
||||
export { _default as default };
|
||||
296
frontend/node_modules/element-plus/es/components/mention/src/mention.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
296
frontend/node_modules/element-plus/es/components/mention/src/mention.vue_vue_type_script_setup_true_lang.mjs
generated
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
import { EVENT_CODE } from "../../../constants/aria.mjs";
|
||||
import { INPUT_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.mjs";
|
||||
import { getEventCode } from "../../../utils/dom/event.mjs";
|
||||
import { isArray, isFunction } from "../../../utils/types.mjs";
|
||||
import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
|
||||
import { useId } from "../../../hooks/use-id/index.mjs";
|
||||
import { useFocusController } from "../../../hooks/use-focus-controller/index.mjs";
|
||||
import { useFormDisabled } from "../../form/src/hooks/use-form-common-props.mjs";
|
||||
import { ElTooltip } from "../../tooltip/index.mjs";
|
||||
import { ElInput } from "../../input/index.mjs";
|
||||
import { getCursorPosition, getMentionCtx } from "./helper.mjs";
|
||||
import { mentionDefaultProps, mentionEmits, mentionProps } from "./mention.mjs";
|
||||
import mention_dropdown_default from "./mention-dropdown2.mjs";
|
||||
import { pick } from "lodash-unified";
|
||||
import { computed, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, guardReactiveProps, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, openBlock, ref, renderList, renderSlot, unref, withCtx, withModifiers } from "vue";
|
||||
//#region ../../packages/components/mention/src/mention.vue?vue&type=script&setup=true&lang.ts
|
||||
var mention_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
||||
name: "ElMention",
|
||||
inheritAttrs: false,
|
||||
__name: "mention",
|
||||
props: mentionProps,
|
||||
emits: mentionEmits,
|
||||
setup(__props, { expose: __expose, emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const passInputProps = computed(() => {
|
||||
const inputProps = ElInput.props ?? [];
|
||||
return pick(props, isArray(inputProps) ? inputProps : Object.keys(inputProps));
|
||||
});
|
||||
const ns = useNamespace("mention");
|
||||
const disabled = useFormDisabled();
|
||||
const contentId = useId();
|
||||
const elInputRef = ref();
|
||||
const tooltipRef = ref();
|
||||
const dropdownRef = ref();
|
||||
const visible = ref(false);
|
||||
const cursorStyle = ref();
|
||||
const mentionCtx = ref();
|
||||
const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
|
||||
const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
|
||||
const aliasProps = computed(() => ({
|
||||
...mentionDefaultProps,
|
||||
...props.props
|
||||
}));
|
||||
const mapOption = (option) => {
|
||||
const base = {
|
||||
label: option[aliasProps.value.label],
|
||||
value: option[aliasProps.value.value],
|
||||
disabled: option[aliasProps.value.disabled]
|
||||
};
|
||||
return {
|
||||
...option,
|
||||
...base
|
||||
};
|
||||
};
|
||||
const options = computed(() => props.options.map(mapOption));
|
||||
const filteredOptions = computed(() => {
|
||||
const { filterOption } = props;
|
||||
if (!mentionCtx.value || !filterOption) return options.value;
|
||||
return options.value.filter((option) => filterOption(mentionCtx.value.pattern, option));
|
||||
});
|
||||
const dropdownVisible = computed(() => {
|
||||
return visible.value && (!!filteredOptions.value.length || props.loading);
|
||||
});
|
||||
const hoveringId = computed(() => {
|
||||
return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`;
|
||||
});
|
||||
const handleInputChange = (value) => {
|
||||
emit(UPDATE_MODEL_EVENT, value);
|
||||
emit(INPUT_EVENT, value);
|
||||
syncAfterCursorMove();
|
||||
};
|
||||
const handleInputKeyDown = (event) => {
|
||||
if (elInputRef.value?.isComposing) return;
|
||||
const code = getEventCode(event);
|
||||
switch (code) {
|
||||
case EVENT_CODE.left:
|
||||
case EVENT_CODE.right:
|
||||
syncAfterCursorMove();
|
||||
break;
|
||||
case EVENT_CODE.up:
|
||||
case EVENT_CODE.down:
|
||||
if (!visible.value) return;
|
||||
event.preventDefault();
|
||||
dropdownRef.value?.navigateOptions(code === EVENT_CODE.up ? "prev" : "next");
|
||||
break;
|
||||
case EVENT_CODE.enter:
|
||||
case EVENT_CODE.numpadEnter:
|
||||
if (!visible.value) {
|
||||
props.type !== "textarea" && syncAfterCursorMove();
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
if (dropdownRef.value?.hoverOption) dropdownRef.value?.selectHoverOption();
|
||||
else visible.value = false;
|
||||
break;
|
||||
case EVENT_CODE.esc:
|
||||
if (!visible.value) return;
|
||||
event.preventDefault();
|
||||
visible.value = false;
|
||||
break;
|
||||
case EVENT_CODE.backspace: if (props.whole && mentionCtx.value) {
|
||||
const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
|
||||
const inputEl = getInputEl();
|
||||
if (!inputEl) return;
|
||||
const inputValue = inputEl.value;
|
||||
const matchOption = options.value.find((item) => item.value === pattern);
|
||||
if ((isFunction(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption) && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
|
||||
event.preventDefault();
|
||||
const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
|
||||
emit(UPDATE_MODEL_EVENT, newValue);
|
||||
emit(INPUT_EVENT, newValue);
|
||||
emit("whole-remove", pattern, prefix);
|
||||
const newSelectionEnd = prefixIndex;
|
||||
nextTick(() => {
|
||||
inputEl.selectionStart = newSelectionEnd;
|
||||
inputEl.selectionEnd = newSelectionEnd;
|
||||
syncDropdownVisible();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const { wrapperRef } = useFocusController(elInputRef, {
|
||||
disabled,
|
||||
afterFocus() {
|
||||
syncAfterCursorMove();
|
||||
},
|
||||
beforeBlur(event) {
|
||||
return tooltipRef.value?.isFocusInsideContent(event);
|
||||
},
|
||||
afterBlur() {
|
||||
visible.value = false;
|
||||
}
|
||||
});
|
||||
const handleInputMouseDown = () => {
|
||||
syncAfterCursorMove();
|
||||
};
|
||||
const getOriginalOption = (mentionOption) => {
|
||||
return props.options.find((option) => {
|
||||
return mentionOption.value === option[aliasProps.value.value];
|
||||
});
|
||||
};
|
||||
const handleSelect = (item) => {
|
||||
if (!mentionCtx.value) return;
|
||||
const inputEl = getInputEl();
|
||||
if (!inputEl) return;
|
||||
const inputValue = inputEl.value;
|
||||
const { split } = props;
|
||||
const newEndPart = inputValue.slice(mentionCtx.value.end);
|
||||
const alreadySeparated = newEndPart.startsWith(split);
|
||||
const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
|
||||
const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
|
||||
emit(UPDATE_MODEL_EVENT, newValue);
|
||||
emit(INPUT_EVENT, newValue);
|
||||
emit("select", getOriginalOption(item), mentionCtx.value.prefix);
|
||||
const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
|
||||
nextTick(() => {
|
||||
inputEl.selectionStart = newSelectionEnd;
|
||||
inputEl.selectionEnd = newSelectionEnd;
|
||||
inputEl.focus();
|
||||
syncDropdownVisible();
|
||||
});
|
||||
};
|
||||
const getInputEl = () => props.type === "textarea" ? elInputRef.value?.textarea : elInputRef.value?.input;
|
||||
const syncAfterCursorMove = () => {
|
||||
setTimeout(() => {
|
||||
syncCursor();
|
||||
syncDropdownVisible();
|
||||
nextTick(() => tooltipRef.value?.updatePopper());
|
||||
}, 0);
|
||||
};
|
||||
const syncCursor = () => {
|
||||
const inputEl = getInputEl();
|
||||
if (!inputEl) return;
|
||||
const caretPosition = getCursorPosition(inputEl);
|
||||
const inputRect = inputEl.getBoundingClientRect();
|
||||
const wrapperRect = wrapperRef.value.getBoundingClientRect();
|
||||
cursorStyle.value = {
|
||||
position: "absolute",
|
||||
width: 0,
|
||||
height: `${caretPosition.height}px`,
|
||||
left: `${caretPosition.left + inputRect.left - wrapperRect.left}px`,
|
||||
top: `${caretPosition.top + inputRect.top - wrapperRect.top}px`
|
||||
};
|
||||
};
|
||||
const syncDropdownVisible = () => {
|
||||
const inputEl = getInputEl();
|
||||
if (document.activeElement !== inputEl) {
|
||||
visible.value = false;
|
||||
return;
|
||||
}
|
||||
const { prefix, split } = props;
|
||||
mentionCtx.value = getMentionCtx(inputEl, prefix, split);
|
||||
if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
|
||||
visible.value = true;
|
||||
emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
|
||||
return;
|
||||
}
|
||||
visible.value = false;
|
||||
};
|
||||
__expose({
|
||||
input: elInputRef,
|
||||
tooltip: tooltipRef,
|
||||
dropdownVisible
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("div", {
|
||||
ref_key: "wrapperRef",
|
||||
ref: wrapperRef,
|
||||
class: normalizeClass(unref(ns).b())
|
||||
}, [createVNode(unref(ElInput), mergeProps(mergeProps(passInputProps.value, _ctx.$attrs), {
|
||||
ref_key: "elInputRef",
|
||||
ref: elInputRef,
|
||||
"model-value": __props.modelValue,
|
||||
disabled: unref(disabled),
|
||||
role: dropdownVisible.value ? "combobox" : void 0,
|
||||
"aria-activedescendant": dropdownVisible.value ? hoveringId.value || "" : void 0,
|
||||
"aria-controls": dropdownVisible.value ? unref(contentId) : void 0,
|
||||
"aria-expanded": dropdownVisible.value || void 0,
|
||||
"aria-label": __props.ariaLabel,
|
||||
"aria-autocomplete": dropdownVisible.value ? "none" : void 0,
|
||||
"aria-haspopup": dropdownVisible.value ? "listbox" : void 0,
|
||||
onInput: handleInputChange,
|
||||
onKeydown: handleInputKeyDown,
|
||||
onMousedown: handleInputMouseDown
|
||||
}), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
|
||||
return {
|
||||
name,
|
||||
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
|
||||
};
|
||||
})]), 1040, [
|
||||
"model-value",
|
||||
"disabled",
|
||||
"role",
|
||||
"aria-activedescendant",
|
||||
"aria-controls",
|
||||
"aria-expanded",
|
||||
"aria-label",
|
||||
"aria-autocomplete",
|
||||
"aria-haspopup"
|
||||
]), createVNode(unref(ElTooltip), {
|
||||
ref_key: "tooltipRef",
|
||||
ref: tooltipRef,
|
||||
visible: dropdownVisible.value,
|
||||
"popper-class": [unref(ns).e("popper"), __props.popperClass],
|
||||
"popper-style": __props.popperStyle,
|
||||
"popper-options": __props.popperOptions,
|
||||
placement: computedPlacement.value,
|
||||
"fallback-placements": computedFallbackPlacements.value,
|
||||
effect: "light",
|
||||
pure: "",
|
||||
offset: __props.offset,
|
||||
"show-arrow": __props.showArrow
|
||||
}, {
|
||||
default: withCtx(() => [createElementVNode("div", { style: normalizeStyle(cursorStyle.value) }, null, 4)]),
|
||||
content: withCtx(() => [createVNode(mention_dropdown_default, {
|
||||
ref_key: "dropdownRef",
|
||||
ref: dropdownRef,
|
||||
options: filteredOptions.value,
|
||||
disabled: unref(disabled),
|
||||
loading: __props.loading,
|
||||
"content-id": unref(contentId),
|
||||
"aria-label": __props.ariaLabel,
|
||||
onSelect: handleSelect,
|
||||
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => elInputRef.value?.focus(), ["stop"]))
|
||||
}, createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
|
||||
return {
|
||||
name,
|
||||
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
|
||||
};
|
||||
})]), 1032, [
|
||||
"options",
|
||||
"disabled",
|
||||
"loading",
|
||||
"content-id",
|
||||
"aria-label"
|
||||
])]),
|
||||
_: 3
|
||||
}, 8, [
|
||||
"visible",
|
||||
"popper-class",
|
||||
"popper-style",
|
||||
"popper-options",
|
||||
"placement",
|
||||
"fallback-placements",
|
||||
"offset",
|
||||
"show-arrow"
|
||||
])], 2);
|
||||
};
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
export { mention_vue_vue_type_script_setup_true_lang_default as default };
|
||||
|
||||
//# sourceMappingURL=mention.vue_vue_type_script_setup_true_lang.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/mention.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/mention.vue_vue_type_script_setup_true_lang.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
frontend/node_modules/element-plus/es/components/mention/src/mention2.mjs
generated
vendored
Normal file
7
frontend/node_modules/element-plus/es/components/mention/src/mention2.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import mention_vue_vue_type_script_setup_true_lang_default from "./mention.vue_vue_type_script_setup_true_lang.mjs";
|
||||
//#region ../../packages/components/mention/src/mention.vue
|
||||
var mention_default = mention_vue_vue_type_script_setup_true_lang_default;
|
||||
//#endregion
|
||||
export { mention_default as default };
|
||||
|
||||
//# sourceMappingURL=mention2.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/components/mention/src/mention2.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/components/mention/src/mention2.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
frontend/node_modules/element-plus/es/components/mention/src/types.d.ts
generated
vendored
Normal file
18
frontend/node_modules/element-plus/es/components/mention/src/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
//#region ../../packages/components/mention/src/types.d.ts
|
||||
type MentionOption = {
|
||||
value?: string;
|
||||
label?: string;
|
||||
disabled?: boolean;
|
||||
[key: string]: any;
|
||||
};
|
||||
interface MentionCtx {
|
||||
pattern: string;
|
||||
start: number;
|
||||
end: number;
|
||||
prefix: string;
|
||||
prefixIndex: number;
|
||||
splitIndex: number;
|
||||
selectionEnd: number;
|
||||
}
|
||||
//#endregion
|
||||
export { MentionCtx, MentionOption };
|
||||
0
frontend/node_modules/element-plus/es/components/mention/src/types.mjs
generated
vendored
Normal file
0
frontend/node_modules/element-plus/es/components/mention/src/types.mjs
generated
vendored
Normal file
5
frontend/node_modules/element-plus/es/components/mention/style/css.mjs
generated
vendored
Normal file
5
frontend/node_modules/element-plus/es/components/mention/style/css.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import "../../base/style/css.mjs";
|
||||
import "../../input/style/css.mjs";
|
||||
import "../../scrollbar/style/css.mjs";
|
||||
import "../../tooltip/style/css.mjs";
|
||||
import "element-plus/theme-chalk/el-mention.css";
|
||||
5
frontend/node_modules/element-plus/es/components/mention/style/index.mjs
generated
vendored
Normal file
5
frontend/node_modules/element-plus/es/components/mention/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import "../../base/style/index.mjs";
|
||||
import "../../input/style/index.mjs";
|
||||
import "../../scrollbar/style/index.mjs";
|
||||
import "../../tooltip/style/index.mjs";
|
||||
import "element-plus/theme-chalk/src/mention.scss";
|
||||
Reference in New Issue
Block a user