@aplus-frontend/ui 0.5.14 → 0.5.15
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/src/ap-field/date/constant.d.ts +1 -1
- package/es/src/ap-field/date/constant.mjs +14 -2
- package/es/src/ap-field/date/index.vue.mjs +59 -58
- package/es/src/ap-field/date/interface.d.ts +1 -1
- package/es/src/ap-field/date-range/index.vue.mjs +67 -66
- package/es/src/ap-field/interface.d.ts +8 -0
- package/es/src/ap-field/select/index.vue.mjs +2 -1
- package/lib/src/ap-field/date/constant.d.ts +1 -1
- package/lib/src/ap-field/date/constant.js +1 -1
- package/lib/src/ap-field/date/index.vue.js +1 -1
- package/lib/src/ap-field/date/interface.d.ts +1 -1
- package/lib/src/ap-field/date-range/index.vue.js +1 -1
- package/lib/src/ap-field/interface.d.ts +8 -0
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PickerMode } from '@aplus-frontend/antdv/es/vc-picker/interface';
|
|
2
2
|
import { ApFormatPresetType } from './interface';
|
|
3
3
|
export declare const ApFieldDatePresetFormats: string[];
|
|
4
|
-
export declare const PRESET_FORMAT_MAP: Record<ApFormatPresetType, string>;
|
|
4
|
+
export declare const PRESET_FORMAT_MAP: Record<ApFormatPresetType, string | undefined>;
|
|
5
5
|
export declare const PRESET_FORMAT_PICK_MAP: Record<ApFormatPresetType, PickerMode>;
|
|
6
6
|
export declare const PRESET_FORMAT_TIME_MAP: Record<ApFormatPresetType, {
|
|
7
7
|
showTime: boolean;
|
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
const Y = [
|
|
2
2
|
"Y",
|
|
3
|
+
"Y-Q",
|
|
3
4
|
"Y-M",
|
|
5
|
+
"Y-W",
|
|
4
6
|
"Y-D",
|
|
5
7
|
"Y-h",
|
|
6
8
|
"Y-m",
|
|
7
9
|
"Y-s"
|
|
8
10
|
], e = {
|
|
9
11
|
Y: "YYYY",
|
|
12
|
+
"Y-Q": void 0,
|
|
10
13
|
"Y-M": "YYYY-MM",
|
|
14
|
+
"Y-W": void 0,
|
|
11
15
|
"Y-D": "YYYY-MM-DD",
|
|
12
16
|
"Y-h": "YYYY-MM-DD HH",
|
|
13
17
|
"Y-m": "YYYY-MM-DD HH:mm",
|
|
14
18
|
"Y-s": "YYYY-MM-DD HH:mm:ss"
|
|
15
19
|
}, s = {
|
|
16
20
|
Y: "year",
|
|
21
|
+
"Y-Q": "quarter",
|
|
17
22
|
"Y-M": "month",
|
|
23
|
+
"Y-W": "week",
|
|
18
24
|
"Y-D": "date",
|
|
19
25
|
"Y-h": "date",
|
|
20
26
|
"Y-m": "date",
|
|
21
27
|
"Y-s": "date"
|
|
22
|
-
},
|
|
28
|
+
}, o = {
|
|
23
29
|
Y: {
|
|
24
30
|
showTime: !1
|
|
25
31
|
},
|
|
32
|
+
"Y-Q": {
|
|
33
|
+
showTime: !1
|
|
34
|
+
},
|
|
26
35
|
"Y-M": {
|
|
27
36
|
showTime: !1
|
|
28
37
|
},
|
|
38
|
+
"Y-W": {
|
|
39
|
+
showTime: !1
|
|
40
|
+
},
|
|
29
41
|
"Y-D": {
|
|
30
42
|
showTime: !1
|
|
31
43
|
},
|
|
@@ -46,5 +58,5 @@ export {
|
|
|
46
58
|
Y as ApFieldDatePresetFormats,
|
|
47
59
|
e as PRESET_FORMAT_MAP,
|
|
48
60
|
s as PRESET_FORMAT_PICK_MAP,
|
|
49
|
-
|
|
61
|
+
o as PRESET_FORMAT_TIME_MAP
|
|
50
62
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { InputGroup as
|
|
4
|
-
import { ApFieldDatePresetFormats as
|
|
1
|
+
import { defineComponent as E, computed as u, unref as a, createElementBlock as g, createBlock as h, openBlock as s, Fragment as k, createTextVNode as w, toDisplayString as P, normalizeStyle as N, withCtx as f, createCommentVNode as j, createVNode as I, isRef as U, renderList as C, mergeProps as H, createSlots as K, renderSlot as $, normalizeProps as G, guardReactiveProps as L } from "vue";
|
|
2
|
+
import d from "dayjs";
|
|
3
|
+
import { InputGroup as W, Select as Y, SelectOption as Z, DatePicker as q } from "@aplus-frontend/antdv";
|
|
4
|
+
import { ApFieldDatePresetFormats as J, PRESET_FORMAT_MAP as S, PRESET_FORMAT_PICK_MAP as Q, PRESET_FORMAT_TIME_MAP as X } from "./constant.mjs";
|
|
5
5
|
import "../../hooks/index.mjs";
|
|
6
|
-
import { isNil as T, omit as
|
|
7
|
-
import { formatDayWithTimezone as
|
|
8
|
-
import { getTimeFormatToZone as
|
|
9
|
-
import { useDefaultPlaceholder as
|
|
10
|
-
import { useDateTimezone as
|
|
11
|
-
import { useControllableValue as
|
|
12
|
-
const
|
|
6
|
+
import { isNil as T, omit as z } from "lodash-unified";
|
|
7
|
+
import { formatDayWithTimezone as ee } from "./helper.mjs";
|
|
8
|
+
import { getTimeFormatToZone as oe } from "@aplus-frontend/utils";
|
|
9
|
+
import { useDefaultPlaceholder as te } from "../hooks/use-default-placeholder.mjs";
|
|
10
|
+
import { useDateTimezone as ae } from "../hooks/use-date-timezone.mjs";
|
|
11
|
+
import { useControllableValue as ne } from "../../hooks/useControllableValue.mjs";
|
|
12
|
+
const ye = /* @__PURE__ */ E({
|
|
13
13
|
name: "ApFieldDate",
|
|
14
14
|
__name: "index",
|
|
15
15
|
props: {
|
|
@@ -84,27 +84,28 @@ const ve = /* @__PURE__ */ x({
|
|
|
84
84
|
onChange: {},
|
|
85
85
|
onOk: {},
|
|
86
86
|
format: { default: "Y-D" },
|
|
87
|
+
shownFormat: {},
|
|
87
88
|
formatBegins: { type: Boolean, default: !0 },
|
|
88
89
|
timezone: {}
|
|
89
90
|
},
|
|
90
91
|
emits: ["update:value"],
|
|
91
92
|
setup(O, { emit: b }) {
|
|
92
|
-
const e = O,
|
|
93
|
+
const e = O, F = b, { value: c, updateValue: B } = ne(
|
|
93
94
|
e,
|
|
94
|
-
|
|
95
|
-
),
|
|
96
|
-
() =>
|
|
97
|
-
),
|
|
98
|
-
() =>
|
|
99
|
-
), v =
|
|
95
|
+
F
|
|
96
|
+
), _ = te("Date", e), { currentTimezone: i } = ae(e), l = u(
|
|
97
|
+
() => J.indexOf(e.format) > -1
|
|
98
|
+
), A = u(() => e.shownFormat ? e.shownFormat : l.value ? S[e.format] : e.format), m = u(
|
|
99
|
+
() => l.value ? S[e.format] : e.format
|
|
100
|
+
), v = u(() => {
|
|
100
101
|
if (T(a(c)))
|
|
101
102
|
return;
|
|
102
|
-
let t =
|
|
103
|
-
return e.timezone && (t =
|
|
104
|
-
}),
|
|
105
|
-
const t = a(
|
|
103
|
+
let t = d(a(c));
|
|
104
|
+
return e.timezone && (t = d(oe(a(c), i.value))), t;
|
|
105
|
+
}), R = u(() => a(l) ? e.picker ?? Q[e.format] : e.picker), M = u(() => {
|
|
106
|
+
const t = a(l) ? X[e.format] : {};
|
|
106
107
|
return {
|
|
107
|
-
...
|
|
108
|
+
...z(e, [
|
|
108
109
|
"value",
|
|
109
110
|
"defaultValue",
|
|
110
111
|
"onChange",
|
|
@@ -113,85 +114,85 @@ const ve = /* @__PURE__ */ x({
|
|
|
113
114
|
"onUpdate:value",
|
|
114
115
|
"mode"
|
|
115
116
|
]),
|
|
116
|
-
placeholder: a(
|
|
117
|
+
placeholder: a(_),
|
|
117
118
|
...t
|
|
118
119
|
};
|
|
119
|
-
}), y = (t, n, o = !0) =>
|
|
120
|
-
function
|
|
120
|
+
}), y = (t, n, o = !0) => ee(i.value)(t, n, o);
|
|
121
|
+
function D(t) {
|
|
121
122
|
if (T(t)) {
|
|
122
123
|
B(null);
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
|
-
const n =
|
|
126
|
+
const n = d(t);
|
|
126
127
|
B(
|
|
127
128
|
y(
|
|
128
129
|
n,
|
|
129
|
-
a(
|
|
130
|
+
a(l) ? a(m) : void 0,
|
|
130
131
|
e.formatBegins
|
|
131
132
|
)
|
|
132
133
|
);
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function x(t, n) {
|
|
135
136
|
var p;
|
|
136
|
-
const o =
|
|
137
|
+
const o = d(t), r = t ? y(
|
|
137
138
|
o,
|
|
138
|
-
a(
|
|
139
|
+
a(l) ? a(m) : void 0,
|
|
139
140
|
e.formatBegins
|
|
140
141
|
) : null;
|
|
141
|
-
(p = e.onChange) == null || p.call(e,
|
|
142
|
+
(p = e.onChange) == null || p.call(e, r, n);
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
-
var
|
|
145
|
-
const n =
|
|
144
|
+
function V(t) {
|
|
145
|
+
var r;
|
|
146
|
+
const n = d(t), o = t ? y(
|
|
146
147
|
n,
|
|
147
|
-
a(
|
|
148
|
+
a(l) ? a(m) : void 0,
|
|
148
149
|
e.formatBegins
|
|
149
150
|
) : null;
|
|
150
|
-
(
|
|
151
|
+
(r = e.onOk) == null || r.call(e, o);
|
|
151
152
|
}
|
|
152
|
-
return (t, n) => t.mode === "read" ? (
|
|
153
|
-
P(
|
|
154
|
-
], 64)) : (
|
|
153
|
+
return (t, n) => t.mode === "read" ? (s(), g(k, { key: 0 }, [
|
|
154
|
+
w(P(v.value ? a(d)(v.value).format(m.value) : t.emptyText), 1)
|
|
155
|
+
], 64)) : (s(), h(a(W), {
|
|
155
156
|
key: 1,
|
|
156
157
|
compact: "",
|
|
157
|
-
style:
|
|
158
|
+
style: N({
|
|
158
159
|
display: Array.isArray(e.timezone) && e.timezone.length ? "flex" : "block"
|
|
159
160
|
})
|
|
160
161
|
}, {
|
|
161
162
|
default: f(() => [
|
|
162
|
-
Array.isArray(e.timezone) && e.timezone.length ? (
|
|
163
|
+
Array.isArray(e.timezone) && e.timezone.length ? (s(), h(a(Y), {
|
|
163
164
|
key: 0,
|
|
164
|
-
value: a(
|
|
165
|
-
"onUpdate:value": n[0] || (n[0] = (o) =>
|
|
165
|
+
value: a(i),
|
|
166
|
+
"onUpdate:value": n[0] || (n[0] = (o) => U(i) ? i.value = o : null),
|
|
166
167
|
"default-active-first-option": "",
|
|
167
168
|
"dropdown-match-select-width": !1,
|
|
168
169
|
style: { "max-width": "50%" }
|
|
169
170
|
}, {
|
|
170
171
|
default: f(() => [
|
|
171
|
-
(
|
|
172
|
+
(s(!0), g(k, null, C(e.timezone, (o) => (s(), h(a(Z), {
|
|
172
173
|
key: o == null ? void 0 : o.value,
|
|
173
174
|
value: o == null ? void 0 : o.value
|
|
174
175
|
}, {
|
|
175
176
|
default: f(() => [
|
|
176
|
-
P(
|
|
177
|
+
w(P((o == null ? void 0 : o.label) ?? (o == null ? void 0 : o.value)), 1)
|
|
177
178
|
]),
|
|
178
179
|
_: 2
|
|
179
180
|
}, 1032, ["value"]))), 128))
|
|
180
181
|
]),
|
|
181
182
|
_: 1
|
|
182
|
-
}, 8, ["value"])) :
|
|
183
|
-
|
|
183
|
+
}, 8, ["value"])) : j("", !0),
|
|
184
|
+
I(a(q), H(M.value, {
|
|
184
185
|
value: v.value,
|
|
185
|
-
format:
|
|
186
|
-
picker:
|
|
187
|
-
"onUpdate:value":
|
|
188
|
-
onChange:
|
|
189
|
-
onOk:
|
|
190
|
-
}),
|
|
191
|
-
|
|
192
|
-
name:
|
|
186
|
+
format: A.value,
|
|
187
|
+
picker: R.value,
|
|
188
|
+
"onUpdate:value": D,
|
|
189
|
+
onChange: x,
|
|
190
|
+
onOk: V
|
|
191
|
+
}), K({ _: 2 }, [
|
|
192
|
+
C(t.$slots, (o, r) => ({
|
|
193
|
+
name: r,
|
|
193
194
|
fn: f((p) => [
|
|
194
|
-
|
|
195
|
+
$(t.$slots, r, G(L(p || {})))
|
|
195
196
|
])
|
|
196
197
|
}))
|
|
197
198
|
]), 1040, ["value", "format", "picker"])
|
|
@@ -201,5 +202,5 @@ const ve = /* @__PURE__ */ x({
|
|
|
201
202
|
}
|
|
202
203
|
});
|
|
203
204
|
export {
|
|
204
|
-
|
|
205
|
+
ye as default
|
|
205
206
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type OmitValue<T> = Omit<T, 'value' | 'defaultValue' | 'onChange' | 'mode' | 'format'>;
|
|
2
|
-
export type ApFormatPresetType = 'Y' | 'Y-M' | 'Y-D' | 'Y-h' | 'Y-m' | 'Y-s';
|
|
2
|
+
export type ApFormatPresetType = 'Y' | 'Y-Q' | 'Y-M' | 'Y-W' | 'Y-D' | 'Y-h' | 'Y-m' | 'Y-s';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ApFieldDatePresetFormats as
|
|
1
|
+
import { defineComponent as q, useSlots as J, computed as f, unref as t, isVNode as Q, createVNode as T, Fragment as y, createElementBlock as k, createBlock as C, openBlock as d, createTextVNode as B, toDisplayString as P, resolveDynamicComponent as X, normalizeStyle as z, withCtx as D, createCommentVNode as ee, isRef as ne, renderList as A, mergeProps as oe, createSlots as te, renderSlot as ae, normalizeProps as re, guardReactiveProps as le } from "vue";
|
|
2
|
+
import { ApFieldDatePresetFormats as ue, PRESET_FORMAT_MAP as R, PRESET_FORMAT_PICK_MAP as de, PRESET_FORMAT_TIME_MAP as ie } from "../date/constant.mjs";
|
|
3
3
|
import "../../hooks/index.mjs";
|
|
4
|
-
import { isNil as
|
|
4
|
+
import { isNil as F, omit as _, isString as h, isFunction as se } from "lodash-unified";
|
|
5
5
|
import i from "dayjs";
|
|
6
|
-
import { InputGroup as
|
|
7
|
-
import { formatDayWithTimezone as
|
|
8
|
-
import { SwapRightOutlined as
|
|
6
|
+
import { InputGroup as fe, Select as me, SelectOption as pe, DatePicker as ce } from "@aplus-frontend/antdv";
|
|
7
|
+
import { formatDayWithTimezone as ye } from "../date/helper.mjs";
|
|
8
|
+
import { SwapRightOutlined as he } from "@ant-design/icons-vue";
|
|
9
9
|
import { omitUndefined as ve } from "../../utils/index.mjs";
|
|
10
|
-
import { getTimeFormatToZone as
|
|
11
|
-
import { useDefaultPlaceholder as
|
|
12
|
-
import { useDefaultPresets as
|
|
13
|
-
import { useDateTimezone as
|
|
14
|
-
import { useControllableValue as
|
|
15
|
-
const
|
|
10
|
+
import { getTimeFormatToZone as N } from "@aplus-frontend/utils";
|
|
11
|
+
import { useDefaultPlaceholder as ge } from "../hooks/use-default-placeholder.mjs";
|
|
12
|
+
import { useDefaultPresets as Se } from "../hooks/use-default-presets.mjs";
|
|
13
|
+
import { useDateTimezone as ke } from "../hooks/use-date-timezone.mjs";
|
|
14
|
+
import { useControllableValue as Ce } from "../../hooks/useControllableValue.mjs";
|
|
15
|
+
const Ee = /* @__PURE__ */ q({
|
|
16
16
|
__name: "index",
|
|
17
17
|
props: {
|
|
18
18
|
mode: {
|
|
@@ -147,6 +147,7 @@ const xe = /* @__PURE__ */ Y({
|
|
|
147
147
|
format: {
|
|
148
148
|
default: "Y-D"
|
|
149
149
|
},
|
|
150
|
+
shownFormat: {},
|
|
150
151
|
timezone: {},
|
|
151
152
|
readModeSeparator: {},
|
|
152
153
|
presets: {
|
|
@@ -154,94 +155,94 @@ const xe = /* @__PURE__ */ Y({
|
|
|
154
155
|
}
|
|
155
156
|
},
|
|
156
157
|
emits: ["update:value"],
|
|
157
|
-
setup(
|
|
158
|
-
emit:
|
|
158
|
+
setup(x, {
|
|
159
|
+
emit: E
|
|
159
160
|
}) {
|
|
160
|
-
const n =
|
|
161
|
+
const n = x, V = E, O = J(), s = f(() => ue.indexOf(n.format) > -1), v = f(() => s.value ? R[n.format] : n.format), {
|
|
161
162
|
value: g,
|
|
162
|
-
updateValue:
|
|
163
|
-
} =
|
|
163
|
+
updateValue: w
|
|
164
|
+
} = Ce(n, V), I = f(() => n.shownFormat ? n.shownFormat : s.value ? R[n.format] : n.format), U = ge("DateRange", n), {
|
|
164
165
|
currentTimezone: u
|
|
165
|
-
} =
|
|
166
|
-
presets:
|
|
167
|
-
changeCurrentDate:
|
|
168
|
-
} =
|
|
166
|
+
} = ke(n), {
|
|
167
|
+
presets: j,
|
|
168
|
+
changeCurrentDate: H
|
|
169
|
+
} = Se({
|
|
169
170
|
...n,
|
|
170
171
|
timezone: u
|
|
171
|
-
}),
|
|
172
|
+
}), m = (e, a, r = !0) => ye(u.value)(e, a, r), S = f(() => {
|
|
172
173
|
var l, o;
|
|
173
174
|
const e = t(g);
|
|
174
|
-
if (
|
|
175
|
+
if (F(e) || !(e != null && e.length))
|
|
175
176
|
return e;
|
|
176
|
-
const a = u.value ?
|
|
177
|
+
const a = u.value ? N(t(g)[0], u.value) : (l = t(g)) == null ? void 0 : l[0], r = n.timezone ? N(t(g)[1], u.value) : (o = t(g)) == null ? void 0 : o[1];
|
|
177
178
|
return [i(a), i(r)];
|
|
178
|
-
}),
|
|
179
|
-
const e = t(s) ?
|
|
179
|
+
}), K = f(() => t(s) ? n.picker ?? de[n.format] : n.picker), $ = f(() => {
|
|
180
|
+
const e = t(s) ? ie[n.format] : {};
|
|
180
181
|
return {
|
|
181
182
|
...ve(_(n, ["value", "onUpdate:value", "onChange", "onOk", "format", "mode", "presets"])),
|
|
182
|
-
placeholder: t(
|
|
183
|
-
presets: t(
|
|
183
|
+
placeholder: t(U),
|
|
184
|
+
presets: t(j),
|
|
184
185
|
...e
|
|
185
186
|
};
|
|
186
187
|
});
|
|
187
|
-
function
|
|
188
|
+
function G(e) {
|
|
188
189
|
if (!e) {
|
|
189
|
-
|
|
190
|
+
w(e);
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
193
|
let a = h(e[0]) ? i(e[0]) : e[0], r = h(e[1]) ? i(e[1]) : e[1];
|
|
193
|
-
const l = t(s) ? t(
|
|
194
|
-
|
|
194
|
+
const l = t(s) ? t(v) : void 0;
|
|
195
|
+
w([m(a, l), m(r, l, !1)]);
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function L(e) {
|
|
197
198
|
var c;
|
|
198
|
-
const a = h(e[0]) ? i(e[0]) : e[0], r = h(e[1]) ? i(e[1]) : e[1], l = t(s) ? t(
|
|
199
|
-
(c = n.onOk) == null || c.call(n, [o,
|
|
199
|
+
const a = h(e[0]) ? i(e[0]) : e[0], r = h(e[1]) ? i(e[1]) : e[1], l = t(s) ? t(v) : void 0, o = e[0] ? m(a, l) : null, p = e[1] ? m(r, l, !1) : null;
|
|
200
|
+
(c = n.onOk) == null || c.call(n, [o, p]);
|
|
200
201
|
}
|
|
201
|
-
function
|
|
202
|
+
function W(e) {
|
|
202
203
|
var a;
|
|
203
|
-
e &&
|
|
204
|
+
e && H(), (a = n.onOpenChange) == null || a.call(n, e);
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
-
var
|
|
207
|
-
if (
|
|
208
|
-
(
|
|
206
|
+
function Y(e, a) {
|
|
207
|
+
var M, b;
|
|
208
|
+
if (F(e)) {
|
|
209
|
+
(M = n.onChange) == null || M.call(n, e, a);
|
|
209
210
|
return;
|
|
210
211
|
}
|
|
211
|
-
const r = h(e[0]) ? i(e[0]) : e[0], l = h(e[1]) ? i(e[1]) : e[1], o = t(s) ? t(
|
|
212
|
-
(
|
|
212
|
+
const r = h(e[0]) ? i(e[0]) : e[0], l = h(e[1]) ? i(e[1]) : e[1], o = t(s) ? t(v) : void 0, p = e[0] ? m(r, o) : null, c = e[1] ? m(l, o, !1) : null;
|
|
213
|
+
(b = n.onChange) == null || b.call(n, [p, c], a);
|
|
213
214
|
}
|
|
214
|
-
const
|
|
215
|
+
const Z = f(() => {
|
|
215
216
|
var r;
|
|
216
217
|
const e = n.readModeSeparator;
|
|
217
218
|
if (e)
|
|
218
|
-
return
|
|
219
|
+
return Q(e) || se(e) ? n.readModeSeparator : T(y, null, [n.readModeSeparator]);
|
|
219
220
|
const a = (r = O.readModeSeparator) == null ? void 0 : r.call(O);
|
|
220
|
-
return a ? T(
|
|
221
|
+
return a ? T(y, null, [a]) : he;
|
|
221
222
|
});
|
|
222
223
|
return (e, a) => {
|
|
223
224
|
var r, l;
|
|
224
|
-
return e.mode === "read" ? (d(), k(
|
|
225
|
+
return e.mode === "read" ? (d(), k(y, {
|
|
225
226
|
key: 0
|
|
226
|
-
}, [S.value ? (d(), k(
|
|
227
|
+
}, [S.value ? (d(), k(y, {
|
|
227
228
|
key: 0
|
|
228
|
-
}, [B(P((r = S.value[0]) == null ? void 0 : r.format(
|
|
229
|
+
}, [B(P((r = S.value[0]) == null ? void 0 : r.format(v.value)) + " ", 1), (d(), C(X(Z.value))), B(" " + P((l = S.value[1]) == null ? void 0 : l.format(v.value)), 1)], 64)) : (d(), k(y, {
|
|
229
230
|
key: 1
|
|
230
|
-
}, [B(P(e.emptyText), 1)], 64))], 64)) : (d(), C(t(
|
|
231
|
+
}, [B(P(e.emptyText), 1)], 64))], 64)) : (d(), C(t(fe), {
|
|
231
232
|
key: 1,
|
|
232
233
|
compact: "",
|
|
233
|
-
style:
|
|
234
|
+
style: z({
|
|
234
235
|
display: Array.isArray(n.timezone) && n.timezone.length ? "flex" : "block"
|
|
235
236
|
})
|
|
236
237
|
}, {
|
|
237
|
-
default: D(() => [Array.isArray(n.timezone) && n.timezone.length ? (d(), C(t(
|
|
238
|
+
default: D(() => [Array.isArray(n.timezone) && n.timezone.length ? (d(), C(t(me), {
|
|
238
239
|
key: 0,
|
|
239
240
|
value: t(u),
|
|
240
|
-
"onUpdate:value": a[0] || (a[0] = (o) =>
|
|
241
|
+
"onUpdate:value": a[0] || (a[0] = (o) => ne(u) ? u.value = o : null),
|
|
241
242
|
"default-active-first-option": "",
|
|
242
243
|
"dropdown-match-select-width": !1
|
|
243
244
|
}, {
|
|
244
|
-
default: D(() => [(d(!0), k(
|
|
245
|
+
default: D(() => [(d(!0), k(y, null, A(n.timezone, (o) => (d(), C(t(pe), {
|
|
245
246
|
key: o == null ? void 0 : o.value,
|
|
246
247
|
value: o == null ? void 0 : o.value
|
|
247
248
|
}, {
|
|
@@ -249,19 +250,19 @@ const xe = /* @__PURE__ */ Y({
|
|
|
249
250
|
_: 2
|
|
250
251
|
}, 1032, ["value"]))), 128))]),
|
|
251
252
|
_: 1
|
|
252
|
-
}, 8, ["value"])) :
|
|
253
|
+
}, 8, ["value"])) : ee("", !0), T(t(ce).RangePicker, oe($.value, {
|
|
253
254
|
value: S.value,
|
|
254
|
-
picker:
|
|
255
|
-
format:
|
|
256
|
-
"onUpdate:value":
|
|
257
|
-
onChange:
|
|
258
|
-
onOk:
|
|
259
|
-
onOpenChange:
|
|
260
|
-
}),
|
|
255
|
+
picker: K.value,
|
|
256
|
+
format: I.value,
|
|
257
|
+
"onUpdate:value": G,
|
|
258
|
+
onChange: Y,
|
|
259
|
+
onOk: L,
|
|
260
|
+
onOpenChange: W
|
|
261
|
+
}), te({
|
|
261
262
|
_: 2
|
|
262
|
-
}, [
|
|
263
|
-
name:
|
|
264
|
-
fn: D((c) => [
|
|
263
|
+
}, [A(t(_)(e.$slots, "readModeSeparator"), (o, p) => ({
|
|
264
|
+
name: p,
|
|
265
|
+
fn: D((c) => [ae(e.$slots, p, re(le(c || {})))])
|
|
265
266
|
}))]), 1040, ["value", "picker", "format"])]),
|
|
266
267
|
_: 3
|
|
267
268
|
}, 8, ["style"]));
|
|
@@ -269,5 +270,5 @@ const xe = /* @__PURE__ */ Y({
|
|
|
269
270
|
}
|
|
270
271
|
});
|
|
271
272
|
export {
|
|
272
|
-
|
|
273
|
+
Ee as default
|
|
273
274
|
};
|
|
@@ -41,6 +41,10 @@ export type ApFieldDateProps = BasicApFieldProps<Omit<DatePickerProps, 'mode' |
|
|
|
41
41
|
onChange?: (ts: number | null, dayStr: string) => void;
|
|
42
42
|
onOk?: (ts: number | null) => void;
|
|
43
43
|
format?: LiteralUnion<ApFormatPresetType, string>;
|
|
44
|
+
/**
|
|
45
|
+
* 只用于显示的自定义格式化
|
|
46
|
+
*/
|
|
47
|
+
shownFormat?: DatePickerProps['format'];
|
|
44
48
|
/**
|
|
45
49
|
* 格式化时间时是否以`format`的开始
|
|
46
50
|
* @default true
|
|
@@ -99,6 +103,10 @@ export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'va
|
|
|
99
103
|
onChange?: (ts: RangeValue<number> | null, dayStr: [string, string]) => void;
|
|
100
104
|
onOk?: (ts: RangeValue<number>) => void;
|
|
101
105
|
format?: LiteralUnion<ApFormatPresetType, string>;
|
|
106
|
+
/**
|
|
107
|
+
* 只用于显示的format
|
|
108
|
+
*/
|
|
109
|
+
shownFormat?: RangePickerProps['format'];
|
|
102
110
|
/**
|
|
103
111
|
* 指定时区,指定后value会变为特定时区下的timestamp
|
|
104
112
|
*/
|
|
@@ -166,7 +166,8 @@ const ie = { key: 0 }, he = /* @__PURE__ */ z({
|
|
|
166
166
|
showArrow: !1,
|
|
167
167
|
defaultActiveFirstOption: !1,
|
|
168
168
|
onSearch: V,
|
|
169
|
-
notFoundContent: r.value ? void 0 : null
|
|
169
|
+
notFoundContent: r.value ? void 0 : null,
|
|
170
|
+
filterOption: !1
|
|
170
171
|
} : {
|
|
171
172
|
showArrow: !0,
|
|
172
173
|
filterOption: te(e == null ? void 0 : e.filterOption) ? x : e == null ? void 0 : e.filterOption
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PickerMode } from '@aplus-frontend/antdv/es/vc-picker/interface';
|
|
2
2
|
import { ApFormatPresetType } from './interface';
|
|
3
3
|
export declare const ApFieldDatePresetFormats: string[];
|
|
4
|
-
export declare const PRESET_FORMAT_MAP: Record<ApFormatPresetType, string>;
|
|
4
|
+
export declare const PRESET_FORMAT_MAP: Record<ApFormatPresetType, string | undefined>;
|
|
5
5
|
export declare const PRESET_FORMAT_PICK_MAP: Record<ApFormatPresetType, PickerMode>;
|
|
6
6
|
export declare const PRESET_FORMAT_TIME_MAP: Record<ApFormatPresetType, {
|
|
7
7
|
showTime: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=["Y","Y-M","Y-D","Y-h","Y-m","Y-s"],e={Y:"YYYY","Y-M":"YYYY-MM","Y-D":"YYYY-MM-DD","Y-h":"YYYY-MM-DD HH","Y-m":"YYYY-MM-DD HH:mm","Y-s":"YYYY-MM-DD HH:mm:ss"},s={Y:"year","Y-M":"month","Y-D":"date","Y-h":"date","Y-m":"date","Y-s":"date"},M={Y:{showTime:!1},"Y-M":{showTime:!1},"Y-D":{showTime:!1},"Y-h":{showTime:!0,showSecond:!1,showMinute:!1},"Y-m":{showTime:!0,showSecond:!1},"Y-s":{showTime:!0}};exports.ApFieldDatePresetFormats=Y;exports.PRESET_FORMAT_MAP=e;exports.PRESET_FORMAT_PICK_MAP=s;exports.PRESET_FORMAT_TIME_MAP=M;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=["Y","Y-Q","Y-M","Y-W","Y-D","Y-h","Y-m","Y-s"],e={Y:"YYYY","Y-Q":void 0,"Y-M":"YYYY-MM","Y-W":void 0,"Y-D":"YYYY-MM-DD","Y-h":"YYYY-MM-DD HH","Y-m":"YYYY-MM-DD HH:mm","Y-s":"YYYY-MM-DD HH:mm:ss"},s={Y:"year","Y-Q":"quarter","Y-M":"month","Y-W":"week","Y-D":"date","Y-h":"date","Y-m":"date","Y-s":"date"},M={Y:{showTime:!1},"Y-Q":{showTime:!1},"Y-M":{showTime:!1},"Y-W":{showTime:!1},"Y-D":{showTime:!1},"Y-h":{showTime:!0,showSecond:!1,showMinute:!1},"Y-m":{showTime:!0,showSecond:!1},"Y-s":{showTime:!0}};exports.ApFieldDatePresetFormats=Y;exports.PRESET_FORMAT_MAP=e;exports.PRESET_FORMAT_PICK_MAP=s;exports.PRESET_FORMAT_TIME_MAP=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("dayjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("dayjs"),f=require("@aplus-frontend/antdv"),d=require("./constant.js");require("../../hooks/index.js");const y=require("lodash-unified"),O=require("./helper.js"),F=require("@aplus-frontend/utils"),A=require("../hooks/use-default-placeholder.js"),M=require("../hooks/use-date-timezone.js"),R=require("../../hooks/useControllableValue.js"),D=e.defineComponent({name:"ApFieldDate",__name:"index",props:{mode:{default:"edit"},class:{},style:{},dropdownClassName:{},dropdownAlign:{},popupStyle:{},transitionName:{},placeholder:{},allowClear:{type:Boolean,default:!0},autofocus:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},tabindex:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},inputReadOnly:{type:Boolean,default:void 0},id:{},presets:{},suffixIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},clearIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},getPopupContainer:{},panelRender:{},inputRender:{},onOpenChange:{},onPanelChange:{},onFocus:{},onBlur:{},onMousedown:{},onMouseup:{},onMouseenter:{},onMouseleave:{},onClick:{},onContextmenu:{},onKeydown:{},role:{},name:{},autocomplete:{},direction:{},showToday:{type:Boolean,default:void 0},showTime:{type:Boolean,default:void 0},picker:{},prefixCls:{},defaultPickerValue:{},disabledDate:{},dateRender:{},monthCellRender:{},renderExtraFooter:{},onSelect:{},locale:{},size:{},bordered:{type:Boolean,default:void 0},showNow:{type:Boolean,default:void 0},disabledTime:{},defaultOpenValue:{},showHour:{type:Boolean,default:void 0},showMinute:{type:Boolean,default:void 0},showSecond:{type:Boolean,default:void 0},use12Hours:{type:Boolean,default:void 0},hourStep:{},minuteStep:{},secondStep:{},hideDisabledOptions:{type:Boolean,default:void 0},disabledHours:{},disabledMinutes:{},disabledSeconds:{},valueFormat:{},emptyText:{default:"--"},value:{},defaultValue:{},onChange:{},onOk:{},format:{default:"Y-D"},shownFormat:{},formatBegins:{type:Boolean,default:!0},timezone:{}},emits:["update:value"],setup(B,{emit:k}){const o=B,g=k,{value:m,updateValue:h}=R.useControllableValue(o,g),P=A.useDefaultPlaceholder("Date",o),{currentTimezone:i}=M.useDateTimezone(o),l=e.computed(()=>d.ApFieldDatePresetFormats.indexOf(o.format)>-1),w=e.computed(()=>o.shownFormat?o.shownFormat:l.value?d.PRESET_FORMAT_MAP[o.format]:o.format),s=e.computed(()=>l.value?d.PRESET_FORMAT_MAP[o.format]:o.format),p=e.computed(()=>{if(y.isNil(e.unref(m)))return;let n=u(e.unref(m));return o.timezone&&(n=u(F.getTimeFormatToZone(e.unref(m),i.value))),n}),C=e.computed(()=>e.unref(l)?o.picker??d.PRESET_FORMAT_PICK_MAP[o.format]:o.picker),T=e.computed(()=>{const n=e.unref(l)?d.PRESET_FORMAT_TIME_MAP[o.format]:{};return{...y.omit(o,["value","defaultValue","onChange","onOk","format","onUpdate:value","mode"]),placeholder:e.unref(P),...n}}),v=(n,a,t=!0)=>O.formatDayWithTimezone(i.value)(n,a,t);function S(n){if(y.isNil(n)){h(null);return}const a=u(n);h(v(a,e.unref(l)?e.unref(s):void 0,o.formatBegins))}function _(n,a){var c;const t=u(n),r=n?v(t,e.unref(l)?e.unref(s):void 0,o.formatBegins):null;(c=o.onChange)==null||c.call(o,r,a)}function b(n){var r;const a=u(n),t=n?v(a,e.unref(l)?e.unref(s):void 0,o.formatBegins):null;(r=o.onOk)==null||r.call(o,t)}return(n,a)=>n.mode==="read"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(p.value?e.unref(u)(p.value).format(s.value):n.emptyText),1)],64)):(e.openBlock(),e.createBlock(e.unref(f.InputGroup),{key:1,compact:"",style:e.normalizeStyle({display:Array.isArray(o.timezone)&&o.timezone.length?"flex":"block"})},{default:e.withCtx(()=>[Array.isArray(o.timezone)&&o.timezone.length?(e.openBlock(),e.createBlock(e.unref(f.Select),{key:0,value:e.unref(i),"onUpdate:value":a[0]||(a[0]=t=>e.isRef(i)?i.value=t:null),"default-active-first-option":"","dropdown-match-select-width":!1,style:{"max-width":"50%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.timezone,t=>(e.openBlock(),e.createBlock(e.unref(f.SelectOption),{key:t==null?void 0:t.value,value:t==null?void 0:t.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString((t==null?void 0:t.label)??(t==null?void 0:t.value)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])):e.createCommentVNode("",!0),e.createVNode(e.unref(f.DatePicker),e.mergeProps(T.value,{value:p.value,format:w.value,picker:C.value,"onUpdate:value":S,onChange:_,onOk:b}),e.createSlots({_:2},[e.renderList(n.$slots,(t,r)=>({name:r,fn:e.withCtx(c=>[e.renderSlot(n.$slots,r,e.normalizeProps(e.guardReactiveProps(c||{})))])}))]),1040,["value","format","picker"])]),_:3},8,["style"]))}});exports.default=D;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type OmitValue<T> = Omit<T, 'value' | 'defaultValue' | 'onChange' | 'mode' | 'format'>;
|
|
2
|
-
export type ApFormatPresetType = 'Y' | 'Y-M' | 'Y-D' | 'Y-h' | 'Y-m' | 'Y-s';
|
|
2
|
+
export type ApFormatPresetType = 'Y' | 'Y-Q' | 'Y-M' | 'Y-W' | 'Y-D' | 'Y-h' | 'Y-m' | 'Y-s';
|
|
@@ -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"),g=require("../date/constant.js");require("../../hooks/index.js");const u=require("lodash-unified"),d=require("dayjs"),v=require("@aplus-frontend/antdv"),E=require("../date/helper.js"),I=require("@ant-design/icons-vue"),U=require("../../utils/index.js"),T=require("@aplus-frontend/utils"),j=require("../hooks/use-default-placeholder.js"),H=require("../hooks/use-default-presets.js"),K=require("../hooks/use-date-timezone.js"),L=require("../../hooks/useControllableValue.js"),Z=e.defineComponent({__name:"index",props:{mode:{default:"edit"},class:{},style:{},id:{},defaultPickerValue:{},placeholder:{},disabled:{type:[Boolean,Array],default:void 0},disabledTime:{},ranges:{},separator:{type:[Object,String,Number,Boolean,null,Array],default:void 0},allowEmpty:{},onCalendarChange:{},onFocus:{},onBlur:{},onMousedown:{},onMouseup:{},onMouseenter:{},onMouseleave:{},onClick:{},direction:{},autocomplete:{},activePickerIndex:{},dateRender:{},panelRender:{},dropdownClassName:{},dropdownAlign:{},popupStyle:{},transitionName:{},allowClear:{type:Boolean,default:!0},autofocus:{type:Boolean,default:void 0},tabindex:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},inputReadOnly:{type:Boolean,default:void 0},suffixIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},clearIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},getPopupContainer:{},inputRender:{},onOpenChange:{},onContextmenu:{},onKeydown:{},role:{},name:{},picker:{},prefixCls:{},disabledDate:{},monthCellRender:{},locale:{},size:{},bordered:{type:Boolean,default:void 0},showTime:{type:Boolean,default:void 0},showNow:{type:Boolean,default:void 0},order:{type:Boolean,default:void 0},defaultOpenValue:{},showHour:{type:Boolean,default:void 0},showMinute:{type:Boolean,default:void 0},showSecond:{type:Boolean,default:void 0},use12Hours:{type:Boolean,default:void 0},hourStep:{},minuteStep:{},secondStep:{},hideDisabledOptions:{type:Boolean,default:void 0},disabledHours:{},disabledMinutes:{},disabledSeconds:{},valueFormat:{},emptyText:{default:"--"},value:{},defaultValue:{},onChange:{},onOk:{},format:{default:"Y-D"},shownFormat:{},timezone:{},readModeSeparator:{},presets:{type:[Array,Boolean]}},emits:["update:value"],setup(D,{emit:P}){const t=D,M=P,k=e.useSlots(),s=e.computed(()=>g.ApFieldDatePresetFormats.indexOf(t.format)>-1),m=e.computed(()=>s.value?g.PRESET_FORMAT_MAP[t.format]:t.format),{value:y,updateValue:S}=L.useControllableValue(t,M),O=e.computed(()=>t.shownFormat?t.shownFormat:s.value?g.PRESET_FORMAT_MAP[t.format]:t.format),w=j.useDefaultPlaceholder("DateRange",t),{currentTimezone:i}=K.useDateTimezone(t),{presets:F,changeCurrentDate:b}=H.useDefaultPresets({...t,timezone:i}),c=(n,a,r=!0)=>E.formatDayWithTimezone(i.value)(n,a,r),h=e.computed(()=>{var l,o;const n=e.unref(y);if(u.isNil(n)||!(n!=null&&n.length))return n;const a=i.value?T.getTimeFormatToZone(e.unref(y)[0],i.value):(l=e.unref(y))==null?void 0:l[0],r=t.timezone?T.getTimeFormatToZone(e.unref(y)[1],i.value):(o=e.unref(y))==null?void 0:o[1];return[d(a),d(r)]}),_=e.computed(()=>e.unref(s)?t.picker??g.PRESET_FORMAT_PICK_MAP[t.format]:t.picker),A=e.computed(()=>{const n=e.unref(s)?g.PRESET_FORMAT_TIME_MAP[t.format]:{};return{...U.omitUndefined(u.omit(t,["value","onUpdate:value","onChange","onOk","format","mode","presets"])),placeholder:e.unref(w),presets:e.unref(F),...n}});function R(n){if(!n){S(n);return}let a=u.isString(n[0])?d(n[0]):n[0],r=u.isString(n[1])?d(n[1]):n[1];const l=e.unref(s)?e.unref(m):void 0;S([c(a,l),c(r,l,!1)])}function N(n){var p;const a=u.isString(n[0])?d(n[0]):n[0],r=u.isString(n[1])?d(n[1]):n[1],l=e.unref(s)?e.unref(m):void 0,o=n[0]?c(a,l):null,f=n[1]?c(r,l,!1):null;(p=t.onOk)==null||p.call(t,[o,f])}function x(n){var a;n&&b(),(a=t.onOpenChange)==null||a.call(t,n)}function V(n,a){var B,C;if(u.isNil(n)){(B=t.onChange)==null||B.call(t,n,a);return}const r=u.isString(n[0])?d(n[0]):n[0],l=u.isString(n[1])?d(n[1]):n[1],o=e.unref(s)?e.unref(m):void 0,f=n[0]?c(r,o):null,p=n[1]?c(l,o,!1):null;(C=t.onChange)==null||C.call(t,[f,p],a)}const q=e.computed(()=>{var r;const n=t.readModeSeparator;if(n)return e.isVNode(n)||u.isFunction(n)?t.readModeSeparator:e.createVNode(e.Fragment,null,[t.readModeSeparator]);const a=(r=k.readModeSeparator)==null?void 0:r.call(k);return a?e.createVNode(e.Fragment,null,[a]):I.SwapRightOutlined});return(n,a)=>{var r,l;return n.mode==="read"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[h.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString((r=h.value[0])==null?void 0:r.format(m.value))+" ",1),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(q.value))),e.createTextVNode(" "+e.toDisplayString((l=h.value[1])==null?void 0:l.format(m.value)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(n.emptyText),1)],64))],64)):(e.openBlock(),e.createBlock(e.unref(v.InputGroup),{key:1,compact:"",style:e.normalizeStyle({display:Array.isArray(t.timezone)&&t.timezone.length?"flex":"block"})},{default:e.withCtx(()=>[Array.isArray(t.timezone)&&t.timezone.length?(e.openBlock(),e.createBlock(e.unref(v.Select),{key:0,value:e.unref(i),"onUpdate:value":a[0]||(a[0]=o=>e.isRef(i)?i.value=o:null),"default-active-first-option":"","dropdown-match-select-width":!1},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.timezone,o=>(e.openBlock(),e.createBlock(e.unref(v.SelectOption),{key:o==null?void 0:o.value,value:o==null?void 0:o.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString((o==null?void 0:o.label)??(o==null?void 0:o.value)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])):e.createCommentVNode("",!0),e.createVNode(e.unref(v.DatePicker).RangePicker,e.mergeProps(A.value,{value:h.value,picker:_.value,format:O.value,"onUpdate:value":R,onChange:V,onOk:N,onOpenChange:x}),e.createSlots({_:2},[e.renderList(e.unref(u.omit)(n.$slots,"readModeSeparator"),(o,f)=>({name:f,fn:e.withCtx(p=>[e.renderSlot(n.$slots,f,e.normalizeProps(e.guardReactiveProps(p||{})))])}))]),1040,["value","picker","format"])]),_:3},8,["style"]))}}});exports.default=Z;
|
|
@@ -41,6 +41,10 @@ export type ApFieldDateProps = BasicApFieldProps<Omit<DatePickerProps, 'mode' |
|
|
|
41
41
|
onChange?: (ts: number | null, dayStr: string) => void;
|
|
42
42
|
onOk?: (ts: number | null) => void;
|
|
43
43
|
format?: LiteralUnion<ApFormatPresetType, string>;
|
|
44
|
+
/**
|
|
45
|
+
* 只用于显示的自定义格式化
|
|
46
|
+
*/
|
|
47
|
+
shownFormat?: DatePickerProps['format'];
|
|
44
48
|
/**
|
|
45
49
|
* 格式化时间时是否以`format`的开始
|
|
46
50
|
* @default true
|
|
@@ -99,6 +103,10 @@ export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'va
|
|
|
99
103
|
onChange?: (ts: RangeValue<number> | null, dayStr: [string, string]) => void;
|
|
100
104
|
onOk?: (ts: RangeValue<number>) => void;
|
|
101
105
|
format?: LiteralUnion<ApFormatPresetType, string>;
|
|
106
|
+
/**
|
|
107
|
+
* 只用于显示的format
|
|
108
|
+
*/
|
|
109
|
+
shownFormat?: RangePickerProps['format'];
|
|
102
110
|
/**
|
|
103
111
|
* 指定时区,指定后value会变为特定时区下的timestamp
|
|
104
112
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),i=require("lodash-unified"),w=require("@aplus-frontend/antdv");require("../../hooks/index.js");const k=require("../hooks/use-default-placeholder.js"),d=require("./use-select-options.js"),M=require("../../hooks/useControllableValue.js"),U={key:0},D=o.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},defaultValue:{},notFoundContent:{},suffixIcon:{},itemIcon:{},size:{},bordered:{type:Boolean,default:void 0},transitionName:{},choiceTransitionName:{},popupClassName:{},dropdownClassName:{},placement:{},status:{},children:{},listHeight:{},onMouseenter:{},onMouseleave:{},tabindex:{},onClick:{},onFocus:{},onBlur:{},onChange:{},onKeydown:{},onKeyup:{},onMousedown:{},onSelect:{},open:{type:Boolean,default:void 0},animation:{},direction:{},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},autofocus:{type:Boolean,default:void 0},getPopupContainer:{},virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{},options:{},showAction:{},onDeselect:{},loading:{type:Boolean,default:void 0},placeholder:{},clearIcon:{},allowClear:{type:Boolean,default:!0},fieldNames:{},dropdownStyle:{},dropdownRender:{},dropdownAlign:{},showSearch:{type:Boolean,default:void 0},searchValue:{},onInputKeyDown:{},removeIcon:{},maxTagCount:{},maxTagTextLength:{},maxTagPlaceholder:{},tokenSeparators:{},tagRender:{},optionLabelRender:{},onClear:{},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{},showArrow:{type:Boolean,default:void 0},onPopupScroll:{},menuItemSelectedIcon:{},listItemHeight:{},inputValue:{},autoClearSearchValue:{type:Boolean,default:void 0},filterOption:{},filterSort:{},optionFilterProp:{},optionLabelProp:{},defaultActiveFirstOption:{type:Boolean,default:void 0},onClickOption:{},labelInValue:{type:Boolean,default:void 0},emptyText:{default:"--"},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},addAll:{type:[Boolean,Number]},params:{},searchDelay:{default:300}},emits:["update:value"],setup(B,{expose:L,emit:b}){let r=0;const e=B,_=i.debounce(t=>{if(!i.isFunction(e.request))return;r+=1;const l=r;c([]),u.value=!0,e.request(t).then(n=>{r===l&&(c(n),u.value=!1)})},e.searchDelay),A=(t,l)=>{var a;const n=((a=e.fieldNames)==null?void 0:a.label)||"label";return typeof(l==null?void 0:l[n])=="string"&&l[n].toLowerCase().indexOf(t.toLowerCase())>-1},{options:s,updateOptions:c}=d.useSelectOptions(e),v=o.ref(),u=o.ref((e==null?void 0:e.loading)||!1),F=b;async function f(t=!0){if(!i.isFunction(e.request))return;u.value=!0,r+=1;const l=r;try{t&&c([]);const n=await e.request(void 0,e.params);if(l!==r)return;c(n)}finally{u.value=!1}}function O(t){var l;(l=e.onFocus)==null||l.call(e,t),e.refetchOnFocus&&r>0&&!u.value&&f(!0)}o.onMounted(()=>{e.lazy||f()}),o.watch(()=>e.params,()=>{f()},{deep:!0});const{value:p,updateValue:h}=M.useControllableValue(e,F),V=k.useDefaultPlaceholder("Select",e),E=o.computed(()=>{var m,g;const t=o.unref(p);if(!t)return e.emptyText;const l=((m=e.fieldNames)==null?void 0:m.label)||"label",n=((g=e.fieldNames)==null?void 0:g.value)||"value";if(i.isArray(t))return t.map(y=>{var C;return(C=o.unref(s).find(P=>P[n]===y))==null?void 0:C[l]}).filter(Boolean).join("、")||e.emptyText;const a=o.unref(s).find(y=>y[n]===t);return(a==null?void 0:a[l])||e.emptyText}),N=o.computed(()=>{const t=!!(e!=null&&e.showSearch),l=e.searchMode;let n={};return t&&(n=l==="request"?{showArrow:!1,defaultActiveFirstOption:!1,onSearch:_,notFoundContent:u.value?void 0:null}:{showArrow:!0,filterOption:i.isNil(e==null?void 0:e.filterOption)?A:e==null?void 0:e.filterOption}),{...i.omit(e,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect"]),placeholder:o.unref(V),...n}}),S=o.computed(()=>s.value.map(t=>{var l;return t[((l=e.fieldNames)==null?void 0:l.value)||"value"]}).filter(t=>t!==d.SELECT_ALL_VALUE_KEY)),q=o.computed(()=>{if(!e.multiple||!e.addAll)return o.unref(p);if(s.value.some(t=>{var l;return t[((l=e.fieldNames)==null?void 0:l.value)||"value"]===d.SELECT_ALL_VALUE_KEY})){const t=o.unref(S),l=o.unref(p)||[];if(t.length&&t.every(n=>l==null?void 0:l.includes(n)))return[d.SELECT_ALL_VALUE_KEY]}return o.unref(p)});function T(t){return e.multiple&&t.includes(d.SELECT_ALL_VALUE_KEY)?h(o.unref(S)):h(t)}function x(){var t;(t=v.value)==null||t.focus()}function I(){var t;(t=v.value)==null||t.blur()}return L({focus:x,blur:I,request:f}),(t,l)=>t.mode==="read"?(o.openBlock(),o.createElementBlock("span",U,o.toDisplayString(E.value),1)):(o.openBlock(),o.createBlock(o.unref(w.Select),o.mergeProps({key:1,ref_key:"selectRef",ref:v,"allow-clear":""},N.value,{mode:t.multiple?"multiple":void 0,value:q.value,options:o.unref(s),loading:u.value,"onUpdate:value":T,onFocus:O}),o.createSlots({_:2},[o.renderList(t.$slots,(n,a)=>({name:a,fn:o.withCtx(m=>[o.renderSlot(t.$slots,a,o.normalizeProps(o.guardReactiveProps(m||{})))])})),u.value?{name:"notFoundContent",fn:o.withCtx(()=>[o.createVNode(o.unref(w.Spin),{size:"small"})]),key:"0"}:void 0]),1040,["mode","value","options","loading"]))}});exports.default=D;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),i=require("lodash-unified"),w=require("@aplus-frontend/antdv");require("../../hooks/index.js");const k=require("../hooks/use-default-placeholder.js"),d=require("./use-select-options.js"),M=require("../../hooks/useControllableValue.js"),U={key:0},D=o.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},defaultValue:{},notFoundContent:{},suffixIcon:{},itemIcon:{},size:{},bordered:{type:Boolean,default:void 0},transitionName:{},choiceTransitionName:{},popupClassName:{},dropdownClassName:{},placement:{},status:{},children:{},listHeight:{},onMouseenter:{},onMouseleave:{},tabindex:{},onClick:{},onFocus:{},onBlur:{},onChange:{},onKeydown:{},onKeyup:{},onMousedown:{},onSelect:{},open:{type:Boolean,default:void 0},animation:{},direction:{},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},autofocus:{type:Boolean,default:void 0},getPopupContainer:{},virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{},options:{},showAction:{},onDeselect:{},loading:{type:Boolean,default:void 0},placeholder:{},clearIcon:{},allowClear:{type:Boolean,default:!0},fieldNames:{},dropdownStyle:{},dropdownRender:{},dropdownAlign:{},showSearch:{type:Boolean,default:void 0},searchValue:{},onInputKeyDown:{},removeIcon:{},maxTagCount:{},maxTagTextLength:{},maxTagPlaceholder:{},tokenSeparators:{},tagRender:{},optionLabelRender:{},onClear:{},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{},showArrow:{type:Boolean,default:void 0},onPopupScroll:{},menuItemSelectedIcon:{},listItemHeight:{},inputValue:{},autoClearSearchValue:{type:Boolean,default:void 0},filterOption:{},filterSort:{},optionFilterProp:{},optionLabelProp:{},defaultActiveFirstOption:{type:Boolean,default:void 0},onClickOption:{},labelInValue:{type:Boolean,default:void 0},emptyText:{default:"--"},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},addAll:{type:[Boolean,Number]},params:{},searchDelay:{default:300}},emits:["update:value"],setup(B,{expose:L,emit:b}){let r=0;const e=B,_=i.debounce(t=>{if(!i.isFunction(e.request))return;r+=1;const l=r;c([]),u.value=!0,e.request(t).then(n=>{r===l&&(c(n),u.value=!1)})},e.searchDelay),A=(t,l)=>{var a;const n=((a=e.fieldNames)==null?void 0:a.label)||"label";return typeof(l==null?void 0:l[n])=="string"&&l[n].toLowerCase().indexOf(t.toLowerCase())>-1},{options:s,updateOptions:c}=d.useSelectOptions(e),v=o.ref(),u=o.ref((e==null?void 0:e.loading)||!1),F=b;async function f(t=!0){if(!i.isFunction(e.request))return;u.value=!0,r+=1;const l=r;try{t&&c([]);const n=await e.request(void 0,e.params);if(l!==r)return;c(n)}finally{u.value=!1}}function O(t){var l;(l=e.onFocus)==null||l.call(e,t),e.refetchOnFocus&&r>0&&!u.value&&f(!0)}o.onMounted(()=>{e.lazy||f()}),o.watch(()=>e.params,()=>{f()},{deep:!0});const{value:p,updateValue:h}=M.useControllableValue(e,F),V=k.useDefaultPlaceholder("Select",e),E=o.computed(()=>{var m,g;const t=o.unref(p);if(!t)return e.emptyText;const l=((m=e.fieldNames)==null?void 0:m.label)||"label",n=((g=e.fieldNames)==null?void 0:g.value)||"value";if(i.isArray(t))return t.map(y=>{var C;return(C=o.unref(s).find(P=>P[n]===y))==null?void 0:C[l]}).filter(Boolean).join("、")||e.emptyText;const a=o.unref(s).find(y=>y[n]===t);return(a==null?void 0:a[l])||e.emptyText}),N=o.computed(()=>{const t=!!(e!=null&&e.showSearch),l=e.searchMode;let n={};return t&&(n=l==="request"?{showArrow:!1,defaultActiveFirstOption:!1,onSearch:_,notFoundContent:u.value?void 0:null,filterOption:!1}:{showArrow:!0,filterOption:i.isNil(e==null?void 0:e.filterOption)?A:e==null?void 0:e.filterOption}),{...i.omit(e,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect"]),placeholder:o.unref(V),...n}}),S=o.computed(()=>s.value.map(t=>{var l;return t[((l=e.fieldNames)==null?void 0:l.value)||"value"]}).filter(t=>t!==d.SELECT_ALL_VALUE_KEY)),q=o.computed(()=>{if(!e.multiple||!e.addAll)return o.unref(p);if(s.value.some(t=>{var l;return t[((l=e.fieldNames)==null?void 0:l.value)||"value"]===d.SELECT_ALL_VALUE_KEY})){const t=o.unref(S),l=o.unref(p)||[];if(t.length&&t.every(n=>l==null?void 0:l.includes(n)))return[d.SELECT_ALL_VALUE_KEY]}return o.unref(p)});function T(t){return e.multiple&&t.includes(d.SELECT_ALL_VALUE_KEY)?h(o.unref(S)):h(t)}function x(){var t;(t=v.value)==null||t.focus()}function I(){var t;(t=v.value)==null||t.blur()}return L({focus:x,blur:I,request:f}),(t,l)=>t.mode==="read"?(o.openBlock(),o.createElementBlock("span",U,o.toDisplayString(E.value),1)):(o.openBlock(),o.createBlock(o.unref(w.Select),o.mergeProps({key:1,ref_key:"selectRef",ref:v,"allow-clear":""},N.value,{mode:t.multiple?"multiple":void 0,value:q.value,options:o.unref(s),loading:u.value,"onUpdate:value":T,onFocus:O}),o.createSlots({_:2},[o.renderList(t.$slots,(n,a)=>({name:a,fn:o.withCtx(m=>[o.renderSlot(t.$slots,a,o.normalizeProps(o.guardReactiveProps(m||{})))])})),u.value?{name:"notFoundContent",fn:o.withCtx(()=>[o.createVNode(o.unref(w.Spin),{size:"small"})]),key:"0"}:void 0]),1040,["mode","value","options","loading"]))}});exports.default=D;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"@aplus-frontend/utils": "1.0.54"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@aplus-frontend/antdv": "^1.1.
|
|
74
|
+
"@aplus-frontend/antdv": "^1.1.1",
|
|
75
75
|
"@aplus-frontend/icon": "^1.2.1",
|
|
76
76
|
"@aplus-frontend/oss": "^1.1.2",
|
|
77
77
|
"vue": "^3.5.13"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@aplus-frontend/antdv": "^1.1.
|
|
80
|
+
"@aplus-frontend/antdv": "^1.1.1",
|
|
81
81
|
"@aplus-frontend/icon": "^1.2.1",
|
|
82
82
|
"@aplus-frontend/oss": "^1.1.2",
|
|
83
83
|
"@types/sortablejs": "^1.15.8",
|