@aplus-frontend/ui 0.0.8 → 0.0.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.
- package/es/src/ap-field/interface.d.ts +4 -0
- package/es/src/ap-field/select/index.vue.d.ts +3 -0
- package/es/src/ap-field/select/index.vue.mjs +45 -36
- package/es/src/ap-table/ap-table.vue.d.ts +3 -0
- package/es/src/ap-table/ap-table.vue.mjs +106 -88
- package/es/src/ap-table/constants.d.ts +19 -0
- package/es/src/ap-table/hooks/use-table-content-height.d.ts +9 -0
- package/es/src/ap-table/hooks/use-table-content-height.mjs +39 -0
- package/es/src/ap-table/interface.d.ts +4 -0
- package/es/src/ap-table/style/ap-table.css +28 -0
- package/es/src/theme/ap-table/ap-table.css +28 -0
- package/lib/src/ap-field/interface.d.ts +4 -0
- package/lib/src/ap-field/select/index.vue.d.ts +3 -0
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +3 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +19 -0
- package/lib/src/ap-table/hooks/use-table-content-height.d.ts +9 -0
- package/lib/src/ap-table/hooks/use-table-content-height.js +1 -0
- package/lib/src/ap-table/interface.d.ts +4 -0
- package/lib/src/ap-table/style/ap-table.css +28 -0
- package/lib/src/theme/ap-table/ap-table.css +28 -0
- package/package.json +3 -3
|
@@ -89,6 +89,10 @@ export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'v
|
|
|
89
89
|
multiple?: boolean;
|
|
90
90
|
value?: SelectProps['value'];
|
|
91
91
|
'onUpdate:value'?: SelectProps['onUpdate:value'];
|
|
92
|
+
/**
|
|
93
|
+
* 如果设置showSearch=true,此时设置searchMode=filter将进行前端筛选,设置searchMode=request将会走后端筛选
|
|
94
|
+
*/
|
|
95
|
+
searchMode?: 'filter' | 'request';
|
|
92
96
|
};
|
|
93
97
|
export type ApFieldSelectSlots = {
|
|
94
98
|
focus: () => void;
|
|
@@ -34,6 +34,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
34
34
|
defaultActiveFirstOption: undefined;
|
|
35
35
|
labelInValue: undefined;
|
|
36
36
|
multiple: undefined;
|
|
37
|
+
searchMode: string;
|
|
37
38
|
}>, {
|
|
38
39
|
focus: typeof focus;
|
|
39
40
|
blur: typeof blur;
|
|
@@ -56,6 +57,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
56
57
|
defaultActiveFirstOption: undefined;
|
|
57
58
|
labelInValue: undefined;
|
|
58
59
|
multiple: undefined;
|
|
60
|
+
searchMode: string;
|
|
59
61
|
}>>> & {
|
|
60
62
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
61
63
|
}, {
|
|
@@ -75,6 +77,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
75
77
|
defaultActiveFirstOption: boolean;
|
|
76
78
|
labelInValue: boolean;
|
|
77
79
|
emptyText: string;
|
|
80
|
+
searchMode: "filter" | "request";
|
|
78
81
|
}, {}>, Readonly<ApFieldSelectSlots> & ApFieldSelectSlots>;
|
|
79
82
|
export default _default;
|
|
80
83
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as P, ref as c, onMounted as k, computed as p, unref as
|
|
2
|
-
import { debounce as L, isFunction as h, isArray as z,
|
|
1
|
+
import { defineComponent as P, ref as c, onMounted as k, computed as p, unref as a, openBlock as m, createElementBlock as A, toDisplayString as M, createBlock as O, mergeProps as T, createSlots as q, renderList as N, withCtx as v, renderSlot as _, normalizeProps as R, guardReactiveProps as U, createVNode as D } from "vue";
|
|
2
|
+
import { debounce as L, isFunction as h, isArray as z, isNil as K, omit as H } from "lodash-unified";
|
|
3
3
|
import { Select as $, Spin as j } from "ant-design-vue";
|
|
4
4
|
import "../../hooks/index.mjs";
|
|
5
5
|
import { omitUndefined as E } from "../../utils/index.mjs";
|
|
@@ -84,61 +84,70 @@ const G = { key: 0 }, oe = /* @__PURE__ */ P({
|
|
|
84
84
|
request: {},
|
|
85
85
|
multiple: { type: Boolean, default: void 0 },
|
|
86
86
|
value: {},
|
|
87
|
-
"onUpdate:value": {}
|
|
87
|
+
"onUpdate:value": {},
|
|
88
|
+
searchMode: { default: "filter" }
|
|
88
89
|
},
|
|
89
90
|
emits: ["update:value"],
|
|
90
91
|
setup(y, { expose: w, emit: g }) {
|
|
91
|
-
let
|
|
92
|
+
let r = 0;
|
|
92
93
|
const S = (o, t) => typeof (t == null ? void 0 : t.label) == "string" && t.label.indexOf(o) > -1, B = L((o) => {
|
|
93
94
|
if (!h(e.request))
|
|
94
95
|
return;
|
|
95
|
-
|
|
96
|
-
const t =
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
r += 1;
|
|
97
|
+
const t = r;
|
|
98
|
+
i.value = [], l.value = !0, e.request(o).then((n) => {
|
|
99
|
+
r === t && (i.value = n);
|
|
99
100
|
}).finally(() => {
|
|
100
|
-
|
|
101
|
+
l.value = !1;
|
|
101
102
|
});
|
|
102
|
-
}, 300), e = y,
|
|
103
|
+
}, 300), e = y, i = c((e == null ? void 0 : e.options) || []), d = c(), l = c((e == null ? void 0 : e.loading) || !1), C = g;
|
|
103
104
|
k(() => {
|
|
104
105
|
if (h(e.request)) {
|
|
105
|
-
|
|
106
|
-
const o =
|
|
106
|
+
l.value = !0, r += 1;
|
|
107
|
+
const o = r;
|
|
107
108
|
e.request().then((t) => {
|
|
108
|
-
o ===
|
|
109
|
+
o === r && (i.value = t);
|
|
109
110
|
}).finally(() => {
|
|
110
|
-
|
|
111
|
+
l.value = !1;
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
});
|
|
114
115
|
const { value: f, updateValue: b } = W(e, C), x = p(() => {
|
|
115
|
-
const o =
|
|
116
|
+
const o = a(f);
|
|
116
117
|
if (!o)
|
|
117
118
|
return e.emptyText;
|
|
118
119
|
if (z(o))
|
|
119
120
|
return o.map(
|
|
120
|
-
(
|
|
121
|
+
(n) => {
|
|
121
122
|
var u;
|
|
122
|
-
return (u =
|
|
123
|
+
return (u = a(i).find((s) => s.value === n)) == null ? void 0 : u.label;
|
|
123
124
|
}
|
|
124
125
|
).filter(Boolean).join("、") || e.emptyText;
|
|
125
|
-
const t =
|
|
126
|
+
const t = a(i).find((n) => n.value === o);
|
|
126
127
|
return (t == null ? void 0 : t.label) || e.emptyText;
|
|
127
128
|
}), F = p(() => {
|
|
128
|
-
const
|
|
129
|
+
const o = !!(e != null && e.showSearch), t = e.searchMode;
|
|
130
|
+
let n = {};
|
|
131
|
+
return o && (n = t === "request" ? {
|
|
129
132
|
showArrow: !1,
|
|
130
133
|
defaultActiveFirstOption: !1,
|
|
131
134
|
onSearch: B,
|
|
132
|
-
notFoundContent:
|
|
135
|
+
notFoundContent: l.value ? void 0 : null
|
|
133
136
|
} : {
|
|
134
|
-
showArrow: !0
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
showArrow: !0,
|
|
138
|
+
filterOption: K(e == null ? void 0 : e.filterOption) ? S : e == null ? void 0 : e.filterOption
|
|
139
|
+
}), {
|
|
137
140
|
...E(
|
|
138
|
-
|
|
141
|
+
H(e, [
|
|
142
|
+
"mode",
|
|
143
|
+
"value",
|
|
144
|
+
"onUpdate:value",
|
|
145
|
+
"onSearch",
|
|
146
|
+
"request",
|
|
147
|
+
"searchMode"
|
|
148
|
+
])
|
|
139
149
|
),
|
|
140
|
-
...
|
|
141
|
-
filterOption: e.showSearch ? !1 : H(e == null ? void 0 : e.filterOption) ? S : e == null ? void 0 : e.filterOption
|
|
150
|
+
...n
|
|
142
151
|
};
|
|
143
152
|
});
|
|
144
153
|
function I() {
|
|
@@ -152,28 +161,28 @@ const G = { key: 0 }, oe = /* @__PURE__ */ P({
|
|
|
152
161
|
return w({
|
|
153
162
|
focus: I,
|
|
154
163
|
blur: V
|
|
155
|
-
}), (o, t) => o.mode === "read" ? (m(), A("span", G,
|
|
164
|
+
}), (o, t) => o.mode === "read" ? (m(), A("span", G, M(x.value), 1)) : (m(), O(a($), T({
|
|
156
165
|
key: 1,
|
|
157
166
|
"allow-clear": "",
|
|
158
167
|
ref_key: "selectRef",
|
|
159
168
|
ref: d
|
|
160
169
|
}, F.value, {
|
|
161
170
|
mode: o.multiple ? "multiple" : void 0,
|
|
162
|
-
value:
|
|
163
|
-
"onUpdate:value":
|
|
164
|
-
options:
|
|
165
|
-
loading:
|
|
166
|
-
}),
|
|
167
|
-
|
|
171
|
+
value: a(f),
|
|
172
|
+
"onUpdate:value": a(b),
|
|
173
|
+
options: i.value,
|
|
174
|
+
loading: l.value
|
|
175
|
+
}), q({ _: 2 }, [
|
|
176
|
+
N(o.$slots, (n, u) => ({
|
|
168
177
|
name: u,
|
|
169
178
|
fn: v((s) => [
|
|
170
|
-
|
|
179
|
+
_(o.$slots, u, R(U(s || {})))
|
|
171
180
|
])
|
|
172
181
|
})),
|
|
173
|
-
|
|
182
|
+
l.value ? {
|
|
174
183
|
name: "notFoundContent",
|
|
175
184
|
fn: v(() => [
|
|
176
|
-
D(
|
|
185
|
+
D(a(j), { size: "small" })
|
|
177
186
|
]),
|
|
178
187
|
key: "0"
|
|
179
188
|
} : void 0
|
|
@@ -47,6 +47,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
47
47
|
searchForm: undefined;
|
|
48
48
|
loading: undefined;
|
|
49
49
|
manual: boolean;
|
|
50
|
+
adaptive: boolean;
|
|
50
51
|
}>, {
|
|
51
52
|
submit: () => void;
|
|
52
53
|
reset: () => void;
|
|
@@ -71,6 +72,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
71
72
|
searchForm: undefined;
|
|
72
73
|
loading: undefined;
|
|
73
74
|
manual: boolean;
|
|
75
|
+
adaptive: boolean;
|
|
74
76
|
}>>>, {
|
|
75
77
|
loading: boolean | Partial< ExtractPropTypes<{
|
|
76
78
|
prefixCls: StringConstructor;
|
|
@@ -164,6 +166,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
164
166
|
childrenColumnName: string;
|
|
165
167
|
card: boolean;
|
|
166
168
|
searchForm: false | ApFormSearchFormProps;
|
|
169
|
+
adaptive: boolean;
|
|
167
170
|
}, {}>, Partial<Record<NonNullable<keyof ApTableSlots>, (_: any) => any>> & {
|
|
168
171
|
title?(_: {}): any;
|
|
169
172
|
}>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Typography as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { apTableRenderItemMap as
|
|
1
|
+
import { defineComponent as U, computed as d, createVNode as s, mergeProps as f, unref as l, watch as J, openBlock as i, createElementBlock as m, normalizeClass as F, normalizeStyle as x, withCtx as g, Fragment as X, renderList as B, createBlock as Y, resolveDynamicComponent as Z, createCommentVNode as v, createElementVNode as P, renderSlot as I, createSlots as ee, toDisplayString as ae, normalizeProps as te, guardReactiveProps as oe } from "vue";
|
|
2
|
+
import { Typography as re, Table as le, Tooltip as ne } from "ant-design-vue";
|
|
3
|
+
import { ApForm as de } from "../ap-form/index.mjs";
|
|
4
|
+
import { apTableRenderItemMap as se, noRenderAsFormItemValueList as k, apTableFormItemMap as ue } from "./constants.mjs";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
|
-
import { useTablePaging as
|
|
7
|
-
import { isUndefined as
|
|
6
|
+
import { useTablePaging as ie } from "./hooks/use-table-paging.mjs";
|
|
7
|
+
import { isUndefined as pe, omit as ce } from "lodash-unified";
|
|
8
8
|
import "./style/ap-table.css";
|
|
9
|
-
import { QuestionCircleOutlined as
|
|
10
|
-
import { apColumnToColumn as
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
9
|
+
import { QuestionCircleOutlined as fe } from "@ant-design/icons-vue";
|
|
10
|
+
import { apColumnToColumn as me, getTableRenderType as ge, getTableRenderProps as ye, getColumnOrder as O, updateFormProps as be, getFieldProps as he, getPlaceholder as Ce } from "./utils.mjs";
|
|
11
|
+
import Fe from "./hooks/use-table-content-height.mjs";
|
|
12
|
+
import { useLocale as Se } from "../config-provider/hooks/use-locale.mjs";
|
|
13
|
+
import { useNamespace as Re } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
import { useGlobalConfig as we } from "../config-provider/hooks/use-global-config.mjs";
|
|
15
|
+
const Te = {
|
|
15
16
|
key: 0
|
|
16
|
-
},
|
|
17
|
+
}, _e = /* @__PURE__ */ U({
|
|
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
130
|
setup(z, {
|
|
126
131
|
expose: E
|
|
127
132
|
}) {
|
|
128
|
-
const
|
|
133
|
+
const r = z, {
|
|
129
134
|
t: L
|
|
130
|
-
} =
|
|
131
|
-
e:
|
|
132
|
-
b:
|
|
133
|
-
} =
|
|
135
|
+
} = Se(), {
|
|
136
|
+
e: y,
|
|
137
|
+
b: p
|
|
138
|
+
} = Re("ap-table"), V = we("uiMode"), {
|
|
139
|
+
height: N,
|
|
140
|
+
contentRef: D
|
|
141
|
+
} = Fe(), b = d(() => {
|
|
134
142
|
var t;
|
|
135
|
-
let e = ((t =
|
|
143
|
+
let e = ((t = r.columns) == null ? void 0 : t.filter((a) => !a.hideInTable)) || [];
|
|
136
144
|
return e = e.map((a) => ({
|
|
137
|
-
...
|
|
145
|
+
...me(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 =
|
|
158
|
+
const T = ge(a), G = se[T], Q = ye(a, {
|
|
151
159
|
value: o,
|
|
152
160
|
...n
|
|
153
161
|
});
|
|
154
|
-
u = s(
|
|
162
|
+
u = s(G, f(Q, {
|
|
155
163
|
mode: "read"
|
|
156
164
|
}), null);
|
|
157
165
|
}
|
|
158
|
-
return
|
|
166
|
+
return H(a, o, u);
|
|
159
167
|
}
|
|
160
168
|
})), e;
|
|
161
|
-
}),
|
|
169
|
+
}), S = d(() => {
|
|
162
170
|
var e, t, a;
|
|
163
|
-
return ((a = (t = (e =
|
|
171
|
+
return ((a = (t = (e = r.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
172
|
let u = O(o.order);
|
|
165
173
|
return O(n.order) - u;
|
|
166
174
|
})) == null ? void 0 : a.map((o) => {
|
|
167
|
-
const n =
|
|
175
|
+
const n = be(o, he(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:
|
|
183
|
+
placeholder: Ce(L, o.valueType, n == null ? void 0 : n.placeholder)
|
|
176
184
|
}
|
|
177
185
|
};
|
|
178
186
|
})) || [];
|
|
179
|
-
}),
|
|
180
|
-
formRef:
|
|
181
|
-
submit:
|
|
182
|
-
reset:
|
|
183
|
-
tableProps:
|
|
187
|
+
}), W = d(() => l(b).filter((e) => e.sorter === !0).map((e) => e.dataIndex)), _ = d(() => l(b).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex)), {
|
|
188
|
+
formRef: h,
|
|
189
|
+
submit: R,
|
|
190
|
+
reset: w,
|
|
191
|
+
tableProps: c,
|
|
184
192
|
handleTableChange: j,
|
|
185
|
-
data:
|
|
186
|
-
} =
|
|
193
|
+
data: C
|
|
194
|
+
} = ie({
|
|
187
195
|
async request(e) {
|
|
188
196
|
var a, o;
|
|
189
|
-
const t = await ((a =
|
|
190
|
-
return (o =
|
|
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:
|
|
196
|
-
sortFields:
|
|
197
|
-
defaultParams:
|
|
198
|
-
defaultData:
|
|
199
|
-
manual:
|
|
200
|
-
defaultCurrent:
|
|
201
|
-
defaultPageSize:
|
|
202
|
-
formatParams:
|
|
203
|
-
}),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
filterFields: l(_),
|
|
204
|
+
sortFields: l(W),
|
|
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
|
+
}), A = d(() => {
|
|
212
|
+
if (r.scroll)
|
|
213
|
+
return r.scroll;
|
|
214
|
+
if (r.adaptive && C.value.total > 0)
|
|
215
|
+
return {
|
|
216
|
+
y: l(N)
|
|
217
|
+
};
|
|
218
|
+
}), M = d(() => ({
|
|
219
|
+
...r,
|
|
220
|
+
...l(c),
|
|
221
|
+
loading: pe(r.loading) ? l(c).loading : r.loading,
|
|
222
|
+
pagination: r.pagination === !1 ? !1 : l(c).pagination,
|
|
223
|
+
scroll: l(A)
|
|
224
|
+
})), q = d(() => [r.card ? null : p("wrapper"), r.adaptive ? p("adaptive") : null].filter(Boolean));
|
|
225
|
+
function H(e, t, a) {
|
|
226
|
+
return k.includes(e.valueType) ? a : e.copyable || e.ellipsis ? s(re.Text, {
|
|
211
227
|
copyable: e.copyable ? {
|
|
212
228
|
text: t,
|
|
213
229
|
tooltip: !1
|
|
@@ -218,76 +234,78 @@ const Ce = {
|
|
|
218
234
|
content: a
|
|
219
235
|
}, null) : a;
|
|
220
236
|
}
|
|
221
|
-
|
|
237
|
+
J(() => l(C).loading, (e) => {
|
|
222
238
|
var t;
|
|
223
|
-
(t =
|
|
239
|
+
(t = r.onLoadingChange) == null || t.call(r, e);
|
|
224
240
|
});
|
|
225
|
-
function
|
|
241
|
+
function K(e) {
|
|
226
242
|
var t, a, o;
|
|
227
|
-
(o = (a = (t =
|
|
243
|
+
(o = (a = (t = h.value) == null ? void 0 : t.apForm) == null ? void 0 : a.setFieldsValue) == null || o.call(a, e);
|
|
228
244
|
}
|
|
229
|
-
function
|
|
245
|
+
function $() {
|
|
230
246
|
var e, t, a;
|
|
231
|
-
return (a = (t = (e =
|
|
247
|
+
return (a = (t = (e = h.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValue) == null ? void 0 : a.call(t, !0);
|
|
232
248
|
}
|
|
233
249
|
return E({
|
|
234
|
-
submit: () =>
|
|
235
|
-
reset: () =>
|
|
236
|
-
setSearchFormValues:
|
|
237
|
-
getSearchFormValues:
|
|
238
|
-
dataSource: d(() =>
|
|
239
|
-
}), (e, t) => (
|
|
240
|
-
class:
|
|
241
|
-
}, [e.searchForm !== !1 &&
|
|
250
|
+
submit: () => R(),
|
|
251
|
+
reset: () => w(),
|
|
252
|
+
setSearchFormValues: K,
|
|
253
|
+
getSearchFormValues: $,
|
|
254
|
+
dataSource: d(() => l(C).records)
|
|
255
|
+
}), (e, t) => (i(), m("div", {
|
|
256
|
+
class: F(q.value)
|
|
257
|
+
}, [e.searchForm !== !1 && S.value.length > 0 ? (i(), m("div", {
|
|
242
258
|
key: 0,
|
|
243
|
-
class:
|
|
259
|
+
class: F(e.card ? l(y)("search-wrapper") : null),
|
|
244
260
|
style: x(e.searchFormWrapperStyle)
|
|
245
|
-
}, [s(
|
|
261
|
+
}, [s(l(de).SearchForm, f(e.searchForm || {}, {
|
|
246
262
|
ref_key: "formRef",
|
|
247
|
-
ref:
|
|
263
|
+
ref: h,
|
|
248
264
|
"custom-reset": "",
|
|
249
|
-
onSubmit:
|
|
250
|
-
onReset:
|
|
251
|
-
"submit-loading":
|
|
265
|
+
onSubmit: l(R),
|
|
266
|
+
onReset: l(w),
|
|
267
|
+
"submit-loading": l(c).loading
|
|
252
268
|
}), {
|
|
253
|
-
default:
|
|
269
|
+
default: g(() => [(i(!0), m(X, null, B(S.value, (a) => (i(), Y(Z(a.customRenderFormItem ? a.customRenderFormItem(a) : l(ue)[a.valueType || "text"]), f({
|
|
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
275
|
_: 1
|
|
260
|
-
}, 16, ["onSubmit", "onReset", "submit-loading"])], 6)) :
|
|
261
|
-
|
|
276
|
+
}, 16, ["onSubmit", "onReset", "submit-loading"])], 6)) : v("", !0), P("div", {
|
|
277
|
+
ref_key: "contentRef",
|
|
278
|
+
ref: D,
|
|
279
|
+
class: F([l(y)("table-wrapper"), e.card ? l(y)("table-wrapper-card") : null]),
|
|
262
280
|
style: x(e.tableWrapperStyle)
|
|
263
|
-
}, [
|
|
264
|
-
class:
|
|
265
|
-
},
|
|
266
|
-
onChange:
|
|
267
|
-
columns:
|
|
268
|
-
}),
|
|
269
|
-
headerCell:
|
|
281
|
+
}, [I(e.$slots, "title"), s(l(le), f({
|
|
282
|
+
class: l(V) === "admin" ? l(p)("table-admin") : l(p)("table")
|
|
283
|
+
}, M.value, {
|
|
284
|
+
onChange: l(j),
|
|
285
|
+
columns: b.value
|
|
286
|
+
}), ee({
|
|
287
|
+
headerCell: g(({
|
|
270
288
|
column: a,
|
|
271
289
|
title: o
|
|
272
|
-
}) => [a.tooltip ? (
|
|
290
|
+
}) => [a.tooltip ? (i(), m("span", Te, [P("span", null, ae(o), 1), s(l(ne), {
|
|
273
291
|
title: a.tooltip,
|
|
274
292
|
placement: "bottom"
|
|
275
293
|
}, {
|
|
276
|
-
default:
|
|
294
|
+
default: g(() => [s(l(fe), {
|
|
277
295
|
style: {
|
|
278
296
|
color: "#0070ff",
|
|
279
297
|
"padding-left": "4px"
|
|
280
298
|
}
|
|
281
299
|
})]),
|
|
282
300
|
_: 2
|
|
283
|
-
}, 1032, ["title"])])) :
|
|
301
|
+
}, 1032, ["title"])])) : v("", !0)]),
|
|
284
302
|
_: 2
|
|
285
|
-
}, [B(
|
|
303
|
+
}, [B(l(ce)(e.$slots, "title"), (a, o) => ({
|
|
286
304
|
name: o,
|
|
287
|
-
fn:
|
|
305
|
+
fn: g((n) => [I(e.$slots, o, te(oe(n || {})))])
|
|
288
306
|
}))]), 1040, ["class", "onChange", "columns"])], 6)], 2));
|
|
289
307
|
}
|
|
290
308
|
});
|
|
291
309
|
export {
|
|
292
|
-
|
|
310
|
+
_e as default
|
|
293
311
|
};
|
|
@@ -10516,6 +10516,10 @@ export declare const apTableRenderItemMap: {
|
|
|
10516
10516
|
request: {
|
|
10517
10517
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
10518
10518
|
};
|
|
10519
|
+
searchMode: {
|
|
10520
|
+
type: PropType<"filter" | "request">;
|
|
10521
|
+
default: string;
|
|
10522
|
+
};
|
|
10519
10523
|
}>> & {
|
|
10520
10524
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
10521
10525
|
}, {
|
|
@@ -10771,6 +10775,10 @@ export declare const apTableRenderItemMap: {
|
|
|
10771
10775
|
request: {
|
|
10772
10776
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
10773
10777
|
};
|
|
10778
|
+
searchMode: {
|
|
10779
|
+
type: PropType<"filter" | "request">;
|
|
10780
|
+
default: string;
|
|
10781
|
+
};
|
|
10774
10782
|
}>> & {
|
|
10775
10783
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
10776
10784
|
}, {
|
|
@@ -10790,6 +10798,7 @@ export declare const apTableRenderItemMap: {
|
|
|
10790
10798
|
defaultActiveFirstOption: boolean;
|
|
10791
10799
|
labelInValue: boolean;
|
|
10792
10800
|
emptyText: string;
|
|
10801
|
+
searchMode: "filter" | "request";
|
|
10793
10802
|
}, true, {}, {}, {
|
|
10794
10803
|
P: {};
|
|
10795
10804
|
B: {};
|
|
@@ -11045,6 +11054,10 @@ export declare const apTableRenderItemMap: {
|
|
|
11045
11054
|
request: {
|
|
11046
11055
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
11047
11056
|
};
|
|
11057
|
+
searchMode: {
|
|
11058
|
+
type: PropType<"filter" | "request">;
|
|
11059
|
+
default: string;
|
|
11060
|
+
};
|
|
11048
11061
|
}>> & {
|
|
11049
11062
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
11050
11063
|
}, {
|
|
@@ -11067,6 +11080,7 @@ export declare const apTableRenderItemMap: {
|
|
|
11067
11080
|
defaultActiveFirstOption: boolean;
|
|
11068
11081
|
labelInValue: boolean;
|
|
11069
11082
|
emptyText: string;
|
|
11083
|
+
searchMode: "filter" | "request";
|
|
11070
11084
|
}>;
|
|
11071
11085
|
__isFragment?: undefined;
|
|
11072
11086
|
__isTeleport?: undefined;
|
|
@@ -11319,6 +11333,10 @@ export declare const apTableRenderItemMap: {
|
|
|
11319
11333
|
request: {
|
|
11320
11334
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
11321
11335
|
};
|
|
11336
|
+
searchMode: {
|
|
11337
|
+
type: PropType<"filter" | "request">;
|
|
11338
|
+
default: string;
|
|
11339
|
+
};
|
|
11322
11340
|
}>> & {
|
|
11323
11341
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
11324
11342
|
}, {
|
|
@@ -11343,6 +11361,7 @@ export declare const apTableRenderItemMap: {
|
|
|
11343
11361
|
defaultActiveFirstOption: boolean;
|
|
11344
11362
|
labelInValue: boolean;
|
|
11345
11363
|
emptyText: string;
|
|
11364
|
+
searchMode: "filter" | "request";
|
|
11346
11365
|
}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
11347
11366
|
$slots: Readonly<{
|
|
11348
11367
|
notFoundContent: any;
|
|
@@ -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
|
+
};
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -89,6 +89,10 @@ export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'v
|
|
|
89
89
|
multiple?: boolean;
|
|
90
90
|
value?: SelectProps['value'];
|
|
91
91
|
'onUpdate:value'?: SelectProps['onUpdate:value'];
|
|
92
|
+
/**
|
|
93
|
+
* 如果设置showSearch=true,此时设置searchMode=filter将进行前端筛选,设置searchMode=request将会走后端筛选
|
|
94
|
+
*/
|
|
95
|
+
searchMode?: 'filter' | 'request';
|
|
92
96
|
};
|
|
93
97
|
export type ApFieldSelectSlots = {
|
|
94
98
|
focus: () => void;
|
|
@@ -34,6 +34,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
34
34
|
defaultActiveFirstOption: undefined;
|
|
35
35
|
labelInValue: undefined;
|
|
36
36
|
multiple: undefined;
|
|
37
|
+
searchMode: string;
|
|
37
38
|
}>, {
|
|
38
39
|
focus: typeof focus;
|
|
39
40
|
blur: typeof blur;
|
|
@@ -56,6 +57,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
56
57
|
defaultActiveFirstOption: undefined;
|
|
57
58
|
labelInValue: undefined;
|
|
58
59
|
multiple: undefined;
|
|
60
|
+
searchMode: string;
|
|
59
61
|
}>>> & {
|
|
60
62
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
61
63
|
}, {
|
|
@@ -75,6 +77,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
75
77
|
defaultActiveFirstOption: boolean;
|
|
76
78
|
labelInValue: boolean;
|
|
77
79
|
emptyText: string;
|
|
80
|
+
searchMode: "filter" | "request";
|
|
78
81
|
}, {}>, Readonly<ApFieldSelectSlots> & ApFieldSelectSlots>;
|
|
79
82
|
export default _default;
|
|
80
83
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("lodash-unified"),p=require("ant-design-vue");require("../../hooks/index.js");const F=require("../../utils/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("lodash-unified"),p=require("ant-design-vue");require("../../hooks/index.js");const F=require("../../utils/index.js"),q=require("../../hooks/useControllableValue.js"),V={key:0},I=e.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},defaultValue:{},notFoundContent:{},suffixIcon:{},itemIcon:{},size:{},bordered:{type:Boolean,default:void 0},transitionName:{},choiceTransitionName:{},popupClassName:{},dropdownClassName:{},placement:{},status:{},children:{},listHeight:{},onMouseenter:{},onMouseleave:{},tabindex:{},onClick:{},onFocus:{},onBlur:{},onChange:{},onKeydown:{},onKeyup:{},onMousedown:{},onSelect:{},open:{type:Boolean,default:void 0},animation:{},direction:{},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},autofocus:{type:Boolean,default:void 0},getPopupContainer:{},virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{},options:{},showAction:{},placeholder:{},onDeselect:{},loading:{type:Boolean,default:void 0},clearIcon:{},allowClear:{type:Boolean,default:!0},fieldNames:{},dropdownStyle:{},dropdownRender:{},dropdownAlign:{},showSearch:{type:Boolean,default:void 0},searchValue:{},onInputKeyDown:{},removeIcon:{},maxTagCount:{},maxTagTextLength:{},maxTagPlaceholder:{},tokenSeparators:{},tagRender:{},optionLabelRender:{},onClear:{},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{},showArrow:{type:Boolean,default:void 0},onPopupScroll:{},menuItemSelectedIcon:{},listItemHeight:{},inputValue:{},autoClearSearchValue:{type:Boolean,default:void 0},filterOption:{},filterSort:{},optionFilterProp:{},optionLabelProp:{},defaultActiveFirstOption:{type:Boolean,default:void 0},labelInValue:{type:Boolean,default:void 0},emptyText:{default:"-"},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"}},emits:["update:value"],setup(v,{expose:m,emit:h}){let r=0;const y=(t,n)=>typeof(n==null?void 0:n.label)=="string"&&n.label.indexOf(t)>-1,g=i.debounce(t=>{if(!i.isFunction(o.request))return;r+=1;const n=r;u.value=[],a.value=!0,o.request(t).then(l=>{r===n&&(u.value=l)}).finally(()=>{a.value=!1})},300),o=v,u=e.ref((o==null?void 0:o.options)||[]),s=e.ref(),a=e.ref((o==null?void 0:o.loading)||!1),w=h;e.onMounted(()=>{if(i.isFunction(o.request)){a.value=!0,r+=1;const t=r;o.request().then(n=>{t===r&&(u.value=n)}).finally(()=>{a.value=!1})}});const{value:f,updateValue:S}=q.useControllableValue(o,w),B=e.computed(()=>{const t=e.unref(f);if(!t)return o.emptyText;if(i.isArray(t))return t.map(l=>{var d;return(d=e.unref(u).find(c=>c.value===l))==null?void 0:d.label}).filter(Boolean).join("、")||o.emptyText;const n=e.unref(u).find(l=>l.value===t);return(n==null?void 0:n.label)||o.emptyText}),C=e.computed(()=>{const t=!!(o!=null&&o.showSearch),n=o.searchMode;let l={};return t&&(l=n==="request"?{showArrow:!1,defaultActiveFirstOption:!1,onSearch:g,notFoundContent:a.value?void 0:null}:{showArrow:!0,filterOption:i.isNil(o==null?void 0:o.filterOption)?y:o==null?void 0:o.filterOption}),{...F.omitUndefined(i.omit(o,["mode","value","onUpdate:value","onSearch","request","searchMode"])),...l}});function b(){var t;(t=s.value)==null||t.focus()}function x(){var t;(t=s.value)==null||t.blur()}return m({focus:b,blur:x}),(t,n)=>t.mode==="read"?(e.openBlock(),e.createElementBlock("span",V,e.toDisplayString(B.value),1)):(e.openBlock(),e.createBlock(e.unref(p.Select),e.mergeProps({key:1,"allow-clear":"",ref_key:"selectRef",ref:s},C.value,{mode:t.multiple?"multiple":void 0,value:e.unref(f),"onUpdate:value":e.unref(S),options:u.value,loading:a.value}),e.createSlots({_:2},[e.renderList(t.$slots,(l,d)=>({name:d,fn:e.withCtx(c=>[e.renderSlot(t.$slots,d,e.normalizeProps(e.guardReactiveProps(c||{})))])})),a.value?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(p.Spin),{size:"small"})]),key:"0"}:void 0]),1040,["mode","value","onUpdate:value","options","loading"]))}});exports.default=I;
|
|
@@ -47,6 +47,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
47
47
|
searchForm: undefined;
|
|
48
48
|
loading: undefined;
|
|
49
49
|
manual: boolean;
|
|
50
|
+
adaptive: boolean;
|
|
50
51
|
}>, {
|
|
51
52
|
submit: () => void;
|
|
52
53
|
reset: () => void;
|
|
@@ -71,6 +72,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
71
72
|
searchForm: undefined;
|
|
72
73
|
loading: undefined;
|
|
73
74
|
manual: boolean;
|
|
75
|
+
adaptive: boolean;
|
|
74
76
|
}>>>, {
|
|
75
77
|
loading: boolean | Partial< ExtractPropTypes<{
|
|
76
78
|
prefixCls: StringConstructor;
|
|
@@ -164,6 +166,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
164
166
|
childrenColumnName: string;
|
|
165
167
|
card: boolean;
|
|
166
168
|
searchForm: false | ApFormSearchFormProps;
|
|
169
|
+
adaptive: boolean;
|
|
167
170
|
}, {}>, Partial<Record<NonNullable<keyof ApTableSlots>, (_: any) => any>> & {
|
|
168
171
|
title?(_: {}): any;
|
|
169
172
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y=require("ant-design-vue"),D=require("../ap-form/index.js"),c=require("./constants.js");require("../config-provider/index.js");const j=require("./hooks/use-table-paging.js"),F=require("lodash-unified");require("./style/ap-table.css");const M=require("@ant-design/icons-vue"),u=require("./utils.js"),W=require("./hooks/use-table-content-height.js"),A=require("../config-provider/hooks/use-locale.js"),H=require("../config-provider/hooks/use-namespace.js"),K=require("../config-provider/hooks/use-global-config.js"),$={key:0},G=e.defineComponent({name:"ApTable",__name:"ap-table",props:{dropdownPrefixCls:{},loading:{type:[Boolean,Object],default:void 0},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},card:{type:Boolean,default:!1},params:{},searchFormRender:{},request:{},onLoad:{},defaultData:{},onLoadingChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},manual:{type:Boolean,default:!1},size:{default:"middle"},adaptive:{type:Boolean,default:!1}},setup(R,{expose:w}){const o=R,{t:B}=A.useLocale(),{e:p,b:s}=H.useNamespace("ap-table"),T=K.useGlobalConfig("uiMode"),{height:x,contentRef:v}=W.default(),f=e.computed(()=>{var n;let a=((n=o.columns)==null?void 0:n.filter(t=>!t.hideInTable))||[];return a=a.map(t=>({...u.apColumnToColumn(t),customRender({value:r,...l}){let d;if(t.customRender)d=t.customRender({value:r,...l,column:t});else{const S=u.getTableRenderType(t),L=c.apTableRenderItemMap[S],_=u.getTableRenderProps(t,{value:r,...l});d=e.createVNode(L,e.mergeProps(_,{mode:"read"}),null)}return E(t,r,d)}})),a}),b=e.computed(()=>{var a,n,t;return((t=(n=(a=o.columns)==null?void 0:a.filter(r=>!r.hideInSearch&&r.dataIndex&&(r.valueType||r.customRenderFormItem)&&!c.noRenderAsFormItemValueList.includes(r.valueType)))==null?void 0:n.sort((r,l)=>{let d=u.getColumnOrder(r.order);return u.getColumnOrder(l.order)-d}))==null?void 0:t.map(r=>{const l=u.updateFormProps(r,u.getFieldProps(r.fieldProps));return{...r,fieldProps:{label:r.title,name:r.dataIndex,...l||{},placeholder:u.getPlaceholder(B,r.valueType,l==null?void 0:l.placeholder)}}}))||[]}),P=e.computed(()=>e.unref(f).filter(a=>a.sorter===!0).map(a=>a.dataIndex)),k=e.computed(()=>e.unref(f).filter(a=>a.filters&&!a.onFilter).map(a=>a.dataIndex)),{formRef:m,submit:h,reset:C,tableProps:i,handleTableChange:I,data:g}=j.useTablePaging({async request(a){var t,r;const n=await((t=o.request)==null?void 0:t.call(o,a));return(r=o.onLoad)==null||r.call(o,(n==null?void 0:n.data)||[]),{data:(n==null?void 0:n.data)||[],total:(n==null?void 0:n.total)||0}},filterFields:e.unref(k),sortFields:e.unref(P),defaultParams:o.params,defaultData:o.defaultData,manual:o.manual,defaultCurrent:o.pagination?o.pagination.defaultCurrent:void 0,defaultPageSize:o.pagination?o.pagination.defaultPageSize:void 0,formatParams:o.beforeSearchSubmit}),q=e.computed(()=>{if(o.scroll)return o.scroll;if(o.adaptive&&g.value.total>0)return{y:e.unref(x)}}),V=e.computed(()=>({...o,...e.unref(i),loading:F.isUndefined(o.loading)?e.unref(i).loading:o.loading,pagination:o.pagination===!1?!1:e.unref(i).pagination,scroll:e.unref(q)})),N=e.computed(()=>[o.card?null:s("wrapper"),o.adaptive?s("adaptive"):null].filter(Boolean));function E(a,n,t){return c.noRenderAsFormItemValueList.includes(a.valueType)?t:a.copyable||a.ellipsis?e.createVNode(y.Typography.Text,{copyable:a.copyable?{text:n,tooltip:!1}:!1,ellipsis:a.ellipsis?{tooltip:n}:!1,content:t},null):t}e.watch(()=>e.unref(g).loading,a=>{var n;(n=o.onLoadingChange)==null||n.call(o,a)});function O(a){var n,t,r;(r=(t=(n=m.value)==null?void 0:n.apForm)==null?void 0:t.setFieldsValue)==null||r.call(t,a)}function z(){var a,n,t;return(t=(n=(a=m.value)==null?void 0:a.apForm)==null?void 0:n.getFieldsValue)==null?void 0:t.call(n,!0)}return w({submit:()=>h(),reset:()=>C(),setSearchFormValues:O,getSearchFormValues:z,dataSource:e.computed(()=>e.unref(g).records)}),(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(N.value)},[a.searchForm!==!1&&b.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.card?e.unref(p)("search-wrapper"):null),style:e.normalizeStyle(a.searchFormWrapperStyle)},[e.createVNode(e.unref(D.ApForm).SearchForm,e.mergeProps(a.searchForm||{},{ref_key:"formRef",ref:m,"custom-reset":"",onSubmit:e.unref(h),onReset:e.unref(C),"submit-loading":e.unref(i).loading}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,t=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.customRenderFormItem?t.customRenderFormItem(t):e.unref(c.apTableFormItemMap)[t.valueType||"text"]),e.mergeProps({key:t.dataIndex,ref_for:!0},t.fieldProps||{},{span:t.span}),null,16,["span"]))),128))]),_:1},16,["onSubmit","onReset","submit-loading"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"contentRef",ref:v,class:e.normalizeClass([e.unref(p)("table-wrapper"),a.card?e.unref(p)("table-wrapper-card"):null]),style:e.normalizeStyle(a.tableWrapperStyle)},[e.renderSlot(a.$slots,"title"),e.createVNode(e.unref(y.Table),e.mergeProps({class:e.unref(T)==="admin"?e.unref(s)("table-admin"):e.unref(s)("table")},V.value,{onChange:e.unref(I),columns:f.value}),e.createSlots({headerCell:e.withCtx(({column:t,title:r})=>[t.tooltip?(e.openBlock(),e.createElementBlock("span",$,[e.createElementVNode("span",null,e.toDisplayString(r),1),e.createVNode(e.unref(y.Tooltip),{title:t.tooltip,placement:"bottom"},{default:e.withCtx(()=>[e.createVNode(e.unref(M.QuestionCircleOutlined),{style:{color:"#0070ff","padding-left":"4px"}})]),_:2},1032,["title"])])):e.createCommentVNode("",!0)]),_:2},[e.renderList(e.unref(F.omit)(a.$slots,"title"),(t,r)=>({name:r,fn:e.withCtx(l=>[e.renderSlot(a.$slots,r,e.normalizeProps(e.guardReactiveProps(l||{})))])}))]),1040,["class","onChange","columns"])],6)],2))}});exports.default=G;
|
|
@@ -10516,6 +10516,10 @@ export declare const apTableRenderItemMap: {
|
|
|
10516
10516
|
request: {
|
|
10517
10517
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
10518
10518
|
};
|
|
10519
|
+
searchMode: {
|
|
10520
|
+
type: PropType<"filter" | "request">;
|
|
10521
|
+
default: string;
|
|
10522
|
+
};
|
|
10519
10523
|
}>> & {
|
|
10520
10524
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
10521
10525
|
}, {
|
|
@@ -10771,6 +10775,10 @@ export declare const apTableRenderItemMap: {
|
|
|
10771
10775
|
request: {
|
|
10772
10776
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
10773
10777
|
};
|
|
10778
|
+
searchMode: {
|
|
10779
|
+
type: PropType<"filter" | "request">;
|
|
10780
|
+
default: string;
|
|
10781
|
+
};
|
|
10774
10782
|
}>> & {
|
|
10775
10783
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
10776
10784
|
}, {
|
|
@@ -10790,6 +10798,7 @@ export declare const apTableRenderItemMap: {
|
|
|
10790
10798
|
defaultActiveFirstOption: boolean;
|
|
10791
10799
|
labelInValue: boolean;
|
|
10792
10800
|
emptyText: string;
|
|
10801
|
+
searchMode: "filter" | "request";
|
|
10793
10802
|
}, true, {}, {}, {
|
|
10794
10803
|
P: {};
|
|
10795
10804
|
B: {};
|
|
@@ -11045,6 +11054,10 @@ export declare const apTableRenderItemMap: {
|
|
|
11045
11054
|
request: {
|
|
11046
11055
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
11047
11056
|
};
|
|
11057
|
+
searchMode: {
|
|
11058
|
+
type: PropType<"filter" | "request">;
|
|
11059
|
+
default: string;
|
|
11060
|
+
};
|
|
11048
11061
|
}>> & {
|
|
11049
11062
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
11050
11063
|
}, {
|
|
@@ -11067,6 +11080,7 @@ export declare const apTableRenderItemMap: {
|
|
|
11067
11080
|
defaultActiveFirstOption: boolean;
|
|
11068
11081
|
labelInValue: boolean;
|
|
11069
11082
|
emptyText: string;
|
|
11083
|
+
searchMode: "filter" | "request";
|
|
11070
11084
|
}>;
|
|
11071
11085
|
__isFragment?: undefined;
|
|
11072
11086
|
__isTeleport?: undefined;
|
|
@@ -11319,6 +11333,10 @@ export declare const apTableRenderItemMap: {
|
|
|
11319
11333
|
request: {
|
|
11320
11334
|
type: PropType<(value?: string | undefined) => Promise< DefaultOptionType[] | undefined>>;
|
|
11321
11335
|
};
|
|
11336
|
+
searchMode: {
|
|
11337
|
+
type: PropType<"filter" | "request">;
|
|
11338
|
+
default: string;
|
|
11339
|
+
};
|
|
11322
11340
|
}>> & {
|
|
11323
11341
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
11324
11342
|
}, {
|
|
@@ -11343,6 +11361,7 @@ export declare const apTableRenderItemMap: {
|
|
|
11343
11361
|
defaultActiveFirstOption: boolean;
|
|
11344
11362
|
labelInValue: boolean;
|
|
11345
11363
|
emptyText: string;
|
|
11364
|
+
searchMode: "filter" | "request";
|
|
11346
11365
|
}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
11347
11366
|
$slots: Readonly<{
|
|
11348
11367
|
notFoundContent: any;
|
|
@@ -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 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("@vueuse/core"),r=require("vue");function g(t){if(!t)return 0;const e=parseFloat(t);return Number.isNaN(e)?0:e}function s(t){if(!t)return 0;const e=getComputedStyle(t);return t.clientHeight+g(e.marginTop)+g(e.marginBottom)}const p=t=>{const e=r.ref(),{height:f}=m.useElementSize(e),u=r.ref();let a=!1;const h=r.computed(()=>{var o,c,l;const i=((c=(o=e.value)==null?void 0:o.querySelector(".ant-table-header"))==null?void 0:c.clientHeight)||47,n=(l=e.value)==null?void 0:l.querySelector(".ant-pagination"),d=n?s(n):r.unref(u);return n&&(a=!0),Math.ceil(r.unref(f)-i-(d||0)-((t==null?void 0:t.offset)||0))});return r.onUpdated(()=>{var n;if(a)return;const i=(n=e.value)==null?void 0:n.querySelector(".ant-pagination");if(!i){u.value=0;return}u.value=s(i),a=!0}),{contentRef:e,height:h}};exports.default=p;
|
|
@@ -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;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"files": [
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"sortablejs": "^1.15.2",
|
|
61
61
|
"@aplus-frontend/oss": "^1.0.11",
|
|
62
62
|
"mime": "^4.0.3",
|
|
63
|
-
"@aplus-frontend/
|
|
64
|
-
"@aplus-frontend/
|
|
63
|
+
"@aplus-frontend/hooks": "1.0.4",
|
|
64
|
+
"@aplus-frontend/utils": "1.0.22"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"ant-design-vue": "^4.2.1",
|