vft 0.0.329 → 0.0.332

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,17 +1,17 @@
1
- import { defineComponent as Oe, useAttrs as Te, useSlots as Le, computed as l, ref as S, getCurrentInstance as je, shallowRef as H, watch as U, nextTick as E, onMounted as We, withDirectives as He, createElementBlock as c, openBlock as i, mergeProps as v, Fragment as q, createCommentVNode as r, createElementVNode as w, normalizeClass as u, unref as a, renderSlot as $, createBlock as V, withKeys as Ue, withModifiers as me, toDisplayString as N, normalizeStyle as qe, vShow as Ge } from "vue";
2
- import { UPDATE_MODEL_EVENT as G } from "@vft/constants";
3
- import { useAttrs as Je, useCursor as Qe } from "@vft/use";
4
- import { isString as B, singleAttrToObj as J, noop as Xe, isObject as ve } from "@vft/utils";
1
+ import { defineComponent as Oe, useAttrs as Te, useSlots as Le, computed as l, ref as S, getCurrentInstance as je, shallowRef as H, watch as U, nextTick as E, onMounted as We, withDirectives as He, createElementBlock as c, openBlock as i, mergeProps as y, Fragment as q, createCommentVNode as u, createElementVNode as x, normalizeClass as r, unref as a, renderSlot as $, createBlock as V, withKeys as Ue, withModifiers as me, toDisplayString as D, normalizeStyle as qe, vShow as Ge } from "vue";
5
2
  import "../form/index.js";
6
- import { VftIcon as A } from "../icon/index.js";
7
- import { useResizeObserver as Ye, isClient as Ze } from "@vueuse/core";
8
- import { debugWarn as Q } from "../../utils/error.js";
3
+ import { VftIcon as B } from "../icon/index.js";
4
+ import { useResizeObserver as Je, isClient as Qe } from "@vueuse/core";
5
+ import { isString as A, singleAttrToObj as G, noop as Xe, isObject as ve } from "@vft/utils";
6
+ import { debugWarn as J } from "../../utils/error.js";
9
7
  import "../config-provider/hooks/use-global-config.js";
10
- import { isNil as _e } from "lodash-es";
8
+ import { isNil as Ye } from "lodash-es";
11
9
  import { useNamespace as pe } from "../../hooks/use-namespace/index.js";
12
10
  import "../../hooks/use-model-toggle/index.js";
13
11
  import "@popperjs/core";
14
12
  import "../../hooks/use-z-index/index.js";
13
+ import { UPDATE_MODEL_EVENT as Q } from "@vft/constants";
14
+ import { useAttrs as Ze, useCursor as _e } from "@vft/use";
15
15
  import { calcTextareaHeight as ye } from "./utils.js";
16
16
  import { useFormSize as et, useFormDisabled as tt } from "../form/hooks/use-form-common-props.js";
17
17
  import { useFormItem as at, useFormItemInputId as ot } from "../form/hooks/use-form-item.js";
@@ -44,11 +44,11 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
44
44
  inputStyle: { type: [Boolean, null, String, Object, Array] }
45
45
  },
46
46
  emits: {
47
- [G]: (e) => B(e),
48
- input: (e) => B(e),
49
- change: (e) => B(e),
50
- suffixClick: (e) => B(e),
51
- prefixClick: (e) => B(e),
47
+ [Q]: (e) => A(e),
48
+ input: (e) => A(e),
49
+ change: (e) => A(e),
50
+ suffixClick: (e) => A(e),
51
+ prefixClick: (e) => A(e),
52
52
  focus: (e) => e instanceof FocusEvent,
53
53
  blur: (e) => e instanceof FocusEvent,
54
54
  clear: () => !0,
@@ -62,15 +62,15 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
62
62
  compositionend: (e) => e instanceof CompositionEvent
63
63
  },
