@aplus-frontend/ui 0.1.22 → 0.1.23
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-table/ap-table.vue.mjs +202 -198
- package/es/src/ap-table/interface.d.ts +1 -1
- package/es/src/ap-table/style/ap-table.css +3 -0
- package/es/src/business/ap-label/ApLabel.mjs +8 -7
- package/es/src/editable-table/form-item.vue.mjs +48 -48
- package/es/src/editable-table/hooks/use-get-columns.mjs +64 -56
- package/es/src/editable-table/interface.d.ts +2 -2
- package/es/src/editable-table/utils.mjs +17 -17
- package/es/src/theme/ap-table/ap-table.css +3 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +1 -1
- package/lib/src/ap-table/style/ap-table.css +3 -0
- package/lib/src/business/ap-label/ApLabel.js +1 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/interface.d.ts +2 -2
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/theme/ap-table/ap-table.css +3 -0
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Typography as
|
|
3
|
-
import { useToken as
|
|
4
|
-
import { ApForm as
|
|
5
|
-
import { noRenderAsFormItemValueList as
|
|
1
|
+
import { defineComponent as pe, useSlots as fe, ref as me, unref as l, createVNode as g, Fragment as j, watchEffect as ge, computed as d, watch as ye, openBlock as y, createElementBlock as v, normalizeClass as B, normalizeStyle as A, mergeProps as h, createSlots as W, withCtx as b, renderList as H, createBlock as he, resolveDynamicComponent as be, renderSlot as S, createCommentVNode as Se, createElementVNode as we, normalizeProps as Re, guardReactiveProps as Ce } from "vue";
|
|
2
|
+
import { Typography as Te, Table as Fe } from "ant-design-vue";
|
|
3
|
+
import { useToken as xe } from "ant-design-vue/es/theme/internal";
|
|
4
|
+
import { ApForm as ve } from "../ap-form/index.mjs";
|
|
5
|
+
import { noRenderAsFormItemValueList as $ } from "./constants.mjs";
|
|
6
6
|
import "../config-provider/index.mjs";
|
|
7
|
-
import { useTablePaging as
|
|
8
|
-
import { omit as
|
|
7
|
+
import { useTablePaging as Be } from "./hooks/use-table-paging.mjs";
|
|
8
|
+
import { omit as q, isUndefined as i, isBoolean as Pe } from "lodash-unified";
|
|
9
9
|
import "./style/ap-table.css";
|
|
10
|
-
import { apColumnToColumn as
|
|
11
|
-
import
|
|
12
|
-
import { getRawDisplayValue as
|
|
13
|
-
import
|
|
14
|
-
import { isDef as
|
|
15
|
-
import { useLocale as
|
|
16
|
-
import { useNamespace as
|
|
17
|
-
import { useGlobalConfig as
|
|
18
|
-
const
|
|
10
|
+
import { apColumnToColumn as Ie, getTableTitle as ke, getTableRenderType as ze, getTableRenderProps as Ne, getTableCellRenderNode as Le, getColumnOrder as U, updateFormProps as Ee, getFieldProps as Ve, getPlaceholder as Ke, getSearchFormItemRenderNode as Oe, objectToString as De } from "./utils.mjs";
|
|
11
|
+
import je from "./hooks/use-table-content-height.mjs";
|
|
12
|
+
import { getRawDisplayValue as Ae } from "../editable-table/utils.mjs";
|
|
13
|
+
import We from "./hooks/use-table-row-selection.mjs";
|
|
14
|
+
import { isDef as He } from "../utils/index.mjs";
|
|
15
|
+
import { useLocale as $e } from "../config-provider/hooks/use-locale.mjs";
|
|
16
|
+
import { useNamespace as qe } from "../config-provider/hooks/use-namespace.mjs";
|
|
17
|
+
import { useGlobalConfig as Ue } from "../config-provider/hooks/use-global-config.mjs";
|
|
18
|
+
const ua = /* @__PURE__ */ pe({
|
|
19
19
|
name: "ApTable",
|
|
20
20
|
__name: "ap-table",
|
|
21
21
|
props: {
|
|
@@ -135,240 +135,244 @@ const sa = /* @__PURE__ */ ie({
|
|
|
135
135
|
default: !1
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
-
setup(
|
|
139
|
-
expose:
|
|
138
|
+
setup(G, {
|
|
139
|
+
expose: M
|
|
140
140
|
}) {
|
|
141
|
-
const
|
|
142
|
-
let
|
|
143
|
-
const
|
|
144
|
-
t:
|
|
145
|
-
} =
|
|
146
|
-
e:
|
|
147
|
-
b:
|
|
148
|
-
} =
|
|
149
|
-
height:
|
|
150
|
-
contentRef:
|
|
151
|
-
} =
|
|
141
|
+
const e = G;
|
|
142
|
+
let P = 0;
|
|
143
|
+
const w = fe(), [, J] = xe(), {
|
|
144
|
+
t: Q
|
|
145
|
+
} = $e(), {
|
|
146
|
+
e: R,
|
|
147
|
+
b: p
|
|
148
|
+
} = qe("ap-table"), I = Ue("valueTypeMap"), {
|
|
149
|
+
height: X,
|
|
150
|
+
contentRef: Y
|
|
151
|
+
} = je(), c = me([]), Z = () => {
|
|
152
152
|
var t;
|
|
153
|
-
let
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
153
|
+
let a = ((t = e.columns) == null ? void 0 : t.filter((r) => !r.hideInTable)) || [];
|
|
154
|
+
function o(r) {
|
|
155
|
+
return r.map((n) => ({
|
|
156
|
+
resizable: He(n.resizable) ? n.resizable : e.columnResizable,
|
|
157
|
+
...q(Ie(n), ["ellipsis"]),
|
|
158
|
+
title: ke(n, w.headerCell, l(J).colorPrimary),
|
|
159
|
+
customRender({
|
|
160
|
+
value: s,
|
|
161
|
+
...u
|
|
162
|
+
}) {
|
|
163
|
+
var O, D;
|
|
164
|
+
const V = ze(n), ue = Ne({
|
|
165
|
+
...n,
|
|
166
|
+
valueType: V
|
|
167
|
+
}, {
|
|
168
|
+
value: s,
|
|
169
|
+
...u
|
|
170
|
+
}), ie = Le(V, ue, u.record, l(I)), K = ((O = n.renderText) == null ? void 0 : O.call(n, {
|
|
171
|
+
value: s,
|
|
172
|
+
...u
|
|
173
|
+
})) || s, ce = n.renderText ? g(j, null, [(D = n.renderText) == null ? void 0 : D.call(n, {
|
|
174
|
+
value: s,
|
|
175
|
+
...u
|
|
176
|
+
})]) : ie;
|
|
177
|
+
let x = ne(n, K, ce);
|
|
178
|
+
return n.customRender && (x = n.customRender({
|
|
179
|
+
value: s,
|
|
180
|
+
...u,
|
|
181
|
+
column: n,
|
|
182
|
+
originalNode: x,
|
|
183
|
+
originalText: K
|
|
184
|
+
})), x;
|
|
185
|
+
},
|
|
186
|
+
children: o(n.children || [])
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
return o(a);
|
|
186
190
|
};
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
ge(() => {
|
|
192
|
+
c.value = Z();
|
|
189
193
|
});
|
|
190
|
-
const
|
|
191
|
-
var
|
|
192
|
-
return
|
|
193
|
-
let
|
|
194
|
-
return
|
|
195
|
-
})) == null ? void 0 :
|
|
196
|
-
const n =
|
|
194
|
+
const k = d(() => {
|
|
195
|
+
var a, o, t;
|
|
196
|
+
return P++, ((t = (o = (a = e.columns) == null ? void 0 : a.filter((r) => !r.hideInSearch && r.dataIndex && (r.valueType || r.customRenderFormItem) && !$.includes(r.valueType))) == null ? void 0 : o.sort((r, n) => {
|
|
197
|
+
let s = U(r.order);
|
|
198
|
+
return U(n.order) - s;
|
|
199
|
+
})) == null ? void 0 : t.map((r) => {
|
|
200
|
+
const n = Ee(r, Ve(r.fieldProps, {})), s = {
|
|
197
201
|
...r,
|
|
198
202
|
fieldProps: {
|
|
199
203
|
label: r.title,
|
|
200
204
|
name: r.dataIndex,
|
|
201
205
|
...n || {},
|
|
202
206
|
// 格式化placeholder
|
|
203
|
-
placeholder:
|
|
204
|
-
_signal:
|
|
207
|
+
placeholder: Ke(Q, r.valueType, n == null ? void 0 : n.placeholder),
|
|
208
|
+
_signal: P
|
|
205
209
|
},
|
|
206
210
|
renderNode: void 0
|
|
207
211
|
};
|
|
208
|
-
return
|
|
212
|
+
return s.renderNode = Oe(s, l(I)), s;
|
|
209
213
|
})) || [];
|
|
210
|
-
}),
|
|
211
|
-
rowSelection:
|
|
212
|
-
selectedRows:
|
|
213
|
-
...
|
|
214
|
-
} =
|
|
215
|
-
...
|
|
216
|
-
rowKey:
|
|
217
|
-
dataSource:
|
|
214
|
+
}), _ = d(() => l(c).filter((a) => a.sorter === !0).map((a) => a.dataIndex).filter(Boolean)), ee = d(() => l(c).filter((a) => a.filters && !a.onFilter).map((a) => a.dataIndex).filter(Boolean)), ae = d(() => i(e.dataSource) ? m.value.records : e.dataSource), {
|
|
215
|
+
rowSelection: C,
|
|
216
|
+
selectedRows: z,
|
|
217
|
+
...T
|
|
218
|
+
} = We({
|
|
219
|
+
...e.rowSelection === !0 ? {} : e.rowSelection,
|
|
220
|
+
rowKey: e.rowKey,
|
|
221
|
+
dataSource: ae
|
|
218
222
|
}), {
|
|
219
|
-
formRef:
|
|
220
|
-
submit:
|
|
221
|
-
reset:
|
|
222
|
-
tableProps:
|
|
223
|
-
handleTableChange:
|
|
224
|
-
data:
|
|
225
|
-
} =
|
|
226
|
-
async request(
|
|
227
|
-
var
|
|
228
|
-
!
|
|
229
|
-
const
|
|
230
|
-
return (r =
|
|
231
|
-
data: (
|
|
232
|
-
total: (
|
|
223
|
+
formRef: F,
|
|
224
|
+
submit: N,
|
|
225
|
+
reset: L,
|
|
226
|
+
tableProps: f,
|
|
227
|
+
handleTableChange: oe,
|
|
228
|
+
data: m
|
|
229
|
+
} = Be({
|
|
230
|
+
async request(a) {
|
|
231
|
+
var t, r;
|
|
232
|
+
!C.value.preserveSelectedRowKeys && i(e.dataSource) && T.clearAll();
|
|
233
|
+
const o = await ((t = e.request) == null ? void 0 : t.call(e, a));
|
|
234
|
+
return (r = e.onLoad) == null || r.call(e, (o == null ? void 0 : o.data) || []), {
|
|
235
|
+
data: (o == null ? void 0 : o.data) || [],
|
|
236
|
+
total: (o == null ? void 0 : o.total) || 0
|
|
233
237
|
};
|
|
234
238
|
},
|
|
235
|
-
filterFields:
|
|
236
|
-
sortFields:
|
|
237
|
-
defaultParams:
|
|
238
|
-
defaultData:
|
|
239
|
-
manual:
|
|
240
|
-
defaultCurrent:
|
|
241
|
-
defaultPageSize:
|
|
242
|
-
formatParams:
|
|
243
|
-
showLessItems:
|
|
244
|
-
showTotal:
|
|
245
|
-
}),
|
|
246
|
-
var
|
|
247
|
-
if (
|
|
239
|
+
filterFields: ee,
|
|
240
|
+
sortFields: _,
|
|
241
|
+
defaultParams: e.params,
|
|
242
|
+
defaultData: e.defaultData,
|
|
243
|
+
manual: e.manual,
|
|
244
|
+
defaultCurrent: e.pagination ? e.pagination.defaultCurrent : void 0,
|
|
245
|
+
defaultPageSize: e.pagination ? e.pagination.defaultPageSize : void 0,
|
|
246
|
+
formatParams: e.beforeSearchSubmit,
|
|
247
|
+
showLessItems: e.pagination ? e.pagination.showLessItems : void 0,
|
|
248
|
+
showTotal: e.pagination ? e.pagination.showTotal : void 0
|
|
249
|
+
}), re = d(() => {
|
|
250
|
+
var o, t;
|
|
251
|
+
if (e.adaptive && (m.value.total > 0 || ((o = e.dataSource) == null ? void 0 : o.length)))
|
|
248
252
|
return {
|
|
249
|
-
y: l(
|
|
250
|
-
x: ((
|
|
253
|
+
y: l(X),
|
|
254
|
+
x: ((t = e.scroll) == null ? void 0 : t.x) || "100%"
|
|
251
255
|
};
|
|
252
|
-
if (
|
|
253
|
-
return
|
|
254
|
-
}), te =
|
|
255
|
-
var
|
|
256
|
-
if (
|
|
257
|
-
return
|
|
258
|
-
if ((
|
|
256
|
+
if (e.scroll)
|
|
257
|
+
return e.scroll;
|
|
258
|
+
}), te = d(() => {
|
|
259
|
+
var a;
|
|
260
|
+
if (e.tableLayout)
|
|
261
|
+
return e.tableLayout;
|
|
262
|
+
if ((a = e.columns) != null && a.some((o) => o.ellipsis))
|
|
259
263
|
return "fixed";
|
|
260
|
-
}),
|
|
264
|
+
}), E = d(() => {
|
|
261
265
|
var r;
|
|
262
|
-
const
|
|
263
|
-
...e,
|
|
264
|
-
dataSource: a.dataSource,
|
|
265
|
-
onChange: a.onChange
|
|
266
|
-
}, o = l(R);
|
|
267
|
-
return {
|
|
266
|
+
const a = l(f), o = i(e.dataSource) ? a : {
|
|
268
267
|
...a,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
dataSource: e.dataSource,
|
|
269
|
+
onChange: e.onChange
|
|
270
|
+
}, t = l(C);
|
|
271
|
+
return {
|
|
272
|
+
...e,
|
|
273
|
+
...o,
|
|
274
|
+
rowSelection: e.rowSelection === !0 || ((r = e.rowSelection) == null ? void 0 : r.mode) === "internal" ? {
|
|
275
|
+
...t,
|
|
272
276
|
// tips 如果是前端分页,则默认会走缓存
|
|
273
|
-
preserveSelectedRowKeys:
|
|
274
|
-
} :
|
|
275
|
-
loading:
|
|
276
|
-
pagination:
|
|
277
|
-
scroll: l(
|
|
277
|
+
preserveSelectedRowKeys: i(e.dataSource) ? t.preserveSelectedRowKeys : !0
|
|
278
|
+
} : e.rowSelection,
|
|
279
|
+
loading: i(e.loading) ? l(f).loading : e.loading,
|
|
280
|
+
pagination: e.pagination === !1 ? !1 : l(f).pagination,
|
|
281
|
+
scroll: l(re)
|
|
278
282
|
};
|
|
279
|
-
}),
|
|
280
|
-
function
|
|
281
|
-
if (
|
|
282
|
-
return
|
|
283
|
-
const r =
|
|
284
|
-
return
|
|
285
|
-
copyable:
|
|
283
|
+
}), le = d(() => [p(), e.card ? null : p("wrapper"), e.adaptive ? p("adaptive") : null].filter(Boolean));
|
|
284
|
+
function ne(a, o, t) {
|
|
285
|
+
if ($.includes(a.valueType))
|
|
286
|
+
return t;
|
|
287
|
+
const r = De(o);
|
|
288
|
+
return a.copyable || a.ellipsis ? g(Te.Paragraph, {
|
|
289
|
+
copyable: a.copyable ? {
|
|
286
290
|
text: r,
|
|
287
291
|
tooltip: !1
|
|
288
292
|
} : !1,
|
|
289
|
-
ellipsis:
|
|
293
|
+
ellipsis: a.ellipsis ? Pe(a.ellipsis) ? {
|
|
290
294
|
tooltip: r
|
|
291
295
|
} : {
|
|
292
|
-
...
|
|
296
|
+
...a.ellipsis,
|
|
293
297
|
tooltip: r
|
|
294
298
|
} : !1,
|
|
295
|
-
content:
|
|
296
|
-
}, null) :
|
|
299
|
+
content: a.ellipsis ? Ae(a, o) : t
|
|
300
|
+
}, null) : t;
|
|
297
301
|
}
|
|
298
|
-
|
|
299
|
-
var
|
|
300
|
-
(
|
|
302
|
+
ye(() => l(m).loading, (a) => {
|
|
303
|
+
var o;
|
|
304
|
+
(o = e.onLoadingChange) == null || o.call(e, a);
|
|
301
305
|
});
|
|
302
|
-
function
|
|
303
|
-
var
|
|
304
|
-
(r = (
|
|
306
|
+
function se(a) {
|
|
307
|
+
var o, t, r;
|
|
308
|
+
(r = (t = (o = F.value) == null ? void 0 : o.apForm) == null ? void 0 : t.setFieldsValue) == null || r.call(t, a);
|
|
305
309
|
}
|
|
306
|
-
function
|
|
307
|
-
var
|
|
308
|
-
return (
|
|
310
|
+
function de() {
|
|
311
|
+
var a, o, t;
|
|
312
|
+
return (t = (o = (a = F.value) == null ? void 0 : a.apForm) == null ? void 0 : o.getFieldsValue) == null ? void 0 : t.call(o, !0);
|
|
309
313
|
}
|
|
310
|
-
return
|
|
311
|
-
submit: () =>
|
|
312
|
-
reset: () =>
|
|
313
|
-
setSearchFormValues:
|
|
314
|
-
getSearchFormValues:
|
|
315
|
-
dataSource:
|
|
314
|
+
return M({
|
|
315
|
+
submit: () => N(),
|
|
316
|
+
reset: () => L(),
|
|
317
|
+
setSearchFormValues: se,
|
|
318
|
+
getSearchFormValues: de,
|
|
319
|
+
dataSource: d(() => l(m).records),
|
|
316
320
|
rowSelection: {
|
|
317
|
-
selectedRows:
|
|
318
|
-
...
|
|
321
|
+
selectedRows: d(() => l(z)),
|
|
322
|
+
...T
|
|
319
323
|
}
|
|
320
|
-
}), (
|
|
321
|
-
class:
|
|
322
|
-
}, [l(
|
|
324
|
+
}), (a, o) => (y(), v("div", {
|
|
325
|
+
class: B(le.value)
|
|
326
|
+
}, [l(i)(a.dataSource) && a.searchForm !== !1 && k.value.length > 0 ? (y(), v("div", {
|
|
323
327
|
key: 0,
|
|
324
|
-
class:
|
|
325
|
-
style:
|
|
326
|
-
}, [
|
|
328
|
+
class: B(a.card ? l(R)("search-wrapper") : null),
|
|
329
|
+
style: A(a.searchFormWrapperStyle)
|
|
330
|
+
}, [g(l(ve).SearchForm, h(a.searchForm || {}, {
|
|
327
331
|
ref_key: "formRef",
|
|
328
|
-
ref:
|
|
332
|
+
ref: F,
|
|
329
333
|
"custom-reset": "",
|
|
330
|
-
onSubmit: l(
|
|
331
|
-
onReset: l(
|
|
332
|
-
"submit-loading": l(
|
|
333
|
-
}),
|
|
334
|
-
default:
|
|
335
|
-
key:
|
|
334
|
+
onSubmit: l(N),
|
|
335
|
+
onReset: l(L),
|
|
336
|
+
"submit-loading": l(f).loading
|
|
337
|
+
}), W({
|
|
338
|
+
default: b(() => [(y(!0), v(j, null, H(k.value, (t) => (y(), he(be(t.renderNode), h({
|
|
339
|
+
key: t.dataIndex,
|
|
336
340
|
ref_for: !0
|
|
337
|
-
},
|
|
338
|
-
span:
|
|
341
|
+
}, t.fieldProps || {}, {
|
|
342
|
+
span: t.span
|
|
339
343
|
}), null, 16, ["span"]))), 128))]),
|
|
340
344
|
_: 2
|
|
341
|
-
}, [
|
|
345
|
+
}, [w.searchFormExtra ? {
|
|
342
346
|
name: "extra",
|
|
343
|
-
fn:
|
|
347
|
+
fn: b(() => [S(a.$slots, "searchFormExtra")]),
|
|
344
348
|
key: "0"
|
|
345
|
-
} : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) :
|
|
349
|
+
} : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : Se("", !0), we("div", {
|
|
346
350
|
ref_key: "contentRef",
|
|
347
|
-
ref:
|
|
348
|
-
class:
|
|
349
|
-
style:
|
|
350
|
-
}, [
|
|
351
|
-
selectedRows: l(
|
|
352
|
-
selectedRowKeys: l(
|
|
353
|
-
},
|
|
354
|
-
class: l(
|
|
355
|
-
},
|
|
351
|
+
ref: Y,
|
|
352
|
+
class: B([l(R)("table-wrapper"), a.card ? l(R)("table-wrapper-card") : null]),
|
|
353
|
+
style: A(a.tableWrapperStyle)
|
|
354
|
+
}, [S(a.$slots, "title", h({
|
|
355
|
+
selectedRows: l(z),
|
|
356
|
+
selectedRowKeys: l(C).selectedRowKeys
|
|
357
|
+
}, T)), g(l(Fe), h({
|
|
358
|
+
class: l(p)("table")
|
|
359
|
+
}, E.value, {
|
|
356
360
|
"table-layout": te.value,
|
|
357
|
-
onChange: l(
|
|
358
|
-
columns:
|
|
359
|
-
onResizeColumn:
|
|
360
|
-
}),
|
|
361
|
-
summary:
|
|
362
|
-
columns:
|
|
363
|
-
records:
|
|
361
|
+
onChange: l(oe),
|
|
362
|
+
columns: c.value,
|
|
363
|
+
onResizeColumn: o[0] || (o[0] = (t, r) => r.width = t)
|
|
364
|
+
}), W({
|
|
365
|
+
summary: b(() => [S(a.$slots, "summary", {
|
|
366
|
+
columns: c.value,
|
|
367
|
+
records: E.value.dataSource
|
|
364
368
|
})]),
|
|
365
369
|
_: 2
|
|
366
|
-
}, [
|
|
370
|
+
}, [H(l(q)(w, ["title", "searchFormExtra", "headerCell"]), (t, r) => ({
|
|
367
371
|
name: r,
|
|
368
|
-
fn:
|
|
372
|
+
fn: b((n) => [S(a.$slots, r, Re(Ce(n || {})))])
|
|
369
373
|
}))]), 1040, ["class", "table-layout", "onChange", "columns"])], 6)], 2));
|
|
370
374
|
}
|
|
371
375
|
});
|
|
372
376
|
export {
|
|
373
|
-
|
|
377
|
+
ua as default
|
|
374
378
|
};
|
|
@@ -68,7 +68,7 @@ export type ApTableRowSelection<RecordType = any> = Omit<TableRowSelection<Recor
|
|
|
68
68
|
mode: 'internal';
|
|
69
69
|
};
|
|
70
70
|
export type CommonFieldReturnType = ApFormItemProps & {
|
|
71
|
-
field
|
|
71
|
+
field?: Recordable;
|
|
72
72
|
placeholder?: string;
|
|
73
73
|
disabled?: boolean;
|
|
74
74
|
};
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
.aplus-ap-table-table tr > th.ant-table-cell {
|
|
51
51
|
background-color: var(--ap-table-header-bg, #F2F6F9);
|
|
52
52
|
}
|
|
53
|
+
.aplus-ap-table-table tr > th.ant-table-cell::before {
|
|
54
|
+
background-color: #D8DDE5 !important;
|
|
55
|
+
}
|
|
53
56
|
.aplus-ap-table .ant-table.ant-table-middle .ant-table-row .ant-table-cell {
|
|
54
57
|
padding: 12px 16px;
|
|
55
58
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Tooltip as
|
|
1
|
+
import { defineComponent as a, useSlots as r, computed as m, createVNode as e, mergeProps as d } from "vue";
|
|
2
|
+
import { Tooltip as p, Badge as f } from "ant-design-vue";
|
|
3
3
|
import { IconApAdLineAnnotation as A, IconApAdFillWarn as y, IconApAdFillExecution as v, IconApAdFillSuccessful as b } from "@aplus-frontend/icon";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import { ApLabelProps as g } from "./constans.mjs";
|
|
6
6
|
import { omit as T } from "lodash-unified";
|
|
7
7
|
import "./style.css";
|
|
8
8
|
import { useNamespace as x } from "../../config-provider/hooks/use-namespace.mjs";
|
|
9
|
-
const B = /* @__PURE__ */
|
|
9
|
+
const B = /* @__PURE__ */ a({
|
|
10
10
|
name: "ApLabel",
|
|
11
11
|
props: g(),
|
|
12
12
|
setup(l) {
|
|
@@ -17,8 +17,9 @@ const B = /* @__PURE__ */ c({
|
|
|
17
17
|
color: l.iconColor,
|
|
18
18
|
"font-size": l.iconSize + "px",
|
|
19
19
|
"margin-left": "4px",
|
|
20
|
-
display: "inline-flex"
|
|
21
|
-
|
|
20
|
+
display: "inline-flex",
|
|
21
|
+
cursor: "pointer"
|
|
22
|
+
})), c = (u, t) => u ? e(p, {
|
|
22
23
|
title: u,
|
|
23
24
|
placement: t.placement || "top",
|
|
24
25
|
color: t.toolTipBgColor
|
|
@@ -37,9 +38,9 @@ const B = /* @__PURE__ */ c({
|
|
|
37
38
|
class: [s()]
|
|
38
39
|
}, [e("div", {
|
|
39
40
|
class: [i("content")]
|
|
40
|
-
}, [e(
|
|
41
|
+
}, [e(f, d(T(l, ["helpMessage", "placement", "iconColor"]), {
|
|
41
42
|
status: l.status ? l.status : "default"
|
|
42
|
-
}), null), o.default ? o.default() :
|
|
43
|
+
}), null), o.default ? o.default() : c(l.helpMessage, l)]), o.custom ? e("div", {
|
|
43
44
|
class: [i("custom")]
|
|
44
45
|
}, [o.custom()]) : null]) : null]);
|
|
45
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, ref as y, unref as
|
|
1
|
+
import { defineComponent as q, ref as y, unref as t, useSlots as G, watch as H, openBlock as m, createBlock as C, mergeProps as b, withCtx as d, createVNode as w, createSlots as I, createElementBlock as M, normalizeClass as W, createCommentVNode as R, createElementVNode as $, toDisplayString as Q, normalizeStyle as U, renderList as J, renderSlot as X, normalizeProps as Y, guardReactiveProps as Z } from "vue";
|
|
2
2
|
import { Table as ee, Tooltip as oe } from "ant-design-vue";
|
|
3
3
|
import { ApForm as B } from "../ap-form/index.mjs";
|
|
4
4
|
import { isNumber as i, cloneDeep as f, omit as te } from "lodash-unified";
|
|
@@ -10,8 +10,8 @@ import le from "./hooks/use-get-columns.mjs";
|
|
|
10
10
|
import { scrollToRowIndex as ne, getColumnIsRequired as re } from "./utils.mjs";
|
|
11
11
|
import { QuestionCircleOutlined as se } from "@ant-design/icons-vue";
|
|
12
12
|
import { useToken as ue } from "ant-design-vue/es/theme/internal";
|
|
13
|
-
import { useNamespace as
|
|
14
|
-
import { useGlobalConfig as
|
|
13
|
+
import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
import { useGlobalConfig as me } from "../config-provider/hooks/use-global-config.mjs";
|
|
15
15
|
const ve = /* @__PURE__ */ q({
|
|
16
16
|
name: "EditableTableInner",
|
|
17
17
|
__name: "form-item",
|
|
@@ -119,102 +119,102 @@ const ve = /* @__PURE__ */ q({
|
|
|
119
119
|
const l = k, {
|
|
120
120
|
internalInstance: n,
|
|
121
121
|
model: D
|
|
122
|
-
} = ae(),
|
|
122
|
+
} = ae(), s = y(((h = t(D)) == null ? void 0 : h[l.name]) || []), L = G(), T = B.useWatch(l.name);
|
|
123
123
|
H(() => T.value, (e) => {
|
|
124
|
-
var
|
|
125
|
-
|
|
124
|
+
var o;
|
|
125
|
+
s.value = e, (o = l.onChange) == null || o.call(l, e);
|
|
126
126
|
}, {
|
|
127
127
|
deep: !0
|
|
128
128
|
});
|
|
129
129
|
const {
|
|
130
130
|
b: E,
|
|
131
131
|
em: F
|
|
132
|
-
} =
|
|
133
|
-
function
|
|
132
|
+
} = de("editable-table"), c = y(), N = me("valueTypeMap"), [, S] = ue(), _ = le(l, N);
|
|
133
|
+
function V(e, o) {
|
|
134
134
|
var u;
|
|
135
|
-
const a = ((u =
|
|
135
|
+
const a = ((u = t(s)) == null ? void 0 : u.length) || 0;
|
|
136
136
|
if (p(l.maxLength) && a >= l.maxLength)
|
|
137
137
|
return;
|
|
138
|
-
const
|
|
139
|
-
p(
|
|
138
|
+
const r = [...t(s) || []];
|
|
139
|
+
p(o) ? r.splice(o, 0, {
|
|
140
140
|
...e || {}
|
|
141
|
-
}) :
|
|
141
|
+
}) : r.push({
|
|
142
142
|
...e || {}
|
|
143
|
-
}), n == null || n.setFieldValue(l.name,
|
|
143
|
+
}), n == null || n.setFieldValue(l.name, r);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function z(e, o = "suffix") {
|
|
146
146
|
var g;
|
|
147
|
-
const a = ((g =
|
|
148
|
-
if (p(l.maxLength) && a +
|
|
147
|
+
const a = ((g = t(s)) == null ? void 0 : g.length) || 0, r = i(e) ? e : e.length;
|
|
148
|
+
if (p(l.maxLength) && a + r > l.maxLength)
|
|
149
149
|
return;
|
|
150
|
-
const u = [...
|
|
151
|
-
|
|
150
|
+
const u = [...t(s) || []], x = i(e) ? new Array(e).fill({}) : f(e);
|
|
151
|
+
o === "suffix" ? u.push(...x) : u.unshift(...x), n == null || n.setFieldValue(l.name, u);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
let
|
|
153
|
+
function P(e) {
|
|
154
|
+
let o = f(t(s) || []);
|
|
155
155
|
const a = i(e) ? [e] : e;
|
|
156
|
-
|
|
156
|
+
o = o.filter((r, u) => !a.includes(u)), n == null || n.setFieldValue(l.name, o);
|
|
157
157
|
}
|
|
158
158
|
function j() {
|
|
159
|
-
return
|
|
159
|
+
return t(s);
|
|
160
160
|
}
|
|
161
161
|
function O(e) {
|
|
162
|
-
var
|
|
163
|
-
return (
|
|
162
|
+
var o;
|
|
163
|
+
return (o = t(s)) == null ? void 0 : o[e];
|
|
164
164
|
}
|
|
165
|
-
function A(e,
|
|
166
|
-
const a = f(
|
|
165
|
+
function A(e, o) {
|
|
166
|
+
const a = f(t(s));
|
|
167
167
|
a[e] && (a[e] = {
|
|
168
168
|
...a[e],
|
|
169
|
-
...
|
|
169
|
+
...o
|
|
170
170
|
}, n == null || n.setFieldValue(l.name, [...a]));
|
|
171
171
|
}
|
|
172
|
-
function K(e,
|
|
173
|
-
var
|
|
174
|
-
const a = e === "end" ?
|
|
175
|
-
ne(a, (
|
|
172
|
+
function K(e, o) {
|
|
173
|
+
var r;
|
|
174
|
+
const a = e === "end" ? s.value.length - 1 : e;
|
|
175
|
+
ne(a, (r = c.value) == null ? void 0 : r.$el, o);
|
|
176
176
|
}
|
|
177
177
|
return v({
|
|
178
|
-
add:
|
|
179
|
-
remove:
|
|
178
|
+
add: V,
|
|
179
|
+
remove: P,
|
|
180
180
|
getRowData: O,
|
|
181
181
|
getRowsData: j,
|
|
182
182
|
setRowData: A,
|
|
183
|
-
addMultiple:
|
|
183
|
+
addMultiple: z,
|
|
184
184
|
scrollTo: K
|
|
185
|
-
}), (e,
|
|
185
|
+
}), (e, o) => (m(), C(t(B).FormItem, b(e.formItem, {
|
|
186
186
|
name: e.name,
|
|
187
187
|
label: e.label
|
|
188
188
|
}), {
|
|
189
|
-
default:
|
|
190
|
-
class:
|
|
191
|
-
columns:
|
|
192
|
-
"data-source":
|
|
189
|
+
default: d(() => [w(t(ee), b(t(te)(l, ["name", "maxLength", "onChange"]), {
|
|
190
|
+
class: t(E)(),
|
|
191
|
+
columns: t(_),
|
|
192
|
+
"data-source": s.value,
|
|
193
193
|
ref_key: "tableRef",
|
|
194
194
|
ref: c
|
|
195
195
|
}), I({
|
|
196
|
-
headerCell:
|
|
196
|
+
headerCell: d(({
|
|
197
197
|
column: a
|
|
198
|
-
}) => [
|
|
198
|
+
}) => [t(re)(a) ? (m(), M("span", {
|
|
199
199
|
key: 0,
|
|
200
|
-
class: W(
|
|
201
|
-
}, "*", 2)) : R("", !0), $("span", null, Q(a.title), 1), a.tooltip ? (
|
|
200
|
+
class: W(t(F)("header-cell", "required"))
|
|
201
|
+
}, "*", 2)) : R("", !0), $("span", null, Q(a.title), 1), a.tooltip ? (m(), C(t(oe), {
|
|
202
202
|
key: 1,
|
|
203
203
|
title: a.tooltip,
|
|
204
204
|
placement: "bottom"
|
|
205
205
|
}, {
|
|
206
|
-
default:
|
|
206
|
+
default: d(() => [w(t(se), {
|
|
207
207
|
style: U({
|
|
208
208
|
paddingLeft: "4px",
|
|
209
|
-
color:
|
|
209
|
+
color: t(S).colorPrimary
|
|
210
210
|
})
|
|
211
211
|
}, null, 8, ["style"])]),
|
|
212
212
|
_: 2
|
|
213
213
|
}, 1032, ["title"])) : R("", !0)]),
|
|
214
214
|
_: 2
|
|
215
|
-
}, [J(L, (a,
|
|
216
|
-
name:
|
|
217
|
-
fn:
|
|
215
|
+
}, [J(L, (a, r) => ({
|
|
216
|
+
name: r,
|
|
217
|
+
fn: d((u) => [X(e.$slots, r, Y(Z(u || {})))])
|
|
218
218
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
219
219
|
_: 3
|
|
220
220
|
}, 16, ["name", "label"]));
|
|
@@ -1,63 +1,71 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { omit as
|
|
3
|
-
import { mergeClass as
|
|
4
|
-
import { updateFormProps as
|
|
1
|
+
import { computed as b, unref as h } from "vue";
|
|
2
|
+
import { omit as I, isFunction as R, isArray as C } from "lodash-unified";
|
|
3
|
+
import { mergeClass as y, getFinalNode as T } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as N, getFieldProps as v, getPlaceholder as w, getTableRenderProps as A } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { useLocale as
|
|
7
|
-
const
|
|
6
|
+
import { useLocale as G } from "../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
const B = (l, m) => {
|
|
8
8
|
const {
|
|
9
|
-
t:
|
|
10
|
-
} =
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return (m = o.onFieldChange) == null ? void 0 : m.call(o, n.index, e.dataIndex, f);
|
|
31
|
-
}), c = {
|
|
32
|
-
name: [o.name, n.index, e.dataIndex],
|
|
33
|
-
...l || {},
|
|
34
|
-
// 格式化placeholder
|
|
35
|
-
placeholder: y(s, e.valueType, l == null ? void 0 : l.placeholder),
|
|
36
|
-
field: {
|
|
37
|
-
style: "width: 100%",
|
|
38
|
-
...(l == null ? void 0 : l.field) || {},
|
|
39
|
-
...u,
|
|
40
|
-
class: R("is-editable", l.class)
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
} else
|
|
44
|
-
c = {
|
|
45
|
-
field: T(e, {
|
|
46
|
-
value: a,
|
|
9
|
+
t: f
|
|
10
|
+
} = G();
|
|
11
|
+
return b(() => {
|
|
12
|
+
const t = l.columns;
|
|
13
|
+
if (!t)
|
|
14
|
+
return [];
|
|
15
|
+
function c(x) {
|
|
16
|
+
return x.map((e) => ({
|
|
17
|
+
...I(e, ["ellipsis"]),
|
|
18
|
+
children: c(e.children || []),
|
|
19
|
+
customRender({
|
|
20
|
+
value: o,
|
|
21
|
+
...n
|
|
22
|
+
}) {
|
|
23
|
+
const a = R(e.editable) ? e.editable(n.text, n.record, n.index) : !!e.editable;
|
|
24
|
+
if (!e.valueType && !e.customRender && !e.customRenderFormItem)
|
|
25
|
+
return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"), null;
|
|
26
|
+
let r;
|
|
27
|
+
if (a) {
|
|
28
|
+
const d = N(e, v(e.fieldProps, {
|
|
29
|
+
value: o,
|
|
47
30
|
...n
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
31
|
+
})), i = {};
|
|
32
|
+
l.onFieldChange && (i[`onUpdate:${d.valuePropName || "value"}`] = (F) => {
|
|
33
|
+
var s;
|
|
34
|
+
return (s = l.onFieldChange) == null ? void 0 : s.call(l, n.index, e.dataIndex, F);
|
|
35
|
+
});
|
|
36
|
+
const g = C(e.dataIndex) ? e.dataIndex : [e.dataIndex];
|
|
37
|
+
r = {
|
|
38
|
+
name: [l.name, n.index, ...g],
|
|
39
|
+
...d || {},
|
|
40
|
+
// 格式化placeholder
|
|
41
|
+
placeholder: w(f, e.valueType, d == null ? void 0 : d.placeholder),
|
|
42
|
+
field: {
|
|
43
|
+
style: "width: 100%",
|
|
44
|
+
...(d == null ? void 0 : d.field) || {},
|
|
45
|
+
...i,
|
|
46
|
+
class: y("is-editable", d.class)
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
} else
|
|
50
|
+
r = {
|
|
51
|
+
field: A(e, {
|
|
52
|
+
value: o,
|
|
53
|
+
...n
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
const u = T(e, a, r, o, n.record, h(m));
|
|
57
|
+
return e.customRender ? e.customRender({
|
|
58
|
+
value: o,
|
|
59
|
+
...n,
|
|
60
|
+
editable: a,
|
|
61
|
+
originalNode: u
|
|
62
|
+
}) : u;
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
return c(t);
|
|
59
67
|
});
|
|
60
68
|
};
|
|
61
69
|
export {
|
|
62
|
-
|
|
70
|
+
B as default
|
|
63
71
|
};
|
|
@@ -8,7 +8,7 @@ import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
|
8
8
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
9
9
|
import { Recordable } from '../type';
|
|
10
10
|
export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
11
|
-
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType
|
|
11
|
+
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
|
|
12
12
|
/**
|
|
13
13
|
* 在title之后展示一个icon并触发tooltip
|
|
14
14
|
*/
|
|
@@ -32,7 +32,7 @@ export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueT
|
|
|
32
32
|
/**
|
|
33
33
|
* 自定义表单,适用于内置`valueType`不满足的情况下使用
|
|
34
34
|
*/
|
|
35
|
-
customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean) => any;
|
|
35
|
+
customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean, record: RecordType) => any;
|
|
36
36
|
/**
|
|
37
37
|
* 指定值类型(将会用于普通列和可编辑表格的渲染)
|
|
38
38
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isVNode as F, createVNode as f, mergeProps as g } from "vue";
|
|
2
|
-
import { isFunction as
|
|
2
|
+
import { isFunction as T, isArray as I, isBoolean as h, omit as P } from "lodash-unified";
|
|
3
3
|
import { apTableFormItemMap as V, noRenderAsFormItemValueList as j, apTableRenderItemMap as q } from "../ap-table/constants.mjs";
|
|
4
4
|
import { isDef as w } from "../utils/index.mjs";
|
|
5
5
|
import { getValueStr as S } from "../ap-field/number/helper.mjs";
|
|
@@ -7,8 +7,8 @@ import A from "scroll-into-view-if-needed";
|
|
|
7
7
|
import { Typography as v } from "ant-design-vue";
|
|
8
8
|
import "../ap-form/index.mjs";
|
|
9
9
|
import { objectToString as C } from "../ap-table/utils.mjs";
|
|
10
|
-
import
|
|
11
|
-
function
|
|
10
|
+
import y from "../ap-form/ap-form-item.vue.mjs";
|
|
11
|
+
function b(e) {
|
|
12
12
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !F(e);
|
|
13
13
|
}
|
|
14
14
|
function N(e) {
|
|
@@ -17,14 +17,14 @@ function N(e) {
|
|
|
17
17
|
function Q(e) {
|
|
18
18
|
if (!e.fieldProps)
|
|
19
19
|
return !1;
|
|
20
|
-
const t =
|
|
21
|
-
return w(t.required) ? t.required : (
|
|
20
|
+
const t = T(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
|
|
21
|
+
return w(t.required) ? t.required : (I(t.rules) ? t.rules : t.rules ? [t.rules] : []).some((r) => r.required);
|
|
22
22
|
}
|
|
23
23
|
function _(e, t) {
|
|
24
24
|
if (e.valueType === "text" || e.valueType === "textArea")
|
|
25
25
|
return t || "--";
|
|
26
26
|
if (e.valueType === "number") {
|
|
27
|
-
const o = e.fieldProps ?
|
|
27
|
+
const o = e.fieldProps ? T(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
|
|
28
28
|
return S(t, o) || "--";
|
|
29
29
|
}
|
|
30
30
|
return C(t);
|
|
@@ -32,7 +32,7 @@ function _(e, t) {
|
|
|
32
32
|
function R(e, t) {
|
|
33
33
|
const o = [e];
|
|
34
34
|
if (t) {
|
|
35
|
-
const r =
|
|
35
|
+
const r = I(t) ? t : [t];
|
|
36
36
|
o.unshift(...r);
|
|
37
37
|
}
|
|
38
38
|
return o.join(" ");
|
|
@@ -61,32 +61,32 @@ function D(e, t, o) {
|
|
|
61
61
|
content: e.ellipsis ? _(e, t) : o
|
|
62
62
|
}, null) : o;
|
|
63
63
|
}
|
|
64
|
-
function W(e, t, o, r,
|
|
65
|
-
var
|
|
64
|
+
function W(e, t, o, r, d, i) {
|
|
65
|
+
var a, m;
|
|
66
66
|
if (t) {
|
|
67
67
|
if (e.customRenderFormItem) {
|
|
68
|
-
const n = e.customRenderFormItem(e, o.field, t);
|
|
69
|
-
return f(
|
|
68
|
+
const n = e.customRenderFormItem(e, o.field, t, d);
|
|
69
|
+
return f(y, P(o, ["field"]), b(n) ? n : {
|
|
70
70
|
default: () => [n]
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
const l = N(e.valueType);
|
|
74
74
|
if (l)
|
|
75
75
|
return f(l, o, null);
|
|
76
|
-
const s = i == null ? void 0 : i[e.valueType], u = (
|
|
77
|
-
return u ? f(
|
|
76
|
+
const s = i == null ? void 0 : i[e.valueType], u = (a = s == null ? void 0 : s.renderFormItem) == null ? void 0 : a.call(s, o.field);
|
|
77
|
+
return u ? f(y, o, b(u) ? u : {
|
|
78
78
|
default: () => [u]
|
|
79
79
|
}) : null;
|
|
80
80
|
}
|
|
81
81
|
let p;
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
p = f(
|
|
82
|
+
const c = q[e.valueType];
|
|
83
|
+
if (c)
|
|
84
|
+
p = f(c, g(o.field, {
|
|
85
85
|
mode: "read"
|
|
86
86
|
}), null);
|
|
87
87
|
else {
|
|
88
88
|
const l = i == null ? void 0 : i[e.valueType];
|
|
89
|
-
p = (
|
|
89
|
+
p = (m = l == null ? void 0 : l.render) == null ? void 0 : m.call(l, r, d, o.field);
|
|
90
90
|
}
|
|
91
91
|
return p ? D(e, r, p) : null;
|
|
92
92
|
}
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
.aplus-ap-table-table tr > th.ant-table-cell {
|
|
51
51
|
background-color: var(--ap-table-header-bg, #F2F6F9);
|
|
52
52
|
}
|
|
53
|
+
.aplus-ap-table-table tr > th.ant-table-cell::before {
|
|
54
|
+
background-color: #D8DDE5 !important;
|
|
55
|
+
}
|
|
53
56
|
.aplus-ap-table .ant-table.ant-table-middle .ant-table-row .ant-table-cell {
|
|
54
57
|
padding: 12px 16px;
|
|
55
58
|
}
|
|
@@ -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"),N=require("ant-design-vue"),ee=require("ant-design-vue/es/theme/internal"),ae=require("../ap-form/index.js"),z=require("./constants.js");require("../config-provider/index.js");const re=require("./hooks/use-table-paging.js"),d=require("lodash-unified");require("./style/ap-table.css");const s=require("./utils.js"),oe=require("./hooks/use-table-content-height.js"),ne=require("../editable-table/utils.js"),te=require("./hooks/use-table-row-selection.js"),le=require("../utils/index.js"),se=require("../config-provider/hooks/use-locale.js"),ue=require("../config-provider/hooks/use-namespace.js"),de=require("../config-provider/hooks/use-global-config.js"),ie=e.defineComponent({name:"ApTable",__name:"ap-table",props:{dropdownPrefixCls:{},loading:{type:[Boolean,Object],default:void 0},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},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:{},rowSelection:{type:[Boolean,Object]},card:{type:Boolean,default:!1},params:{},searchFormRender:{},request:{},onLoad:{},defaultData:{},dataSource:{},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},columnResizable:{type:Boolean,default:!1}},setup(L,{expose:V}){const a=L;let C=0;const g=e.useSlots(),[,E]=ee.useToken(),{t:O}=se.useLocale(),{e:y,b:f}=ue.useNamespace("ap-table"),R=de.useGlobalConfig("valueTypeMap"),{height:K,contentRef:D}=oe.default(),c=e.ref([]),U=()=>{var t;let r=((t=a.columns)==null?void 0:t.filter(n=>!n.hideInTable))||[];function o(n){return n.map(l=>({resizable:le.isDef(l.resizable)?l.resizable:a.columnResizable,...d.omit(s.apColumnToColumn(l),["ellipsis"]),title:s.getTableTitle(l,g.headerCell,e.unref(E).colorPrimary),customRender({value:u,...i}){var q,I;const P=s.getTableRenderType(l),X=s.getTableRenderProps({...l,valueType:P},{value:u,...i}),Y=s.getTableCellRenderNode(P,X,i.record,e.unref(R)),k=((q=l.renderText)==null?void 0:q.call(l,{value:u,...i}))||u,Z=l.renderText?e.createVNode(e.Fragment,null,[(I=l.renderText)==null?void 0:I.call(l,{value:u,...i})]):Y;let w=_(l,k,Z);return l.customRender&&(w=l.customRender({value:u,...i,column:l,originalNode:w,originalText:k})),w},children:o(l.children||[])}))}return o(r)};e.watchEffect(()=>{c.value=U()});const T=e.computed(()=>{var r,o,t;return C++,((t=(o=(r=a.columns)==null?void 0:r.filter(n=>!n.hideInSearch&&n.dataIndex&&(n.valueType||n.customRenderFormItem)&&!z.noRenderAsFormItemValueList.includes(n.valueType)))==null?void 0:o.sort((n,l)=>{let u=s.getColumnOrder(n.order);return s.getColumnOrder(l.order)-u}))==null?void 0:t.map(n=>{const l=s.updateFormProps(n,s.getFieldProps(n.fieldProps,{})),u={...n,fieldProps:{label:n.title,name:n.dataIndex,...l||{},placeholder:s.getPlaceholder(O,n.valueType,l==null?void 0:l.placeholder),_signal:C},renderNode:void 0};return u.renderNode=s.getSearchFormItemRenderNode(u,e.unref(R)),u}))||[]}),j=e.computed(()=>e.unref(c).filter(r=>r.sorter===!0).map(r=>r.dataIndex).filter(Boolean)),A=e.computed(()=>e.unref(c).filter(r=>r.filters&&!r.onFilter).map(r=>r.dataIndex).filter(Boolean)),W=e.computed(()=>d.isUndefined(a.dataSource)?m.value.records:a.dataSource),{rowSelection:h,selectedRows:x,...S}=te.default({...a.rowSelection===!0?{}:a.rowSelection,rowKey:a.rowKey,dataSource:W}),{formRef:b,submit:F,reset:v,tableProps:p,handleTableChange:$,data:m}=re.useTablePaging({async request(r){var t,n;!h.value.preserveSelectedRowKeys&&d.isUndefined(a.dataSource)&&S.clearAll();const o=await((t=a.request)==null?void 0:t.call(a,r));return(n=a.onLoad)==null||n.call(a,(o==null?void 0:o.data)||[]),{data:(o==null?void 0:o.data)||[],total:(o==null?void 0:o.total)||0}},filterFields:A,sortFields:j,defaultParams:a.params,defaultData:a.defaultData,manual:a.manual,defaultCurrent:a.pagination?a.pagination.defaultCurrent:void 0,defaultPageSize:a.pagination?a.pagination.defaultPageSize:void 0,formatParams:a.beforeSearchSubmit,showLessItems:a.pagination?a.pagination.showLessItems:void 0,showTotal:a.pagination?a.pagination.showTotal:void 0}),H=e.computed(()=>{var o,t;if(a.adaptive&&(m.value.total>0||((o=a.dataSource)==null?void 0:o.length)))return{y:e.unref(K),x:((t=a.scroll)==null?void 0:t.x)||"100%"};if(a.scroll)return a.scroll}),M=e.computed(()=>{var r;if(a.tableLayout)return a.tableLayout;if((r=a.columns)!=null&&r.some(o=>o.ellipsis))return"fixed"}),B=e.computed(()=>{var n;const r=e.unref(p),o=d.isUndefined(a.dataSource)?r:{...r,dataSource:a.dataSource,onChange:a.onChange},t=e.unref(h);return{...a,...o,rowSelection:a.rowSelection===!0||((n=a.rowSelection)==null?void 0:n.mode)==="internal"?{...t,preserveSelectedRowKeys:d.isUndefined(a.dataSource)?t.preserveSelectedRowKeys:!0}:a.rowSelection,loading:d.isUndefined(a.loading)?e.unref(p).loading:a.loading,pagination:a.pagination===!1?!1:e.unref(p).pagination,scroll:e.unref(H)}}),G=e.computed(()=>[f(),a.card?null:f("wrapper"),a.adaptive?f("adaptive"):null].filter(Boolean));function _(r,o,t){if(z.noRenderAsFormItemValueList.includes(r.valueType))return t;const n=s.objectToString(o);return r.copyable||r.ellipsis?e.createVNode(N.Typography.Paragraph,{copyable:r.copyable?{text:n,tooltip:!1}:!1,ellipsis:r.ellipsis?d.isBoolean(r.ellipsis)?{tooltip:n}:{...r.ellipsis,tooltip:n}:!1,content:r.ellipsis?ne.getRawDisplayValue(r,o):t},null):t}e.watch(()=>e.unref(m).loading,r=>{var o;(o=a.onLoadingChange)==null||o.call(a,r)});function J(r){var o,t,n;(n=(t=(o=b.value)==null?void 0:o.apForm)==null?void 0:t.setFieldsValue)==null||n.call(t,r)}function Q(){var r,o,t;return(t=(o=(r=b.value)==null?void 0:r.apForm)==null?void 0:o.getFieldsValue)==null?void 0:t.call(o,!0)}return V({submit:()=>F(),reset:()=>v(),setSearchFormValues:J,getSearchFormValues:Q,dataSource:e.computed(()=>e.unref(m).records),rowSelection:{selectedRows:e.computed(()=>e.unref(x)),...S}}),(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(G.value)},[e.unref(d.isUndefined)(r.dataSource)&&r.searchForm!==!1&&T.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(r.card?e.unref(y)("search-wrapper"):null),style:e.normalizeStyle(r.searchFormWrapperStyle)},[e.createVNode(e.unref(ae.ApForm).SearchForm,e.mergeProps(r.searchForm||{},{ref_key:"formRef",ref:b,"custom-reset":"",onSubmit:e.unref(F),onReset:e.unref(v),"submit-loading":e.unref(p).loading}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,t=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.renderNode),e.mergeProps({key:t.dataIndex,ref_for:!0},t.fieldProps||{},{span:t.span}),null,16,["span"]))),128))]),_:2},[g.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(r.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["onSubmit","onReset","submit-loading"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"contentRef",ref:D,class:e.normalizeClass([e.unref(y)("table-wrapper"),r.card?e.unref(y)("table-wrapper-card"):null]),style:e.normalizeStyle(r.tableWrapperStyle)},[e.renderSlot(r.$slots,"title",e.mergeProps({selectedRows:e.unref(x),selectedRowKeys:e.unref(h).selectedRowKeys},S)),e.createVNode(e.unref(N.Table),e.mergeProps({class:e.unref(f)("table")},B.value,{"table-layout":M.value,onChange:e.unref($),columns:c.value,onResizeColumn:o[0]||(o[0]=(t,n)=>n.width=t)}),e.createSlots({summary:e.withCtx(()=>[e.renderSlot(r.$slots,"summary",{columns:c.value,records:B.value.dataSource})]),_:2},[e.renderList(e.unref(d.omit)(g,["title","searchFormExtra","headerCell"]),(t,n)=>({name:n,fn:e.withCtx(l=>[e.renderSlot(r.$slots,n,e.normalizeProps(e.guardReactiveProps(l||{})))])}))]),1040,["class","table-layout","onChange","columns"])],6)],2))}});exports.default=ie;
|
|
@@ -68,7 +68,7 @@ export type ApTableRowSelection<RecordType = any> = Omit<TableRowSelection<Recor
|
|
|
68
68
|
mode: 'internal';
|
|
69
69
|
};
|
|
70
70
|
export type CommonFieldReturnType = ApFormItemProps & {
|
|
71
|
-
field
|
|
71
|
+
field?: Recordable;
|
|
72
72
|
placeholder?: string;
|
|
73
73
|
disabled?: boolean;
|
|
74
74
|
};
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
.aplus-ap-table-table tr > th.ant-table-cell {
|
|
51
51
|
background-color: var(--ap-table-header-bg, #F2F6F9);
|
|
52
52
|
}
|
|
53
|
+
.aplus-ap-table-table tr > th.ant-table-cell::before {
|
|
54
|
+
background-color: #D8DDE5 !important;
|
|
55
|
+
}
|
|
53
56
|
.aplus-ap-table .ant-table.ant-table-middle .ant-table-row .ant-table-cell {
|
|
54
57
|
padding: 12px 16px;
|
|
55
58
|
}
|
|
@@ -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"),a=require("ant-design-vue"),c=require("@aplus-frontend/icon");require("../../config-provider/index.js");const d=require("./constans.js"),m=require("lodash-unified");require("./style.css");const f=require("../../config-provider/hooks/use-namespace.js"),A=e.defineComponent({name:"ApLabel",props:d.ApLabelProps(),setup(t){const{b:i,e:u}=f.useNamespace("ap-label"),n=e.useSlots(),o=e.computed(()=>({color:t.iconColor,"font-size":t.iconSize+"px","margin-left":"4px",display:"inline-flex",cursor:"pointer"})),r=(s,l)=>s?e.createVNode(a.Tooltip,{title:s,placement:l.placement||"top",color:l.toolTipBgColor},{default:()=>[l.iconType==="question"&&e.createVNode(c.IconApAdLineAnnotation,{style:o.value},null),l.iconType==="warning"&&e.createVNode(c.IconApAdFillWarn,{style:o.value},null),l.iconType==="ellipsis"&&e.createVNode(c.IconApAdFillExecution,{style:o.value},null),l.iconType==="success"&&e.createVNode(c.IconApAdFillSuccessful,{style:o.value},null)]}):null;return()=>e.createVNode("div",null,[t.show?e.createVNode("div",{class:[i()]},[e.createVNode("div",{class:[u("content")]},[e.createVNode(a.Badge,e.mergeProps(m.omit(t,["helpMessage","placement","iconColor"]),{status:t.status?t.status:"default"}),null),n.default?n.default():r(t.helpMessage,t)]),n.custom?e.createVNode("div",{class:[u("custom")]},[n.custom()]):null]):null])}});exports.default=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("ant-design-vue"),x=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("ant-design-vue"),x=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const E=require("../ap-form/context.js");require("./style/index.css");const i=require("../utils/index.js"),P=require("./hooks/use-get-columns.js"),g=require("./utils.js"),j=require("@ant-design/icons-vue"),z=require("ant-design-vue/es/theme/internal"),O=require("../config-provider/hooks/use-namespace.js"),A=require("../config-provider/hooks/use-global-config.js"),M=e.defineComponent({name:"EditableTableInner",__name:"form-item",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},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:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{default:()=>({})}},setup(C,{expose:b}){var f;const a=C,{internalInstance:l,model:y}=E.useInjectForm(),u=e.ref(((f=e.unref(y))==null?void 0:f[a.name])||[]),w=e.useSlots(),R=x.ApForm.useWatch(a.name);e.watch(()=>R.value,t=>{var o;u.value=t,(o=a.onChange)==null||o.call(a,t)},{deep:!0});const{b:B,em:q}=O.useNamespace("editable-table"),c=e.ref(),D=A.useGlobalConfig("valueTypeMap"),[,k]=z.useToken(),v=P.default(a,D);function N(t,o){var s;const n=((s=e.unref(u))==null?void 0:s.length)||0;if(i.isDef(a.maxLength)&&n>=a.maxLength)return;const r=[...e.unref(u)||[]];i.isDef(o)?r.splice(o,0,{...t||{}}):r.push({...t||{}}),l==null||l.setFieldValue(a.name,r)}function S(t,o="suffix"){var p;const n=((p=e.unref(u))==null?void 0:p.length)||0,r=d.isNumber(t)?t:t.length;if(i.isDef(a.maxLength)&&n+r>a.maxLength)return;const s=[...e.unref(u)||[]],m=d.isNumber(t)?new Array(t).fill({}):d.cloneDeep(t);o==="suffix"?s.push(...m):s.unshift(...m),l==null||l.setFieldValue(a.name,s)}function T(t){let o=d.cloneDeep(e.unref(u)||[]);const n=d.isNumber(t)?[t]:t;o=o.filter((r,s)=>!n.includes(s)),l==null||l.setFieldValue(a.name,o)}function F(){return e.unref(u)}function L(t){var o;return(o=e.unref(u))==null?void 0:o[t]}function V(t,o){const n=d.cloneDeep(e.unref(u));n[t]&&(n[t]={...n[t],...o},l==null||l.setFieldValue(a.name,[...n]))}function _(t,o){var r;const n=t==="end"?u.value.length-1:t;g.scrollToRowIndex(n,(r=c.value)==null?void 0:r.$el,o)}return b({add:N,remove:T,getRowData:L,getRowsData:F,setRowData:V,addMultiple:S,scrollTo:_}),(t,o)=>(e.openBlock(),e.createBlock(e.unref(x.ApForm).FormItem,e.mergeProps(t.formItem,{name:t.name,label:t.label}),{default:e.withCtx(()=>[e.createVNode(e.unref(h.Table),e.mergeProps(e.unref(d.omit)(a,["name","maxLength","onChange"]),{class:e.unref(B)(),columns:e.unref(v),"data-source":u.value,ref_key:"tableRef",ref:c}),e.createSlots({headerCell:e.withCtx(({column:n})=>[e.unref(g.getColumnIsRequired)(n)?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(q)("header-cell","required"))},"*",2)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(n.title),1),n.tooltip?(e.openBlock(),e.createBlock(e.unref(h.Tooltip),{key:1,title:n.tooltip,placement:"bottom"},{default:e.withCtx(()=>[e.createVNode(e.unref(j.QuestionCircleOutlined),{style:e.normalizeStyle({paddingLeft:"4px",color:e.unref(k).colorPrimary})},null,8,["style"])]),_:2},1032,["title"])):e.createCommentVNode("",!0)]),_:2},[e.renderList(w,(n,r)=>({name:r,fn:e.withCtx(s=>[e.renderSlot(t.$slots,r,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("vue"),t=require("lodash-unified"),x=require("../utils.js"),a=require("../../ap-table/utils.js");require("../../config-provider/index.js");const q=require("../../config-provider/hooks/use-locale.js"),y=(d,h)=>{const{t:F}=q.useLocale();return b.computed(()=>{const c=d.columns;if(!c)return[];function s(I){return I.map(e=>({...t.omit(e,["ellipsis"]),children:s(e.children||[]),customRender({value:u,...n}){const o=t.isFunction(e.editable)?e.editable(n.text,n.record,n.index):!!e.editable;if(!e.valueType&&!e.customRender&&!e.customRenderFormItem)return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"),null;let r;if(o){const l=a.updateFormProps(e,a.getFieldProps(e.fieldProps,{value:u,...n})),g={};d.onFieldChange&&(g[`onUpdate:${l.valuePropName||"value"}`]=m=>{var f;return(f=d.onFieldChange)==null?void 0:f.call(d,n.index,e.dataIndex,m)});const R=t.isArray(e.dataIndex)?e.dataIndex:[e.dataIndex];r={name:[d.name,n.index,...R],...l||{},placeholder:a.getPlaceholder(F,e.valueType,l==null?void 0:l.placeholder),field:{style:"width: 100%",...(l==null?void 0:l.field)||{},...g,class:x.mergeClass("is-editable",l.class)}}}else r={field:a.getTableRenderProps(e,{value:u,...n})};const i=x.getFinalNode(e,o,r,u,n.record,b.unref(h));return e.customRender?e.customRender({value:u,...n,editable:o,originalNode:i}):i}}))}return s(c)})};exports.default=y;
|
|
@@ -8,7 +8,7 @@ import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
|
8
8
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
9
9
|
import { Recordable } from '../type';
|
|
10
10
|
export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
11
|
-
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType
|
|
11
|
+
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
|
|
12
12
|
/**
|
|
13
13
|
* 在title之后展示一个icon并触发tooltip
|
|
14
14
|
*/
|
|
@@ -32,7 +32,7 @@ export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueT
|
|
|
32
32
|
/**
|
|
33
33
|
* 自定义表单,适用于内置`valueType`不满足的情况下使用
|
|
34
34
|
*/
|
|
35
|
-
customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean) => any;
|
|
35
|
+
customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean, record: RecordType) => any;
|
|
36
36
|
/**
|
|
37
37
|
* 指定值类型(将会用于普通列和可编辑表格的渲染)
|
|
38
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),u=require("lodash-unified"),a=require("../ap-table/constants.js"),F=require("../utils/index.js"),h=require("../ap-field/number/helper.js"),N=require("scroll-into-view-if-needed"),_=require("ant-design-vue");require("../ap-form/index.js");const v=require("../ap-table/utils.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),u=require("lodash-unified"),a=require("../ap-table/constants.js"),F=require("../utils/index.js"),h=require("../ap-field/number/helper.js"),N=require("scroll-into-view-if-needed"),_=require("ant-design-vue");require("../ap-form/index.js");const v=require("../ap-table/utils.js"),g=require("../ap-form/ap-form-item.vue.js");function T(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!i.isVNode(e)}function I(e){return a.apTableFormItemMap[e]}function w(e){if(!e.fieldProps)return!1;const t=u.isFunction(e.fieldProps)?e.fieldProps({}):e.fieldProps;return F.isDef(t.required)?t.required:(u.isArray(t.rules)?t.rules:t.rules?[t.rules]:[]).some(r=>r.required)}function V(e,t){if(e.valueType==="text"||e.valueType==="textArea")return t||"--";if(e.valueType==="number"){const o=e.fieldProps?u.isFunction(e.fieldProps)?e.fieldProps({}):e.fieldProps:{};return h.getValueStr(t,o)||"--"}return v.objectToString(t)}function P(e,t){const o=[e];if(t){const r=u.isArray(t)?t:[t];o.unshift(...r)}return o.join(" ")}function S(e,t=document.body,o={}){const r=t.querySelectorAll("tr.ant-table-row")[e];r&&N(r,{scrollMode:"if-needed",block:"nearest",behavior:"smooth",...o})}function j(e,t,o){return a.noRenderAsFormItemValueList.includes(e.valueType)?o:e.copyable||e.ellipsis?i.createVNode(_.Typography.Paragraph,{copyable:e.copyable?{text:t,tooltip:!1}:!1,ellipsis:e.ellipsis?u.isBoolean(e.ellipsis)?{tooltip:t}:{...e.ellipsis,tooltip:t}:!1,content:e.ellipsis?V(e,t):o},null):o}function m(e,t,o,r,p,s){var b,q;if(t){if(e.customRenderFormItem){const c=e.customRenderFormItem(e,o.field,t,p);return i.createVNode(g.default,u.omit(o,["field"]),T(c)?c:{default:()=>[c]})}const l=I(e.valueType);if(l)return i.createVNode(l,o,null);const n=s==null?void 0:s[e.valueType],d=(b=n==null?void 0:n.renderFormItem)==null?void 0:b.call(n,o.field);return d?i.createVNode(g.default,o,T(d)?d:{default:()=>[d]}):null}let f;const y=a.apTableRenderItemMap[e.valueType];if(y)f=i.createVNode(y,i.mergeProps(o.field,{mode:"read"}),null);else{const l=s==null?void 0:s[e.valueType];f=(q=l==null?void 0:l.render)==null?void 0:q.call(l,r,p,o.field)}return f?j(e,r,f):null}exports.getColumnIsRequired=w;exports.getEditableComponent=I;exports.getFinalNode=m;exports.getRawDisplayValue=V;exports.mergeClass=P;exports.scrollToRowIndex=S;
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
.aplus-ap-table-table tr > th.ant-table-cell {
|
|
51
51
|
background-color: var(--ap-table-header-bg, #F2F6F9);
|
|
52
52
|
}
|
|
53
|
+
.aplus-ap-table-table tr > th.ant-table-cell::before {
|
|
54
|
+
background-color: #D8DDE5 !important;
|
|
55
|
+
}
|
|
53
56
|
.aplus-ap-table .ant-table.ant-table-middle .ant-table-row .ant-table-cell {
|
|
54
57
|
padding: 12px 16px;
|
|
55
58
|
}
|