@aplus-frontend/ui 0.4.5 → 0.4.7

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 (57) hide show
  1. package/es/src/ap-field/date/index.vue.d.ts +1 -0
  2. package/es/src/ap-field/date/index.vue.mjs +22 -15
  3. package/es/src/ap-field/date-range/index.vue.mjs +46 -42
  4. package/es/src/ap-field/hooks/use-default-presets.d.ts +11 -0
  5. package/es/src/ap-field/hooks/use-default-presets.mjs +15 -0
  6. package/es/src/ap-field/interface.d.ts +7 -1
  7. package/es/src/ap-table/ap-table.vue2.mjs +87 -85
  8. package/es/src/ap-table/components/dynamic-component/diff.d.ts +2 -0
  9. package/es/src/ap-table/components/dynamic-component/index.vue.d.ts +4 -0
  10. package/es/src/ap-table/components/dynamic-component/index.vue.mjs +4 -0
  11. package/es/src/ap-table/components/dynamic-component/index.vue2.mjs +14 -0
  12. package/es/src/ap-table/components/interface.d.ts +3 -0
  13. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +55 -55
  14. package/es/src/ap-table/constants.d.ts +3 -0
  15. package/es/src/ap-table/hooks/use-table-column-state.d.ts +2 -2
  16. package/es/src/ap-table/hooks/use-table-column-state.mjs +92 -92
  17. package/es/src/ap-table/utils.d.ts +1549 -1539
  18. package/es/src/ap-table/utils.mjs +115 -104
  19. package/es/src/ap-upload/components/Picture.vue2.mjs +59 -55
  20. package/es/src/business/batch-input-group/form-item.vue.mjs +7 -6
  21. package/es/src/business/batch-input-group/interface.d.ts +5 -0
  22. package/es/src/business/hooks/usePageListApTable.d.ts +2 -2
  23. package/es/src/locale/lang/en.mjs +10 -1
  24. package/es/src/locale/lang/zh-cn.mjs +10 -1
  25. package/es/src/utils/data-range-persets.d.ts +87 -0
  26. package/es/src/utils/data-range-persets.mjs +107 -0
  27. package/lib/src/ap-field/date/index.vue.d.ts +1 -0
  28. package/lib/src/ap-field/date/index.vue.js +1 -1
  29. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  30. package/lib/src/ap-field/hooks/use-default-presets.d.ts +11 -0
  31. package/lib/src/ap-field/hooks/use-default-presets.js +1 -0
  32. package/lib/src/ap-field/interface.d.ts +7 -1
  33. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  34. package/lib/src/ap-table/components/dynamic-component/diff.d.ts +2 -0
  35. package/lib/src/ap-table/components/dynamic-component/index.vue.d.ts +4 -0
  36. package/lib/src/ap-table/components/dynamic-component/index.vue.js +1 -0
  37. package/lib/src/ap-table/components/dynamic-component/index.vue2.js +1 -0
  38. package/lib/src/ap-table/components/interface.d.ts +3 -0
  39. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
  40. package/lib/src/ap-table/constants.d.ts +3 -0
  41. package/lib/src/ap-table/hooks/use-table-column-state.d.ts +2 -2
  42. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  43. package/lib/src/ap-table/utils.d.ts +1549 -1539
  44. package/lib/src/ap-table/utils.js +1 -1
  45. package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
  46. package/lib/src/business/batch-input-group/form-item.vue.js +1 -1
  47. package/lib/src/business/batch-input-group/interface.d.ts +5 -0
  48. package/lib/src/business/hooks/usePageListApTable.d.ts +2 -2
  49. package/lib/src/locale/lang/en.js +1 -1
  50. package/lib/src/locale/lang/zh-cn.js +1 -1
  51. package/lib/src/utils/data-range-persets.d.ts +87 -0
  52. package/lib/src/utils/data-range-persets.js +1 -0
  53. package/package.json +3 -3
  54. package/theme/ap-table/ap-table.css +4 -4
  55. package/theme/ap-table/ap-table.less +4 -4
  56. package/theme/ap-table-modal/index.css +4 -4
  57. package/theme/index.css +4 -4
@@ -56,6 +56,7 @@ declare const __VLS_component: DefineComponent<ApFieldDateProps, {}, {}, {}, {},
56
56
  showToday: boolean;
