@aplus-frontend/ui 0.5.14 → 0.5.16
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/index.mjs +41 -39
- 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/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +239 -236
- package/es/src/mask/index.d.ts +2 -0
- package/es/src/mask/index.mjs +1 -0
- package/es/src/mask/index.vue.d.ts +31 -0
- package/es/src/mask/index.vue.mjs +116 -0
- package/es/src/mask/index.vue2.mjs +4 -0
- package/es/src/mask/interface.d.ts +21 -0
- package/es/src/mask/utils.d.ts +2 -0
- package/es/src/mask/utils.mjs +21 -0
- package/lib/index.js +1 -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/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/mask/index.d.ts +2 -0
- package/lib/src/mask/index.js +1 -0
- package/lib/src/mask/index.vue.d.ts +31 -0
- package/lib/src/mask/index.vue.js +1 -0
- package/lib/src/mask/index.vue2.js +1 -0
- package/lib/src/mask/interface.d.ts +21 -0
- package/lib/src/mask/utils.d.ts +2 -0
- package/lib/src/mask/utils.js +6 -0
- package/package.json +3 -3
- package/theme/index.css +54 -0
- package/theme/index.less +1 -0
- package/theme/mask/index.css +54 -0
- package/theme/mask/index.less +28 -0
- package/theme/mixins/animations.css +24 -0
- package/theme/mixins/animations.less +38 -0
|
@@ -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
|
package/es/src/index.d.ts
CHANGED