@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.
Files changed (43) hide show
  1. package/es/index.mjs +41 -39
  2. package/es/src/ap-field/date/constant.d.ts +1 -1
  3. package/es/src/ap-field/date/constant.mjs +14 -2
  4. package/es/src/ap-field/date/index.vue.mjs +59 -58
  5. package/es/src/ap-field/date/interface.d.ts +1 -1
  6. package/es/src/ap-field/date-range/index.vue.mjs +67 -66
  7. package/es/src/ap-field/interface.d.ts +8 -0
  8. package/es/src/ap-field/select/index.vue.mjs +2 -1
  9. package/es/src/index.d.ts +1 -0
  10. package/es/src/index.mjs +239 -236
  11. package/es/src/mask/index.d.ts +2 -0
  12. package/es/src/mask/index.mjs +1 -0
  13. package/es/src/mask/index.vue.d.ts +31 -0
  14. package/es/src/mask/index.vue.mjs +116 -0
  15. package/es/src/mask/index.vue2.mjs +4 -0
  16. package/es/src/mask/interface.d.ts +21 -0
  17. package/es/src/mask/utils.d.ts +2 -0
  18. package/es/src/mask/utils.mjs +21 -0
  19. package/lib/index.js +1 -1
  20. package/lib/src/ap-field/date/constant.d.ts +1 -1
  21. package/lib/src/ap-field/date/constant.js +1 -1
  22. package/lib/src/ap-field/date/index.vue.js +1 -1
  23. package/lib/src/ap-field/date/interface.d.ts +1 -1
  24. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  25. package/lib/src/ap-field/interface.d.ts +8 -0
  26. package/lib/src/ap-field/select/index.vue.js +1 -1
  27. package/lib/src/index.d.ts +1 -0
  28. package/lib/src/index.js +1 -1
  29. package/lib/src/mask/index.d.ts +2 -0
  30. package/lib/src/mask/index.js +1 -0
  31. package/lib/src/mask/index.vue.d.ts +31 -0
  32. package/lib/src/mask/index.vue.js +1 -0
  33. package/lib/src/mask/index.vue2.js +1 -0
  34. package/lib/src/mask/interface.d.ts +21 -0
  35. package/lib/src/mask/utils.d.ts +2 -0
  36. package/lib/src/mask/utils.js +6 -0
  37. package/package.json +3 -3
  38. package/theme/index.css +54 -0
  39. package/theme/index.less +1 -0
  40. package/theme/mask/index.css +54 -0
  41. package/theme/mask/index.less +28 -0
  42. package/theme/mixins/animations.css +24 -0
  43. package/theme/mixins/animations.less +38 -0