64
64
  setup(e, { expose: he, emit: be }) {
65
- const s = be, x = Te(), m = Le(), X = l(() => {
65
+ const s = be, g = Te(), m = Le(), X = l(() => {
66
66
  const t = {};
67
- return e.containerRole === "combobox" && (t["aria-haspopup"] = x["aria-haspopup"], t["aria-owns"] = x["aria-owns"], t["aria-expanded"] = x["aria-expanded"]), t;
67
+ return e.containerRole === "combobox" && (t["aria-haspopup"] = g["aria-haspopup"], t["aria-owns"] = g["aria-owns"], t["aria-expanded"] = g["aria-expanded"]), t;
68
68
  }), we = l(() => [
69
69
  e.type === "textarea" ? Z.b() : o.b(),
70
70
  o.m(ke.value),
71
- o.is("disabled", p.value),
71
+ o.is("disabled", h.value),
72
72
  o.is("exceed", Ee.value),
73
- o.is("focus", h.value),
73
+ o.is("focus", v.value),
74
74
  {
75
75
  [o.b("group")]: m.prepend || m.append,
76
76
  [o.bm("group", "append")]: m.append,
@@ -79,194 +79,195 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
79
79
  [o.m("suffix")]: m.suffix || e.suffixIcon || e.clearable || e.showPassword,
80
80
  [o.bm("suffix", "password-clear")]: P.value && L.value
81
81
  },
82
- x.class
82
+ g.class
83
83
  ]), xe = je(), ge = l(() => [
84
84
  o.e("wrapper"),
85
- o.is("focus", h.value)
86
- ]), d = Je({
85
+ o.is("focus", v.value)
86
+ ]), d = Ze({
87
87
  excludeKeys: l(() => Object.keys(X.value))
88
88
  }), { form: Ce, formItem: F } = at(), { inputId: Y } = ot(xe.props, {
89
89
  formItemContext: F
90
- }), ke = et(), p = tt(), o = pe("input"), Z = pe("textarea"), K = H(), y = H(), h = S(!1), D = S(!1), g = S(!1), M = S(!1), _ = S(), O = H(e.inputStyle), C = l(() => K.value || y.value), T = l(() => J(e.prefixIcon, "icon", { size: 16 })), ee = l(() => J(e.suffixIcon, "icon", { size: 16 })), Ie = l(() => J(e.clearIcon, "icon", {
90
+ }), ke = et(), h = tt(), o = pe("input"), Z = pe("textarea"), M = H(), b = H(), v = S(!1), N = S(!1), C = S(!1), K = S(!1), _ = S(), O = H(e.inputStyle), k = l(() => M.value || b.value), T = l(() => G(e.prefixIcon, "icon", { size: 16 })), ee = l(() => G(e.suffixIcon, "icon", { size: 16 })), Ie = l(() => G(e.clearIcon, "icon", {
91
91
  icon: "icon-circle-close",
92
92
  size: 16
93
- })), te = l(() => Ce?.statusIcon ?? !1), k = l(() => F?.validateState || ""), ae = l(
94
- () => k.value && {
93
+ })), te = l(() => Ce?.statusIcon ?? !1), I = l(() => F?.validateState || ""), ae = l(
94
+ () => I.value && {
95
95
  validating: "icon-loading",
96
96
  success: "icon-circle-check",
97
97
  error: "icon-circle-close"
98
- }[k.value]
98
+ }[I.value]
99
99
  ), ze = l(
100
- () => M.value ? { icon: "icon-view", size: 16 } : { icon: "icon-hide", size: 16 }
100
+ () => K.value ? { icon: "icon-view", size: 16 } : { icon: "icon-hide", size: 16 }
101
101
  ), Se = l(() => [
102
- x.style,
102
+ g.style,
103
103
  e.inputStyle
104
104
  ]), oe = l(() => [
105
105
  e.inputStyle,
106
106
  O.value,
107
107
  { resize: e.resize }
108
108
  ]), f = l(
109
- () => _e(e.modelValue) ? "" : String(e.modelValue)
109
+ () => Ye(e.modelValue) ? "" : String(e.modelValue)
110
110
  ), P = l(
111
- () => e.clearable && !p.value && !e.readonly && !!f.value && (h.value || D.value)
111
+ () => e.clearable && !h.value && !e.readonly && !!f.value && (v.value || N.value)
112
112
  ), L = l(
113
- () => e.showPassword && !p.value && !e.readonly && !!f.value && (!!f.value || h.value)
114
- ), b = l(
115
- () => e.showWordLimit && !!d.value.maxlength && (e.type === "text" || e.type === "textarea") && !p.value && !e.readonly && !e.showPassword
113
+ () => e.showPassword && !h.value && !e.readonly && !!f.value && (!!f.value || v.value)
114
+ ), w = l(
115
+ () => e.showWordLimit && !!d.value.maxlength && (e.type === "text" || e.type === "textarea") && !h.value && !e.readonly && !e.showPassword
116
116
  ), j = l(() => Array.from(f.value).length), Ee = l(
117
117
  () => (
118
118
  // show exceed style if length of initial value greater then maxlength
119
- !!b.value && j.value > Number(d.value.maxlength)
119
+ !!w.value && j.value > Number(d.value.maxlength)
120
120
  )
121
121
  ), Ve = l(
122
- () => !!m.suffix || !!e.suffixIcon || P.value || e.showPassword || b.value || !!k.value && te.value
123
- ), [Be, Ae] = Qe(K);
124
- Ye(y, (t) => {
125
- if (!b.value || e.resize !== "both") return;
126
- const n = t[0], { width: z } = n.contentRect;
122
+ () => !!m.suffix || !!e.suffixIcon || P.value || e.showPassword || w.value || !!I.value && te.value
123
+ ), [Be, Ae] = _e(M);
124
+ Je(b, (t) => {
125
+ if (!w.value || e.resize !== "both") return;
126
+ const n = t[0], { width: p } = n.contentRect;
127
127
  _.value = {
128
128
  /** right: 100% - width + padding(15) + right(6) */
129
- right: `calc(100% - ${z + 15 + 6}px)`
129
+ right: `calc(100% - ${p + 15 + 6}px)`
130
130
  };
131
131
  });
132
132
  const R = () => {
133
- if (!(!Ze || e.type !== "textarea"))
133
+ if (!(!Qe || e.type !== "textarea"))
134
134
  if (e.autosize) {
135
135
  const t = ve(e.autosize) ? e.autosize.minRows : void 0, n = ve(e.autosize) ? e.autosize.maxRows : void 0;
136
136
  O.value = {
137
- ...ye(y.value, t, n)
137
+ ...ye(b.value, t, n)
138
138
  };
139
139
  } else
140
140
  O.value = {
141
- minHeight: ye(y.value).minHeight
141
+ minHeight: ye(b.value).minHeight
142
142
  };
143
- }, I = () => {
144
- const t = C.value;
143
+ }, z = () => {
144
+ const t = k.value;
145
145
  !t || t.value === f.value || (t.value = f.value);
146
146
  }, W = async (t) => {
147
147
  Be();
148
148
  let { value: n } = t.target;
149
- if (d.value.maxlength && n.length >= d.value.maxlength && (n = n.slice(0, Number(d.value.maxlength))), e.formatter && (n = e.parser ? e.parser(n) : n, n = e.formatter(n)), !g.value) {
149
+ if (d.value.maxlength && n.length >= d.value.maxlength && (n = n.slice(0, Number(d.value.maxlength))), e.formatter && (n = e.parser ? e.parser(n) : n, n = e.formatter(n)), !C.value) {
150
150
  if (n === f.value) {
151
- I();
151
+ z();
152
152
  return;
153
153
  }
154
- s(G, n), s("input", n), await E(), I(), Ae();
154
+ s(Q, n), s("input", n), await E(), z(), Ae();
155
155
  }
156
156
  }, ne = (t) => {
157
157
  s("change", t.target.value);
158
158
  }, Fe = () => {
159
159
  s("suffixClick", e.modelValue);
160
- }, Ke = () => {
160
+ }, Me = () => {
161
161
  s("prefixClick", e.modelValue);
162
162
  }, le = (t) => {
163
- s("compositionstart", t), g.value = !0;
164
- }, Me = (t) => /([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(t), se = (t) => {
163
+ s("compositionstart", t), C.value = !0;
164
+ }, Ke = (t) => /([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(t), se = (t) => {
165
165
  s("compositionupdate", t);
166
- const n = t.target?.value, z = n[n.length - 1] || "";
167
- g.value = !Me(z);
166
+ const n = t.target?.value, p = n[n.length - 1] || "";
167
+ C.value = !Ke(p);
168
168
  }, ie = (t) => {
169
- s("compositionend", t), g.value && (g.value = !1, W(t));
169
+ s("compositionend", t), C.value && (C.value = !1, W(t));
170
170
  }, Pe = () => {
171
- M.value = !M.value, re();
172
- }, re = async () => {
173
- await E(), C.value?.focus();
174
- }, Re = () => C.value?.blur(), ue = (t) => {
175
- h.value = !0, s("focus", t);
171
+ K.value = !K.value, ue();
172
+ }, ue = async () => {
173
+ await E(), k.value?.focus();
174
+ }, Re = () => k.value?.blur(), re = (t) => {
175
+ v.value = !0, s("focus", t);
176
176
  }, ce = (t) => {
177
- h.value = !1, s("blur", t), e.validateEvent && F?.validate?.("blur").catch((n) => Q(n));
177
+ v.value = !1, s("blur", t), e.validateEvent && F?.validate?.("blur").catch((n) => J(n));
178
178
  }, $e = (t) => {
179
- D.value = !1, s("mouseleave", t);
180
- }, Ne = (t) => {
181
- D.value = !0, s("mouseenter", t);
179
+ N.value = !1, s("mouseleave", t);
180
+ }, De = (t) => {
181
+ N.value = !0, s("mouseenter", t);
182
182
  }, de = (t) => {
183
183
  let n = t.key;
184
184
  if (t.target.type === "number" && ["e", "+", "-0", "E"].includes(n))
185
185
  return t.returnValue = !1, !1;
186
186
  s("keydown", t);
187
- }, De = () => {
188
- C.value?.select();
187
+ }, Ne = () => {
188
+ k.value?.select();
189
189
  }, fe = () => {
190
- s(G, ""), s("change", ""), s("clear"), s("input", "");
190
+ s(Q, ""), s("change", ""), s("clear"), s("input", "");
191
191
  };
192
192
  return U(
193
193
  () => e.modelValue,
194
194
  () => {
195
- E(() => R()), e.validateEvent && F?.validate?.("change").catch((t) => Q(t));
195
+ E(() => R()), e.validateEvent && F?.validate?.("change").catch((t) => J(t));
196
196
  }
197
- ), U(f, () => I()), U(
197
+ ), U(f, () => z()), U(
198
198
  () => e.type,
199
199
  async () => {
200
- await E(), I(), R();
200
+ await E(), z(), R();
201
201
  }
202
202
  ), We(() => {
203
- !e.formatter && e.parser && Q(
203
+ !e.formatter && e.parser && J(
204
204
  "VftInput",
205
205
  "If you set the parser, you also need to set the formatter."
206
- ), I(), E(R);
206
+ ), z(), E(R);
207
207
  }), he({
208
208
  /** @description HTML input element */
209
- input: K,
209
+ input: M,
210
210
  /** @description HTML textarea element */
211
- textarea: y,
211
+ textarea: b,
212
212
  /** @description HTML element, input or textarea */
213
- ref: C,
213
+ ref: k,
214
214
  /** @description style of textarea. */
215
215
  textareaStyle: oe,
216
216
  /** @description from props (used on unit test) */
217
217
  autosize: e.autosize,
218
218
  /** @description HTML input element native method */
219
- focus: re,
219
+ focus: ue,
220
220
  /** @description HTML input element native method */
221
221
  blur: Re,
222
222
  /** @description HTML input element native method */
223
- select: De,
223
+ select: Ne,
224
224
  /** @description clear input value */
225
225
  clear: fe,
226
226
  /** @description resize textarea. */
227
227
  resizeTextarea: R
228
- }), (t, n) => He((i(), c("div", v(X.value, {
228
+ }), (t, n) => He((i(), c("div", y(X.value, {
229
229
  class: we.value,
230
230
  style: Se.value,
231
231
  role: t.containerRole,
232
- onMouseenter: Ne,
233
- onMouseleave: $e
232
+ onMouseenter: De,
233
+ onMouseleave: $e,
234
+ onMousewheel: n[1] || (n[1] = (p) => t.type === "number" && v.value ? p.preventDefault() : null)
234
235
  }), [
235
236
  t.type !== "textarea" ? (i(), c(q, { key: 0 }, [
236
237
  t.$slots.prepend ? (i(), c("div", {
237
238
  key: 0,
238
- class: u(a(o).be("group", "prepend"))
239
+ class: r(a(o).be("group", "prepend"))
239
240
  }, [
240
241
  $(t.$slots, "prepend")
241
- ], 2)) : r("", !0),
242
- w("div", {
243
- class: u(ge.value)
242
+ ], 2)) : u("", !0),
243
+ x("div", {
244
+ class: r(ge.value)
244
245
  }, [
245
246
  t.$slots.prefix || T.value?.icon ? (i(), c("span", {
246
247
  key: 0,
247
- class: u(a(o).e("prefix"))
248
+ class: r(a(o).e("prefix"))
248
249
  }, [
249
- w("span", {
250
- class: u(a(o).e("prefix-inner")),
251
- onClick: Ke
250
+ x("span", {
251
+ class: r(a(o).e("prefix-inner")),
252
+ onClick: Me
252
253
  }, [
253
254
  $(t.$slots, "prefix"),
254
- T.value?.icon ? (i(), V(a(A), v({
255
+ T.value?.icon ? (i(), V(a(B), y({
255
256
  key: 0,
256
257
  pointer: ""
257
258
  }, T.value, {
258
259
  class: a(o).e("icon")
259
- }), null, 16, ["class"])) : r("", !0)
260
+ }), null, 16, ["class"])) : u("", !0)
260
261
  ], 2)
261
- ], 2)) : r("", !0),
262
- w("input", v({
262
+ ], 2)) : u("", !0),
263
+ x("input", y({
263
264
  id: a(Y),
264
265
  ref_key: "input",
265
- ref: K,
266
+ ref: M,
266
267
  class: a(o).e("inner")
267
268
  }, a(d), {
268
- type: t.showPassword ? M.value ? "text" : "password" : t.type,
269
- disabled: a(p),
269
+ type: t.showPassword ? K.value ? "text" : "password" : t.type,
270
+ disabled: a(h),
270
271
  formatter: t.formatter,
271
272
  parser: t.parser,
272
273
  readonly: t.readonly,
@@ -280,73 +281,73 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
280
281
  onCompositionupdate: se,
281
282
  onCompositionend: ie,
282
283
  onInput: W,
283
- onFocus: ue,
284
+ onFocus: re,
284
285
  onBlur: ce,
285
286
  onChange: ne,
286
287
  onKeydown: de,
287
- onKeyup: n[0] || (n[0] = Ue((z) => s("enter"), ["enter"]))
288
+ onKeyup: n[0] || (n[0] = Ue((p) => s("enter"), ["enter"]))
288
289
  }), null, 16, lt),
289
290
  Ve.value ? (i(), c("span", {
290
291
  key: 1,
291
- class: u(a(o).e("suffix"))
292
+ class: r(a(o).e("suffix"))
292
293
  }, [
293
- w("span", {
294
- class: u(a(o).e("suffix-inner")),
294
+ x("span", {
295
+ class: r(a(o).e("suffix-inner")),
295
296
  onClick: Fe
296
297
  }, [
297
- !P.value || !L.value || !b.value ? (i(), c(q, { key: 0 }, [
298
+ !P.value || !L.value || !w.value ? (i(), c(q, { key: 0 }, [
298
299
  $(t.$slots, "suffix"),
299
- ee.value?.icon ? (i(), V(a(A), v({ key: 0 }, ee.value, {
300
+ ee.value?.icon ? (i(), V(a(B), y({ key: 0 }, ee.value, {
300
301
  class: a(o).e("icon")
301
- }), null, 16, ["class"])) : r("", !0)
302
- ], 64)) : r("", !0),
303
- P.value ? (i(), V(a(A), v({
302
+ }), null, 16, ["class"])) : u("", !0)
303
+ ], 64)) : u("", !0),
304
+ P.value ? (i(), V(a(B), y({
304
305
  key: 1,
305
306
  pointer: "",
306
307
  class: [a(o).e("icon"), a(o).e("clear")]
307
308
  }, Ie.value, {
308
309
  onMousedown: me(a(Xe), ["prevent"]),
309
310
  onClick: me(fe, ["stop"])
310
- }), null, 16, ["class", "onMousedown"])) : r("", !0),
311
- L.value ? (i(), V(a(A), v({ key: 2 }, ze.value, {
311
+ }), null, 16, ["class", "onMousedown"])) : u("", !0),
312
+ L.value ? (i(), V(a(B), y({ key: 2 }, ze.value, {
312
313
  class: [a(o).e("icon"), a(o).e("password")],
313
314
  onClick: Pe
314
- }), null, 16, ["class"])) : r("", !0),
315
- b.value ? (i(), c("span", {
315
+ }), null, 16, ["class"])) : u("", !0),
316
+ w.value ? (i(), c("span", {
316
317
  key: 3,
317
- class: u(a(o).e("count"))
318
+ class: r(a(o).e("count"))
318
319
  }, [
319
- w("span", {
320
- class: u(a(o).e("count-inner"))
321
- }, N(j.value) + " / " + N(a(d).maxlength), 3)
322
- ], 2)) : r("", !0),
323
- k.value && ae.value && te.value ? (i(), V(a(A), {
320
+ x("span", {
321
+ class: r(a(o).e("count-inner"))
322
+ }, D(j.value) + " / " + D(a(d).maxlength), 3)
323
+ ], 2)) : u("", !0),
324
+ I.value && ae.value && te.value ? (i(), V(a(B), {
324
325
  key: 4,
325
326
  icon: ae.value,
326
- class: u([
327
+ class: r([
327
328
  a(o).e("icon"),
328
329
  a(o).e("validateIcon"),
329
- a(o).is("loading", k.value === "validating")
330
+ a(o).is("loading", I.value === "validating")
330
331
  ])
331
- }, null, 8, ["icon", "class"])) : r("", !0)
332
+ }, null, 8, ["icon", "class"])) : u("", !0)
332
333
  ], 2)
333
- ], 2)) : r("", !0)
334
+ ], 2)) : u("", !0)
334
335
  ], 2),
335
336
  t.$slots.append ? (i(), c("div", {
336
337
  key: 1,
337
- class: u(a(o).be("group", "append"))
338
+ class: r(a(o).be("group", "append"))
338
339
  }, [
339
340
  $(t.$slots, "append")
340
- ], 2)) : r("", !0)
341
+ ], 2)) : u("", !0)
341
342
  ], 64)) : (i(), c(q, { key: 1 }, [
342
- w("textarea", v({
343
+ x("textarea", y({
343
344
  id: a(Y),
344
345
  ref_key: "textarea",
345
- ref: y,
346
+ ref: b,
346
347
  class: a(Z).e("inner")
347
348
  }, a(d), {
348
349
  tabindex: t.tabindex,
349
- disabled: a(p),
350
+ disabled: a(h),
350
351
  readonly: t.readonly,
351
352
  autocomplete: t.autocomplete,
352
353
  style: oe.value,
@@ -357,16 +358,16 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
357
358
  onCompositionupdate: se,
358
359
  onCompositionend: ie,
359
360
  onInput: W,
360
- onFocus: ue,
361
+ onFocus: re,
361
362
  onBlur: ce,
362
363
  onChange: ne,
363
364
  onKeydown: de
364
365
  }), null, 16, st),
365
- b.value ? (i(), c("span", {
366
+ w.value ? (i(), c("span", {
366
367
  key: 0,
367
368
  style: qe(_.value),
368
- class: u(a(o).e("count"))
369
- }, N(j.value) + " / " + N(a(d).maxlength), 7)) : r("", !0)
369
+ class: r(a(o).e("count"))
370
+ }, D(j.value) + " / " + D(a(d).maxlength), 7)) : u("", !0)
370
371
  ], 64))
371
372
  ], 16, nt)), [
372
373
  [Ge, t.type !== "hidden"]
@@ -1,4 +1,4 @@
1
- import { defineComponent as D, ref as w, inject as Y, getCurrentInstance as q, onMounted as F, watch as G, computed as i, reactive as H, onBeforeUnmount as Q, createElementBlock as a, openBlock as n, normalizeClass as l, normalizeStyle as z, createCommentVNode as S, createElementVNode as d, unref as t, renderSlot as p, createTextVNode as k, toDisplayString as y, createBlock as N, mergeProps as R } from "vue";
1
+ import { defineComponent as D, ref as w, inject as Y, getCurrentInstance as q, onMounted as F, watch as G, computed as n, reactive as H, onBeforeUnmount as Q, createElementBlock as a, openBlock as i, normalizeClass as l, normalizeStyle as z, createCommentVNode as S, createElementVNode as d, unref as t, renderSlot as p, createTextVNode as k, toDisplayString as y, createBlock as N, mergeProps as R } from "vue";
2
2
  import { VftIcon as V } from "../icon/index.js";
3
3
  import "@vueuse/core";
4
4
  import { singleAttrToObj as X, isNumber as Z } from "@vft/utils";
@@ -20,7 +20,7 @@ const ee = D({
20
20
  status: {}
21
21
  },
22
22
  setup(K) {
23
- const I = K, s = _("step"), c = w(-1), B = w({}), m = w(""), o = Y(x), $ = q();
23
+ const I = K, e = _("step"), c = w(-1), B = w({}), m = w(""), o = Y(x), $ = q();
24
24
  F(() => {
25
25
  G(
26
26
  [
@@ -28,37 +28,38 @@ const ee = D({
28
28
  () => o.props.processStatus,
29
29
  () => o.props.finishStatus
30
30
  ],
31
- ([e]) => {
32
- U(e);
31
+ ([s]) => {
32
+ U(s);
33
33
  },
34
34
  { immediate: !0 }
35
35
  );
36
36
  });
37
- const E = i(
37
+ const E = n(
38
38
  () => X(I.icon, "icon")
39
- ), r = i(() => I.status || m.value), O = i(() => {
40
- const e = o.steps.value[c.value - 1];
41
- return e ? e.currentStatus : "wait";
42
- }), h = i(() => o.props.alignCenter), P = i(() => o.props.direction === "vertical"), u = i(() => o.props.simple), g = i(() => o.props.contentPosition === "top"), C = i(() => o.steps.value.length), T = i(() => o.steps.value[C.value - 1]?.uid === $.uid), f = i(() => u.value ? "" : o.props.space), A = i(() => [
43
- s.b(),
44
- s.is(u.value ? "simple" : o.props.direction),
45
- s.is("flex", T.value && !f.value && !h.value),
46
- s.is("center", h.value && !P.value && !u.value),
47
- s.is("content-top", g.value)
48
- ]), J = i(() => {
49
- const e = {
39
+ ), r = n(() => I.status || m.value), O = n(() => {
40
+ const s = o.steps.value[c.value - 1];
41
+ return s ? s.currentStatus : "wait";
42
+ }), h = n(() => o.props.alignCenter), P = n(() => o.props.direction === "vertical"), u = n(() => o.props.simple), g = n(() => o.props.contentPosition === "top"), C = n(() => o.steps.value.length), T = n(() => o.steps.value[C.value - 1]?.uid === $.uid), f = n(() => u.value ? "" : o.props.space), A = n(() => [
43
+ e.b(),
44
+ e.is(u.value ? "simple" : o.props.direction),
45
+ e.is("flex", T.value && !f.value && !h.value),
46
+ e.is("center", h.value && !P.value && !u.value),
47
+ e.is("content-top", g.value),
48
+ e.is(r.value)
49
+ ]), J = n(() => {
50
+ const s = {
50
51
  flexBasis: Z(f.value) ? `${f.value}px` : f.value ? f.value : `${100 / (C.value - (h.value ? 0 : 1))}%`
51
52
  };
52
- return P.value || T.value && (e.maxWidth = `${100 / C.value}%`), e;
53
- }), L = (e) => {
54
- c.value = e;
55
- }, M = (e) => {
56
- const v = e === "wait", b = {
53
+ return P.value || T.value && (s.maxWidth = `${100 / C.value}%`), s;
54
+ }), L = (s) => {
55
+ c.value = s;
56
+ }, M = (s) => {
57
+ const v = s === "wait", b = {
57
58
  transitionDelay: `${v ? "-" : ""}${150 * c.value}ms`
58
- }, j = e === o.props.processStatus || v ? 0 : 100;
59
+ }, j = s === o.props.processStatus || v ? 0 : 100;
59
60
  b.borderWidth = j && !u.value ? "1px" : 0, b[o.props.direction === "vertical" ? "height" : "width"] = `${j}%`, B.value = b;
60
- }, U = (e) => {
61
- e > c.value ? m.value = o.props.finishStatus : e === c.value && O.value !== "error" ? m.value = o.props.processStatus : m.value = "wait";
61
+ }, U = (s) => {
62
+ s > c.value ? m.value = o.props.finishStatus : s === c.value && O.value !== "error" ? m.value = o.props.processStatus : m.value = "wait";
62
63
  const v = o.steps.value[c.value - 1];
63
64
  v && v.calcProgress(m.value);
64
65
  }, W = H({
@@ -70,96 +71,96 @@ const ee = D({
70
71
  });
71
72
  return o.addStep(W), Q(() => {
72
73
  o.removeStep(W);
73
- }), (e, v) => (n(), a("div", {
74
+ }), (s, v) => (i(), a("div", {
74
75
  style: z(J.value),
75
76
  class: l(A.value)
76
77
  }, [
77
- e.$slots.top ? (n(), a("div", {
78
+ s.$slots.top ? (i(), a("div", {
78
79
  key: 0,
79
- class: l(t(s).e("top-slot"))
80
+ class: l(t(e).e("top-slot"))
80
81
  }, [
81
- p(e.$slots, "top")
82
- ], 2)) : g.value ? (n(), a("div", {
82
+ p(s.$slots, "top")
83
+ ], 2)) : g.value ? (i(), a("div", {
83
84
  key: 1,
84
- class: l(t(s).e("main"))
85
+ class: l(t(e).e("main"))
85
86
  }, [
86
87
  d("div", {
87
- class: l([t(s).e("title"), t(s).is(r.value)])
88
+ class: l([t(e).e("title"), t(e).is(r.value)])
88
89
  }, [
89
- p(e.$slots, "title", {}, () => [
90
- k(y(e.title), 1)
90
+ p(s.$slots, "title", {}, () => [
91
+ k(y(s.title), 1)
91
92
  ])
92
93
  ], 2),
93
- u.value ? (n(), a("div", {
94
+ u.value ? (i(), a("div", {
94
95
  key: 0,
95
- class: l(t(s).e("arrow"))
96
+ class: l(t(e).e("arrow"))
96
97
  }, null, 2)) : S("", !0),
97
98
  d("div", {
98
- class: l([t(s).e("description"), t(s).is(r.value)])
99
+ class: l([t(e).e("description"), t(e).is(r.value)])
99
100
  }, [
100
- p(e.$slots, "description", {}, () => [
101
- k(y(e.description), 1)
101
+ p(s.$slots, "description", {}, () => [
102
+ k(y(s.description), 1)
102
103
  ])
103
104
  ], 2)
104
105
  ], 2)) : S("", !0),
105
106
  d("div", {
106
- class: l([t(s).e("head"), t(s).is(r.value)])
107
+ class: l([t(e).e("head"), t(e).is(r.value)])
107
108
  }, [
108
- u.value ? S("", !0) : (n(), a("div", {
109
+ u.value ? S("", !0) : (i(), a("div", {
109
110
  key: 0,
110
- class: l(t(s).e("line"))
111
+ class: l(t(e).e("line"))
111
112
  }, [
112
113
  d("i", {
113
- class: l(t(s).e("line-inner")),
114
+ class: l(t(e).e("line-inner")),
114
115
  style: z(B.value)
115
116
  }, null, 6)
116
117
  ], 2)),
117
118
  d("div", {
118
- class: l([t(s).e("icon"), t(s).is(e.icon || e.$slots.icon ? "icon" : "text")])
119
+ class: l([t(e).e("icon"), t(e).is(s.icon || s.$slots.icon ? "icon" : "text")])
119
120
  }, [
120
- p(e.$slots, "icon", {}, () => [
121
- E.value?.icon ? (n(), N(t(V), R({ key: 0 }, E.value, {
122
- class: t(s).e("icon-inner")
123
- }), null, 16, ["class"])) : r.value === "success" ? (n(), N(t(V), {
121
+ p(s.$slots, "icon", {}, () => [
122
+ E.value?.icon ? (i(), N(t(V), R({ key: 0 }, E.value, {
123
+ class: t(e).e("icon-inner")
124
+ }), null, 16, ["class"])) : r.value === "success" ? (i(), N(t(V), {
124
125
  key: 1,
125
- class: l([t(s).e("icon-inner"), t(s).is("status")]),
126
+ class: l([t(e).e("icon-inner"), t(e).is("status")]),
126
127
  icon: "icon-check"
127
- }, null, 8, ["class"])) : r.value === "error" ? (n(), N(t(V), {
128
+ }, null, 8, ["class"])) : r.value === "error" ? (i(), N(t(V), {
128
129
  key: 2,
129
- class: l([t(s).e("icon-inner"), t(s).is("status")]),
130
+ class: l([t(e).e("icon-inner"), t(e).is("status")]),
130
131
  icon: "icon-close"
131
- }, null, 8, ["class"])) : u.value ? S("", !0) : (n(), a("div", {
132
+ }, null, 8, ["class"])) : u.value ? S("", !0) : (i(), a("div", {
132
133
  key: 3,
133
- class: l(t(s).e("icon-inner"))
134
+ class: l(t(e).e("icon-inner"))
134
135
  }, y(c.value + 1), 3))
135
136
  ])
136
137
  ], 2)
137
138
  ], 2),
138
- e.$slots.bottom ? (n(), a("div", {
139
+ s.$slots.bottom ? (i(), a("div", {
139
140
  key: 2,
140
- class: l(t(s).e("bottom-slot"))
141
+ class: l(t(e).e("bottom-slot"))
141
142
  }, [
142
- p(e.$slots, "bottom")
143
- ], 2)) : g.value ? S("", !0) : (n(), a("div", {
143
+ p(s.$slots, "bottom")
144
+ ], 2)) : g.value ? S("", !0) : (i(), a("div", {
144
145
  key: 3,
145
- class: l(t(s).e("main"))
146
+ class: l(t(e).e("main"))
146
147
  }, [
147
148
  d("div", {
148
- class: l([t(s).e("title"), t(s).is(r.value)])
149
+ class: l([t(e).e("title"), t(e).is(r.value)])
149
150
  }, [
150
- p(e.$slots, "title", {}, () => [
151
- k(y(e.title), 1)
151
+ p(s.$slots, "title", {}, () => [
152
+ k(y(s.title), 1)
152
153
  ])
153
154
  ], 2),
154
- u.value ? (n(), a("div", {
155
+ u.value ? (i(), a("div", {
155
156
  key: 0,
156
- class: l(t(s).e("arrow"))
157
- }, null, 2)) : (n(), a("div", {
157
+ class: l(t(e).e("arrow"))
158
+ }, null, 2)) : (i(), a("div", {
158
159
  key: 1,
159
- class: l([t(s).e("description"), t(s).is(r.value)])
160
+ class: l([t(e).e("description"), t(e).is(r.value)])
160
161
  }, [
161
- p(e.$slots, "description", {}, () => [
162
- k(y(e.description), 1)
162
+ p(s.$slots, "description", {}, () => [
163
+ k(y(s.description), 1)
163
164
  ])
164
165
  ], 2))
165
166
  ], 2))
@@ -1 +1,2 @@
1
+ import 'vft/es/components/step/style/css';
1
2
  import 'vft/theme-style/vft-steps.css';
@@ -1,2 +1,3 @@
1
1
  import "vft/theme-style/base.css";
2
+ import "vft/theme-style/vft-step.css";
2
3
  import "vft/theme-style/vft-steps.css";
@@ -1 +1,2 @@
1
+ import 'vft/es/components/step/style';
1
2
  import 'vft/theme-style/src/steps.scss';
@@ -1,2 +1,3 @@
1
1
  import "vft/theme-style/src/base.scss";
2
+ import "vft/theme-style/src/step.scss";
2
3
  import "vft/theme-style/src/steps.scss";
@@ -0,0 +1,46 @@
1
+ interface SimpleFormProps {
2
+ commonButtonOptions?: {
3
+ loading?: boolean;
4
+ btnText?: string;
5
+ onClick?: (data?: any) => void;
6
+ };
7
+ }
8
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SimpleFormProps>, {
9
+ commonButtonOptions: () => {
10
+ btnText: string;
11
+ loading: boolean;
12
+ };
13
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "common-click": (data?: any) => void;
15
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SimpleFormProps>, {
16
+ commonButtonOptions: () => {
17
+ btnText: string;
18
+ loading: boolean;
19
+ };
20
+ }>>> & Readonly<{
21
+ "onCommon-click"?: ((data?: any) => any) | undefined;
22
+ }>, {
23
+ commonButtonOptions: {
24
+ loading?: boolean;
25
+ btnText?: string;
26
+ onClick?: (data?: any) => void;
27
+ };
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
+ export default _default;
30
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
31
+ type __VLS_TypePropsToRuntimeProps<T> = {
32
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
33
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
34
+ } : {
35
+ type: import('vue').PropType<T[K]>;
36
+ required: true;
37
+ };
38
+ };
39
+ type __VLS_WithDefaults<P, D> = {
40
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
41
+ default: D[K];
42
+ }> : P[K];
43
+ };
44
+ type __VLS_Prettify<T> = {
45
+ [K in keyof T]: T[K];
46
+ } & {};
@@ -0,0 +1,7 @@
1
+ import o from "./super-form-simple.vue2.js";
2
+ /* empty css */
3
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b35ac0e7"]]);
5
+ export {
6
+ e as default
7
+ };
@@ -0,0 +1,32 @@
1
+ import { defineComponent as r, computed as l, unref as t, createElementBlock as a, openBlock as u, createVNode as f, mergeProps as d, withCtx as _, createTextVNode as k, toDisplayString as C } from "vue";
2
+ import { VftButton as x } from "../button/index.js";
3
+ const B = { class: "super-form-simple" }, v = /* @__PURE__ */ r({
4
+ __name: "super-form-simple",
5
+ props: {
6
+ commonButtonOptions: { default: () => ({
7
+ btnText: "取消",
8
+ loading: !1
9
+ }) }
10
+ },
11
+ emits: ["common-click"],
12
+ setup(m, { emit: s }) {
13
+ const n = m, i = s, e = l(() => ({
14
+ btnText: "取消",
15
+ ...t(n.commonButtonOptions)
16
+ })), p = (c) => {
17
+ const o = t(n.commonButtonOptions);
18
+ o.onClick && o.onClick(), i("common-click");
19
+ };
20
+ return (c, o) => (u(), a("div", B, [
21
+ f(t(x), d(e.value, { onClick: p }), {
22
+ default: _(() => [
23
+ k(C(e.value.btnText), 1)
24
+ ]),
25
+ _: 1
26
+ }, 16)
27
+ ]));
28
+ }
29
+ });
30
+ export {
31
+ v as default
32
+ };
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.329",
3
+ "version": "0.0.332",
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.329";
1
+ const o = "0.0.332";
2
2
  export {
3
3
  o as version
4
4
  };
package/es/script.css CHANGED
@@ -1 +1 @@
1
- .sortable-fallback{visibility:hidden!important}
1
+ .sortable-fallback{visibility:hidden!important}.super-form-simple[data-v-b35ac0e7]{padding:20px}
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),T=require("@vft/constants"),Y=require("@vft/use"),s=require("@vft/utils");require("../form/index.cjs");const b=require("../icon/index.cjs"),Z=require("@vueuse/core"),q=require("../../utils/error.cjs");require("../config-provider/hooks/use-global-config.cjs");const Be=require("lodash-es"),_=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const ee=require("./utils.cjs"),te=require("../form/hooks/use-form-common-props.cjs"),oe=require("../form/hooks/use-form-item.cjs"),Ve=["role"],Ie=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],Se=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],ze=e.defineComponent({__name:"input",props:{id:{},size:{default:""},disabled:{type:Boolean},modelValue:{},type:{default:"text"},resize:{},autosize:{type:[Object,Boolean],default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},showPassword:{type:Boolean},showWordLimit:{type:Boolean},suffixIcon:{},prefixIcon:{},clearIcon:{},containerRole:{},label:{},tabindex:{default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Boolean,null,String,Object,Array]}},emits:{[T.UPDATE_MODEL_EVENT]:t=>s.isString(t),input:t=>s.isString(t),change:t=>s.isString(t),suffixClick:t=>s.isString(t),prefixClick:t=>s.isString(t),focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0,enter:()=>!0,mouseleave:t=>t instanceof MouseEvent,mouseenter:t=>t instanceof MouseEvent,keydown:t=>t instanceof Event,compositionstart:t=>t instanceof CompositionEvent,compositionupdate:t=>t instanceof CompositionEvent,compositionend:t=>t instanceof CompositionEvent},setup(t,{expose:ne,emit:ae}){const l=ae,p=e.useAttrs(),i=e.useSlots(),F=e.computed(()=>{const o={};return t.containerRole==="combobox"&&(o["aria-haspopup"]=p["aria-haspopup"],o["aria-owns"]=p["aria-owns"],o["aria-expanded"]=p["aria-expanded"]),o}),le=e.computed(()=>[t.type==="textarea"?A.b():n.b(),n.m(ie.value),n.is("disabled",c.value),n.is("exceed",fe.value),n.is("focus",m.value),{[n.b("group")]:i.prepend||i.append,[n.bm("group","append")]:i.append,[n.bm("group","prepend")]:i.prepend,[n.m("prefix")]:i.prefix||t.prefixIcon,[n.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[n.bm("suffix","password-clear")]:E.value&&z.value},p.class]),se=e.getCurrentInstance(),re=e.computed(()=>[n.e("wrapper"),n.is("focus",m.value)]),r=Y.useAttrs({excludeKeys:e.computed(()=>Object.keys(F.value))}),{form:ue,formItem:C}=oe.useFormItem(),{inputId:M}=oe.useFormItemInputId(se.props,{formItemContext:C}),ie=te.useFormSize(),c=te.useFormDisabled(),n=_.useNamespace("input"),A=_.useNamespace("textarea"),w=e.shallowRef(),d=e.shallowRef(),m=e.ref(!1),V=e.ref(!1),v=e.ref(!1),x=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),y=e.computed(()=>w.value||d.value),S=e.computed(()=>s.singleAttrToObj(t.prefixIcon,"icon",{size:16})),O=e.computed(()=>s.singleAttrToObj(t.suffixIcon,"icon",{size:16})),ce=e.computed(()=>s.singleAttrToObj(t.clearIcon,"icon",{icon:"icon-circle-close",size:16})),R=e.computed(()=>ue?.statusIcon??!1),h=e.computed(()=>C?.validateState||""),K=e.computed(()=>h.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[h.value]),de=e.computed(()=>x.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[p.style,t.inputStyle]),$=e.computed(()=>[t.inputStyle,I.value,{resize:t.resize}]),u=e.computed(()=>Be.isNil(t.modelValue)?"":String(t.modelValue)),E=e.computed(()=>t.clearable&&!c.value&&!t.readonly&&!!u.value&&(m.value||V.value)),z=e.computed(()=>t.showPassword&&!c.value&&!t.readonly&&!!u.value&&(!!u.value||m.value)),f=e.computed(()=>t.showWordLimit&&!!r.value.maxlength&&(t.type==="text"||t.type==="textarea")&&!c.value&&!t.readonly&&!t.showPassword),N=e.computed(()=>Array.from(u.value).length),fe=e.computed(()=>!!f.value&&N.value>Number(r.value.maxlength)),pe=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||f.value||!!h.value&&R.value),[ve,ye]=Y.useCursor(w);Z.useResizeObserver(d,o=>{if(!f.value||t.resize!=="both")return;const a=o[0],{width:k}=a.contentRect;D.value={right:`calc(100% - ${k+15+6}px)`}});const B=()=>{if(!(!Z.isClient||t.type!=="textarea"))if(t.autosize){const o=s.isObject(t.autosize)?t.autosize.minRows:void 0,a=s.isObject(t.autosize)?t.autosize.maxRows:void 0;I.value={...ee.calcTextareaHeight(d.value,o,a)}}else I.value={minHeight:ee.calcTextareaHeight(d.value).minHeight}},g=()=>{const o=y.value;!o||o.value===u.value||(o.value=u.value)},P=async o=>{ve();let{value:a}=o.target;if(r.value.maxlength&&a.length>=r.value.maxlength&&(a=a.slice(0,Number(r.value.maxlength))),t.formatter&&(a=t.parser?t.parser(a):a,a=t.formatter(a)),!v.value){if(a===u.value){g();return}l(T.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),g(),ye()}},j=o=>{l("change",o.target.value)},he=()=>{l("suffixClick",t.modelValue)},ge=()=>{l("prefixClick",t.modelValue)},L=o=>{l("compositionstart",o),v.value=!0},ke=o=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(o),W=o=>{l("compositionupdate",o);const a=o.target?.value,k=a[a.length-1]||"";v.value=!ke(k)},H=o=>{l("compositionend",o),v.value&&(v.value=!1,P(o))},be=()=>{x.value=!x.value,U()},U=async()=>{await e.nextTick(),y.value?.focus()},Ce=()=>y.value?.blur(),G=o=>{m.value=!0,l("focus",o)},J=o=>{m.value=!1,l("blur",o),t.validateEvent&&C?.validate?.("blur").catch(a=>q.debugWarn(a))},we=o=>{V.value=!1,l("mouseleave",o)},xe=o=>{V.value=!0,l("mouseenter",o)},Q=o=>{let a=o.key;if(o.target.type==="number"&&["e","+","-0","E"].includes(a))return o.returnValue=!1,!1;l("keydown",o)},Ee=()=>{y.value?.select()},X=()=>{l(T.UPDATE_MODEL_EVENT,""),l("change",""),l("clear"),l("input","")};return e.watch(()=>t.modelValue,()=>{e.nextTick(()=>B()),t.validateEvent&&C?.validate?.("change").catch(o=>q.debugWarn(o))}),e.watch(u,()=>g()),e.watch(()=>t.type,async()=>{await e.nextTick(),g(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&q.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),g(),e.nextTick(B)}),ne({input:w,textarea:d,ref:y,textareaStyle:$,autosize:t.autosize,focus:U,blur:Ce,select:Ee,clear:X,resizeTextarea:B}),(o,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(F.value,{class:le.value,style:me.value,role:o.containerRole,onMouseenter:xe,onMouseleave:we}),[o.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).be("group","prepend"))},[e.renderSlot(o.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[o.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("prefix-inner")),onClick:ge},[e.renderSlot(o.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(M),ref_key:"input",ref:w,class:e.unref(n).e("inner")},e.unref(r),{type:o.showPassword?x.value?"text":"password":o.type,disabled:e.unref(c),formatter:o.formatter,parser:o.parser,readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,"aria-label":o.label,placeholder:o.placeholder,style:o.inputStyle,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q,onKeyup:a[0]||(a[0]=e.withKeys(k=>l("enter"),["enter"]))}),null,16,Ie),pe.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("suffix-inner")),onClick:he},[!E.value||!z.value||!f.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(o.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(n).e("icon"),e.unref(n).e("clear")]},ce.value,{onMousedown:e.withModifiers(e.unref(s.noop),["prevent"]),onClick:e.withModifiers(X,["stop"])}),null,16,["class","onMousedown"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(n).e("icon"),e.unref(n).e("password")],onClick:be}),null,16,["class"])):e.createCommentVNode("",!0),f.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(n).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),h.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(n).e("icon"),e.unref(n).e("validateIcon"),e.unref(n).is("loading",h.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),o.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).be("group","append"))},[e.renderSlot(o.$slots,"append")],2)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("textarea",e.mergeProps({id:e.unref(M),ref_key:"textarea",ref:d,class:e.unref(A).e("inner")},e.unref(r),{tabindex:o.tabindex,disabled:e.unref(c),readonly:o.readonly,autocomplete:o.autocomplete,style:$.value,"aria-label":o.label,placeholder:o.placeholder,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),f.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(n).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,o.type!=="hidden"]])}});exports.default=ze;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const k=require("../icon/index.cjs"),Y=require("@vueuse/core"),s=require("@vft/utils"),T=require("../../utils/error.cjs");require("../config-provider/hooks/use-global-config.cjs");const Be=require("lodash-es"),Z=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const q=require("@vft/constants"),_=require("@vft/use"),ee=require("./utils.cjs"),te=require("../form/hooks/use-form-common-props.cjs"),oe=require("../form/hooks/use-form-item.cjs"),Ve=["role"],Ie=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],Se=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],ze=e.defineComponent({__name:"input",props:{id:{},size:{default:""},disabled:{type:Boolean},modelValue:{},type:{default:"text"},resize:{},autosize:{type:[Object,Boolean],default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},showPassword:{type:Boolean},showWordLimit:{type:Boolean},suffixIcon:{},prefixIcon:{},clearIcon:{},containerRole:{},label:{},tabindex:{default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Boolean,null,String,Object,Array]}},emits:{[q.UPDATE_MODEL_EVENT]:t=>s.isString(t),input:t=>s.isString(t),change:t=>s.isString(t),suffixClick:t=>s.isString(t),prefixClick:t=>s.isString(t),focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0,enter:()=>!0,mouseleave:t=>t instanceof MouseEvent,mouseenter:t=>t instanceof MouseEvent,keydown:t=>t instanceof Event,compositionstart:t=>t instanceof CompositionEvent,compositionupdate:t=>t instanceof CompositionEvent,compositionend:t=>t instanceof CompositionEvent},setup(t,{expose:ne,emit:ae}){const l=ae,v=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const o={};return t.containerRole==="combobox"&&(o["aria-haspopup"]=v["aria-haspopup"],o["aria-owns"]=v["aria-owns"],o["aria-expanded"]=v["aria-expanded"]),o}),le=e.computed(()=>[t.type==="textarea"?A.b():n.b(),n.m(ie.value),n.is("disabled",m.value),n.is("exceed",fe.value),n.is("focus",c.value),{[n.b("group")]:i.prepend||i.append,[n.bm("group","append")]:i.append,[n.bm("group","prepend")]:i.prepend,[n.m("prefix")]:i.prefix||t.prefixIcon,[n.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[n.bm("suffix","password-clear")]:E.value&&z.value},v.class]),se=e.getCurrentInstance(),re=e.computed(()=>[n.e("wrapper"),n.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:C}=oe.useFormItem(),{inputId:F}=oe.useFormItemInputId(se.props,{formItemContext:C}),ie=te.useFormSize(),m=te.useFormDisabled(),n=Z.useNamespace("input"),A=Z.useNamespace("textarea"),w=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),x=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>w.value||f.value),S=e.computed(()=>s.singleAttrToObj(t.prefixIcon,"icon",{size:16})),O=e.computed(()=>s.singleAttrToObj(t.suffixIcon,"icon",{size:16})),ce=e.computed(()=>s.singleAttrToObj(t.clearIcon,"icon",{icon:"icon-circle-close",size:16})),R=e.computed(()=>ue?.statusIcon??!1),g=e.computed(()=>C?.validateState||""),K=e.computed(()=>g.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[g.value]),de=e.computed(()=>x.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[v.style,t.inputStyle]),$=e.computed(()=>[t.inputStyle,I.value,{resize:t.resize}]),u=e.computed(()=>Be.isNil(t.modelValue)?"":String(t.modelValue)),E=e.computed(()=>t.clearable&&!m.value&&!t.readonly&&!!u.value&&(c.value||V.value)),z=e.computed(()=>t.showPassword&&!m.value&&!t.readonly&&!!u.value&&(!!u.value||c.value)),p=e.computed(()=>t.showWordLimit&&!!r.value.maxlength&&(t.type==="text"||t.type==="textarea")&&!m.value&&!t.readonly&&!t.showPassword),N=e.computed(()=>Array.from(u.value).length),fe=e.computed(()=>!!p.value&&N.value>Number(r.value.maxlength)),pe=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||p.value||!!g.value&&R.value),[ve,ye]=_.useCursor(w);Y.useResizeObserver(f,o=>{if(!p.value||t.resize!=="both")return;const a=o[0],{width:d}=a.contentRect;D.value={right:`calc(100% - ${d+15+6}px)`}});const B=()=>{if(!(!Y.isClient||t.type!=="textarea"))if(t.autosize){const o=s.isObject(t.autosize)?t.autosize.minRows:void 0,a=s.isObject(t.autosize)?t.autosize.maxRows:void 0;I.value={...ee.calcTextareaHeight(f.value,o,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},b=()=>{const o=h.value;!o||o.value===u.value||(o.value=u.value)},P=async o=>{ve();let{value:a}=o.target;if(r.value.maxlength&&a.length>=r.value.maxlength&&(a=a.slice(0,Number(r.value.maxlength))),t.formatter&&(a=t.parser?t.parser(a):a,a=t.formatter(a)),!y.value){if(a===u.value){b();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),b(),ye()}},j=o=>{l("change",o.target.value)},he=()=>{l("suffixClick",t.modelValue)},ge=()=>{l("prefixClick",t.modelValue)},L=o=>{l("compositionstart",o),y.value=!0},be=o=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(o),W=o=>{l("compositionupdate",o);const a=o.target?.value,d=a[a.length-1]||"";y.value=!be(d)},H=o=>{l("compositionend",o),y.value&&(y.value=!1,P(o))},ke=()=>{x.value=!x.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},Ce=()=>h.value?.blur(),G=o=>{c.value=!0,l("focus",o)},J=o=>{c.value=!1,l("blur",o),t.validateEvent&&C?.validate?.("blur").catch(a=>T.debugWarn(a))},we=o=>{V.value=!1,l("mouseleave",o)},xe=o=>{V.value=!0,l("mouseenter",o)},Q=o=>{let a=o.key;if(o.target.type==="number"&&["e","+","-0","E"].includes(a))return o.returnValue=!1,!1;l("keydown",o)},Ee=()=>{h.value?.select()},X=()=>{l(q.UPDATE_MODEL_EVENT,""),l("change",""),l("clear"),l("input","")};return e.watch(()=>t.modelValue,()=>{e.nextTick(()=>B()),t.validateEvent&&C?.validate?.("change").catch(o=>T.debugWarn(o))}),e.watch(u,()=>b()),e.watch(()=>t.type,async()=>{await e.nextTick(),b(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),b(),e.nextTick(B)}),ne({input:w,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:Ce,select:Ee,clear:X,resizeTextarea:B}),(o,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:o.containerRole,onMouseenter:xe,onMouseleave:we,onMousewheel:a[1]||(a[1]=d=>o.type==="number"&&c.value?d.preventDefault():null)}),[o.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).be("group","prepend"))},[e.renderSlot(o.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[o.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("prefix-inner")),onClick:ge},[e.renderSlot(o.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(F),ref_key:"input",ref:w,class:e.unref(n).e("inner")},e.unref(r),{type:o.showPassword?x.value?"text":"password":o.type,disabled:e.unref(m),formatter:o.formatter,parser:o.parser,readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,"aria-label":o.label,placeholder:o.placeholder,style:o.inputStyle,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q,onKeyup:a[0]||(a[0]=e.withKeys(d=>l("enter"),["enter"]))}),null,16,Ie),pe.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("suffix-inner")),onClick:he},[!E.value||!z.value||!p.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(o.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(n).e("icon"),e.unref(n).e("clear")]},ce.value,{onMousedown:e.withModifiers(e.unref(s.noop),["prevent"]),onClick:e.withModifiers(X,["stop"])}),null,16,["class","onMousedown"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(n).e("icon"),e.unref(n).e("password")],onClick:ke}),null,16,["class"])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(n).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),g.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(n).e("icon"),e.unref(n).e("validateIcon"),e.unref(n).is("loading",g.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),o.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).be("group","append"))},[e.renderSlot(o.$slots,"append")],2)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("textarea",e.mergeProps({id:e.unref(F),ref_key:"textarea",ref:f,class:e.unref(A).e("inner")},e.unref(r),{tabindex:o.tabindex,disabled:e.unref(m),readonly:o.readonly,autocomplete:o.autocomplete,style:$.value,"aria-label":o.label,placeholder:o.placeholder,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),p.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(n).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,o.type!=="hidden"]])}});exports.default=ze;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../icon/index.cjs");require("@vueuse/core");const E=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");const I=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const w=require("./tokens.cjs"),D=e.defineComponent({name:"VftStep"}),P=e.defineComponent({...D,props:{title:{},icon:{},description:{},status:{}},setup(N){const k=N,s=I.useNamespace("step"),r=e.ref(-1),S=e.ref({}),i=e.ref(""),n=e.inject(w.STEPS_INJECTION_KEY),u=e.getCurrentInstance();e.onMounted(()=>{e.watch([()=>n.props.active,()=>n.props.processStatus,()=>n.props.finishStatus],([t])=>{T(t)},{immediate:!0})});const C=e.computed(()=>E.singleAttrToObj(k.icon,"icon")),o=e.computed(()=>k.status||i.value),$=e.computed(()=>{const t=n.steps.value[r.value-1];return t?t.currentStatus:"wait"}),p=e.computed(()=>n.props.alignCenter),B=e.computed(()=>n.props.direction==="vertical"),l=e.computed(()=>n.props.simple),d=e.computed(()=>n.props.contentPosition==="top"),v=e.computed(()=>n.steps.value.length),y=e.computed(()=>n.steps.value[v.value-1]?.uid===u.uid),c=e.computed(()=>l.value?"":n.props.space),g=e.computed(()=>[s.b(),s.is(l.value?"simple":n.props.direction),s.is("flex",y.value&&!c.value&&!p.value),s.is("center",p.value&&!B.value&&!l.value),s.is("content-top",d.value)]),h=e.computed(()=>{const t={flexBasis:E.isNumber(c.value)?`${c.value}px`:c.value?c.value:`${100/(v.value-(p.value?0:1))}%`};return B.value||y.value&&(t.maxWidth=`${100/v.value}%`),t}),q=t=>{r.value=t},b=t=>{const a=t==="wait",m={transitionDelay:`${a?"-":""}${150*r.value}ms`},z=t===n.props.processStatus||a?0:100;m.borderWidth=z&&!l.value?"1px":0,m[n.props.direction==="vertical"?"height":"width"]=`${z}%`,S.value=m},T=t=>{t>r.value?i.value=n.props.finishStatus:t===r.value&&$.value!=="error"?i.value=n.props.processStatus:i.value="wait";const a=n.steps.value[r.value-1];a&&a.calcProgress(i.value)},V=e.reactive({uid:u.uid,getVnode:()=>u.vnode,currentStatus:o,setIndex:q,calcProgress:b});return n.addStep(V),e.onBeforeUnmount(()=>{n.removeStep(V)}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(h.value),class:e.normalizeClass(g.value)},[t.$slots.top?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(s).e("top-slot"))},[e.renderSlot(t.$slots,"top")],2)):d.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(s).e("main"))},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("title"),e.unref(s).is(o.value)])},[e.renderSlot(t.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(s).e("arrow"))},null,2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("description"),e.unref(s).is(o.value)])},[e.renderSlot(t.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("head"),e.unref(s).is(o.value)])},[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(s).e("line"))},[e.createElementVNode("i",{class:e.normalizeClass(e.unref(s).e("line-inner")),style:e.normalizeStyle(S.value)},null,6)],2)),e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("icon"),e.unref(s).is(t.icon||t.$slots.icon?"icon":"text")])},[e.renderSlot(t.$slots,"icon",{},()=>[C.value?.icon?(e.openBlock(),e.createBlock(e.unref(f.VftIcon),e.mergeProps({key:0},C.value,{class:e.unref(s).e("icon-inner")}),null,16,["class"])):o.value==="success"?(e.openBlock(),e.createBlock(e.unref(f.VftIcon),{key:1,class:e.normalizeClass([e.unref(s).e("icon-inner"),e.unref(s).is("status")]),icon:"icon-check"},null,8,["class"])):o.value==="error"?(e.openBlock(),e.createBlock(e.unref(f.VftIcon),{key:2,class:e.normalizeClass([e.unref(s).e("icon-inner"),e.unref(s).is("status")]),icon:"icon-close"},null,8,["class"])):l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(e.unref(s).e("icon-inner"))},e.toDisplayString(r.value+1),3))])],2)],2),t.$slots.bottom?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(e.unref(s).e("bottom-slot"))},[e.renderSlot(t.$slots,"bottom")],2)):d.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(e.unref(s).e("main"))},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(s).e("title"),e.unref(s).is(o.value)])},[e.renderSlot(t.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(s).e("arrow"))},null,2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([e.unref(s).e("description"),e.unref(s).is(o.value)])},[e.renderSlot(t.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])],2))],2))],6))}});exports.default=P;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),f=require("../icon/index.cjs");require("@vueuse/core");const E=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");const I=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const w=require("./tokens.cjs"),D=e.defineComponent({name:"VftStep"}),P=e.defineComponent({...D,props:{title:{},icon:{},description:{},status:{}},setup(N){const k=N,t=I.useNamespace("step"),r=e.ref(-1),S=e.ref({}),i=e.ref(""),n=e.inject(w.STEPS_INJECTION_KEY),u=e.getCurrentInstance();e.onMounted(()=>{e.watch([()=>n.props.active,()=>n.props.processStatus,()=>n.props.finishStatus],([s])=>{T(s)},{immediate:!0})});const C=e.computed(()=>E.singleAttrToObj(k.icon,"icon")),o=e.computed(()=>k.status||i.value),$=e.computed(()=>{const s=n.steps.value[r.value-1];return s?s.currentStatus:"wait"}),p=e.computed(()=>n.props.alignCenter),B=e.computed(()=>n.props.direction==="vertical"),l=e.computed(()=>n.props.simple),d=e.computed(()=>n.props.contentPosition==="top"),v=e.computed(()=>n.steps.value.length),y=e.computed(()=>n.steps.value[v.value-1]?.uid===u.uid),c=e.computed(()=>l.value?"":n.props.space),g=e.computed(()=>[t.b(),t.is(l.value?"simple":n.props.direction),t.is("flex",y.value&&!c.value&&!p.value),t.is("center",p.value&&!B.value&&!l.value),t.is("content-top",d.value),t.is(o.value)]),h=e.computed(()=>{const s={flexBasis:E.isNumber(c.value)?`${c.value}px`:c.value?c.value:`${100/(v.value-(p.value?0:1))}%`};return B.value||y.value&&(s.maxWidth=`${100/v.value}%`),s}),q=s=>{r.value=s},b=s=>{const a=s==="wait",m={transitionDelay:`${a?"-":""}${150*r.value}ms`},z=s===n.props.processStatus||a?0:100;m.borderWidth=z&&!l.value?"1px":0,m[n.props.direction==="vertical"?"height":"width"]=`${z}%`,S.value=m},T=s=>{s>r.value?i.value=n.props.finishStatus:s===r.value&&$.value!=="error"?i.value=n.props.processStatus:i.value="wait";const a=n.steps.value[r.value-1];a&&a.calcProgress(i.value)},V=e.reactive({uid:u.uid,getVnode:()=>u.vnode,currentStatus:o,setIndex:q,calcProgress:b});return n.addStep(V),e.onBeforeUnmount(()=>{n.removeStep(V)}),(s,a)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(h.value),class:e.normalizeClass(g.value)},[s.$slots.top?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("top-slot"))},[e.renderSlot(s.$slots,"top")],2)):d.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(t).e("main"))},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(t).e("title"),e.unref(t).is(o.value)])},[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(s.title),1)])],2),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("arrow"))},null,2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(t).e("description"),e.unref(t).is(o.value)])},[e.renderSlot(s.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(s.description),1)])],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(t).e("head"),e.unref(t).is(o.value)])},[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("line"))},[e.createElementVNode("i",{class:e.normalizeClass(e.unref(t).e("line-inner")),style:e.normalizeStyle(S.value)},null,6)],2)),e.createElementVNode("div",{class:e.normalizeClass([e.unref(t).e("icon"),e.unref(t).is(s.icon||s.$slots.icon?"icon":"text")])},[e.renderSlot(s.$slots,"icon",{},()=>[C.value?.icon?(e.openBlock(),e.createBlock(e.unref(f.VftIcon),e.mergeProps({key:0},C.value,{class:e.unref(t).e("icon-inner")}),null,16,["class"])):o.value==="success"?(e.openBlock(),e.createBlock(e.unref(f.VftIcon),{key:1,class:e.normalizeClass([e.unref(t).e("icon-inner"),e.unref(t).is("status")]),icon:"icon-check"},null,8,["class"])):o.value==="error"?(e.openBlock(),e.createBlock(e.unref(f.VftIcon),{key:2,class:e.normalizeClass([e.unref(t).e("icon-inner"),e.unref(t).is("status")]),icon:"icon-close"},null,8,["class"])):l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(e.unref(t).e("icon-inner"))},e.toDisplayString(r.value+1),3))])],2)],2),s.$slots.bottom?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(e.unref(t).e("bottom-slot"))},[e.renderSlot(s.$slots,"bottom")],2)):d.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(e.unref(t).e("main"))},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(t).e("title"),e.unref(t).is(o.value)])},[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(s.title),1)])],2),l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).e("arrow"))},null,2)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([e.unref(t).e("description"),e.unref(t).is(o.value)])},[e.renderSlot(s.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(s.description),1)])],2))],2))],6))}});exports.default=P;
@@ -1 +1 @@
1
- "use strict";require("vft/theme-style/base.css");require("vft/theme-style/vft-steps.css");
1
+ "use strict";require("vft/theme-style/base.css");require("vft/theme-style/vft-step.css");require("vft/theme-style/vft-steps.css");
@@ -1 +1,2 @@
1
+ import 'vft/es/components/step/style/css';
1
2
  import 'vft/theme-style/vft-steps.css';
