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,22 +1,23 @@
|
|
|
1
|
-
import { defineComponent as N, getCurrentInstance as
|
|
2
|
-
import { VftScrollbar as
|
|
1
|
+
import { defineComponent as N, getCurrentInstance as b, inject as A, ref as B, computed as p, createBlock as k, openBlock as n, unref as e, normalizeClass as i, withCtx as S, createElementBlock as u, createCommentVNode as z, Fragment as D, renderList as q, createVNode as R, createTextVNode as x, toDisplayString as L, renderSlot as X } from "vue";
|
|
2
|
+
import { VftScrollbar as j } from "../scrollbar/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
7
|
import "../form/index.js";
|
|
8
|
-
import { useId as
|
|
9
|
-
import { useNamespace as
|
|
8
|
+
import { useId as F } from "../../hooks/use-id/index.js";
|
|
9
|
+
import { useNamespace as J } 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 {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
13
|
+
import { useLocale as K } from "../../locale/use-locale.js";
|
|
14
|
+
import { VftIcon as O } from "../icon/index.js";
|
|
15
|
+
import P from "./node.vue2.js";
|
|
16
|
+
import { CASCADER_PANEL_INJECTION_KEY as W } from "./types.js";
|
|
17
|
+
const Y = N({
|
|
17
18
|
name: "VftCascaderMenu"
|
|
18
|
-
}),
|
|
19
|
-
...
|
|
19
|
+
}), pe = /* @__PURE__ */ N({
|
|
20
|
+
...Y,
|
|
20
21
|
props: {
|
|
21
22
|
nodes: {
|
|
22
23
|
type: Array,
|
|
@@ -28,70 +29,70 @@ const O = N({
|
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
setup(f) {
|
|
31
|
-
const v = f, w =
|
|
32
|
-
let
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
if (!(!
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
const
|
|
32
|
+
const v = f, w = b(), t = J("cascader-menu"), { t: g } = K(), E = F();
|
|
33
|
+
let r, s;
|
|
34
|
+
const l = A(W), a = B(), h = p(() => !v.nodes.length), H = p(() => !l.initialLoaded), y = p(() => `${E.value}-${v.index}`), V = (o) => {
|
|
35
|
+
r = o.target;
|
|
36
|
+
}, I = (o) => {
|
|
37
|
+
if (!(!l.isHoverMenu || !r || !a.value))
|
|
38
|
+
if (r.contains(o.target)) {
|
|
39
|
+
$();
|
|
40
|
+
const m = w.vnode.el, { left: c } = m.getBoundingClientRect(), { offsetWidth: M, offsetHeight: Z } = m, C = o.clientX - c, d = r.offsetTop, T = d + r.offsetHeight;
|
|
40
41
|
a.value.innerHTML = `
|
|
41
42
|
<path style="pointer-events: auto;" fill="transparent" d="M${C} ${d} L${M} 0 V${d} Z" />
|
|
42
|
-
<path style="pointer-events: auto;" fill="transparent" d="M${C} ${T} L${M} ${
|
|
43
|
+
<path style="pointer-events: auto;" fill="transparent" d="M${C} ${T} L${M} ${Z} V${T} Z" />
|
|
43
44
|
`;
|
|
44
|
-
} else
|
|
45
|
-
}, h = () => {
|
|
46
|
-
i && (clearTimeout(i), i = void 0);
|
|
45
|
+
} else s || (s = window.setTimeout(_, l.config.hoverThreshold));
|
|
47
46
|
}, $ = () => {
|
|
48
|
-
|
|
47
|
+
s && (clearTimeout(s), s = void 0);
|
|
48
|
+
}, _ = () => {
|
|
49
|
+
a.value && (a.value.innerHTML = "", $());
|
|
49
50
|
};
|
|
50
|
-
return (
|
|
51
|
-
key:
|
|
51
|
+
return (o, m) => (n(), k(e(j), {
|
|
52
|
+
key: y.value,
|
|
52
53
|
tag: "ul",
|
|
53
54
|
role: "menu",
|
|
54
|
-
class:
|
|
55
|
+
class: i(e(t).b()),
|
|
55
56
|
"wrap-class": e(t).e("wrap"),
|
|
56
|
-
"view-class": [e(t).e("list"), e(t).is("empty",
|
|
57
|
-
onMousemove:
|
|
58
|
-
onMouseleave:
|
|
57
|
+
"view-class": [e(t).e("list"), e(t).is("empty", h.value)],
|
|
58
|
+
onMousemove: I,
|
|
59
|
+
onMouseleave: _
|
|
59
60
|
}, {
|
|
60
|
-
default:
|
|
61
|
-
(
|
|
62
|
-
key:
|
|
63
|
-
node:
|
|
64
|
-
"menu-id":
|
|
65
|
-
onExpand:
|
|
61
|
+
default: S(() => [
|
|
62
|
+
(n(!0), u(D, null, q(f.nodes, (c) => (n(), k(P, {
|
|
63
|
+
key: c.uid,
|
|
64
|
+
node: c,
|
|
65
|
+
"menu-id": y.value,
|
|
66
|
+
onExpand: V
|
|
66
67
|
}, null, 8, ["node", "menu-id"]))), 128)),
|
|
67
|
-
H.value ? (
|
|
68
|
+
H.value ? (n(), u("div", {
|
|
68
69
|
key: 0,
|
|
69
|
-
class:
|
|
70
|
+
class: i(e(t).e("empty-text"))
|
|
70
71
|
}, [
|
|
71
|
-
|
|
72
|
+
R(e(O), {
|
|
72
73
|
icon: "icon-loadding",
|
|
73
74
|
size: "14",
|
|
74
|
-
class:
|
|
75
|
+
class: i(e(t).is("loading"))
|
|
75
76
|
}, null, 8, ["class"]),
|
|
76
|
-
|
|
77
|
-
], 2)) :
|
|
77
|
+
x(" " + L(e(g)("vft.loading")), 1)
|
|
78
|
+
], 2)) : h.value ? (n(), u("div", {
|
|
78
79
|
key: 1,
|
|
79
|
-
class:
|
|
80
|
+
class: i(e(t).e("empty-text"))
|
|
80
81
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
X(o.$slots, "empty", {}, () => [
|
|
83
|
+
x(L(e(g)("vft.noData")), 1)
|
|
83
84
|
])
|
|
84
|
-
], 2)) : e(
|
|
85
|
+
], 2)) : e(l)?.isHoverMenu ? (n(), u("svg", {
|
|
85
86
|
key: 2,
|
|
86
87
|
ref_key: "hoverZone",
|
|
87
88
|
ref: a,
|
|
88
|
-
class:
|
|
89
|
-
}, null, 2)) :
|
|
89
|
+
class: i(e(t).e("hover-zone"))
|
|
90
|
+
}, null, 2)) : z("", !0)
|
|
90
91
|
]),
|
|
91
92
|
_: 3
|
|
92
93
|
}, 8, ["class", "wrap-class", "view-class"]));
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
96
|
export {
|
|
96
|
-
|
|
97
|
+
pe as default
|
|
97
98
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VftClamp as
|
|
1
|
+
import { defineComponent as m, computed as t, createBlock as f, openBlock as i, unref as n, normalizeStyle as x, withCtx as d, createElementBlock as p, createCommentVNode as z, normalizeClass as C, toDisplayString as h } from "vue";
|
|
2
|
+
import { VftClamp as y } from "../clamp/index.js";
|
|
3
3
|
import "@vueuse/core";
|
|
4
4
|
import "@vft/utils";
|
|
5
5
|
import "../config-provider/hooks/use-global-config.js";
|
|
6
|
-
import { generateCssVars as
|
|
6
|
+
import { generateCssVars as T } from "../../utils/ns-cover.js";
|
|
7
7
|
import "lodash-es";
|
|
8
8
|
import "../form/index.js";
|
|
9
|
-
import { useNamespace as
|
|
9
|
+
import { useNamespace as v } 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
|
-
|
|
13
|
+
import { useLocale as k } from "../../locale/use-locale.js";
|
|
14
|
+
const B = ["onClick"], S = m({
|
|
14
15
|
name: "vft-clamp-toggle"
|
|
15
|
-
}),
|
|
16
|
-
...
|
|
16
|
+
}), J = /* @__PURE__ */ m({
|
|
17
|
+
...S,
|
|
17
18
|
props: {
|
|
18
19
|
text: {},
|
|
19
20
|
maxHeight: {},
|
|
@@ -26,15 +27,18 @@ const y = ["onClick"], k = a({
|
|
|
26
27
|
size: {},
|
|
27
28
|
toggleColor: {},
|
|
28
29
|
toggleSize: {},
|
|
29
|
-
toggleText: {
|
|
30
|
+
toggleText: {}
|
|
30
31
|
},
|
|
31
32
|
setup(e) {
|
|
32
|
-
const
|
|
33
|
+
const { t: o } = k(), s = v("clamp-toggle"), c = t(() => [
|
|
34
|
+
o("vft.clampToggle.expand"),
|
|
35
|
+
o("vft.clampToggle.collapse")
|
|
36
|
+
]), l = t(() => e.toggleText || c.value), r = t(() => T(
|
|
33
37
|
{ color: e.color, size: e.size, toggleColor: e.toggleColor, toggleSize: e.toggleSize },
|
|
34
38
|
"clamp-toggle"
|
|
35
39
|
));
|
|
36
|
-
return (
|
|
37
|
-
style:
|
|
40
|
+
return (L, V) => (i(), f(n(y), {
|
|
41
|
+
style: x(r.value),
|
|
38
42
|
text: e.text,
|
|
39
43
|
"max-height": e.maxHeight,
|
|
40
44
|
"max-lines": e.maxLines,
|
|
@@ -43,17 +47,17 @@ const y = ["onClick"], k = a({
|
|
|
43
47
|
ellipsis: e.ellipsis,
|
|
44
48
|
"auto-resize": e.autoResize
|
|
45
49
|
}, {
|
|
46
|
-
after: d(({ toggle:
|
|
47
|
-
|
|
50
|
+
after: d(({ toggle: g, expanded: a, clamped: u }) => [
|
|
51
|
+
a || u ? (i(), p("span", {
|
|
48
52
|
key: 0,
|
|
49
|
-
class:
|
|
50
|
-
onClick:
|
|
51
|
-
},
|
|
53
|
+
class: C(["cursor-pointer", [n(s).e("more")]]),
|
|
54
|
+
onClick: g
|
|
55
|
+
}, h(a ? l.value[1] : l.value[0]), 11, B)) : z("", !0)
|
|
52
56
|
]),
|
|
53
57
|
_: 1
|
|
54
58
|
}, 8, ["style", "text", "max-height", "max-lines", "expanded", "location", "ellipsis", "auto-resize"]));
|
|
55
59
|
}
|
|
56
60
|
});
|
|
57
61
|
export {
|
|
58
|
-
|
|
62
|
+
J as default
|
|
59
63
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ClickOutside as
|
|
3
|
-
import { VftButton as
|
|
1
|
+
import { defineComponent as j, ref as c, reactive as ce, computed as h, onMounted as ue, watch as C, nextTick as V, provide as me, createBlock as y, openBlock as d, unref as e, withCtx as E, createElementVNode as u, withKeys as H, normalizeClass as r, createElementBlock as M, createCommentVNode as x, normalizeStyle as de, withDirectives as O, createVNode as p, vShow as pe, createTextVNode as R, toDisplayString as U } from "vue";
|
|
2
|
+
import { ClickOutside as fe } from "@vft/directives";
|
|
3
|
+
import { VftButton as _ } from "../button/index.js";
|
|
4
4
|
import "../form/index.js";
|
|
5
|
-
import { VftIcon as
|
|
6
|
-
import { VftInput as
|
|
7
|
-
import { VftTooltip as
|
|
8
|
-
import { UPDATE_MODEL_EVENT as P, CHANGE_EVENT as
|
|
5
|
+
import { VftIcon as G } from "../icon/index.js";
|
|
6
|
+
import { VftInput as ve } from "../input/index.js";
|
|
7
|
+
import { VftTooltip as be } from "../tooltip/index.js";
|
|
8
|
+
import { UPDATE_MODEL_EVENT as P, CHANGE_EVENT as he } from "../../constants/event.js";
|
|
9
9
|
import "@vueuse/core";
|
|
10
10
|
import "@vft/utils";
|
|
11
|
-
import { debugWarn as
|
|
11
|
+
import { debugWarn as W } from "../../utils/error.js";
|
|
12
12
|
import "../config-provider/hooks/use-global-config.js";
|
|
13
|
-
import { debounce as
|
|
14
|
-
import { useNamespace as
|
|
13
|
+
import { debounce as ke } from "lodash-es";
|
|
14
|
+
import { useNamespace as we } from "../../hooks/use-namespace/index.js";
|
|
15
15
|
import "../../hooks/use-model-toggle/index.js";
|
|
16
16
|
import "@popperjs/core";
|
|
17
17
|
import "../../hooks/use-z-index/index.js";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { colorPickerContextKey as
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
18
|
+
import ge from "./components/alpha-slider.vue2.js";
|
|
19
|
+
import Ce from "./components/hue-slider.vue.js";
|
|
20
|
+
import Ve from "./components/predefine.vue.js";
|
|
21
|
+
import ye from "./components/sv-panel.vue.js";
|
|
22
|
+
import { colorPickerContextKey as Ee } from "./contants.js";
|
|
23
|
+
import z from "./utils/color.js";
|
|
24
|
+
import { useLocale as xe } from "../../locale/use-locale.js";
|
|
25
|
+
import { useFormItem as Ae, useFormItemInputId as Ie } from "../form/hooks/use-form-item.js";
|
|
26
|
+
import { useFormSize as Se, useFormDisabled as $e } from "../form/hooks/use-form-common-props.js";
|
|
27
|
+
const Pe = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex"], ze = j({
|
|
27
28
|
name: "VftColorPicker"
|
|
28
|
-
}),
|
|
29
|
-
...
|
|
29
|
+
}), to = /* @__PURE__ */ j({
|
|
30
|
+
...ze,
|
|
30
31
|
props: {
|
|
31
32
|
modelValue: {},
|
|
32
33
|
id: {},
|
|
@@ -42,232 +43,232 @@ const Ie = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex
|
|
|
42
43
|
},
|
|
43
44
|
emits: [
|
|
44
45
|
P,
|
|
45
|
-
|
|
46
|
+
he,
|
|
46
47
|
"activeChange",
|
|
47
48
|
"click-outside"
|
|
48
49
|
],
|
|
49
|
-
setup(
|
|
50
|
-
const a =
|
|
51
|
-
formItemContext:
|
|
52
|
-
}),
|
|
53
|
-
let
|
|
54
|
-
const t =
|
|
55
|
-
new
|
|
50
|
+
setup(n, { expose: q, emit: J }) {
|
|
51
|
+
const { t: f } = xe(), a = n, m = J, l = we("color"), { formItem: k } = Ae(), Q = Se(), A = $e(), { inputId: X, isLabeledByFormItem: B } = Ie(a, {
|
|
52
|
+
formItemContext: k
|
|
53
|
+
}), F = c(), Y = c(), N = c(), Z = c();
|
|
54
|
+
let I = !0;
|
|
55
|
+
const t = ce(
|
|
56
|
+
new z({
|
|
56
57
|
enableAlpha: a.showAlpha,
|
|
57
58
|
format: a.colorFormat || "",
|
|
58
59
|
value: a.modelValue
|
|
59
60
|
})
|
|
60
|
-
),
|
|
61
|
+
), v = c(!1), i = c(!1), b = c(""), ee = h(() => !a.modelValue && !i.value ? "transparent" : te(t, a.showAlpha)), S = h(() => !a.modelValue && !i.value ? "" : t.value), oe = h(() => B.value ? void 0 : a.label || f("colorPicker")), le = h(() => B.value ? k?.labelId : void 0), ae = h(() => [
|
|
61
62
|
l.b("picker"),
|
|
62
|
-
l.is("disabled",
|
|
63
|
-
l.bm("picker",
|
|
63
|
+
l.is("disabled", A.value),
|
|
64
|
+
l.bm("picker", Q.value)
|
|
64
65
|
]);
|
|
65
|
-
function
|
|
66
|
-
if (!(o instanceof
|
|
66
|
+
function te(o, s) {
|
|
67
|
+
if (!(o instanceof z))
|
|
67
68
|
throw new TypeError("color should be instance of _color Class");
|
|
68
|
-
const { r:
|
|
69
|
-
return
|
|
69
|
+
const { r: g, g: K, b: L } = o.toRgb();
|
|
70
|
+
return s ? `rgba(${g}, ${K}, ${L}, ${o.get("alpha") / 100})` : `rgb(${g}, ${K}, ${L})`;
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
72
|
+
function re(o) {
|
|
73
|
+
v.value = o;
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
76
|
-
|
|
75
|
+
const w = ke(re, 100);
|
|
76
|
+
function ne(o) {
|
|
77
|
+
w(!1), $(), m("click-outside", o);
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
a.modelValue ? t.fromString(a.modelValue) : (t.value = "",
|
|
81
|
-
|
|
79
|
+
function $() {
|
|
80
|
+
V(() => {
|
|
81
|
+
a.modelValue ? t.fromString(a.modelValue) : (t.value = "", V(() => {
|
|
82
|
+
i.value = !1;
|
|
82
83
|
}));
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
function N() {
|
|
86
|
-
x.value || k(!f.value);
|
|
87
|
-
}
|
|
88
86
|
function T() {
|
|
89
|
-
|
|
87
|
+
A.value || w(!v.value);
|
|
88
|
+
}
|
|
89
|
+
function D() {
|
|
90
|
+
t.fromString(b.value);
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function ie() {
|
|
92
93
|
const o = t.value;
|
|
93
|
-
|
|
94
|
-
const
|
|
94
|
+
m(P, o), m("change", o), a.validateEvent && k?.validate("change").catch((s) => W(s)), w(!1), V(() => {
|
|
95
|
+
const s = new z({
|
|
95
96
|
enableAlpha: a.showAlpha,
|
|
96
97
|
format: a.colorFormat || "",
|
|
97
98
|
value: a.modelValue
|
|
98
99
|
});
|
|
99
|
-
t.compare(
|
|
100
|
+
t.compare(s) || $();
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
103
|
+
function se() {
|
|
104
|
+
w(!1), m(P, null), m("change", null), a.modelValue !== null && a.validateEvent && k?.validate("change").catch((o) => W(o)), $();
|
|
104
105
|
}
|
|
105
|
-
return
|
|
106
|
-
a.modelValue && (
|
|
107
|
-
}),
|
|
106
|
+
return ue(() => {
|
|
107
|
+
a.modelValue && (b.value = S.value);
|
|
108
|
+
}), C(
|
|
108
109
|
() => a.modelValue,
|
|
109
110
|
(o) => {
|
|
110
|
-
o ? o && o !== t.value && (
|
|
111
|
+
o ? o && o !== t.value && (I = !1, t.fromString(o)) : i.value = !1;
|
|
111
112
|
}
|
|
112
|
-
),
|
|
113
|
-
() =>
|
|
113
|
+
), C(
|
|
114
|
+
() => S.value,
|
|
114
115
|
(o) => {
|
|
115
|
-
|
|
116
|
+
b.value = o, I && m("activeChange", o), I = !0;
|
|
116
117
|
}
|
|
117
|
-
),
|
|
118
|
+
), C(
|
|
118
119
|
() => t.value,
|
|
119
120
|
() => {
|
|
120
|
-
!a.modelValue && !
|
|
121
|
+
!a.modelValue && !i.value && (i.value = !0);
|
|
121
122
|
}
|
|
122
|
-
),
|
|
123
|
-
() =>
|
|
123
|
+
), C(
|
|
124
|
+
() => v.value,
|
|
124
125
|
() => {
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
V(() => {
|
|
127
|
+
F.value?.update(), Y.value?.update(), N.value?.update();
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
|
-
),
|
|
130
|
-
currentColor:
|
|
131
|
-
}),
|
|
130
|
+
), me(Ee, {
|
|
131
|
+
currentColor: S
|
|
132
|
+
}), q({
|
|
132
133
|
/**
|
|
133
134
|
* @description current color object
|
|
134
135
|
*/
|
|
135
136
|
color: t,
|
|
136
|
-
showPicker:
|
|
137
|
-
}), (o,
|
|
137
|
+
showPicker: v
|
|
138
|
+
}), (o, s) => (d(), y(e(be), {
|
|
138
139
|
ref_key: "popper",
|
|
139
|
-
ref:
|
|
140
|
-
visible:
|
|
140
|
+
ref: Z,
|
|
141
|
+
visible: v.value,
|
|
141
142
|
"show-arrow": !1,
|
|
142
143
|
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
143
144
|
offset: 0,
|
|
144
145
|
"gpu-acceleration": !1,
|
|
145
|
-
"popper-class": [e(l).be("picker", "panel"), e(l).b("dropdown"),
|
|
146
|
+
"popper-class": [e(l).be("picker", "panel"), e(l).b("dropdown"), n.popperClass],
|
|
146
147
|
"stop-popper-mouse-event": !1,
|
|
147
148
|
effect: "light",
|
|
148
149
|
trigger: "click",
|
|
149
150
|
transition: `${e(l).namespace.value}-zoom-in-top`,
|
|
150
151
|
persistent: ""
|
|
151
152
|
}, {
|
|
152
|
-
content:
|
|
153
|
-
|
|
153
|
+
content: E(() => [
|
|
154
|
+
O((d(), M("div", null, [
|
|
154
155
|
u("div", {
|
|
155
|
-
class:
|
|
156
|
+
class: r(e(l).be("dropdown", "main-wrapper"))
|
|
156
157
|
}, [
|
|
157
|
-
p(
|
|
158
|
+
p(Ce, {
|
|
158
159
|
ref_key: "hue",
|
|
159
|
-
ref:
|
|
160
|
+
ref: F,
|
|
160
161
|
class: "hue-slider",
|
|
161
162
|
color: t,
|
|
162
163
|
vertical: ""
|
|
163
164
|
}, null, 8, ["color"]),
|
|
164
|
-
p(
|
|
165
|
+
p(ye, {
|
|
165
166
|
ref: "svPanel",
|
|
166
167
|
color: t
|
|
167
168
|
}, null, 8, ["color"])
|
|
168
169
|
], 2),
|
|
169
|
-
|
|
170
|
+
n.showAlpha ? (d(), y(ge, {
|
|
170
171
|
key: 0,
|
|
171
172
|
ref_key: "alpha",
|
|
172
|
-
ref:
|
|
173
|
+
ref: N,
|
|
173
174
|
color: t
|
|
174
|
-
}, null, 8, ["color"])) :
|
|
175
|
-
|
|
175
|
+
}, null, 8, ["color"])) : x("", !0),
|
|
176
|
+
n.predefine ? (d(), y(Ve, {
|
|
176
177
|
key: 1,
|
|
177
178
|
ref: "predefine",
|
|
178
179
|
color: t,
|
|
179
|
-
colors:
|
|
180
|
-
}, null, 8, ["color", "colors"])) :
|
|
180
|
+
colors: n.predefine
|
|
181
|
+
}, null, 8, ["color", "colors"])) : x("", !0),
|
|
181
182
|
u("div", {
|
|
182
|
-
class:
|
|
183
|
+
class: r(e(l).be("dropdown", "btns"))
|
|
183
184
|
}, [
|
|
184
185
|
u("span", {
|
|
185
|
-
class:
|
|
186
|
+
class: r(e(l).be("dropdown", "value"))
|
|
186
187
|
}, [
|
|
187
|
-
p(e(
|
|
188
|
-
modelValue:
|
|
189
|
-
"onUpdate:modelValue":
|
|
188
|
+
p(e(ve), {
|
|
189
|
+
modelValue: b.value,
|
|
190
|
+
"onUpdate:modelValue": s[0] || (s[0] = (g) => b.value = g),
|
|
190
191
|
"validate-event": !1,
|
|
191
192
|
size: "small",
|
|
192
|
-
onKeyup:
|
|
193
|
-
onBlur:
|
|
193
|
+
onKeyup: H(D, ["enter"]),
|
|
194
|
+
onBlur: D
|
|
194
195
|
}, null, 8, ["modelValue"])
|
|
195
196
|
], 2),
|
|
196
|
-
p(e(
|
|
197
|
-
class:
|
|
197
|
+
p(e(_), {
|
|
198
|
+
class: r(e(l).be("dropdown", "link-btn")),
|
|
198
199
|
text: "",
|
|
199
200
|
size: "small",
|
|
200
|
-
onClick:
|
|
201
|
+
onClick: se
|
|
201
202
|
}, {
|
|
202
|
-
default:
|
|
203
|
-
|
|
204
|
-
])
|
|
203
|
+
default: E(() => [
|
|
204
|
+
R(U(e(f)("clear")), 1)
|
|
205
|
+
]),
|
|
205
206
|
_: 1
|
|
206
207
|
}, 8, ["class"]),
|
|
207
|
-
p(e(
|
|
208
|
+
p(e(_), {
|
|
208
209
|
plain: "",
|
|
209
210
|
size: "small",
|
|
210
|
-
class:
|
|
211
|
-
onClick:
|
|
211
|
+
class: r(e(l).be("dropdown", "btn")),
|
|
212
|
+
onClick: ie
|
|
212
213
|
}, {
|
|
213
|
-
default:
|
|
214
|
-
|
|
215
|
-
])
|
|
214
|
+
default: E(() => [
|
|
215
|
+
R(U(e(f)("confirm")), 1)
|
|
216
|
+
]),
|
|
216
217
|
_: 1
|
|
217
218
|
}, 8, ["class"])
|
|
218
219
|
], 2)
|
|
219
220
|
])), [
|
|
220
|
-
[e(
|
|
221
|
+
[e(fe), ne]
|
|
221
222
|
])
|
|
222
223
|
]),
|
|
223
|
-
default:
|
|
224
|
+
default: E(() => [
|
|
224
225
|
u("div", {
|
|
225
|
-
id: e(
|
|
226
|
-
class:
|
|
226
|
+
id: e(X),
|
|
227
|
+
class: r(ae.value),
|
|
227
228
|
role: "button",
|
|
228
|
-
"aria-label":
|
|
229
|
-
"aria-labelledby":
|
|
230
|
-
"aria-description":
|
|
231
|
-
tabindex:
|
|
232
|
-
onKeydown:
|
|
229
|
+
"aria-label": oe.value,
|
|
230
|
+
"aria-labelledby": le.value,
|
|
231
|
+
"aria-description": `${e(f)("currentColor")} {color}。${e(f)("pressEnter")} ${n.modelValue}`,
|
|
232
|
+
tabindex: n.tabindex,
|
|
233
|
+
onKeydown: H(T, ["enter"])
|
|
233
234
|
}, [
|
|
234
|
-
e(
|
|
235
|
+
e(A) ? (d(), M("div", {
|
|
235
236
|
key: 0,
|
|
236
|
-
class:
|
|
237
|
-
}, null, 2)) :
|
|
237
|
+
class: r(e(l).be("picker", "mask"))
|
|
238
|
+
}, null, 2)) : x("", !0),
|
|
238
239
|
u("div", {
|
|
239
|
-
class:
|
|
240
|
-
onClick:
|
|
240
|
+
class: r(e(l).be("picker", "trigger")),
|
|
241
|
+
onClick: T
|
|
241
242
|
}, [
|
|
242
243
|
u("span", {
|
|
243
|
-
class:
|
|
244
|
+
class: r([e(l).be("picker", "color"), e(l).is("alpha", n.showAlpha)])
|
|
244
245
|
}, [
|
|
245
246
|
u("span", {
|
|
246
|
-
class:
|
|
247
|
-
style:
|
|
248
|
-
backgroundColor:
|
|
247
|
+
class: r(e(l).be("picker", "color-inner")),
|
|
248
|
+
style: de({
|
|
249
|
+
backgroundColor: ee.value
|
|
249
250
|
})
|
|
250
251
|
}, [
|
|
251
|
-
|
|
252
|
+
O(p(e(G), {
|
|
252
253
|
icon: "icon-arrow-down",
|
|
253
|
-
class:
|
|
254
|
+
class: r([e(l).be("picker", "icon"), e(l).is("icon-arrow-down")])
|
|
254
255
|
}, null, 8, ["class"]), [
|
|
255
|
-
[
|
|
256
|
+
[pe, n.modelValue || i.value]
|
|
256
257
|
]),
|
|
257
|
-
!
|
|
258
|
+
!n.modelValue && !i.value ? (d(), y(e(G), {
|
|
258
259
|
key: 0,
|
|
259
260
|
icon: "icon-circle-close",
|
|
260
|
-
class:
|
|
261
|
-
}, null, 8, ["class"])) :
|
|
261
|
+
class: r([e(l).be("picker", "empty"), e(l).is("icon-close")])
|
|
262
|
+
}, null, 8, ["class"])) : x("", !0)
|
|
262
263
|
], 6)
|
|
263
264
|
], 2)
|
|
264
265
|
], 2)
|
|
265
|
-
], 42,
|
|
266
|
+
], 42, Pe)
|
|
266
267
|
]),
|
|
267
268
|
_: 1
|
|
268
269
|
}, 8, ["visible", "popper-class", "transition"]));
|
|
269
270
|
}
|
|
270
271
|
});
|
|
271
272
|
export {
|
|
272
|
-
|
|
273
|
+
to as default
|
|
273
274
|
};
|