vft 0.0.333 → 0.0.335

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.
@@ -1,15 +1,122 @@
1
- import { defineComponent as w, useSlots as U, shallowRef as T, computed as h, onBeforeUnmount as j, provide as N, toRef as V, createElementBlock as q, openBlock as f, normalizeClass as z, unref as t, createBlock as c, createCommentVNode as o, renderSlot as l, createSlots as g, withCtx as r, createVNode as D, mergeProps as k } from "vue";
1
+ import { defineComponent as E, useSlots as T, shallowRef as V, computed as b, onBeforeUnmount as j, provide as N, toRef as O, createElementBlock as q, openBlock as u, normalizeClass as D, unref as o, createBlock as v, createCommentVNode as t, renderSlot as r, createSlots as B, withCtx as a, createVNode as H, mergeProps as S } from "vue";
2
+ import "../alert/index.js";
3
+ import "../avatar/index.js";
4
+ import "../avatar-stack/index.js";
5
+ import "../backtop/index.js";
6
+ import "../button/index.js";
7
+ import "../card/index.js";
8
+ import "../cascader/index.js";
9
+ import "../cascader-panel/index.js";
10
+ import "../check-tag/index.js";
11
+ import "../checkbox/index.js";
12
+ import "../clamp/index.js";
13
+ import "../clamp-toggle/index.js";
14
+ import "../clamp-tooltip/index.js";
15
+ import "../col/index.js";
16
+ import "../collapse-transition/index.js";
17
+ import "../color-picker/index.js";
18
+ import "../config-provider/index.js";
19
+ import "../container/index.js";
20
+ import "@vft/utils";
21
+ import "../context-menu/context-menu.vue2.js";
22
+ import "../icon/index.js";
23
+ import "../date-picker/index.js";
24
+ import "../date-time-select/index.js";
25
+ import "../descriptions/index.js";
26
+ import "../dialog/index.js";
27
+ import "../divider/index.js";
28
+ import "../drawer/index.js";
29
+ import "../dropdown/index.js";
30
+ import "../empty/index.js";
31
+ import "../footer-layout/index.js";
2
32
  import "../form/index.js";