@@ -1 +1 @@
1
- "use strict";require("vft/theme-style/src/base.scss");require("vft/theme-style/src/steps.scss");
1
+ "use strict";require("vft/theme-style/src/base.scss");require("vft/theme-style/src/step.scss");require("vft/theme-style/src/steps.scss");
@@ -1 +1,2 @@
1
+ import 'vft/es/components/step/style';
1
2
  import 'vft/theme-style/src/steps.scss';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./super-form-simple.vue2.cjs");;/* empty css */const u=require("../../_virtual/_plugin-vue_export-helper.cjs"),r=u.default(e.default,[["__scopeId","data-v-b35ac0e7"]]);exports.default=r;
@@ -0,0 +1,46 @@
1
+ interface SimpleFormProps {
2
+ commonButtonOptions?: {
3
+ loading?: boolean;
4
+ btnText?: string;
5
+ onClick?: (data?: any) => void;
6
+ };
7
+ }
8
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SimpleFormProps>, {
9
+ commonButtonOptions: () => {
10
+ btnText: string;
11
+ loading: boolean;
12
+ };
13
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "common-click": (data?: any) => void;
15
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SimpleFormProps>, {
16
+ commonButtonOptions: () => {
17
+ btnText: string;
18
+ loading: boolean;
19
+ };
20
+ }>>> & Readonly<{
21
+ "onCommon-click"?: ((data?: any) => any) | undefined;
22
+ }>, {
23
+ commonButtonOptions: {
24
+ loading?: boolean;
25
+ btnText?: string;
26
+ onClick?: (data?: any) => void;
27
+ };
28
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
+ export default _default;
30
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
31
+ type __VLS_TypePropsToRuntimeProps<T> = {
32
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
33
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
34
+ } : {
35
+ type: import('vue').PropType<T[K]>;
36
+ required: true;
37
+ };
38
+ };
39
+ type __VLS_WithDefaults<P, D> = {
40
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
41
+ default: D[K];
42
+ }> : P[K];
43
+ };
44
+ type __VLS_Prettify<T> = {
45
+ [K in keyof T]: T[K];
46
+ } & {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../button/index.cjs"),l={class:"super-form-simple"},p=e.defineComponent({__name:"super-form-simple",props:{commonButtonOptions:{default:()=>({btnText:"取消",loading:!1})}},emits:["common-click"],setup(s,{emit:i}){const o=s,r=i,n=e.computed(()=>({btnText:"取消",...e.unref(o.commonButtonOptions)})),m=c=>{const t=e.unref(o.commonButtonOptions);t.onClick&&t.onClick(),r("common-click")};return(c,t)=>(e.openBlock(),e.createElementBlock("div",l,[e.createVNode(e.unref(u.VftButton),e.mergeProps(n.value,{onClick:m}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.value.btnText),1)]),_:1},16)]))}});exports.default=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.329";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.332";exports.version=e;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.329",
3
+ "version": "0.0.332",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
package/lib/script.css CHANGED
@@ -1 +1 @@
1
- .sortable-fallback{visibility:hidden!important}
1
+ .sortable-fallback{visibility:hidden!important}.super-form-simple[data-v-b35ac0e7]{padding:20px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vft",
3
- "version": "0.0.329",
3
+ "version": "0.0.332",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -55,12 +55,12 @@
55
55
  "resize-detector": "0.3.0",
56
56
  "sortablejs": "1.15.0",
57
57
  "photoswipe": "5.4.4",
58
- "@vft/constants": "0.0.72",
59
58
  "@vft/router": "0.0.65",
60
- "@vft/use": "0.0.76",
61
59
  "@vft/utils": "0.0.128",
62
- "@vft/directives": "0.0.33",
63
- "@vft/store": "0.0.54"
60
+ "@vft/use": "0.0.76",
61
+ "@vft/constants": "0.0.72",
62
+ "@vft/store": "0.0.54",
63
+ "@vft/directives": "0.0.33"
64
64
  },
65
65
  "vetur": {
66
66
  "tags": "tags.json",
package/web-types.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.329","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}
1
+ {"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.332","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}