vft 0.0.360 → 0.0.362
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/carousel/use-carousel.js +1 -1
- package/es/components/input/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- package/es/components/md-vue-playground/md-vue-playground.vue2.js +11 -14
- package/es/components/super-form/use/use-form-events.js +7 -9
- package/es/components/super-form/use/use-form.js +14 -13
- package/es/components/upload/upload.vue.d.ts +13 -13
- package/es/components/upload/upload.vue2.js +46 -152
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/utils/vue/vnode.js +1 -1
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/md-vue-playground/md-vue-playground.vue2.cjs +1 -1
- package/lib/components/super-form/use/use-form-events.cjs +1 -1
- package/lib/components/super-form/use/use-form.cjs +1 -1
- package/lib/components/upload/upload.vue.d.ts +13 -13
- package/lib/components/upload/upload.vue2.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/web-types.json +1 -1
|
@@ -10,7 +10,7 @@ import "../../hooks/use-model-toggle/index.js";
|
|
|
10
10
|
import { useOrderedChildren as Ie } from "../../hooks/use-ordered-children/index.js";
|
|
11
11
|
import "@popperjs/core";
|
|
12
12
|
import "../../hooks/use-z-index/index.js";
|
|
13
|
-
import {
|
|
13
|
+
import { carouselContextKey as ge, CAROUSEL_ITEM_NAME as H } from "./constants.js";
|
|
14
14
|
const L = 300, _e = (t, O, M) => {
|
|
15
15
|
const {
|
|
16
16
|
children: o,
|
|
@@ -13,8 +13,8 @@ import "../../hooks/use-z-index/index.js";
|
|
|
13
13
|
import { UPDATE_MODEL_EVENT as Q } from "@vft/constants";
|
|
14
14
|
import { useAttrs as Ze, useCursor as _e } from "@vft/use";
|
|
15
15
|
import { calcTextareaHeight as ye } from "./utils.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useFormItem as et, useFormItemInputId as tt } from "../form/hooks/use-form-item.js";
|
|
17
|
+
import { useFormSize as at, useFormDisabled as ot } from "../form/hooks/use-form-common-props.js";
|
|
18
18
|
const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"], st = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"], It = /* @__PURE__ */ Oe({
|
|
19
19
|
__name: "input",
|
|
20
20
|
props: {
|
|
@@ -85,9 +85,9 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
85
85
|
o.is("focus", v.value)
|
|
86
86
|
]), d = Ze({
|
|
87
87
|
excludeKeys: l(() => Object.keys(X.value))
|
|
88
|
-
}), { form: Ce, formItem: F } =
|
|
88
|
+
}), { form: Ce, formItem: F } = et(), { inputId: Y } = tt(xe.props, {
|
|
89
89
|
formItemContext: F
|
|
90
|
-
}), ke =
|
|
90
|
+
}), ke = at(), h = ot(), 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
93
|
})), te = l(() => Ce?.statusIcon ?? !1), I = l(() => F?.validateState || ""), ae = l(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallowRef as B, ref as L, computed as c, watch as G } from "vue";
|
|
2
2
|
import { EVENT_CODE as g } from "../../../constants/aria.js";
|
|
3
|
-
import { CHANGE_EVENT as i,
|
|
3
|
+
import { CHANGE_EVENT as i, UPDATE_MODEL_EVENT as d, INPUT_EVENT as H } from "../../../constants/event.js";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import { isUndefined as K } from "@vft/utils";
|
|
6
6
|
import { debugWarn as C } from "../../../utils/error.js";
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as i, ref as s, shallowRef as
|
|
2
|
-
import { VftIcon as
|
|
1
|
+
import { defineComponent as i, ref as s, shallowRef as p, computed as d, onMounted as m, createVNode as e, h as v } from "vue";
|
|
2
|
+
import { VftIcon as f } from "../icon/index.js";
|
|
3
3
|
import "@vueuse/core";
|
|
4
4
|
import "@vft/utils";
|
|
5
5
|
import "../config-provider/hooks/use-global-config.js";
|
|
6
6
|
import "lodash-es";
|
|
7
|
-
import { useNamespace as
|
|
7
|
+
import { useNamespace as g } from "../../hooks/use-namespace/index.js";
|
|
8
8
|
import "../../hooks/use-model-toggle/index.js";
|
|
9
9
|
import "@popperjs/core";
|
|
10
10
|
import "../../hooks/use-z-index/index.js";
|
|
11
|
+
import { Repl as w, ReplStore as h } from "@vue/repl";
|
|
11
12
|
import { getVuePlaygroundSettings as V } from "./playground.js";
|
|
12
13
|
const y = i({
|
|
13
14
|
name: "vft-md-vue-playground"
|
|
14
|
-
}),
|
|
15
|
+
}), P = /* @__PURE__ */ i({
|
|
15
16
|
...y,
|
|
16
17
|
props: {
|
|
17
18
|
title: {},
|
|
@@ -19,17 +20,13 @@ const y = i({
|
|
|
19
20
|
settings: {}
|
|
20
21
|
},
|
|
21
22
|
setup(t) {
|
|
22
|
-
const u =
|
|
23
|
-
|
|
24
|
-
ReplStore: p,
|
|
25
|
-
Repl: d
|
|
26
|
-
} = await import("@vue/repl");
|
|
27
|
-
n.value = d, a.value = new p({
|
|
23
|
+
const u = g("md-vue-playground"), r = s(!0), n = p(), a = s(), o = d(() => V(t.settings)), l = s(o.value.showCode || !1), c = async () => {
|
|
24
|
+
n.value = w, a.value = new h({
|
|
28
25
|
serializedState: decodeURIComponent(t.files),
|
|
29
26
|
showOutput: !0
|
|
30
27
|
}), o.value.vueVersion && await a.value.setVueVersion(o.value.vueVersion);
|
|
31
28
|
};
|
|
32
|
-
return
|
|
29
|
+
return m(async () => {
|
|
33
30
|
await c(), r.value = !1;
|
|
34
31
|
}), () => e("div", {
|
|
35
32
|
class: u.b()
|
|
@@ -37,7 +34,7 @@ const y = i({
|
|
|
37
34
|
class: "title-wrapper"
|
|
38
35
|
}, [t.title ? e("div", {
|
|
39
36
|
class: "title"
|
|
40
|
-
}, [decodeURIComponent(t.title)]) : null, e(
|
|
37
|
+
}, [decodeURIComponent(t.title)]) : null, e(f, {
|
|
41
38
|
cursor: !0,
|
|
42
39
|
icon: l.value ? "icon-collapse-alt" : "icon-expand-alt",
|
|
43
40
|
size: 20,
|
|
@@ -46,12 +43,12 @@ const y = i({
|
|
|
46
43
|
}
|
|
47
44
|
}, null)]), e("div", {
|
|
48
45
|
class: ["repl-container", l.value ? "show-code" : "hide-code"]
|
|
49
|
-
}, [n.value ?
|
|
46
|
+
}, [n.value ? v(n.value, {
|
|
50
47
|
store: a.value,
|
|
51
48
|
...o.value
|
|
52
49
|
}) : null])]);
|
|
53
50
|
}
|
|
54
51
|
});
|
|
55
52
|
export {
|
|
56
|
-
|
|
53
|
+
P as default
|
|
57
54
|
};
|
|
@@ -4,7 +4,7 @@ import { get as ot, cloneDeep as m, uniqBy as at, isEqual as ct, set as X } from
|
|
|
4
4
|
import { unref as n, toRaw as x, nextTick as W } from "vue";
|
|
5
5
|
import { isInput as ft, FormCompEnum as S, isDatePicker as ut } from "../component-map.js";
|
|
6
6
|
import { handleInputNumberValue as dt } from "./helper.js";
|
|
7
|
-
function
|
|
7
|
+
function _(h, y) {
|
|
8
8
|
const { show: o, ifShow: c } = h;
|
|
9
9
|
let p = !0, f = !0;
|
|
10
10
|
return typeof o == "boolean" ? p = o : typeof o == "function" && (p = o({
|
|
@@ -62,7 +62,7 @@ function Et({
|
|
|
62
62
|
formElRef: f,
|
|
63
63
|
schemaRef: F,
|
|
64
64
|
handleFormValues: B,
|
|
65
|
-
initValues:
|
|
65
|
+
initValues: T
|
|
66
66
|
}) {
|
|
67
67
|
async function Y(t) {
|
|
68
68
|
const { resetFunc: e, submitOnReset: s } = n(y);
|
|
@@ -192,7 +192,7 @@ function Et({
|
|
|
192
192
|
const s = B(x(n(o)));
|
|
193
193
|
if (t)
|
|
194
194
|
return s;
|
|
195
|
-
const r = n(c).filter((l) =>
|
|
195
|
+
const r = n(c).filter((l) => _(l, n(o))).map((l) => l.field).filter(Boolean), a = {};
|
|
196
196
|
return r.forEach((l) => {
|
|
197
197
|
l in s && (a[l] = s[l]);
|
|
198
198
|
}), a;
|
|
@@ -204,19 +204,17 @@ function Et({
|
|
|
204
204
|
return n(c).some((e) => e.field === t ? ut(e.type) : !1);
|
|
205
205
|
}
|
|
206
206
|
async function $(t) {
|
|
207
|
-
return t || (t = n(c).filter((s) =>
|
|
207
|
+
return t || (t = n(c).filter((s) => _(s, n(o))).map((s) => s.field).filter(Boolean)), n(f)?.validateField(t);
|
|
208
208
|
}
|
|
209
209
|
async function P(t) {
|
|
210
|
-
return t || (t = n(c).filter((s) =>
|
|
210
|
+
return t || (t = n(c).filter((s) => _(s, n(o))).map((s) => s.field).filter(Boolean)), await n(f)?.validate(t, () => {
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
async function D(t) {
|
|
214
214
|
await n(f)?.clearValidate(t);
|
|
215
215
|
}
|
|
216
216
|
async function tt(t, e) {
|
|
217
|
-
await D(t),
|
|
218
|
-
await N([{ field: t, itemProps: { error: e } }]);
|
|
219
|
-
});
|
|
217
|
+
await D(t), await N([{ field: t, itemProps: { error: e } }]);
|
|
220
218
|
}
|
|
221
219
|
async function et(t, e) {
|
|
222
220
|
await n(f)?.scrollToField(t, e);
|
|
@@ -235,7 +233,7 @@ function Et({
|
|
|
235
233
|
return;
|
|
236
234
|
const u = g();
|
|
237
235
|
if (s) {
|
|
238
|
-
const b = ct(
|
|
236
|
+
const b = ct(T.value, u), C = rt(T.value, u);
|
|
239
237
|
h("submit", u, !b, C);
|
|
240
238
|
} else
|
|
241
239
|
h("submit", u);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../../form/index.js";
|
|
2
2
|
import { tryOnBeforeUnmount as l } from "@vueuse/core";
|
|
3
|
-
import { ref as
|
|
4
|
-
function d(
|
|
3
|
+
import { ref as m, unref as o, watch as u, nextTick as f } from "vue";
|
|
4
|
+
function d(s) {
|
|
5
5
|
const r = {};
|
|
6
|
-
return Object.keys(
|
|
7
|
-
r[
|
|
6
|
+
return Object.keys(s).map((i) => {
|
|
7
|
+
r[i] = o(s[i]);
|
|
8
8
|
}), r;
|
|
9
9
|
}
|
|
10
|
-
function v(
|
|
11
|
-
const r =
|
|
10
|
+
function v(s) {
|
|
11
|
+
const r = m(null), i = m(!1);
|
|
12
12
|
async function a() {
|
|
13
13
|
const e = o(r);
|
|
14
14
|
return e || console.error(
|
|
@@ -17,11 +17,11 @@ function v(n) {
|
|
|
17
17
|
}
|
|
18
18
|
function c(e) {
|
|
19
19
|
l(() => {
|
|
20
|
-
r.value = null,
|
|
21
|
-
}), !(o(
|
|
22
|
-
() =>
|
|
20
|
+
r.value = null, i.value = null;
|
|
21
|
+
}), !(o(i) && e === o(r)) && (r.value = e, i.value = !0, u(
|
|
22
|
+
() => s,
|
|
23
23
|
() => {
|
|
24
|
-
|
|
24
|
+
s && e && e.setProps(d(s));
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
immediate: !0,
|
|
@@ -43,7 +43,8 @@ function v(n) {
|
|
|
43
43
|
(await a()).updateSchema(e);
|
|
44
44
|
},
|
|
45
45
|
setFormItemError: async (e, t) => {
|
|
46
|
-
|
|
46
|
+
const n = await a();
|
|
47
|
+
await n.clearValidate(e), await n.updateSchema([{ field: e, itemProps: { error: t } }]);
|
|
47
48
|
},
|
|
48
49
|
resetSchema: async (e) => {
|
|
49
50
|
const t = await a();
|
|
@@ -67,8 +68,8 @@ function v(n) {
|
|
|
67
68
|
setFieldsValue: async (e, t = !0) => {
|
|
68
69
|
(await a()).setFieldsValue(e, t);
|
|
69
70
|
},
|
|
70
|
-
appendSchemaByField: async (e, t,
|
|
71
|
-
await (await a()).appendSchemaByField(e, t,
|
|
71
|
+
appendSchemaByField: async (e, t, n) => {
|
|
72
|
+
await (await a()).appendSchemaByField(e, t, n);
|
|
72
73
|
},
|
|
73
74
|
submit: async () => (await a()).submit(),
|
|
74
75
|
validate: async (e, t = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UploadProps } from './types';
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
file?(_: {
|
|
4
|
-
file: import("
|
|
4
|
+
file: import("./types").UploadFile;
|
|
5
5
|
}): any;
|
|
6
6
|
trigger?(_: {}): any;
|
|
7
7
|
default?(_: {}): any;
|
|
@@ -18,22 +18,22 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
18
18
|
type: string;
|
|
19
19
|
autoUpload: boolean;
|
|
20
20
|
listType: string;
|
|
21
|
-
httpRequest: import("
|
|
21
|
+
httpRequest: import("./types").UploadRequestHandler;
|
|
22
22
|
fileList: never[];
|
|
23
23
|
replaceOnLimit: boolean;
|
|
24
24
|
maxSize: undefined;
|
|
25
25
|
sizeExceedMessage: string;
|
|
26
26
|
onExceed: () => void;
|
|
27
27
|
}>>, {
|
|
28
|
-
abort: (file: import("
|
|
28
|
+
abort: (file: import("./types").UploadFile) => void;
|
|
29
29
|
submit: () => void;
|
|
30
|
-
clearFiles: (states?: import("
|
|
31
|
-
handleStart: (rawFile: import("
|
|
32
|
-
handleRemove: (file: import("
|
|
30
|
+
clearFiles: (states?: import("./types").UploadStatus[]) => void;
|
|
31
|
+
handleStart: (rawFile: import("./types").UploadRawFile) => void;
|
|
32
|
+
handleRemove: (file: import("./types").UploadFile | import("./types").UploadRawFile, rawFile?: import("./types").UploadRawFile) => void;
|
|
33
33
|
fileList: import("vue").Ref<{
|
|
34
34
|
name: string;
|
|
35
35
|
percentage?: number | undefined;
|
|
36
|
-
status: import("
|
|
36
|
+
status: import("./types").UploadStatus;
|
|
37
37
|
size?: number | undefined;
|
|
38
38
|
response?: unknown;
|
|
39
39
|
uid: number;
|
|
@@ -54,7 +54,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
54
54
|
}[], {
|
|
55
55
|
name: string;
|
|
56
56
|
percentage?: number | undefined;
|
|
57
|
-
status: import("
|
|
57
|
+
status: import("./types").UploadStatus;
|
|
58
58
|
size?: number | undefined;
|
|
59
59
|
response?: unknown;
|
|
60
60
|
uid: number;
|
|
@@ -84,7 +84,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
84
84
|
type: string;
|
|
85
85
|
autoUpload: boolean;
|
|
86
86
|
listType: string;
|
|
87
|
-
httpRequest: import("
|
|
87
|
+
httpRequest: import("./types").UploadRequestHandler;
|
|
88
88
|
fileList: never[];
|
|
89
89
|
replaceOnLimit: boolean;
|
|
90
90
|
maxSize: undefined;
|
|
@@ -97,16 +97,16 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
97
97
|
method: string;
|
|
98
98
|
multiple: boolean;
|
|
99
99
|
action: string;
|
|
100
|
-
fileList: import("
|
|
100
|
+
fileList: import("./types").UploadUserFile[];
|
|
101
101
|
showFileList: boolean;
|
|
102
102
|
accept: string;
|
|
103
103
|
autoUpload: boolean;
|
|
104
|
-
listType: import("
|
|
105
|
-
httpRequest: import("
|
|
104
|
+
listType: import("./types").ListType;
|
|
105
|
+
httpRequest: import("./types").UploadRequestHandler;
|
|
106
106
|
replaceOnLimit: boolean;
|
|
107
107
|
maxSize: number;
|
|
108
108
|
sizeExceedMessage: string;
|
|
109
|
-
onExceed: import("
|
|
109
|
+
onExceed: import("./types").UploadHooks["onExceed"];
|
|
110
110
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
111
111
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
112
112
|
export default _default;
|
|
@@ -1,112 +1,6 @@
|
|
|
1
|
-
import { defineComponent as E, useSlots as T, shallowRef as V, computed as b, onBeforeUnmount as j, provide as N, toRef as O, createElementBlock as q, openBlock as
|
|
2
|
-
import "../alert/index.js";
|
|
3
|
-
import "../avatar/index.js";
|
|
4
|
-
import "../avatar-stack/index.js";
|
|
5
|
-
import "../backtop/index.js";
|
|
6
|
-
import "../button/index.js";
|
|
7
|
-
import "../card/index.js";
|
|
8
|
-
import "../cascader/index.js";
|
|
9
|
-
import "../cascader-panel/index.js";
|
|
10
|
-
import "../check-tag/index.js";
|
|
11
|
-
import "../checkbox/index.js";
|
|
12
|
-
import "../clamp/index.js";
|
|
13
|
-
import "../clamp-toggle/index.js";
|
|
14
|
-
import "../clamp-tooltip/index.js";
|
|
15
|
-
import "../col/index.js";
|
|
16
|
-
import "../collapse-transition/index.js";
|
|
17
|
-
import "../color-picker/index.js";
|
|
18
|
-
import "../config-provider/index.js";
|
|
19
|
-
import "../container/index.js";
|
|
20
|
-
import "@vft/utils";
|
|
21
|
-
import "../context-menu/context-menu.vue2.js";
|
|
22
|
-
import "../icon/index.js";
|
|
23
|
-
import "../date-picker/index.js";
|
|
24
|
-
import "../date-time-select/index.js";
|
|
25
|
-
import "../descriptions/index.js";
|
|
26
|
-
import "../dialog/index.js";
|
|
27
|
-
import "../divider/index.js";
|
|
28
|
-
import "../drawer/index.js";
|
|
29
|
-
import "../dropdown/index.js";
|
|
30
|
-
import "../empty/index.js";
|
|
31
|
-
import "../footer-layout/index.js";
|
|
32
|
-
import "../form/index.js";
|
|
33
|
-
import "../full-screen/index.js";
|
|
34
|
-
import "../header-layout/index.js";
|
|
35
|
-
import "../horizontal-menu/index.js";
|
|
36
|
-
import "../icon-text/index.js";
|
|
37
|
-
import "../iframe-layout/index.js";
|
|
38
|
-
import "../image/index.js";
|
|
39
|
-
import "../image-viewer/index.js";
|
|
40
|
-
import "../input/index.js";
|
|
41
|
-
import "../input-number/index.js";
|
|
42
|
-
import "../link/index.js";
|
|
43
|
-
import "../list-cell/index.js";
|
|
44
|
-
import "../logo/index.js";
|
|
45
|
-
import "../menu/index.js";
|
|
46
|
-
import "../multiple-tabs/index.js";
|
|
47
|
-
import "../notification/index.js";
|
|
48
|
-
import "../overlay/index.js";
|
|
49
|
-
import "../page-wrapper/index.js";
|
|
50
|
-
import "../pagination/index.js";
|
|
51
|
-
import "../popconfirm/index.js";
|
|
52
|
-
import "../popover/index.js";
|
|
53
|
-
import "../popper/index.js";
|
|
54
|
-
import "../qrcode/index.js";
|
|
55
|
-
import "../radio/index.js";
|
|
56
|
-
import "../result/index.js";
|
|
57
|
-
import "../router-view-content/index.js";
|
|
58
|
-
import "../row/index.js";
|
|
59
|
-
import "../scrollbar/index.js";
|
|
60
|
-
import "../search/index.js";
|
|
61
|
-
import "../select/index.js";
|
|
62
|
-
import "../side-menu/index.js";
|
|
63
|
-
import "../skeleton/index.js";
|
|
64
|
-
import "../slider/index.js";
|
|
65
|
-
import "../space/index.js";
|
|
66
|
-
import "../steps/index.js";
|
|
67
|
-
import "../switch/index.js";
|
|
68
|
-
import "../table/index.js";
|
|
69
|
-
import "../tabs/index.js";
|
|
70
|
-
import "../tag/index.js";
|
|
71
|
-
import "../time-picker/index.js";
|
|
72
|
-
import "../tooltip/index.js";
|
|
73
|
-
import "../tree/index.js";
|
|
74
|
-
import "../verify-code/index.js";
|
|
75
|
-
import "../virtual-list/components/fixed-size-list.js";
|
|
76
|
-
import "../virtual-list/components/dynamic-size-list.js";
|
|
77
|
-
import "../virtual-list/components/fixed-size-grid.js";
|
|
78
|
-
import "../virtual-list/components/dynamic-size-grid.js";
|
|
79
|
-
import "../virtual-list/props.js";
|
|
80
|
-
import "../autocomplete/index.js";
|
|
81
|
-
import "../breadcrumb/index.js";
|
|
82
|
-
import "../carousel/index.js";
|
|
83
|
-
import "../collapse/index.js";
|
|
84
|
-
import "../countdown/index.js";
|
|
85
|
-
import "../input-tag/index.js";
|
|
86
|
-
import "../modal/index.js";
|
|
87
|
-
import "../progress/index.js";
|
|
88
|
-
import "../segmented/index.js";
|
|
89
|
-
import "../statistic/index.js";
|
|
90
|
-
import "../super-form/index.js";
|
|
91
|
-
import "../timeline/index.js";
|
|
92
|
-
import "../transfer/index.js";
|
|
93
|
-
import "./index.js";
|
|
94
|
-
import "../watermark/index.js";
|
|
95
|
-
import "../md-code-demo/index.js";
|
|
96
|
-
import "../md-code-tabs/index.js";
|
|
97
|
-
import "../md-comment/index.js";
|
|
98
|
-
import "../md-container/index.js";
|
|
99
|
-
import "../md-tabs/index.js";
|
|
100
|
-
import "../md-vue-playground/index.js";
|
|
101
|
-
import "../infinite-scroll/index.js";
|
|
102
|
-
import "@vueuse/core";
|
|
103
|
-
import "../config-provider/hooks/use-global-config.js";
|
|
104
|
-
import "lodash-es";
|
|
105
|
-
import "../../hooks/use-model-toggle/index.js";
|
|
106
|
-
import "@popperjs/core";
|
|
107
|
-
import "../../hooks/use-z-index/index.js";
|
|
1
|
+
import { defineComponent as E, useSlots as T, shallowRef as V, computed as b, onBeforeUnmount as j, provide as N, toRef as O, createElementBlock as q, openBlock as m, normalizeClass as D, unref as o, createBlock as v, createCommentVNode as t, renderSlot as l, createSlots as B, withCtx as n, createVNode as H, mergeProps as S } from "vue";
|
|
108
2
|
import { VftMessage as I } from "../message/index.js";
|
|
109
|
-
import "../
|
|
3
|
+
import "../form/index.js";
|
|
110
4
|
import { ajaxUpload as K } from "./ajax.js";
|
|
111
5
|
import { uploadContextKey as W } from "./constants.js";
|
|
112
6
|
import $ from "./upload-content.vue2.js";
|
|
@@ -115,7 +9,7 @@ import { useHandlers as A } from "./use-handlers.js";
|
|
|
115
9
|
import { useFormDisabled as G } from "../form/hooks/use-form-common-props.js";
|
|
116
10
|
const J = E({
|
|
117
11
|
name: "vft-upload"
|
|
118
|
-
}),
|
|
12
|
+
}), le = /* @__PURE__ */ E({
|
|
119
13
|
...J,
|
|
120
14
|
props: {
|
|
121
15
|
action: { default: "#" },
|
|
@@ -151,74 +45,74 @@ const J = E({
|
|
|
151
45
|
onSizeExceed: {}
|
|
152
46
|
},
|
|
153
47
|
setup(F, { expose: L }) {
|
|
154
|
-
const
|
|
48
|
+
const a = F, s = T(), c = G(), d = V(), {
|
|
155
49
|
abort: y,
|
|
156
50
|
submit: g,
|
|
157
51
|
clearFiles: h,
|
|
158
|
-
uploadFiles:
|
|
52
|
+
uploadFiles: r,
|
|
159
53
|
handleStart: w,
|
|
160
54
|
handleError: P,
|
|
161
|
-
handleRemove:
|
|
55
|
+
handleRemove: f,
|
|
162
56
|
handleSuccess: z,
|
|
163
57
|
handleProgress: M
|
|
164
|
-
} = A(
|
|
58
|
+
} = A(a, d), u = b(() => a.listType === "picture-card"), U = {
|
|
165
59
|
abort: y,
|
|
166
60
|
submit: g,
|
|
167
61
|
clearFiles: h,
|
|
168
|
-
uploadFiles:
|
|
169
|
-
uploadRef:
|
|
62
|
+
uploadFiles: r,
|
|
63
|
+
uploadRef: d
|
|
170
64
|
}, k = b(() => ({
|
|
171
|
-
...
|
|
172
|
-
fileList:
|
|
65
|
+
...a,
|
|
66
|
+
fileList: r.value,
|
|
173
67
|
onStart: w,
|
|
174
68
|
onProgress: M,
|
|
175
69
|
onSuccess: z,
|
|
176
70
|
onError: P,
|
|
177
|
-
onRemove:
|
|
178
|
-
onChange: (e,
|
|
179
|
-
|
|
71
|
+
onRemove: f,
|
|
72
|
+
onChange: (e, i) => {
|
|
73
|
+
a.onChange?.(e, i, U);
|
|
180
74
|
},
|
|
181
|
-
onSizeExceed: (e,
|
|
182
|
-
if (
|
|
183
|
-
|
|
75
|
+
onSizeExceed: (e, i) => {
|
|
76
|
+
if (a.onSizeExceed)
|
|
77
|
+
a.onSizeExceed?.(e, i);
|
|
184
78
|
else {
|
|
185
|
-
const R = `文件大小不能超过 ${(
|
|
79
|
+
const R = `文件大小不能超过 ${(i / 1048576).toFixed(2)}MB`;
|
|
186
80
|
console.warn("默认文件大小超出提示:", R), I.warning(R);
|
|
187
81
|
}
|
|
188
82
|
}
|
|
189
83
|
}));
|
|
190
84
|
return j(() => {
|
|
191
|
-
|
|
85
|
+
r.value.forEach(({ url: e }) => {
|
|
192
86
|
e?.startsWith("blob:") && URL.revokeObjectURL(e);
|
|
193
87
|
});
|
|
194
88
|
}), N(W, {
|
|
195
|
-
accept: O(
|
|
89
|
+
accept: O(a, "accept")
|
|
196
90
|
}), L({
|
|
197
91
|
abort: y,
|
|
198
92
|
submit: g,
|
|
199
93
|
clearFiles: h,
|
|
200
94
|
handleStart: w,
|
|
201
|
-
handleRemove:
|
|
202
|
-
fileList:
|
|
203
|
-
}), (e,
|
|
95
|
+
handleRemove: f,
|
|
96
|
+
fileList: r
|
|
97
|
+
}), (e, i) => (m(), q("div", {
|
|
204
98
|
class: D(["vft-upload-wrapper", { disabled: o(c) }])
|
|
205
99
|
}, [
|
|
206
|
-
|
|
100
|
+
u.value && e.showFileList ? (m(), v(C, {
|
|
207
101
|
key: 0,
|
|
208
102
|
disabled: o(c),
|
|
209
103
|
"list-type": e.listType,
|
|
210
|
-
files: o(
|
|
104
|
+
files: o(r),
|
|
211
105
|
"handle-preview": e.onPreview,
|
|
212
|
-
onRemove: o(
|
|
106
|
+
onRemove: o(f)
|
|
213
107
|
}, B({
|
|
214
|
-
append:
|
|
108
|
+
append: n(() => [
|
|
215
109
|
H($, S({
|
|
216
110
|
ref_key: "uploadRef",
|
|
217
|
-
ref:
|
|
111
|
+
ref: d
|
|
218
112
|
}, k.value), {
|
|
219
|
-
default:
|
|
220
|
-
o(
|
|
221
|
-
!o(
|
|
113
|
+
default: n(() => [
|
|
114
|
+
o(s).trigger ? l(e.$slots, "trigger", { key: 0 }) : t("", !0),
|
|
115
|
+
!o(s).trigger && o(s).default ? l(e.$slots, "default", { key: 1 }) : t("", !0)
|
|
222
116
|
]),
|
|
223
117
|
_: 3
|
|
224
118
|
}, 16)
|
|
@@ -227,37 +121,37 @@ const J = E({
|
|
|
227
121
|
}, [
|
|
228
122
|
e.$slots.file ? {
|
|
229
123
|
name: "default",
|
|
230
|
-
fn:
|
|
231
|
-
|
|
124
|
+
fn: n(({ file: p }) => [
|
|
125
|
+
l(e.$slots, "file", { file: p })
|
|
232
126
|
]),
|
|
233
127
|
key: "0"
|
|
234
128
|
} : void 0
|
|
235
129
|
]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : t("", !0),
|
|
236
|
-
!
|
|
130
|
+
!u.value || u.value && !e.showFileList ? (m(), v($, S({
|
|
237
131
|
key: 1,
|
|
238
132
|
ref_key: "uploadRef",
|
|
239
|
-
ref:
|
|
133
|
+
ref: d
|
|
240
134
|
}, k.value), {
|
|
241
|
-
default:
|
|
242
|
-
o(
|
|
243
|
-
!o(
|
|
135
|
+
default: n(() => [
|
|
136
|
+
o(s).trigger ? l(e.$slots, "trigger", { key: 0 }) : t("", !0),
|
|
137
|
+
!o(s).trigger && o(s).default ? l(e.$slots, "default", { key: 1 }) : t("", !0)
|
|
244
138
|
]),
|
|
245
139
|
_: 3
|
|
246
140
|
}, 16)) : t("", !0),
|
|
247
|
-
e.$slots.trigger ?
|
|
248
|
-
|
|
249
|
-
!
|
|
141
|
+
e.$slots.trigger ? l(e.$slots, "default", { key: 2 }) : t("", !0),
|
|
142
|
+
l(e.$slots, "tip"),
|
|
143
|
+
!u.value && e.showFileList ? (m(), v(C, {
|
|
250
144
|
key: 3,
|
|
251
145
|
disabled: o(c),
|
|
252
146
|
"list-type": e.listType,
|
|
253
|
-
files: o(
|
|
147
|
+
files: o(r),
|
|
254
148
|
"handle-preview": e.onPreview,
|
|
255
|
-
onRemove: o(
|
|
149
|
+
onRemove: o(f)
|
|
256
150
|
}, B({ _: 2 }, [
|
|
257
151
|
e.$slots.file ? {
|
|
258
152
|
name: "default",
|
|
259
|
-
fn:
|
|
260
|
-
|
|
153
|
+
fn: n(({ file: p }) => [
|
|
154
|
+
l(e.$slots, "file", { file: p })
|
|
261
155
|
]),
|
|
262
156
|
key: "0"
|
|
263
157
|
} : void 0
|
|
@@ -266,5 +160,5 @@ const J = E({
|
|
|
266
160
|
}
|
|
267
161
|
});
|
|
268
162
|
export {
|
|
269
|
-
|
|
163
|
+
le as default
|
|
270
164
|
};
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
package/es/utils/vue/vnode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasOwn as m, camelize as N, isArray as E } from "@vft/utils";
|
|
2
2
|
import { isVNode as o, Fragment as S, Comment as A, Text as s, createCommentVNode as L, createBlock as _, openBlock as C } from "vue";
|
|
3
3
|
import { debugWarn as O } from "../error.js";
|
|
4
4
|
const R = "utils/vue/vnode";
|
|
@@ -1 +1 @@
|
|
|
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
|
+
"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-item.cjs"),oe=require("../form/hooks/use-form-common-props.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}=te.useFormItem(),{inputId:F}=te.useFormItemInputId(se.props,{formItemContext:C}),ie=oe.useFormSize(),m=oe.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";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("../icon/index.cjs");require("@vueuse/core");require("@vft/utils");require("../config-provider/hooks/use-global-config.cjs");require("lodash-es");const d=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const l=require("@vue/repl"),v=require("./playground.cjs"),p=e.defineComponent({name:"vft-md-vue-playground"}),f=e.defineComponent({...p,props:{title:{},files:{},settings:{}},setup(t){const s=d.useNamespace("md-vue-playground"),a=e.ref(!0),u=e.shallowRef(),r=e.ref(),o=e.computed(()=>v.getVuePlaygroundSettings(t.settings)),n=e.ref(o.value.showCode||!1),i=async()=>{u.value=l.Repl,r.value=new l.ReplStore({serializedState:decodeURIComponent(t.files),showOutput:!0}),o.value.vueVersion&&await r.value.setVueVersion(o.value.vueVersion)};return e.onMounted(async()=>{await i(),a.value=!1}),()=>e.createVNode("div",{class:s.b()},[e.createVNode("div",{class:"title-wrapper"},[t.title?e.createVNode("div",{class:"title"},[decodeURIComponent(t.title)]):null,e.createVNode(c.VftIcon,{cursor:!0,icon:n.value?"icon-collapse-alt":"icon-expand-alt",size:20,onClick:()=>{n.value=!n.value}},null)]),e.createVNode("div",{class:["repl-container",n.value?"show-code":"hide-code"]},[u.value?e.h(u.value,{store:r.value,...o.value}):null])])}});exports.default=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@vft/utils"),U=require("@vft/utils/date"),b=require("lodash-es"),i=require("vue"),V=require("../component-map.cjs"),L=require("./helper.cjs");function C(p,F){const{show:l,ifShow:o}=p;let y=!0,c=!0;return typeof l=="boolean"?y=l:typeof l=="function"&&(y=l({field:p.field,model:F,values:{...F},schema:p})),typeof o=="boolean"?c=o:typeof o=="function"&&(c=o({field:p.field,model:F,values:{...F},schema:p})),y&&c}function K(p,F={}){const l=/^\[(.+)\]$/;if(l.test(p)){const o=p.match(l);if(o&&o[1]){const y=o[1].split(",");if(!y.length)return;const c=[];return y.forEach((v,g)=>{b.set(c,g,F[v.trim()])}),c.filter(Boolean).length?c:void 0}}}function R(p,F={}){const l=/^\{(.+)\}$/;if(l.test(p)){const o=p.match(l);if(o&&o[1]){const y=o[1].split(",");if(!y.length)return;const c={};return y.forEach(v=>{b.set(c,v.trim(),F[v.trim()])}),Object.values(c).filter(Boolean).length?c:void 0}}}function k({emit:p,getProps:F,formModel:l,getSchema:o,defaultValueRef:y,formElRef:c,schemaRef:v,handleFormValues:g,initValues:S}){async function $(e){const{resetFunc:n,submitOnReset:s}=i.unref(F);n&&a.isFunction(n)&&await n();const r=i.unref(c);if(r){if(e?.length)return r.resetFields(e);Object.keys(l).forEach(f=>{const u=i.unref(o).find(d=>d.field===f),t=b.cloneDeep(y.value[f]);l[f]=V.isInput(u?.type)?t||"":t}),i.nextTick(()=>O()),p("reset",i.toRaw(l)),s&&await _()}}async function m(e,n=!0){const s=i.unref(o).map(t=>t.field).filter(Boolean),r=".",f=s.filter(t=>String(t).indexOf(r)>=0),u=[];s.forEach(t=>{const d=i.unref(o).find(h=>h.field===t);let E=b.get(e,t);const B=Reflect.has(e,t);E=L.handleInputNumberValue(d?.type,E);const{componentProps:N}=d||{};let w=N;typeof N=="function"&&(w=w({formModel:i.unref(l)}));const P=K(t,e)||R(t,e);if(B||P){const h=P||E;if(W(t))if(Array.isArray(h)){const D=[];for(const I of h)D.push(I?U.formatToDate(I):null);i.unref(l)[t]=D}else i.unref(l)[t]=h?w?.valueFormat?h:U.formatToDate(h):null;else i.unref(l)[t]=h;w?.onChange&&w?.onChange(h),u.push(t)}else f.forEach(h=>{try{const D=h.split(".").reduce((I,Z)=>I[Z],e);a.isDef(D)&&(i.unref(l)[h]=i.unref(D),u.push(h))}catch{a.isDef(y.value[h])&&(i.unref(l)[h]=b.cloneDeep(i.unref(y.value[h])))}})}),n&&i.nextTick(async()=>{await
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@vft/utils"),U=require("@vft/utils/date"),b=require("lodash-es"),i=require("vue"),V=require("../component-map.cjs"),L=require("./helper.cjs");function C(p,F){const{show:l,ifShow:o}=p;let y=!0,c=!0;return typeof l=="boolean"?y=l:typeof l=="function"&&(y=l({field:p.field,model:F,values:{...F},schema:p})),typeof o=="boolean"?c=o:typeof o=="function"&&(c=o({field:p.field,model:F,values:{...F},schema:p})),y&&c}function K(p,F={}){const l=/^\[(.+)\]$/;if(l.test(p)){const o=p.match(l);if(o&&o[1]){const y=o[1].split(",");if(!y.length)return;const c=[];return y.forEach((v,g)=>{b.set(c,g,F[v.trim()])}),c.filter(Boolean).length?c:void 0}}}function R(p,F={}){const l=/^\{(.+)\}$/;if(l.test(p)){const o=p.match(l);if(o&&o[1]){const y=o[1].split(",");if(!y.length)return;const c={};return y.forEach(v=>{b.set(c,v.trim(),F[v.trim()])}),Object.values(c).filter(Boolean).length?c:void 0}}}function k({emit:p,getProps:F,formModel:l,getSchema:o,defaultValueRef:y,formElRef:c,schemaRef:v,handleFormValues:g,initValues:S}){async function $(e){const{resetFunc:n,submitOnReset:s}=i.unref(F);n&&a.isFunction(n)&&await n();const r=i.unref(c);if(r){if(e?.length)return r.resetFields(e);Object.keys(l).forEach(f=>{const u=i.unref(o).find(d=>d.field===f),t=b.cloneDeep(y.value[f]);l[f]=V.isInput(u?.type)?t||"":t}),i.nextTick(()=>O()),p("reset",i.toRaw(l)),s&&await _()}}async function m(e,n=!0){const s=i.unref(o).map(t=>t.field).filter(Boolean),r=".",f=s.filter(t=>String(t).indexOf(r)>=0),u=[];s.forEach(t=>{const d=i.unref(o).find(h=>h.field===t);let E=b.get(e,t);const B=Reflect.has(e,t);E=L.handleInputNumberValue(d?.type,E);const{componentProps:N}=d||{};let w=N;typeof N=="function"&&(w=w({formModel:i.unref(l)}));const P=K(t,e)||R(t,e);if(B||P){const h=P||E;if(W(t))if(Array.isArray(h)){const D=[];for(const I of h)D.push(I?U.formatToDate(I):null);i.unref(l)[t]=D}else i.unref(l)[t]=h?w?.valueFormat?h:U.formatToDate(h):null;else i.unref(l)[t]=h;w?.onChange&&w?.onChange(h),u.push(t)}else f.forEach(h=>{try{const D=h.split(".").reduce((I,Z)=>I[Z],e);a.isDef(D)&&(i.unref(l)[h]=i.unref(D),u.push(h))}catch{a.isDef(y.value[h])&&(i.unref(l)[h]=b.cloneDeep(i.unref(y.value[h])))}})}),n&&i.nextTick(async()=>{await T(u).catch(t=>{})})}async function z(e){const n=b.cloneDeep(i.unref(o));if(!e)return;let s=a.isString(e)?[e]:e;a.isString(e)&&(s=[e]);for(const r of s)G(r,n);v.value=n}function G(e,n){if(a.isString(e)){const s=n.findIndex(r=>r.field===e);s!==-1&&(delete l[e],n.splice(s,1))}}async function H(e,n,s=!1){const r=b.cloneDeep(i.unref(o)),f=r.findIndex(t=>t.field===n),u=a.isObject(e)?[e]:e;if(!n||f===-1||s){s?r.unshift(...u):r.push(...u),v.value=r,j(e);return}f!==-1&&r.splice(f+1,0,...u),j(e),v.value=r}async function J(e){let n=[];if(a.isObject(e)&&n.push(e),a.isArray(e)&&(n=[...e]),!n.every(r=>r.type===V.FormCompEnum.DIVIDER||Reflect.has(r,"field")&&r.field)){console.error("All children of the form Schema array that need to be updated must contain the `field` field");return}v.value=n}async function q(e){let n=[];if(a.isObject(e)&&n.push(e),a.isArray(e)&&(n=[...e]),!n.every(u=>u.type===V.FormCompEnum.DIVIDER||Reflect.has(u,"field")&&u.field)){console.error("All children of the form Schema array that need to be updated must contain the `field` field");return}const r=[],f=[];i.unref(o).forEach(u=>{let t;if(n.forEach(d=>{u.field===d.field&&(t=d),d.defaultValue&&d.field&&r.push(d.field)}),t!==void 0&&u.field===t.field){const d=a.deepMerge(u,t);f.push(d)}else f.push(u)}),j(f,r),v.value=b.uniqBy(f,"field")}function j(e,n,s=!0){if(a.isArray(n)&&n?.length===0)return;let r=[];a.isObject(e)&&r.push(e),a.isArray(e)&&(r=[...e]);const f={},u=A();r.forEach(t=>{t.type!==V.FormCompEnum.DIVIDER&&Reflect.has(t,"field")&&t.field&&!a.isNullOrUndefined(t.defaultValue)&&(!(t.field in u)||a.isNullOrUndefined(u[t.field])||a.isEmpty(u[t.field]))&&(f[t.field]=t.defaultValue)}),a.isEmptyObject(f)||m(f,s)}function A(e=!1){if(!i.unref(c))return{};const s=g(i.toRaw(i.unref(l)));if(e)return s;const r=i.unref(o).filter(u=>C(u,i.unref(l))).map(u=>u.field).filter(Boolean),f={};return r.forEach(u=>{u in s&&(f[u]=s[u])}),f}function Q(e){return i.unref(c)?i.toRaw(i.unref(l))[e]:{}}function W(e){return i.unref(o).some(n=>n.field===e?V.isDatePicker(n.type):!1)}async function T(e){return e||(e=i.unref(o).filter(s=>C(s,i.unref(l))).map(s=>s.field).filter(Boolean)),i.unref(c)?.validateField(e)}async function x(e){return e||(e=i.unref(o).filter(s=>C(s,i.unref(l))).map(s=>s.field).filter(Boolean)),await i.unref(c)?.validate(e,()=>{})}async function O(e){await i.unref(c)?.clearValidate(e)}async function X(e,n){await O(e),await q([{field:e,itemProps:{error:n}}])}async function Y(e,n){await i.unref(c)?.scrollToField(e,n)}async function _(e){const{autoCleanErrorMessage:n,watchDataIsChange:s}=i.unref(F);e&&e.preventDefault(),n&&await O();const{submitFunc:r,beforeSubmitFunc:f}=i.unref(F);if(f&&a.isFunction(f)&&await f(),r&&a.isFunction(r)){await r();return}if(i.unref(c))try{if(!await x())return;const d=A();if(s){const E=b.isEqual(S.value,d),B=a.findDifferentValuesForObj(S.value,d);p("submit",d,!E,B)}else p("submit",d)}catch(t){if(t?.outOfDate===!1&&t?.errorFields)return;throw new Error(t.message)}}return{handleSubmit:_,clearValidate:O,validate:x,validateField:T,getFieldsValue:A,updateSchema:q,resetSchema:J,appendSchemaByField:H,removeSchemaByField:z,resetFields:$,setFieldsValue:m,scrollToField:Y,getFieldValue:Q,setFormItemError:X}}exports.useFormEvents=k;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../form/index.cjs");const u=require("@vueuse/core"),a=require("vue");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../form/index.cjs");const u=require("@vueuse/core"),a=require("vue");function c(s){const o={};return Object.keys(s).map(i=>{o[i]=a.unref(s[i])}),o}function l(s){const o=a.ref(null),i=a.ref(!1);async function r(){const e=a.unref(o);return e||console.error("The form instance has not been obtained, please make sure that the form has been rendered when performing the form operation!"),await a.nextTick(),e}function m(e){u.tryOnBeforeUnmount(()=>{o.value=null,i.value=null}),!(a.unref(i)&&e===a.unref(o))&&(o.value=e,i.value=!0,a.watch(()=>s,()=>{s&&e&&e.setProps(c(s))},{immediate:!0,deep:!0}))}return[m,{scrollToField:async(e,t)=>{(await r()).scrollToField(e,t)},setProps:async e=>{(await r()).setProps(e)},setSubmitLoading:async(e=!0)=>{(await r()).setProps({submitButtonOptions:{loading:e}})},updateSchema:async e=>{(await r()).updateSchema(e)},setFormItemError:async(e,t)=>{const n=await r();await n.clearValidate(e),await n.updateSchema([{field:e,itemProps:{error:t}}])},resetSchema:async e=>{const t=await r();t.resetSchema(e).then(()=>{setTimeout(()=>{t.clearValidate()},0)})},clearValidate:async e=>{(await r()).clearValidate(e)},resetFields:async e=>{a.unref(o)?.resetFields(e)},removeSchemaByField:async e=>{a.unref(o)?.removeSchemaByField(e)},getFieldValue:e=>a.unref(o)?.getFieldValue(e),getFieldsValue:()=>a.unref(o)?.getFieldsValue(),setFieldsValue:async(e,t=!0)=>{(await r()).setFieldsValue(e,t)},appendSchemaByField:async(e,t,n)=>{await(await r()).appendSchemaByField(e,t,n)},submit:async()=>(await r()).submit(),validate:async(e,t=()=>{})=>(await r()).validate(e,t),validateField:async e=>(await r()).validateField(e)}]}exports.getDynamicProps=c;exports.useForm=l;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UploadProps } from './types';
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
file?(_: {
|
|
4
|
-
file: import("
|
|
4
|
+
file: import("./types").UploadFile;
|
|
5
5
|
}): any;
|
|
6
6
|
trigger?(_: {}): any;
|
|
7
7
|
default?(_: {}): any;
|
|
@@ -18,22 +18,22 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
18
18
|
type: string;
|
|
19
19
|
autoUpload: boolean;
|
|
20
20
|
listType: string;
|
|
21
|
-
httpRequest: import("
|
|
21
|
+
httpRequest: import("./types").UploadRequestHandler;
|
|
22
22
|
fileList: never[];
|
|
23
23
|
replaceOnLimit: boolean;
|
|
24
24
|
maxSize: undefined;
|
|
25
25
|
sizeExceedMessage: string;
|
|
26
26
|
onExceed: () => void;
|
|
27
27
|
}>>, {
|
|
28
|
-
abort: (file: import("
|
|
28
|
+
abort: (file: import("./types").UploadFile) => void;
|
|
29
29
|
submit: () => void;
|
|
30
|
-
clearFiles: (states?: import("
|
|
31
|
-
handleStart: (rawFile: import("
|
|
32
|
-
handleRemove: (file: import("
|
|
30
|
+
clearFiles: (states?: import("./types").UploadStatus[]) => void;
|
|
31
|
+
handleStart: (rawFile: import("./types").UploadRawFile) => void;
|
|
32
|
+
handleRemove: (file: import("./types").UploadFile | import("./types").UploadRawFile, rawFile?: import("./types").UploadRawFile) => void;
|
|
33
33
|
fileList: import("vue").Ref<{
|
|
34
34
|
name: string;
|
|
35
35
|
percentage?: number | undefined;
|
|
36
|
-
status: import("
|
|
36
|
+
status: import("./types").UploadStatus;
|
|
37
37
|
size?: number | undefined;
|
|
38
38
|
response?: unknown;
|
|
39
39
|
uid: number;
|
|
@@ -54,7 +54,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
54
54
|
}[], {
|
|
55
55
|
name: string;
|
|
56
56
|
percentage?: number | undefined;
|
|
57
|
-
status: import("
|
|
57
|
+
status: import("./types").UploadStatus;
|
|
58
58
|
size?: number | undefined;
|
|
59
59
|
response?: unknown;
|
|
60
60
|
uid: number;
|
|
@@ -84,7 +84,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
84
84
|
type: string;
|
|
85
85
|
autoUpload: boolean;
|
|
86
86
|
listType: string;
|
|
87
|
-
httpRequest: import("
|
|
87
|
+
httpRequest: import("./types").UploadRequestHandler;
|
|
88
88
|
fileList: never[];
|
|
89
89
|
replaceOnLimit: boolean;
|
|
90
90
|
maxSize: undefined;
|
|
@@ -97,16 +97,16 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
97
97
|
method: string;
|
|
98
98
|
multiple: boolean;
|
|
99
99
|
action: string;
|
|
100
|
-
fileList: import("
|
|
100
|
+
fileList: import("./types").UploadUserFile[];
|
|
101
101
|
showFileList: boolean;
|
|
102
102
|
accept: string;
|
|
103
103
|
autoUpload: boolean;
|
|
104
|
-
listType: import("
|
|
105
|
-
httpRequest: import("
|
|
104
|
+
listType: import("./types").ListType;
|
|
105
|
+
httpRequest: import("./types").UploadRequestHandler;
|
|
106
106
|
replaceOnLimit: boolean;
|
|
107
107
|
maxSize: number;
|
|
108
108
|
sizeExceedMessage: string;
|
|
109
|
-
onExceed: import("
|
|
109
|
+
onExceed: import("./types").UploadHooks["onExceed"];
|
|
110
110
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
111
111
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
112
112
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue")
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),R=require("../message/index.cjs");require("../form/index.cjs");const P=require("./ajax.cjs"),_=require("./constants.cjs"),g=require("./upload-content.vue2.cjs"),h=require("./upload-list.vue2.cjs"),$=require("./use-handlers.cjs"),E=require("../form/hooks/use-form-common-props.cjs"),F=e.defineComponent({name:"vft-upload"}),L=e.defineComponent({...F,props:{action:{default:"#"},headers:{},method:{default:"post"},data:{},multiple:{type:Boolean,default:!1},name:{default:"file"},drag:{type:Boolean,default:!1},withCredentials:{type:Boolean},showFileList:{type:Boolean,default:!0},accept:{default:""},type:{default:"select"},fileList:{default:[]},autoUpload:{type:Boolean,default:!1},listType:{default:"text"},httpRequest:{type:Function,default:P.ajaxUpload},disabled:{type:Boolean},limit:{},replaceOnLimit:{type:Boolean,default:!1},maxSize:{default:void 0},sizeExceedMessage:{default:"文件大小超出限制"},beforeUpload:{},beforeRemove:{},onRemove:{},onChange:{},onPreview:{},onSuccess:{},onProgress:{},onError:{},onExceed:{type:Function,default:()=>{}},onSizeExceed:{}},setup(C,{expose:S}){const o=C,l=e.useSlots(),i=E.useFormDisabled(),s=e.shallowRef(),{abort:f,submit:p,clearFiles:c,uploadFiles:r,handleStart:m,handleError:k,handleRemove:n,handleSuccess:w,handleProgress:B}=$.useHandlers(o,s),u=e.computed(()=>o.listType==="picture-card"),b={abort:f,submit:p,clearFiles:c,uploadFiles:r,uploadRef:s},v=e.computed(()=>({...o,fileList:r.value,onStart:m,onProgress:B,onSuccess:w,onError:k,onRemove:n,onChange:(t,a)=>{o.onChange?.(t,a,b)},onSizeExceed:(t,a)=>{if(o.onSizeExceed)o.onSizeExceed?.(t,a);else{const y=`文件大小不能超过 ${(a/1048576).toFixed(2)}MB`;console.warn("默认文件大小超出提示:",y),R.VftMessage.warning(y)}}}));return e.onBeforeUnmount(()=>{r.value.forEach(({url:t})=>{t?.startsWith("blob:")&&URL.revokeObjectURL(t)})}),e.provide(_.uploadContextKey,{accept:e.toRef(o,"accept")}),S({abort:f,submit:p,clearFiles:c,handleStart:m,handleRemove:n,fileList:r}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vft-upload-wrapper",{disabled:e.unref(i)}])},[u.value&&t.showFileList?(e.openBlock(),e.createBlock(h.default,{key:0,disabled:e.unref(i),"list-type":t.listType,files:e.unref(r),"handle-preview":t.onPreview,onRemove:e.unref(n)},e.createSlots({append:e.withCtx(()=>[e.createVNode(g.default,e.mergeProps({ref_key:"uploadRef",ref:s},v.value),{default:e.withCtx(()=>[e.unref(l).trigger?e.renderSlot(t.$slots,"trigger",{key:0}):e.createCommentVNode("",!0),!e.unref(l).trigger&&e.unref(l).default?e.renderSlot(t.$slots,"default",{key:1}):e.createCommentVNode("",!0)]),_:3},16)]),_:2},[t.$slots.file?{name:"default",fn:e.withCtx(({file:d})=>[e.renderSlot(t.$slots,"file",{file:d})]),key:"0"}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):e.createCommentVNode("",!0),!u.value||u.value&&!t.showFileList?(e.openBlock(),e.createBlock(g.default,e.mergeProps({key:1,ref_key:"uploadRef",ref:s},v.value),{default:e.withCtx(()=>[e.unref(l).trigger?e.renderSlot(t.$slots,"trigger",{key:0}):e.createCommentVNode("",!0),!e.unref(l).trigger&&e.unref(l).default?e.renderSlot(t.$slots,"default",{key:1}):e.createCommentVNode("",!0)]),_:3},16)):e.createCommentVNode("",!0),t.$slots.trigger?e.renderSlot(t.$slots,"default",{key:2}):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"tip"),!u.value&&t.showFileList?(e.openBlock(),e.createBlock(h.default,{key:3,disabled:e.unref(i),"list-type":t.listType,files:e.unref(r),"handle-preview":t.onPreview,onRemove:e.unref(n)},e.createSlots({_:2},[t.$slots.file?{name:"default",fn:e.withCtx(({file:d})=>[e.renderSlot(t.$slots,"file",{file:d})]),key:"0"}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):e.createCommentVNode("",!0)],2))}});exports.default=L;
|
package/lib/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.362";exports.version=e;
|
package/lib/package.json.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.362",
|
|
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/router": "0.0.65",
|
|
59
|
-
"@vft/use": "0.0.76",
|
|
60
58
|
"@vft/constants": "0.0.72",
|
|
61
59
|
"@vft/store": "0.0.54",
|
|
62
|
-
"@vft/
|
|
63
|
-
"@vft/directives": "0.0.33"
|
|
60
|
+
"@vft/router": "0.0.65",
|
|
61
|
+
"@vft/directives": "0.0.33",
|
|
62
|
+
"@vft/use": "0.0.77",
|
|
63
|
+
"@vft/utils": "0.0.131"
|
|
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.
|
|
1
|
+
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.362","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}
|