@@ -1,18 +1,18 @@
1
- import { defineComponent as Y, useSlots as Z, computed as y, unref as t, isVNode as q, createVNode as T, Fragment as v, createElementBlock as k, createBlock as C, openBlock as d, createTextVNode as B, toDisplayString as P, resolveDynamicComponent as J, normalizeStyle as Q, withCtx as D, createCommentVNode as X, isRef as z, renderList as R, mergeProps as ee, createSlots as ne, renderSlot as oe, normalizeProps as te, guardReactiveProps as ae } from "vue";
2
- import { ApFieldDatePresetFormats as re, PRESET_FORMAT_MAP as le, PRESET_FORMAT_PICK_MAP as ue, PRESET_FORMAT_TIME_MAP as de } from "../date/constant.mjs";
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 w, omit as _, isString as h, isFunction as ie } from "lodash-unified";
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 se, Select as fe, SelectOption as pe, DatePicker as me } from "@aplus-frontend/antdv";
7
- import { formatDayWithTimezone as ce } from "../date/helper.mjs";
8
- import { SwapRightOutlined as ye } from "@ant-design/icons-vue";
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 F } from "@aplus-frontend/utils";
11
- import { useDefaultPlaceholder as he } from "../hooks/use-default-placeholder.mjs";
12
- import { useDefaultPresets as ge } from "../hooks/use-default-presets.mjs";
13
- import { useDateTimezone as Se } from "../hooks/use-date-timezone.mjs";
14
- import { useControllableValue as ke } from "../../hooks/useControllableValue.mjs";
15
- const xe = /* @__PURE__ */ Y({
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(N, {
158
- emit: x
158
+ setup(x, {
159
+ emit: E
159
160
  }) {
160
- const n = N, E = x, O = Z(), s = y(() => re.indexOf(n.format) > -1), f = y(() => s.value ? le[n.format] : n.format), {
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: M
163
- } = ke(n, E), V = he("DateRange", n), {
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
- } = Se(n), {
166
- presets: I,
167
- changeCurrentDate: U
168
- } = ge({
166
+ } = ke(n), {
167
+ presets: j,
168
+ changeCurrentDate: H
169
+ } = Se({
169
170
  ...n,
170
171
  timezone: u
171
- }), p = (e, a, r = !0) => ce(u.value)(e, a, r), S = y(() => {
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 (w(e) || !(e != null && e.length))
175
+ if (F(e) || !(e != null && e.length))
175
176
  return e;
176
- const a = u.value ? F(t(g)[0], u.value) : (l = t(g)) == null ? void 0 : l[0], r = n.timezone ? F(t(g)[1], u.value) : (o = t(g)) == null ? void 0 : o[1];
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
- }), j = y(() => t(s) ? n.picker ?? ue[n.format] : n.picker), H = y(() => {
179
- const e = t(s) ? de[n.format] : {};
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(V),
183
- presets: t(I),
183
+ placeholder: t(U),
184
+ presets: t(j),
184
185
  ...e
185
186
  };
186
187
  });
187
- function K(e) {
188
+ function G(e) {
188
189
  if (!e) {
189
- M(e);
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(f) : void 0;
194
- M([p(a, l), p(r, l, !1)]);
194
+ const l = t(s) ? t(v) : void 0;
195
+ w([m(a, l), m(r, l, !1)]);
195
196
  }
196
- function $(e) {
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(f) : void 0, o = e[0] ? p(a, l) : null, m = e[1] ? p(r, l, !1) : null;
199
- (c = n.onOk) == null || c.call(n, [o, m]);
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 G(e) {
202
+ function W(e) {
202
203
  var a;
203
- e && U(), (a = n.onOpenChange) == null || a.call(n, e);
204
+ e && H(), (a = n.onOpenChange) == null || a.call(n, e);
204
205
  }
205
- function L(e, a) {
206
- var b, A;
207
- if (w(e)) {
208
- (b = n.onChange) == null || b.call(n, e, a);
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(f) : void 0, m = e[0] ? p(r, o) : null, c = e[1] ? p(l, o, !1) : null;
212
- (A = n.onChange) == null || A.call(n, [m, c], a);
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 W = y(() => {
215
+ const Z = f(() => {
215
216
  var r;
216
217
  const e = n.readModeSeparator;
217
218
  if (e)
218
- return q(e) || ie(e) ? n.readModeSeparator : T(v, null, [n.readModeSeparator]);
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(v, null, [a]) : ye;
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(v, {
225
+ return e.mode === "read" ? (d(), k(y, {
225
226
  key: 0
226
- }, [S.value ? (d(), k(v, {
227
+ }, [S.value ? (d(), k(y, {
227
228
  key: 0
228
- }, [B(P((r = S.value[0]) == null ? void 0 : r.format(f.value)) + " ", 1), (d(), C(J(W.value))), B(" " + P((l = S.value[1]) == null ? void 0 : l.format(f.value)), 1)], 64)) : (d(), k(v, {
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(se), {
231
+ }, [B(P(e.emptyText), 1)], 64))], 64)) : (d(), C(t(fe), {
231
232
  key: 1,
232
233
  compact: "",
233
- style: Q({
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(fe), {
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) => z(u) ? u.value = o : null),
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(v, null, R(n.timezone, (o) => (d(), C(t(pe), {
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"])) : X("", !0), T(t(me).RangePicker, ee(H.value, {
253
+ }, 8, ["value"])) : ee("", !0), T(t(ce).RangePicker, oe($.value, {
253
254
  value: S.value,
254
- picker: j.value,
255
- format: f.value,
256
- "onUpdate:value": K,
257
- onChange: L,
258
- onOk: $,
259
- onOpenChange: G
260
- }), ne({
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
- }, [R(t(_)(e.$slots, "readModeSeparator"), (o, m) => ({
263
- name: m,
264
- fn: D((c) => [oe(e.$slots, m, te(ae(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
- xe as default
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
@@ -24,3 +24,4 @@ export * from './full-screen';
24
24
  export * from './resize-observer';
25
25
  export * from './ap-grid';
26
26
  export * from './text';
27
+ export * from './mask';