vft 0.0.327 → 0.0.329

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,24 +1,24 @@
1
- import { defineComponent as W, computed as L, unref as u, useSlots as _, createVNode as d, mergeProps as F, withDirectives as ee, vShow as te, isVNode as re, createTextVNode as H, resolveComponent as U } from "vue";
2
- import { VftCol as G } from "../col/index.js";
3
- import { VftDivider as ne } from "../divider/index.js";
4
- import { VftFormItem as oe } from "../form/index.js";
1
+ import { defineComponent as $, computed as v, ref as ee, unref as u, useSlots as te, createVNode as f, mergeProps as L, withDirectives as re, vShow as ne, isVNode as oe, createTextVNode as G, resolveComponent as q } from "vue";
2
+ import { VftCol as J } from "../col/index.js";
3
+ import { VftDivider as le } from "../divider/index.js";
4
+ import { VftFormItem as se } from "../form/index.js";
5
5
  import "@vueuse/core";
6
- import { isFunction as C, isBoolean as v, cloneDeep as le, isArray as J, isNull as se, upperFirst as ie, isString as ae } from "@vft/utils";
6
+ import { isFunction as g, isBoolean as j, cloneDeep as ie, isArray as X, isNull as ae, upperFirst as ce, isString as ue } from "@vft/utils";
7
7
  import "../config-provider/hooks/use-global-config.js";
8
8
  import "lodash-es";
9
- import { useNamespace as ce } from "../../hooks/use-namespace/index.js";
9
+ import { useNamespace as fe } from "../../hooks/use-namespace/index.js";
10
10
  import "../../hooks/use-model-toggle/index.js";
11
11
  import "@popperjs/core";
12
12
  import "../../hooks/use-z-index/index.js";