57
57
  showTime: boolean | SharedTimeProps<dayjs.Dayjs>;
58
58
  emptyText: string;
59
+ formatBegins: boolean;
59
60
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
60
61
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
61
62
  export default _default;
@@ -83,23 +83,24 @@ const le = /* @__PURE__ */ b({
83
83
  onChange: {},
84
84
  onOk: {},
85
85
  format: { default: "Y-D" },
86
+ formatBegins: { type: Boolean, default: !0 },
86
87
  timezone: {}
87
88
  },
88
89
  emits: ["update:value"],
89
90
  setup(h, { emit: B }) {
90
- const e = h, k = B, { value: p, updateValue: c } = Z(
91
+ const e = h, g = B, { value: m, updateValue: c } = Z(
91
92
  e,
92
- k
93
- ), P = Y("Date", e), n = i(
93
+ g
94
+ ), k = Y("Date", e), n = i(
94
95
  () => I.indexOf(e.format) > -1
95
96
  ), d = i(
96
97
  () => n.value ? H[e.format] : e.format
97
- ), m = i(() => {
98
- if (y(t(p)))
98
+ ), p = i(() => {
99
+ if (y(t(m)))
99
100
  return;
100
- let o = r(t(p));
101
- return e.timezone && (o = r(W(t(p), e.timezone))), o;
102
- }), g = i(() => t(n) ? e.picker ?? U[e.format] : e.picker), C = i(() => {
101
+ let o = r(t(m));
102
+ return e.timezone && (o = r(W(t(m), e.timezone))), o;
103
+ }), P = i(() => t(n) ? e.picker ?? U[e.format] : e.picker), C = i(() => {
103
104
  const o = t(n) ? K[e.format] : {};
104
105
  return {
105
106
  ...$(e, [
@@ -111,7 +112,7 @@ const le = /* @__PURE__ */ b({
111
112
  "onUpdate:value",
112
113
  "mode"
113
114
  ]),
114
- placeholder: t(P),
115
+ placeholder: t(k),
115
116
  ...o
116
117
  };
117
118
  }), f = L(e.timezone);
@@ -122,14 +123,19 @@ const le = /* @__PURE__ */ b({
122
123
  }
123
124
  const l = r(o);
124
125
  c(
125
- f(l, t(n) ? t(d) : void 0)
126
+ f(
127
+ l,
128
+ t(n) ? t(d) : void 0,
129
+ e.formatBegins
130
+ )
126
131
  );
127
132
  }
128
133
  function T(o, l) {
129
134
  var s;
130
135
  const u = r(o), a = o ? f(
131
136
  u,
132
- t(n) ? t(d) : void 0
137
+ t(n) ? t(d) : void 0,
138
+ e.formatBegins
133
139
  ) : null;
134
140
  (s = e.onChange) == null || s.call(e, a, l);
135
141
  }
@@ -137,16 +143,17 @@ const le = /* @__PURE__ */ b({
137
143
  var a;
138
144
  const l = r(o), u = o ? f(
139
145
  l,
140
- t(n) ? t(d) : void 0
146
+ t(n) ? t(d) : void 0,
147
+ e.formatBegins
141
148
  ) : null;
142
149
  (a = e.onOk) == null || a.call(e, u);
143
150
  }
144
151
  return (o, l) => o.mode === "read" ? (v(), _(w, { key: 0 }, [
145
- M(R(m.value ? t(r)(m.value).format(d.value) : o.emptyText), 1)
152
+ M(R(p.value ? t(r)(p.value).format(d.value) : o.emptyText), 1)
146
153
  ], 64)) : (v(), F(t(j), A({ key: 1 }, C.value, {
147
- value: m.value,
154
+ value: p.value,
148
155
  format: d.value,
149
- picker: g.value,
156
+ picker: P.value,
150
157
  "onUpdate:value": O,
151
158
  onChange: T,
152
159
  onOk: S
@@ -1,16 +1,17 @@
1
- import { defineComponent as U, useSlots as H, computed as m, unref as n, isVNode as K, createVNode as T, Fragment as h, openBlock as g, createElementBlock as v, createTextVNode as B, toDisplayString as P, createBlock as O, resolveDynamicComponent as $, mergeProps as L, createSlots as W, renderList as Y, withCtx as Z, renderSlot as q, normalizeProps as G, guardReactiveProps as J } from "vue";
2
- import { ApFieldDatePresetFormats as Q, PRESET_FORMAT_MAP as X, PRESET_FORMAT_PICK_MAP as ee, PRESET_FORMAT_TIME_MAP as oe } from "../date/constant.mjs";
1
+ import { defineComponent as H, useSlots as K, computed as m, unref as n, isVNode as $, createVNode as T, Fragment as h, openBlock as g, createElementBlock as v, createTextVNode as B, toDisplayString as P, createBlock as O, resolveDynamicComponent as L, mergeProps as W, createSlots as Y, renderList as Z, withCtx as q, renderSlot as G, normalizeProps as J, guardReactiveProps as Q } from "vue";
2
+ import { ApFieldDatePresetFormats as X, PRESET_FORMAT_MAP as ee, PRESET_FORMAT_PICK_MAP as oe, PRESET_FORMAT_TIME_MAP as ne } from "../date/constant.mjs";
3
3
  import "../../hooks/index.mjs";
4
- import { isNil as b, omit as R, isString as c, isFunction as ne } from "lodash-unified";
4
+ import { isNil as b, omit as R, isString as c, isFunction as te } from "lodash-unified";
5
5
  import u from "dayjs";
6
- import { DatePicker as te } from "@aplus-frontend/antdv";
7
- import { formatDayWithTimezone as ae } from "../date/helper.mjs";
8
- import { SwapRightOutlined as re } from "@ant-design/icons-vue";
9
- import { omitUndefined as le } from "../../utils/index.mjs";
6
+ import { DatePicker as ae } from "@aplus-frontend/antdv";
7
+ import { formatDayWithTimezone as re } from "../date/helper.mjs";
8
+ import { SwapRightOutlined as le } from "@ant-design/icons-vue";
9
+ import { omitUndefined as ue } from "../../utils/index.mjs";
10
10
  import { getTimeFormatToZone as w } from "@aplus-frontend/utils";
11
- import { useDefaultPlaceholder as ue } from "../hooks/use-default-placeholder.mjs";
12
- import { useControllableValue as de } from "../../hooks/useControllableValue.mjs";
13
- const Be = /* @__PURE__ */ U({
11
+ import { useDefaultPlaceholder as de } from "../hooks/use-default-placeholder.mjs";
12
+ import { useDefaultPresets as ie } from "../hooks/use-default-presets.mjs";
13
+ import { useControllableValue as se } from "../../hooks/useControllableValue.mjs";
14
+ const De = /* @__PURE__ */ H({
14
15
  __name: "index",
15
16
  props: {
16
17
  mode: {
@@ -26,7 +27,6 @@ const Be = /* @__PURE__ */ U({
26
27
  default: void 0
27
28
  },
28
29
  disabledTime: {},
29
- presets: {},
30
30
  ranges: {},
31
31
  separator: {
32
32
  type: [Object, String, Number, Boolean, null, Array],
@@ -147,60 +147,64 @@ const Be = /* @__PURE__ */ U({
147
147
  default: "Y-D"
148
148
  },
149
149
  timezone: {},
150
- readModeSeparator: {}
150
+ readModeSeparator: {},
151
+ presets: {
152
+ type: [Array, Boolean]
153
+ }
151
154
  },
152
155
  emits: ["update:value"],
153
156
  setup(_, {
154
157
  emit: A
155
158
  }) {
156
- const o = _, F = A, k = H(), d = m(() => Q.indexOf(o.format) > -1), i = m(() => d.value ? X[o.format] : o.format), {
159
+ const o = _, F = A, k = K(), d = m(() => X.indexOf(o.format) > -1), i = m(() => d.value ? ee[o.format] : o.format), {
157
160
  value: y,
158
161
  updateValue: C
159
- } = de(o, F), N = ue("DateRange", o), f = ae(o.timezone), S = m(() => {
162
+ } = se(o, F), N = de("DateRange", o), x = ie(o), s = re(o.timezone), S = m(() => {
160
163
  var a, l;
161
164
  const e = n(y);
162
165
  if (b(e) || !(e != null && e.length))
163
166
  return e;
164
167
  const r = o.timezone ? w(n(y)[0], o.timezone) : (a = n(y)) == null ? void 0 : a[0], t = o.timezone ? w(n(y)[1], o.timezone) : (l = n(y)) == null ? void 0 : l[1];
165
168
  return [u(r), u(t)];
166
- }), x = m(() => n(d) ? o.picker ?? ee[o.format] : o.picker), z = m(() => {
167
- const e = n(d) ? oe[o.format] : {};
169
+ }), z = m(() => n(d) ? o.picker ?? oe[o.format] : o.picker), E = m(() => {
170
+ const e = n(d) ? ne[o.format] : {};
168
171
  return {
169
- ...le(R(o, ["value", "onUpdate:value", "onChange", "onOk", "format", "mode"])),
172
+ ...ue(R(o, ["value", "onUpdate:value", "onChange", "onOk", "format", "mode", "presets"])),
170
173
  placeholder: n(N),
174
+ presets: n(x),
171
175
  ...e
172
176
  };
173
177
  });
174
- function E(e) {
178
+ function V(e) {
175
179
  if (!e) {
176
180
  C(e);
177
181
  return;
178
182
  }
179
183
  let r = c(e[0]) ? u(e[0]) : e[0], t = c(e[1]) ? u(e[1]) : e[1];
180
184
  const a = n(d) ? n(i) : void 0;
181
- C([f(r, a), f(t, a, !1)]);
185
+ C([s(r, a), s(t, a, !1)]);
182
186
  }
183
- function V(e) {
187
+ function I(e) {
184
188
  var p;
185
- const r = c(e[0]) ? u(e[0]) : e[0], t = c(e[1]) ? u(e[1]) : e[1], a = n(d) ? n(i) : void 0, l = e[0] ? f(r, a) : null, s = e[1] ? f(t, a, !1) : null;
186
- (p = o.onOk) == null || p.call(o, [l, s]);
189
+ const r = c(e[0]) ? u(e[0]) : e[0], t = c(e[1]) ? u(e[1]) : e[1], a = n(d) ? n(i) : void 0, l = e[0] ? s(r, a) : null, f = e[1] ? s(t, a, !1) : null;
190
+ (p = o.onOk) == null || p.call(o, [l, f]);
187
191
  }
188
- function I(e, r) {
189
- var M, D;
192
+ function j(e, r) {
193
+ var D, M;
190
194
  if (b(e)) {
191
- (M = o.onChange) == null || M.call(o, e, r);
195
+ (D = o.onChange) == null || D.call(o, e, r);
192
196
  return;
193
197
  }
194
- const t = c(e[0]) ? u(e[0]) : e[0], a = c(e[1]) ? u(e[1]) : e[1], l = n(d) ? n(i) : void 0, s = e[0] ? f(t, l) : null, p = e[1] ? f(a, l, !1) : null;
195
- (D = o.onChange) == null || D.call(o, [s, p], r);
198
+ const t = c(e[0]) ? u(e[0]) : e[0], a = c(e[1]) ? u(e[1]) : e[1], l = n(d) ? n(i) : void 0, f = e[0] ? s(t, l) : null, p = e[1] ? s(a, l, !1) : null;
199
+ (M = o.onChange) == null || M.call(o, [f, p], r);
196
200
  }
197
- const j = m(() => {
201
+ const U = m(() => {
198
202
  var t;
199
203
  const e = o.readModeSeparator;
200
204
  if (e)
201
- return K(e) || ne(e) ? o.readModeSeparator : T(h, null, [o.readModeSeparator]);
205
+ return $(e) || te(e) ? o.readModeSeparator : T(h, null, [o.readModeSeparator]);
202
206
  const r = (t = k.readModeSeparator) == null ? void 0 : t.call(k);
203
- return r ? T(h, null, [r]) : re;
207
+ return r ? T(h, null, [r]) : le;
204
208
  });
205
209
  return (e, r) => {
206
210
  var t, a;
@@ -208,26 +212,26 @@ const Be = /* @__PURE__ */ U({
208
212
  key: 0
209
213
  }, [S.value ? (g(), v(h, {
210
214
  key: 0
211
- }, [B(P((t = S.value[0]) == null ? void 0 : t.format(i.value)) + " ", 1), (g(), O($(j.value))), B(" " + P((a = S.value[1]) == null ? void 0 : a.format(i.value)), 1)], 64)) : (g(), v(h, {
215
+ }, [B(P((t = S.value[0]) == null ? void 0 : t.format(i.value)) + " ", 1), (g(), O(L(U.value))), B(" " + P((a = S.value[1]) == null ? void 0 : a.format(i.value)), 1)], 64)) : (g(), v(h, {
212
216
  key: 1
213
- }, [B(P(e.emptyText), 1)], 64))], 64)) : (g(), O(n(te).RangePicker, L({
217
+ }, [B(P(e.emptyText), 1)], 64))], 64)) : (g(), O(n(ae).RangePicker, W({
214
218
  key: 1
215
- }, z.value, {
219
+ }, E.value, {
216
220
  value: S.value,
217
- picker: x.value,
221
+ picker: z.value,
218
222
  format: i.value,
219
- "onUpdate:value": E,
220
- onChange: I,
221
- onOk: V
222
- }), W({
223
+ "onUpdate:value": V,
224
+ onChange: j,
225
+ onOk: I
226
+ }), Y({
223
227
  _: 2
224
- }, [Y(n(R)(e.$slots, "readModeSeparator"), (l, s) => ({
225
- name: s,
226
- fn: Z((p) => [q(e.$slots, s, G(J(p || {})))])
228
+ }, [Z(n(R)(e.$slots, "readModeSeparator"), (l, f) => ({
229
+ name: f,
230
+ fn: q((p) => [G(e.$slots, f, J(Q(p || {})))])
227
231
  }))]), 1040, ["value", "picker", "format"]));
228
232
  };
229
233
  }
230
234
  });
231
235
  export {
232
- Be as default
236
+ De as default
233
237
  };
@@ -0,0 +1,11 @@
1
+ import { ApFieldDateRangeProps, BasicApFieldProps } from '../interface';
2
+ import { Dayjs } from 'dayjs';
3
+ import { ComputedRef } from 'vue';
4
+ import { VueNode } from '@aplus-frontend/antdv/es/_util/type';
5
+ export declare const useDefaultPresets: (props: BasicApFieldProps<{
6
+ presets?: ApFieldDateRangeProps["presets"];
7
+ timezone?: ApFieldDateRangeProps["timezone"];
8
+ }>) => ComputedRef<{
9
+ label: VueNode;
10
+ value: Dayjs[];
11
+ }[] | undefined>;
@@ -0,0 +1,15 @@
1
+ import { computed as r } from "vue";
2
+ import { presetsDefault as f } from "../../utils/data-range-persets.mjs";
3
+ const b = (e) => r(() => {
4
+ var t, u;
5
+ return e.presets === !0 ? f(e == null ? void 0 : e.timezone) : (u = (t = e == null ? void 0 : e.presets) == null ? void 0 : t.map) == null ? void 0 : u.call(t, (l) => {
6
+ var a;
7
+ return {
8
+ label: l.label,
9
+ value: (a = l == null ? void 0 : l.value) == null ? void 0 : a.filter((m) => m !== null)
10
+ };
11
+ });
12
+ });
13
+ export {
14
+ b as useDefaultPresets
15
+ };
@@ -41,6 +41,11 @@ 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
+ * 格式化时间时是否以`format`的开始
46
+ * @default true
47
+ */
48
+ formatBegins?: boolean;
44
49
  /**
45
50
  * 指定时区,指定后value会变为特定时区下的timestamp
46
51
  */
@@ -84,7 +89,7 @@ export type ApFieldTextAreaExpose = {
84
89
  blur: () => void;
85
90
  resizableTextArea: any;
86
91
  };
87
- export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'value' | 'onChange' | 'onPanelChange' | 'defaultValue' | 'onOk' | 'renderExtraFooter' | 'onUpdate:value' | 'mode' | 'format'>> & {
92
+ export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'value' | 'onChange' | 'onPanelChange' | 'defaultValue' | 'onOk' | 'renderExtraFooter' | 'onUpdate:value' | 'mode' | 'format' | 'presets'>> & {
88
93
  emptyText?: string;
89
94
  value?: RangeValue<number> | null;
90
95
  defaultValue?: RangeValue<number>;
@@ -99,6 +104,7 @@ export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'va
99
104
  * 只读模式下的分隔符(比插槽优先级更高)
100
105
  */
101
106
  readModeSeparator?: any;
107
+ presets?: RangePickerProps['presets'] | true;
102
108
  };
103
109
  export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'value' | 'onUpdate:value' | 'onSearch'>> & {
104
110
  emptyText?: string;