@aplus-frontend/ui 6.21.1 → 6.22.0

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 (117) hide show
  1. package/es/index.mjs +160 -155
  2. package/es/src/ag-grid/components/body-cell/index.vue.d.ts +6 -0
  3. package/es/src/ag-grid/components/body-cell/index.vue.mjs +4 -0
  4. package/es/src/ag-grid/components/body-cell/index.vue2.mjs +27 -0
  5. package/es/src/ag-grid/components/header-cell/index.vue.d.ts +6 -0
  6. package/es/src/ag-grid/components/header-cell/index.vue.mjs +4 -0
  7. package/es/src/ag-grid/components/header-cell/index.vue2.mjs +65 -0
  8. package/es/src/ag-grid/context.d.ts +18 -0
  9. package/es/src/ag-grid/context.mjs +17 -0
  10. package/es/src/ag-grid/hooks/use-row-selection.d.ts +78 -0
  11. package/es/src/ag-grid/hooks/use-row-selection.mjs +98 -0
  12. package/es/src/ag-grid/index.d.ts +3 -0
  13. package/es/src/ag-grid/index.mjs +2 -0
  14. package/es/src/ag-grid/index.vue.d.ts +43 -0
  15. package/es/src/ag-grid/index.vue.mjs +512 -0
  16. package/es/src/ag-grid/index.vue2.mjs +4 -0
  17. package/es/src/ag-grid/interface.d.ts +296 -0
  18. package/es/src/ag-grid/interface.mjs +1 -0
  19. package/es/src/ag-grid/style/css.d.ts +0 -0
  20. package/es/src/ag-grid/style/css.js +1 -0
  21. package/es/src/ag-grid/style/index.d.ts +0 -0
  22. package/es/src/ag-grid/style/index.js +1 -0
  23. package/es/src/ag-grid/theme.d.ts +3 -0
  24. package/es/src/ag-grid/theme.mjs +25 -0
  25. package/es/src/ap-field/number/index.vue.mjs +25 -25
  26. package/es/src/ap-grid/index.vue.mjs +1 -1
  27. package/es/src/ap-grid/utils/col.d.ts +11 -0
  28. package/es/src/ap-grid/utils/col.mjs +99 -95
  29. package/es/src/ap-pro-card/components/card/index.vue2.mjs +112 -102
  30. package/es/src/ap-pro-card/components/operation/index.vue.d.ts +18 -0
  31. package/es/src/ap-pro-card/components/operation/index.vue.mjs +4 -0
  32. package/es/src/ap-pro-card/components/operation/index.vue2.mjs +20 -0
  33. package/es/src/ap-pro-card/components/statistic/index.vue.d.ts +51 -0
  34. package/es/src/ap-pro-card/components/statistic/index.vue.mjs +4 -0
  35. package/es/src/ap-pro-card/components/statistic/index.vue2.mjs +134 -0
  36. package/es/src/ap-pro-card/components/statistic-card/index.vue.d.ts +25 -0
  37. package/es/src/ap-pro-card/components/statistic-card/index.vue.mjs +4 -0
  38. package/es/src/ap-pro-card/components/statistic-card/index.vue2.mjs +116 -0
  39. package/es/src/ap-pro-card/index.d.ts +13 -3
  40. package/es/src/ap-pro-card/index.mjs +16 -4
  41. package/es/src/ap-pro-card/interface.d.ts +64 -0
  42. package/es/src/ap-table/utils.d.ts +1 -1
  43. package/es/src/ap-tag/ap-tag-group.vue.mjs +42 -42
  44. package/es/src/business/ap-label/group/ApLabelGroup.mjs +17 -15
  45. package/es/src/business/hooks/index.d.ts +1 -0
  46. package/es/src/business/hooks/index.mjs +8 -6
  47. package/es/src/business/hooks/usePageListAgGrid.d.ts +37 -0
  48. package/es/src/business/hooks/usePageListAgGrid.mjs +88 -0
  49. package/es/src/index.d.ts +1 -0
  50. package/es/src/index.mjs +296 -290
  51. package/es/src/version.d.ts +1 -1
  52. package/es/src/version.mjs +1 -1
  53. package/lib/index.js +1 -1
  54. package/lib/src/ag-grid/components/body-cell/index.vue.d.ts +6 -0
  55. package/lib/src/ag-grid/components/body-cell/index.vue.js +1 -0
  56. package/lib/src/ag-grid/components/body-cell/index.vue2.js +1 -0
  57. package/lib/src/ag-grid/components/header-cell/index.vue.d.ts +6 -0
  58. package/lib/src/ag-grid/components/header-cell/index.vue.js +1 -0
  59. package/lib/src/ag-grid/components/header-cell/index.vue2.js +1 -0
  60. package/lib/src/ag-grid/context.d.ts +18 -0
  61. package/lib/src/ag-grid/context.js +1 -0
  62. package/lib/src/ag-grid/hooks/use-row-selection.d.ts +78 -0
  63. package/lib/src/ag-grid/hooks/use-row-selection.js +1 -0
  64. package/lib/src/ag-grid/index.d.ts +3 -0
  65. package/lib/src/ag-grid/index.js +1 -0
  66. package/lib/src/ag-grid/index.vue.d.ts +43 -0
  67. package/lib/src/ag-grid/index.vue.js +1 -0
  68. package/lib/src/ag-grid/index.vue2.js +1 -0
  69. package/lib/src/ag-grid/interface.d.ts +296 -0
  70. package/lib/src/ag-grid/interface.js +1 -0
  71. package/lib/src/ag-grid/style/css.cjs +1 -0
  72. package/lib/src/ag-grid/style/css.d.ts +0 -0
  73. package/lib/src/ag-grid/style/index.cjs +1 -0
  74. package/lib/src/ag-grid/style/index.d.ts +0 -0
  75. package/lib/src/ag-grid/theme.d.ts +3 -0
  76. package/lib/src/ag-grid/theme.js +1 -0
  77. package/lib/src/ap-field/number/index.vue.js +1 -1
  78. package/lib/src/ap-grid/index.vue.js +1 -1
  79. package/lib/src/ap-grid/utils/col.d.ts +11 -0
  80. package/lib/src/ap-grid/utils/col.js +1 -1
  81. package/lib/src/ap-pro-card/components/card/index.vue2.js +1 -1
  82. package/lib/src/ap-pro-card/components/operation/index.vue.d.ts +18 -0
  83. package/lib/src/ap-pro-card/components/operation/index.vue.js +1 -0
  84. package/lib/src/ap-pro-card/components/operation/index.vue2.js +1 -0
  85. package/lib/src/ap-pro-card/components/statistic/index.vue.d.ts +51 -0
  86. package/lib/src/ap-pro-card/components/statistic/index.vue.js +1 -0
  87. package/lib/src/ap-pro-card/components/statistic/index.vue2.js +1 -0
  88. package/lib/src/ap-pro-card/components/statistic-card/index.vue.d.ts +25 -0
  89. package/lib/src/ap-pro-card/components/statistic-card/index.vue.js +1 -0
  90. package/lib/src/ap-pro-card/components/statistic-card/index.vue2.js +1 -0
  91. package/lib/src/ap-pro-card/index.d.ts +13 -3
  92. package/lib/src/ap-pro-card/index.js +1 -1
  93. package/lib/src/ap-pro-card/interface.d.ts +64 -0
  94. package/lib/src/ap-table/utils.d.ts +1 -1
  95. package/lib/src/ap-tag/ap-tag-group.vue.js +1 -1
  96. package/lib/src/business/ap-label/group/ApLabelGroup.js +1 -1
  97. package/lib/src/business/hooks/index.d.ts +1 -0
  98. package/lib/src/business/hooks/index.js +1 -1
  99. package/lib/src/business/hooks/usePageListAgGrid.d.ts +37 -0
  100. package/lib/src/business/hooks/usePageListAgGrid.js +1 -0
  101. package/lib/src/index.d.ts +1 -0
  102. package/lib/src/index.js +1 -1
  103. package/lib/src/version.d.ts +1 -1
  104. package/lib/src/version.js +1 -1
  105. package/package.json +3 -1
  106. package/theme/ag-grid/index.css +468 -0
  107. package/theme/ag-grid/index.less +25 -0
  108. package/theme/ap-button/ap-button.css +1 -1
  109. package/theme/ap-button/ap-button.less +1 -1
  110. package/theme/ap-grid/index.css +3 -0
  111. package/theme/ap-grid/index.less +3 -0
  112. package/theme/ap-pro-card/index.css +147 -0
  113. package/theme/ap-pro-card/index.less +147 -0
  114. package/theme/ap-tag/ap-tag.css +1 -1
  115. package/theme/ap-tag/ap-tag.less +1 -1
  116. package/theme/index.css +330 -5
  117. package/theme/index.less +1 -0