13
- import { FormCompEnum as e, componentMap as X, isInput as ue, isDatePicker as de, isRangePicker as fe } from "./component-map.js";
14
- import { createPlaceholderMessage as z } from "./use/helper.js";
15
- function q(n) {
16
- return typeof n == "function" || Object.prototype.toString.call(n) === "[object Object]" && !re(n);
13
+ import { FormCompEnum as e, componentMap as z, isInput as de, isDatePicker as me, isRangePicker as he } from "./component-map.js";
14
+ import { createPlaceholderMessage as W } from "./use/helper.js";
15
+ function k(n) {
16
+ return typeof n == "function" || Object.prototype.toString.call(n) === "[object Object]" && !oe(n);
17
17
  }
18
- const me = W({
18
+ const pe = $({
19
19
  inheritAttrs: !1
20
- }), Se = /* @__PURE__ */ W({
21
- ...me,
20
+ }), Ne = /* @__PURE__ */ $({
21
+ ...pe,
22
22
  __name: "super-form-item",
23
23
  props: {
24
24
  schema: {},
@@ -30,7 +30,7 @@ const me = W({
30
30
  formActionType: {}
31
31
  },
32
32
  setup(n) {
33
- const D = ce("super-form"), P = L(() => {
33
+ const D = fe("super-form"), P = v(() => {
34
34
  const {
35
35
  mergeDynamicData: t
36
36
  } = n.formProps;
@@ -42,13 +42,14 @@ const me = W({
42
42
  ...n.allDefaultValues,
43
43
  ...n.formModel
44
44
  },
45
- schema: n.schema
45
+ schema: n.schema,
46
+ elRef: w
46
47
  };
47
- }), K = L(() => {
48
+ }), K = v(() => {
48
49
  let {
49
50
  componentProps: t = {}
50
51
  } = n.schema;
51
- C(t) && (t = t({
52
+ g(t) && (t = t({
52
53
  schema: n.schema,
53
54
  formModel: n.formModel,
54
55
  formActionType: n.formActionType
@@ -97,7 +98,7 @@ const me = W({
97
98
  "end-placeholder": "结束月份"
98
99
  }]]);
99
100
  return r.has(n.schema.type) && (t = Object.assign(r.get(n.schema.type) || {}, t)), n.formProps.inputMaxLength && [e.INPUT].includes(n.schema.type) && !t?.maxlength && (t.maxlength = n.formProps.inputMaxLength), t;
100
- }), $ = L(() => {
101
+ }), Y = v(() => {
101
102
  const {
102
103
  disabled: t
103
104
  } = n.formProps, {
@@ -106,20 +107,20 @@ const me = W({
106
107
  disabled: a = !1
107
108
  } = u(K);
108
109
  let i = !!t || a;
109
- return v(r) && (i = r), C(r) && (i = r(u(P))), i;
110
+ return j(r) && (i = r), g(r) && (i = r(u(P))), i;
110
111
  });
111
- function j() {
112
+ function V() {
112
113
  const {
113
114
  show: t,
114
115
  ifShow: r
115
116
  } = n.schema;
116
117
  let a = !0, i = !0;
117
- return v(t) && (a = t), v(r) && (i = r), C(t) && (a = t(u(P))), C(r) && (i = r(u(P))), {
118
+ return j(t) && (a = t), j(r) && (i = r), g(t) && (a = t(u(P))), g(r) && (i = r(u(P))), {
118
119
  isShow: a,
119
120
  isIfShow: i
120
121
  };
121
122
  }
122
- function Y() {
123
+ function Q() {
123
124
  const {
124
125
  rules: t = [],
125
126
  type: r = e.INPUT,
@@ -127,26 +128,26 @@ const me = W({
127
128
  label: i,
128
129
  title: p,
129
130
  dynamicRule: c,
130
- required: I,
131
- dynamicRuleAdd: R = !0
131
+ required: C,
132
+ dynamicRuleAdd: I = !0
132
133
  } = n.schema, m = i || p;
133
- if (C(c) && !R)
134
+ if (g(c) && !I)
134
135
  return c(u(P));
135
- let o = le(J(t) ? t : [t]);
136
+ let o = ie(X(t) ? t : [t]);
136
137
  const {
137
138
  rulesMessageJoinLabel: b
138
- } = n.formProps, y = Reflect.has(n.schema, "rulesMessageJoinLabel") ? a : b, A = z(r, `${y ? m : ""}`);
139
+ } = n.formProps, y = Reflect.has(n.schema, "rulesMessageJoinLabel") ? a : b, A = W(r, `${y ? m : ""}`);
139
140
  function M(l, s) {
140
141
  const N = l.message || A;
141
- return s === void 0 || se(s) || Array.isArray(s) && s.length === 0 || typeof s == "string" && s.trim() === "" || typeof s == "object" && Reflect.has(s, "checked") && Reflect.has(s, "halfChecked") && Array.isArray(s.checked) && Array.isArray(s.halfChecked) && s.checked.length === 0 && s.halfChecked.length === 0 ? Promise.reject(N) : Promise.resolve();
142
+ return s === void 0 || ae(s) || Array.isArray(s) && s.length === 0 || typeof s == "string" && s.trim() === "" || typeof s == "object" && Reflect.has(s, "checked") && Reflect.has(s, "halfChecked") && Array.isArray(s.checked) && Array.isArray(s.halfChecked) && s.checked.length === 0 && s.halfChecked.length === 0 ? Promise.reject(N) : Promise.resolve();
142
143
  }
143
- const f = C(I) ? I(u(P)) : I, T = [e.RADIO, e.SELECT, e.RADIO, e.RADIO_SINGLE, e.RADIO_BUTTON, e.CHECKBOX, e.CHECKBOX_SINGLE, e.CHECKBOX_BUTTON, e.AUTOCOMPLETE, e.Cascader, e.ColorPicker, e.Upload, e.Slider].includes(r);
144
- f && (!o || o.length === 0 ? o = [{
145
- required: f,
144
+ const d = g(C) ? C(u(P)) : C, T = [e.RADIO, e.SELECT, e.RADIO, e.RADIO_SINGLE, e.RADIO_BUTTON, e.CHECKBOX, e.CHECKBOX_SINGLE, e.CHECKBOX_BUTTON, e.AUTOCOMPLETE, e.Cascader, e.ColorPicker, e.Upload, e.Slider].includes(r);
145
+ d && (!o || o.length === 0 ? o = [{
146
+ required: d,
146
147
  validator: M,
147
148
  trigger: T ? "change" : "blur"
148
149
  }] : o.findIndex((s) => Reflect.has(s, "required")) === -1 && o.unshift({
149
- required: f,
150
+ required: d,
150
151
  validator: M,
151
152
  trigger: T ? "change" : "blur"
152
153
  }));
@@ -154,23 +155,23 @@ const me = W({
154
155
  if (x !== -1) {
155
156
  const l = o[x], {
156
157
  isShow: s
157
- } = j();
158
+ } = V();
158
159
  s || (l.required = !1), r && (l.message = l.message || A);
159
160
  }
160
161
  const h = o.findIndex((l) => l.min), E = o.findIndex((l) => l.max);
161
- function g(l, s, N = "all") {
162
- const O = o[s], B = O.isNumber ? isNaN(l) ? l?.length || 0 : Number(l) : l?.length || 0;
163
- return ["min", "all"].includes(N) && B < O.min ? Promise.reject(m + "至少为" + O.min + "位") : ["max", "all"].includes(N) && B > O.max ? Promise.reject(m + "最多" + O.max + "位") : Promise.resolve();
162
+ function R(l, s, N = "all") {
163
+ const O = o[s], H = O.isNumber ? isNaN(l) ? l?.length || 0 : Number(l) : l?.length || 0;
164
+ return ["min", "all"].includes(N) && H < O.min ? Promise.reject(m + "至少为" + O.min + "位") : ["max", "all"].includes(N) && H > O.max ? Promise.reject(m + "最多" + O.max + "位") : Promise.resolve();
164
165
  }
165
- (h !== -1 || E !== -1) && (h !== -1 && E !== -1 && !o[h].validator && !o[h].message ? o[h].validator = (l, s) => g(s, h) : h !== -1 && !o[h].validator && !o[h].message ? o[h].validator = (l, s) => g(s, h, "min") : E !== -1 && !o[E].validator && !o[E].message && (o[E].validator = (l, s) => g(s, E, "max")));
166
+ (h !== -1 || E !== -1) && (h !== -1 && E !== -1 && !o[h].validator && !o[h].message ? o[h].validator = (l, s) => R(s, h) : h !== -1 && !o[h].validator && !o[h].message ? o[h].validator = (l, s) => R(s, h, "min") : E !== -1 && !o[E].validator && !o[E].message && (o[E].validator = (l, s) => R(s, E, "max")));
166
167
  const S = o.findIndex((l) => l.len);
167
- if (S !== -1 && (o[S].validator = (l, s) => s.length !== o[S].len ? Promise.reject(m + "必须是" + o[S].len + "位") : Promise.resolve()), C(c) && R) {
168
+ if (S !== -1 && (o[S].validator = (l, s) => s.length !== o[S].len ? Promise.reject(m + "必须是" + o[S].len + "位") : Promise.resolve()), g(c) && I) {
168
169
  let l = c(u(P));
169
- l = J(l) ? l : [l], o = o.concat(l);
170
+ l = X(l) ? l : [l], o = o.concat(l);
170
171
  }
171
172
  return o;
172
173
  }
173
- const Q = () => {
174
+ const w = ee(), Z = () => {
174
175
  const {
175
176
  renderComponentContent: t,
176
177
  type: r = e.INPUT,
@@ -178,66 +179,73 @@ const me = W({
178
179
  changeEvent: i = "change",
179
180
  valueField: p,
180
181
  label: c,
181
- title: I,
182
- placeholderJoinLabel: R = !0
182
+ title: C,
183
+ placeholderJoinLabel: I = !0
183
184
  } = n.schema;
184
185
  let m = i;
185
- ue(r) ? m = "input" : de(r) || r === e.TIME_PICKER || [e.INPUT_TAG, e.AUTOCOMPLETE, e.Cascader, e.ColorPicker, e.Slider].includes(r) ? m = "update:modelValue" : r === e.Upload && (m = "update:fileList");
186
- const o = `on${ie(m)}`, b = {
187
- [o]: (...g) => {
188
- const [S] = g;
189
- f[o] && f[o](...g);
186
+ de(r) ? m = "input" : me(r) || r === e.TIME_PICKER || [e.INPUT_TAG, e.AUTOCOMPLETE, e.Cascader, e.ColorPicker, e.Slider].includes(r) ? m = "update:modelValue" : r === e.Upload && (m = "update:fileList");
187
+ const o = `on${ce(m)}`, b = {
188
+ [o]: (...R) => {
189
+ const [S] = R;
190
+ d[o] && d[o](...R);
190
191
  const l = S ? S.target : null, s = l ? l.value : S;
191
192
  n.setFormModel(a, s, n.schema);
192
193
  }
193
- }, y = X.get(r), {
194
+ }, y = z.get(r), {
194
195
  autoSetPlaceHolder: A,
195
196
  size: M
196
- } = n.formProps, f = {
197
+ } = n.formProps, d = {
197
198
  clearable: !0,
198
199
  ...u(K)
199
200
  };
200
- if ([e.SEARCH].includes(r) || (f.size = u(K)?.size || M, f.disabled = u($)), !f.disabled && A && !fe(r) && r) {
201
- const g = c || I;
202
- f.placeholder = u(K)?.placeholder || z(r, R && ae(g) ? g : "");
201
+ if ([e.SEARCH].includes(r) || (d.size = u(K)?.size || M, d.disabled = u(Y)), !d.disabled && A && !he(r) && r) {
202
+ const R = c || C;
203
+ d.placeholder = u(K)?.placeholder || W(r, I && ue(R) ? R : "");
203
204
  }
204
205
  const x = {
205
206
  [p || "model-value"]: n.formModel[a]
206
207
  }, h = {
207
208
  ...b,
208
- ...f,
209
+ ...d,
209
210
  ...x
210
211
  };
211
212
  if (!t && r !== e.Upload)
212
- return d(y, h, null);
213
+ return f(y, L({
214
+ ref: w
215
+ }, h), null);
213
216
  let E;
214
- if (E = C(t) ? {
215
- ...t(u(P))
217
+ if (E = g(t) ? {
218
+ ...t({
219
+ ...u(P),
220
+ elRef: w
221
+ })
216
222
  } : {
217
223
  default: () => t
218
224
  }, r === e.Upload && !t) {
219
225
  const {
220
- drag: g
226
+ drag: R
221
227
  } = u(K);
222
- E = g ? {
223
- default: () => d(U("vft-icon"), {
228
+ E = R ? {
229
+ default: () => f(q("vft-icon"), {
224
230
  icon: "icon-arrow-upload"
225
231
  }, null)
226
232
  } : {
227
- default: () => d(U("vft-button"), {
233
+ default: () => f(q("vft-button"), {
228
234
  type: "primary"
229
235
  }, {
230
- default: () => [d(U("vft-icon"), {
236
+ default: () => [f(q("vft-icon"), {
231
237
  icon: "icon-arrow-upload"
232
238
  }, null)]
233
239
  })
234
240
  };
235
241
  }
236
- return d(y, h, q(E) ? E : {
242
+ return f(y, L({
243
+ ref: w
244
+ }, h), k(E) ? E : {
237
245
  default: () => [E]
238
246
  });
239
247
  };
240
- function w() {
248
+ function U() {
241
249
  const {
242
250
  showLabel: t = !0,
243
251
  label: r,
@@ -246,22 +254,22 @@ const me = W({
246
254
  labelRequired: p
247
255
  } = n.schema;
248
256
  let c = r || a;
249
- return c = p ? d("span", null, [d("span", {
257
+ return c = p ? f("span", null, [f("span", {
250
258
  class: "label-required"
251
- }, [H("*")]), d("span", null, [c])]) : c, t && c ? i ? d("span", null, [c, H(" "), d("span", {
259
+ }, [G("*")]), f("span", null, [c])]) : c, t && c ? i ? f("span", null, [c, G(" "), f("span", {
252
260
  class: "sub-label"
253
261
  }, [i])]) : c : void 0;
254
262
  }
255
- const k = _();
256
- function V(t, r = "default", a) {
263
+ const B = te();
264
+ function F(t, r = "default", a) {
257
265
  if (!t || !Reflect.has(t, r))
258
266
  return null;
259
- if (!C(t[r]))
267
+ if (!g(t[r]))
260
268
  return console.error(`${r} is not a function!`), null;
261
269
  const i = t[r];
262
270
  return i ? i(a) : null;
263
271
  }
264
- function Z() {
272
+ function _() {
265
273
  const {
266
274
  itemProps: t,
267
275
  slot: r,
@@ -269,18 +277,18 @@ const me = W({
269
277
  field: i,
270
278
  suffix: p,
271
279
  prefix: c,
272
- prefixParentStyle: I
280
+ prefixParentStyle: C
273
281
  } = n.schema, {
274
- autoCleanErrorMessage: R,
282
+ autoCleanErrorMessage: I,
275
283
  compFullWidth: m
276
- } = n.formProps, o = () => r ? V(k, r, u(P)) : a ? a(u(P)) : Q(), b = !!p, y = !!c, A = C(p) ? p(u(P)) : p, M = C(c) ? c(u(P)) : c, f = () => {
284
+ } = n.formProps, o = () => r ? F(B, r, u(P)) : a ? a(u(P)) : Z(), b = !!p, y = !!c, A = g(p) ? p(u(P)) : p, M = g(c) ? c(u(P)) : c, d = () => {
277
285
  n.updateSchema([{
278
286
  field: i,
279
287
  itemProps: {
280
288
  error: ""
281
289
  }
282
290
  }]);
283
- }, T = () => d(oe, F({
291
+ }, T = () => f(se, L({
284
292
  style: {
285
293
  marginRight: n.formProps.customLayout ? "10px" : 0
286
294
  },
@@ -292,22 +300,22 @@ const me = W({
292
300
  }, D.e("item")]
293
301
  }, t, {
294
302
  label: t?.label || t?.title,
295
- "onUpdate:error": R ? f : () => {
303
+ "onUpdate:error": I ? d : () => {
296
304
  },
297
- rules: Y()
305
+ rules: Q()
298
306
  }), {
299
- default: () => [d("div", {
307
+ default: () => [f("div", {
300
308
  class: D.e("container")
301
- }, [d("div", {
309
+ }, [f("div", {
302
310
  class: D.e("content")
303
- }, [o(), b && d("span", {
311
+ }, [o(), b && f("span", {
304
312
  class: D.m("suffix")
305
313
  }, [A])])])],
306
- label: w() ? () => w() : void 0
314
+ label: U() ? () => U() : void 0
307
315
  });
308
- return y ? d("div", {
309
- style: I
310
- }, [d("span", {
316
+ return y ? f("div", {
317
+ style: C
318
+ }, [f("span", {
311
319
  class: D.m("prefix")
312
320
  }, [M]), T()]) : T();
313
321
  }
@@ -319,20 +327,20 @@ const me = W({
319
327
  renderColContent: i,
320
328
  type: p = e.INPUT,
321
329
  render: c,
322
- quickColSpan: I
330
+ quickColSpan: C
323
331
  } = n.schema;
324
- if (!X.has(p) && !i && !c)
332
+ if (!z.has(p) && !i && !c)
325
333
  return null;
326
334
  const {
327
- baseColProps: R = {},
335
+ baseColProps: I = {},
328
336
  quickColSpan: m
329
337
  } = n.formProps, o = m ? {
330
338
  span: Math.ceil(24 / m),
331
- ...R
339
+ ...I
332
340
  } : {
333
- ...R
334
- }, b = I ? {
335
- span: Math.ceil(24 / I),
341
+ ...I
342
+ }, b = C ? {
343
+ span: Math.ceil(24 / C),
336
344
  ...r
337
345
  } : {
338
346
  ...r
@@ -342,23 +350,23 @@ const me = W({
342
350
  }, {
343
351
  isIfShow: A,
344
352
  isShow: M
345
- } = j(), f = u(P), T = () => a ? V(k, a, f) : i ? i(f) : Z();
353
+ } = V(), d = u(P), T = () => a ? F(B, a, d) : i ? i(d) : _();
346
354
  if (p === e.DIVIDER) {
347
355
  let x;
348
- return d(G, F({
356
+ return f(J, L({
349
357
  span: 24
350
358
  }, b), {
351
- default: () => [d(ne, u(K), q(x = w()) ? x : {
359
+ default: () => [f(le, u(K), k(x = U()) ? x : {
352
360
  default: () => [x]
353
361
  })]
354
362
  });
355
363
  }
356
- return A && (n.formProps.customLayout ? T() : ee(d(G, y, q(t = T()) ? t : {
364
+ return A && (n.formProps.customLayout ? T() : re(f(J, y, k(t = T()) ? t : {
357
365
  default: () => [t]
358
- }), [[te, M]]));
366
+ }), [[ne, M]]));
359
367
  };
360
368
  }
361
369
  });
362
370
  export {
363
- Se as default
371
+ Ne as default
364
372
  };
@@ -4,7 +4,7 @@ import type { FormItemProp, FormItemProps, FormProps } from 'vft/es/components/f
4
4
  import type { RowProps } from 'vft/es/components/row';
5
5
  import type { ComponentSize } from 'vft/es/constants';
6
6
  import type { InternalRuleItem, RuleItem } from 'async-validator';
7
- import type { StyleValue, VNode } from 'vue';
7
+ import type { ComponentPublicInstance, Ref, StyleValue, VNode } from 'vue';
8
8
  import type { Arrayable } from 'vft/es/utils';
9
9
  import type { Recordable } from '../types';
10
10
  import { FormCompEnum } from './component-map';
@@ -47,6 +47,8 @@ export interface RenderCallbackParams {
47
47
  model: Recordable;
48
48
  /** 字段名 */
49
49
  field: string;
50
+ /** 组件实例引用 */
51
+ elRef?: Ref<ComponentPublicInstance | null>;
50
52
  }
51
53
  /** 表单操作方法接口 */
52
54
  export interface FormActionType {
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.327",
3
+ "version": "0.0.329",
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.327";
1
+ const o = "0.0.329";
2
2
  export {
3
3
  o as version
4
4
  };
@@ -11,6 +11,10 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
11
11
  type: import("vue").PropType<number>;
12
12
  default: number;
13
13
  };
14
+ contentPosition: {
15
+ type: import("vue").PropType<"top" | "bottom">;
16
+ default: string;
17
+ };
14
18
  alignCenter: {
15
19
  type: import("vue").PropType<boolean>;
16
20
  };
@@ -32,6 +36,7 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
32
36
  }, import("vue").PublicProps, {
33
37
  direction: "horizontal" | "vertical";
34
38
  active: number;
39
+ contentPosition: "top" | "bottom";
35
40
  finishStatus: "wait" | "process" | "finish" | "error" | "success";
36
41
  processStatus: "wait" | "process" | "finish" | "error" | "success";
37
42
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
@@ -53,6 +58,10 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
53
58
  type: import("vue").PropType<number>;
54
59
  default: number;
55
60
  };
61
+ contentPosition: {
62
+ type: import("vue").PropType<"top" | "bottom">;
63
+ default: string;
64
+ };
56
65
  alignCenter: {
57
66
  type: import("vue").PropType<boolean>;
58
67
  };
@@ -72,6 +81,7 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
72
81
  }>, {}, {}, {}, {}, {
73
82
  direction: "horizontal" | "vertical";
74
83
  active: number;
84
+ contentPosition: "top" | "bottom";
75
85
  finishStatus: "wait" | "process" | "finish" | "error" | "success";
76
86
  processStatus: "wait" | "process" | "finish" | "error" | "success";
77
87
  }>;
@@ -90,6 +100,10 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
90
100
  type: import("vue").PropType<number>;
91
101
  default: number;
92
102
  };
103
+ contentPosition: {
104
+ type: import("vue").PropType<"top" | "bottom">;
105
+ default: string;
106
+ };
93
107
  alignCenter: {
94
108
  type: import("vue").PropType<boolean>;
95
109
  };
@@ -111,6 +125,7 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
111
125
  }, string, {
112
126
  direction: "horizontal" | "vertical";
113
127
  active: number;
128
+ contentPosition: "top" | "bottom";
114
129
  finishStatus: "wait" | "process" | "finish" | "error" | "success";
115
130
  processStatus: "wait" | "process" | "finish" | "error" | "success";
116
131
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
@@ -124,7 +139,7 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
124
139
  type: import("vue").PropType<string>;
125
140
  };
126
141
  icon: {
127
- type: import("vue").PropType<import("vft/es/vft").IconProps>;
142
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
128
143
  };
129
144
  description: {
130
145
  type: import("vue").PropType<string>;
@@ -144,7 +159,7 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
144
159
  type: import("vue").PropType<string>;
145
160
  };
146
161
  icon: {
147
- type: import("vue").PropType<import("vft/es/vft").IconProps>;
162
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
148
163
  };
149
164
  description: {
150
165
  type: import("vue").PropType<string>;
@@ -161,7 +176,7 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
161
176
  type: import("vue").PropType<string>;
162
177
  };
163
178
  icon: {
164
- type: import("vue").PropType<import("vft/es/vft").IconProps>;
179
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
165
180
  };
166
181
  description: {
167
182
  type: import("vue").PropType<string>;
@@ -171,9 +186,11 @@ export declare const VftSteps: import("vft/es/utils").SFCWithInstall<{
171
186
  };
172
187
  }>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
173
188
  $slots: {
174
- icon?(_: {}): any;
189
+ top?(_: {}): any;
175
190
  title?(_: {}): any;
176
191
  description?(_: {}): any;
192
+ icon?(_: {}): any;
193
+ bottom?(_: {}): any;
177
194
  };
178
195
  });
179
196
  };
@@ -184,7 +201,7 @@ export declare const VftStep: import("vft/es/utils").SFCWithInstall<{
184
201
  type: import("vue").PropType<string>;
185
202
  };
186
203
  icon: {
187
- type: import("vue").PropType<import("vft/es/vft").IconProps>;
204
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
188
205
  };
189
206
  description: {
190
207
  type: import("vue").PropType<string>;
@@ -204,7 +221,7 @@ export declare const VftStep: import("vft/es/utils").SFCWithInstall<{
204
221
  type: import("vue").PropType<string>;
205
222
  };
206
223
  icon: {
207
- type: import("vue").PropType<import("vft/es/vft").IconProps>;
224
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
208
225
  };
209
226
  description: {
210
227
  type: import("vue").PropType<string>;
@@ -221,7 +238,7 @@ export declare const VftStep: import("vft/es/utils").SFCWithInstall<{
221
238
  type: import("vue").PropType<string>;
222
239
  };
223
240
  icon: {
224
- type: import("vue").PropType<import("vft/es/vft").IconProps>;
241
+ type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
225
242
  };
226
243
  description: {
227
244
  type: import("vue").PropType<string>;
@@ -231,9 +248,11 @@ export declare const VftStep: import("vft/es/utils").SFCWithInstall<{
231
248
  };
232
249
  }>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
233
250
  $slots: {
234
- icon?(_: {}): any;
251
+ top?(_: {}): any;
235
252
  title?(_: {}): any;
236
253
  description?(_: {}): any;
254
+ icon?(_: {}): any;
255
+ bottom?(_: {}): any;
237
256
  };
238
257
  })>;
239
258
  export * from './types';
@@ -1,30 +1,24 @@
1
- import type { StepItemProps } from './types';
2
- import type { Ref } from 'vue';
3
- export interface IStepsProps {
4
- space: number | string;
5
- active: number;
6
- direction: string;
7
- alignCenter: boolean;
8
- simple: boolean;
9
- finishStatus: string;
10
- processStatus: string;
11
- }
1
+ import type { StepItemProps, StepsProps } from './types';
2
+ import type { Ref, VNode } from 'vue';
12
3
  export interface StepItemState {
13
4
  uid: number;
5
+ getVnode: () => VNode;
14
6
  currentStatus: string;
15
7
  setIndex: (val: number) => void;
16
8
  calcProgress: (status: string) => void;
17
9
  }
18
10
  export interface IStepsInject {
19
- props: IStepsProps;
11
+ props: StepsProps;
20
12
  steps: Ref<StepItemState[]>;
21
13
  addStep: (item: StepItemState) => void;
22
- removeStep: (uid: number) => void;
14
+ removeStep: (item: StepItemState) => void;
23
15
  }
24
16
  declare function __VLS_template(): {
25
- icon?(_: {}): any;
17
+ top?(_: {}): any;
26
18
  title?(_: {}): any;
27
19
  description?(_: {}): any;
20
+ icon?(_: {}): any;
21
+ bottom?(_: {}): any;
28
22
  };
29
23
  declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<StepItemProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<StepItemProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
30
24
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("@vueuse/core");const E=require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");const w=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const d=require("../icon/index.cjs"),I=e.defineComponent({name:"VftStep"}),b=e.defineComponent({...I,props:{title:{},icon:{},description:{},status:{}},setup(B){const z=B,s=w.useNamespace("step"),r=e.ref(-1),m=e.ref({}),u=e.ref(""),n=e.inject("VftSteps"),f=e.getCurrentInstance();e.onMounted(()=>{e.watch([()=>n.props.active,()=>n.props.processStatus,()=>n.props.finishStatus],([t])=>{q(t)},{immediate:!0})}),e.onBeforeUnmount(()=>{n.removeStep(C.uid)});const o=e.computed(()=>z.status||u.value),V=e.computed(()=>{const t=n.steps.value[r.value-1];return t?t.currentStatus:"wait"}),c=e.computed(()=>n.props.alignCenter),S=e.computed(()=>n.props.direction==="vertical"),l=e.computed(()=>n.props.simple),p=e.computed(()=>n.steps.value.length),k=e.computed(()=>n.steps.value[p.value-1]?.uid===f?.uid),i=e.computed(()=>l.value?"":n.props.space),h=e.computed(()=>[s.b(),s.is(l.value?"simple":n.props.direction),s.is("flex",k.value&&!i.value&&!c.value),s.is("center",c.value&&!S.value&&!l.value)]),$=e.computed(()=>{const t={flexBasis:E.isNumber(i.value)?`${i.value}px`:i.value?i.value:`${100/(p.value-(c.value?0:1))}%`};return S.value||k.value&&(t.maxWidth=`${100/p.value}%`),t}),g=t=>{r.value=t},N=t=>{const a=t==="wait",v={transitionDelay:`${a?"-":""}${150*r.value}ms`},y=t===n.props.processStatus||a?0:100;v.borderWidth=y&&!l.value?"1px":0,v[n.props.direction==="vertical"?"height":"width"]=`${y}%`,m.value=v},q=t=>{t>r.value?u.value=n.props.finishStatus:t===r.value&&V.value!=="error"?u.value=n.props.processStatus:u.value="wait";const a=n.steps.value[r.value-1];a&&a.calcProgress(u.value)},C=e.reactive({uid:f.uid,currentStatus:o,setIndex:g,calcProgress:N});return n.addStep(C),(t,a)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle($.value),class:e.normalizeClass(h.value)},[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(m.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",{},()=>[t.icon?(e.openBlock(),e.createBlock(e.unref(d.VftIcon),{key:0,class:e.normalizeClass(e.unref(s).e("icon-inner"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),_:1},8,["class"])):o.value==="success"?(e.openBlock(),e.createBlock(e.unref(d.VftIcon),{key:1,class:e.normalizeClass([e.unref(s).e("icon-inner"),e.unref(s).is("status")])},null,8,["class"])):o.value==="error"?(e.openBlock(),e.createBlock(e.unref(d.VftIcon),{key:2,class:e.normalizeClass([e.unref(s).e("icon-inner"),e.unref(s).is("status")])},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),e.createElementVNode("div",{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=b;
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;