vft 0.0.507 → 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/carousel/use-carousel.js +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/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- 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/es/utils/vue/vnode.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/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 +3 -3
- 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,38 +1,39 @@
|
|
|
1
1
|
import "../../pagination/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { useLocale as et } from "../../../locale/use-locale.js";
|
|
3
|
+
import { isFunction as E, isBoolean as at, delObjAttrNotExist as rt, isString as nt, isEmptyObject as it, isNullOrUndefined as M, isObject as k, isNumber as q, isPlainObject as ot } from "@vft/utils";
|
|
4
|
+
import { merge as st, get as H } from "lodash-es";
|
|
5
|
+
import { ref as B, watchEffect as lt, unref as i, watch as L, computed as ct, onMounted as ut, nextTick as U } from "vue";
|
|
6
|
+
import { PageSize as ft } from "../constants.js";
|
|
7
|
+
function pt(m, {
|
|
7
8
|
tableData: V,
|
|
8
|
-
setLoading:
|
|
9
|
+
setLoading: O,
|
|
9
10
|
getPaginationInfo: D,
|
|
10
11
|
setPagination: h,
|
|
11
12
|
getGridRef: C
|
|
12
|
-
},
|
|
13
|
-
const f =
|
|
14
|
-
|
|
13
|
+
}, P) {
|
|
14
|
+
const { t: W } = et(), f = B([]), x = B({});
|
|
15
|
+
lt(() => {
|
|
15
16
|
V.value = i(f);
|
|
16
17
|
}), L(
|
|
17
18
|
() => i(m).data,
|
|
18
19
|
() => {
|
|
19
|
-
const { data:
|
|
20
|
-
!
|
|
20
|
+
const { data: t, api: e } = i(m);
|
|
21
|
+
!e && t && (f.value = t);
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
immediate: !0
|
|
24
25
|
}
|
|
25
26
|
);
|
|
26
|
-
function
|
|
27
|
-
h(
|
|
27
|
+
function X(t) {
|
|
28
|
+
h(t), T({});
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
return !
|
|
30
|
+
const z = ct(() => {
|
|
31
|
+
const t = i(f);
|
|
32
|
+
return !t || t.length === 0 ? i(f) : i(f);
|
|
32
33
|
});
|
|
33
|
-
async function T(
|
|
34
|
+
async function T(t) {
|
|
34
35
|
const {
|
|
35
|
-
api:
|
|
36
|
+
api: e,
|
|
36
37
|
fetchSetting: r = {},
|
|
37
38
|
beforeFetch: a,
|
|
38
39
|
afterFetch: o,
|
|
@@ -41,9 +42,9 @@ function he(m, {
|
|
|
41
42
|
transformParams: w,
|
|
42
43
|
extraParams: u
|
|
43
44
|
} = i(m);
|
|
44
|
-
if (!(!
|
|
45
|
+
if (!(!e || !E(e)))
|
|
45
46
|
try {
|
|
46
|
-
|
|
47
|
+
O(!0);
|
|
47
48
|
const { pageField: n, sizeField: d, listField: I, totalField: y } = Object.assign(
|
|
48
49
|
{},
|
|
49
50
|
{
|
|
@@ -54,28 +55,28 @@ function he(m, {
|
|
|
54
55
|
},
|
|
55
56
|
r
|
|
56
57
|
);
|
|
57
|
-
let g = {}, l =
|
|
58
|
-
const { currentPage: j = 1, pageSize: _ =
|
|
58
|
+
let g = {}, l = t;
|
|
59
|
+
const { currentPage: j = 1, pageSize: _ = ft } = i(
|
|
59
60
|
D
|
|
60
61
|
);
|
|
61
62
|
if (w) {
|
|
62
|
-
if (
|
|
63
|
+
if (at(s) && !s)
|
|
63
64
|
g = {};
|
|
64
65
|
else {
|
|
65
|
-
const p =
|
|
66
|
+
const p = t && t.page || j;
|
|
66
67
|
g[n] = s?.pageIsZero ? p - 1 : p, g[d] = _;
|
|
67
68
|
}
|
|
68
|
-
if (l =
|
|
69
|
+
if (l = st(t, g), a && E(a)) {
|
|
69
70
|
const p = await a(l);
|
|
70
71
|
l = { ...l, ...p };
|
|
71
72
|
}
|
|
72
|
-
c &&
|
|
73
|
+
c && rt(
|
|
73
74
|
l,
|
|
74
|
-
|
|
75
|
+
nt(c) ? c === "strict" : !1
|
|
75
76
|
);
|
|
76
77
|
}
|
|
77
|
-
l && !
|
|
78
|
-
const F = await
|
|
78
|
+
l && !it(l) && !M(u) ? k(l) && k(u) && (l = Object.assign({}, l, u)) : M(u) || (l = u);
|
|
79
|
+
const F = await e(l), N = Array.isArray(F);
|
|
79
80
|
let b = N ? F : H(F, I);
|
|
80
81
|
const S = N ? F.length : H(F, y);
|
|
81
82
|
if (Number(S)) {
|
|
@@ -83,57 +84,57 @@ function he(m, {
|
|
|
83
84
|
if (j > p)
|
|
84
85
|
return h({
|
|
85
86
|
currentPage: p
|
|
86
|
-
}), await T(
|
|
87
|
+
}), await T(t);
|
|
87
88
|
}
|
|
88
|
-
return o &&
|
|
89
|
+
return o && E(o) && (b = await o(b) || b), f.value = b, x.value = b, h({
|
|
89
90
|
total: S || 0
|
|
90
|
-
}),
|
|
91
|
-
currentPage:
|
|
92
|
-
}),
|
|
91
|
+
}), t && t.page && h({
|
|
92
|
+
currentPage: t.page || 1
|
|
93
|
+
}), P("fetch-success", {
|
|
93
94
|
items: i(b),
|
|
94
95
|
total: S
|
|
95
96
|
}), b;
|
|
96
97
|
} catch (n) {
|
|
97
|
-
console.log(n),
|
|
98
|
+
console.log(n), P("fetch-error", n), f.value = [], h({
|
|
98
99
|
total: 0
|
|
99
100
|
});
|
|
100
101
|
} finally {
|
|
101
102
|
U(() => {
|
|
102
|
-
|
|
103
|
+
O(!1);
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
function v() {
|
|
107
|
-
return
|
|
108
|
+
return x.value;
|
|
108
109
|
}
|
|
109
|
-
async function
|
|
110
|
+
async function Z(t) {
|
|
110
111
|
return h({
|
|
111
|
-
currentPage:
|
|
112
|
-
}), await T(
|
|
112
|
+
currentPage: t?.page || 1
|
|
113
|
+
}), await T(t);
|
|
113
114
|
}
|
|
114
|
-
async function
|
|
115
|
-
return f.value[
|
|
115
|
+
async function J(t, e, r) {
|
|
116
|
+
return f.value[t] && (f.value[t][e] = r), f.value[t];
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
const r = C(), a = r.getRowById(
|
|
118
|
+
function Q(t, e) {
|
|
119
|
+
const r = C(), a = r.getRowById(t);
|
|
119
120
|
if (!a) return;
|
|
120
121
|
const s = i(m).treeConfig;
|
|
121
122
|
if (!!s && s?.parentField) {
|
|
122
|
-
const w = s.parentField, u = a[w], n =
|
|
123
|
+
const w = s.parentField, u = a[w], n = e[w], d = (g) => g == null || g === "" ? null : g, I = d(u), y = d(n);
|
|
123
124
|
if (I !== y) {
|
|
124
125
|
if (r.remove(a), y !== null) {
|
|
125
126
|
const l = r.getRowById(y);
|
|
126
|
-
l ? r.insertChild(
|
|
127
|
+
l ? r.insertChild(e, l) : r.insert(e);
|
|
127
128
|
} else
|
|
128
|
-
r.insert(
|
|
129
|
+
r.insert(e);
|
|
129
130
|
const g = s.rowField || "id";
|
|
130
|
-
return r.getRowById(
|
|
131
|
+
return r.getRowById(e[g]);
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
return r.setRow(a,
|
|
134
|
+
return r.setRow(a, e), a;
|
|
134
135
|
}
|
|
135
|
-
async function
|
|
136
|
-
const a =
|
|
136
|
+
async function Y(t, e = 0, r) {
|
|
137
|
+
const a = ot(t) ? [t] : t, o = a.length, s = i(m), c = C();
|
|
137
138
|
if (!!s.treeConfig)
|
|
138
139
|
if (r != null && r !== "") {
|
|
139
140
|
const n = c.getRowById(r);
|
|
@@ -146,7 +147,7 @@ function he(m, {
|
|
|
146
147
|
} else
|
|
147
148
|
for (const n of a)
|
|
148
149
|
await c.insert(n);
|
|
149
|
-
else if (
|
|
150
|
+
else if (e === -1)
|
|
150
151
|
for (const n of a)
|
|
151
152
|
await c.insertAt(n, -1);
|
|
152
153
|
else
|
|
@@ -160,55 +161,55 @@ function he(m, {
|
|
|
160
161
|
}
|
|
161
162
|
return i(f);
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
-
const r = C(), a =
|
|
164
|
+
function $(t, e) {
|
|
165
|
+
const r = C(), a = t != null ? Array.isArray(t) ? t : [t] : e != null ? Array.isArray(e) ? e.map((s) => r.getRowById(s)).filter(Boolean) : r.getRowById(e) ? [r.getRowById(e)] : [] : [];
|
|
165
166
|
if (!a.length) return;
|
|
166
167
|
r.remove(a);
|
|
167
168
|
const { total: o } = i(D);
|
|
168
169
|
q(o) && h({ total: Math.max(0, o - a.length) });
|
|
169
170
|
}
|
|
170
|
-
function A(
|
|
171
|
-
f.value =
|
|
171
|
+
function A(t) {
|
|
172
|
+
f.value = t;
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
174
|
+
function G() {
|
|
175
|
+
return z.value;
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
177
|
+
function K(t) {
|
|
178
|
+
const e = String(t).trim().toLowerCase();
|
|
179
|
+
if (e) {
|
|
179
180
|
const r = v?.()?.filter((a) => {
|
|
180
181
|
for (const o in a)
|
|
181
|
-
if (String(a[o]).trim().toLowerCase()?.includes(
|
|
182
|
+
if (String(a[o]).trim().toLowerCase()?.includes(e))
|
|
182
183
|
return !0;
|
|
183
184
|
});
|
|
184
185
|
A(r);
|
|
185
186
|
} else
|
|
186
187
|
A(v());
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
-
const
|
|
190
|
-
!
|
|
191
|
-
if (
|
|
192
|
-
|
|
189
|
+
function tt(t) {
|
|
190
|
+
const e = C();
|
|
191
|
+
!e || !i(m).treeConfig || U(() => {
|
|
192
|
+
if (t === void 0 || t === -1) {
|
|
193
|
+
e.setAllTreeExpand(!0);
|
|
193
194
|
return;
|
|
194
195
|
}
|
|
195
|
-
const o =
|
|
196
|
+
const o = e.getTableData().tableData;
|
|
196
197
|
if (!o || o.length === 0) {
|
|
197
|
-
console.warn("
|
|
198
|
+
console.warn(W("vft.tableError.noDataToExpand"));
|
|
198
199
|
return;
|
|
199
200
|
}
|
|
200
201
|
const s = [], c = (w, u) => {
|
|
201
|
-
u >
|
|
202
|
-
u <=
|
|
202
|
+
u > t || w.forEach((n) => {
|
|
203
|
+
u <= t && s.push(n);
|
|
203
204
|
const d = n._X_ROW_CHILD;
|
|
204
|
-
d && d.length > 0 && u <
|
|
205
|
+
d && d.length > 0 && u < t && c(d, u + 1);
|
|
205
206
|
});
|
|
206
207
|
};
|
|
207
|
-
c(o, 1), s.length > 0 &&
|
|
208
|
+
c(o, 1), s.length > 0 && e.setTreeExpand(s, !0);
|
|
208
209
|
});
|
|
209
210
|
}
|
|
210
|
-
const R =
|
|
211
|
-
return
|
|
211
|
+
const R = B(!0);
|
|
212
|
+
return ut(() => {
|
|
212
213
|
i(m).immediate && T(), R.value = !1;
|
|
213
214
|
}), L(
|
|
214
215
|
() => i(m).api,
|
|
@@ -217,19 +218,19 @@ function he(m, {
|
|
|
217
218
|
}
|
|
218
219
|
), {
|
|
219
220
|
setTableData: A,
|
|
220
|
-
updateTableData:
|
|
221
|
-
updateTableDataRecord:
|
|
222
|
-
insertTableDataRecord:
|
|
223
|
-
deleteTableDataRecord:
|
|
224
|
-
reload:
|
|
225
|
-
handleTableChange:
|
|
226
|
-
getDataSourceRef:
|
|
227
|
-
getDataSource:
|
|
221
|
+
updateTableData: J,
|
|
222
|
+
updateTableDataRecord: Q,
|
|
223
|
+
insertTableDataRecord: Y,
|
|
224
|
+
deleteTableDataRecord: $,
|
|
225
|
+
reload: Z,
|
|
226
|
+
handleTableChange: X,
|
|
227
|
+
getDataSourceRef: z,
|
|
228
|
+
getDataSource: G,
|
|
228
229
|
getRawDataSource: v,
|
|
229
|
-
tableSearch:
|
|
230
|
-
expandTreeLevel:
|
|
230
|
+
tableSearch: K,
|
|
231
|
+
expandTreeLevel: tt
|
|
231
232
|
};
|
|
232
233
|
}
|
|
233
234
|
export {
|
|
234
|
-
|
|
235
|
+
pt as useDataSource
|
|
235
236
|
};
|
|
@@ -1,109 +1,110 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Q, inject as W, ref as w, computed as d, createBlock as X, openBlock as T, Transition as Z, withCtx as ee, createElementBlock as te, createCommentVNode as ne, normalizeClass as r, unref as n, createElementVNode as p, createVNode as oe, toDisplayString as A } from "vue";
|
|
2
2
|
import f from "dayjs";
|
|
3
|
-
import { EVENT_CODE as
|
|
3
|
+
import { EVENT_CODE as se } from "../../../constants/aria.js";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { isUndefined as
|
|
5
|
+
import { isUndefined as ae } from "@vft/utils";
|
|
6
6
|
import "../../config-provider/hooks/use-global-config.js";
|
|
7
7
|
import "lodash-es";
|
|
8
8
|
import "../../form/index.js";
|
|
9
|
-
import { useNamespace as
|
|
9
|
+
import { useNamespace as ie } 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
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
|
|
13
|
+
import { useLocale as re } from "../../../locale/use-locale.js";
|
|
14
|
+
import { PICKER_BASE_INJECTION_KEY as le } from "../constants.js";
|
|
15
|
+
import { panelTimePickerProps as ce } from "../props/panel-time-picker.js";
|
|
16
|
+
import { useTimePanel as pe } from "../composables/use-time-panel.js";
|
|
17
|
+
import { useOldValue as me, buildAvailableTimeSlotGetter as ue } from "../composables/use-time-picker.js";
|
|
18
|
+
import de from "./basic-time-spinner.vue2.js";
|
|
19
|
+
const Pe = /* @__PURE__ */ Q({
|
|
19
20
|
__name: "panel-time-pick",
|
|
20
|
-
props:
|
|
21
|
+
props: ce,
|
|
21
22
|
emits: ["pick", "select-range", "set-picker-option"],
|
|
22
|
-
setup(
|
|
23
|
-
const
|
|
24
|
-
arrowControl:
|
|
23
|
+
setup(R, { emit: E }) {
|
|
24
|
+
const o = R, s = E, _ = W(le), {
|
|
25
|
+
arrowControl: D,
|
|
25
26
|
disabledHours: b,
|
|
26
27
|
disabledMinutes: g,
|
|
27
28
|
disabledSeconds: v,
|
|
28
|
-
defaultValue:
|
|
29
|
-
} =
|
|
30
|
-
const t = f(e).locale(
|
|
29
|
+
defaultValue: N
|
|
30
|
+
} = _.props, { getAvailableHours: O, getAvailableMinutes: P, getAvailableSeconds: y } = ue(b, g, v), i = ie("time"), { t: k } = re(), m = w("zh-cn"), h = w([0, 2]), I = me(o), B = d(() => ae(o.actualVisible) ? `${i.namespace.value}-zoom-in-top` : ""), l = d(() => o.format.includes("ss")), K = d(() => o.format.includes("A") ? "A" : o.format.includes("a") ? "a" : ""), x = (e) => {
|
|
31
|
+
const t = f(e).locale(m.value), a = u(t);
|
|
31
32
|
return t.isSame(a);
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
t ||
|
|
36
|
-
}, z = (e) => {
|
|
37
|
-
if (!n.visible)
|
|
38
|
-
return;
|
|
39
|
-
const t = m(e).millisecond(0);
|
|
40
|
-
o("pick", t, !0);
|
|
41
|
-
}, M = (e, t) => {
|
|
42
|
-
o("select-range", e, t), k.value = [e, t];
|
|
33
|
+
}, z = () => {
|
|
34
|
+
s("pick", I.value, !1);
|
|
35
|
+
}, M = (e = !1, t = !1) => {
|
|
36
|
+
t || s("pick", o.parsedValue, e);
|
|
43
37
|
}, U = (e) => {
|
|
38
|
+
if (!o.visible)
|
|
39
|
+
return;
|
|
40
|
+
const t = u(e).millisecond(0);
|
|
41
|
+
s("pick", t, !0);
|
|
42
|
+
}, $ = (e, t) => {
|
|
43
|
+
s("select-range", e, t), h.value = [e, t];
|
|
44
|
+
}, j = (e) => {
|
|
44
45
|
const t = [0, 3].concat(l.value ? [6] : []), a = ["hours", "minutes"].concat(
|
|
45
46
|
l.value ? ["seconds"] : []
|
|
46
|
-
), c = (t.indexOf(
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
const t = e.code, { left: a, right:
|
|
50
|
-
if ([a,
|
|
51
|
-
|
|
47
|
+
), c = (t.indexOf(h.value[0]) + e + t.length) % t.length;
|
|
48
|
+
V.start_emitSelectRange(a[c]);
|
|
49
|
+
}, H = (e) => {
|
|
50
|
+
const t = e.code, { left: a, right: S, up: c, down: F } = se;
|
|
51
|
+
if ([a, S].includes(t)) {
|
|
52
|
+
j(t === a ? -1 : 1), e.preventDefault();
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
if ([c,
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
if ([c, F].includes(t)) {
|
|
56
|
+
const C = t === c ? -1 : 1;
|
|
57
|
+
V.start_scrollDown(C), e.preventDefault();
|
|
57
58
|
}
|
|
58
|
-
}, { timePickerOptions:
|
|
59
|
-
getAvailableHours:
|
|
60
|
-
getAvailableMinutes:
|
|
61
|
-
getAvailableSeconds:
|
|
62
|
-
}),
|
|
63
|
-
return
|
|
64
|
-
default:
|
|
65
|
-
e.actualVisible || e.visible ? (
|
|
59
|
+
}, { timePickerOptions: V, onSetOption: G, getAvailableTime: J } = pe({
|
|
60
|
+
getAvailableHours: O,
|
|
61
|
+
getAvailableMinutes: P,
|
|
62
|
+
getAvailableSeconds: y
|
|
63
|
+
}), u = (e) => J(e, o.datetimeRole || "", !0), L = (e) => e ? f(e, o.format).locale(m.value) : null, Y = (e) => e ? e.format(o.format) : null, q = () => f(N).locale(m.value);
|
|
64
|
+
return s("set-picker-option", ["isValidValue", x]), s("set-picker-option", ["formatToString", Y]), s("set-picker-option", ["parseUserInput", L]), s("set-picker-option", ["handleKeydownInput", H]), s("set-picker-option", ["getRangeAvailableTime", u]), s("set-picker-option", ["getDefaultValue", q]), (e, t) => (T(), X(Z, { name: B.value }, {
|
|
65
|
+
default: ee(() => [
|
|
66
|
+
e.actualVisible || e.visible ? (T(), te("div", {
|
|
66
67
|
key: 0,
|
|
67
|
-
class: r(
|
|
68
|
+
class: r(n(i).b("panel"))
|
|
68
69
|
}, [
|
|
69
70
|
p("div", {
|
|
70
|
-
class: r([
|
|
71
|
+
class: r([n(i).be("panel", "content"), { "has-seconds": l.value }])
|
|
71
72
|
}, [
|
|
72
|
-
|
|
73
|
+
oe(de, {
|
|
73
74
|
ref: "spinner",
|
|
74
75
|
role: e.datetimeRole || "start",
|
|
75
|
-
"arrow-control":
|
|
76
|
+
"arrow-control": n(D),
|
|
76
77
|
"show-seconds": l.value,
|
|
77
|
-
"am-pm-mode":
|
|
78
|
+
"am-pm-mode": K.value,
|
|
78
79
|
"spinner-date": e.parsedValue,
|
|
79
|
-
"disabled-hours":
|
|
80
|
-
"disabled-minutes":
|
|
81
|
-
"disabled-seconds":
|
|
82
|
-
onChange:
|
|
83
|
-
onSetOption:
|
|
84
|
-
onSelectRange:
|
|
80
|
+
"disabled-hours": n(b),
|
|
81
|
+
"disabled-minutes": n(g),
|
|
82
|
+
"disabled-seconds": n(v),
|
|
83
|
+
onChange: U,
|
|
84
|
+
onSetOption: n(G),
|
|
85
|
+
onSelectRange: $
|
|
85
86
|
}, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
|
|
86
87
|
], 2),
|
|
87
88
|
p("div", {
|
|
88
|
-
class: r(
|
|
89
|
+
class: r(n(i).be("panel", "footer"))
|
|
89
90
|
}, [
|
|
90
91
|
p("button", {
|
|
91
92
|
type: "button",
|
|
92
|
-
class: r(["cancel", [
|
|
93
|
-
onClick:
|
|
94
|
-
}, "
|
|
93
|
+
class: r(["cancel", [n(i).be("panel", "btn")]]),
|
|
94
|
+
onClick: z
|
|
95
|
+
}, A(n(k)("vft.timePicker.cancel")), 3),
|
|
95
96
|
p("button", {
|
|
96
97
|
type: "button",
|
|
97
|
-
class: r(["confirm", [
|
|
98
|
-
onClick: t[0] || (t[0] = (a) =>
|
|
99
|
-
}, "
|
|
98
|
+
class: r(["confirm", [n(i).be("panel", "btn")]]),
|
|
99
|
+
onClick: t[0] || (t[0] = (a) => M())
|
|
100
|
+
}, A(n(k)("vft.timePicker.confirm")), 3)
|
|
100
101
|
], 2)
|
|
101
|
-
], 2)) :
|
|
102
|
+
], 2)) : ne("", !0)
|
|
102
103
|
]),
|
|
103
104
|
_: 1
|
|
104
105
|
}, 8, ["name"]));
|
|
105
106
|
}
|
|
106
107
|
});
|
|
107
108
|
export {
|
|
108
|
-
|
|
109
|
+
Pe as default
|
|
109
110
|
};
|