@aplus-frontend/ui 7.13.9 → 7.13.10

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/src/ag-grid/hooks/use-columns.d.ts +2 -0
  2. package/es/src/ag-grid/hooks/use-columns.mjs +35 -17
  3. package/es/src/ag-grid/index.vue.mjs +323 -292
  4. package/es/src/ap-field/date-range/index.vue.mjs +18 -18
  5. package/es/src/ap-field/date-range/read.vue2.mjs +3 -3
  6. package/es/src/ap-field/hooks/use-default-presets.mjs +59 -16
  7. package/es/src/ap-field/interface.d.ts +46 -1
  8. package/es/src/ap-table/hooks/use-sorted-filtered.d.ts +18 -2
  9. package/es/src/ap-table/hooks/use-sorted-filtered.mjs +13 -11
  10. package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +17 -2
  11. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +148 -142
  12. package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +119 -112
  13. package/es/src/business/ap-export-group/handleExportDownload.d.ts +1 -1
  14. package/es/src/business/ap-export-group/handleExportDownload.mjs +2 -2
  15. package/es/src/business/ap-export-group/interface.d.ts +9 -0
  16. package/es/src/config-provider/config-provider-props.d.ts +1 -1
  17. package/es/src/config-provider/config-provider.d.ts +3 -0
  18. package/es/src/config-provider/hooks/use-global-config.d.ts +1 -0
  19. package/es/src/config-provider/index.d.ts +6 -0
  20. package/es/src/version.d.ts +1 -1
  21. package/es/src/version.mjs +1 -1
  22. package/lib/src/ag-grid/hooks/use-columns.d.ts +2 -0
  23. package/lib/src/ag-grid/hooks/use-columns.js +1 -1
  24. package/lib/src/ag-grid/index.vue.js +1 -1
  25. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  26. package/lib/src/ap-field/date-range/read.vue2.js +1 -1
  27. package/lib/src/ap-field/hooks/use-default-presets.js +1 -1
  28. package/lib/src/ap-field/interface.d.ts +46 -1
  29. package/lib/src/ap-table/hooks/use-sorted-filtered.d.ts +18 -2
  30. package/lib/src/ap-table/hooks/use-sorted-filtered.js +1 -1
  31. package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +17 -2
  32. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
  33. package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -1
  34. package/lib/src/business/ap-export-group/handleExportDownload.d.ts +1 -1
  35. package/lib/src/business/ap-export-group/handleExportDownload.js +1 -1
  36. package/lib/src/business/ap-export-group/interface.d.ts +9 -0
  37. package/lib/src/config-provider/config-provider-props.d.ts +1 -1
  38. package/lib/src/config-provider/config-provider.d.ts +3 -0
  39. package/lib/src/config-provider/hooks/use-global-config.d.ts +1 -0
  40. package/lib/src/config-provider/index.d.ts +6 -0
  41. package/lib/src/version.d.ts +1 -1
  42. package/lib/src/version.js +1 -1
  43. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
- import { defineComponent as L, useSlots as Y, computed as s, unref as t, isVNode as Z, createVNode as O, Fragment as m, createElementBlock as g, createBlock as k, openBlock as u, createTextVNode as S, toDisplayString as C, resolveDynamicComponent as q, normalizeStyle as J, withCtx as B, createCommentVNode as Q, isRef as X, renderList as w, mergeProps as ee, createSlots as oe, renderSlot as te, normalizeProps as ne, guardReactiveProps as ae } from "vue";
1
+ import { defineComponent as L, useSlots as Y, computed as s, unref as t, isVNode as Z, createVNode as D, Fragment as m, createElementBlock as g, createBlock as k, openBlock as u, createTextVNode as S, toDisplayString as C, resolveDynamicComponent as q, normalizeStyle as J, withCtx as B, createCommentVNode as Q, isRef as X, renderList as w, mergeProps as ee, createSlots as oe, renderSlot as te, normalizeProps as ne, guardReactiveProps as ae } from "vue";
2
2
  import { SwapRightOutlined as re } from "@ant-design/icons-vue";
3
3
  import { InputGroup as le, Select as ue, SelectOption as de, DatePicker as ie } from "@aplus-frontend/antdv";
4
4
  import { getTimeFormatToZone as T } from "@aplus-frontend/utils";
5
5
  import d from "dayjs";
6
- import { isNil as M, omit as b, isString as c, isFunction as se } from "lodash-unified";
6
+ import { isNil as b, omit as M, isString as c, isFunction as se } from "lodash-unified";
7
7
  import "../../hooks/index.mjs";
