vft 0.0.296 → 0.0.299
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/form/form.vue2.js +31 -33
- package/es/components/md-container/md-container.vue2.js +13 -12
- package/es/components/super-form/super-form-item.vue2.js +190 -188
- package/es/components/super-form/use/helper.js +23 -20
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/form/form.vue2.cjs +1 -1
- package/lib/components/md-container/md-container.vue2.cjs +1 -1
- package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +4 -4
- package/web-types.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as b, ref as x, reactive as y, computed as F, watch as
|
|
1
|
+
import { defineComponent as b, getCurrentInstance as q, ref as x, reactive as y, computed as F, watch as z, provide as T, toRefs as $, createElementBlock as j, openBlock as M, normalizeClass as W, renderSlot as A } from "vue";
|
|
2
2
|
import "@vueuse/core";
|
|
3
|
-
import { isFunction as
|
|
3
|
+
import { isFunction as K } from "@vft/utils";
|
|
4
4
|
import { debugWarn as n } from "../../utils/error.js";
|
|
5
5
|
import "../../utils/ns-cover.js";
|
|
6
6
|
import "lodash-es";
|
|
7
|
-
import { useNamespace as
|
|
7
|
+
import { useNamespace as L } 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 { formContextKey as
|
|
12
|
-
import { useFormSize as
|
|
13
|
-
import { useFormLabelWidth as
|
|
14
|
-
const
|
|
11
|
+
import { formContextKey as N } from "./constants.js";
|
|
12
|
+
import { useFormSize as D } from "./hooks/use-form-common-props.js";
|
|
13
|
+
import { useFormLabelWidth as G, filterFields as f } from "./utils.js";
|
|
14
|
+
const H = b({
|
|
15
15
|
name: "vft-form"
|
|
16
|
-
}),
|
|
17
|
-
...
|
|
16
|
+
}), ae = /* @__PURE__ */ b({
|
|
17
|
+
...H,
|
|
18
18
|
props: {
|
|
19
19
|
size: {},
|
|
20
20
|
disabled: { type: Boolean },
|
|
@@ -35,16 +35,16 @@ const G = b({
|
|
|
35
35
|
},
|
|
36
36
|
emits: ["validate"],
|
|
37
37
|
setup(o, { expose: w, emit: g }) {
|
|
38
|
-
const B = g, d = x(), l = y([]),
|
|
38
|
+
const B = g, V = q(), d = x(), l = y([]), I = D(), i = L("form"), C = F(() => [
|
|
39
39
|
i.b(),
|
|
40
|
-
i.m(
|
|
40
|
+
i.m(I.value || "default"),
|
|
41
41
|
{
|
|
42
42
|
[i.m(`label-${o.labelPosition}`)]: o.labelPosition,
|
|
43
43
|
[i.m("inline")]: o.inline
|
|
44
44
|
}
|
|
45
|
-
]), u = (e) => f(l, [e])[0],
|
|
45
|
+
]), u = (e) => f(l, [e])[0], E = (e) => {
|
|
46
46
|
l.push(e);
|
|
47
|
-
},
|
|
47
|
+
}, O = (e) => {
|
|
48
48
|
e.prop && l.splice(l.indexOf(e), 1);
|
|
49
49
|
}, m = (e = []) => {
|
|
50
50
|
if (!o.model) {
|
|
@@ -54,16 +54,16 @@ const G = b({
|
|
|
54
54
|
f(l, e).forEach((t) => t.resetField());
|
|
55
55
|
}, p = (e = []) => {
|
|
56
56
|
f(l, e).forEach((t) => t.clearValidate());
|
|
57
|
-
},
|
|
57
|
+
}, k = F(() => {
|
|
58
58
|
const e = !!o.model;
|
|
59
59
|
return e || n(i.b(), "model is required for validate to work."), e;
|
|
60
|
-
}),
|
|
60
|
+
}), P = (e) => {
|
|
61
61
|
if (l.length === 0) return [];
|
|
62
62
|
const t = f(l, e);
|
|
63
63
|
return t.length ? t : (n(i.b(), "please pass correct props!"), []);
|
|
64
|
-
}, h = async (e) => c(void 0, e),
|
|
65
|
-
if (!
|
|
66
|
-
const t =
|
|
64
|
+
}, h = async (e) => c(void 0, e), R = async (e = []) => {
|
|
65
|
+
if (!k.value) return !1;
|
|
66
|
+
const t = P(e);
|
|
67
67
|
if (t.length === 0) return !0;
|
|
68
68
|
let r = {};
|
|
69
69
|
for (const s of t)
|
|
@@ -78,9 +78,9 @@ const G = b({
|
|
|
78
78
|
return Object.keys(r).length === 0 ? !0 : Promise.reject(r);
|
|
79
79
|
}, c = async (e = [], t) => {
|
|
80
80
|
let r = !1;
|
|
81
|
-
const s = !
|
|
81
|
+
const s = !K(t);
|
|
82
82
|
try {
|
|
83
|
-
return r = await
|
|
83
|
+
return r = await R(e), r === !0 && await t?.(r), o.model;
|
|
84
84
|
} catch (a) {
|
|
85
85
|
if (a instanceof Error) throw a;
|
|
86
86
|
const v = a;
|
|
@@ -92,26 +92,24 @@ const G = b({
|
|
|
92
92
|
const t = u(e);
|
|
93
93
|
t && t.$el?.scrollIntoView(o.scrollIntoViewOptions);
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
return z(
|
|
96
96
|
() => o.rules,
|
|
97
97
|
() => {
|
|
98
98
|
o.validateOnRuleChange && h().catch((e) => n(e));
|
|
99
99
|
},
|
|
100
100
|
{ deep: !0, flush: "post" }
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
return T(
|
|
104
|
-
L,
|
|
101
|
+
), T(
|
|
102
|
+
N,
|
|
105
103
|
y({
|
|
106
|
-
|
|
104
|
+
...$(V.props),
|
|
107
105
|
emit: B,
|
|
108
106
|
resetFields: m,
|
|
109
107
|
clearValidate: p,
|
|
110
108
|
validateField: c,
|
|
111
109
|
getField: u,
|
|
112
|
-
addField:
|
|
113
|
-
removeField:
|
|
114
|
-
...
|
|
110
|
+
addField: E,
|
|
111
|
+
removeField: O,
|
|
112
|
+
...G()
|
|
115
113
|
})
|
|
116
114
|
), w({
|
|
117
115
|
/**
|
|
@@ -134,15 +132,15 @@ const G = b({
|
|
|
134
132
|
* @description Scroll to the specified fields.
|
|
135
133
|
*/
|
|
136
134
|
scrollToField: S
|
|
137
|
-
}), (e, t) => (
|
|
135
|
+
}), (e, t) => (M(), j("form", {
|
|
138
136
|
ref_key: "formRef",
|
|
139
137
|
ref: d,
|
|
140
|
-
class:
|
|
138
|
+
class: W(C.value)
|
|
141
139
|
}, [
|
|
142
|
-
|
|
140
|
+
A(e.$slots, "default")
|
|
143
141
|
], 2));
|
|
144
142
|
}
|
|
145
143
|
});
|
|
146
144
|
export {
|
|
147
|
-
|
|
145
|
+
ae as default
|
|
148
146
|
};
|
|
@@ -4,15 +4,16 @@ import { VftIconText as R } from "../icon-text/index.js";
|
|
|
4
4
|
import { VftTag as $ } from "../tag/index.js";
|
|
5
5
|
import { VftMdComment as B } from "../md-comment/index.js";
|
|
6
6
|
import "@vueuse/core";
|
|
7
|
-
import { jumpElement as H, getRandomElementForArr as M,
|
|
8
|
-
import { primaryColor as
|
|
7
|
+
import { jumpElement as H, getRandomElementForArr as M, isClient as q } from "@vft/utils";
|
|
8
|
+
import { primaryColor as F } from "../../utils/ns-cover.js";
|
|
9
9
|
import "lodash-es";
|
|
10
|
-
import { useNamespace as
|
|
10
|
+
import { useNamespace as J } from "../../hooks/use-namespace/index.js";
|
|
11
11
|
import "../../hooks/use-model-toggle/index.js";
|
|
12
12
|
import "@popperjs/core";
|
|
13
13
|
import "../../hooks/use-z-index/index.js";
|
|
14
|
-
import { useRouterHelper as
|
|
15
|
-
import { usePhotoSwipe as
|
|
14
|
+
import { useRouterHelper as O } from "@vft/router";
|
|
15
|
+
import { usePhotoSwipe as j, useEventListener as U } from "@vft/use";
|
|
16
|
+
import { formatToDateTime as Y, getDayTimestamp as G } from "@vft/utils/date";
|
|
16
17
|
import K from "./toc.js";
|
|
17
18
|
import { useCopyCode as Q } from "./use/useCopyCode.js";
|
|
18
19
|
import { useActiveHeaderLinks as W } from "./use/useActiveHeaderLinks.js";
|
|
@@ -25,13 +26,13 @@ const Z = { class: "info-container" }, tt = {
|
|
|
25
26
|
title: "阅读量"
|
|
26
27
|
}, it = ["data-path"], nt = _({
|
|
27
28
|
name: "vft-md-container"
|
|
28
|
-
}),
|
|
29
|
+
}), wt = /* @__PURE__ */ _({
|
|
29
30
|
...nt,
|
|
30
31
|
props: {
|
|
31
32
|
tocList: {}
|
|
32
33
|
},
|
|
33
34
|
setup(m) {
|
|
34
|
-
const a =
|
|
35
|
+
const a = J("md-container"), C = D(), u = f(() => m.tocList && m.tocList !== "undefined" ? JSON.parse(m.tocList) : ""), { initPhotoSwipe: x } = j(`.${a.e("content")} img`);
|
|
35
36
|
x(), W({}), Q();
|
|
36
37
|
const p = C.appContext.config.globalProperties.$router, o = p.currentRoute.value;
|
|
37
38
|
S(() => {
|
|
@@ -43,12 +44,12 @@ const Z = { class: "info-container" }, tt = {
|
|
|
43
44
|
"div.language-vue"
|
|
44
45
|
);
|
|
45
46
|
for (let e = 0; e < r.length; e++)
|
|
46
|
-
|
|
47
|
+
U(r[e], "click", () => {
|
|
47
48
|
i[e].offsetHeight === 0 ? (i[e].style.height = "auto", i[e].style.visibility = "visible") : (i[e].style.height = "0px", i[e].style.visibility = "hidden");
|
|
48
49
|
});
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
|
-
const k =
|
|
52
|
+
const k = F(), T = q ? location.pathname : "", { go: V } = O(p);
|
|
52
53
|
function b(r) {
|
|
53
54
|
V("/?classify=" + r);
|
|
54
55
|
}
|
|
@@ -94,8 +95,8 @@ const Z = { class: "info-container" }, tt = {
|
|
|
94
95
|
size: 12,
|
|
95
96
|
class: "mr-10px",
|
|
96
97
|
distance: 5,
|
|
97
|
-
text: t(
|
|
98
|
-
(t(o).meta?.date ? new Date(t(o).meta.date).getTime() : (/* @__PURE__ */ new Date()).getTime()) - t(
|
|
98
|
+
text: t(Y)(
|
|
99
|
+
(t(o).meta?.date ? new Date(t(o).meta.date).getTime() : (/* @__PURE__ */ new Date()).getTime()) - t(G)()
|
|
99
100
|
)
|
|
100
101
|
}, null, 8, ["text"]),
|
|
101
102
|
n("div", ot, [
|
|
@@ -130,5 +131,5 @@ const Z = { class: "info-container" }, tt = {
|
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
133
|
export {
|
|
133
|
-
|
|
134
|
+
wt as default
|
|
134
135
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as z, computed as
|
|
1
|
+
import { defineComponent as z, computed as L, unref as u, useSlots as Z, createVNode as m, mergeProps as k, withDirectives as _, vShow as ee, isVNode as te, createTextVNode as F } from "vue";
|
|
2
2
|
import { VftCol as H } from "../col/index.js";
|
|
3
|
-
import { VftDivider as
|
|
4
|
-
import { VftFormItem as
|
|
3
|
+
import { VftDivider as re } from "../divider/index.js";
|
|
4
|
+
import { VftFormItem as ne } from "../form/index.js";
|
|
5
5
|
import "@vueuse/core";
|
|
6
|
-
import { isFunction as
|
|
6
|
+
import { isFunction as g, isBoolean as q, cloneDeep as oe, isArray as G, isNull as le, upperFirst as se, isString as ie } from "@vft/utils";
|
|
7
7
|
import "../../utils/ns-cover.js";
|
|
8
8
|
import "lodash-es";
|
|
9
|
-
import { useNamespace as
|
|
9
|
+
import { useNamespace as ae } 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
|
|
14
|
-
import { createPlaceholderMessage as
|
|
15
|
-
function j(
|
|
16
|
-
return typeof
|
|
13
|
+
import { FormCompEnum as t, componentMap as J, isInput as ce, isDatePicker as ue, isRangePicker as fe } from "./component-map.js";
|
|
14
|
+
import { createPlaceholderMessage as X } from "./use/helper.js";
|
|
15
|
+
function j(r) {
|
|
16
|
+
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !te(r);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const me = z({
|
|
19
19
|
inheritAttrs: !1
|
|
20
|
-
}),
|
|
21
|
-
...
|
|
20
|
+
}), xe = /* @__PURE__ */ z({
|
|
21
|
+
...me,
|
|
22
22
|
__name: "super-form-item",
|
|
23
23
|
props: {
|
|
24
24
|
schema: {},
|
|
@@ -29,92 +29,92 @@ const fe = z({
|
|
|
29
29
|
updateSchema: {},
|
|
30
30
|
formActionType: {}
|
|
31
31
|
},
|
|
32
|
-
setup(
|
|
33
|
-
const
|
|
32
|
+
setup(r) {
|
|
33
|
+
const N = ae("super-form"), p = L(() => {
|
|
34
34
|
const {
|
|
35
35
|
mergeDynamicData: e
|
|
36
|
-
} =
|
|
36
|
+
} = r.formProps;
|
|
37
37
|
return {
|
|
38
|
-
field:
|
|
39
|
-
model:
|
|
38
|
+
field: r.schema.field,
|
|
39
|
+
model: r.formModel,
|
|
40
40
|
values: {
|
|
41
41
|
...e,
|
|
42
|
-
...
|
|
43
|
-
...
|
|
42
|
+
...r.allDefaultValues,
|
|
43
|
+
...r.formModel
|
|
44
44
|
},
|
|
45
|
-
schema:
|
|
45
|
+
schema: r.schema
|
|
46
46
|
};
|
|
47
|
-
}),
|
|
47
|
+
}), K = L(() => {
|
|
48
48
|
let {
|
|
49
49
|
componentProps: e = {}
|
|
50
|
-
} =
|
|
51
|
-
|
|
52
|
-
schema:
|
|
53
|
-
formModel:
|
|
54
|
-
formActionType:
|
|
50
|
+
} = r.schema;
|
|
51
|
+
g(e) && (e = e({
|
|
52
|
+
schema: r.schema,
|
|
53
|
+
formModel: r.formModel,
|
|
54
|
+
formActionType: r.formActionType
|
|
55
55
|
}) ?? {});
|
|
56
|
-
const
|
|
56
|
+
const n = /* @__PURE__ */ new Map([[t.DIVIDER, {
|
|
57
57
|
type: "horizontal"
|
|
58
|
-
}], [
|
|
58
|
+
}], [t.TEXTAREA, {
|
|
59
59
|
type: "textarea"
|
|
60
|
-
}], [
|
|
60
|
+
}], [t.PASSWORD, {
|
|
61
61
|
type: "password",
|
|
62
62
|
"show-password": !0
|
|
63
|
-
}], [
|
|
63
|
+
}], [t.INPUT_NUMBER, {
|
|
64
64
|
type: "number"
|
|
65
|
-
}], [
|
|
65
|
+
}], [t.CHECKBOX_BUTTON, {
|
|
66
66
|
useButton: !0
|
|
67
|
-
}], [
|
|
67
|
+
}], [t.RADIO_BUTTON, {
|
|
68
68
|
useButton: !0
|
|
69
|
-
}], [
|
|
70
|
-
type:
|
|
71
|
-
}], [
|
|
72
|
-
type:
|
|
73
|
-
}], [
|
|
74
|
-
type:
|
|
75
|
-
}], [
|
|
76
|
-
type:
|
|
77
|
-
}], [
|
|
78
|
-
type:
|
|
79
|
-
}], [
|
|
80
|
-
type:
|
|
81
|
-
}], [
|
|
82
|
-
type:
|
|
69
|
+
}], [t.YEAR_PICKER, {
|
|
70
|
+
type: t.YEAR_PICKER
|
|
71
|
+
}], [t.MONTH_PICKER, {
|
|
72
|
+
type: t.MONTH_PICKER
|
|
73
|
+
}], [t.DATE_PICKER, {
|
|
74
|
+
type: t.DATE_PICKER
|
|
75
|
+
}], [t.DATES_PICKER, {
|
|
76
|
+
type: t.DATES_PICKER
|
|
77
|
+
}], [t.DATETIME_PICKER, {
|
|
78
|
+
type: t.DATETIME_PICKER
|
|
79
|
+
}], [t.WEEK_PICKER, {
|
|
80
|
+
type: t.WEEK_PICKER
|
|
81
|
+
}], [t.TIMERANGE_PICKER, {
|
|
82
|
+
type: t.TIME_PICKER,
|
|
83
83
|
"is-range": !0,
|
|
84
84
|
"start-placeholder": "开始时间",
|
|
85
85
|
"end-placeholder": "结束时间"
|
|
86
|
-
}], [
|
|
87
|
-
type:
|
|
86
|
+
}], [t.DATETIMERANGE_PICKER, {
|
|
87
|
+
type: t.DATETIMERANGE_PICKER,
|
|
88
88
|
"start-placeholder": "开始日期",
|
|
89
89
|
"end-placeholder": "结束日期"
|
|
90
|
-
}], [
|
|
91
|
-
type:
|
|
90
|
+
}], [t.DATERANGE_PICKER, {
|
|
91
|
+
type: t.DATERANGE_PICKER,
|
|
92
92
|
"start-placeholder": "开始日期",
|
|
93
93
|
"end-placeholder": "结束日期"
|
|
94
|
-
}], [
|
|
95
|
-
type:
|
|
94
|
+
}], [t.MONTHRANGE_PICKER, {
|
|
95
|
+
type: t.MONTHRANGE_PICKER,
|
|
96
96
|
"start-placeholder": "开始月份",
|
|
97
97
|
"end-placeholder": "结束月份"
|
|
98
98
|
}]]);
|
|
99
|
-
return
|
|
100
|
-
}), W =
|
|
99
|
+
return n.has(r.schema.type) && (e = Object.assign(n.get(r.schema.type) || {}, e)), r.formProps.inputMaxLength && [t.INPUT].includes(r.schema.type) && !e?.maxlength && (e.maxlength = r.formProps.inputMaxLength), e;
|
|
100
|
+
}), W = L(() => {
|
|
101
101
|
const {
|
|
102
102
|
disabled: e
|
|
103
|
-
} =
|
|
104
|
-
dynamicDisabled:
|
|
105
|
-
} =
|
|
103
|
+
} = r.formProps, {
|
|
104
|
+
dynamicDisabled: n
|
|
105
|
+
} = r.schema, {
|
|
106
106
|
disabled: a = !1
|
|
107
|
-
} = u(
|
|
107
|
+
} = u(K);
|
|
108
108
|
let i = !!e || a;
|
|
109
|
-
return
|
|
109
|
+
return q(n) && (i = n), g(n) && (i = n(u(p))), i;
|
|
110
110
|
});
|
|
111
111
|
function v() {
|
|
112
112
|
const {
|
|
113
113
|
show: e,
|
|
114
|
-
ifShow:
|
|
115
|
-
} =
|
|
114
|
+
ifShow: n
|
|
115
|
+
} = r.schema;
|
|
116
116
|
let a = !0, i = !0;
|
|
117
|
-
return
|
|
117
|
+
return q(e) && (a = e), q(n) && (i = n), g(e) && (a = e(u(p))), g(n) && (i = n(u(p))), {
|
|
118
118
|
isShow: a,
|
|
119
119
|
isIfShow: i
|
|
120
120
|
};
|
|
@@ -122,223 +122,225 @@ const fe = z({
|
|
|
122
122
|
function $() {
|
|
123
123
|
const {
|
|
124
124
|
rules: e = [],
|
|
125
|
-
type:
|
|
125
|
+
type: n = t.INPUT,
|
|
126
126
|
rulesMessageJoinLabel: a,
|
|
127
127
|
label: i,
|
|
128
128
|
title: h,
|
|
129
129
|
dynamicRule: c,
|
|
130
130
|
required: R,
|
|
131
|
-
dynamicRuleAdd:
|
|
132
|
-
} =
|
|
133
|
-
if (
|
|
134
|
-
return c(u(
|
|
135
|
-
let
|
|
131
|
+
dynamicRuleAdd: I = !0
|
|
132
|
+
} = r.schema, E = i || h;
|
|
133
|
+
if (g(c) && !I)
|
|
134
|
+
return c(u(p));
|
|
135
|
+
let o = oe(G(e) ? e : [e]);
|
|
136
136
|
const {
|
|
137
|
-
rulesMessageJoinLabel:
|
|
138
|
-
} =
|
|
139
|
-
function
|
|
140
|
-
const
|
|
141
|
-
return s === void 0 ||
|
|
137
|
+
rulesMessageJoinLabel: C
|
|
138
|
+
} = r.formProps, A = Reflect.has(r.schema, "rulesMessageJoinLabel") ? a : C, T = X(n, `${A ? E : ""}`);
|
|
139
|
+
function M(l, s) {
|
|
140
|
+
const S = l.message || T;
|
|
141
|
+
return s === void 0 || le(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(S) : Promise.resolve();
|
|
142
142
|
}
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
required:
|
|
146
|
-
validator:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
const f = g(R) ? R(u(p)) : R, b = [t.RADIO, t.SELECT, t.RADIO, t.RADIO_SINGLE, t.RADIO_BUTTON, t.CHECKBOX, t.CHECKBOX_SINGLE, t.CHECKBOX_BUTTON].includes(n);
|
|
144
|
+
f && (!o || o.length === 0 ? o = [{
|
|
145
|
+
required: f,
|
|
146
|
+
validator: M,
|
|
147
|
+
trigger: b ? "change" : "blur"
|
|
148
|
+
}] : o.findIndex((s) => Reflect.has(s, "required")) === -1 && o.unshift({
|
|
149
|
+
required: f,
|
|
150
|
+
validator: M,
|
|
151
|
+
trigger: b ? "change" : "blur"
|
|
150
152
|
}));
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
153
|
+
const x = o.findIndex((l) => Reflect.has(l, "required") && !Reflect.has(l, "validator"));
|
|
154
|
+
if (x !== -1) {
|
|
155
|
+
const l = o[x], {
|
|
154
156
|
isShow: s
|
|
155
157
|
} = v();
|
|
156
|
-
s || (
|
|
158
|
+
s || (l.required = !1), n && (l.message = l.message || T);
|
|
157
159
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
return ["min", "all"].includes(
|
|
160
|
+
const d = o.findIndex((l) => l.min), P = o.findIndex((l) => l.max);
|
|
161
|
+
function y(l, s, S = "all") {
|
|
162
|
+
const O = o[s], U = O.isNumber ? isNaN(l) ? l?.length || 0 : Number(l) : l?.length || 0;
|
|
163
|
+
return ["min", "all"].includes(S) && U < O.min ? Promise.reject(E + "至少为" + O.min + "位") : ["max", "all"].includes(S) && U > O.max ? Promise.reject(E + "最多" + O.max + "位") : Promise.resolve();
|
|
162
164
|
}
|
|
163
|
-
(
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
166
|
-
let
|
|
167
|
-
|
|
165
|
+
(d !== -1 || P !== -1) && (d !== -1 && P !== -1 && !o[d].validator && !o[d].message ? o[d].validator = (l, s) => y(s, d) : d !== -1 && !o[d].validator && !o[d].message ? o[d].validator = (l, s) => y(s, d, "min") : P !== -1 && !o[P].validator && !o[P].message && (o[P].validator = (l, s) => y(s, P, "max")));
|
|
166
|
+
const D = o.findIndex((l) => l.len);
|
|
167
|
+
if (D !== -1 && (o[D].validator = (l, s) => s.length !== o[D].len ? Promise.reject(E + "必须是" + o[D].len + "位") : Promise.resolve()), g(c) && I) {
|
|
168
|
+
let l = c(u(p));
|
|
169
|
+
l = G(l) ? l : [l], o = o.concat(l);
|
|
168
170
|
}
|
|
169
|
-
return
|
|
171
|
+
return o;
|
|
170
172
|
}
|
|
171
|
-
const
|
|
173
|
+
const Y = () => {
|
|
172
174
|
const {
|
|
173
175
|
renderComponentContent: e,
|
|
174
|
-
type:
|
|
176
|
+
type: n = t.INPUT,
|
|
175
177
|
field: a,
|
|
176
178
|
changeEvent: i = "change",
|
|
177
179
|
valueField: h,
|
|
178
180
|
label: c,
|
|
179
181
|
title: R,
|
|
180
|
-
placeholderJoinLabel:
|
|
181
|
-
} =
|
|
182
|
-
let
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
[
|
|
186
|
-
const [
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
182
|
+
placeholderJoinLabel: I = !0
|
|
183
|
+
} = r.schema;
|
|
184
|
+
let E = i;
|
|
185
|
+
ce(n) ? E = "input" : (ue(n) || n === t.TIME_PICKER) && (E = "update:modelValue");
|
|
186
|
+
const o = `on${se(E)}`, C = {
|
|
187
|
+
[o]: (...y) => {
|
|
188
|
+
const [D] = y;
|
|
189
|
+
f[o] && f[o](...y);
|
|
190
|
+
const l = D ? D.target : null, s = l ? l.value : D;
|
|
191
|
+
r.setFormModel(a, s, r.schema);
|
|
190
192
|
}
|
|
191
|
-
},
|
|
192
|
-
autoSetPlaceHolder:
|
|
193
|
-
size:
|
|
194
|
-
} =
|
|
193
|
+
}, A = J.get(n), {
|
|
194
|
+
autoSetPlaceHolder: T,
|
|
195
|
+
size: M
|
|
196
|
+
} = r.formProps, f = {
|
|
195
197
|
clearable: !0,
|
|
196
|
-
...u(
|
|
198
|
+
...u(K)
|
|
197
199
|
};
|
|
198
|
-
if ([
|
|
199
|
-
const
|
|
200
|
-
|
|
200
|
+
if ([t.SEARCH].includes(n) || (f.size = u(K)?.size || M, f.disabled = u(W)), !f.disabled && T && !fe(n) && n) {
|
|
201
|
+
const y = c || R;
|
|
202
|
+
f.placeholder = u(K)?.placeholder || X(n, I && ie(y) ? y : "");
|
|
201
203
|
}
|
|
202
|
-
const
|
|
203
|
-
[h || "model-value"]:
|
|
204
|
-
},
|
|
205
|
-
...
|
|
206
|
-
...
|
|
207
|
-
...
|
|
204
|
+
const x = {
|
|
205
|
+
[h || "model-value"]: r.formModel[a]
|
|
206
|
+
}, d = {
|
|
207
|
+
...C,
|
|
208
|
+
...f,
|
|
209
|
+
...x
|
|
208
210
|
};
|
|
209
211
|
if (!e)
|
|
210
|
-
return
|
|
211
|
-
const
|
|
212
|
-
...e(u(
|
|
212
|
+
return m(A, d, null);
|
|
213
|
+
const P = g(e) ? {
|
|
214
|
+
...e(u(p))
|
|
213
215
|
} : {
|
|
214
216
|
default: () => e
|
|
215
217
|
};
|
|
216
|
-
return
|
|
217
|
-
default: () => [
|
|
218
|
+
return m(A, d, j(P) ? P : {
|
|
219
|
+
default: () => [P]
|
|
218
220
|
});
|
|
219
221
|
};
|
|
220
222
|
function w() {
|
|
221
223
|
const {
|
|
222
224
|
showLabel: e = !0,
|
|
223
|
-
label:
|
|
225
|
+
label: n,
|
|
224
226
|
title: a,
|
|
225
227
|
subLabel: i,
|
|
226
228
|
labelRequired: h
|
|
227
|
-
} =
|
|
228
|
-
let c =
|
|
229
|
-
return c = h ?
|
|
229
|
+
} = r.schema;
|
|
230
|
+
let c = n || a;
|
|
231
|
+
return c = h ? m("span", null, [m("span", {
|
|
230
232
|
class: "label-required"
|
|
231
|
-
}, [
|
|
233
|
+
}, [F("*")]), m("span", null, [c])]) : c, e && c ? i ? m("span", null, [c, F(" "), m("span", {
|
|
232
234
|
class: "sub-label"
|
|
233
235
|
}, [i])]) : c : void 0;
|
|
234
236
|
}
|
|
235
|
-
const V =
|
|
236
|
-
function
|
|
237
|
-
if (!e || !Reflect.has(e,
|
|
237
|
+
const V = Z();
|
|
238
|
+
function B(e, n = "default", a) {
|
|
239
|
+
if (!e || !Reflect.has(e, n))
|
|
238
240
|
return null;
|
|
239
|
-
if (!
|
|
240
|
-
return console.error(`${
|
|
241
|
-
const i = e[
|
|
241
|
+
if (!g(e[n]))
|
|
242
|
+
return console.error(`${n} is not a function!`), null;
|
|
243
|
+
const i = e[n];
|
|
242
244
|
return i ? i(a) : null;
|
|
243
245
|
}
|
|
244
|
-
function
|
|
246
|
+
function Q() {
|
|
245
247
|
const {
|
|
246
248
|
itemProps: e,
|
|
247
|
-
slot:
|
|
249
|
+
slot: n,
|
|
248
250
|
render: a,
|
|
249
251
|
field: i,
|
|
250
252
|
suffix: h,
|
|
251
253
|
prefix: c,
|
|
252
254
|
prefixParentStyle: R
|
|
253
|
-
} =
|
|
254
|
-
autoCleanErrorMessage:
|
|
255
|
-
compFullWidth:
|
|
256
|
-
} =
|
|
257
|
-
|
|
255
|
+
} = r.schema, {
|
|
256
|
+
autoCleanErrorMessage: I,
|
|
257
|
+
compFullWidth: E
|
|
258
|
+
} = r.formProps, o = () => n ? B(V, n, u(p)) : a ? a(u(p)) : Y(), C = !!h, A = !!c, T = g(h) ? h(u(p)) : h, M = g(c) ? c(u(p)) : c, f = () => {
|
|
259
|
+
r.updateSchema([{
|
|
258
260
|
field: i,
|
|
259
261
|
itemProps: {
|
|
260
262
|
error: ""
|
|
261
263
|
}
|
|
262
264
|
}]);
|
|
263
|
-
},
|
|
265
|
+
}, b = () => m(ne, k({
|
|
264
266
|
style: {
|
|
265
|
-
marginRight:
|
|
267
|
+
marginRight: r.formProps.customLayout ? "10px" : 0
|
|
266
268
|
},
|
|
267
269
|
prop: i,
|
|
268
270
|
class: [{
|
|
269
|
-
[
|
|
271
|
+
[N.is("suffix")]: C
|
|
270
272
|
}, {
|
|
271
|
-
[
|
|
272
|
-
},
|
|
273
|
+
[N.is("comp-full-width")]: E
|
|
274
|
+
}, N.e("item")]
|
|
273
275
|
}, e, {
|
|
274
276
|
label: e?.label || e?.title,
|
|
275
|
-
"onUpdate:error":
|
|
277
|
+
"onUpdate:error": I ? f : () => {
|
|
276
278
|
},
|
|
277
279
|
rules: $()
|
|
278
280
|
}), {
|
|
279
|
-
default: () => [
|
|
280
|
-
class:
|
|
281
|
-
}, [
|
|
282
|
-
class:
|
|
283
|
-
}, [
|
|
284
|
-
class:
|
|
285
|
-
}, [
|
|
281
|
+
default: () => [m("div", {
|
|
282
|
+
class: N.e("container")
|
|
283
|
+
}, [m("div", {
|
|
284
|
+
class: N.e("content")
|
|
285
|
+
}, [o(), C && m("span", {
|
|
286
|
+
class: N.m("suffix")
|
|
287
|
+
}, [T])])])],
|
|
286
288
|
label: w() ? () => w() : void 0
|
|
287
289
|
});
|
|
288
|
-
return
|
|
290
|
+
return A ? m("div", {
|
|
289
291
|
style: R
|
|
290
|
-
}, [
|
|
291
|
-
class:
|
|
292
|
-
}, [
|
|
292
|
+
}, [m("span", {
|
|
293
|
+
class: N.m("prefix")
|
|
294
|
+
}, [M]), b()]) : b();
|
|
293
295
|
}
|
|
294
296
|
return () => {
|
|
295
297
|
let e;
|
|
296
298
|
const {
|
|
297
|
-
colProps:
|
|
299
|
+
colProps: n = {},
|
|
298
300
|
colSlot: a,
|
|
299
301
|
renderColContent: i,
|
|
300
|
-
type: h =
|
|
302
|
+
type: h = t.INPUT,
|
|
301
303
|
render: c,
|
|
302
304
|
quickColSpan: R
|
|
303
|
-
} =
|
|
304
|
-
if (!
|
|
305
|
+
} = r.schema;
|
|
306
|
+
if (!J.has(h) && !i && !c)
|
|
305
307
|
return null;
|
|
306
308
|
const {
|
|
307
|
-
baseColProps:
|
|
308
|
-
quickColSpan:
|
|
309
|
-
} =
|
|
310
|
-
span: Math.ceil(24 /
|
|
311
|
-
...
|
|
309
|
+
baseColProps: I = {},
|
|
310
|
+
quickColSpan: E
|
|
311
|
+
} = r.formProps, o = E ? {
|
|
312
|
+
span: Math.ceil(24 / E),
|
|
313
|
+
...I
|
|
312
314
|
} : {
|
|
313
|
-
...
|
|
314
|
-
},
|
|
315
|
+
...I
|
|
316
|
+
}, C = R ? {
|
|
315
317
|
span: Math.ceil(24 / R),
|
|
316
|
-
...
|
|
318
|
+
...n
|
|
317
319
|
} : {
|
|
318
|
-
...
|
|
319
|
-
},
|
|
320
|
-
...
|
|
321
|
-
...
|
|
320
|
+
...n
|
|
321
|
+
}, A = {
|
|
322
|
+
...o,
|
|
323
|
+
...C
|
|
322
324
|
}, {
|
|
323
|
-
isIfShow:
|
|
324
|
-
isShow:
|
|
325
|
-
} = v(),
|
|
326
|
-
if (h ===
|
|
327
|
-
let
|
|
328
|
-
return
|
|
325
|
+
isIfShow: T,
|
|
326
|
+
isShow: M
|
|
327
|
+
} = v(), f = u(p), b = () => a ? B(V, a, f) : i ? i(f) : Q();
|
|
328
|
+
if (h === t.DIVIDER) {
|
|
329
|
+
let x;
|
|
330
|
+
return m(H, k({
|
|
329
331
|
span: 24
|
|
330
|
-
},
|
|
331
|
-
default: () => [
|
|
332
|
-
default: () => [
|
|
332
|
+
}, C), {
|
|
333
|
+
default: () => [m(re, u(K), j(x = w()) ? x : {
|
|
334
|
+
default: () => [x]
|
|
333
335
|
})]
|
|
334
336
|
});
|
|
335
337
|
}
|
|
336
|
-
return
|
|
338
|
+
return T && (r.formProps.customLayout ? b() : _(m(H, A, j(e = b()) ? e : {
|
|
337
339
|
default: () => [e]
|
|
338
|
-
}), [[
|
|
340
|
+
}), [[ee, M]]));
|
|
339
341
|
};
|
|
340
342
|
}
|
|
341
343
|
});
|
|
342
344
|
export {
|
|
343
|
-
|
|
345
|
+
xe as default
|
|
344
346
|
};
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { isNumber as
|
|
2
|
-
import { FormCompEnum as
|
|
3
|
-
function
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
].includes(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { isNumber as n } from "@vft/utils";
|
|
2
|
+
import { FormCompEnum as E, isInput as u } from "../component-map.js";
|
|
3
|
+
function I(e, r = "") {
|
|
4
|
+
return r = (r || "").replace(":", ""), [
|
|
5
|
+
E.INPUT,
|
|
6
|
+
E.INPUT_NUMBER,
|
|
7
|
+
E.TEXTAREA
|
|
8
|
+
].includes(e) ? "请输入" + r : [E.PASSWORD].includes(e) ? "请输入密码" : [E.SELECT, E.RADIO].includes(e) ? "请选择" + r : [E.SEARCH].includes(e) ? "请输入要搜索的内容" : [
|
|
9
|
+
E.TIME_PICKER,
|
|
10
|
+
E.YEAR_PICKER,
|
|
11
|
+
E.MONTH_PICKER,
|
|
12
|
+
E.DATE_PICKER,
|
|
13
|
+
E.DATES_PICKER,
|
|
14
|
+
E.DATETIME_PICKER,
|
|
15
|
+
E.WEEK_PICKER,
|
|
16
|
+
E.DATETIMERANGE_PICKER,
|
|
17
|
+
E.DATERANGE_PICKER,
|
|
18
|
+
E.MONTHRANGE_PICKER
|
|
19
|
+
].includes(e) ? "请选择时间" : "";
|
|
17
20
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
21
|
+
function T(e, r) {
|
|
22
|
+
return e && u(e) && r && n(r) ? `${r}` : r;
|
|
20
23
|
}
|
|
21
24
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
I as createPlaceholderMessage,
|
|
26
|
+
T as handleInputNumberValue
|
|
24
27
|
};
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue");require("@vueuse/core");const E=require("@vft/utils"),d=require("../../utils/error.cjs");require("../../utils/ns-cover.cjs");require("lodash-es");const k=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue");require("@vueuse/core");const E=require("@vft/utils"),d=require("../../utils/error.cjs");require("../../utils/ns-cover.cjs");require("lodash-es");const k=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const R=require("./constants.cjs"),W=require("./hooks/use-form-common-props.cjs"),u=require("./utils.cjs"),x=r.defineComponent({name:"vft-form"}),M=r.defineComponent({...x,props:{size:{},disabled:{type:Boolean},model:{},rules:{},labelPosition:{default:"right"},requireAsteriskPosition:{default:"left"},labelWidth:{default:""},labelSuffix:{default:""},inline:{type:Boolean},inlineMessage:{type:Boolean},statusIcon:{type:Boolean},showMessage:{type:Boolean,default:!0},validateOnRuleChange:{type:Boolean,default:!0},hideRequiredAsterisk:{type:Boolean,default:!1},scrollToError:{type:Boolean},scrollIntoViewOptions:{type:Boolean,default:!0}},emits:["validate"],setup(o,{expose:y,emit:q}){const g=q,p=r.getCurrentInstance(),c=r.ref(),l=r.reactive([]),w=W.useFormSize(),s=k.useNamespace("form"),B=r.computed(()=>[s.b(),s.m(w.value||"default"),{[s.m(`label-${o.labelPosition}`)]:o.labelPosition,[s.m("inline")]:o.inline}]),m=e=>u.filterFields(l,[e])[0],V=e=>{l.push(e)},C=e=>{e.prop&&l.splice(l.indexOf(e),1)},h=(e=[])=>{if(!o.model){d.debugWarn(s.b(),"model is required for resetFields to work.");return}u.filterFields(l,e).forEach(t=>t.resetField())},v=(e=[])=>{u.filterFields(l,e).forEach(t=>t.clearValidate())},I=r.computed(()=>{const e=!!o.model;return e||d.debugWarn(s.b(),"model is required for validate to work."),e}),O=e=>{if(l.length===0)return[];const t=u.filterFields(l,e);return t.length?t:(d.debugWarn(s.b(),"please pass correct props!"),[])},F=async e=>f(void 0,e),P=async(e=[])=>{if(!I.value)return!1;const t=O(e);if(t.length===0)return!0;let i={};for(const n of t)try{await n.validate(""),n.validateState==="error"&&n.resetField()}catch(a){i={...i,...a}}return Object.keys(i).length===0?!0:Promise.reject(i)},f=async(e=[],t)=>{let i=!1;const n=!E.isFunction(t);try{return i=await P(e),i===!0&&await t?.(i),o.model}catch(a){if(a instanceof Error)throw a;const b=a;return o.scrollToError&&c.value&&c.value.querySelector(`.${s.b()}-item.is-error`)?.scrollIntoView(o.scrollIntoViewOptions),!i&&await t?.(!1,b),n&&Promise.reject(b)}},S=e=>{const t=m(e);t&&t.$el?.scrollIntoView(o.scrollIntoViewOptions)};return r.watch(()=>o.rules,()=>{o.validateOnRuleChange&&F().catch(e=>d.debugWarn(e))},{deep:!0,flush:"post"}),r.provide(R.formContextKey,r.reactive({...r.toRefs(p.props),emit:g,resetFields:h,clearValidate:v,validateField:f,getField:m,addField:V,removeField:C,...u.useFormLabelWidth()})),y({validate:F,validateField:f,resetFields:h,clearValidate:v,scrollToField:S}),(e,t)=>(r.openBlock(),r.createElementBlock("form",{ref_key:"formRef",ref:c,class:r.normalizeClass(B.value)},[r.renderSlot(e.$slots,"default")],2))}});exports.default=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../icon/index.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../icon/index.cjs"),V=require("../icon-text/index.cjs"),k=require("../tag/index.cjs"),_=require("../md-comment/index.cjs");require("@vueuse/core");const a=require("@vft/utils"),x=require("../../utils/ns-cover.cjs");require("lodash-es");const N=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const E=require("@vft/router"),d=require("@vft/use"),m=require("@vft/utils/date"),T=require("./toc.cjs"),b=require("./use/useCopyCode.cjs"),B=require("./use/useActiveHeaderLinks.cjs"),S=require("./utils.cjs"),L={class:"info-container"},$={key:0,class:"left"},w={class:"infos"},z={class:"reading",title:"阅读量"},D=["data-path"],A=e.defineComponent({name:"vft-md-container"}),P=e.defineComponent({...A,props:{tocList:{}},setup(s){const r=N.useNamespace("md-container"),f=e.getCurrentInstance(),c=e.computed(()=>s.tocList&&s.tocList!=="undefined"?JSON.parse(s.tocList):""),{initPhotoSwipe:p}=d.usePhotoSwipe(`.${r.e("content")} img`);p(),B.useActiveHeaderLinks({}),b.useCopyCode();const l=f.appContext.config.globalProperties.$router,n=l.currentRoute.value;e.onMounted(()=>{e.nextTick(()=>{setTimeout(()=>{a.jumpElement(encodeURI(n.hash))});const i=document.querySelectorAll(".item.expand"),o=document.querySelectorAll("div.language-vue");for(let t=0;t<i.length;t++)d.useEventListener(i[t],"click",()=>{o[t].offsetHeight===0?(o[t].style.height="auto",o[t].style.visibility="visible"):(o[t].style.height="0px",o[t].style.visibility="hidden")})})});const g=x.primaryColor(),y=a.isClient?location.pathname:"",{go:v}=E.useRouterHelper(l);function h(i){v("/?classify="+i)}const C=e.computed(()=>n.meta.category?.includes("api"));return(i,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(r).b(),e.unref(r).is("api",C.value)])},[c.value?(e.openBlock(),e.createBlock(e.unref(T.default),{key:0,items:c.value,route:e.unref(n)},null,8,["items","route"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(r).e("header"))},[e.createElementVNode("h1",{class:e.normalizeClass(e.unref(r).e("title"))},e.toDisplayString(e.unref(n).meta?.title),3),e.createElementVNode("div",L,[e.unref(n).meta?.category?.length?(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(u.VftIcon),{size:14,color:e.unref(g),icon:"icon-category"},null,8,["color"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n).meta?.category,(t,q)=>(e.openBlock(),e.createBlock(e.unref(k.VftTag),{size:"small",class:"tag",type:e.unref(a.getRandomElementForArr)(e.unref(S.COMP_TYPE),1)[0],key:q,onClick:I=>h(t)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t),1)]),_:2},1032,["type","onClick"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",w,[e.createVNode(e.unref(V.VftIconText),{title:"发布时间",icon:"icon-date",size:12,class:"mr-10px",distance:5,text:e.unref(m.formatToDateTime)((e.unref(n).meta?.date?new Date(e.unref(n).meta.date).getTime():new Date().getTime())-e.unref(m.getDayTimestamp)())},null,8,["text"]),e.createElementVNode("div",z,[e.createVNode(e.unref(u.VftIcon),{icon:"icon-reading",size:14,class:"mr-5px"}),e.createElementVNode("div",{class:"waline-pageview-count lh-1","data-path":e.unref(y)},"0",8,D)])])])],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(r).e("content"))},[e.renderSlot(i.$slots,"default")],2),e.createVNode(e.unref(_.VftMdComment)),o[0]||(o[0]=e.createElementVNode("ins",{class:"adsbygoogle",style:{display:"block","text-align":"center"},"data-ad-layout":"in-article","data-ad-format":"fluid","data-ad-client":"ca-pub-4046301015031382","data-ad-slot":"6525439078"},null,-1))],2))}});exports.default=P;
|
|
@@ -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"),v=require("../col/index.cjs"),G=require("../divider/index.cjs"),$=require("../form/index.cjs");require("@vueuse/core");const c=require("@vft/utils");require("../../utils/ns-cover.cjs");require("lodash-es");const J=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const t=require("./component-map.cjs"),j=require("./use/helper.cjs");function q(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!e.isVNode(r)}const X=e.defineComponent({inheritAttrs:!1}),z=e.defineComponent({...X,__name:"super-form-item",props:{schema:{},formProps:{},allDefaultValues:{},formModel:{},setFormModel:{},updateSchema:{},formActionType:{}},setup(r){const M=J.useNamespace("super-form"),C=e.computed(()=>{const{mergeDynamicData:n}=r.formProps;return{field:r.schema.field,model:r.formModel,values:{...n,...r.allDefaultValues,...r.formModel},schema:r.schema}}),S=e.computed(()=>{let{componentProps:n={}}=r.schema;c.isFunction(n)&&(n=n({schema:r.schema,formModel:r.formModel,formActionType:r.formActionType})??{});const o=new Map([[t.FormCompEnum.DIVIDER,{type:"horizontal"}],[t.FormCompEnum.TEXTAREA,{type:"textarea"}],[t.FormCompEnum.PASSWORD,{type:"password","show-password":!0}],[t.FormCompEnum.INPUT_NUMBER,{type:"number"}],[t.FormCompEnum.CHECKBOX_BUTTON,{useButton:!0}],[t.FormCompEnum.RADIO_BUTTON,{useButton:!0}],[t.FormCompEnum.YEAR_PICKER,{type:t.FormCompEnum.YEAR_PICKER}],[t.FormCompEnum.MONTH_PICKER,{type:t.FormCompEnum.MONTH_PICKER}],[t.FormCompEnum.DATE_PICKER,{type:t.FormCompEnum.DATE_PICKER}],[t.FormCompEnum.DATES_PICKER,{type:t.FormCompEnum.DATES_PICKER}],[t.FormCompEnum.DATETIME_PICKER,{type:t.FormCompEnum.DATETIME_PICKER}],[t.FormCompEnum.WEEK_PICKER,{type:t.FormCompEnum.WEEK_PICKER}],[t.FormCompEnum.TIMERANGE_PICKER,{type:t.FormCompEnum.TIME_PICKER,"is-range":!0,"start-placeholder":"开始时间","end-placeholder":"结束时间"}],[t.FormCompEnum.DATETIMERANGE_PICKER,{type:t.FormCompEnum.DATETIMERANGE_PICKER,"start-placeholder":"开始日期","end-placeholder":"结束日期"}],[t.FormCompEnum.DATERANGE_PICKER,{type:t.FormCompEnum.DATERANGE_PICKER,"start-placeholder":"开始日期","end-placeholder":"结束日期"}],[t.FormCompEnum.MONTHRANGE_PICKER,{type:t.FormCompEnum.MONTHRANGE_PICKER,"start-placeholder":"开始月份","end-placeholder":"结束月份"}]]);return o.has(r.schema.type)&&(n=Object.assign(o.get(r.schema.type)||{},n)),r.formProps.inputMaxLength&&[t.FormCompEnum.INPUT].includes(r.schema.type)&&!n?.maxlength&&(n.maxlength=r.formProps.inputMaxLength),n}),B=e.computed(()=>{const{disabled:n}=r.formProps,{dynamicDisabled:o}=r.schema,{disabled:m=!1}=e.unref(S);let a=!!n||m;return c.isBoolean(o)&&(a=o),c.isFunction(o)&&(a=o(e.unref(C))),a});function K(){const{show:n,ifShow:o}=r.schema;let m=!0,a=!0;return c.isBoolean(n)&&(m=n),c.isBoolean(o)&&(a=o),c.isFunction(n)&&(m=n(e.unref(C))),c.isFunction(o)&&(a=o(e.unref(C))),{isShow:m,isIfShow:a}}function U(){const{rules:n=[],type:o=t.FormCompEnum.INPUT,rulesMessageJoinLabel:m,label:a,title:E,dynamicRule:u,required:P,dynamicRuleAdd:g=!0}=r.schema,p=a||E;if(c.isFunction(u)&&!g)return u(e.unref(C));let s=c.cloneDeep(c.isArray(n)?n:[n]);const{rulesMessageJoinLabel:R}=r.formProps,b=Reflect.has(r.schema,"rulesMessageJoinLabel")?m:R,N=j.createPlaceholderMessage(o,`${b?p:""}`);function y(l,i){const x=l.message||N;return i===void 0||c.isNull(i)||Array.isArray(i)&&i.length===0||typeof i=="string"&&i.trim()===""||typeof i=="object"&&Reflect.has(i,"checked")&&Reflect.has(i,"halfChecked")&&Array.isArray(i.checked)&&Array.isArray(i.halfChecked)&&i.checked.length===0&&i.halfChecked.length===0?Promise.reject(x):Promise.resolve()}const d=c.isFunction(P)?P(e.unref(C)):P,F=[t.FormCompEnum.RADIO,t.FormCompEnum.SELECT,t.FormCompEnum.RADIO,t.FormCompEnum.RADIO_SINGLE,t.FormCompEnum.RADIO_BUTTON,t.FormCompEnum.CHECKBOX,t.FormCompEnum.CHECKBOX_SINGLE,t.FormCompEnum.CHECKBOX_BUTTON].includes(o);d&&(!s||s.length===0?s=[{required:d,validator:y,trigger:F?"change":"blur"}]:s.findIndex(i=>Reflect.has(i,"required"))===-1&&s.unshift({required:d,validator:y,trigger:F?"change":"blur"}));const T=s.findIndex(l=>Reflect.has(l,"required")&&!Reflect.has(l,"validator"));if(T!==-1){const l=s[T],{isShow:i}=K();i||(l.required=!1),o&&(l.message=l.message||N)}const f=s.findIndex(l=>l.min),h=s.findIndex(l=>l.max);function I(l,i,x="all"){const D=s[i],L=D.isNumber?isNaN(l)?l?.length||0:Number(l):l?.length||0;return["min","all"].includes(x)&&L<D.min?Promise.reject(p+"至少为"+D.min+"位"):["max","all"].includes(x)&&L>D.max?Promise.reject(p+"最多"+D.max+"位"):Promise.resolve()}(f!==-1||h!==-1)&&(f!==-1&&h!==-1&&!s[f].validator&&!s[f].message?s[f].validator=(l,i)=>I(i,f):f!==-1&&!s[f].validator&&!s[f].message?s[f].validator=(l,i)=>I(i,f,"min"):h!==-1&&!s[h].validator&&!s[h].message&&(s[h].validator=(l,i)=>I(i,h,"max")));const A=s.findIndex(l=>l.len);if(A!==-1&&(s[A].validator=(l,i)=>i.length!==s[A].len?Promise.reject(p+"必须是"+s[A].len+"位"):Promise.resolve()),c.isFunction(u)&&g){let l=u(e.unref(C));l=c.isArray(l)?l:[l],s=s.concat(l)}return s}const k=()=>{const{renderComponentContent:n,type:o=t.FormCompEnum.INPUT,field:m,changeEvent:a="change",valueField:E,label:u,title:P,placeholderJoinLabel:g=!0}=r.schema;let p=a;t.isInput(o)?p="input":(t.isDatePicker(o)||o===t.FormCompEnum.TIME_PICKER)&&(p="update:modelValue");const s=`on${c.upperFirst(p)}`,R={[s]:(...I)=>{const[A]=I;d[s]&&d[s](...I);const l=A?A.target:null,i=l?l.value:A;r.setFormModel(m,i,r.schema)}},b=t.componentMap.get(o),{autoSetPlaceHolder:N,size:y}=r.formProps,d={clearable:!0,...e.unref(S)};if([t.FormCompEnum.SEARCH].includes(o)||(d.size=e.unref(S)?.size||y,d.disabled=e.unref(B)),!d.disabled&&N&&!t.isRangePicker(o)&&o){const I=u||P;d.placeholder=e.unref(S)?.placeholder||j.createPlaceholderMessage(o,g&&c.isString(I)?I:"")}const T={[E||"model-value"]:r.formModel[m]},f={...R,...d,...T};if(!n)return e.createVNode(b,f,null);const h=c.isFunction(n)?{...n(e.unref(C))}:{default:()=>n};return e.createVNode(b,f,q(h)?h:{default:()=>[h]})};function V(){const{showLabel:n=!0,label:o,title:m,subLabel:a,labelRequired:E}=r.schema;let u=o||m;return u=E?e.createVNode("span",null,[e.createVNode("span",{class:"label-required"},[e.createTextVNode("*")]),e.createVNode("span",null,[u])]):u,n&&u?a?e.createVNode("span",null,[u,e.createTextVNode(" "),e.createVNode("span",{class:"sub-label"},[a])]):u:void 0}const O=e.useSlots();function w(n,o="default",m){if(!n||!Reflect.has(n,o))return null;if(!c.isFunction(n[o]))return console.error(`${o} is not a function!`),null;const a=n[o];return a?a(m):null}function H(){const{itemProps:n,slot:o,render:m,field:a,suffix:E,prefix:u,prefixParentStyle:P}=r.schema,{autoCleanErrorMessage:g,compFullWidth:p}=r.formProps,s=()=>o?w(O,o,e.unref(C)):m?m(e.unref(C)):k(),R=!!E,b=!!u,N=c.isFunction(E)?E(e.unref(C)):E,y=c.isFunction(u)?u(e.unref(C)):u,d=()=>{r.updateSchema([{field:a,itemProps:{error:""}}])},F=()=>e.createVNode($.VftFormItem,e.mergeProps({style:{marginRight:r.formProps.customLayout?"10px":0},prop:a,class:[{[M.is("suffix")]:R},{[M.is("comp-full-width")]:p},M.e("item")]},n,{label:n?.label||n?.title,"onUpdate:error":g?d:()=>{},rules:U()}),{default:()=>[e.createVNode("div",{class:M.e("container")},[e.createVNode("div",{class:M.e("content")},[s(),R&&e.createVNode("span",{class:M.m("suffix")},[N])])])],label:V()?()=>V():void 0});return b?e.createVNode("div",{style:P},[e.createVNode("span",{class:M.m("prefix")},[y]),F()]):F()}return()=>{let n;const{colProps:o={},colSlot:m,renderColContent:a,type:E=t.FormCompEnum.INPUT,render:u,quickColSpan:P}=r.schema;if(!t.componentMap.has(E)&&!a&&!u)return null;const{baseColProps:g={},quickColSpan:p}=r.formProps,s=p?{span:Math.ceil(24/p),...g}:{...g},R=P?{span:Math.ceil(24/P),...o}:{...o},b={...s,...R},{isIfShow:N,isShow:y}=K(),d=e.unref(C),F=()=>m?w(O,m,d):a?a(d):H();if(E===t.FormCompEnum.DIVIDER){let T;return e.createVNode(v.VftCol,e.mergeProps({span:24},R),{default:()=>[e.createVNode(G.VftDivider,e.unref(S),q(T=V())?T:{default:()=>[T]})]})}return N&&(r.formProps.customLayout?F():e.withDirectives(e.createVNode(v.VftCol,b,q(n=F())?n:{default:()=>[n]}),[[e.vShow,y]]))}}});exports.default=z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@vft/utils"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@vft/utils"),m=require("../component-map.cjs");function E(e,r=""){return r=(r||"").replace(":",""),[m.FormCompEnum.INPUT,m.FormCompEnum.INPUT_NUMBER,m.FormCompEnum.TEXTAREA].includes(e)?"请输入"+r:[m.FormCompEnum.PASSWORD].includes(e)?"请输入密码":[m.FormCompEnum.SELECT,m.FormCompEnum.RADIO].includes(e)?"请选择"+r:[m.FormCompEnum.SEARCH].includes(e)?"请输入要搜索的内容":[m.FormCompEnum.TIME_PICKER,m.FormCompEnum.YEAR_PICKER,m.FormCompEnum.MONTH_PICKER,m.FormCompEnum.DATE_PICKER,m.FormCompEnum.DATES_PICKER,m.FormCompEnum.DATETIME_PICKER,m.FormCompEnum.WEEK_PICKER,m.FormCompEnum.DATETIMERANGE_PICKER,m.FormCompEnum.DATERANGE_PICKER,m.FormCompEnum.MONTHRANGE_PICKER].includes(e)?"请选择时间":""}function n(e,r){return e&&m.isInput(e)&&r&&u.isNumber(r)?`${r}`:r}exports.createPlaceholderMessage=E;exports.handleInputNumberValue=n;
|
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.299";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.299",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"resize-detector": "0.3.0",
|
|
56
56
|
"sortablejs": "1.15.0",
|
|
57
57
|
"@vft/use": "0.0.69",
|
|
58
|
-
"@vft/router": "0.0.65",
|
|
59
58
|
"@vft/constants": "0.0.72",
|
|
59
|
+
"@vft/utils": "0.0.120",
|
|
60
|
+
"@vft/router": "0.0.65",
|
|
60
61
|
"@vft/store": "0.0.53",
|
|
61
|
-
"@vft/directives": "0.0.33"
|
|
62
|
-
"@vft/utils": "0.0.120"
|
|
62
|
+
"@vft/directives": "0.0.33"
|
|
63
63
|
},
|
|
64
64
|
"vetur": {
|
|
65
65
|
"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.299","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}
|