@antdv-next/x 0.0.2 → 0.0.4
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/index.d.ts +40 -0
- package/dist/index.esm.js +1085 -44
- package/dist/index.umd.js +1083 -42
- package/dist/notification/index.d.ts +15 -0
- package/dist/notification/interface.d.ts +22 -0
- package/dist/package.js +1 -1
- package/dist/sender/Sender.d.ts +25 -7
- package/dist/sender/Sender.js +59 -13
- package/dist/sender/SenderSwitch.js +1 -1
- package/dist/sender/components/ActionButton.d.ts +0 -9
- package/dist/sender/components/ActionButton.js +1 -5
- package/dist/sender/components/Skill.d.ts +30 -0
- package/dist/sender/components/Skill.js +61 -0
- package/dist/sender/components/SlotTextArea.d.ts +20 -0
- package/dist/sender/components/SlotTextArea.js +747 -0
- package/dist/sender/components/TextArea.d.ts +1 -3
- package/dist/sender/context.d.ts +1 -0
- package/dist/sender/index.d.ts +2 -2
- package/dist/sender/interface.d.ts +2 -1
- package/dist/sender/style/index.d.ts +7 -0
- package/dist/sender/style/index.js +17 -1
- package/dist/sender/style/slot-textarea.d.ts +4 -0
- package/dist/sender/style/slot-textarea.js +187 -0
- package/dist/suggestion/useActive.js +4 -0
- package/dist/x-provider/index.d.ts +9 -9
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UseNotificationType, XNotificationOpenArgs } from './interface';
|
|
2
|
+
declare class XNotification {
|
|
3
|
+
private static permissionMap;
|
|
4
|
+
static permissible: boolean;
|
|
5
|
+
constructor();
|
|
6
|
+
get permission(): NotificationPermission;
|
|
7
|
+
open(arg: XNotificationOpenArgs): void;
|
|
8
|
+
requestPermission(): Promise<NotificationPermission>;
|
|
9
|
+
useNotification(): UseNotificationType;
|
|
10
|
+
close(tags?: string[]): void;
|
|
11
|
+
}
|
|
12
|
+
export type { XNotificationOpenArgs };
|
|
13
|
+
declare const _default: XNotification;
|
|
14
|
+
export default _default;
|
|
15
|
+
export { XNotification };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { XNotification } from '.';
|
|
3
|
+
type TypeOpen = NotificationOptions & {
|
|
4
|
+
title: string;
|
|
5
|
+
onClick?: (event: Event, close?: Notification["close"]) => void;
|
|
6
|
+
onClose?: (event: Event) => void;
|
|
7
|
+
onError?: (event: Event) => void;
|
|
8
|
+
onShow?: (event: Event) => void;
|
|
9
|
+
duration?: number;
|
|
10
|
+
};
|
|
11
|
+
export type UseNotificationType = [
|
|
12
|
+
{
|
|
13
|
+
permission: Ref<NotificationPermission>;
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
open: XNotification["open"];
|
|
17
|
+
close: XNotification["close"];
|
|
18
|
+
requestPermission: () => Promise<NotificationPermission>;
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
export type XNotificationOpenArgs = TypeOpen;
|
|
22
|
+
export {};
|
package/dist/package.js
CHANGED
package/dist/sender/Sender.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType, StyleValue, CSSProperties } from 'vue';
|
|
2
|
-
import { AllowSpeech, BaseNode, NodeRender, SubmitType } from './interface';
|
|
2
|
+
import { AllowSpeech, BaseNode, NodeRender, SkillType, SlotConfigType, SubmitType } from './interface';
|
|
3
3
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
4
|
prefixCls: {
|
|
5
5
|
type: StringConstructor;
|
|
@@ -41,6 +41,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
41
41
|
type: BooleanConstructor;
|
|
42
42
|
default: boolean;
|
|
43
43
|
};
|
|
44
|
+
slotConfig: {
|
|
45
|
+
type: PropType<Readonly<SlotConfigType[]>>;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
skill: {
|
|
49
|
+
type: PropType<SkillType>;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
44
52
|
placeholder: {
|
|
45
53
|
type: StringConstructor;
|
|
46
54
|
default: undefined;
|
|
@@ -83,11 +91,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
83
91
|
default: undefined;
|
|
84
92
|
};
|
|
85
93
|
onSubmit: {
|
|
86
|
-
type: PropType<(message: string) => void>;
|
|
94
|
+
type: PropType<(message: string, slotConfig?: SlotConfigType[], skill?: SkillType) => void>;
|
|
87
95
|
default: undefined;
|
|
88
96
|
};
|
|
89
97
|
onChange: {
|
|
90
|
-
type: PropType<(value: string, event?: Event) => void>;
|
|
98
|
+
type: PropType<(value: string, event?: Event, slotConfig?: SlotConfigType[], skill?: SkillType) => void>;
|
|
91
99
|
default: undefined;
|
|
92
100
|
};
|
|
93
101
|
onCancel: {
|
|
@@ -159,6 +167,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
159
167
|
type: BooleanConstructor;
|
|
160
168
|
default: boolean;
|
|
161
169
|
};
|
|
170
|
+
slotConfig: {
|
|
171
|
+
type: PropType<Readonly<SlotConfigType[]>>;
|
|
172
|
+
default: undefined;
|
|
173
|
+
};
|
|
174
|
+
skill: {
|
|
175
|
+
type: PropType<SkillType>;
|
|
176
|
+
default: undefined;
|
|
177
|
+
};
|
|
162
178
|
placeholder: {
|
|
163
179
|
type: StringConstructor;
|
|
164
180
|
default: undefined;
|
|
@@ -201,11 +217,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
201
217
|
default: undefined;
|
|
202
218
|
};
|
|
203
219
|
onSubmit: {
|
|
204
|
-
type: PropType<(message: string) => void>;
|
|
220
|
+
type: PropType<(message: string, slotConfig?: SlotConfigType[], skill?: SkillType) => void>;
|
|
205
221
|
default: undefined;
|
|
206
222
|
};
|
|
207
223
|
onChange: {
|
|
208
|
-
type: PropType<(value: string, event?: Event) => void>;
|
|
224
|
+
type: PropType<(value: string, event?: Event, slotConfig?: SlotConfigType[], skill?: SkillType) => void>;
|
|
209
225
|
default: undefined;
|
|
210
226
|
};
|
|
211
227
|
onCancel: {
|
|
@@ -250,8 +266,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
250
266
|
onPaste: (event: ClipboardEvent) => void;
|
|
251
267
|
onFocus: (event: FocusEvent) => void;
|
|
252
268
|
onBlur: (event: FocusEvent) => void;
|
|
253
|
-
onChange: (value: string, event?: Event) => void;
|
|
254
|
-
onSubmit: (message: string) => void;
|
|
269
|
+
onChange: (value: string, event?: Event, slotConfig?: SlotConfigType[], skill?: SkillType) => void;
|
|
270
|
+
onSubmit: (message: string, slotConfig?: SlotConfigType[], skill?: SkillType) => void;
|
|
255
271
|
placeholder: string;
|
|
256
272
|
prefix: BaseNode | NodeRender;
|
|
257
273
|
classNames: Record<string, string>;
|
|
@@ -259,6 +275,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
259
275
|
suffix: BaseNode | NodeRender;
|
|
260
276
|
onKeyUp: (event: KeyboardEvent) => void;
|
|
261
277
|
onKeyDown: (event: KeyboardEvent) => void | false;
|
|
278
|
+
skill: SkillType;
|
|
279
|
+
slotConfig: readonly SlotConfigType[];
|
|
262
280
|
readOnly: boolean;
|
|
263
281
|
autoSize: boolean | {
|
|
264
282
|
minRows?: number;
|
package/dist/sender/Sender.js
CHANGED
|
@@ -3,12 +3,13 @@ import { provideActionButtonContext } from "./components/ActionButton.js";
|
|
|
3
3
|
import ClearButton_default from "./components/ClearButton.js";
|
|
4
4
|
import LoadingButton_default from "./components/LoadingButton/index.js";
|
|
5
5
|
import SendButton_default from "./components/SendButton.js";
|
|
6
|
-
import SpeechButton_default from "./components/SpeechButton/index.js";
|
|
7
6
|
import { provideSenderContext } from "./context.js";
|
|
7
|
+
import SlotTextArea_default from "./components/SlotTextArea.js";
|
|
8
|
+
import SpeechButton_default from "./components/SpeechButton/index.js";
|
|
8
9
|
import TextArea_default from "./components/TextArea.js";
|
|
9
10
|
import useSpeech from "./hooks/use-speech.js";
|
|
10
11
|
import style_default from "./style/index.js";
|
|
11
|
-
import { computed, createVNode, defineComponent, mergeProps, ref, useAttrs } from "vue";
|
|
12
|
+
import { computed, createVNode, defineComponent, mergeProps, ref, useAttrs, watch } from "vue";
|
|
12
13
|
import { useConfig } from "antdv-next/dist/config-provider/context";
|
|
13
14
|
//#region components/sender/Sender.tsx
|
|
14
15
|
var sharedRenderComponents = {
|
|
@@ -65,6 +66,14 @@ var Sender_default = /* @__PURE__ */ defineComponent({
|
|
|
65
66
|
type: Boolean,
|
|
66
67
|
default: false
|
|
67
68
|
},
|
|
69
|
+
slotConfig: {
|
|
70
|
+
type: Array,
|
|
71
|
+
default: void 0
|
|
72
|
+
},
|
|
73
|
+
skill: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: void 0
|
|
76
|
+
},
|
|
68
77
|
placeholder: {
|
|
69
78
|
type: String,
|
|
70
79
|
default: void 0
|
|
@@ -163,21 +172,40 @@ var Sender_default = /* @__PURE__ */ defineComponent({
|
|
|
163
172
|
const [hashId, cssVarCls] = style_default(prefixCls);
|
|
164
173
|
const containerRef = ref();
|
|
165
174
|
const inputRef = ref();
|
|
175
|
+
const isSlotMode = computed(() => Array.isArray(props.slotConfig) || !!props.skill?.value);
|
|
166
176
|
const innerValue = ref(props.defaultValue);
|
|
167
177
|
const mergedValue = computed(() => props.value ?? innerValue.value);
|
|
168
|
-
const triggerValueChange = (nextValue, event) => {
|
|
178
|
+
const triggerValueChange = (nextValue, event, slotConfig, skill) => {
|
|
169
179
|
innerValue.value = nextValue;
|
|
170
|
-
props.onChange?.(nextValue, event);
|
|
180
|
+
props.onChange?.(nextValue, event, slotConfig, skill);
|
|
171
181
|
};
|
|
182
|
+
const submitDisabled = ref(!mergedValue.value);
|
|
183
|
+
watch(() => mergedValue.value, (next) => {
|
|
184
|
+
if (!isSlotMode.value) submitDisabled.value = !next;
|
|
185
|
+
}, { immediate: true });
|
|
172
186
|
const [speechPermission, triggerSpeech, speechRecording] = useSpeech((transcript) => {
|
|
187
|
+
if (isSlotMode.value) {
|
|
188
|
+
inputRef.value?.insert?.([{
|
|
189
|
+
type: "text",
|
|
190
|
+
value: transcript
|
|
191
|
+
}]);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
173
194
|
triggerValueChange(`${mergedValue.value} ${transcript}`);
|
|
174
195
|
}, () => props.allowSpeech);
|
|
175
196
|
const triggerSend = () => {
|
|
176
|
-
if (props.onSubmit
|
|
197
|
+
if (!props.onSubmit || props.loading || submitDisabled.value) return;
|
|
198
|
+
const value = inputRef.value?.getValue?.() ?? { value: "" };
|
|
199
|
+
const slotConfig = "slotConfig" in value ? value.slotConfig : void 0;
|
|
200
|
+
const skill = "skill" in value ? value.skill : void 0;
|
|
201
|
+
props.onSubmit(value.value, slotConfig, skill);
|
|
177
202
|
};
|
|
178
203
|
const triggerClear = () => {
|
|
204
|
+
if (inputRef.value?.clear) {
|
|
205
|
+
inputRef.value.clear();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
179
208
|
triggerValueChange("");
|
|
180
|
-
inputRef.value?.clear();
|
|
181
209
|
};
|
|
182
210
|
expose({
|
|
183
211
|
get nativeElement() {
|
|
@@ -193,7 +221,19 @@ var Sender_default = /* @__PURE__ */ defineComponent({
|
|
|
193
221
|
triggerClear();
|
|
194
222
|
},
|
|
195
223
|
insert(text, position) {
|
|
196
|
-
|
|
224
|
+
if (isSlotMode.value) {
|
|
225
|
+
const slotList = Array.isArray(text) ? text : [{
|
|
226
|
+
type: "text",
|
|
227
|
+
value: text
|
|
228
|
+
}];
|
|
229
|
+
inputRef.value?.insert?.(slotList, position);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const textValue = Array.isArray(text) ? text.map((config) => {
|
|
233
|
+
if (config.type === "text") return config.value ?? "";
|
|
234
|
+
return config.formatResult?.(config.props?.defaultValue) ?? "";
|
|
235
|
+
}).join("") : text;
|
|
236
|
+
inputRef.value?.insert?.(textValue, position);
|
|
197
237
|
},
|
|
198
238
|
getValue() {
|
|
199
239
|
return inputRef.value?.getValue() ?? { value: "" };
|
|
@@ -216,15 +256,20 @@ var Sender_default = /* @__PURE__ */ defineComponent({
|
|
|
216
256
|
triggerSend,
|
|
217
257
|
placeholder: props.placeholder,
|
|
218
258
|
onFocus: props.onFocus,
|
|
219
|
-
onBlur: props.onBlur
|
|
259
|
+
onBlur: props.onBlur,
|
|
260
|
+
slotConfig: props.slotConfig,
|
|
261
|
+
skill: props.skill,
|
|
262
|
+
setSubmitDisabled: (disabled) => {
|
|
263
|
+
submitDisabled.value = disabled;
|
|
264
|
+
}
|
|
220
265
|
})));
|
|
221
266
|
const actionBtnCls = computed(() => `${prefixCls.value}-actions-btn`);
|
|
222
267
|
provideActionButtonContext(computed(() => ({
|
|
223
268
|
prefixCls: actionBtnCls.value,
|
|
224
269
|
onSend: triggerSend,
|
|
225
|
-
onSendDisabled:
|
|
270
|
+
onSendDisabled: submitDisabled.value,
|
|
226
271
|
onClear: triggerClear,
|
|
227
|
-
onClearDisabled:
|
|
272
|
+
onClearDisabled: submitDisabled.value,
|
|
228
273
|
onCancel: props.onCancel,
|
|
229
274
|
onCancelDisabled: !props.loading,
|
|
230
275
|
onSpeech: () => triggerSpeech(false),
|
|
@@ -277,8 +322,9 @@ var Sender_default = /* @__PURE__ */ defineComponent({
|
|
|
277
322
|
"class": [`${cls}-content`, props.classNames.content],
|
|
278
323
|
"style": props.styles.content,
|
|
279
324
|
"onMousedown": (e) => {
|
|
280
|
-
|
|
281
|
-
|
|
325
|
+
const inputNode = containerRef.value?.querySelector(`.${cls}-input`);
|
|
326
|
+
if (!isSlotMode.value && e.target !== inputNode) e.preventDefault();
|
|
327
|
+
if (e.target === inputNode || e.target === containerRef.value) inputRef.value?.focus();
|
|
282
328
|
}
|
|
283
329
|
}, [
|
|
284
330
|
prefixNode && createVNode("div", {
|
|
@@ -289,7 +335,7 @@ var Sender_default = /* @__PURE__ */ defineComponent({
|
|
|
289
335
|
],
|
|
290
336
|
"style": [contextConfig.value.styles?.prefix, props.styles.prefix]
|
|
291
337
|
}, [prefixNode]),
|
|
292
|
-
createVNode(TextArea_default, { "ref": inputRef }, null),
|
|
338
|
+
isSlotMode.value ? createVNode(SlotTextArea_default, { "ref": inputRef }, null) : createVNode(TextArea_default, { "ref": inputRef }, null),
|
|
293
339
|
suffixNode && createVNode("div", {
|
|
294
340
|
"class": [
|
|
295
341
|
actionListCls,
|
|
@@ -121,7 +121,7 @@ var SenderSwitch_default = /* @__PURE__ */ defineComponent({
|
|
|
121
121
|
"class": [`${cls}-content`, props.classNames.content],
|
|
122
122
|
"style": props.styles.content
|
|
123
123
|
}, {
|
|
124
|
-
|
|
124
|
+
classes: {
|
|
125
125
|
icon: props.classNames.icon,
|
|
126
126
|
content: props.classNames.title
|
|
127
127
|
},
|
|
@@ -46,10 +46,6 @@ declare const ActionButton: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
46
46
|
type: PropType<ButtonProps["variant"]>;
|
|
47
47
|
default: undefined;
|
|
48
48
|
};
|
|
49
|
-
class: {
|
|
50
|
-
type: StringConstructor;
|
|
51
|
-
default: undefined;
|
|
52
|
-
};
|
|
53
49
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
54
50
|
action: {
|
|
55
51
|
type: PropType<ActionType>;
|
|
@@ -79,16 +75,11 @@ declare const ActionButton: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
79
75
|
type: PropType<ButtonProps["variant"]>;
|
|
80
76
|
default: undefined;
|
|
81
77
|
};
|
|
82
|
-
class: {
|
|
83
|
-
type: StringConstructor;
|
|
84
|
-
default: undefined;
|
|
85
|
-
};
|
|
86
78
|
}>> & Readonly<{}>, {
|
|
87
79
|
color: "blue" | "purple" | "cyan" | "green" | "magenta" | "pink" | "red" | "orange" | "yellow" | "volcano" | "geekblue" | "lime" | "gold" | "default" | "danger" | "primary" | undefined;
|
|
88
80
|
icon: Record<string, any>;
|
|
89
81
|
disabled: boolean;
|
|
90
82
|
type: "dashed" | "text" | "default" | "link" | "primary" | undefined;
|
|
91
|
-
class: string;
|
|
92
83
|
variant: "dashed" | "solid" | "text" | "filled" | "link" | "outlined" | undefined;
|
|
93
84
|
shape: "round" | "default" | "square" | "circle" | undefined;
|
|
94
85
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -39,10 +39,6 @@ var ActionButton = /* @__PURE__ */ defineComponent({
|
|
|
39
39
|
variant: {
|
|
40
40
|
type: String,
|
|
41
41
|
default: void 0
|
|
42
|
-
},
|
|
43
|
-
class: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: void 0
|
|
46
42
|
}
|
|
47
43
|
},
|
|
48
44
|
setup(props, { attrs }) {
|
|
@@ -65,7 +61,7 @@ var ActionButton = /* @__PURE__ */ defineComponent({
|
|
|
65
61
|
"disabled": mergedDisabled.value,
|
|
66
62
|
"class": [
|
|
67
63
|
prefixCls,
|
|
68
|
-
|
|
64
|
+
attrs.class,
|
|
69
65
|
{ [`${prefixCls}-disabled`]: mergedDisabled.value }
|
|
70
66
|
],
|
|
71
67
|
"onClick": (e) => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { SkillType } from '../interface';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
prefixCls: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
skill: {
|
|
9
|
+
type: PropType<SkillType>;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
removeSkill: {
|
|
13
|
+
type: PropType<() => void>;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
17
|
+
prefixCls: {
|
|
18
|
+
type: StringConstructor;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
skill: {
|
|
22
|
+
type: PropType<SkillType>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
removeSkill: {
|
|
26
|
+
type: PropType<() => void>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { classNames } from "@v-c/util";
|
|
2
|
+
import { computed, createVNode, defineComponent, isVNode } from "vue";
|
|
3
|
+
import { Tooltip } from "antdv-next";
|
|
4
|
+
import { CloseOutlined } from "@antdv-next/icons";
|
|
5
|
+
//#region components/sender/components/Skill.tsx
|
|
6
|
+
function _isSlot(s) {
|
|
7
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
8
|
+
}
|
|
9
|
+
var Skill_default = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "SenderSkill",
|
|
11
|
+
props: {
|
|
12
|
+
prefixCls: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
skill: {
|
|
17
|
+
type: Object,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
removeSkill: {
|
|
21
|
+
type: Function,
|
|
22
|
+
required: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
setup(props) {
|
|
26
|
+
const componentCls = computed(() => `${props.prefixCls}-skill`);
|
|
27
|
+
const closeNode = computed(() => {
|
|
28
|
+
const closable = props.skill.closable;
|
|
29
|
+
if (!closable) return null;
|
|
30
|
+
const config = typeof closable === "boolean" ? {} : closable;
|
|
31
|
+
const closeIcon = config.closeIcon ?? createVNode(CloseOutlined, { "class": `${componentCls.value}-close-icon` }, null);
|
|
32
|
+
return createVNode("div", {
|
|
33
|
+
"class": classNames([`${componentCls.value}-close`, { [`${componentCls.value}-close-disabled`]: config.disabled }]),
|
|
34
|
+
"role": "button",
|
|
35
|
+
"aria-label": "Close skill",
|
|
36
|
+
"tabindex": 0,
|
|
37
|
+
"onClick": (event) => {
|
|
38
|
+
if (config.disabled) return;
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
props.removeSkill();
|
|
41
|
+
config.onClose?.(event);
|
|
42
|
+
}
|
|
43
|
+
}, [closeIcon]);
|
|
44
|
+
});
|
|
45
|
+
return () => {
|
|
46
|
+
const mergeTitle = props.skill.title ?? props.skill.value;
|
|
47
|
+
const titleNode = props.skill.toolTip ? createVNode(Tooltip, props.skill.toolTip, _isSlot(mergeTitle) ? mergeTitle : { default: () => [mergeTitle] }) : mergeTitle;
|
|
48
|
+
return createVNode("div", {
|
|
49
|
+
"class": `${componentCls.value}-wrapper`,
|
|
50
|
+
"contenteditable": false
|
|
51
|
+
}, [createVNode("div", {
|
|
52
|
+
"class": `${componentCls.value}-tag`,
|
|
53
|
+
"contenteditable": false,
|
|
54
|
+
"role": "button",
|
|
55
|
+
"tabindex": 0
|
|
56
|
+
}, [createVNode("span", { "class": `${componentCls.value}-tag-text` }, [titleNode]), closeNode.value]), createVNode("div", { "class": `${componentCls.value}-holder` }, null)]);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Skill_default as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InsertPosition, SkillType, SlotConfigType } from '../interface';
|
|
2
|
+
type SlotFocusOptions = {
|
|
3
|
+
preventScroll?: boolean;
|
|
4
|
+
cursor?: "start" | "end" | "all" | "slot";
|
|
5
|
+
key?: string;
|
|
6
|
+
};
|
|
7
|
+
export interface SlotTextAreaRef {
|
|
8
|
+
nativeElement: HTMLDivElement | null;
|
|
9
|
+
focus: (options?: SlotFocusOptions) => void;
|
|
10
|
+
blur: () => void;
|
|
11
|
+
insert: (slotConfig: SlotConfigType[], position?: InsertPosition, replaceCharacters?: string, preventScroll?: boolean) => void;
|
|
12
|
+
clear: () => void;
|
|
13
|
+
getValue: () => {
|
|
14
|
+
value: string;
|
|
15
|
+
slotConfig: SlotConfigType[];
|
|
16
|
+
skill?: SkillType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
declare const _default: import('vue').DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
20
|
+
export default _default;
|