vft 0.0.506 → 0.0.509
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/dist/index.css +1 -1
- package/es/components/cascader/cascader.vue2.js +203 -202
- package/es/components/cascader-panel/menu.vue2.js +50 -49
- package/es/components/clamp-toggle/clamp-toggle.vue2.js +21 -17
- package/es/components/color-picker/color-picker.vue2.js +134 -133
- package/es/components/config-provider/config-provider.vue.d.ts +2 -0
- package/es/components/config-provider/config-provider.vue2.js +5 -4
- package/es/components/config-provider/constants.d.ts +1 -0
- package/es/components/config-provider/constants.js +3 -2
- package/es/components/config-provider/hooks/use-global-config.js +33 -30
- package/es/components/config-provider/index.d.ts +9 -0
- package/es/components/config-provider/index.js +6 -5
- package/es/components/date-picker/composables/use-basic-date-table.d.ts +1 -1
- package/es/components/date-picker/composables/use-basic-date-table.js +124 -123
- package/es/components/date-picker/composables/use-month-range-header.js +15 -14
- package/es/components/date-picker/composables/use-panel-date-range.js +24 -23
- package/es/components/date-picker/date-picker-com/basic-month-table.vue2.js +39 -38
- package/es/components/date-picker/date-picker-com/basic-year-table.vue2.js +39 -38
- package/es/components/date-picker/date-picker-com/panel-date-pick.vue2.js +179 -178
- package/es/components/date-picker/date-picker-com/panel-date-range.vue2.js +225 -224
- package/es/components/date-time-select/date-time-select.vue2.js +39 -36
- package/es/components/dropdown/dropdown.vue2.js +68 -67
- package/es/components/empty/empty.vue2.js +39 -38
- package/es/components/full-screen/full-screen.vue2.js +18 -17
- package/es/components/image/image.vue2.js +60 -59
- package/es/components/image-viewer/image-viewer.vue2.js +45 -44
- package/es/components/index.js +161 -160
- package/es/components/input/index.d.ts +5 -0
- package/es/components/input/input.vue.d.ts +2 -0
- package/es/components/input/input.vue2.js +42 -41
- package/es/components/md-container/md-container.vue2.js +75 -74
- package/es/components/md-container/toc.js +37 -36
- package/es/components/modal/modal-footer-action.vue2.js +25 -24
- package/es/components/multiple-tabs/multiple-tabs.vue2.js +16 -15
- package/es/components/multiple-tabs/use/use-tab-dropdown.js +54 -53
- package/es/components/pagination/components/jumper.vue2.js +29 -28
- package/es/components/pagination/components/sizes.vue2.js +21 -20
- package/es/components/pagination/components/total.vue2.js +11 -10
- package/es/components/popconfirm/popconfirm.vue2.js +40 -39
- package/es/components/search/search.vue2.js +79 -77
- package/es/components/select/useSelect.js +232 -231
- package/es/components/super-form/super-form-action.vue2.js +41 -40
- package/es/components/super-form/super-form-item.vue2.js +206 -203
- package/es/components/super-form/use/helper.d.ts +1 -1
- package/es/components/super-form/use/helper.js +62 -62
- package/es/components/table/field.js +130 -110
- package/es/components/table/table.vue2.js +152 -150
- package/es/components/table/use/use-columns.js +29 -26
- package/es/components/table/use/use-data-source.js +87 -86
- package/es/components/time-picker/time-picker-com/panel-time-pick.vue2.js +66 -65
- package/es/components/time-picker/time-picker-com/panel-time-range.vue2.js +134 -133
- package/es/components/transfer/transfer-panel.vue2.js +57 -56
- package/es/components/transfer/transfer.vue2.js +70 -69
- package/es/components/tree/tree.vue2.js +60 -59
- package/es/components/upload/index.d.ts +3 -3
- package/es/components/upload/upload-content.vue.d.ts +2 -2
- package/es/components/upload/upload-content.vue2.js +78 -75
- package/es/components/upload/upload-list.vue2.js +46 -45
- package/es/components/upload/upload.vue.d.ts +2 -2
- package/es/components/upload/upload.vue2.js +87 -85
- package/es/components/upload/utils.js +29 -29
- package/es/constants/date.d.ts +1 -1
- package/es/constants/date.js +9 -1
- package/es/hooks/use-z-index/index.js +3 -3
- package/es/index.d.ts +1 -0
- package/es/index.js +5 -1
- package/es/locale/index.d.js +1 -0
- package/es/locale/index.d.ts +26 -0
- package/es/locale/index.js +10 -0
- package/es/locale/lang/en.d.ts +183 -0
- package/es/locale/lang/en.js +241 -0
- package/es/locale/lang/zh-cn.d.ts +183 -0
- package/es/locale/lang/zh-cn.js +241 -0
- package/es/locale/lang/zh-tw.d.ts +183 -0
- package/es/locale/lang/zh-tw.js +241 -0
- package/es/locale/use-locale.d.ts +17 -0
- package/es/locale/use-locale.js +56 -0
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/cascader/cascader.vue2.cjs +1 -1
- package/lib/components/cascader-panel/menu.vue2.cjs +4 -4
- package/lib/components/clamp-toggle/clamp-toggle.vue2.cjs +1 -1
- package/lib/components/color-picker/color-picker.vue2.cjs +1 -1
- package/lib/components/config-provider/config-provider.vue.d.ts +2 -0
- package/lib/components/config-provider/config-provider.vue2.cjs +1 -1
- package/lib/components/config-provider/constants.cjs +1 -1
- package/lib/components/config-provider/constants.d.ts +1 -0
- package/lib/components/config-provider/hooks/use-global-config.cjs +1 -1
- package/lib/components/config-provider/index.cjs +1 -1
- package/lib/components/config-provider/index.d.ts +9 -0
- package/lib/components/date-picker/composables/use-basic-date-table.cjs +1 -1
- package/lib/components/date-picker/composables/use-basic-date-table.d.ts +1 -1
- package/lib/components/date-picker/composables/use-month-range-header.cjs +1 -1
- package/lib/components/date-picker/composables/use-panel-date-range.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/basic-month-table.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/basic-year-table.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/panel-date-pick.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/panel-date-range.vue2.cjs +1 -1
- package/lib/components/date-time-select/date-time-select.vue2.cjs +1 -1
- package/lib/components/dropdown/dropdown.vue2.cjs +1 -1
- package/lib/components/empty/empty.vue2.cjs +1 -1
- package/lib/components/full-screen/full-screen.vue2.cjs +1 -1
- package/lib/components/image/image.vue2.cjs +1 -1
- package/lib/components/image-viewer/image-viewer.vue2.cjs +1 -1
- package/lib/components/index.cjs +1 -1
- package/lib/components/input/index.d.ts +5 -0
- package/lib/components/input/input.vue.d.ts +2 -0
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/md-container/md-container.vue2.cjs +1 -1
- package/lib/components/md-container/toc.cjs +1 -1
- package/lib/components/modal/modal-footer-action.vue2.cjs +1 -1
- package/lib/components/multiple-tabs/multiple-tabs.vue2.cjs +1 -1
- package/lib/components/multiple-tabs/use/use-tab-dropdown.cjs +1 -1
- package/lib/components/pagination/components/jumper.vue2.cjs +1 -1
- package/lib/components/pagination/components/sizes.vue2.cjs +1 -1
- package/lib/components/pagination/components/total.vue2.cjs +1 -1
- package/lib/components/popconfirm/popconfirm.vue2.cjs +1 -1
- package/lib/components/search/search.vue2.cjs +1 -1
- package/lib/components/select/useSelect.cjs +1 -1
- package/lib/components/super-form/super-form-action.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/components/super-form/use/helper.d.ts +1 -1
- package/lib/components/table/field.cjs +1 -1
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/components/table/use/use-columns.cjs +1 -1
- package/lib/components/table/use/use-data-source.cjs +1 -1
- package/lib/components/time-picker/time-picker-com/panel-time-pick.vue2.cjs +1 -1
- package/lib/components/time-picker/time-picker-com/panel-time-range.vue2.cjs +1 -1
- package/lib/components/transfer/transfer-panel.vue2.cjs +1 -1
- package/lib/components/transfer/transfer.vue2.cjs +1 -1
- package/lib/components/tree/tree.vue2.cjs +1 -1
- package/lib/components/upload/index.d.ts +3 -3
- package/lib/components/upload/upload-content.vue.d.ts +2 -2
- package/lib/components/upload/upload-content.vue2.cjs +1 -1
- package/lib/components/upload/upload-list.vue2.cjs +1 -1
- package/lib/components/upload/upload.vue.d.ts +2 -2
- package/lib/components/upload/upload.vue2.cjs +1 -1
- package/lib/components/upload/utils.cjs +1 -1
- package/lib/constants/date.cjs +1 -1
- package/lib/constants/date.d.ts +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/locale/index.cjs +1 -0
- package/lib/locale/index.d.cjs +1 -0
- package/lib/locale/index.d.ts +26 -0
- package/lib/locale/lang/en.cjs +1 -0
- package/lib/locale/lang/en.d.ts +183 -0
- package/lib/locale/lang/zh-cn.cjs +1 -0
- package/lib/locale/lang/zh-cn.d.ts +183 -0
- package/lib/locale/lang/zh-tw.cjs +1 -0
- package/lib/locale/lang/zh-tw.d.ts +183 -0
- package/lib/locale/use-locale.cjs +1 -0
- package/lib/locale/use-locale.d.ts +17 -0
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +2 -2
- package/theme-style/index.css +1 -1
- package/theme-style/src/super-form.scss +0 -1
- package/theme-style/vft-super-form.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as Oe, useAttrs as Te, useSlots as Le, computed as l, ref as
|
|
1
|
+
import { defineComponent as Oe, useAttrs as Te, useSlots as Le, computed as l, ref as E, getCurrentInstance as je, shallowRef as H, watch as U, nextTick as V, onMounted as We, withDirectives as He, createElementBlock as c, openBlock as i, mergeProps as h, Fragment as q, createCommentVNode as u, createElementVNode as w, normalizeClass as r, unref as a, renderSlot as $, createBlock as B, withKeys as Ue, withModifiers as me, toDisplayString as D, normalizeStyle as qe, vShow as Ge } from "vue";
|
|
2
2
|
import "../form/index.js";
|
|
3
|
-
import { VftIcon as
|
|
3
|
+
import { VftIcon as A } from "../icon/index.js";
|
|
4
4
|
import { useResizeObserver as Je, isClient as Qe } from "@vueuse/core";
|
|
5
|
-
import { isString as
|
|
5
|
+
import { isString as F, singleAttrToObj as G, noop as Xe, isObject as ve } from "@vft/utils";
|
|
6
6
|
import { debugWarn as J } from "../../utils/error.js";
|
|
7
7
|
import "../config-provider/hooks/use-global-config.js";
|
|
8
8
|
import { isNil as Ye } from "lodash-es";
|
|
@@ -44,11 +44,11 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
44
44
|
inputStyle: { type: [Boolean, null, String, Object, Array] }
|
|
45
45
|
},
|
|
46
46
|
emits: {
|
|
47
|
-
[Q]: (e) =>
|
|
48
|
-
input: (e) =>
|
|
49
|
-
change: (e) =>
|
|
50
|
-
suffixClick: (e) =>
|
|
51
|
-
prefixClick: (e) =>
|
|
47
|
+
[Q]: (e) => F(e),
|
|
48
|
+
input: (e) => F(e),
|
|
49
|
+
change: (e) => F(e),
|
|
50
|
+
suffixClick: (e) => F(e),
|
|
51
|
+
prefixClick: (e) => F(e),
|
|
52
52
|
focus: (e) => e instanceof FocusEvent,
|
|
53
53
|
blur: (e) => e instanceof FocusEvent,
|
|
54
54
|
clear: () => !0,
|
|
@@ -59,7 +59,8 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
59
59
|
keydown: (e) => e instanceof Event,
|
|
60
60
|
compositionstart: (e) => e instanceof CompositionEvent,
|
|
61
61
|
compositionupdate: (e) => e instanceof CompositionEvent,
|
|
62
|
-
compositionend: (e) => e instanceof CompositionEvent
|
|
62
|
+
compositionend: (e) => e instanceof CompositionEvent,
|
|
63
|
+
passwordVisibleChange: (e) => typeof e == "boolean"
|
|
63
64
|
},
|
|
64
65
|
setup(e, { expose: xe, emit: pe }) {
|
|
65
66
|
const s = pe, g = Te(), m = Le(), X = l(() => {
|
|
@@ -85,19 +86,19 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
85
86
|
n.is("focus", v.value)
|
|
86
87
|
]), d = Ze({
|
|
87
88
|
excludeKeys: l(() => Object.keys(X.value))
|
|
88
|
-
}), { form: Ce, formItem:
|
|
89
|
-
formItemContext:
|
|
90
|
-
}), ke = et(), x = tt(), n = ye("input"), Z = ye("textarea"),
|
|
89
|
+
}), { form: Ce, formItem: M } = at(), { inputId: Y } = nt(we.props, {
|
|
90
|
+
formItemContext: M
|
|
91
|
+
}), ke = et(), x = tt(), n = ye("input"), Z = ye("textarea"), K = H(), p = H(), v = E(!1), N = E(!1), C = E(!1), k = E(!1), _ = E(), O = H(e.inputStyle), I = l(() => K.value || p.value), T = l(() => G(e.prefixIcon, "icon", { size: 16 })), ee = l(() => G(e.suffixIcon, "icon", { size: 16 })), Ie = l(() => G(e.clearIcon, "icon", {
|
|
91
92
|
icon: "icon-circle-close",
|
|
92
93
|
size: 16
|
|
93
|
-
})), te = l(() => Ce?.statusIcon ?? !1),
|
|
94
|
-
() =>
|
|
94
|
+
})), te = l(() => Ce?.statusIcon ?? !1), z = l(() => M?.validateState || ""), ae = l(
|
|
95
|
+
() => z.value && {
|
|
95
96
|
validating: "icon-loading",
|
|
96
97
|
success: "icon-circle-check",
|
|
97
98
|
error: "icon-circle-close"
|
|
98
|
-
}[
|
|
99
|
+
}[z.value]
|
|
99
100
|
), ze = l(
|
|
100
|
-
() =>
|
|
101
|
+
() => k.value ? { icon: "icon-view", size: 16 } : { icon: "icon-hide", size: 16 }
|
|
101
102
|
), Se = l(() => [
|
|
102
103
|
g.style,
|
|
103
104
|
e.inputStyle
|
|
@@ -119,8 +120,8 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
119
120
|
!!b.value && j.value > Number(d.value.maxlength)
|
|
120
121
|
)
|
|
121
122
|
), Ve = l(
|
|
122
|
-
() => !!m.suffix || !!e.suffixIcon || P.value || e.showPassword || b.value || !!
|
|
123
|
-
), [Be, Ae] = _e(
|
|
123
|
+
() => !!m.suffix || !!e.suffixIcon || P.value || e.showPassword || b.value || !!z.value && te.value
|
|
124
|
+
), [Be, Ae] = _e(K);
|
|
124
125
|
Je(p, (t) => {
|
|
125
126
|
if (!b.value || e.resize !== "both") return;
|
|
126
127
|
const o = t[0], { width: y } = o.contentRect;
|
|
@@ -140,18 +141,18 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
140
141
|
O.value = {
|
|
141
142
|
minHeight: he(p.value).minHeight
|
|
142
143
|
};
|
|
143
|
-
},
|
|
144
|
-
const t =
|
|
144
|
+
}, S = () => {
|
|
145
|
+
const t = I.value;
|
|
145
146
|
!t || t.value === f.value || (t.value = f.value);
|
|
146
147
|
}, W = async (t) => {
|
|
147
148
|
Be();
|
|
148
149
|
let { value: o } = t.target;
|
|
149
150
|
if (d.value.maxlength && o.length >= d.value.maxlength && (o = o.slice(0, Number(d.value.maxlength))), e.formatter && (o = e.parser ? e.parser(o) : o, o = e.formatter(o)), !C.value) {
|
|
150
151
|
if (o === f.value) {
|
|
151
|
-
|
|
152
|
+
S();
|
|
152
153
|
return;
|
|
153
154
|
}
|
|
154
|
-
s(Q, o), s("input", o), await
|
|
155
|
+
s(Q, o), s("input", o), await V(), S(), Ae();
|
|
155
156
|
}
|
|
156
157
|
}, oe = (t) => {
|
|
157
158
|
s("change", t.target.value);
|
|
@@ -168,13 +169,13 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
168
169
|
}, ie = (t) => {
|
|
169
170
|
s("compositionend", t), C.value && (C.value = !1, W(t));
|
|
170
171
|
}, Pe = () => {
|
|
171
|
-
|
|
172
|
+
k.value = !k.value, s("passwordVisibleChange", k.value), ue();
|
|
172
173
|
}, ue = async () => {
|
|
173
|
-
await
|
|
174
|
-
}, Re = () =>
|
|
174
|
+
await V(), I.value?.focus();
|
|
175
|
+
}, Re = () => I.value?.blur(), re = (t) => {
|
|
175
176
|
v.value = !0, s("focus", t);
|
|
176
177
|
}, ce = (t) => {
|
|
177
|
-
v.value = !1, s("blur", t), e.validateEvent &&
|
|
178
|
+
v.value = !1, s("blur", t), e.validateEvent && M?.validate?.("blur").catch((o) => J(o));
|
|
178
179
|
}, $e = (t) => {
|
|
179
180
|
N.value = !1, s("mouseleave", t);
|
|
180
181
|
}, De = (t) => {
|
|
@@ -185,32 +186,32 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
185
186
|
return t.returnValue = !1, !1;
|
|
186
187
|
s("keydown", t);
|
|
187
188
|
}, Ne = () => {
|
|
188
|
-
|
|
189
|
+
I.value?.select();
|
|
189
190
|
}, fe = () => {
|
|
190
191
|
s(Q, ""), s("change", ""), s("clear"), s("input", "");
|
|
191
192
|
};
|
|
192
193
|
return U(
|
|
193
194
|
() => e.modelValue,
|
|
194
195
|
() => {
|
|
195
|
-
|
|
196
|
+
V(() => R()), e.validateEvent && M?.validate?.("change").catch((t) => J(t));
|
|
196
197
|
}
|
|
197
|
-
), U(f, () =>
|
|
198
|
+
), U(f, () => S()), U(
|
|
198
199
|
() => e.type,
|
|
199
200
|
async () => {
|
|
200
|
-
await
|
|
201
|
+
await V(), S(), R();
|
|
201
202
|
}
|
|
202
203
|
), We(() => {
|
|
203
204
|
!e.formatter && e.parser && J(
|
|
204
205
|
"VftInput",
|
|
205
206
|
"If you set the parser, you also need to set the formatter."
|
|
206
|
-
),
|
|
207
|
+
), S(), V(R);
|
|
207
208
|
}), xe({
|
|
208
209
|
/** @description HTML input element */
|
|
209
|
-
input:
|
|
210
|
+
input: K,
|
|
210
211
|
/** @description HTML textarea element */
|
|
211
212
|
textarea: p,
|
|
212
213
|
/** @description HTML element, input or textarea */
|
|
213
|
-
ref:
|
|
214
|
+
ref: I,
|
|
214
215
|
/** @description style of textarea. */
|
|
215
216
|
textareaStyle: ne,
|
|
216
217
|
/** @description from props (used on unit test) */
|
|
@@ -252,7 +253,7 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
252
253
|
onClick: Me
|
|
253
254
|
}, [
|
|
254
255
|
$(t.$slots, "prefix"),
|
|
255
|
-
T.value?.icon ? (i(),
|
|
256
|
+
T.value?.icon ? (i(), B(a(A), h({
|
|
256
257
|
key: 0,
|
|
257
258
|
pointer: ""
|
|
258
259
|
}, T.value, {
|
|
@@ -263,10 +264,10 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
263
264
|
w("input", h({
|
|
264
265
|
id: a(Y),
|
|
265
266
|
ref_key: "input",
|
|
266
|
-
ref:
|
|
267
|
+
ref: K,
|
|
267
268
|
class: a(n).e("inner")
|
|
268
269
|
}, a(d), {
|
|
269
|
-
type: e.showPassword ?
|
|
270
|
+
type: e.showPassword ? k.value ? "text" : "password" : e.type,
|
|
270
271
|
disabled: a(x),
|
|
271
272
|
formatter: e.formatter,
|
|
272
273
|
parser: e.parser,
|
|
@@ -297,11 +298,11 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
297
298
|
}, [
|
|
298
299
|
!P.value || !L.value || !b.value ? (i(), c(q, { key: 0 }, [
|
|
299
300
|
$(t.$slots, "suffix"),
|
|
300
|
-
ee.value?.icon ? (i(),
|
|
301
|
+
ee.value?.icon ? (i(), B(a(A), h({ key: 0 }, ee.value, {
|
|
301
302
|
class: a(n).e("icon")
|
|
302
303
|
}), null, 16, ["class"])) : u("", !0)
|
|
303
304
|
], 64)) : u("", !0),
|
|
304
|
-
P.value ? (i(),
|
|
305
|
+
P.value ? (i(), B(a(A), h({
|
|
305
306
|
key: 1,
|
|
306
307
|
pointer: "",
|
|
307
308
|
class: [a(n).e("icon"), a(n).e("clear")]
|
|
@@ -309,7 +310,7 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
309
310
|
onMousedown: me(a(Xe), ["prevent"]),
|
|
310
311
|
onClick: me(fe, ["stop"])
|
|
311
312
|
}), null, 16, ["class", "onMousedown"])) : u("", !0),
|
|
312
|
-
L.value ? (i(),
|
|
313
|
+
L.value ? (i(), B(a(A), h({ key: 2 }, ze.value, {
|
|
313
314
|
class: [a(n).e("icon"), a(n).e("password")],
|
|
314
315
|
onClick: Pe
|
|
315
316
|
}), null, 16, ["class"])) : u("", !0),
|
|
@@ -321,13 +322,13 @@ const ot = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
321
322
|
class: r(a(n).e("count-inner"))
|
|
322
323
|
}, D(j.value) + " / " + D(a(d).maxlength), 3)
|
|
323
324
|
], 2)) : u("", !0),
|
|
324
|
-
|
|
325
|
+
z.value && ae.value && te.value ? (i(), B(a(A), {
|
|
325
326
|
key: 4,
|
|
326
327
|
icon: ae.value,
|
|
327
328
|
class: r([
|
|
328
329
|
a(n).e("icon"),
|
|
329
330
|
a(n).e("validateIcon"),
|
|
330
|
-
a(n).is("loading",
|
|
331
|
+
a(n).is("loading", z.value === "validating")
|
|
331
332
|
])
|
|
332
333
|
}, null, 8, ["icon", "class"])) : u("", !0)
|
|
333
334
|
], 2)
|
|
@@ -1,88 +1,86 @@
|
|
|
1
|
-
import { defineComponent as S, getCurrentInstance as
|
|
2
|
-
import { VftIcon as
|
|
3
|
-
import { VftIconText as
|
|
4
|
-
import { VftMdComment as
|
|
5
|
-
import { VftSideMenu as
|
|
6
|
-
import { VftTag as
|
|
1
|
+
import { defineComponent as S, getCurrentInstance as N, ref as A, computed as k, onMounted as P, nextTick as q, onDeactivated as z, onBeforeMount as B, createElementBlock as u, openBlock as s, normalizeClass as c, unref as e, createBlock as f, createCommentVNode as p, createElementVNode as l, toDisplayString as b, createVNode as h, Fragment as I, renderList as O, withCtx as F, createTextVNode as H, renderSlot as J } from "vue";
|
|
2
|
+
import { VftIcon as T } from "../icon/index.js";
|
|
3
|
+
import { VftIconText as j } from "../icon-text/index.js";
|
|
4
|
+
import { VftMdComment as U } from "../md-comment/index.js";
|
|
5
|
+
import { VftSideMenu as Y } from "../side-menu/index.js";
|
|
6
|
+
import { VftTag as G } from "../tag/index.js";
|
|
7
7
|
import "@vueuse/core";
|
|
8
|
-
import { handleScrollPosition as
|
|
8
|
+
import { handleScrollPosition as K, getAdaptiveOffset as Q, jumpElement as D, getRandomElementForArr as W, isClient as X } from "@vft/utils";
|
|
9
9
|
import "../config-provider/hooks/use-global-config.js";
|
|
10
|
-
import { primaryColor as
|
|
11
|
-
import { debounce as
|
|
10
|
+
import { primaryColor as Z } from "../../utils/ns-cover.js";
|
|
11
|
+
import { debounce as ee } from "lodash-es";
|
|
12
12
|
import "../form/index.js";
|
|
13
|
-
import { useNamespace as
|
|
13
|
+
import { useNamespace as te } from "../../hooks/use-namespace/index.js";
|
|
14
14
|
import "../../hooks/use-model-toggle/index.js";
|
|
15
15
|
import "@popperjs/core";
|
|
16
16
|
import "../../hooks/use-z-index/index.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
17
|
+
import { useLocale as oe } from "../../locale/use-locale.js";
|
|
18
|
+
import { useRouterHelper as ne } from "@vft/router";
|
|
19
|
+
import { useEventListener as ie } from "@vft/use";
|
|
20
|
+
import { usePhotoSwipe as le } from "@vft/use/photoswipe";
|
|
21
|
+
import { formatToDateTime as ae, getDayTimestamp as re } from "@vft/utils/date";
|
|
22
|
+
import { useCopyCode as se } from "./use/useCopyCode.js";
|
|
23
|
+
import { COMP_TYPE as ce } from "./utils.js";
|
|
24
|
+
const me = { class: "info-container" }, de = {
|
|
24
25
|
key: 0,
|
|
25
26
|
class: "left"
|
|
26
|
-
},
|
|
27
|
-
class: "reading",
|
|
28
|
-
title: "阅读量"
|
|
29
|
-
}, ue = ["data-path"], fe = S({
|
|
27
|
+
}, ue = { class: "infos" }, fe = ["title"], pe = ["data-path"], he = S({
|
|
30
28
|
name: "vft-md-container"
|
|
31
|
-
}),
|
|
32
|
-
...
|
|
29
|
+
}), Ie = /* @__PURE__ */ S({
|
|
30
|
+
...he,
|
|
33
31
|
props: {
|
|
34
32
|
tocList: {},
|
|
35
33
|
scrollDom: { default: ".layout-content" },
|
|
36
34
|
showComment: { type: Boolean, default: !0 }
|
|
37
35
|
},
|
|
38
36
|
setup(a) {
|
|
39
|
-
const
|
|
40
|
-
w(),
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
|
|
37
|
+
const r = te("md-container"), L = N(), { t: g } = oe(), m = A(), d = k(() => a.tocList && a.tocList !== "undefined" ? JSON.parse(a.tocList) : ""), { initPhotoSwipe: w } = le(`.${r.e("content")} img`);
|
|
38
|
+
w(), se();
|
|
39
|
+
const v = L.appContext.config.globalProperties.$router, n = v.currentRoute.value, V = Z(), _ = X ? location.pathname : "", { go: E } = ne(v);
|
|
40
|
+
function M(o) {
|
|
41
|
+
E(`/?classify=${o}`);
|
|
44
42
|
}
|
|
45
|
-
const
|
|
46
|
-
() =>
|
|
43
|
+
const R = k(() => n.meta.category?.includes("api")), y = ee(
|
|
44
|
+
() => K({
|
|
47
45
|
scrollDom: a.scrollDom,
|
|
48
46
|
contentDom: ".header-anchor",
|
|
49
47
|
selectAttrName: "href",
|
|
50
|
-
offset:
|
|
48
|
+
offset: Q(210, 1920, 1500, 1920),
|
|
51
49
|
callback: (o) => {
|
|
52
50
|
m.value?.menuRef && (m.value.menuRef.activeIndex = o.slice(1));
|
|
53
51
|
}
|
|
54
52
|
}),
|
|
55
53
|
100
|
|
56
|
-
),
|
|
54
|
+
), C = (o) => {
|
|
57
55
|
D(`[id="${o.index}"]`, a.scrollDom, 120);
|
|
58
|
-
},
|
|
56
|
+
}, x = () => {
|
|
59
57
|
const o = document.querySelector(a.scrollDom);
|
|
60
|
-
o && o.removeEventListener("scroll",
|
|
58
|
+
o && o.removeEventListener("scroll", y);
|
|
61
59
|
};
|
|
62
|
-
return
|
|
63
|
-
|
|
60
|
+
return P(() => {
|
|
61
|
+
q(() => {
|
|
64
62
|
setTimeout(() => {
|
|
65
63
|
n.hash && D(`[id="${encodeURI(n.hash).slice(1)}"]`);
|
|
66
64
|
}), setTimeout(() => {
|
|
67
65
|
const t = document.querySelector(".layout-content");
|
|
68
|
-
t && t.addEventListener("scroll",
|
|
66
|
+
t && t.addEventListener("scroll", y);
|
|
69
67
|
}, 1500);
|
|
70
68
|
const o = document.querySelectorAll(".item.expand"), i = document.querySelectorAll(
|
|
71
69
|
"div.language-vue"
|
|
72
70
|
);
|
|
73
71
|
for (let t = 0; t < o.length; t++)
|
|
74
|
-
|
|
72
|
+
ie(o[t], "click", () => {
|
|
75
73
|
i[t].offsetHeight === 0 ? (i[t].style.height = "auto", i[t].style.visibility = "visible") : (i[t].style.height = "0px", i[t].style.visibility = "hidden");
|
|
76
74
|
});
|
|
77
75
|
});
|
|
78
|
-
}), q(() => {
|
|
79
|
-
C();
|
|
80
76
|
}), z(() => {
|
|
81
|
-
|
|
82
|
-
}), (
|
|
83
|
-
|
|
77
|
+
x();
|
|
78
|
+
}), B(() => {
|
|
79
|
+
x();
|
|
80
|
+
}), (o, i) => (s(), u("div", {
|
|
81
|
+
class: c([e(r).b(), e(r).is("api", R.value)])
|
|
84
82
|
}, [
|
|
85
|
-
d.value?.length ? (
|
|
83
|
+
d.value?.length ? (s(), f(e(Y), {
|
|
86
84
|
key: 0,
|
|
87
85
|
ref_key: "sideMenuRef",
|
|
88
86
|
ref: m,
|
|
@@ -96,66 +94,69 @@ const re = { class: "info-container" }, ce = {
|
|
|
96
94
|
"attr-mapping": {
|
|
97
95
|
index: "slug"
|
|
98
96
|
},
|
|
99
|
-
onSelect:
|
|
100
|
-
onSubMenuClick:
|
|
97
|
+
onSelect: C,
|
|
98
|
+
onSubMenuClick: C
|
|
101
99
|
}, null, 8, ["default-active", "menus"])) : p("", !0),
|
|
102
100
|
l("div", {
|
|
103
|
-
class: c(e(
|
|
101
|
+
class: c(e(r).e("header"))
|
|
104
102
|
}, [
|
|
105
103
|
l("h1", {
|
|
106
|
-
class: c(e(
|
|
107
|
-
},
|
|
108
|
-
l("div",
|
|
109
|
-
e(n).meta?.category?.length ? (
|
|
110
|
-
|
|
104
|
+
class: c(e(r).e("title"))
|
|
105
|
+
}, b(e(n).meta?.title), 3),
|
|
106
|
+
l("div", me, [
|
|
107
|
+
e(n).meta?.category?.length ? (s(), u("div", de, [
|
|
108
|
+
h(e(T), {
|
|
111
109
|
size: 14,
|
|
112
|
-
color: e(
|
|
110
|
+
color: e(V),
|
|
113
111
|
icon: "icon-category"
|
|
114
112
|
}, null, 8, ["color"]),
|
|
115
|
-
(
|
|
113
|
+
(s(!0), u(I, null, O(e(n).meta?.category, (t, $) => (s(), f(e(G), {
|
|
116
114
|
size: "small",
|
|
117
115
|
class: "tag",
|
|
118
|
-
type: e(
|
|
119
|
-
key:
|
|
120
|
-
onClick: (
|
|
116
|
+
type: e(W)(e(ce), 1)[0],
|
|
117
|
+
key: $,
|
|
118
|
+
onClick: (ge) => M(t)
|
|
121
119
|
}, {
|
|
122
|
-
default:
|
|
123
|
-
|
|
120
|
+
default: F(() => [
|
|
121
|
+
H(b(t), 1)
|
|
124
122
|
]),
|
|
125
123
|
_: 2
|
|
126
124
|
}, 1032, ["type", "onClick"]))), 128))
|
|
127
125
|
])) : p("", !0),
|
|
128
|
-
l("div",
|
|
129
|
-
|
|
130
|
-
title: "
|
|
126
|
+
l("div", ue, [
|
|
127
|
+
h(e(j), {
|
|
128
|
+
title: e(g)("vft.mdContainer.publishTime"),
|
|
131
129
|
icon: "icon-date",
|
|
132
130
|
size: 12,
|
|
133
131
|
class: "mr-10px",
|
|
134
132
|
distance: 5,
|
|
135
|
-
text: e(
|
|
136
|
-
(e(n).meta?.date ? new Date(e(n).meta.date).getTime() : (/* @__PURE__ */ new Date()).getTime()) - e(
|
|
133
|
+
text: e(ae)(
|
|
134
|
+
(e(n).meta?.date ? new Date(e(n).meta.date).getTime() : (/* @__PURE__ */ new Date()).getTime()) - e(re)()
|
|
137
135
|
)
|
|
138
|
-
}, null, 8, ["text"]),
|
|
139
|
-
l("div",
|
|
140
|
-
|
|
136
|
+
}, null, 8, ["title", "text"]),
|
|
137
|
+
l("div", {
|
|
138
|
+
class: "reading",
|
|
139
|
+
title: e(g)("vft.mdContainer.readCount")
|
|
140
|
+
}, [
|
|
141
|
+
h(e(T), {
|
|
141
142
|
icon: "icon-reading",
|
|
142
143
|
size: 14,
|
|
143
144
|
class: "mr-5px"
|
|
144
145
|
}),
|
|
145
146
|
l("div", {
|
|
146
147
|
class: "waline-pageview-count lh-1",
|
|
147
|
-
"data-path": e(
|
|
148
|
-
}, "0", 8,
|
|
149
|
-
])
|
|
148
|
+
"data-path": e(_)
|
|
149
|
+
}, "0", 8, pe)
|
|
150
|
+
], 8, fe)
|
|
150
151
|
])
|
|
151
152
|
])
|
|
152
153
|
], 2),
|
|
153
154
|
l("div", {
|
|
154
|
-
class: c(e(
|
|
155
|
+
class: c(e(r).e("content"))
|
|
155
156
|
}, [
|
|
156
|
-
|
|
157
|
+
J(o.$slots, "default")
|
|
157
158
|
], 2),
|
|
158
|
-
a.showComment ? (
|
|
159
|
+
a.showComment ? (s(), f(e(U), { key: 1 })) : p("", !0),
|
|
159
160
|
i[0] || (i[0] = l("ins", {
|
|
160
161
|
class: "adsbygoogle",
|
|
161
162
|
style: { display: "block", "text-align": "center" },
|
|
@@ -168,5 +169,5 @@ const re = { class: "info-container" }, ce = {
|
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
171
|
export {
|
|
171
|
-
|
|
172
|
+
Ie as default
|
|
172
173
|
};
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import { jumpElement as h } from "@vft/utils";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { useLocale as v } from "../../locale/use-locale.js";
|
|
3
|
+
import { defineComponent as g, ref as C, getCurrentInstance as T, computed as $, onMounted as I, watch as b, h as n } from "vue";
|
|
4
|
+
import { isActiveLink as k } from "./utils.js";
|
|
5
|
+
const y = ({ title: e, level: o, slug: t }) => n(
|
|
5
6
|
"a",
|
|
6
7
|
{
|
|
7
|
-
href: `#${
|
|
8
|
-
class: ["toc-link", `level${
|
|
8
|
+
href: `#${t}`,
|
|
9
|
+
class: ["toc-link", `level${o}`]
|
|
9
10
|
},
|
|
10
|
-
|
|
11
|
-
),
|
|
11
|
+
e
|
|
12
|
+
), u = (e, o, t) => e.length && o > 0 ? n(
|
|
12
13
|
"ul",
|
|
13
14
|
{ class: "toc-list" },
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
e.map((l) => [
|
|
16
|
+
n(
|
|
16
17
|
"li",
|
|
17
18
|
{
|
|
18
19
|
class: [
|
|
19
20
|
"toc-item",
|
|
20
21
|
{
|
|
21
|
-
active:
|
|
22
|
-
|
|
23
|
-
`#${decodeURIComponent(
|
|
22
|
+
active: k(
|
|
23
|
+
t,
|
|
24
|
+
`#${decodeURIComponent(l.slug)}`
|
|
24
25
|
)
|
|
25
26
|
}
|
|
26
27
|
],
|
|
27
|
-
onClick: (
|
|
28
|
+
onClick: (s) => H(s, l.slug)
|
|
28
29
|
},
|
|
29
|
-
|
|
30
|
+
y(l)
|
|
30
31
|
),
|
|
31
|
-
|
|
32
|
+
u(l.children, o - 1, t)
|
|
32
33
|
])
|
|
33
34
|
) : null;
|
|
34
|
-
function
|
|
35
|
-
|
|
35
|
+
function H(e, o) {
|
|
36
|
+
e.preventDefault(), h(`[id="${o}"]`);
|
|
36
37
|
}
|
|
37
|
-
const
|
|
38
|
+
const w = g({
|
|
38
39
|
props: {
|
|
39
40
|
/**
|
|
40
41
|
* TOC items config
|
|
@@ -55,37 +56,37 @@ const A = v({
|
|
|
55
56
|
default: 2
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
|
-
setup(
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
setup(e) {
|
|
60
|
+
const { t: o } = v(), t = C(), s = T().appContext.config.globalProperties.$router, a = $(() => s.currentRoute.value), m = (c) => {
|
|
61
|
+
t.value?.scrollTo({ top: c, behavior: "smooth" });
|
|
61
62
|
};
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
() =>
|
|
65
|
-
(
|
|
66
|
-
if (
|
|
63
|
+
return I(() => {
|
|
64
|
+
b(
|
|
65
|
+
() => a.value.hash,
|
|
66
|
+
(c) => {
|
|
67
|
+
if (t.value) {
|
|
67
68
|
const p = document.querySelector(
|
|
68
|
-
`#toc a.toc-link[href$="${
|
|
69
|
+
`#toc a.toc-link[href$="${c}"]`
|
|
69
70
|
);
|
|
70
71
|
if (!p) return;
|
|
71
|
-
const { top:
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const { top: r, height: d } = t.value.getBoundingClientRect(), { top: i, height: f } = p.getBoundingClientRect();
|
|
73
|
+
i < r ? m(t.value.scrollTop + i - r) : i + f > r + d && m(
|
|
74
|
+
t.value.scrollTop + i + f - r - d
|
|
74
75
|
);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
);
|
|
78
79
|
}), () => {
|
|
79
|
-
const
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const c = e.items.length ? u(e.items, e.headerDepth, a.value) || [] : u([], e.headerDepth, a.value) || null;
|
|
81
|
+
return c ? n("div", { class: "toc-place-holder" }, [
|
|
82
|
+
n("aside", { id: "toc" }, [
|
|
83
|
+
n("div", { class: "toc-header" }, [o("vft.mdContainer.tableOfContents")]),
|
|
84
|
+
n("div", { class: "toc-wrapper", ref: t }, [c])
|
|
84
85
|
])
|
|
85
86
|
]) : null;
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
export {
|
|
90
|
-
|
|
91
|
+
w as default
|
|
91
92
|
};
|