@uzum-tech/ui 2.4.6 → 2.4.8
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.js +320 -91
- package/dist/index.mjs +320 -91
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +3 -3
- package/es/chat/src/styles/index.cssr.mjs +1 -1
- package/es/components.d.ts +99 -10
- package/es/dynamic-tags/index.d.ts +3 -3
- package/es/dynamic-tags/index.mjs +2 -1
- package/es/dynamic-tags/src/DynamicTags.d.ts +74 -1177
- package/es/dynamic-tags/src/DynamicTags.mjs +150 -107
- package/es/dynamic-tags/src/interface.d.ts +1146 -6
- package/es/dynamic-tags/src/interface.mjs +34 -1
- package/es/dynamic-tags/src/styles/index.cssr.mjs +35 -3
- package/es/dynamic-tags/styles/dark.mjs +4 -2
- package/es/dynamic-tags/styles/light.d.ts +2 -0
- package/es/dynamic-tags/styles/light.mjs +4 -2
- package/es/editor/index.d.ts +1 -1
- package/es/editor/src/Editor.d.ts +21 -0
- package/es/editor/src/Editor.mjs +5 -2
- package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +27 -0
- package/es/editor/src/EditorParts/EditorContent/EditorContent.mjs +37 -3
- package/es/editor/src/EditorParts/EditorContent/interface.d.ts +11 -0
- package/es/editor/src/EditorParts/EditorContent/interface.mjs +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +18 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +9 -0
- package/es/editor/src/composables/use-editor-css-vars.mjs +8 -2
- package/es/editor/src/extensions.d.ts +2 -1
- package/es/editor/src/extensions.mjs +34 -4
- package/es/editor/src/interface.d.ts +22 -2
- package/es/editor/src/interface.mjs +1 -0
- package/es/editor/src/styles/index.cssr.mjs +21 -4
- package/es/editor/styles/dark.d.ts +3 -0
- package/es/editor/styles/light.d.ts +6 -0
- package/es/editor/styles/light.mjs +6 -1
- package/es/message-bubble/src/styles/index.cssr.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/chat/src/styles/index.cssr.js +1 -1
- package/lib/components.d.ts +99 -10
- package/lib/dynamic-tags/index.d.ts +3 -3
- package/lib/dynamic-tags/index.js +3 -2
- package/lib/dynamic-tags/src/DynamicTags.d.ts +74 -1177
- package/lib/dynamic-tags/src/DynamicTags.js +142 -77
- package/lib/dynamic-tags/src/interface.d.ts +1146 -6
- package/lib/dynamic-tags/src/interface.js +24 -0
- package/lib/dynamic-tags/src/styles/index.cssr.js +34 -2
- package/lib/dynamic-tags/styles/dark.js +4 -2
- package/lib/dynamic-tags/styles/light.d.ts +2 -0
- package/lib/dynamic-tags/styles/light.js +4 -2
- package/lib/editor/index.d.ts +1 -1
- package/lib/editor/src/Editor.d.ts +21 -0
- package/lib/editor/src/Editor.js +4 -2
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +27 -0
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.js +30 -3
- package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +11 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.js +1 -1
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +18 -0
- package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +9 -0
- package/lib/editor/src/composables/use-editor-css-vars.js +5 -2
- package/lib/editor/src/extensions.d.ts +2 -1
- package/lib/editor/src/extensions.js +41 -5
- package/lib/editor/src/interface.d.ts +22 -2
- package/lib/editor/src/interface.js +1 -1
- package/lib/editor/src/styles/index.cssr.js +21 -4
- package/lib/editor/styles/dark.d.ts +3 -0
- package/lib/editor/styles/light.d.ts +6 -0
- package/lib/editor/styles/light.js +5 -2
- package/lib/message-bubble/src/styles/index.cssr.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +31 -2
package/dist/index.mjs
CHANGED
|
@@ -54503,9 +54503,11 @@ const dynamicTagsDark = {
|
|
|
54503
54503
|
Tag: tagDark,
|
|
54504
54504
|
Space: spaceDark
|
|
54505
54505
|
},
|
|
54506
|
-
self() {
|
|
54506
|
+
self(vars) {
|
|
54507
54507
|
return {
|
|
54508
|
-
inputWidth: "64px"
|
|
54508
|
+
inputWidth: "64px",
|
|
54509
|
+
draggingOpacity: "0.5",
|
|
54510
|
+
dropIndicatorColor: vars.elementsPrimary
|
|
54509
54511
|
};
|
|
54510
54512
|
}
|
|
54511
54513
|
};
|
|
@@ -54519,9 +54521,11 @@ const dynamicTagsLight = createTheme$1({
|
|
|
54519
54521
|
Tag: tagLight,
|
|
54520
54522
|
Space: spaceLight
|
|
54521
54523
|
},
|
|
54522
|
-
self() {
|
|
54524
|
+
self(vars) {
|
|
54523
54525
|
return {
|
|
54524
|
-
inputWidth: "64px"
|
|
54526
|
+
inputWidth: "64px",
|
|
54527
|
+
draggingOpacity: "0.5",
|
|
54528
|
+
dropIndicatorColor: vars.elementsPrimary
|
|
54525
54529
|
};
|
|
54526
54530
|
}
|
|
54527
54531
|
});
|
|
@@ -54538,6 +54542,8 @@ function self$M(vars) {
|
|
|
54538
54542
|
lineHeightTitleSmall,
|
|
54539
54543
|
lineHeightBodyLarge,
|
|
54540
54544
|
lineHeightBodyMedium,
|
|
54545
|
+
fontBodySmall,
|
|
54546
|
+
lineHeightBodySmall,
|
|
54541
54547
|
surfacePrimary,
|
|
54542
54548
|
elementsQuaternary,
|
|
54543
54549
|
elementsQuinary,
|
|
@@ -54594,7 +54600,10 @@ function self$M(vars) {
|
|
|
54594
54600
|
markdownH1LineHeight: lineHeightTitleMedium,
|
|
54595
54601
|
markdownH2LineHeight: lineHeightTitleSmall,
|
|
54596
54602
|
markdownH3LineHeight: lineHeightBodyLarge,
|
|
54597
|
-
markdownTextLineHeight: lineHeightBodyMedium
|
|
54603
|
+
markdownTextLineHeight: lineHeightBodyMedium,
|
|
54604
|
+
countTextColor: textTertiary,
|
|
54605
|
+
countFontSize: fontBodySmall,
|
|
54606
|
+
countLineHeight: lineHeightBodySmall
|
|
54598
54607
|
};
|
|
54599
54608
|
}
|
|
54600
54609
|
const editorLight = createTheme$1({
|
|
@@ -60865,7 +60874,7 @@ var style$1a = cB("message-bubble", `
|
|
|
60865
60874
|
border-radius: var(--u-message-bubble-border-radius);
|
|
60866
60875
|
font-size: 14px;
|
|
60867
60876
|
line-height: 20px;
|
|
60868
|
-
|
|
60877
|
+
overflow-wrap: anywhere;
|
|
60869
60878
|
background-color: var(--u-message-bubble-background-color-other);
|
|
60870
60879
|
color: var(--u-message-bubble-text-color-other);
|
|
60871
60880
|
border-bottom-left-radius: 6px;
|
|
@@ -61950,7 +61959,7 @@ var style$19 = cB("chat", `
|
|
|
61950
61959
|
border-radius: 18px;
|
|
61951
61960
|
font-size: 14px;
|
|
61952
61961
|
line-height: 20px;
|
|
61953
|
-
|
|
61962
|
+
overflow-wrap: anywhere;
|
|
61954
61963
|
background-color: var(--u-message-bubble-background-color-other);
|
|
61955
61964
|
color: var(--u-message-bubble-text-color-other);
|
|
61956
61965
|
border-bottom-left-radius: 6px;
|
|
@@ -82944,7 +82953,10 @@ function useEditorCssVars(themeRef, themeVarsRef) {
|
|
|
82944
82953
|
markdownH1LineHeight,
|
|
82945
82954
|
markdownH2LineHeight,
|
|
82946
82955
|
markdownH3LineHeight,
|
|
82947
|
-
markdownTextLineHeight
|
|
82956
|
+
markdownTextLineHeight,
|
|
82957
|
+
countTextColor,
|
|
82958
|
+
countFontSize,
|
|
82959
|
+
countLineHeight
|
|
82948
82960
|
} = themeVarsRef.value;
|
|
82949
82961
|
return {
|
|
82950
82962
|
"--u-bezier": cubicBezierEaseInOut,
|
|
@@ -82984,7 +82996,10 @@ function useEditorCssVars(themeRef, themeVarsRef) {
|
|
|
82984
82996
|
"--u-editor-markdown-h1-line-height": markdownH1LineHeight,
|
|
82985
82997
|
"--u-editor-markdown-h2-line-height": markdownH2LineHeight,
|
|
82986
82998
|
"--u-editor-markdown-h3-line-height": markdownH3LineHeight,
|
|
82987
|
-
"--u-editor-markdown-text-line-height": markdownTextLineHeight
|
|
82999
|
+
"--u-editor-markdown-text-line-height": markdownTextLineHeight,
|
|
83000
|
+
"--u-editor-count-text-color": countTextColor,
|
|
83001
|
+
"--u-editor-count-font-size": countFontSize,
|
|
83002
|
+
"--u-editor-count-line-height": countLineHeight
|
|
82988
83003
|
};
|
|
82989
83004
|
});
|
|
82990
83005
|
}
|
|
@@ -83024,6 +83039,7 @@ const editorProps = {
|
|
|
83024
83039
|
autofocus: Boolean,
|
|
83025
83040
|
maxLength: Number,
|
|
83026
83041
|
maxRows: Number,
|
|
83042
|
+
showCount: Boolean,
|
|
83027
83043
|
toolbarButtonProps: Object,
|
|
83028
83044
|
toolbarIconProps: Object,
|
|
83029
83045
|
toolbarDropdownProps: Object,
|
|
@@ -83059,7 +83075,11 @@ var style$16 = c$1([cB("editor", `
|
|
|
83059
83075
|
margin: 0;
|
|
83060
83076
|
`), cE("toolbar-block-type", `
|
|
83061
83077
|
width: 71px;
|
|
83062
|
-
`)]), cE("
|
|
83078
|
+
`)]), cE("body", `
|
|
83079
|
+
display: flex;
|
|
83080
|
+
flex-direction: column;
|
|
83081
|
+
gap: 4px;
|
|
83082
|
+
`), cE("content-wrapper", `
|
|
83063
83083
|
position: relative;
|
|
83064
83084
|
box-sizing: border-box;
|
|
83065
83085
|
display: flex;
|
|
@@ -83081,7 +83101,14 @@ var style$16 = c$1([cB("editor", `
|
|
|
83081
83101
|
right: 6px;
|
|
83082
83102
|
top: 6px;
|
|
83083
83103
|
flex-shrink: 0;
|
|
83084
|
-
`)]), cE("
|
|
83104
|
+
`)]), cE("count", `
|
|
83105
|
+
align-self: flex-end;
|
|
83106
|
+
font-size: var(--u-editor-count-font-size);
|
|
83107
|
+
line-height: var(--u-editor-count-line-height);
|
|
83108
|
+
color: var(--u-editor-count-text-color);
|
|
83109
|
+
white-space: nowrap;
|
|
83110
|
+
padding-right: 10px;
|
|
83111
|
+
`), cE("content", `
|
|
83085
83112
|
white-space: normal;
|
|
83086
83113
|
width: 100%;
|
|
83087
83114
|
min-width: 0;
|
|
@@ -83089,7 +83116,7 @@ var style$16 = c$1([cB("editor", `
|
|
|
83089
83116
|
color: var(--u-editor-content-text-color);
|
|
83090
83117
|
font-size: var(--u-editor-markdown-text-font-size);
|
|
83091
83118
|
line-height: var(--u-editor-markdown-text-line-height);
|
|
83092
|
-
|
|
83119
|
+
overflow-wrap: anywhere;
|
|
83093
83120
|
`, [cM("scrollable", `
|
|
83094
83121
|
overflow-y: auto;
|
|
83095
83122
|
scrollbar-width: none;
|
|
@@ -83097,7 +83124,10 @@ var style$16 = c$1([cB("editor", `
|
|
|
83097
83124
|
width: 0;
|
|
83098
83125
|
height: 0;
|
|
83099
83126
|
display: none;
|
|
83100
|
-
`)]), cE("editable",
|
|
83127
|
+
`)]), cE("editable", `
|
|
83128
|
+
outline: none;
|
|
83129
|
+
overflow-wrap: anywhere;
|
|
83130
|
+
`, [c$1(".is-editor-empty:first-child::before", `
|
|
83101
83131
|
content: attr(data-placeholder);
|
|
83102
83132
|
float: left;
|
|
83103
83133
|
height: 0;
|
|
@@ -83188,6 +83218,8 @@ const editorContentProps = {
|
|
|
83188
83218
|
},
|
|
83189
83219
|
sendDisabled: Boolean,
|
|
83190
83220
|
maxRows: Number,
|
|
83221
|
+
showCount: Boolean,
|
|
83222
|
+
maxLength: Number,
|
|
83191
83223
|
sendTooltip: String,
|
|
83192
83224
|
disabled: Boolean,
|
|
83193
83225
|
sendButtonProps: Object,
|
|
@@ -83223,6 +83255,7 @@ var _UEditorContent = defineComponent({
|
|
|
83223
83255
|
const sendButtonThemeOverridesRef = computed(() => createSendButtonThemeOverrides(themeVarsRef.value));
|
|
83224
83256
|
const scrollbarInstRef = ref(null);
|
|
83225
83257
|
const contentInstRef = ref(null);
|
|
83258
|
+
const characterCountRef = ref(0);
|
|
83226
83259
|
const mergedMaxRowsRef = computed(
|
|
83227
83260
|
() => UEditor?.maxRowsRef.value ?? props.maxRows
|
|
83228
83261
|
);
|
|
@@ -83241,18 +83274,27 @@ var _UEditorContent = defineComponent({
|
|
|
83241
83274
|
function syncScrollbar() {
|
|
83242
83275
|
scrollbarInstRef.value?.syncUnifiedContainer();
|
|
83243
83276
|
}
|
|
83277
|
+
function syncCharacterCount() {
|
|
83278
|
+
characterCountRef.value = editorInstanceRef.value?.storage.characterCount?.characters() ?? 0;
|
|
83279
|
+
}
|
|
83280
|
+
function handleTransaction({ transaction }) {
|
|
83281
|
+
syncScrollbar();
|
|
83282
|
+
if (transaction.docChanged)
|
|
83283
|
+
syncCharacterCount();
|
|
83284
|
+
}
|
|
83244
83285
|
function unsubscribe() {
|
|
83245
|
-
subscribed?.off("transaction",
|
|
83286
|
+
subscribed?.off("transaction", handleTransaction);
|
|
83246
83287
|
subscribed = void 0;
|
|
83247
83288
|
}
|
|
83248
83289
|
watch(
|
|
83249
83290
|
editorInstanceRef,
|
|
83250
83291
|
(editor) => {
|
|
83251
83292
|
unsubscribe();
|
|
83293
|
+
syncCharacterCount();
|
|
83252
83294
|
if (!editor)
|
|
83253
83295
|
return;
|
|
83254
83296
|
subscribed = editor;
|
|
83255
|
-
editor.on("transaction",
|
|
83297
|
+
editor.on("transaction", handleTransaction);
|
|
83256
83298
|
},
|
|
83257
83299
|
{ immediate: true }
|
|
83258
83300
|
);
|
|
@@ -83291,6 +83333,16 @@ var _UEditorContent = defineComponent({
|
|
|
83291
83333
|
mergedContentProps: computed(
|
|
83292
83334
|
() => UEditor?.contentPropsRef.value ?? props.contentProps
|
|
83293
83335
|
),
|
|
83336
|
+
mergedShowCount: computed(
|
|
83337
|
+
() => UEditor?.showCountRef.value ?? props.showCount
|
|
83338
|
+
),
|
|
83339
|
+
mergedMaxLength: computed(
|
|
83340
|
+
() => UEditor?.maxLengthRef.value ?? props.maxLength
|
|
83341
|
+
),
|
|
83342
|
+
countAvailable: computed(
|
|
83343
|
+
() => !!editorInstanceRef.value?.storage.characterCount
|
|
83344
|
+
),
|
|
83345
|
+
characterCount: characterCountRef,
|
|
83294
83346
|
scrollbarInstRef,
|
|
83295
83347
|
contentInstRef,
|
|
83296
83348
|
mergedMaxRows: mergedMaxRowsRef,
|
|
@@ -83302,7 +83354,7 @@ var _UEditorContent = defineComponent({
|
|
|
83302
83354
|
},
|
|
83303
83355
|
render() {
|
|
83304
83356
|
this.onRender?.();
|
|
83305
|
-
const
|
|
83357
|
+
const contentWrapper = /* @__PURE__ */ h$1(
|
|
83306
83358
|
"div",
|
|
83307
83359
|
{
|
|
83308
83360
|
class: [
|
|
@@ -83348,6 +83400,16 @@ var _UEditorContent = defineComponent({
|
|
|
83348
83400
|
{ icon: this.$slots.sendIcon }
|
|
83349
83401
|
)
|
|
83350
83402
|
);
|
|
83403
|
+
const content = this.mergedShowCount ? /* @__PURE__ */ h$1("div", { class: `${this.mergedClsPrefix}-editor__body` }, contentWrapper, this.countAvailable && /* @__PURE__ */ h$1("span", { class: `${this.mergedClsPrefix}-editor__count` }, resolveSlotWithProps(
|
|
83404
|
+
this.$slots.count,
|
|
83405
|
+
{
|
|
83406
|
+
count: this.characterCount,
|
|
83407
|
+
maxLength: this.mergedMaxLength
|
|
83408
|
+
},
|
|
83409
|
+
() => [
|
|
83410
|
+
this.mergedMaxLength === void 0 ? this.characterCount : `${this.characterCount} / ${this.mergedMaxLength}`
|
|
83411
|
+
]
|
|
83412
|
+
))) : contentWrapper;
|
|
83351
83413
|
if (!this.isStandalone)
|
|
83352
83414
|
return content;
|
|
83353
83415
|
return /* @__PURE__ */ h$1(
|
|
@@ -93296,6 +93358,36 @@ const MarkdownSource = Extension.create({
|
|
|
93296
93358
|
}];
|
|
93297
93359
|
}
|
|
93298
93360
|
});
|
|
93361
|
+
const CharacterLimit = Extension.create({
|
|
93362
|
+
name: "characterLimit",
|
|
93363
|
+
addOptions: () => ({
|
|
93364
|
+
getLimit: () => void 0
|
|
93365
|
+
}),
|
|
93366
|
+
addProseMirrorPlugins() {
|
|
93367
|
+
const {
|
|
93368
|
+
getLimit
|
|
93369
|
+
} = this.options;
|
|
93370
|
+
const count = node => this.editor.storage.characterCount.characters({
|
|
93371
|
+
node
|
|
93372
|
+
});
|
|
93373
|
+
return [new Plugin({
|
|
93374
|
+
filterTransaction: (transaction, state) => {
|
|
93375
|
+
const limit = getLimit();
|
|
93376
|
+
if (!transaction.docChanged || transaction.getMeta("preventUpdate") || !limit) {
|
|
93377
|
+
return true;
|
|
93378
|
+
}
|
|
93379
|
+
const oldSize = count(state.doc);
|
|
93380
|
+
const newSize = count(transaction.doc);
|
|
93381
|
+
if (newSize <= limit) return true;
|
|
93382
|
+
if (oldSize > limit) return newSize <= oldSize;
|
|
93383
|
+
if (!transaction.getMeta("paste")) return false;
|
|
93384
|
+
const pos = transaction.selection.$head.pos;
|
|
93385
|
+
transaction.deleteRange(pos - (newSize - limit), pos);
|
|
93386
|
+
return count(transaction.doc) <= limit;
|
|
93387
|
+
}
|
|
93388
|
+
})];
|
|
93389
|
+
}
|
|
93390
|
+
});
|
|
93299
93391
|
const SendShortcut = Extension.create({
|
|
93300
93392
|
name: "sendShortcut",
|
|
93301
93393
|
priority: 1e3,
|
|
@@ -93351,7 +93443,7 @@ const MarkdownPaste = Extension.create({
|
|
|
93351
93443
|
}
|
|
93352
93444
|
const single = document.childCount === 1 && document.firstChild?.type.name === "paragraph";
|
|
93353
93445
|
const slice = single ? new Slice(document.content, 1, 1) : new Slice(document.content, 0, 0);
|
|
93354
|
-
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
|
|
93446
|
+
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
|
|
93355
93447
|
return true;
|
|
93356
93448
|
}
|
|
93357
93449
|
}
|
|
@@ -93398,9 +93490,9 @@ function createEditorExtensions({
|
|
|
93398
93490
|
}
|
|
93399
93491
|
}), Placeholder.configure({
|
|
93400
93492
|
placeholder
|
|
93401
|
-
}),
|
|
93402
|
-
|
|
93403
|
-
})
|
|
93493
|
+
}), CharacterCount, CharacterLimit.configure({
|
|
93494
|
+
getLimit: typeof maxLength === "function" ? maxLength : () => maxLength
|
|
93495
|
+
}), MarkdownSource, MarkdownPaste.configure({
|
|
93404
93496
|
markdownOptions
|
|
93405
93497
|
}), ...(onSendShortcut ? [SendShortcut.configure({
|
|
93406
93498
|
onSend: onSendShortcut
|
|
@@ -93506,7 +93598,7 @@ var _UEditor = defineComponent({
|
|
|
93506
93598
|
markdownOptions: props.markdownOptions,
|
|
93507
93599
|
extensions: props.extensions,
|
|
93508
93600
|
nodeProps: props.nodeProps,
|
|
93509
|
-
maxLength: props.maxLength,
|
|
93601
|
+
maxLength: () => props.maxLength,
|
|
93510
93602
|
onSendShortcut: props.sendOnEnter ? handleSend : void 0
|
|
93511
93603
|
}),
|
|
93512
93604
|
editable: editableRef.value,
|
|
@@ -93654,6 +93746,8 @@ var _UEditor = defineComponent({
|
|
|
93654
93746
|
contentPropsRef: toRef(props, "contentProps"),
|
|
93655
93747
|
maxRowsRef: toRef(props, "maxRows"),
|
|
93656
93748
|
showSendButtonRef: toRef(props, "showSendButton"),
|
|
93749
|
+
showCountRef: toRef(props, "showCount"),
|
|
93750
|
+
maxLengthRef: toRef(props, "maxLength"),
|
|
93657
93751
|
sendDisabledRef,
|
|
93658
93752
|
sendTooltipRef: mergedSendTooltipRef,
|
|
93659
93753
|
disabledRef: toRef(props, "disabled"),
|
|
@@ -93689,7 +93783,7 @@ var _UEditor = defineComponent({
|
|
|
93689
93783
|
style: this.inlineThemeDisabled ? void 0 : this.cssVars
|
|
93690
93784
|
},
|
|
93691
93785
|
this.$slots.toolbar?.() ?? /* @__PURE__ */ h$1(_UEditorToolbar, null),
|
|
93692
|
-
this.$slots.content?.() ?? /* @__PURE__ */ h$1(_UEditorContent, null, { sendIcon: this.$slots.sendIcon })
|
|
93786
|
+
this.$slots.content?.() ?? /* @__PURE__ */ h$1(_UEditorContent, null, { sendIcon: this.$slots.sendIcon, count: this.$slots.count })
|
|
93693
93787
|
);
|
|
93694
93788
|
}
|
|
93695
93789
|
});
|
|
@@ -124351,10 +124445,6 @@ var USpace$1 = defineComponent({
|
|
|
124351
124445
|
}
|
|
124352
124446
|
});
|
|
124353
124447
|
|
|
124354
|
-
var style$M = cB("dynamic-tags", [cB("input", {
|
|
124355
|
-
minWidth: "var(--u-input-width)"
|
|
124356
|
-
})]);
|
|
124357
|
-
|
|
124358
124448
|
const dynamicTagsProps = {
|
|
124359
124449
|
...useTheme.props,
|
|
124360
124450
|
...commonProps,
|
|
@@ -124366,6 +124456,10 @@ const dynamicTagsProps = {
|
|
|
124366
124456
|
type: Boolean,
|
|
124367
124457
|
default: true
|
|
124368
124458
|
},
|
|
124459
|
+
draggable: {
|
|
124460
|
+
type: Boolean,
|
|
124461
|
+
default: false
|
|
124462
|
+
},
|
|
124369
124463
|
defaultValue: {
|
|
124370
124464
|
type: Array,
|
|
124371
124465
|
default: () => []
|
|
@@ -124378,13 +124472,48 @@ const dynamicTagsProps = {
|
|
|
124378
124472
|
renderTag: Function,
|
|
124379
124473
|
onCreate: {
|
|
124380
124474
|
type: Function,
|
|
124381
|
-
default:
|
|
124475
|
+
default: label => label
|
|
124382
124476
|
},
|
|
124383
124477
|
"onUpdate:value": [Function, Array],
|
|
124384
124478
|
onUpdateValue: [Function, Array],
|
|
124385
124479
|
// deprecated
|
|
124386
124480
|
onChange: [Function, Array]
|
|
124387
124481
|
};
|
|
124482
|
+
|
|
124483
|
+
var style$M = cB("dynamic-tags", [cB("input", {
|
|
124484
|
+
minWidth: "var(--u-input-width)"
|
|
124485
|
+
}), cE("tag-wrapper", `
|
|
124486
|
+
display: flex;
|
|
124487
|
+
position: relative;
|
|
124488
|
+
cursor: default;
|
|
124489
|
+
`, [c$1("& > *", `
|
|
124490
|
+
cursor: inherit;
|
|
124491
|
+
`)]), cE("tag", [cM("draggable", `
|
|
124492
|
+
cursor: grab;
|
|
124493
|
+
user-select: none;
|
|
124494
|
+
`), cM("dragging", `
|
|
124495
|
+
opacity: var(--u-dragging-opacity);
|
|
124496
|
+
cursor: grabbing;
|
|
124497
|
+
`), cM("drop-before", [c$1("&::before", `
|
|
124498
|
+
content: '';
|
|
124499
|
+
position: absolute;
|
|
124500
|
+
top: 0;
|
|
124501
|
+
bottom: 0;
|
|
124502
|
+
left: -5px;
|
|
124503
|
+
width: 2px;
|
|
124504
|
+
border-radius: 2px;
|
|
124505
|
+
background-color: var(--u-drop-indicator-color);
|
|
124506
|
+
`)]), cM("drop-after", [c$1("&::after", `
|
|
124507
|
+
content: '';
|
|
124508
|
+
position: absolute;
|
|
124509
|
+
top: 0;
|
|
124510
|
+
bottom: 0;
|
|
124511
|
+
right: -5px;
|
|
124512
|
+
width: 2px;
|
|
124513
|
+
border-radius: 2px;
|
|
124514
|
+
background-color: var(--u-drop-indicator-color);
|
|
124515
|
+
`)])])]);
|
|
124516
|
+
|
|
124388
124517
|
var _UDynamicTags = defineComponent({
|
|
124389
124518
|
name: "DynamicTags",
|
|
124390
124519
|
props: dynamicTagsProps,
|
|
@@ -124400,14 +124529,9 @@ var _UDynamicTags = defineComponent({
|
|
|
124400
124529
|
}
|
|
124401
124530
|
});
|
|
124402
124531
|
}
|
|
124403
|
-
const { mergedClsPrefixRef, inlineThemeDisabled } = useConfig(props);
|
|
124404
124532
|
const { localeRef } = useLocale("DynamicTags");
|
|
124533
|
+
const { mergedClsPrefixRef, inlineThemeDisabled } = useConfig(props);
|
|
124405
124534
|
const formItem = useFormItem(props);
|
|
124406
|
-
const { mergedDisabledRef } = formItem;
|
|
124407
|
-
const inputValueRef = ref("");
|
|
124408
|
-
const showInputRef = ref(false);
|
|
124409
|
-
const inputForceFocusedRef = ref(true);
|
|
124410
|
-
const inputInstRef = ref(null);
|
|
124411
124535
|
const themeRef = useTheme(
|
|
124412
124536
|
"DynamicTags",
|
|
124413
124537
|
"-dynamic-tags",
|
|
@@ -124416,8 +124540,14 @@ var _UDynamicTags = defineComponent({
|
|
|
124416
124540
|
props,
|
|
124417
124541
|
mergedClsPrefixRef
|
|
124418
124542
|
);
|
|
124543
|
+
const inputInstRef = ref(null);
|
|
124544
|
+
const inputValueRef = ref("");
|
|
124545
|
+
const showInputRef = ref(false);
|
|
124546
|
+
const inputForceFocusedRef = ref(true);
|
|
124419
124547
|
const uncontrolledValueRef = ref(props.defaultValue);
|
|
124420
124548
|
const controlledValueRef = toRef(props, "value");
|
|
124549
|
+
const dragIndexRef = ref(null);
|
|
124550
|
+
const dragOverIndexRef = ref(null);
|
|
124421
124551
|
const mergedValueRef = useMergedState(
|
|
124422
124552
|
controlledValueRef,
|
|
124423
124553
|
uncontrolledValueRef
|
|
@@ -124428,38 +124558,44 @@ var _UDynamicTags = defineComponent({
|
|
|
124428
124558
|
const inputSizeRef = computed(() => {
|
|
124429
124559
|
return smallerSize(props.size);
|
|
124430
124560
|
});
|
|
124561
|
+
const buttonSizeRef = computed(() => {
|
|
124562
|
+
return smallerSize(props.size);
|
|
124563
|
+
});
|
|
124431
124564
|
const triggerDisabledRef = computed(() => {
|
|
124432
|
-
return mergedDisabledRef.value || !!props.max && mergedValueRef.value.length >= props.max;
|
|
124565
|
+
return formItem.mergedDisabledRef.value || !!props.max && mergedValueRef.value.length >= props.max;
|
|
124433
124566
|
});
|
|
124434
|
-
|
|
124567
|
+
const cssVarsRef = computed(() => {
|
|
124435
124568
|
const {
|
|
124436
|
-
|
|
124437
|
-
|
|
124438
|
-
|
|
124439
|
-
|
|
124440
|
-
|
|
124441
|
-
|
|
124442
|
-
|
|
124443
|
-
|
|
124444
|
-
|
|
124445
|
-
|
|
124446
|
-
|
|
124569
|
+
self: { inputWidth, draggingOpacity, dropIndicatorColor }
|
|
124570
|
+
} = themeRef.value;
|
|
124571
|
+
return {
|
|
124572
|
+
"--u-input-width": inputWidth,
|
|
124573
|
+
"--u-dragging-opacity": draggingOpacity,
|
|
124574
|
+
"--u-drop-indicator-color": dropIndicatorColor
|
|
124575
|
+
};
|
|
124576
|
+
});
|
|
124577
|
+
const tagSizeRef = computed(() => {
|
|
124578
|
+
const { size } = props;
|
|
124579
|
+
return size === "huge" ? "medium" : "small";
|
|
124580
|
+
});
|
|
124581
|
+
const themeClassHandle = inlineThemeDisabled ? useThemeClass("dynamic-tags", void 0, cssVarsRef, props) : void 0;
|
|
124582
|
+
const doChange = (value) => {
|
|
124583
|
+
if (props.onChange)
|
|
124584
|
+
call(props.onChange, value);
|
|
124585
|
+
if (props.onUpdateValue)
|
|
124586
|
+
call(props.onUpdateValue, value);
|
|
124587
|
+
if (props["onUpdate:value"])
|
|
124588
|
+
call(props["onUpdate:value"], value);
|
|
124447
124589
|
uncontrolledValueRef.value = value;
|
|
124448
|
-
triggerFormInput();
|
|
124449
|
-
triggerFormChange();
|
|
124450
|
-
}
|
|
124451
|
-
|
|
124590
|
+
formItem.triggerFormInput();
|
|
124591
|
+
formItem.triggerFormChange();
|
|
124592
|
+
};
|
|
124593
|
+
const handleCloseClick = (index) => {
|
|
124452
124594
|
const tags = mergedValueRef.value.slice(0);
|
|
124453
124595
|
tags.splice(index, 1);
|
|
124454
124596
|
doChange(tags);
|
|
124455
|
-
}
|
|
124456
|
-
|
|
124457
|
-
switch (e.key) {
|
|
124458
|
-
case "Enter":
|
|
124459
|
-
handleInputConfirm();
|
|
124460
|
-
}
|
|
124461
|
-
}
|
|
124462
|
-
function handleInputConfirm(externalValue) {
|
|
124597
|
+
};
|
|
124598
|
+
const handleInputConfirm = (externalValue) => {
|
|
124463
124599
|
const nextValue = externalValue ?? inputValueRef.value;
|
|
124464
124600
|
if (nextValue) {
|
|
124465
124601
|
const tags = mergedValueRef.value.slice(0);
|
|
@@ -124469,60 +124605,125 @@ var _UDynamicTags = defineComponent({
|
|
|
124469
124605
|
showInputRef.value = false;
|
|
124470
124606
|
inputForceFocusedRef.value = true;
|
|
124471
124607
|
inputValueRef.value = "";
|
|
124472
|
-
}
|
|
124473
|
-
|
|
124608
|
+
};
|
|
124609
|
+
const handleInputKeyUp = (event) => {
|
|
124610
|
+
if (event.key === "Enter")
|
|
124611
|
+
handleInputConfirm();
|
|
124612
|
+
};
|
|
124613
|
+
const handleInputBlur = () => {
|
|
124474
124614
|
handleInputConfirm();
|
|
124475
|
-
}
|
|
124476
|
-
|
|
124615
|
+
};
|
|
124616
|
+
const handleAddClick = () => {
|
|
124477
124617
|
showInputRef.value = true;
|
|
124478
124618
|
void nextTick(() => {
|
|
124479
124619
|
inputInstRef.value?.focus();
|
|
124480
124620
|
inputForceFocusedRef.value = false;
|
|
124481
124621
|
});
|
|
124482
|
-
}
|
|
124483
|
-
const
|
|
124484
|
-
|
|
124485
|
-
|
|
124486
|
-
|
|
124622
|
+
};
|
|
124623
|
+
const moveItem = (from, to) => {
|
|
124624
|
+
if (from === to)
|
|
124625
|
+
return;
|
|
124626
|
+
const values = [...mergedValueRef.value];
|
|
124627
|
+
const [item] = values.splice(from, 1);
|
|
124628
|
+
values.splice(to, 0, item);
|
|
124629
|
+
doChange(values);
|
|
124630
|
+
};
|
|
124631
|
+
const resetDrag = () => {
|
|
124632
|
+
dragIndexRef.value = null;
|
|
124633
|
+
dragOverIndexRef.value = null;
|
|
124634
|
+
};
|
|
124635
|
+
const handleDragStart = (event, index) => {
|
|
124636
|
+
dragIndexRef.value = index;
|
|
124637
|
+
if (event.dataTransfer) {
|
|
124638
|
+
event.dataTransfer.effectAllowed = "move";
|
|
124639
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
124640
|
+
}
|
|
124641
|
+
};
|
|
124642
|
+
const handleDragOver = (event, index) => {
|
|
124643
|
+
if (dragIndexRef.value === null)
|
|
124644
|
+
return;
|
|
124645
|
+
event.preventDefault();
|
|
124646
|
+
dragOverIndexRef.value = index;
|
|
124647
|
+
};
|
|
124648
|
+
const handleDragLeave = (event, index) => {
|
|
124649
|
+
if (dragOverIndexRef.value !== index)
|
|
124650
|
+
return;
|
|
124651
|
+
const current = event.currentTarget;
|
|
124652
|
+
const related = event.relatedTarget;
|
|
124653
|
+
if (current && related && current.contains(related))
|
|
124654
|
+
return;
|
|
124655
|
+
dragOverIndexRef.value = null;
|
|
124656
|
+
};
|
|
124657
|
+
const handleDrop = (event, index) => {
|
|
124658
|
+
if (dragIndexRef.value === null)
|
|
124659
|
+
return;
|
|
124660
|
+
event.preventDefault();
|
|
124661
|
+
moveItem(dragIndexRef.value, index);
|
|
124662
|
+
resetDrag();
|
|
124663
|
+
};
|
|
124664
|
+
const getDragProps = (index) => {
|
|
124665
|
+
if (!props.draggable || formItem.mergedDisabledRef.value)
|
|
124666
|
+
return {};
|
|
124667
|
+
const prefix = `${mergedClsPrefixRef.value}-dynamic-tags__tag`;
|
|
124668
|
+
const from = dragIndexRef.value;
|
|
124669
|
+
const isOver = from !== null && dragOverIndexRef.value === index;
|
|
124487
124670
|
return {
|
|
124488
|
-
|
|
124671
|
+
class: [
|
|
124672
|
+
prefix,
|
|
124673
|
+
`${prefix}--draggable`,
|
|
124674
|
+
{
|
|
124675
|
+
[`${prefix}--dragging`]: from === index,
|
|
124676
|
+
[`${prefix}--drop-before`]: isOver && from > index,
|
|
124677
|
+
[`${prefix}--drop-after`]: isOver && from < index
|
|
124678
|
+
}
|
|
124679
|
+
],
|
|
124680
|
+
draggable: true,
|
|
124681
|
+
onDragstart: (event) => handleDragStart(event, index),
|
|
124682
|
+
onDragover: (event) => handleDragOver(event, index),
|
|
124683
|
+
onDragleave: (event) => handleDragLeave(event, index),
|
|
124684
|
+
onDrop: (event) => handleDrop(event, index),
|
|
124685
|
+
onDragend: resetDrag
|
|
124489
124686
|
};
|
|
124490
|
-
}
|
|
124491
|
-
const tagSizeRef = computed(() => {
|
|
124492
|
-
const { size } = props;
|
|
124493
|
-
return size === "huge" ? "medium" : "small";
|
|
124494
|
-
});
|
|
124495
|
-
const themeClassHandle = inlineThemeDisabled ? useThemeClass("dynamic-tags", void 0, cssVarsRef, props) : void 0;
|
|
124687
|
+
};
|
|
124496
124688
|
return {
|
|
124497
124689
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
124498
124690
|
inputInstRef,
|
|
124499
124691
|
localizedAdd: localizedAddRef,
|
|
124500
124692
|
inputSize: inputSizeRef,
|
|
124501
124693
|
inputValue: inputValueRef,
|
|
124694
|
+
buttonSize: buttonSizeRef,
|
|
124502
124695
|
showInput: showInputRef,
|
|
124503
124696
|
inputForceFocused: inputForceFocusedRef,
|
|
124504
124697
|
mergedValue: mergedValueRef,
|
|
124505
|
-
mergedDisabled: mergedDisabledRef,
|
|
124698
|
+
mergedDisabled: formItem.mergedDisabledRef,
|
|
124506
124699
|
triggerDisabled: triggerDisabledRef,
|
|
124700
|
+
mergedTheme: themeRef,
|
|
124701
|
+
cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
|
|
124702
|
+
themeClass: themeClassHandle?.themeClass,
|
|
124703
|
+
tagSize: tagSizeRef,
|
|
124507
124704
|
handleInputKeyUp,
|
|
124508
124705
|
handleAddClick,
|
|
124509
124706
|
handleInputBlur,
|
|
124510
124707
|
handleCloseClick,
|
|
124511
124708
|
handleInputConfirm,
|
|
124512
|
-
|
|
124513
|
-
|
|
124514
|
-
themeClass: themeClassHandle?.themeClass,
|
|
124515
|
-
onRender: themeClassHandle?.onRender,
|
|
124516
|
-
tagSize: tagSizeRef
|
|
124709
|
+
getDragProps,
|
|
124710
|
+
onRender: themeClassHandle?.onRender
|
|
124517
124711
|
};
|
|
124518
124712
|
},
|
|
124519
124713
|
render() {
|
|
124520
|
-
const {
|
|
124714
|
+
const {
|
|
124715
|
+
mergedTheme,
|
|
124716
|
+
cssVars,
|
|
124717
|
+
mergedClsPrefix,
|
|
124718
|
+
themeClass,
|
|
124719
|
+
onRender,
|
|
124720
|
+
renderTag
|
|
124721
|
+
} = this;
|
|
124521
124722
|
onRender?.();
|
|
124522
124723
|
return /* @__PURE__ */ h$1(
|
|
124523
124724
|
USpace$1,
|
|
124524
124725
|
{
|
|
124525
|
-
class: [`${mergedClsPrefix}-dynamic-tags`,
|
|
124726
|
+
class: [`${mergedClsPrefix}-dynamic-tags`, themeClass],
|
|
124526
124727
|
size: "small",
|
|
124527
124728
|
style: cssVars,
|
|
124528
124729
|
theme: mergedTheme.peers.Space,
|
|
@@ -124533,36 +124734,64 @@ var _UDynamicTags = defineComponent({
|
|
|
124533
124734
|
default: () => {
|
|
124534
124735
|
const {
|
|
124535
124736
|
mergedTheme: mergedTheme2,
|
|
124737
|
+
mergedValue,
|
|
124536
124738
|
tagStyle,
|
|
124739
|
+
tagSize,
|
|
124537
124740
|
type,
|
|
124538
124741
|
round,
|
|
124539
124742
|
color,
|
|
124540
124743
|
closable,
|
|
124541
124744
|
mergedDisabled,
|
|
124745
|
+
draggable,
|
|
124542
124746
|
showInput,
|
|
124543
124747
|
inputValue,
|
|
124544
124748
|
inputStyle,
|
|
124749
|
+
inputProps,
|
|
124545
124750
|
inputSize,
|
|
124751
|
+
buttonSize,
|
|
124546
124752
|
inputForceFocused,
|
|
124547
124753
|
triggerDisabled,
|
|
124754
|
+
$slots,
|
|
124548
124755
|
handleInputKeyUp,
|
|
124549
124756
|
handleInputBlur,
|
|
124550
124757
|
handleAddClick,
|
|
124551
124758
|
handleCloseClick,
|
|
124552
124759
|
handleInputConfirm,
|
|
124553
|
-
|
|
124760
|
+
getDragProps
|
|
124554
124761
|
} = this;
|
|
124555
|
-
return
|
|
124556
|
-
(
|
|
124762
|
+
return mergedValue.map((tag, index) => {
|
|
124763
|
+
if (renderTag) {
|
|
124764
|
+
const customTag = renderTag(
|
|
124765
|
+
tag,
|
|
124766
|
+
index
|
|
124767
|
+
);
|
|
124768
|
+
if (!draggable)
|
|
124769
|
+
return customTag;
|
|
124770
|
+
const dragProps = getDragProps(index);
|
|
124771
|
+
return /* @__PURE__ */ h$1(
|
|
124772
|
+
"div",
|
|
124773
|
+
{
|
|
124774
|
+
key: index,
|
|
124775
|
+
...dragProps,
|
|
124776
|
+
class: [
|
|
124777
|
+
`${mergedClsPrefix}-dynamic-tags__tag-wrapper`,
|
|
124778
|
+
dragProps.class
|
|
124779
|
+
]
|
|
124780
|
+
},
|
|
124781
|
+
customTag
|
|
124782
|
+
);
|
|
124783
|
+
}
|
|
124784
|
+
return /* @__PURE__ */ h$1(
|
|
124557
124785
|
_UTag,
|
|
124558
124786
|
{
|
|
124559
124787
|
key: index,
|
|
124788
|
+
...getDragProps(index),
|
|
124560
124789
|
theme: mergedTheme2.peers.Tag,
|
|
124561
124790
|
themeOverrides: mergedTheme2.peerOverrides.Tag,
|
|
124562
124791
|
style: tagStyle,
|
|
124563
124792
|
type,
|
|
124564
124793
|
round,
|
|
124565
|
-
size:
|
|
124794
|
+
size: tagSize,
|
|
124566
124795
|
color,
|
|
124567
124796
|
closable,
|
|
124568
124797
|
disabled: mergedDisabled,
|
|
@@ -124573,8 +124802,8 @@ var _UDynamicTags = defineComponent({
|
|
|
124573
124802
|
{
|
|
124574
124803
|
default: () => typeof tag === "string" ? tag : tag.label
|
|
124575
124804
|
}
|
|
124576
|
-
)
|
|
124577
|
-
).concat(
|
|
124805
|
+
);
|
|
124806
|
+
}).concat(
|
|
124578
124807
|
showInput ? $slots.input ? $slots.input({
|
|
124579
124808
|
submit: handleInputConfirm,
|
|
124580
124809
|
deactivate: handleInputBlur
|
|
@@ -124585,7 +124814,7 @@ var _UDynamicTags = defineComponent({
|
|
|
124585
124814
|
size: inputSize,
|
|
124586
124815
|
style: inputStyle,
|
|
124587
124816
|
autosize: true,
|
|
124588
|
-
...
|
|
124817
|
+
...inputProps,
|
|
124589
124818
|
ref: "inputInstRef",
|
|
124590
124819
|
value: inputValue,
|
|
124591
124820
|
onUpdateValue: (v) => {
|
|
@@ -124607,7 +124836,7 @@ var _UDynamicTags = defineComponent({
|
|
|
124607
124836
|
disabled: triggerDisabled,
|
|
124608
124837
|
theme: mergedTheme2.peers.Button,
|
|
124609
124838
|
themeOverrides: mergedTheme2.peerOverrides.Button,
|
|
124610
|
-
size:
|
|
124839
|
+
size: buttonSize,
|
|
124611
124840
|
onClick: handleAddClick
|
|
124612
124841
|
},
|
|
124613
124842
|
{
|
|
@@ -155094,7 +155323,7 @@ function useThemeVars() {
|
|
|
155094
155323
|
});
|
|
155095
155324
|
}
|
|
155096
155325
|
|
|
155097
|
-
var version = "2.4.
|
|
155326
|
+
var version = "2.4.8";
|
|
155098
155327
|
|
|
155099
155328
|
function create({
|
|
155100
155329
|
componentPrefix = "U",
|