3
- import { ajaxUpload as H } from "./ajax.js";
4
- import { uploadContextKey as K } from "./constants.js";
5
- import R from "./upload-content.vue2.js";
6
- import b from "./upload-list.vue2.js";
7
- import { useHandlers as O } from "./use-handlers.js";
8
- import { useFormDisabled as W } from "../form/hooks/use-form-common-props.js";
9
- const A = w({
33
+ import "../full-screen/index.js";
34
+ import "../header-layout/index.js";
35
+ import "../horizontal-menu/index.js";
36
+ import "../icon-text/index.js";
37
+ import "../iframe-layout/index.js";
38
+ import "../image/index.js";
39
+ import "../image-viewer/index.js";
40
+ import "../input/index.js";
41
+ import "../input-number/index.js";
42
+ import "../link/index.js";
43
+ import "../list-cell/index.js";
44
+ import "../logo/index.js";
45
+ import "../menu/index.js";
46
+ import "../multiple-tabs/index.js";
47
+ import "../notification/index.js";
48
+ import "../overlay/index.js";
49
+ import "../page-wrapper/index.js";
50
+ import "../pagination/index.js";
51
+ import "../popconfirm/index.js";
52
+ import "../popover/index.js";
53
+ import "../popper/index.js";
54
+ import "../qrcode/index.js";
55
+ import "../radio/index.js";
56
+ import "../result/index.js";
57
+ import "../router-view-content/index.js";
58
+ import "../row/index.js";
59
+ import "../scrollbar/index.js";
60
+ import "../search/index.js";
61
+ import "../select/index.js";
62
+ import "../side-menu/index.js";
63
+ import "../skeleton/index.js";
64
+ import "../slider/index.js";
65
+ import "../space/index.js";
66
+ import "../steps/index.js";
67
+ import "../switch/index.js";
68
+ import "../table/index.js";
69
+ import "../tabs/index.js";
70
+ import "../tag/index.js";
71
+ import "../time-picker/index.js";
72
+ import "../tooltip/index.js";
73
+ import "../tree/index.js";
74
+ import "../verify-code/index.js";
75
+ import "../virtual-list/components/fixed-size-list.js";
76
+ import "../virtual-list/components/dynamic-size-list.js";
77
+ import "../virtual-list/components/fixed-size-grid.js";
78
+ import "../virtual-list/components/dynamic-size-grid.js";
79
+ import "../virtual-list/props.js";
80
+ import "../autocomplete/index.js";
81
+ import "../breadcrumb/index.js";
82
+ import "../carousel/index.js";
83
+ import "../collapse/index.js";
84
+ import "../countdown/index.js";
85
+ import "../input-tag/index.js";
86
+ import "../modal/index.js";
87
+ import "../progress/index.js";
88
+ import "../segmented/index.js";
89
+ import "../statistic/index.js";
90
+ import "../super-form/index.js";
91
+ import "../timeline/index.js";
92
+ import "../transfer/index.js";
93
+ import "./index.js";
94
+ import "../watermark/index.js";
95
+ import "../md-code-demo/index.js";
96
+ import "../md-code-tabs/index.js";
97
+ import "../md-comment/index.js";
98
+ import "../md-container/index.js";
99
+ import "../md-tabs/index.js";
100
+ import "../md-vue-playground/index.js";
101
+ import "../infinite-scroll/index.js";
102
+ import "@vueuse/core";
103
+ import "../config-provider/hooks/use-global-config.js";
104
+ import "lodash-es";
105
+ import "../../hooks/use-model-toggle/index.js";
106
+ import "@popperjs/core";
107
+ import "../../hooks/use-z-index/index.js";
108
+ import { VftMessage as I } from "../message/index.js";
109
+ import "../progress-i/index.js";
110
+ import { ajaxUpload as K } from "./ajax.js";
111
+ import { uploadContextKey as W } from "./constants.js";
112
+ import $ from "./upload-content.vue2.js";
113
+ import C from "./upload-list.vue2.js";
114
+ import { useHandlers as A } from "./use-handlers.js";
115
+ import { useFormDisabled as G } from "../form/hooks/use-form-common-props.js";
116
+ const J = E({
10
117
  name: "vft-upload"
11
- }), x = /* @__PURE__ */ w({
12
- ...A,
118
+ }), tt = /* @__PURE__ */ E({
119
+ ...J,
13
120
  props: {
14
121
  action: { default: "#" },
15
122
  headers: {},
@@ -25,9 +132,12 @@ const A = w({
25
132
  fileList: { default: [] },
26
133
  autoUpload: { type: Boolean, default: !1 },
27
134
  listType: { default: "text" },
28
- httpRequest: { type: Function, default: H },
135
+ httpRequest: { type: Function, default: K },
29
136
  disabled: { type: Boolean },
30
137
  limit: {},
138
+ replaceOnLimit: { type: Boolean, default: !1 },
139
+ maxSize: { default: void 0 },
140
+ sizeExceedMessage: { default: "文件大小超出限制" },
31
141
  beforeUpload: {},
32
142
  beforeRemove: {},
33
143
  onRemove: {},
@@ -37,60 +147,78 @@ const A = w({
37
147
  onProgress: {},
38
148
  onError: {},
39
149
  onExceed: { type: Function, default: () => {
40
- } }
150
+ } },
151
+ onSizeExceed: {}
41
152
  },
42
- setup($, { expose: B }) {
43
- const i = $, a = U(), u = W(), p = T(), {
44
- abort: C,
45
- submit: F,
46
- clearFiles: L,
47
- uploadFiles: s,
48
- handleStart: v,
153
+ setup(F, { expose: L }) {
154
+ const i = F, p = T(), c = G(), s = V(), {
155
+ abort: y,
156
+ submit: g,
157
+ clearFiles: h,
158
+ uploadFiles: m,
159
+ handleStart: w,
49
160
  handleError: P,
50
- handleRemove: d,
51
- handleSuccess: S,
52
- handleProgress: E
53
- } = O(i, p), n = h(() => i.listType === "picture-card"), y = h(() => ({
161
+ handleRemove: n,
162
+ handleSuccess: z,
163
+ handleProgress: M
164
+ } = A(i, s), d = b(() => i.listType === "picture-card"), U = {
165
+ abort: y,
166
+ submit: g,
167
+ clearFiles: h,
168
+ uploadFiles: m,
169
+ uploadRef: s
170
+ }, k = b(() => ({
54
171
  ...i,
55
- fileList: s.value,
56
- onStart: v,
57
- onProgress: E,
58
- onSuccess: S,
172
+ fileList: m.value,
173
+ onStart: w,
174
+ onProgress: M,
175
+ onSuccess: z,
59
176
  onError: P,
60
- onRemove: d
177
+ onRemove: n,
178
+ onChange: (e, l) => {
179
+ i.onChange?.(e, l, U);
180
+ },
181
+ onSizeExceed: (e, l) => {
182
+ if (i.onSizeExceed)
183
+ i.onSizeExceed?.(e, l);
184
+ else {
185
+ const R = `文件大小不能超过 ${(l / 1048576).toFixed(2)}MB`;
186
+ console.warn("默认文件大小超出提示:", R), I.warning(R);
187
+ }
188
+ }
61
189
  }));
62
190
  return j(() => {
63
- s.value.forEach(({ url: e }) => {
191
+ m.value.forEach(({ url: e }) => {
64
192
  e?.startsWith("blob:") && URL.revokeObjectURL(e);
65
193
  });
66
- }), N(K, {
67
- accept: V(i, "accept")
68
- }), B({
69
- abort: C,
70
- submit: F,
71
- clearFiles: L,
72
- handleStart: v,
73
- handleRemove: d,
74
- fileList: s
75
- }), (e, G) => (f(), q("div", {
76
- class: z(["vft-upload-wrapper", { disabled: t(u) }])
194
+ }), N(W, {
195
+ accept: O(i, "accept")
196
+ }), L({
197
+ abort: y,
198
+ submit: g,
199
+ clearFiles: h,
200
+ handleStart: w,
201
+ handleRemove: n,
202
+ fileList: m
203
+ }), (e, l) => (u(), q("div", {
204
+ class: D(["vft-upload-wrapper", { disabled: o(c) }])
77
205
  }, [
78
- n.value && e.showFileList ? (f(), c(b, {
206
+ d.value && e.showFileList ? (u(), v(C, {
79
207
  key: 0,
80
- disabled: t(u),
208
+ disabled: o(c),
81
209
  "list-type": e.listType,
82
- files: t(s),
210
+ files: o(m),
83
211
  "handle-preview": e.onPreview,
84
- onRemove: t(d)
85
- }, g({
86
- append: r(() => [
87
- D(R, k({
212
+ onRemove: o(n)
213
+ }, B({
214
+ append: a(() => [
215
+ H($, S({
88
216
  ref_key: "uploadRef",
89
- ref: p
90
- }, y.value), {
91
- default: r(() => [
92
- t(a).trigger ? l(e.$slots, "trigger", { key: 0 }) : o("", !0),
93
- !t(a).trigger && t(a).default ? l(e.$slots, "default", { key: 1 }) : o("", !0)
217
+ ref: s
218
+ }, k.value), {
219
+ default: a(() => [
220
+ o(p).trigger ? r(e.$slots, "trigger", { key: 0 }) : t("", !0),
221
+ !o(p).trigger && o(p).default ? r(e.$slots, "default", { key: 1 }) : t("", !0)
94
222
  ]),
95
223
  _: 3
96
224
  }, 16)
@@ -99,44 +227,44 @@ const A = w({
99
227
  }, [
100
228
  e.$slots.file ? {
101
229
  name: "default",
102
- fn: r(({ file: m }) => [
103
- l(e.$slots, "file", { file: m })
230
+ fn: a(({ file: f }) => [
231
+ r(e.$slots, "file", { file: f })
104
232
  ]),
105
233
  key: "0"
106
234
  } : void 0
107
- ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : o("", !0),
108
- !n.value || n.value && !e.showFileList ? (f(), c(R, k({
235
+ ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : t("", !0),
236
+ !d.value || d.value && !e.showFileList ? (u(), v($, S({
109
237
  key: 1,
110
238
  ref_key: "uploadRef",
111
- ref: p
112
- }, y.value), {
113
- default: r(() => [
114
- t(a).trigger ? l(e.$slots, "trigger", { key: 0 }) : o("", !0),
115
- !t(a).trigger && t(a).default ? l(e.$slots, "default", { key: 1 }) : o("", !0)
239
+ ref: s
240
+ }, k.value), {
241
+ default: a(() => [
242
+ o(p).trigger ? r(e.$slots, "trigger", { key: 0 }) : t("", !0),
243
+ !o(p).trigger && o(p).default ? r(e.$slots, "default", { key: 1 }) : t("", !0)
116
244
  ]),
117
245
  _: 3
118
- }, 16)) : o("", !0),
119
- e.$slots.trigger ? l(e.$slots, "default", { key: 2 }) : o("", !0),
120
- l(e.$slots, "tip"),
121
- !n.value && e.showFileList ? (f(), c(b, {
246
+ }, 16)) : t("", !0),
247
+ e.$slots.trigger ? r(e.$slots, "default", { key: 2 }) : t("", !0),
248
+ r(e.$slots, "tip"),
249
+ !d.value && e.showFileList ? (u(), v(C, {
122
250
  key: 3,
123
- disabled: t(u),
251
+ disabled: o(c),
124
252
  "list-type": e.listType,
125
- files: t(s),
253
+ files: o(m),
126
254
  "handle-preview": e.onPreview,
127
- onRemove: t(d)
128
- }, g({ _: 2 }, [
255
+ onRemove: o(n)
256
+ }, B({ _: 2 }, [
129
257
  e.$slots.file ? {
130
258
  name: "default",
131
- fn: r(({ file: m }) => [
132
- l(e.$slots, "file", { file: m })
259
+ fn: a(({ file: f }) => [
260
+ r(e.$slots, "file", { file: f })
133
261
  ]),
134
262
  key: "0"
135
263
  } : void 0
136
- ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : o("", !0)
264
+ ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : t("", !0)
137
265
  ], 2));
138
266
  }
139
267
  });
140
268
  export {
141
- x as default
269
+ tt as default
142
270
  };
@@ -1,38 +1,44 @@
1
- import { useVModel as L } from "@vueuse/core";
1
+ import { useVModel as O } from "@vueuse/core";
2
2
  import "@vft/utils";
3
- import { throwError as U, debugWarn as E } from "../../utils/error.js";
3
+ import { throwError as U, debugWarn as F } from "../../utils/error.js";
4
4
  import "../config-provider/hooks/use-global-config.js";
5
- import { watch as l } from "vue";
6
- import { isNil as F } from "lodash-es";
7
- import { genFileId as d } from "./constants.js";
8
- const v = "VftUpload", O = (o) => {
9
- o.url?.startsWith("blob:") && URL.revokeObjectURL(o.url);
10
- }, k = (o, c) => {
11
- const a = L(
12
- o,
5
+ import { watch as f } from "vue";
6
+ import { isNil as j } from "lodash-es";
7
+ import { genFileId as m } from "./constants.js";
8
+ const h = "VftUpload", b = (u) => {
9
+ u.url?.startsWith("blob:") && URL.revokeObjectURL(u.url);
10
+ }, z = (u, i) => {
11
+ const r = O(
12
+ u,
13
13
  "fileList",
14
14
  void 0,
15
15
  { passive: !0 }
16
- ), s = (e) => a.value.find((t) => t.uid === e.uid);
17
- function i(e) {
18
- c.value?.abort(e);
16
+ ), c = (e) => r.value.find((t) => t.uid === e.uid), s = {
17
+ abort: l,
18
+ submit: v,
19
+ clearFiles: d,
20
+ uploadFiles: r,
21
+ uploadRef: i
22
+ };
23
+ function l(e) {
24
+ i.value?.abort(e);
19
25
  }
20
- function f(e = ["ready", "uploading", "success", "fail"]) {
21
- a.value = a.value.filter(
26
+ function d(e = ["ready", "uploading", "success", "fail"]) {
27
+ r.value = r.value.filter(
22
28
  (t) => !e.includes(t.status)
23
29
  );
24
30
  }
25
- const m = (e, t) => {
26
- const r = s(t);
27
- r && (console.error(e), r.status = "fail", a.value.splice(a.value.indexOf(r), 1), o.onError?.(e, r, a.value), o.onChange?.(r, a.value));
28
- }, b = (e, t) => {
29
- const r = s(t);
30
- r && (o.onProgress?.(e, r, a.value), r.status = "uploading", r.percentage = Math.round(e.percent));
31
- }, h = (e, t) => {
32
- const r = s(t);
33
- r && (r.status = "success", r.response = e, o.onSuccess?.(e, r, a.value), o.onChange?.(r, a.value));
34
- }, g = (e) => {
35
- F(e.uid) && (e.uid = d());
31
+ const g = (e, t) => {
32
+ const a = c(t);
33
+ a && (console.error(e), a.status = "fail", r.value.splice(r.value.indexOf(a), 1), u.onError?.(e, a, r.value), u.onChange?.(a, r.value, s));
34
+ }, L = (e, t) => {
35
+ const a = c(t);
36
+ a && (u.onProgress?.(e, a, r.value), a.status = "uploading", a.percentage = Math.round(e.percent));
37
+ }, R = (e, t) => {
38
+ const a = c(t);
39
+ a && (a.status = "success", a.response = e, u.onSuccess?.(e, a, r.value), u.onChange?.(a, r.value, s));
40
+ }, y = (e) => {
41
+ j(e.uid) && (e.uid = m());
36
42
  const t = {
37
43
  name: e.name,
38
44
  percentage: 0,
@@ -41,61 +47,63 @@ const v = "VftUpload", O = (o) => {
41
47
  raw: e,
42
48
  uid: e.uid
43
49
  };
44
- if (o.listType === "picture-card" || o.listType === "picture")
50
+ if (u.listType === "picture-card" || u.listType === "picture")
45
51
  try {
46
52
  t.url = URL.createObjectURL(e);
47
- } catch (r) {
48
- E(v, r.message), o.onError?.(r, t, a.value);
53
+ } catch (a) {
54
+ F(h, a.message), u.onError?.(a, t, r.value);
49
55
  }
50
- a.value = [...a.value, t], o.onChange?.(t, a.value);
51
- }, R = async (e) => {
52
- const t = e instanceof File ? s(e) : e;
53
- t || U(v, "file to be removed not found");
54
- const r = (u) => {
55
- i(u);
56
- const n = a.value;
57
- n.splice(n.indexOf(u), 1), o.onRemove?.(u, n), O(u);
56
+ u.limit === 1 && u.replaceOnLimit && r.value.length > 0 && (r.value.forEach((a) => {
57
+ b(a);
58
+ }), r.value = []), r.value = [...r.value, t], u.onChange?.(t, r.value, s);
59
+ }, E = async (e) => {
60
+ const t = e instanceof File ? c(e) : e;
61
+ t || U(h, "file to be removed not found");
62
+ const a = (n) => {
63
+ l(n);
64
+ const o = r.value;
65
+ o.splice(o.indexOf(n), 1), u.onRemove?.(n, o), b(n);
58
66
  };
59
- o.beforeRemove ? await o.beforeRemove(t, a.value) !== !1 && r(t) : r(t);
67
+ u.beforeRemove ? await u.beforeRemove(t, r.value) !== !1 && a(t) : a(t);
60
68
  };
61
- function y() {
62
- a.value.filter(({ status: e }) => e === "ready").forEach(({ raw: e }) => e && c.value?.upload(e));
69
+ function v() {
70
+ r.value.filter(({ status: e }) => e === "ready").forEach(({ raw: e }) => e && i.value?.upload(e));
63
71
  }
64
- return l(
65
- () => o.listType,
72
+ return f(
73
+ () => u.listType,
66
74
  (e) => {
67
- e !== "picture-card" && e !== "picture" || (a.value = a.value.map((t) => {
68
- const { raw: r, url: u } = t;
69
- if (!u && r)
75
+ e !== "picture-card" && e !== "picture" || (r.value = r.value.map((t) => {
76
+ const { raw: a, url: n } = t;
77
+ if (!n && a)
70
78
  try {
71
- t.url = URL.createObjectURL(r);
72
- } catch (n) {
73
- o.onError?.(n, t, a.value);
79
+ t.url = URL.createObjectURL(a);
80
+ } catch (o) {
81
+ u.onError?.(o, t, r.value);
74
82
  }
75
83
  return t;
76
84
  }));
77
85
  }
78
- ), l(
79
- a,
86
+ ), f(
87
+ r,
80
88
  (e) => {
81
89
  if (e)
82
90
  for (const t of e)
83
- t.uid ||= d(), t.status ||= "success";
91
+ t.uid ||= m(), t.status ||= "success";
84
92
  },
85
93
  { immediate: !0, deep: !0 }
86
94
  ), {
87
95
  /** @description two-way binding ref from props `fileList` */
88
- uploadFiles: a,
89
- abort: i,
90
- clearFiles: f,
91
- handleError: m,
92
- handleProgress: b,
93
- handleStart: g,
94
- handleSuccess: h,
95
- handleRemove: R,
96
- submit: y
96
+ uploadFiles: r,
97
+ abort: l,
98
+ clearFiles: d,
99
+ handleError: g,
100
+ handleProgress: L,
101
+ handleStart: y,
102
+ handleSuccess: R,
103
+ handleRemove: E,
104
+ submit: v
97
105
  };
98
106
  };
99
107
  export {
100
- k as useHandlers
108
+ z as useHandlers
101
109
  };
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.333",
3
+ "version": "0.0.335",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -1,4 +1,4 @@
1
- const o = "0.0.333";
1
+ const o = "0.0.335";
2
2
  export {
3
3
  o as version
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),ae=require("../../hooks/use-attrs/index.cjs");require("@vueuse/core");const le=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const se=require("../../hooks/use-calc-input-width/index.cjs"),S=require("../icon/index.cjs"),ue=require("../tag/index.cjs");require("../form/index.cjs");const V=require("./input-tag.cjs"),ie=require("./composables/use-drag-tag.cjs"),de=require("./composables/use-hovering.cjs"),fe=require("./composables/use-input-tag.cjs"),ce=require("./composables/use-input-tag-dom.cjs"),w=require("../form/hooks/use-form-item.cjs"),pe=["id","minlength","maxlength","disabled","readonly","autocomplete","tabindex","placeholder","autofocus","ariaLabel"],me=["textContent"],ge=e.defineComponent({name:"ElInputTag",inheritAttrs:!1}),ve=e.defineComponent({...ge,props:V.inputTagProps,emits:V.inputTagEmits,setup(T,{expose:E,emit:z}){const i=T,B=z,M=ae.useAttrs(),N=e.useSlots(),{form:R,formItem:d}=w.useFormItem(),{inputId:x}=w.useFormItemInputId(i,{formItemContext:d}),c=e.computed(()=>R?.statusIcon??!1),a=e.computed(()=>d?.validateState||""),$={validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"},p=e.computed(()=>a.value&&$[a.value]),{inputRef:F,wrapperRef:m,isFocused:L,inputValue:l,size:K,tagSize:P,placeholder:A,closable:g,disabled:v,handleDragged:H,handleInput:C,handleKeydown:I,handleRemoveTag:O,handleClear:U,handleCompositionStart:k,handleCompositionUpdate:y,handleCompositionEnd:h,focus:D,blur:j}=fe.useInputTag({props:i,emit:B,formItem:d}),{hovering:W,handleMouseEnter:b,handleMouseLeave:q}=de.useHovering(),{calculatorRef:G,inputStyle:J}=se.useCalcInputWidth(),{dropIndicatorRef:Q,showDropIndicator:X,handleDragStart:Y,handleDragOver:Z,handleDragEnd:_}=ie.useDragTag({wrapperRef:m,handleDragged:H,afterDragged:D}),{ns:t,nsInput:f,containerKls:ee,containerStyle:ne,innerKls:re,showClear:oe,showSuffix:te}=ce.useInputTagDom({props:i,hovering:W,isFocused:L,inputValue:l,disabled:v,size:K,validateState:a,validateIcon:p,needStatusIcon:c});return E({focus:D,blur:j}),(o,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:m,class:e.normalizeClass(e.unref(ee)),style:e.normalizeStyle(e.unref(ne)),onMouseenter:n[7]||(n[7]=(...r)=>e.unref(b)&&e.unref(b)(...r)),onMouseleave:n[8]||(n[8]=(...r)=>e.unref(q)&&e.unref(q)(...r))},[e.unref(N).prefix?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("prefix"))},[e.renderSlot(o.$slots,"prefix")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(re))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.modelValue,(r,s)=>(e.openBlock(),e.createBlock(e.unref(ue.VftTag),{key:s,size:e.unref(P),closable:e.unref(g),type:o.tagType,effect:o.tagEffect,draggable:e.unref(g)&&o.draggable,"disable-transitions":"",onClose:u=>e.unref(O)(s),onDragstart:u=>e.unref(Y)(u,s),onDragover:u=>e.unref(Z)(u,s),onDragend:e.unref(_),onDrop:n[0]||(n[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"tag",{value:r,index:s},()=>[e.createTextVNode(e.toDisplayString(r),1)])]),_:2},1032,["size","closable","type","effect","draggable","onClose","onDragstart","onDragover","onDragend"]))),128)),e.createElementVNode("div",{class:e.normalizeClass(e.unref(t).e("input-wrapper"))},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(x),ref_key:"inputRef",ref:F,"onUpdate:modelValue":n[1]||(n[1]=r=>e.isRef(l)?l.value=r:null)},e.unref(M),{type:"text",minlength:o.minlength,maxlength:o.maxlength,disabled:e.unref(v),readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,placeholder:e.unref(A),autofocus:o.autofocus,ariaLabel:o.ariaLabel,class:e.unref(t).e("input"),style:e.unref(J),onCompositionstart:n[2]||(n[2]=(...r)=>e.unref(k)&&e.unref(k)(...r)),onCompositionupdate:n[3]||(n[3]=(...r)=>e.unref(y)&&e.unref(y)(...r)),onCompositionend:n[4]||(n[4]=(...r)=>e.unref(h)&&e.unref(h)(...r)),onInput:n[5]||(n[5]=(...r)=>e.unref(C)&&e.unref(C)(...r)),onKeydown:n[6]||(n[6]=(...r)=>e.unref(I)&&e.unref(I)(...r))}),null,16,pe),[[e.vModelText,e.unref(l)]]),e.createElementVNode("span",{ref_key:"calculatorRef",ref:G,"aria-hidden":"true",class:e.normalizeClass(e.unref(t).e("input-calculator")),textContent:e.toDisplayString(e.unref(l))},null,10,me)],2),e.withDirectives(e.createElementVNode("div",{ref_key:"dropIndicatorRef",ref:Q,class:e.normalizeClass(e.unref(t).e("drop-indicator"))},null,2),[[e.vShow,e.unref(X)]])],2),e.unref(te)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(t).e("suffix"))},[e.renderSlot(o.$slots,"suffix"),e.unref(oe)?(e.openBlock(),e.createBlock(e.unref(S.VftIcon),{key:0,class:e.normalizeClass([e.unref(t).e("icon"),e.unref(t).e("clear")]),onMousedown:e.withModifiers(e.unref(le.noop),["prevent"]),onClick:e.unref(U),icon:"icon-circle-close"},null,8,["class","onMousedown","onClick"])):e.createCommentVNode("",!0),a.value&&p.value&&c.value?(e.openBlock(),e.createBlock(e.unref(S.VftIcon),{key:1,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("validateIcon"),e.unref(f).is("loading",a.value==="validating")]),icon:"validateIcon"},null,8,["class"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],38))}});exports.default=ve;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const S=require("../icon/index.cjs"),ae=require("../tag/index.cjs"),le=require("../../hooks/use-attrs/index.cjs");require("@vueuse/core");const se=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const ue=require("../../hooks/use-calc-input-width/index.cjs"),ie=require("./composables/use-drag-tag.cjs"),de=require("./composables/use-hovering.cjs"),fe=require("./composables/use-input-tag.cjs"),ce=require("./composables/use-input-tag-dom.cjs"),V=require("./input-tag.cjs"),w=require("../form/hooks/use-form-item.cjs"),pe=["id","minlength","maxlength","disabled","readonly","autocomplete","tabindex","placeholder","autofocus","ariaLabel"],me=["textContent"],ge=e.defineComponent({name:"VftInputTag",inheritAttrs:!1}),ve=e.defineComponent({...ge,props:V.inputTagProps,emits:V.inputTagEmits,setup(T,{expose:z,emit:B}){const i=T,E=B,M=le.useAttrs(),N=e.useSlots(),{form:R,formItem:d}=w.useFormItem(),{inputId:x}=w.useFormItemInputId(i,{formItemContext:d}),c=e.computed(()=>R?.statusIcon??!1),a=e.computed(()=>d?.validateState||""),$={validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"},p=e.computed(()=>a.value&&$[a.value]),{inputRef:F,wrapperRef:m,isFocused:L,inputValue:l,size:K,tagSize:P,placeholder:A,closable:g,disabled:v,handleDragged:H,handleInput:C,handleKeydown:I,handleRemoveTag:O,handleClear:U,handleCompositionStart:k,handleCompositionUpdate:y,handleCompositionEnd:h,focus:D,blur:j}=fe.useInputTag({props:i,emit:E,formItem:d}),{hovering:W,handleMouseEnter:b,handleMouseLeave:q}=de.useHovering(),{calculatorRef:G,inputStyle:J}=ue.useCalcInputWidth(),{dropIndicatorRef:Q,showDropIndicator:X,handleDragStart:Y,handleDragOver:Z,handleDragEnd:_}=ie.useDragTag({wrapperRef:m,handleDragged:H,afterDragged:D}),{ns:t,nsInput:f,containerKls:ee,containerStyle:ne,innerKls:re,showClear:oe,showSuffix:te}=ce.useInputTagDom({props:i,hovering:W,isFocused:L,inputValue:l,disabled:v,size:K,validateState:a,validateIcon:p,needStatusIcon:c});return z({focus:D,blur:j}),(o,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:m,class:e.normalizeClass(e.unref(ee)),style:e.normalizeStyle(e.unref(ne)),onMouseenter:n[7]||(n[7]=(...r)=>e.unref(b)&&e.unref(b)(...r)),onMouseleave:n[8]||(n[8]=(...r)=>e.unref(q)&&e.unref(q)(...r))},[e.unref(N).prefix?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("prefix"))},[e.renderSlot(o.$slots,"prefix")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(re))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.modelValue,(r,s)=>(e.openBlock(),e.createBlock(e.unref(ae.VftTag),{key:s,size:e.unref(P),closable:e.unref(g),type:o.tagType,effect:o.tagEffect,draggable:e.unref(g)&&o.draggable,"disable-transitions":"",onClose:u=>e.unref(O)(s),onDragstart:u=>e.unref(Y)(u,s),onDragover:u=>e.unref(Z)(u,s),onDragend:e.unref(_),onDrop:n[0]||(n[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"tag",{value:r,index:s},()=>[e.createTextVNode(e.toDisplayString(r),1)])]),_:2},1032,["size","closable","type","effect","draggable","onClose","onDragstart","onDragover","onDragend"]))),128)),e.createElementVNode("div",{class:e.normalizeClass(e.unref(t).e("input-wrapper"))},[e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(x),ref_key:"inputRef",ref:F,"onUpdate:modelValue":n[1]||(n[1]=r=>e.isRef(l)?l.value=r:null)},e.unref(M),{type:"text",minlength:o.minlength,maxlength:o.maxlength,disabled:e.unref(v),readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,placeholder:e.unref(A),autofocus:o.autofocus,ariaLabel:o.ariaLabel,class:e.unref(t).e("input"),style:e.unref(J),onCompositionstart:n[2]||(n[2]=(...r)=>e.unref(k)&&e.unref(k)(...r)),onCompositionupdate:n[3]||(n[3]=(...r)=>e.unref(y)&&e.unref(y)(...r)),onCompositionend:n[4]||(n[4]=(...r)=>e.unref(h)&&e.unref(h)(...r)),onInput:n[5]||(n[5]=(...r)=>e.unref(C)&&e.unref(C)(...r)),onKeydown:n[6]||(n[6]=(...r)=>e.unref(I)&&e.unref(I)(...r))}),null,16,pe),[[e.vModelText,e.unref(l)]]),e.createElementVNode("span",{ref_key:"calculatorRef",ref:G,"aria-hidden":"true",class:e.normalizeClass(e.unref(t).e("input-calculator")),textContent:e.toDisplayString(e.unref(l))},null,10,me)],2),e.withDirectives(e.createElementVNode("div",{ref_key:"dropIndicatorRef",ref:Q,class:e.normalizeClass(e.unref(t).e("drop-indicator"))},null,2),[[e.vShow,e.unref(X)]])],2),e.unref(te)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(t).e("suffix"))},[e.renderSlot(o.$slots,"suffix"),e.unref(oe)?(e.openBlock(),e.createBlock(e.unref(S.VftIcon),{key:0,class:e.normalizeClass([e.unref(t).e("icon"),e.unref(t).e("clear")]),onMousedown:e.withModifiers(e.unref(se.noop),["prevent"]),onClick:e.unref(U),icon:"icon-circle-close"},null,8,["class","onMousedown","onClick"])):e.createCommentVNode("",!0),a.value&&p.value&&c.value?(e.openBlock(),e.createBlock(e.unref(S.VftIcon),{key:1,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("validateIcon"),e.unref(f).is("loading",a.value==="validating")]),icon:"validateIcon"},null,8,["class"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],38))}});exports.default=ve;