@v-c/mentions 1.1.3 → 1.2.1
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/dist/KeywordTrigger.d.ts +2 -0
- package/dist/KeywordTrigger.js +12 -6
- package/dist/Mentions.d.ts +6 -0
- package/dist/Mentions.js +16 -4
- package/package.json +5 -5
package/dist/KeywordTrigger.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VueNode } from '@v-c/util/dist/type';
|
|
1
2
|
import { CSSProperties } from 'vue';
|
|
2
3
|
import { DataDrivenOptionProps, Direction, Placement } from './Mentions';
|
|
3
4
|
interface KeywordTriggerProps {
|
|
@@ -11,6 +12,7 @@ interface KeywordTriggerProps {
|
|
|
11
12
|
getPopupContainer?: () => HTMLElement;
|
|
12
13
|
popupClassName?: string;
|
|
13
14
|
popupStyle?: CSSProperties;
|
|
15
|
+
popupRender?: (menu: VueNode) => VueNode;
|
|
14
16
|
}
|
|
15
17
|
declare const KeywordTrigger: import('vue').DefineSetupFnComponent<KeywordTriggerProps, {}, {}, KeywordTriggerProps & {}, import('vue').PublicProps>;
|
|
16
18
|
export default KeywordTrigger;
|
package/dist/KeywordTrigger.js
CHANGED
|
@@ -43,16 +43,17 @@ var KeywordTrigger = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
43
43
|
return props.placement === "top" ? "topRight" : "bottomRight";
|
|
44
44
|
});
|
|
45
45
|
return () => {
|
|
46
|
-
const { prefixCls, options, visible, transitionName, getPopupContainer, popupClassName, popupStyle } = props;
|
|
46
|
+
const { prefixCls, options, visible, transitionName, getPopupContainer, popupClassName, popupStyle, popupRender } = props;
|
|
47
47
|
const dropdownPrefix = `${prefixCls}-dropdown`;
|
|
48
|
+
const dropdownElement = createVNode(DropdownMenu, {
|
|
49
|
+
"prefixCls": dropdownPrefix,
|
|
50
|
+
"options": options,
|
|
51
|
+
"opened": opened.value
|
|
52
|
+
}, null);
|
|
48
53
|
return createVNode(Trigger, {
|
|
49
54
|
"prefixCls": dropdownPrefix,
|
|
50
55
|
"popupVisible": visible,
|
|
51
|
-
"popup":
|
|
52
|
-
"prefixCls": dropdownPrefix,
|
|
53
|
-
"options": options,
|
|
54
|
-
"opened": opened.value
|
|
55
|
-
}, null),
|
|
56
|
+
"popup": popupRender ? popupRender(dropdownElement) : dropdownElement,
|
|
56
57
|
"popupPlacement": dropdownPlacement.value,
|
|
57
58
|
"popupMotion": { name: transitionName },
|
|
58
59
|
"builtinPlacements": BUILT_IN_PLACEMENTS,
|
|
@@ -114,6 +115,11 @@ var KeywordTrigger = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
114
115
|
type: Object,
|
|
115
116
|
required: false,
|
|
116
117
|
default: void 0
|
|
118
|
+
},
|
|
119
|
+
popupRender: {
|
|
120
|
+
type: Function,
|
|
121
|
+
required: false,
|
|
122
|
+
default: void 0
|
|
117
123
|
}
|
|
118
124
|
},
|
|
119
125
|
name: "KeywordTrigger",
|
package/dist/Mentions.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ export interface MentionsProps extends BaseTextareaAttrs {
|
|
|
45
45
|
popup?: CSSProperties;
|
|
46
46
|
};
|
|
47
47
|
onPopupScroll?: (event: UIEvent) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Customize the dropdown menu rendering
|
|
50
|
+
* @param menu The default dropdown menu
|
|
51
|
+
* @returns The customized dropdown menu
|
|
52
|
+
*/
|
|
53
|
+
popupRender?: (menu: VueNode) => VueNode;
|
|
48
54
|
rows?: HTMLTextAreaElement['rows'];
|
|
49
55
|
}
|
|
50
56
|
export interface MentionsRef {
|
package/dist/Mentions.js
CHANGED
|
@@ -6,7 +6,7 @@ import { filterOption, getBeforeSelectionText, getLastMeasureIndex, replaceWithM
|
|
|
6
6
|
import { Fragment, computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef, watch } from "vue";
|
|
7
7
|
import { BaseInput } from "@v-c/input";
|
|
8
8
|
import TextArea from "@v-c/textarea";
|
|
9
|
-
import { KeyCode, clsx, omit, useId } from "@v-c/util";
|
|
9
|
+
import { KeyCode, clsx, isVueRenderable, omit, useId } from "@v-c/util";
|
|
10
10
|
import { toArray } from "@v-c/util/dist/Children/toArray";
|
|
11
11
|
import { filterEmpty, getAttrStyleAndClass } from "@v-c/util/dist/props-util";
|
|
12
12
|
//#region src/Mentions.tsx
|
|
@@ -44,7 +44,8 @@ var omitKeys = [
|
|
|
44
44
|
"popupClassName",
|
|
45
45
|
"rows",
|
|
46
46
|
"visible",
|
|
47
|
-
"onPopupScroll"
|
|
47
|
+
"onPopupScroll",
|
|
48
|
+
"popupRender"
|
|
48
49
|
];
|
|
49
50
|
var InternalMentions = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }) => {
|
|
50
51
|
const mergedPrefix = computed(() => {
|
|
@@ -329,7 +330,8 @@ var InternalMentions = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
329
330
|
"visible": true,
|
|
330
331
|
"getPopupContainer": props.getPopupContainer,
|
|
331
332
|
"popupClassName": clsx(props.popupClassName, mentionClassNames?.popup),
|
|
332
|
-
"popupStyle": styles?.popup
|
|
333
|
+
"popupStyle": styles?.popup,
|
|
334
|
+
"popupRender": props.popupRender
|
|
333
335
|
}, { default: () => [createVNode("span", null, [mergedMeasurePrefix.value])] })] }),
|
|
334
336
|
mergedValue.value.slice(mergedMeasureLocation.value + mergedMeasurePrefix.value.length)
|
|
335
337
|
])]);
|
|
@@ -484,6 +486,11 @@ var InternalMentions = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
484
486
|
required: false,
|
|
485
487
|
default: void 0
|
|
486
488
|
},
|
|
489
|
+
popupRender: {
|
|
490
|
+
type: Function,
|
|
491
|
+
required: false,
|
|
492
|
+
default: void 0
|
|
493
|
+
},
|
|
487
494
|
rows: {
|
|
488
495
|
required: false,
|
|
489
496
|
default: void 0
|
|
@@ -574,7 +581,7 @@ var InternalMentions = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
574
581
|
inheritAttrs: false
|
|
575
582
|
});
|
|
576
583
|
var Mentions = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
577
|
-
const hasSuffix = computed(() =>
|
|
584
|
+
const hasSuffix = computed(() => isVueRenderable(props.suffix) || Boolean(props.allowClear));
|
|
578
585
|
const holderRef = shallowRef();
|
|
579
586
|
const mentionRef = shallowRef();
|
|
580
587
|
const mergedValue = shallowRef(props?.value ?? props?.defaultValue ?? "");
|
|
@@ -769,6 +776,11 @@ var Mentions = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
|
769
776
|
required: false,
|
|
770
777
|
default: void 0
|
|
771
778
|
},
|
|
779
|
+
popupRender: {
|
|
780
|
+
type: Function,
|
|
781
|
+
required: false,
|
|
782
|
+
default: void 0
|
|
783
|
+
},
|
|
772
784
|
rows: {
|
|
773
785
|
required: false,
|
|
774
786
|
default: void 0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/mentions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/mentions",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"vue": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@v-c/input": "^1.1.
|
|
34
|
-
"@v-c/menu": "^1.
|
|
33
|
+
"@v-c/input": "^1.1.2",
|
|
34
|
+
"@v-c/menu": "^1.4.0",
|
|
35
|
+
"@v-c/util": "^1.2.0",
|
|
35
36
|
"@v-c/textarea": "^1.1.0",
|
|
36
|
-
"@v-c/trigger": "^1.
|
|
37
|
-
"@v-c/util": "^1.0.21"
|
|
37
|
+
"@v-c/trigger": "^1.1.1"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "vite build",
|