8
8
  import { omitUndefined as pe } from "../../utils/index.mjs";
9
9
  import { ApFieldDatePresetFormats as fe, PRESET_FORMAT_MAP as A, PRESET_FORMAT_PICK_MAP as me, PRESET_FORMAT_TIME_MAP as ce } from "../date/constant.mjs";
@@ -157,7 +157,7 @@ const ze = /* @__PURE__ */ L({
157
157
  timezone: {},
158
158
  readModeSeparator: {},
159
159
  presets: {
160
- type: [Array, Boolean]
160
+ type: [Array, Boolean, Object]
161
161
  }
162
162
  },
163
163
  emits: ["update:value"],
@@ -177,20 +177,20 @@ const ze = /* @__PURE__ */ L({
177
177
  timezone: l
178
178
  }), p = (e, a, n = !0) => ye(l.value)(e, a, n), h = s(() => {
179
179
  const e = t(v);
180
- if (M(e) || !e?.length)
180
+ if (b(e) || !e?.length)
181
181
  return e;
182
182
  const a = l.value ? T(t(v)[0], l.value) : t(v)?.[0], n = o.timezone ? T(t(v)[1], l.value) : t(v)?.[1];
183
183
  return [d(a), d(n)];
184
- }), I = s(() => t(i) ? o.picker ?? me[o.format] : o.picker), U = s(() => {
184
+ }), j = s(() => t(i) ? o.picker ?? me[o.format] : o.picker), I = s(() => {
185
185
  const e = t(i) ? ce[o.format] : {};
186
186
  return {
187
- ...pe(b(o, ["value", "onUpdate:value", "onChange", "onOk", "format", "mode", "presets"])),
187
+ ...pe(M(o, ["value", "onUpdate:value", "onChange", "onOk", "format", "mode", "presets"])),
188
188
  placeholder: t(x),
189
189
  presets: t(E),
190
190
  ...e
191
191
  };
192
192
  });
193
- function j(e) {
193
+ function U(e) {
194
194
  if (!e) {
195
195
  P(e);
196
196
  return;
@@ -200,26 +200,26 @@ const ze = /* @__PURE__ */ L({
200
200
  P([p(a, r), p(n, r, !1)]);
201
201
  }
202
202
  function H(e) {
203
- const a = c(e[0]) ? d(e[0]) : e[0], n = c(e[1]) ? d(e[1]) : e[1], r = t(i) ? t(y) : void 0, f = e[0] ? p(a, r) : null, D = e[1] ? p(n, r, !1) : null;
204
- o.onOk?.([f, D]);
203
+ const a = c(e[0]) ? d(e[0]) : e[0], n = c(e[1]) ? d(e[1]) : e[1], r = t(i) ? t(y) : void 0, f = e[0] ? p(a, r) : null, O = e[1] ? p(n, r, !1) : null;
204
+ o.onOk?.([f, O]);
205
205
  }
206
206
  function K(e) {
207
207
  e && V(), o.onOpenChange?.(e);
208
208
  }
209
209
  function W(e, a) {
210
- if (M(e)) {
210
+ if (b(e)) {
211
211
  o.onChange?.(e, a);
212
212
  return;
213
213
  }
214
- const n = c(e[0]) ? d(e[0]) : e[0], r = c(e[1]) ? d(e[1]) : e[1], f = t(i) ? t(y) : void 0, D = e[0] ? p(n, f) : null, G = e[1] ? p(r, f, !1) : null;
215
- o.onChange?.([D, G], a);
214
+ const n = c(e[0]) ? d(e[0]) : e[0], r = c(e[1]) ? d(e[1]) : e[1], f = t(i) ? t(y) : void 0, O = e[0] ? p(n, f) : null, G = e[1] ? p(r, f, !1) : null;
215
+ o.onChange?.([O, G], a);
216
216
  }
217
217
  const $ = s(() => {
218
218
  const e = o.readModeSeparator;
219
219
  if (e)
220
- return Z(e) || se(e) ? o.readModeSeparator : O(m, null, [o.readModeSeparator]);
220
+ return Z(e) || se(e) ? o.readModeSeparator : D(m, null, [o.readModeSeparator]);
221
221
  const a = z.readModeSeparator?.();
222
- return a ? O(m, null, [a]) : re;
222
+ return a ? D(m, null, [a]) : re;
223
223
  });
224
224
  return (e, a) => e.mode === "read" ? (u(), g(m, {
225
225
  key: 0
@@ -249,17 +249,17 @@ const ze = /* @__PURE__ */ L({
249
249
  _: 2
250
250
  }, 1032, ["value"]))), 128))]),
251
251
  _: 1
252
- }, 8, ["value"])) : Q("", !0), O(t(ie).RangePicker, ee(U.value, {
252
+ }, 8, ["value"])) : Q("", !0), D(t(ie).RangePicker, ee(I.value, {
253
253
  value: h.value,
254
- picker: I.value,
254
+ picker: j.value,
255
255
  format: N.value,
256
- "onUpdate:value": j,
256
+ "onUpdate:value": U,
257
257
  onChange: W,
258
258
  onOk: H,
259
259
  onOpenChange: K
260
260
  }), oe({
261
261
  _: 2
262
- }, [w(t(b)(e.$slots, "readModeSeparator"), (n, r) => ({
262
+ }, [w(t(M)(e.$slots, "readModeSeparator"), (n, r) => ({
263
263
  name: r,
264
264
  fn: B((f) => [te(e.$slots, r, ne(ae(f || {})))])
265
265
  }))]), 1040, ["value", "picker", "format"])]),
@@ -3,7 +3,7 @@ import { getTimeFormatToZone as m } from "@aplus-frontend/utils";
3
3
  import c from "dayjs";
4
4
  import { isNil as g } from "lodash-unified";
5
5
  import { ApFieldDatePresetFormats as w, PRESET_FORMAT_MAP as C } from "../date/constant.mjs";
6
- import { useDateTimezone as S } from "../hooks/use-date-timezone.mjs";
6
+ import { useDateTimezone as O } from "../hooks/use-date-timezone.mjs";
7
7
  const M = /* @__PURE__ */ v({
8
8
  name: "ApFieldDateRangeRead",
9
9
  __name: "read",
@@ -86,10 +86,10 @@ const M = /* @__PURE__ */ v({
86
86
  shownFormat: {},
87
87
  timezone: {},
88
88
  readModeSeparator: {},
89
- presets: { type: [Array, Boolean] }
89
+ presets: { type: [Array, Boolean, Object] }
90
90
  },
91
91
  setup(y) {
92
- const e = y, { currentTimezone: a } = S(e), t = n(() => {
92
+ const e = y, { currentTimezone: a } = O(e), t = n(() => {
93
93
  const o = e.value;
94
94
  if (g(o) || !o?.length)
95
95
  return o;
@@ -1,26 +1,69 @@
1
1
  import u from "dayjs";
2
- import { ref as s, computed as n } from "vue";
2
+ import { merge as f } from "lodash-unified";
3
+ import { ref as m, computed as D } from "vue";
3
4
  import "../../config-provider/index.mjs";
4
- import { presetsDefault as o } from "../../utils/data-range-persets.mjs";
5
- import { useLocale as f } from "../../config-provider/hooks/use-locale.mjs";
6
- const p = (e) => {
7
- const a = s(u().valueOf()), { t: l } = f();
5
+ import { presetsDefault as l } from "../../utils/data-range-persets.mjs";
6
+ import { useLocale as h } from "../../config-provider/hooks/use-locale.mjs";
7
+ const W = (t) => {
8
+ const a = m(u().valueOf()), { t: s } = h();
8
9
  return {
9
- presets: n(() => e.presets === !0 ? o(
10
- e?.timezone?.value,
11
- a.value,
12
- l
13
- )?.filter(({ value: t }) => t.every(
14
- (r) => e.disabledDate ? !e.disabledDate(r) : !0
15
- )) : e?.presets?.map?.((t) => ({
16
- label: t.label,
17
- value: t?.value?.filter((r) => r !== null)
18
- }))),
10
+ presets: D(() => {
11
+ if (t.presets === !0)
12
+ return l(
13
+ t?.timezone?.value,
14
+ a.value,
15
+ s
16
+ )?.filter(({ value: e }) => e.every(
17
+ (r) => t.disabledDate ? !t.disabledDate(r) : !0
18
+ ));
19
+ if (typeof t.presets == "object" && !Array.isArray(t.presets)) {
20
+ const e = f(
21
+ {},
22
+ {
23
+ thisWeek: !0,
24
+ lastWeek: !0,
25
+ last7Days: !0,
26
+ last30Days: !0,
27
+ last90Days: !0,
28
+ thisMonth: !0,
29
+ lastMonth: !0,
30
+ thisQuarter: !0,
31
+ lastQuarter: !0,
32
+ thisYear: !0,
33
+ lastYear: !0
34
+ },
35
+ t.presets
36
+ ), r = [
37
+ e.thisWeek,
38
+ e.lastWeek,
39
+ e.last7Days,
40
+ e.last30Days,
41
+ e.last90Days,
42
+ e.thisMonth,
43
+ e.lastMonth,
44
+ e.thisQuarter,
45
+ e.lastQuarter,
46
+ e.thisYear,
47
+ e.lastYear
48
+ ];
49
+ return l(
50
+ t?.timezone?.value,
51
+ a.value,
52
+ s
53
+ )?.filter(({ value: i }, n) => i.every(
54
+ (o) => t.disabledDate ? !t.disabledDate(o) : !0
55
+ ) && r[n]);
56
+ } else
57
+ return t?.presets?.map?.((e) => ({
58
+ label: e.label,
59
+ value: e?.value?.filter((r) => r !== null)
60
+ }));
61
+ }),
19
62
  changeCurrentDate: () => {
20
63
  a.value = u().valueOf();
21
64
  }
22
65
  };
23
66
  };
24
67
  export {
25
- p as useDefaultPresets
68
+ W as useDefaultPresets
26
69
  };
@@ -146,7 +146,52 @@ export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'va
146
146
  * 只读模式下的分隔符(比插槽优先级更高)
147
147
  */
148
148
  readModeSeparator?: any;
149
- presets?: RangePickerProps['presets'] | true;
149
+ presets?: RangePickerProps['presets'] | true | {
150
+ /**
151
+ * 是否显示本周
152
+ */
153
+ thisWeek?: boolean;
154
+ /**
155
+ * 是否显示上周
156
+ */
157
+ lastWeek?: boolean;
158
+ /**
159
+ * 是否显示近7天
160
+ */
161
+ last7Days?: boolean;
162
+ /**
163
+ * 是否显示近30天
164
+ */
165
+ last30Days?: boolean;
166
+ /**
167
+ * 是否显示近90天
168
+ */
169
+ last90Days?: boolean;
170
+ /**
171
+ * 是否显示本月
172
+ */
173
+ thisMonth?: boolean;
174
+ /**
175
+ * 是否显示上月
176
+ */
177
+ lastMonth?: boolean;
178
+ /**
179
+ * 是否显示本季度
180
+ */
181
+ thisQuarter?: boolean;
182
+ /**
183
+ * 是否显示上季度
184
+ */
185
+ lastQuarter?: boolean;
186
+ /**
187
+ * 是否显示今年
188
+ */
189
+ thisYear?: boolean;
190
+ /**
191
+ * 是否显示去年
192
+ */
193
+ lastYear?: boolean;
194
+ };
150
195
  };
151
196
  export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'value' | 'onUpdate:value' | 'onSearch'>> & {
152
197
  emptyText?: string;
@@ -1,12 +1,28 @@
1
1
  import { Recordable } from '../../type';
2
2
  import { ApColumnType } from '../interface';
3
3
  import { Ref } from 'vue';
4
- export declare const useTableSortedAndFiltered: () => {
4
+ export type DefaultSortOrderType = {
5
+ colKey: string | number;
6
+ field: string;
7
+ order: 'descend' | 'ascend';
8
+ [key: string]: any;
9
+ };
10
+ export declare const useTableSortedAndFiltered: (defaultSorterInfo?: DefaultSortOrderType) => {
5
11
  getColumnSFConfig: (column: ApColumnType, append?: boolean) => Recordable;
6
12
  setSF: (filters: any, sorter: any) => void;
7
13
  clearSorter: () => void;
8
14
  clearFilters: () => void;
9
15
  clearAll: () => void;
10
- sortedInfo: Ref<any, any>;
16
+ sortedInfo: Ref<{
17
+ [x: string]: any;
18
+ colKey: string | number;
19
+ field: string;
20
+ order: "descend" | "ascend";
21
+ } | null | undefined, DefaultSortOrderType | {
22
+ [x: string]: any;
23
+ colKey: string | number;
24
+ field: string;
25
+ order: "descend" | "ascend";
26
+ } | null | undefined>;
11
27
  filteredInfo: Ref<any, any>;
12
28
  };
@@ -1,11 +1,13 @@
1
1
  import { ref as i, unref as s } from "vue";
2
- const S = () => {
3
- const r = i(), t = i();
4
- function c(e, n = !1) {
5
- const v = s(t) || {}, u = s(r) || {}, l = n ? e : {};
6
- return e.filters && (l.filteredValue = v[e.key] || null), e.sorter && (l.sortOrder = u.columnKey === e.key ? u.order : null), l;
2
+ const p = (c) => {
3
+ const r = i(
4
+ c
5
+ ), t = i();
6
+ function a(e, n = !1) {
7
+ const F = s(t) || {}, u = s(r) || {}, l = n ? e : {};
8
+ return e.filters && (l.filteredValue = F[e.key] || null), e.sorter && (l.sortOrder = u.columnKey === e.key ? u.order : null), l;
7
9
  }
8
- function a(e, n) {
10
+ function d(e, n) {
9
11
  t.value = e, r.value = n;
10
12
  }
11
13
  function o() {
@@ -14,19 +16,19 @@ const S = () => {
14
16
  function f() {
15
17
  t.value = null;
16
18
  }
17
- function d() {
19
+ function v() {
18
20
  o(), f();
19
21
  }
20
22
  return {
21
- getColumnSFConfig: c,
22
- setSF: a,
23
+ getColumnSFConfig: a,
24
+ setSF: d,
23
25
  clearSorter: o,
24
26
  clearFilters: f,
25
- clearAll: d,
27
+ clearAll: v,
26
28
  sortedInfo: r,
27
29
  filteredInfo: t
28
30
  };
29
31
  };
30
32
  export {
31
- S as useTableSortedAndFiltered
33
+ p as useTableSortedAndFiltered
32
34
  };
@@ -3,6 +3,7 @@ import { Ref, ComputedRef } from 'vue';
3
3
  import { ApFormSearchFormExpose } from '../../ap-form';
4
4
  import { Recordable } from '../../type';
5
5
  import { ApTablePaginationConfig, RequestData } from '../interface';
6
+ import { DefaultSortOrderType } from './use-sorted-filtered';
6
7
  import { TablePaginationConfig } from '@aplus-frontend/antdv';
7
8
  import { FilterValue, SorterResult, TableCurrentDataSource } from '@aplus-frontend/antdv/es/table/interface';
8
9
  import { ApColumnType } from '..';
@@ -63,6 +64,10 @@ export type UseTablePagingParams<DataType, ParamsType> = {
63
64
  * @returns
64
65
  */
65
66
  onAfterRequest?: (records: DataType[]) => void;
67
+ /**
68
+ * 默认排序规则(只允许单字段)
69
+ */
70
+ defaultSortOrder?: DefaultSortOrderType;
66
71
  };
67
72
  export type TablePagingRequestOptions = {
68
73
  /**
@@ -86,7 +91,7 @@ type InternalDataType<DataType = Recordable> = {
86
91
  export declare const DEFAULT_CURRENT = 1;
87
92
  export declare const DEFAULT_PAGE_SIZE = 20;
88
93
  export type OptionalOnTableChange<T extends (...args: any[]) => any> = (...args: Partial<Parameters<T>>) => ReturnType<T>;
89
- export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, params, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, namespace, pagination, onClickReset, onAfterRequest }: UseTablePagingParams<DataType, ParamsType>) => {
94
+ export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, params, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, namespace, pagination, onClickReset, onAfterRequest, defaultSortOrder }: UseTablePagingParams<DataType, ParamsType>) => {
90
95
  formRef: Ref<ApFormSearchFormExpose | undefined, ApFormSearchFormExpose | undefined>;
91
96
  submit: () => void;
92
97
  reset: () => void;
@@ -114,7 +119,17 @@ export declare const useTablePaging: <DataType = any, ParamsType = Record<string
114
119
  dataSource: ComputedRef<DataType[]>;
115
120
  setDataSource: (dataSource?: DataType[]) => void;
116
121
  getColumnSFConfig: (column: ApColumnType, append?: boolean) => Recordable;
117
- sortedInfo: Ref<any, any>;
122
+ sortedInfo: Ref<{
123
+ [x: string]: any;
124
+ colKey: string | number;
125
+ field: string;
126
+ order: "descend" | "ascend";
127
+ } | null | undefined, DefaultSortOrderType | {
128
+ [x: string]: any;
129
+ colKey: string | number;
130
+ field: string;
131
+ order: "descend" | "ascend";
132
+ } | null | undefined>;
118
133
  filteredInfo: Ref<any, any>;
119
134
  getPaging: () => {
120
135
  current?: number | undefined;