@@ -0,0 +1,98 @@
1
+ import { ref as D, computed as d, unref as o } from "vue";
2
+ import { isFunction as r } from "lodash-unified";
3
+ function E(l, n) {
4
+ return !(n != null && n.length) || r(l) ? [] : n.map((u) => ({ [l]: u }));
5
+ }
6
+ const m = (l) => {
7
+ const n = D(
8
+ E(l.rowKey, l.defaultSelectedRowKeys)
9
+ ), u = (e) => r(l.rowKey) ? l.rowKey(e) : e[l.rowKey], a = d(() => {
10
+ const e = /* @__PURE__ */ new Map();
11
+ return o(n).forEach((t) => {
12
+ e.set(u(t), t);
13
+ }), e;
14
+ });
15
+ function v(e) {
16
+ return o(a).has(u(e));
17
+ }
18
+ function S(e) {
19
+ if (!s(e))
20
+ return;
21
+ const t = o(a);
22
+ t.set(u(e), e), n.value = [...t.values()];
23
+ }
24
+ function M(e) {
25
+ const t = o(a);
26
+ for (const c of e)
27
+ s(c) && t.set(u(c), c);
28
+ n.value = [...t.values()];
29
+ }
30
+ function w(e) {
31
+ if (r(l.rowKey))
32
+ return;
33
+ const t = o(a);
34
+ for (const c of e) {
35
+ const f = o(l.dataSource).find(
36
+ (A) => u(A) === c
37
+ ), i = { [l.rowKey]: c };
38
+ s(f || i) && t.set(c, f || i);
39
+ }
40
+ n.value = [...t.values()];
41
+ }
42
+ function x(e) {
43
+ if (!s(e))
44
+ return;
45
+ const t = o(a);
46
+ t.delete(u(e)), n.value = [...t.values()];
47
+ }
48
+ function g(e) {
49
+ const t = o(a);
50
+ for (const c of e)
51
+ s(c) && t.delete(u(c));
52
+ n.value = [...t.values()];
53
+ }
54
+ function s(e) {
55
+ const t = l.disabled;
56
+ return !(t ? t(e) : !1);
57
+ }
58
+ function y() {
59
+ const e = o(a);
60
+ o(l.dataSource).forEach((t) => {
61
+ s(t) && e.set(u(t), t);
62
+ }), n.value = [...e.values()];
63
+ }
64
+ function h(e) {
65
+ if (!s(e))
66
+ return;
67
+ const t = o(a), c = u(e);
68
+ t.has(c) ? t.delete(c) : t.set(c, e), n.value = [...t.values()];
69
+ }
70
+ function b() {
71
+ const e = o(a);
72
+ o(l.dataSource).forEach((t) => {
73
+ s(t) && e.delete(u(t));
74
+ }), n.value = [...e.values()];
75
+ }
76
+ function K() {
77
+ n.value = [];
78
+ }
79
+ return {
80
+ select: S,
81
+ unSelect: x,
82
+ isSelected: v,
83
+ selectAll: y,
84
+ unSelectAll: b,
85
+ clearAll: K,
86
+ toggleSelect: h,
87
+ selectedRows: n,
88
+ selectedRowKeys: d(
89
+ () => o(n).map((e) => u(e))
90
+ ),
91
+ selectMulti: M,
92
+ unSelectMulti: g,
93
+ selectMultiByKeys: w
94
+ };
95
+ };
96
+ export {
97
+ m as default
98
+ };
@@ -0,0 +1,3 @@
1
+ import { default as AgGrid } from './index.vue';
2
+ export { AgGrid };
3
+ export * from './interface';
@@ -0,0 +1,2 @@
1
+ import "./index.vue2.mjs";
2
+ import "./interface.mjs";
@@ -0,0 +1,43 @@
1
+ import { AgGridColumnType, AgGridExpose, AgGridProps } from './interface';
2
+ import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, VNode } from 'vue';
3
+ declare const _default: <RecordType>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & AgGridProps<RecordType> & Partial<{}>> & PublicProps;
5
+ expose(exposed: ShallowUnwrapRef<AgGridExpose>): void;
6
+ attrs: any;
7
+ slots: Readonly<{
8
+ /**
9
+ * 自定义查询表单额外的区域
10
+ */
11
+ searchFormExtra?: any;
12
+ /**
13
+ * 自定义表格上部查询表单下部分区域的渲染
14
+ */
15
+ title?: (params: {
16
+ selectedRows: RecordType[];
17
+ selectedRowKeys: (string | number)[];
18
+ shownColumns: AgGridColumnType<RecordType>[];
19
+ clearAll: () => void;
20
+ }) => any;
21
+ }> & {
22
+ /**
23
+ * 自定义查询表单额外的区域
24
+ */
25
+ searchFormExtra?: any;
26
+ /**
27
+ * 自定义表格上部查询表单下部分区域的渲染
28
+ */
29
+ title?: (params: {
30
+ selectedRows: RecordType[];
31
+ selectedRowKeys: (string | number)[];
32
+ shownColumns: AgGridColumnType<RecordType>[];
33
+ clearAll: () => void;
34
+ }) => any;
35
+ };
36
+ emit: {};
37
+ }>) => VNode & {
38
+ __ctx?: Awaited<typeof __VLS_setup>;
39
+ };
40
+ export default _default;
41
+ type __VLS_PrettifyLocal<T> = {
42
+ [K in keyof T]: T[K];
43
+ } & {};
@@ -0,0 +1,512 @@
1
+ import { defineComponent as Ne, useSlots as Ve, ref as u, computed as s, unref as n, watch as k, toRef as We, nextTick as Ee, createElementBlock as z, openBlock as y, normalizeStyle as b, normalizeClass as m, createCommentVNode as J, createElementVNode as v, createVNode as P, mergeProps as Q, createSlots as Me, withCtx as X, Fragment as Oe, renderList as Le, createBlock as Y, resolveDynamicComponent as $e, renderSlot as Z, withDirectives as Ge, vShow as je } from "vue";
2
+ import { AgGridVue as qe } from "ag-grid-vue3";
3
+ import { ModuleRegistry as He, AllCommunityModule as Ue } from "ag-grid-community";
4
+ import { Spin as Je, Pagination as Qe } from "@aplus-frontend/antdv";
5
+ import { isFunction as _, isUndefined as R } from "lodash-unified";
6
+ import "../config-provider/index.mjs";
7
+ import { ApForm as Xe } from "../ap-form/index.mjs";
8
+ import { noRenderAsFormItemValueList as Ye } from "../ap-table/constants.mjs";
9
+ import { getColumnOrder as ee, updateFormProps as Ze, getFieldProps as _e, getSearchFormItemRenderNode as et, recursionApColumns as tt } from "../ap-table/utils.mjs";
10
+ import { useTablePaging as ot } from "../ap-table/hooks/use-table-paging-ng.mjs";
11
+ import { dataIndexToField as rt } from "../ap-grid/utils/col.mjs";
12
+ import { isDef as at } from "../utils/index.mjs";
13
+ import "./components/header-cell/index.vue.mjs";
14
+ import "./components/body-cell/index.vue.mjs";
15
+ import nt from "./hooks/use-row-selection.mjs";
16
+ import { useProvideSorter as lt } from "./context.mjs";
17
+ import { useProvideApTable as st } from "../ap-table/context.mjs";
18
+ import { sizeReverseMap as it, sizeMap as dt } from "../ap-grid/constants.mjs";
19
+ import { useToken as ct } from "@aplus-frontend/antdv/es/theme/internal";
20
+ import { useTheme as ut } from "./theme.mjs";
21
+ import { useNamespace as mt } from "../config-provider/hooks/use-namespace.mjs";
22
+ import { useGlobalConfig as pt } from "../config-provider/hooks/use-global-config.mjs";
23
+ import ft from "./components/body-cell/index.vue2.mjs";
24
+ import gt from "./components/header-cell/index.vue2.mjs";
25
+ const Lt = /* @__PURE__ */ Ne({
26
+ name: "AgGrid",
27
+ __name: "index",
28
+ props: {
29
+ dropdownPrefixCls: {},
30
+ bordered: { type: Boolean },
31
+ locale: {},
32
+ onChange: {},
33
+ onResizeColumn: {},
34
+ getPopupContainer: {},
35
+ scroll: {},
36
+ sortDirections: {},
37
+ showSorterTooltip: { type: [Boolean, Object] },
38
+ prefixCls: {},
39
+ rowKey: { default: "key" },
40
+ tableLayout: {},
41
+ title: {},
42
+ id: {},
43
+ showHeader: { type: Boolean },
44
+ components: {},
45
+ customRow: {},
46
+ customHeaderRow: {},
47
+ direction: {},
48
+ expandFixed: { type: [String, Boolean] },
49
+ expandColumnWidth: {},
50
+ expandedRowKeys: {},
51
+ defaultExpandedRowKeys: {},
52
+ expandedRowRender: {},
53
+ expandRowByClick: { type: Boolean },
54
+ expandIcon: {},
55
+ onExpand: {},
56
+ onExpandedRowsChange: {},
57
+ defaultExpandAllRows: { type: Boolean },
58
+ indentSize: {},
59
+ expandIconColumnIndex: {},
60
+ showExpandColumn: { type: Boolean },
61
+ expandedRowClassName: {},
62
+ childrenColumnName: {},
63
+ rowExpandable: {},
64
+ transformCellText: {},
65
+ columns: {},
66
+ rowSelection: { type: Boolean },
67
+ card: { type: Boolean },
68
+ params: {},
69
+ request: {},
70
+ defaultData: {},
71
+ dataSource: {},
72
+ onLoadingChange: {},
73
+ onShownColumnsChange: {},
74
+ searchForm: { type: [Boolean, Object], default: void 0 },
75
+ beforeSearchSubmit: {},
76
+ pagination: { type: [Boolean, Object], default: void 0 },
77
+ searchFormWrapperStyle: {},
78
+ tableWrapperStyle: {},
79
+ wrapperStyle: {},
80
+ tableStyle: {},
81
+ manual: { type: Boolean, default: void 0 },
82
+ size: { default: "mini" },
83
+ adaptive: { type: Boolean },
84
+ columnResizable: { type: Boolean, default: !1 },
85
+ loading: { type: Boolean, default: void 0 },
86
+ summary: {}
87
+ },
88
+ setup(te, { expose: oe }) {
89
+ He.registerModules([Ue]);
90
+ const r = te, re = Ve(), { e: C, b: d, em: ae, be: ne } = mt("ag-grid"), g = u(r.size), le = ut(g), S = u(), [, se] = ct();
91
+ let w = !!r.dataSource, D = 0;
92
+ const A = pt("valueTypeMap"), K = s(() => {
93
+ var e, o, a;
94
+ return D++, ((a = (o = (e = r.columns) == null ? void 0 : e.filter(
95
+ (t) => !t.hideInSearch && t.dataIndex && (t.valueType || t.customRenderFormItem) && !Ye.includes(t.valueType)
96
+ )) == null ? void 0 : o.sort((t, l) => {
97
+ let i = ee(t.order);
98
+ return ee(l.order) - i;
99
+ })) == null ? void 0 : a.map((t) => {
100
+ const l = Ze(
101
+ t,
102
+ _e(t.fieldProps, {})
103
+ ), i = {
104
+ ...t,
105
+ fieldProps: {
106
+ label: t.title,
107
+ name: t.dataIndex,
108
+ // tips: 在表格中的查询表单项默认是带边框的
109
+ bordered: !0,
110
+ ...l || {},
111
+ _signal: D
112
+ },
113
+ renderNode: void 0
114
+ };
115
+ return i.renderNode = et(
116
+ i,
117
+ n(A)
118
+ ), i;
119
+ })) || [];
120
+ }), c = u([]), N = u([]);
121
+ function ie() {
122
+ var e;
123
+ return ((e = r.columns) == null ? void 0 : e.filter((o) => !o.hideInTable)) || [];
124
+ }
125
+ k(
126
+ () => r.columns,
127
+ () => {
128
+ var o;
129
+ const e = ie();
130
+ c.value = e, N.value = e, (o = r.onShownColumnsChange) == null || o.call(r, e);
131
+ },
132
+ {
133
+ deep: !0,
134
+ immediate: !0
135
+ }
136
+ );
137
+ const de = s(() => {
138
+ const e = n(c);
139
+ function o(a) {
140
+ return a.map((t) => {
141
+ var i;
142
+ const l = {
143
+ field: rt(t.dataIndex),
144
+ colId: at(t.key) ? String(t.key) : void 0,
145
+ sortable: !!t.sorter,
146
+ comparator: t.sorter === !0 ? () => 0 : t.sorter,
147
+ headerComponentParams: {
148
+ column: t
149
+ },
150
+ cellRendererParams: {
151
+ column: t,
152
+ extraValueType: n(A)
153
+ },
154
+ resizable: t.resizable,
155
+ width: t.width,
156
+ minWidth: t.minWidth,
157
+ maxWidth: t.maxWidth,
158
+ flex: t.width ? void 0 : 1,
159
+ // 如果没有设置确切的宽度,则设置为可自由伸缩列
160
+ pinned: t.fixed || null,
161
+ // undefined to null
162
+ colSpan: t.colSpan,
163
+ cellClass: (h) => {
164
+ const I = t.cellClass || "", Ke = _(I) ? I(h.data, h.node) : I;
165
+ return [
166
+ `${ae("cell", t.align || "left")}`,
167
+ Ke
168
+ ].flat().filter(Boolean);
169
+ },
170
+ wrapText: !t.ellipsis,
171
+ autoHeight: !t.ellipsis
172
+ };
173
+ return (i = t.children) != null && i.length ? {
174
+ ...l,
175
+ children: o(t.children)
176
+ } : l;
177
+ });
178
+ }
179
+ return o(e);
180
+ }), ce = u({
181
+ headerComponent: gt,
182
+ cellRenderer: ft,
183
+ resizable: r.columnResizable,
184
+ suppressMovable: !0,
185
+ cellDataType: !1,
186
+ cellStyle: {
187
+ whiteSpace: "pre-line"
188
+ }
189
+ }), V = u({});
190
+ lt({
191
+ sorter: V,
192
+ setSorter(e) {
193
+ V.value = e;
194
+ }
195
+ });
196
+ const ue = {
197
+ asc: "ascend",
198
+ desc: "descend"
199
+ };
200
+ function me() {
201
+ var l;
202
+ const e = (l = S.value.getColumns()) == null ? void 0 : l.filter((i) => i.getSort() !== void 0);
203
+ if (!(e != null && e.length))
204
+ return;
205
+ const o = e[0], a = o.getColDef(), t = o.getSort();
206
+ E(void 0, void 0, {
207
+ column: a,
208
+ field: a.field,
209
+ order: t ? ue[t] : null
210
+ });
211
+ }
212
+ const pe = s(() => tt(n(c), (e) => {
213
+ if (e.sorter === !0)
214
+ return e.key || e.dataIndex;
215
+ }).filter(Boolean)), {
216
+ formRef: p,
217
+ submit: x,
218
+ reset: F,
219
+ data: f,
220
+ tableProps: W,
221
+ handleTableChangeOptional: E,
222
+ submitWith: M,
223
+ refresh: O,
224
+ getPaging: fe,
225
+ setPaging: ge
226
+ } = ot({
227
+ async request(e) {
228
+ var a;
229
+ if (w = !1, !R(r.dataSource)) {
230
+ const t = e.pageSize * (e.current - 1);
231
+ return {
232
+ data: (r.pagination === !1 ? r.dataSource : r.dataSource.slice(t, t + e.pageSize)) || [],
233
+ total: r.dataSource.length || 0
234
+ };
235
+ }
236
+ const o = await ((a = r.request) == null ? void 0 : a.call(r, e));
237
+ return {
238
+ data: (o == null ? void 0 : o.data) || [],
239
+ total: (o == null ? void 0 : o.total) || 0
240
+ };
241
+ },
242
+ namespace: "ap-grid",
243
+ filterFields: u([]),
244
+ params: We(r, "params"),
245
+ defaultData: r.defaultData,
246
+ manual: r.manual,
247
+ formatParams: r.beforeSearchSubmit,
248
+ pagination: r.pagination,
249
+ sortFields: pe
250
+ }), Se = s(
251
+ () => R(r.dataSource) ? f.records : r.dataSource
252
+ ), {
253
+ select: we,
254
+ unSelect: he,
255
+ selectedRows: T,
256
+ selectedRowKeys: ye,
257
+ clearAll: ve,
258
+ selectMultiByKeys: Ce
259
+ } = nt({
260
+ ...r.rowSelection === !0 ? {} : r.rowSelection,
261
+ dataSource: Se,
262
+ rowKey: r.rowKey
263
+ }), be = {
264
+ checkbox: "multiRow",
265
+ radio: "singleRow"
266
+ }, Re = s(() => {
267
+ if (!r.rowSelection)
268
+ return;
269
+ const { type: e = "checkbox", disabled: o } = r.rowSelection === !0 ? {} : r.rowSelection;
270
+ return {
271
+ mode: be[e],
272
+ isRowSelectable: (a) => o ? !o(a.data) : !0
273
+ };
274
+ }), xe = s(() => {
275
+ if (!r.rowSelection)
276
+ return;
277
+ const e = r.rowSelection === !0 ? {} : r.rowSelection;
278
+ return {
279
+ sortable: !1,
280
+ resizable: !1,
281
+ width: e.columnWidth || 60,
282
+ pinned: e.fixed
283
+ };
284
+ });
285
+ function B(e) {
286
+ return _(r.rowKey) ? r.rowKey(e) : e[r.rowKey];
287
+ }
288
+ const L = ({
289
+ api: e = S.value
290
+ }) => {
291
+ if (!r.rowSelection)
292
+ return;
293
+ const o = T.value;
294
+ if (!o.length)
295
+ return;
296
+ w = !1;
297
+ const a = [];
298
+ e.forEachNode((t) => {
299
+ const l = t.data, i = B(l);
300
+ o.find((h) => B(h) === i) && a.push(t);
301
+ }), e.setNodesSelected({ nodes: a, newValue: !0 }), setTimeout(() => {
302
+ w = !0;
303
+ }, 0);
304
+ }, Fe = (e) => {
305
+ w && (e.node.isSelected() ? we(e.data) : he(e.data));
306
+ }, Te = () => {
307
+ w = !0;
308
+ }, $ = () => {
309
+ var e;
310
+ ve(), (e = S.value) == null || e.deselectAll();
311
+ };
312
+ function Be(e) {
313
+ Ce(e), Ee(() => {
314
+ L({});
315
+ });
316
+ }
317
+ function G(e = !1) {
318
+ var a, t, l;
319
+ const o = e ? "getFieldsValueTransformed" : "getFieldsValue";
320
+ return (l = (t = (a = p.value) == null ? void 0 : a.apForm) == null ? void 0 : t[o]) == null ? void 0 : l.call(t, !0);
321
+ }
322
+ function j(e) {
323
+ var o, a, t;
324
+ (t = (a = (o = p.value) == null ? void 0 : o.apForm) == null ? void 0 : a.setFieldsValue) == null || t.call(a, e);
325
+ }
326
+ function q() {
327
+ var e;
328
+ return ((e = p.value) == null ? void 0 : e.getSorterItems()) || [];
329
+ }
330
+ function H(e) {
331
+ var o;
332
+ (o = p.value) == null || o.setSorterItems(e);
333
+ }
334
+ function U() {
335
+ var e;
336
+ (e = p.value) == null || e.resetSorterItems();
337
+ }
338
+ st({
339
+ columns: s(() => c.value),
340
+ columnsBackup: s(() => N.value),
341
+ size: s(() => dt[g.value]),
342
+ updateColumns(e) {
343
+ var o;
344
+ console.log(e), c.value = e, (o = r.onShownColumnsChange) == null || o.call(r, e);
345
+ },
346
+ updateSize(e) {
347
+ g.value = it[e];
348
+ },
349
+ renderConfig: s(() => ({
350
+ className: ne("table-header", "title"),
351
+ color: se.value.colorTextTertiary
352
+ })),
353
+ dataSource: s(() => n(f).records),
354
+ getSearchFormValues: G,
355
+ setSearchFormValues: j,
356
+ submit: x,
357
+ submitWith: M,
358
+ reset: F,
359
+ refresh: O,
360
+ getSearchFormSorterItems: q,
361
+ setSearchFormSorterItems: H,
362
+ resetSearchFormSorterItems: U
363
+ });
364
+ const Ie = s(
365
+ () => R(r.loading) ? f.loading : r.loading
366
+ ), ke = s(() => [
367
+ d(),
368
+ r.card ? null : d("wrapper"),
369
+ d("adaptive"),
370
+ d(`size-${g.value}`)
371
+ ].filter(Boolean)), ze = s(() => ({
372
+ height: "100%",
373
+ ...r.tableStyle || {}
374
+ })), Pe = (e, o) => {
375
+ E({ current: e, pageSize: o });
376
+ };
377
+ function De(e) {
378
+ const o = e.data;
379
+ return B(o);
380
+ }
381
+ function Ae(e, o) {
382
+ var a;
383
+ (a = S.value) == null || a.ensureIndexVisible(e, o);
384
+ }
385
+ return k(
386
+ () => r.size,
387
+ (e) => {
388
+ g.value = e;
389
+ }
390
+ ), k(
391
+ () => n(f).loading,
392
+ (e) => {
393
+ var o;
394
+ (o = r.onLoadingChange) == null || o.call(r, e);
395
+ }
396
+ ), oe({
397
+ submit: x,
398
+ reset: F,
399
+ refresh: O,
400
+ submitWith: M,
401
+ setSearchFormValues: j,
402
+ getSearchFormValues: G,
403
+ getShowColumns: () => n(c),
404
+ rowSelection: {
405
+ selectedRows: s(() => T.value),
406
+ setSelectedRowKeys: Be,
407
+ clearAll: $
408
+ },
409
+ scrollToRow: Ae,
410
+ getDataSource: () => n(f.records),
411
+ getPaging: fe,
412
+ setPaging: ge,
413
+ getSearchFormSorterItems: q,
414
+ setSearchFormSorterItems: H,
415
+ resetSearchFormSorterItems: U
416
+ }), (e, o) => {
417
+ var a, t;
418
+ return y(), z("div", {
419
+ class: m(ke.value),
420
+ style: b(e.wrapperStyle)
421
+ }, [
422
+ n(R)(e.dataSource) && e.searchForm !== !1 && K.value.length > 0 ? (y(), z("div", {
423
+ key: 0,
424
+ class: m(e.card ? n(C)("search-wrapper") : null),
425
+ style: b(e.searchFormWrapperStyle)
426
+ }, [
427
+ P(n(Xe).SearchForm, Q(e.searchForm || {}, {
428
+ ref_key: "formRef",
429
+ ref: p,
430
+ "custom-reset": "",
431
+ "submit-loading": n(W).loading,
432
+ onSubmit: n(x),
433
+ onReset: n(F)
434
+ }), Me({
435
+ default: X(() => [
436
+ (y(!0), z(Oe, null, Le(K.value, (l) => (y(), Y($e(l.renderNode), {
437
+ key: l.dataIndex
438
+ }))), 128))
439
+ ]),
440
+ _: 2
441
+ }, [
442
+ re.searchFormExtra ? {
443
+ name: "extra",
444
+ fn: X(() => [
445
+ Z(e.$slots, "searchFormExtra")
446
+ ]),
447
+ key: "0"
448
+ } : void 0
449
+ ]), 1040, ["submit-loading", "onSubmit", "onReset"])
450
+ ], 6)) : J("", !0),
451
+ v("div", {
452
+ class: m([n(C)("table-wrapper"), e.card ? n(C)("table-wrapper-card") : null]),
453
+ style: b(e.tableWrapperStyle)
454
+ }, [
455
+ v("div", {
456
+ class: m(n(d)("header-wrapper"))
457
+ }, [
458
+ Z(e.$slots, "title", {
459
+ selectedRows: n(T),
460
+ selectedRowKeys: n(ye),
461
+ shownColumns: c.value,
462
+ clearAll: $
463
+ })
464
+ ], 2),
465
+ v("div", {
466
+ class: m(n(d)("grid-wrapper"))
467
+ }, [
468
+ P(n(qe), {
469
+ style: b(ze.value),
470
+ "row-data": n(f).records,
471
+ "column-defs": de.value,
472
+ "default-col-def": ce.value,
473
+ "locale-text": {
474
+ noRowsToShow: ""
475
+ // 为了隐藏默认的无数据提示,因为外部已经自行实现了loading
476
+ },
477
+ "row-selection": Re.value,
478
+ "selection-column-def": xe.value,
479
+ "get-row-id": De,
480
+ "pinned-top-row-data": (a = e.summary) == null ? void 0 : a.top,
481
+ "pinned-bottom-row-data": (t = e.summary) == null ? void 0 : t.bottom,
482
+ theme: n(le),
483
+ onSortChanged: me,
484
+ onGridReady: o[0] || (o[0] = (l) => S.value = l.api),
485
+ onRowDataUpdated: L,
486
+ onRowSelected: Fe,
487
+ onFirstDataRendered: Te
488
+ }, null, 8, ["style", "row-data", "column-defs", "default-col-def", "row-selection", "selection-column-def", "pinned-top-row-data", "pinned-bottom-row-data", "theme"]),
489
+ Ge(v("div", {
490
+ class: m(n(C)("table-loading-wrapper"))
491
+ }, [
492
+ P(n(Je), { delay: 300 })
493
+ ], 2), [
494
+ [je, Ie.value]
495
+ ])
496
+ ], 2),
497
+ v("div", {
498
+ class: m(n(d)("pagination-wrapper"))
499
+ }, [
500
+ e.pagination !== !1 ? (y(), Y(n(Qe), Q({
501
+ key: 0,
502
+ class: n(d)("pagination")
503
+ }, n(W).pagination, { onChange: Pe }), null, 16, ["class"])) : J("", !0)
504
+ ], 2)
505
+ ], 6)
506
+ ], 6);
507
+ };
508
+ }
509
+ });
510
+ export {
511
+ Lt as default
512
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };