@aplus-frontend/ui 0.0.9 → 0.0.11

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 (47) hide show
  1. package/es/src/ap-field/checkbox/index.vue.mjs +1 -1
  2. package/es/src/ap-field/date/index.vue.mjs +1 -1
  3. package/es/src/ap-field/date-range/index.vue.mjs +1 -1
  4. package/es/src/ap-field/number/index.vue.mjs +1 -1
  5. package/es/src/ap-field/radio/index.vue.mjs +1 -1
  6. package/es/src/ap-field/select/index.vue.mjs +1 -1
  7. package/es/src/ap-field/slider/index.vue.d.ts +3 -0
  8. package/es/src/ap-field/slider/index.vue.mjs +4 -4
  9. package/es/src/ap-field/switch/index.vue.mjs +1 -1
  10. package/es/src/ap-field/text/index.vue2.mjs +1 -1
  11. package/es/src/ap-field/text/password.vue.mjs +1 -1
  12. package/es/src/ap-field/text-area/index.vue.mjs +1 -1
  13. package/es/src/ap-table/ap-table.vue.d.ts +5 -3
  14. package/es/src/ap-table/ap-table.vue.mjs +117 -95
  15. package/es/src/ap-table/hooks/use-table-content-height.d.ts +9 -0
  16. package/es/src/ap-table/hooks/use-table-content-height.mjs +39 -0
  17. package/es/src/ap-table/interface.d.ts +5 -1
  18. package/es/src/ap-table/style/ap-table.css +28 -0
  19. package/es/src/editable-table/interface.d.ts +71 -0
  20. package/es/src/editable-table/style/index.css +7 -0
  21. package/es/src/editable-table/utils.d.ts +8 -0
  22. package/es/src/theme/ap-table/ap-table.css +28 -0
  23. package/es/src/theme/editable-table/index.css +7 -0
  24. package/lib/src/ap-field/checkbox/index.vue.js +1 -1
  25. package/lib/src/ap-field/date/index.vue.js +1 -1
  26. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  27. package/lib/src/ap-field/number/index.vue.js +1 -1
  28. package/lib/src/ap-field/radio/index.vue.js +1 -1
  29. package/lib/src/ap-field/select/index.vue.js +1 -1
  30. package/lib/src/ap-field/slider/index.vue.d.ts +3 -0
  31. package/lib/src/ap-field/slider/index.vue.js +1 -1
  32. package/lib/src/ap-field/switch/index.vue.js +1 -1
  33. package/lib/src/ap-field/text/index.vue2.js +1 -1
  34. package/lib/src/ap-field/text/password.vue.js +1 -1
  35. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  36. package/lib/src/ap-table/ap-table.vue.d.ts +5 -3
  37. package/lib/src/ap-table/ap-table.vue.js +1 -1
  38. package/lib/src/ap-table/hooks/use-table-content-height.d.ts +9 -0
  39. package/lib/src/ap-table/hooks/use-table-content-height.js +1 -0
  40. package/lib/src/ap-table/interface.d.ts +5 -1
  41. package/lib/src/ap-table/style/ap-table.css +28 -0
  42. package/lib/src/editable-table/interface.d.ts +71 -0
  43. package/lib/src/editable-table/style/index.css +7 -0
  44. package/lib/src/editable-table/utils.d.ts +8 -0
  45. package/lib/src/theme/ap-table/ap-table.css +28 -0
  46. package/lib/src/theme/editable-table/index.css +7 -0
  47. package/package.json +1 -1
@@ -19,7 +19,7 @@ const E = /* @__PURE__ */ g({
19
19
  options: { default: () => [] },
20
20
  disabled: { type: Boolean },
21
21
  id: {},
22
- emptyText: { default: "-" },
22
+ emptyText: { default: "--" },
23
23
  request: {}
24
24
  },
25
25
  emits: ["update:value"],
@@ -73,7 +73,7 @@ const Z = /* @__PURE__ */ b({
73
73
  disabledMinutes: {},
74
74
  disabledSeconds: {},
75
75
  valueFormat: {},
76
- emptyText: { default: "-" },
76
+ emptyText: { default: "--" },
77
77
  value: {},
78
78
  defaultValue: {},
79
79
  onChange: {},
@@ -77,7 +77,7 @@ const de = /* @__PURE__ */ x({
77
77
  disabledMinutes: {},
78
78
  disabledSeconds: {},
79
79
  valueFormat: {},
80
- emptyText: { default: "-" },
80
+ emptyText: { default: "--" },
81
81
  value: {},
82
82
  defaultValue: {},
83
83
  onChange: {},
@@ -48,7 +48,7 @@ const Y = /* @__PURE__ */ h({
48
48
  onStep: {},
49
49
  onBlur: {},
50
50
  onFocus: {},
51
- emptyText: { default: "-" },
51
+ emptyText: { default: "--" },
52
52
  thousands: { type: Boolean, default: !1 },
53
53
  limitDecimalsRetain: { type: Boolean }
54
54
  },
@@ -20,7 +20,7 @@ const j = /* @__PURE__ */ V({
20
20
  optionType: {},
21
21
  onChange: {},
22
22
  "onUpdate:value": {},
23
- emptyText: { default: "-" },
23
+ emptyText: { default: "--" },
24
24
  request: {}
25
25
  },
26
26
  emits: ["update:value"],
@@ -80,7 +80,7 @@ const G = { key: 0 }, oe = /* @__PURE__ */ P({
80
80
  optionLabelProp: {},
81
81
  defaultActiveFirstOption: { type: Boolean, default: void 0 },
82
82
  labelInValue: { type: Boolean, default: void 0 },
83
- emptyText: { default: "-" },
83
+ emptyText: { default: "--" },
84
84
  request: {},
85
85
  multiple: { type: Boolean, default: void 0 },
86
86
  value: {},
@@ -17,6 +17,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
17
17
  step: number;
18
18
  tooltipOpen: undefined;
19
19
  tooltipVisible: undefined;
20
+ emptyText: string;
20
21
  }>, {
21
22
  focus: typeof focus;
22
23
  blur: typeof blur;
@@ -29,6 +30,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
29
30
  step: number;
30
31
  tooltipOpen: undefined;
31
32
  tooltipVisible: undefined;
33
+ emptyText: string;
32
34
  }>>> & {
33
35
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
34
36
  }, {
@@ -38,6 +40,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
38
40
  included: boolean;
39
41
  tooltipOpen: boolean;
40
42
  tooltipVisible: boolean;
43
+ emptyText: string;
41
44
  }, {}>, Readonly<ApFieldSliderSlots> & ApFieldSliderSlots>;
42
45
  export default _default;
43
46
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -36,13 +36,13 @@ const I = /* @__PURE__ */ x({
36
36
  onFocus: {},
37
37
  onBlur: {},
38
38
  "onUpdate:value": {},
39
- emptyText: {}
39
+ emptyText: { default: "--" }
40
40
  },
41
41
  emits: ["update:value"],
42
42
  setup(p, { expose: i, emit: s }) {
43
- const d = g(), a = k(), l = p, m = s, { value: r, updateValue: f } = E(
43
+ const d = g(), a = k(), l = p, f = s, { value: r, updateValue: m } = E(
44
44
  l,
45
- m
45
+ f
46
46
  ), c = C(() => {
47
47
  const e = o(r);
48
48
  return w(e) ? l.emptyText : z(e) ? `${e[0]}-${e[1]}` : e;
@@ -71,7 +71,7 @@ const I = /* @__PURE__ */ x({
71
71
  ]),
72
72
  {
73
73
  value: o(r),
74
- "onUpdate:value": o(f),
74
+ "onUpdate:value": o(m),
75
75
  ref_key: "sliderRef",
76
76
  ref: a
77
77
  }
@@ -41,7 +41,7 @@ const J = /* @__PURE__ */ F({
41
41
  onBlur: {},
42
42
  onFocus: {},
43
43
  emptyText: {
44
- default: "-"
44
+ default: "--"
45
45
  },
46
46
  onAction: {},
47
47
  confirm: {}
@@ -80,7 +80,7 @@ const K = /* @__PURE__ */ v({
80
80
  default: !0
81
81
  },
82
82
  emptyText: {
83
- default: "-"
83
+ default: "--"
84
84
  }
85
85
  },
86
86
  emits: ["update:value"],
@@ -94,7 +94,7 @@ const D = /* @__PURE__ */ x({
94
94
  },
95
95
  "onUpdate:visible": {},
96
96
  emptyText: {
97
- default: "-"
97
+ default: "--"
98
98
  }
99
99
  },
100
100
  emits: ["update:value", "update:visible"],
@@ -52,7 +52,7 @@ const I = /* @__PURE__ */ c({
52
52
  handleReset: {},
53
53
  clearIcon: {},
54
54
  allowClear: { type: Boolean, default: !0 },
55
- emptyText: { default: "-" }
55
+ emptyText: { default: "--" }
56
56
  },
57
57
  emits: ["update:value"],
58
58
  setup(u, { expose: p, emit: s }) {
@@ -22,6 +22,7 @@ type ApTableSlots = {
22
22
  expandColumnTitle?: any;
23
23
  customFilterIcon?: any;
24
24
  customFilterDropdown?: any;
25
+ searchFormExtra?: any;
25
26
  };
26
27
  /**
27
28
  * 设置查询表单值
@@ -47,6 +48,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
47
48
  searchForm: undefined;
48
49
  loading: undefined;
49
50
  manual: boolean;
51
+ adaptive: boolean;
50
52
  }>, {
51
53
  submit: () => void;
52
54
  reset: () => void;
@@ -71,6 +73,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
71
73
  searchForm: undefined;
72
74
  loading: undefined;
73
75
  manual: boolean;
76
+ adaptive: boolean;
74
77
  }>>>, {
75
78
  loading: boolean | Partial< ExtractPropTypes<{
76
79
  prefixCls: StringConstructor;
@@ -164,9 +167,8 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
164
167
  childrenColumnName: string;
165
168
  card: boolean;
166
169
  searchForm: false | ApFormSearchFormProps;
167
- }, {}>, Partial<Record<NonNullable<keyof ApTableSlots>, (_: any) => any>> & {
168
- title?(_: {}): any;
169
- }>;
170
+ adaptive: boolean;
171
+ }, {}>, Readonly<ApTableSlots> & ApTableSlots>;
170
172
  export default _default;
171
173
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
172
174
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,19 +1,20 @@
1
- import { defineComponent as $, computed as d, createVNode as s, mergeProps as c, unref as r, watch as H, openBlock as p, createElementBlock as m, normalizeClass as h, normalizeStyle as x, withCtx as f, Fragment as G, renderList as B, createBlock as Q, resolveDynamicComponent as U, createCommentVNode as P, createElementVNode as I, renderSlot as v, createSlots as J, toDisplayString as X, normalizeProps as Y, guardReactiveProps as Z } from "vue";
2
- import { Typography as ee, Table as ae, Tooltip as te } from "ant-design-vue";
3
- import { ApForm as oe } from "../ap-form/index.mjs";
4
- import { apTableRenderItemMap as re, noRenderAsFormItemValueList as k, apTableFormItemMap as le } from "./constants.mjs";
1
+ import { defineComponent as X, useSlots as Y, computed as d, createVNode as s, mergeProps as m, unref as l, watch as Z, openBlock as i, createElementBlock as g, normalizeClass as F, normalizeStyle as v, createSlots as P, withCtx as p, Fragment as ee, renderList as I, createBlock as ae, resolveDynamicComponent as te, renderSlot as S, createCommentVNode as k, createElementVNode as E, toDisplayString as oe, normalizeProps as re, guardReactiveProps as le } from "vue";
2
+ import { Typography as ne, Table as de, Tooltip as se } from "ant-design-vue";
3
+ import { ApForm as ue } from "../ap-form/index.mjs";
4
+ import { apTableRenderItemMap as ie, noRenderAsFormItemValueList as O, apTableFormItemMap as pe } from "./constants.mjs";
5
5
  import "../config-provider/index.mjs";
6
- import { useTablePaging as ne } from "./hooks/use-table-paging.mjs";
7
- import { isUndefined as de, omit as se } from "lodash-unified";
6
+ import { useTablePaging as ce } from "./hooks/use-table-paging.mjs";
7
+ import { isUndefined as fe, omit as me } from "lodash-unified";
8
8
  import "./style/ap-table.css";
9
- import { QuestionCircleOutlined as ue } from "@ant-design/icons-vue";
10
- import { apColumnToColumn as pe, getTableRenderType as ie, getTableRenderProps as ce, getColumnOrder as O, updateFormProps as me, getFieldProps as fe, getPlaceholder as ge } from "./utils.mjs";
11
- import { useLocale as ye } from "../config-provider/hooks/use-locale.mjs";
12
- import { useNamespace as be } from "../config-provider/hooks/use-namespace.mjs";
13
- import { useGlobalConfig as he } from "../config-provider/hooks/use-global-config.mjs";
14
- const Ce = {
9
+ import { QuestionCircleOutlined as ge } from "@ant-design/icons-vue";
10
+ import { apColumnToColumn as ye, getTableRenderType as he, getTableRenderProps as be, getColumnOrder as z, updateFormProps as Ce, getFieldProps as Fe, getPlaceholder as Se } from "./utils.mjs";
11
+ import Re from "./hooks/use-table-content-height.mjs";
12
+ import { useLocale as xe } from "../config-provider/hooks/use-locale.mjs";
13
+ import { useNamespace as we } from "../config-provider/hooks/use-namespace.mjs";
14
+ import { useGlobalConfig as Te } from "../config-provider/hooks/use-global-config.mjs";
15
+ const Be = {
15
16
  key: 0
16
- }, Ee = /* @__PURE__ */ $({
17
+ }, Ae = /* @__PURE__ */ X({
17
18
  name: "ApTable",
18
19
  __name: "ap-table",
19
20
  props: {
@@ -120,21 +121,28 @@ const Ce = {
120
121
  },
121
122
  size: {
122
123
  default: "middle"
124
+ },
125
+ adaptive: {
126
+ type: Boolean,
127
+ default: !1
123
128
  }
124
129
  },
125
- setup(z, {
126
- expose: E
130
+ setup(L, {
131
+ expose: V
127
132
  }) {
128
- const l = z, {
129
- t: L
130
- } = ye(), {
131
- e: C,
132
- b: g
133
- } = be("ap-table"), V = he("uiMode"), y = d(() => {
133
+ const r = L, R = Y(), {
134
+ t: N
135
+ } = xe(), {
136
+ e: y,
137
+ b: c
138
+ } = we("ap-table"), D = Te("uiMode"), {
139
+ height: W,
140
+ contentRef: _
141
+ } = Re(), h = d(() => {
134
142
  var t;
135
- let e = ((t = l.columns) == null ? void 0 : t.filter((a) => !a.hideInTable)) || [];
143
+ let e = ((t = r.columns) == null ? void 0 : t.filter((a) => !a.hideInTable)) || [];
136
144
  return e = e.map((a) => ({
137
- ...pe(a),
145
+ ...ye(a),
138
146
  customRender({
139
147
  value: o,
140
148
  ...n
@@ -147,24 +155,24 @@ const Ce = {
147
155
  column: a
148
156
  });
149
157
  else {
150
- const T = ie(a), q = re[T], K = ce(a, {
158
+ const B = he(a), U = ie[B], J = be(a, {
151
159
  value: o,
152
160
  ...n
153
161
  });
154
- u = s(q, c(K, {
162
+ u = s(U, m(J, {
155
163
  mode: "read"
156
164
  }), null);
157
165
  }
158
- return A(a, o, u);
166
+ return $(a, o, u);
159
167
  }
160
168
  })), e;
161
- }), F = d(() => {
169
+ }), x = d(() => {
162
170
  var e, t, a;
163
- return ((a = (t = (e = l.columns) == null ? void 0 : e.filter((o) => !o.hideInSearch && o.dataIndex && (o.valueType || o.customRenderFormItem) && !k.includes(o.valueType))) == null ? void 0 : t.sort((o, n) => {
164
- let u = O(o.order);
165
- return O(n.order) - u;
171
+ return ((a = (t = (e = r.columns) == null ? void 0 : e.filter((o) => !o.hideInSearch && o.dataIndex && (o.valueType || o.customRenderFormItem) && !O.includes(o.valueType))) == null ? void 0 : t.sort((o, n) => {
172
+ let u = z(o.order);
173
+ return z(n.order) - u;
166
174
  })) == null ? void 0 : a.map((o) => {
167
- const n = me(o, fe(o.fieldProps));
175
+ const n = Ce(o, Fe(o.fieldProps));
168
176
  return {
169
177
  ...o,
170
178
  fieldProps: {
@@ -172,42 +180,50 @@ const Ce = {
172
180
  name: o.dataIndex,
173
181
  ...n || {},
174
182
  // 格式化placeholder
175
- placeholder: ge(L, o.valueType, n == null ? void 0 : n.placeholder)
183
+ placeholder: Se(N, o.valueType, n == null ? void 0 : n.placeholder)
176
184
  }
177
185
  };
178
186
  })) || [];
179
- }), N = d(() => r(y).filter((e) => e.sorter === !0).map((e) => e.dataIndex)), D = d(() => r(y).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex)), {
187
+ }), j = d(() => l(h).filter((e) => e.sorter === !0).map((e) => e.dataIndex)), A = d(() => l(h).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex)), {
180
188
  formRef: b,
181
- submit: S,
182
- reset: R,
183
- tableProps: i,
184
- handleTableChange: j,
185
- data: w
186
- } = ne({
189
+ submit: w,
190
+ reset: T,
191
+ tableProps: f,
192
+ handleTableChange: M,
193
+ data: C
194
+ } = ce({
187
195
  async request(e) {
188
196
  var a, o;
189
- const t = await ((a = l.request) == null ? void 0 : a.call(l, e));
190
- return (o = l.onLoad) == null || o.call(l, (t == null ? void 0 : t.data) || []), {
197
+ const t = await ((a = r.request) == null ? void 0 : a.call(r, e));
198
+ return (o = r.onLoad) == null || o.call(r, (t == null ? void 0 : t.data) || []), {
191
199
  data: (t == null ? void 0 : t.data) || [],
192
200
  total: (t == null ? void 0 : t.total) || 0
193
201
  };
194
202
  },
195
- filterFields: r(D),
196
- sortFields: r(N),
197
- defaultParams: l.params,
198
- defaultData: l.defaultData,
199
- manual: l.manual,
200
- defaultCurrent: l.pagination ? l.pagination.defaultCurrent : void 0,
201
- defaultPageSize: l.pagination ? l.pagination.defaultPageSize : void 0,
202
- formatParams: l.beforeSearchSubmit
203
- }), W = d(() => ({
204
- ...l,
205
- ...r(i),
206
- loading: de(l.loading) ? r(i).loading : l.loading,
207
- pagination: l.pagination === !1 ? !1 : r(i).pagination
208
- }));
209
- function A(e, t, a) {
210
- return k.includes(e.valueType) ? a : e.copyable || e.ellipsis ? s(ee.Text, {
203
+ filterFields: l(A),
204
+ sortFields: l(j),
205
+ defaultParams: r.params,
206
+ defaultData: r.defaultData,
207
+ manual: r.manual,
208
+ defaultCurrent: r.pagination ? r.pagination.defaultCurrent : void 0,
209
+ defaultPageSize: r.pagination ? r.pagination.defaultPageSize : void 0,
210
+ formatParams: r.beforeSearchSubmit
211
+ }), q = d(() => {
212
+ if (r.scroll)
213
+ return r.scroll;
214
+ if (r.adaptive && C.value.total > 0)
215
+ return {
216
+ y: l(W)
217
+ };
218
+ }), H = d(() => ({
219
+ ...r,
220
+ ...l(f),
221
+ loading: fe(r.loading) ? l(f).loading : r.loading,
222
+ pagination: r.pagination === !1 ? !1 : l(f).pagination,
223
+ scroll: l(q)
224
+ })), K = d(() => [r.card ? null : c("wrapper"), r.adaptive ? c("adaptive") : null].filter(Boolean));
225
+ function $(e, t, a) {
226
+ return O.includes(e.valueType) ? a : e.copyable || e.ellipsis ? s(ne.Text, {
211
227
  copyable: e.copyable ? {
212
228
  text: t,
213
229
  tooltip: !1
@@ -218,76 +234,82 @@ const Ce = {
218
234
  content: a
219
235
  }, null) : a;
220
236
  }
221
- H(() => r(w).loading, (e) => {
237
+ Z(() => l(C).loading, (e) => {
222
238
  var t;
223
- (t = l.onLoadingChange) == null || t.call(l, e);
239
+ (t = r.onLoadingChange) == null || t.call(r, e);
224
240
  });
225
- function M(e) {
241
+ function G(e) {
226
242
  var t, a, o;
227
243
  (o = (a = (t = b.value) == null ? void 0 : t.apForm) == null ? void 0 : a.setFieldsValue) == null || o.call(a, e);
228
244
  }
229
- function _() {
245
+ function Q() {
230
246
  var e, t, a;
231
247
  return (a = (t = (e = b.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValue) == null ? void 0 : a.call(t, !0);
232
248
  }
233
- return E({
234
- submit: () => S(),
235
- reset: () => R(),
236
- setSearchFormValues: M,
237
- getSearchFormValues: _,
238
- dataSource: d(() => r(w).records)
239
- }), (e, t) => (p(), m("div", {
240
- class: h(e.card ? null : r(g)("wrapper"))
241
- }, [e.searchForm !== !1 && F.value.length > 0 ? (p(), m("div", {
249
+ return V({
250
+ submit: () => w(),
251
+ reset: () => T(),
252
+ setSearchFormValues: G,
253
+ getSearchFormValues: Q,
254
+ dataSource: d(() => l(C).records)
255
+ }), (e, t) => (i(), g("div", {
256
+ class: F(K.value)
257
+ }, [e.searchForm !== !1 && x.value.length > 0 ? (i(), g("div", {
242
258
  key: 0,
243
- class: h(e.card ? r(C)("search-wrapper") : null),
244
- style: x(e.searchFormWrapperStyle)
245
- }, [s(r(oe).SearchForm, c(e.searchForm || {}, {
259
+ class: F(e.card ? l(y)("search-wrapper") : null),
260
+ style: v(e.searchFormWrapperStyle)
261
+ }, [s(l(ue).SearchForm, m(e.searchForm || {}, {
246
262
  ref_key: "formRef",
247
263
  ref: b,
248
264
  "custom-reset": "",
249
- onSubmit: r(S),
250
- onReset: r(R),
251
- "submit-loading": r(i).loading
252
- }), {
253
- default: f(() => [(p(!0), m(G, null, B(F.value, (a) => (p(), Q(U(a.customRenderFormItem ? a.customRenderFormItem(a) : r(le)[a.valueType || "text"]), c({
265
+ onSubmit: l(w),
266
+ onReset: l(T),
267
+ "submit-loading": l(f).loading
268
+ }), P({
269
+ default: p(() => [(i(!0), g(ee, null, I(x.value, (a) => (i(), ae(te(a.customRenderFormItem ? a.customRenderFormItem(a) : l(pe)[a.valueType || "text"]), m({
254
270
  key: a.dataIndex,
255
271
  ref_for: !0
256
272
  }, a.fieldProps || {}, {
257
273
  span: a.span
258
274
  }), null, 16, ["span"]))), 128))]),
259
- _: 1
260
- }, 16, ["onSubmit", "onReset", "submit-loading"])], 6)) : P("", !0), I("div", {
261
- class: h(e.card ? r(C)("table-wrapper") : null),
262
- style: x(e.tableWrapperStyle)
263
- }, [v(e.$slots, "title"), s(r(ae), c({
264
- class: r(V) === "admin" ? r(g)("table-admin") : r(g)("table")
265
- }, W.value, {
266
- onChange: r(j),
267
- columns: y.value
268
- }), J({
269
- headerCell: f(({
275
+ _: 2
276
+ }, [R.searchFormExtra ? {
277
+ name: "extra",
278
+ fn: p(() => [S(e.$slots, "searchFormExtra")]),
279
+ key: "0"
280
+ } : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : k("", !0), E("div", {
281
+ ref_key: "contentRef",
282
+ ref: _,
283
+ class: F([l(y)("table-wrapper"), e.card ? l(y)("table-wrapper-card") : null]),
284
+ style: v(e.tableWrapperStyle)
285
+ }, [S(e.$slots, "title"), s(l(de), m({
286
+ class: l(D) === "admin" ? l(c)("table-admin") : l(c)("table")
287
+ }, H.value, {
288
+ onChange: l(M),
289
+ columns: h.value
290
+ }), P({
291
+ headerCell: p(({
270
292
  column: a,
271
293
  title: o
272
- }) => [a.tooltip ? (p(), m("span", Ce, [I("span", null, X(o), 1), s(r(te), {
294
+ }) => [a.tooltip ? (i(), g("span", Be, [E("span", null, oe(o), 1), s(l(se), {
273
295
  title: a.tooltip,
274
296
  placement: "bottom"
275
297
  }, {
276
- default: f(() => [s(r(ue), {
298
+ default: p(() => [s(l(ge), {
277
299
  style: {
278
300
  color: "#0070ff",
279
301
  "padding-left": "4px"
280
302
  }
281
303
  })]),
282
304
  _: 2
283
- }, 1032, ["title"])])) : P("", !0)]),
305
+ }, 1032, ["title"])])) : k("", !0)]),
284
306
  _: 2
285
- }, [B(r(se)(e.$slots, "title"), (a, o) => ({
307
+ }, [I(l(me)(R, ["title", "searchFormExtra"]), (a, o) => ({
286
308
  name: o,
287
- fn: f((n) => [v(e.$slots, o, Y(Z(n || {})))])
309
+ fn: p((n) => [S(e.$slots, o, re(le(n || {})))])
288
310
  }))]), 1040, ["class", "onChange", "columns"])], 6)], 2));
289
311
  }
290
312
  });
291
313
  export {
292
- Ee as default
314
+ Ae as default
293
315
  };
@@ -0,0 +1,9 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ export type TableContentHeightOptions = {
3
+ offset?: number;
4
+ };
5
+ declare const useTableContentHeight: (options?: TableContentHeightOptions) => {
6
+ contentRef: Ref<HTMLDivElement | undefined>;
7
+ height: ComputedRef<number>;
8
+ };
9
+ export default useTableContentHeight;
@@ -0,0 +1,39 @@
1
+ import { useElementSize as d } from "@vueuse/core";
2
+ import { ref as g, computed as H, unref as l, onUpdated as S } from "vue";
3
+ function f(t) {
4
+ if (!t)
5
+ return 0;
6
+ const e = parseFloat(t);
7
+ return Number.isNaN(e) ? 0 : e;
8
+ }
9
+ function h(t) {
10
+ if (!t)
11
+ return 0;
12
+ const e = getComputedStyle(t);
13
+ return t.clientHeight + f(e.marginTop) + f(e.marginBottom);
14
+ }
15
+ const v = (t) => {
16
+ const e = g(), { height: s } = d(e), a = g();
17
+ let i = !1;
18
+ const m = H(() => {
19
+ var o, u, c;
20
+ const r = ((u = (o = e.value) == null ? void 0 : o.querySelector(".ant-table-header")) == null ? void 0 : u.clientHeight) || 47, n = (c = e.value) == null ? void 0 : c.querySelector(".ant-pagination"), p = n ? h(n) : l(a);
21
+ return n && (i = !0), Math.ceil(
22
+ l(s) - r - (p || 0) - ((t == null ? void 0 : t.offset) || 0)
23
+ );
24
+ });
25
+ return S(() => {
26
+ var n;
27
+ if (i)
28
+ return;
29
+ const r = (n = e.value) == null ? void 0 : n.querySelector(".ant-pagination");
30
+ if (!r) {
31
+ a.value = 0;
32
+ return;
33
+ }
34
+ a.value = h(r), i = !0;
35
+ }), { contentRef: e, height: m };
36
+ };
37
+ export {
38
+ v as default
39
+ };
@@ -62,7 +62,7 @@ export type ExtraProColumnType<T> = Omit<ColumnType<T>, 'children' | 'filters'>
62
62
  multiple?: number;
63
63
  };
64
64
  };
65
- export type ApColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = ExtraProColumnType<any> & {
65
+ export type ApColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = ExtraProColumnType<RecordType> & {
66
66
  children?: ApColumnType<any, RecordType>[];
67
67
  /**
68
68
  * 表单项所占据的格子数(1-24格)
@@ -199,6 +199,10 @@ export type ApTableProps<RecordType = any, ParamsType = any, ValueType extends k
199
199
  * 表格尺寸(只支持中等大小和小尺寸)
200
200
  */
201
201
  size?: 'middle' | 'small';
202
+ /**
203
+ * 表格是否自适应高度
204
+ */
205
+ adaptive?: boolean;
202
206
  };
203
207
  export type ApTableExpose<SearchParamsType = Recordable, RecordType = any> = {
204
208
  /**
@@ -2,6 +2,30 @@
2
2
  padding: 16px;
3
3
  background-color: #fff;
4
4
  }
5
+ .aplus-ap-table-adaptive {
6
+ height: 100%;
7
+ display: flex;
8
+ flex-direction: column;
9
+ }
10
+ .aplus-ap-table-adaptive .ant-table-wrapper,
11
+ .aplus-ap-table-adaptive .ant-spin-nested-loading,
12
+ .aplus-ap-table-adaptive .ant-spin-container {
13
+ height: 100%;
14
+ }
15
+ .aplus-ap-table-adaptive .ant-spin-container {
16
+ display: flex;
17
+ flex-direction: column;
18
+ }
19
+ .aplus-ap-table-adaptive .ant-table {
20
+ flex: 1;
21
+ }
22
+ .aplus-ap-table-adaptive .ant-table-container,
23
+ .aplus-ap-table-adaptive .ant-table-content {
24
+ height: 100%;
25
+ }
26
+ .aplus-ap-table-adaptive .ant-table-content > table {
27
+ height: 100%;
28
+ }
5
29
  .aplus-ap-table__search-wrapper {
6
30
  padding: 16px;
7
31
  padding-bottom: 0;
@@ -9,8 +33,12 @@
9
33
  margin-bottom: 16px;
10
34
  }
11
35
  .aplus-ap-table__table-wrapper {
36
+ flex: 1;
37
+ }
38
+ .aplus-ap-table__table-wrapper-card {
12
39
  padding: 16px;
13
40
  background-color: #fff;
41
+ overflow: hidden;
14
42
  }
15
43
  .aplus-ap-table-table .ant-pagination {
16
44
  margin-bottom: 0 !important;