@gx-design-vue/pro-table 0.2.0-beta.12 → 0.2.0-beta.120
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/dist/ProTable.d.ts +236 -779
- package/dist/_utils/ant-design-vue/index.d.ts +4 -2
- package/dist/_utils/ant-design-vue/input/typings.d.ts +1 -0
- package/dist/_utils/ant-design-vue/table/props.d.ts +33 -2
- package/dist/_utils/ant-design-vue/table/typings.d.ts +6 -5
- package/dist/_utils/ant-design-vue/tooltip/typings.d.ts +1 -0
- package/dist/_utils/index.d.ts +1 -1
- package/dist/components/ColumnSetting/index.d.ts +17 -17
- package/dist/components/ColumnSetting/style.d.ts +2 -5
- package/dist/components/Form/components/RequestSelect.d.ts +39 -0
- package/dist/components/Form/{useForm.d.ts → hooks/useForm.d.ts} +1 -1
- package/dist/components/Form/index.d.ts +13 -25
- package/dist/components/Form/style.d.ts +2 -5
- package/dist/components/Form/utils/config.d.ts +5 -0
- package/dist/components/Form/utils/dateFormat.d.ts +20 -0
- package/dist/components/ListToolBar/index.d.ts +21 -21
- package/dist/components/ListToolBar/style.d.ts +2 -5
- package/dist/components/ToolBar/FullscreenIcon.d.ts +1 -1
- package/dist/components/ToolBar/index.d.ts +20 -20
- package/dist/context/TableContext.d.ts +16 -14
- package/dist/hooks/tryOnActivated.d.ts +2 -0
- package/dist/hooks/useColumnSetting.d.ts +6 -6
- package/dist/hooks/useColumns.d.ts +102 -0
- package/dist/hooks/useDebounceFn.d.ts +2 -2
- package/dist/hooks/useFetchData.d.ts +20 -15
- package/dist/hooks/useLoading.d.ts +4 -3
- package/dist/hooks/usePagination.d.ts +10 -6
- package/dist/hooks/useRowSelection.d.ts +11 -8
- package/dist/hooks/useTable.d.ts +38 -11
- package/dist/hooks/useTableForm.d.ts +6 -6
- package/dist/hooks/useTableScroll.d.ts +11 -11
- package/dist/hooks/useTableSize.d.ts +2 -2
- package/dist/index.d.ts +8 -7
- package/dist/pro-table.js +2860 -0
- package/dist/pro-table.umd.cjs +12 -0
- package/dist/props.d.ts +95 -360
- package/dist/style.d.ts +2 -6
- package/dist/types/ColumnTypings.d.ts +54 -16
- package/dist/types/SlotsTypings.d.ts +47 -9
- package/dist/types/TableTypings.d.ts +119 -68
- package/dist/utils/utils.d.ts +4 -1
- package/package.json +33 -50
- package/volar.d.ts +3 -3
- package/dist/hooks/useColums.d.ts +0 -24
- package/dist/pro-table.mjs +0 -35100
- package/dist/pro-table.umd.js +0 -364
- package/dist/typing.d.ts +0 -1
- package/dist/utils/config.d.ts +0 -1
|
@@ -0,0 +1,2860 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Gx Design Pro
|
|
3
|
+
* Version: 0.2.0-beta.119
|
|
4
|
+
* Author: gx12358
|
|
5
|
+
* Copyright (C) 2024 gx12358
|
|
6
|
+
* License: MIT License
|
|
7
|
+
* Description: Gx Design Pro Table
|
|
8
|
+
* Date Created: 2025-08-17
|
|
9
|
+
* Homepage:
|
|
10
|
+
* Contact: gx12358@gmail.com
|
|
11
|
+
*/
|
|
12
|
+
import { defineComponent as ne, ref as P, watch as N, cloneVNode as Ve, reactive as be, watchEffect as Ne, computed as S, createVNode as i, Fragment as ke, isVNode as U, mergeProps as M, h as Tt, unref as p, createTextVNode as Ae, renderSlot as ol, onActivated as il, nextTick as ul, getCurrentInstance as sl, toRaw as ve, onUnmounted as rl, onDeactivated as cl, onMounted as dl, toRef as se, isRef as _e, isReactive as fl } from "vue";
|
|
13
|
+
import { UpOutlined as hl, DownOutlined as ml, SettingOutlined as $t, VerticalAlignTopOutlined as vl, VerticalAlignMiddleOutlined as gl, VerticalAlignBottomOutlined as pl, InfoCircleOutlined as yl, ColumnHeightOutlined as bl, FullscreenExitOutlined as Cl, FullscreenOutlined as xl, ReloadOutlined as Sl, CopyOutlined as wl } from "@ant-design/icons-vue";
|
|
14
|
+
import { useProAppContext as Rt } from "@gx-design-vue/pro-app";
|
|
15
|
+
import { useContext as Tl, getProSolidColor as Ft, useProStyle as He, unit as yt, useProConfigContext as $l } from "@gx-design-vue/pro-provider";
|
|
16
|
+
import { isArray as V, isBoolean as le, classNames as re, isNumber as De, filterEmpty as Bt, getPrefixCls as lt, getRandomNumber as tt, genColumnKey as Pt, isDeepEqualReact as Ye, cloneDeep as Z, compareArray as Rl, isObject as q, runFunction as Fl, convertValueBoolean as we, getSortIndex as Bl, isFunction as Ie, handleCurrentPage as Pl, deepMerge as It, arrayRepeat as Il, isString as kt, handleShowIndex as kl, getSlot as bt, handleEmptyField as Al, getSlotsProps as Ol, getTextWidth as Dl, getSlotVNode as jl } from "@gx-design-vue/pro-utils";
|
|
17
|
+
import { useDebounceFn as Nl, useFullscreen as At, useWindowSize as El, toReactive as Ml } from "@vueuse/core";
|
|
18
|
+
import { Grid as at, DatePicker as Ot, Space as ge, Input as Ke, TimePicker as Kl, TreeSelect as zl, Select as Yl, InputNumber as Qe, Button as Ct, Spin as Dt, Popover as Ll, Checkbox as Wl, Tooltip as de, Tree as Vl, Dropdown as Hl, Menu as ze, theme as ql, Pagination as Gl, Table as _l, message as Ql, Empty as Xl } from "ant-design-vue";
|
|
19
|
+
import { omit as je, cloneDeep as jt, pick as xt } from "lodash-es";
|
|
20
|
+
import { tableProps as Ul } from "ant-design-vue/es/table/Table";
|
|
21
|
+
import "ant-design-vue/es/_util/props-util";
|
|
22
|
+
import { warning as Le } from "ant-design-vue/es/vc-util/warning";
|
|
23
|
+
import H from "dayjs";
|
|
24
|
+
import { useMemo as We, tryOnUnmounted as Jl } from "@gx-design-vue/pro-hooks";
|
|
25
|
+
const Zl = ["rowKey", "rowSelection", "columns", "pagination", "size", "bordered", "loading"], Nt = {
|
|
26
|
+
...je(Ul(), Zl),
|
|
27
|
+
transformCellText: Function,
|
|
28
|
+
/**
|
|
29
|
+
* @Author gx12358
|
|
30
|
+
* @DateTime 2022/2/8
|
|
31
|
+
* @lastTime 2022/2/8
|
|
32
|
+
* @description 是否展示外边框和列边框
|
|
33
|
+
*/
|
|
34
|
+
bordered: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
loading: {
|
|
39
|
+
type: [Boolean, Object],
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
scroll: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: void 0
|
|
45
|
+
}
|
|
46
|
+
}, { provideContext: ea, useInjectContext: fe } = Tl("pro-table"), ce = {
|
|
47
|
+
...Nt,
|
|
48
|
+
rowSelection: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
52
|
+
columns: { type: Array, default: () => [] },
|
|
53
|
+
pagination: { type: [Object, Boolean], default: () => {
|
|
54
|
+
} },
|
|
55
|
+
rowKey: { type: String, default: "id" },
|
|
56
|
+
/**
|
|
57
|
+
* @Author gx12358
|
|
58
|
+
* @DateTime 2022/2/8
|
|
59
|
+
* @lastTime 2022/2/8
|
|
60
|
+
* @description 获取 dataSource 的方法
|
|
61
|
+
*/
|
|
62
|
+
request: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: void 0
|
|
65
|
+
},
|
|
66
|
+
// 是否启用虚拟滚动
|
|
67
|
+
virtualScroll: Boolean,
|
|
68
|
+
// 用于 request 查询的额外参数,一旦变化会触发重新加载
|
|
69
|
+
params: {
|
|
70
|
+
type: Object,
|
|
71
|
+
default: () => ({})
|
|
72
|
+
},
|
|
73
|
+
// 等待请求时间设置
|
|
74
|
+
waitRequest: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: !1
|
|
77
|
+
},
|
|
78
|
+
// 轮训时间间隔设置
|
|
79
|
+
polling: Number,
|
|
80
|
+
// 防抖时间设置
|
|
81
|
+
debounceTime: {
|
|
82
|
+
type: Number,
|
|
83
|
+
default: 10
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* @Author gx12358
|
|
87
|
+
* @DateTime 2022/2/8
|
|
88
|
+
* @lastTime 2022/2/8
|
|
89
|
+
* @description 是否显示搜索表单,传入对象时为搜索表单的配置
|
|
90
|
+
*/
|
|
91
|
+
search: {
|
|
92
|
+
type: [Object, Boolean],
|
|
93
|
+
default: () => ({
|
|
94
|
+
type: "auto",
|
|
95
|
+
resetText: "重置",
|
|
96
|
+
searchText: "查询"
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
searchMap: {
|
|
100
|
+
type: Array,
|
|
101
|
+
default: () => []
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* @Author gx12358
|
|
105
|
+
* @DateTime 2022/2/8
|
|
106
|
+
* @lastTime 2022/2/8
|
|
107
|
+
* @description 自定义表格渲染模式:默认表格展示,也可以自定义数据列表展示
|
|
108
|
+
*/
|
|
109
|
+
customRender: {
|
|
110
|
+
type: [Function, Object, Boolean, Array],
|
|
111
|
+
default: () => {
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
useDefaultScrollStyle: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: () => !1
|
|
117
|
+
},
|
|
118
|
+
emptyText: {
|
|
119
|
+
type: [Function, Object, Boolean, Array],
|
|
120
|
+
default: () => {
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
showLoading: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: !0
|
|
126
|
+
},
|
|
127
|
+
tableProps: {
|
|
128
|
+
type: Object,
|
|
129
|
+
default: () => ({
|
|
130
|
+
style: {}
|
|
131
|
+
})
|
|
132
|
+
},
|
|
133
|
+
emptyTextProps: {
|
|
134
|
+
type: Object,
|
|
135
|
+
default: () => ({
|
|
136
|
+
style: {}
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* @Author gx12358
|
|
141
|
+
* @DateTime 2022/2/8
|
|
142
|
+
* @lastTime 2022/2/8
|
|
143
|
+
* @description 渲染按钮工具栏,支持返回一个 dom 数组,会自动增加 margin-right
|
|
144
|
+
*/
|
|
145
|
+
toolBarBtn: {
|
|
146
|
+
type: [Object, Function, Boolean, Array],
|
|
147
|
+
default: () => {
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
// 表格标题
|
|
151
|
+
headerTitle: {
|
|
152
|
+
type: [Object, Function, Boolean, String, Array],
|
|
153
|
+
default: () => {
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
// 标题提示
|
|
157
|
+
titleTip: {
|
|
158
|
+
type: [Object, Function, Boolean, String, Array],
|
|
159
|
+
default: () => {
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
// 标题提示字
|
|
163
|
+
titleTipText: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: "这是一个标题提示"
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* @Author gx12358
|
|
169
|
+
* @DateTime 2022/2/8
|
|
170
|
+
* @lastTime 2022/2/8
|
|
171
|
+
* @description table 工具栏,设为 false 时不显示
|
|
172
|
+
*/
|
|
173
|
+
options: {
|
|
174
|
+
type: [Object, Boolean],
|
|
175
|
+
default: !1
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* @Author gx12358
|
|
179
|
+
* @DateTime 2022/2/8
|
|
180
|
+
* @lastTime 2022/2/8
|
|
181
|
+
* @description 列状态配置,可以配置是否浮动和是否展示
|
|
182
|
+
*/
|
|
183
|
+
columnsState: {
|
|
184
|
+
type: Object
|
|
185
|
+
},
|
|
186
|
+
// table 工具栏 额外的元素
|
|
187
|
+
optionsExtra: {
|
|
188
|
+
type: [Function, Object, Array],
|
|
189
|
+
default: () => {
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* @Author gx12358
|
|
194
|
+
* @DateTime 2022/2/8
|
|
195
|
+
* @lastTime 2022/2/8
|
|
196
|
+
* @description 列设置额外的元素
|
|
197
|
+
*/
|
|
198
|
+
settingExtra: {
|
|
199
|
+
type: [Object, Function, Array],
|
|
200
|
+
default: () => {
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
// 针对 keepalive 缓存的页面 是否重新reload
|
|
204
|
+
keepAliveReload: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: !1
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* @Author gx12358
|
|
210
|
+
* @DateTime 2022/2/8
|
|
211
|
+
* @lastTime 2022/2/8
|
|
212
|
+
* @description 是否展示序号栏
|
|
213
|
+
*/
|
|
214
|
+
showIndex: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
default: !1
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* @Author gx12358
|
|
220
|
+
* @DateTime 2024/11/15
|
|
221
|
+
* @lastTime 2024/11/15
|
|
222
|
+
* @description 是否已card分割
|
|
223
|
+
*/
|
|
224
|
+
cardBordered: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: !1
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* @Author gx12358
|
|
230
|
+
* @DateTime 2022/2/8
|
|
231
|
+
* @lastTime 2022/2/8
|
|
232
|
+
* @description 翻页item设置
|
|
233
|
+
*/
|
|
234
|
+
pageItemRender: {
|
|
235
|
+
type: [Function, Object, Array],
|
|
236
|
+
default: () => {
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* @Author gx12358
|
|
241
|
+
* @DateTime 2022/2/8
|
|
242
|
+
* @lastTime 2022/2/8
|
|
243
|
+
* @description 表格大小
|
|
244
|
+
*/
|
|
245
|
+
size: {
|
|
246
|
+
type: String,
|
|
247
|
+
default: "middle"
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* @Author gx12358
|
|
251
|
+
* @DateTime 2022/2/8
|
|
252
|
+
* @lastTime 2022/2/8
|
|
253
|
+
* @description 表格全局对齐方式
|
|
254
|
+
*/
|
|
255
|
+
align: {
|
|
256
|
+
type: String,
|
|
257
|
+
default: "left"
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* @Author gx12358
|
|
261
|
+
* @DateTime 2022/2/8
|
|
262
|
+
* @lastTime 2022/2/8
|
|
263
|
+
* @description 是否列拖动
|
|
264
|
+
*/
|
|
265
|
+
draggable: Boolean,
|
|
266
|
+
/**
|
|
267
|
+
* @Author gx12358
|
|
268
|
+
* @DateTime 2022/2/8
|
|
269
|
+
* @lastTime 2022/2/8
|
|
270
|
+
* @description 根据屏幕大小或者scrollBreakpoint或者scroll?.x是否存在判断action列是否固定
|
|
271
|
+
*/
|
|
272
|
+
autoScroll: {
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: !0
|
|
275
|
+
},
|
|
276
|
+
/**
|
|
277
|
+
* @Author gx12358
|
|
278
|
+
* @DateTime 2022/2/8
|
|
279
|
+
* @lastTime 2022/2/8
|
|
280
|
+
* @description 滚动断点支持数字(屏幕宽度);也支持md、xl,xxl等
|
|
281
|
+
*/
|
|
282
|
+
scrollBreakpoint: [String, Number],
|
|
283
|
+
/**
|
|
284
|
+
* @Author gx12358
|
|
285
|
+
* @DateTime 2022/2/8
|
|
286
|
+
* @lastTime 2022/2/8
|
|
287
|
+
* @description modalTable时,自动固定滚动高度
|
|
288
|
+
*/
|
|
289
|
+
modalScroll: Boolean,
|
|
290
|
+
/**
|
|
291
|
+
* @Author gx12358
|
|
292
|
+
* @DateTime 2022/2/8
|
|
293
|
+
* @lastTime 2022/2/8
|
|
294
|
+
* @description 从不滚动
|
|
295
|
+
*/
|
|
296
|
+
neverScroll: Boolean,
|
|
297
|
+
/**
|
|
298
|
+
* @Author gx12358
|
|
299
|
+
* @DateTime 2022/2/8
|
|
300
|
+
* @lastTime 2022/2/8
|
|
301
|
+
* @description 空值时的显示,不设置时显示 -, false 可以关闭此功能
|
|
302
|
+
*/
|
|
303
|
+
columnEmptyText: {
|
|
304
|
+
type: [String, Boolean],
|
|
305
|
+
default: !1
|
|
306
|
+
},
|
|
307
|
+
/**
|
|
308
|
+
* @Author gx12358
|
|
309
|
+
* @DateTime 2022/2/8
|
|
310
|
+
* @lastTime 2022/2/8
|
|
311
|
+
* @description Pro-Table 的方法
|
|
312
|
+
*/
|
|
313
|
+
// 对通过 request 获取的数据进行处理
|
|
314
|
+
postData: Function,
|
|
315
|
+
onReset: Function,
|
|
316
|
+
onReload: Function,
|
|
317
|
+
onSubmit: Function,
|
|
318
|
+
onSizeChange: Function,
|
|
319
|
+
onLoadingChange: Function,
|
|
320
|
+
onRequestError: Function,
|
|
321
|
+
onBeforeSearchSubmit: Function,
|
|
322
|
+
onColumnsStateChange: Function
|
|
323
|
+
}, ta = /* @__PURE__ */ ne({
|
|
324
|
+
name: "RequestSelect",
|
|
325
|
+
props: {
|
|
326
|
+
fetch: Function,
|
|
327
|
+
loading: Boolean,
|
|
328
|
+
debounceTime: Number,
|
|
329
|
+
manual: {
|
|
330
|
+
type: Boolean,
|
|
331
|
+
default: void 0
|
|
332
|
+
},
|
|
333
|
+
fieldName: {
|
|
334
|
+
type: String,
|
|
335
|
+
default: "options"
|
|
336
|
+
},
|
|
337
|
+
notFoundContent: {
|
|
338
|
+
type: Function
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
setup(e, {
|
|
342
|
+
slots: a
|
|
343
|
+
}) {
|
|
344
|
+
const l = P([]), n = P(e.loading ?? !1), u = P("init"), o = Nl(e.fetch, e.debounceTime || 10);
|
|
345
|
+
return N([() => e.fetch, () => e.manual], () => {
|
|
346
|
+
if (u.value !== "init" && n.value) return;
|
|
347
|
+
const c = e.manual ?? !1;
|
|
348
|
+
e.fetch && !c && (n.value = !0, o().then((h) => {
|
|
349
|
+
l.value = jt(h), u.value = "success";
|
|
350
|
+
}).catch((h) => {
|
|
351
|
+
console.error(h), u.value = "error";
|
|
352
|
+
}).finally(() => {
|
|
353
|
+
n.value = !1;
|
|
354
|
+
}));
|
|
355
|
+
}, {
|
|
356
|
+
immediate: !0
|
|
357
|
+
}), () => {
|
|
358
|
+
const c = a.default?.();
|
|
359
|
+
return Ve(V(c) ? c[0] : c, {
|
|
360
|
+
options: l.value,
|
|
361
|
+
notFoundContent: e.notFoundContent?.(n.value)
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
function la(e, a) {
|
|
367
|
+
const l = be({});
|
|
368
|
+
function n() {
|
|
369
|
+
Object.keys(e).forEach((c) => {
|
|
370
|
+
u(c, e[c]);
|
|
371
|
+
});
|
|
372
|
+
const o = a.find((c) => c.valueType === "dateRange");
|
|
373
|
+
o && u(o.name || "", e[o.rangeStartName || "start"] ? [
|
|
374
|
+
e[o.rangeStartName || "start"],
|
|
375
|
+
e[o.rangeEndName || "end"]
|
|
376
|
+
] : []);
|
|
377
|
+
}
|
|
378
|
+
Ne(() => {
|
|
379
|
+
n();
|
|
380
|
+
});
|
|
381
|
+
function u(o, c) {
|
|
382
|
+
l[o] = c;
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
formState: l,
|
|
386
|
+
resetFormState: n,
|
|
387
|
+
changeFormState: u
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
const aa = (e) => ({
|
|
391
|
+
[`${e.componentCls}-search`]: {
|
|
392
|
+
position: "relative",
|
|
393
|
+
display: "flex",
|
|
394
|
+
flexWrap: "wrap",
|
|
395
|
+
alignItems: "center",
|
|
396
|
+
"&-border": {
|
|
397
|
+
paddingInline: e.paddingMD,
|
|
398
|
+
paddingBlock: e.paddingMD,
|
|
399
|
+
paddingBlockEnd: e.paddingMD - 16,
|
|
400
|
+
border: `${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,
|
|
401
|
+
borderRadius: e.borderRadiusLG,
|
|
402
|
+
marginBottom: e.marginLG,
|
|
403
|
+
backgroundColor: Ft(e, e.colorBgContainer)
|
|
404
|
+
},
|
|
405
|
+
"&-collapse-buttons": {
|
|
406
|
+
display: "flex",
|
|
407
|
+
alignItems: "center",
|
|
408
|
+
height: e.controlHeight,
|
|
409
|
+
marginBottom: e.margin,
|
|
410
|
+
fontSize: e.fontSize,
|
|
411
|
+
lineHeight: e.lineHeight
|
|
412
|
+
},
|
|
413
|
+
[`${e.componentCls}-search-item`]: {
|
|
414
|
+
display: "flex",
|
|
415
|
+
alignItems: "center",
|
|
416
|
+
marginBottom: e.margin,
|
|
417
|
+
[`${e.componentCls}-search-input-compact`]: {
|
|
418
|
+
display: "flex",
|
|
419
|
+
alignItems: "center",
|
|
420
|
+
[`${e.antCls}-input-number`]: {
|
|
421
|
+
flex: 1,
|
|
422
|
+
"&:first-child": {
|
|
423
|
+
borderRightWidth: 0,
|
|
424
|
+
"&:hover": {
|
|
425
|
+
borderRightWidth: 1
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
"&:last-child": {
|
|
429
|
+
borderLeftWidth: 0,
|
|
430
|
+
"&:hover": {
|
|
431
|
+
borderLeftWidth: 1
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
[`${e.antCls}-input`]: {
|
|
436
|
+
width: 30,
|
|
437
|
+
borderLeftWidth: 0,
|
|
438
|
+
borderRightWidth: 0,
|
|
439
|
+
backgroundColor: "transparent",
|
|
440
|
+
cursor: "default"
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
"&-label": {
|
|
444
|
+
flexShrink: 0,
|
|
445
|
+
"&::after": {
|
|
446
|
+
content: '":"',
|
|
447
|
+
position: "relative",
|
|
448
|
+
marginBlock: 0,
|
|
449
|
+
marginInlineStart: e.marginXXS / 2,
|
|
450
|
+
marginInlineEnd: e.marginXS
|
|
451
|
+
},
|
|
452
|
+
[`&${e.componentCls}-search-item-label-no-colon::after`]: {
|
|
453
|
+
content: '" "'
|
|
454
|
+
},
|
|
455
|
+
[`&${e.componentCls}-search-item-label-left`]: {
|
|
456
|
+
textAlign: "left"
|
|
457
|
+
},
|
|
458
|
+
[`&${e.componentCls}-search-item-label-center`]: {
|
|
459
|
+
textAlign: "center"
|
|
460
|
+
},
|
|
461
|
+
[`&${e.componentCls}-search-item-label-right`]: {
|
|
462
|
+
textAlign: "right"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"&-children": {
|
|
466
|
+
width: "100%"
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
[`${e.componentCls}-search-empty-text`]: {
|
|
471
|
+
display: "flex",
|
|
472
|
+
flexDirection: "column",
|
|
473
|
+
justifyContent: "center",
|
|
474
|
+
alignItems: "center"
|
|
475
|
+
}
|
|
476
|
+
}), Xe = [
|
|
477
|
+
{ value: "xxl", span: 4 },
|
|
478
|
+
{ value: "xl", span: 3 },
|
|
479
|
+
{ value: "lg", span: 2 },
|
|
480
|
+
{ value: "md", span: 2 },
|
|
481
|
+
{ value: "sm", span: 2 },
|
|
482
|
+
{ value: "xs", span: 1 }
|
|
483
|
+
];
|
|
484
|
+
function me(e, a) {
|
|
485
|
+
return typeof a == "function" ? a(H(e)) : H(e).format(a);
|
|
486
|
+
}
|
|
487
|
+
function Pe(e, a) {
|
|
488
|
+
return a ? "YYYY-MM-DD HH:mm:ss" : e ?? "YYYY-MM-DD";
|
|
489
|
+
}
|
|
490
|
+
const St = (e, a, l = "string") => {
|
|
491
|
+
if (V(e)) {
|
|
492
|
+
const [n, u] = e;
|
|
493
|
+
let o, c;
|
|
494
|
+
if (Array.isArray(a) ? (o = a[0], c = a[1]) : typeof a == "object" && a.type === "mask" ? (o = a.format, c = a.format) : (o = a, c = a), l === "string") {
|
|
495
|
+
const h = n ? me(n, o) : "", x = u ? me(u, c) : "";
|
|
496
|
+
return [h, x];
|
|
497
|
+
}
|
|
498
|
+
return [H(n), H(u)];
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
function na(e) {
|
|
502
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
503
|
+
}
|
|
504
|
+
const {
|
|
505
|
+
useBreakpoint: oa
|
|
506
|
+
} = at, {
|
|
507
|
+
MonthPicker: ia,
|
|
508
|
+
RangePicker: ua,
|
|
509
|
+
YearPicker: sa,
|
|
510
|
+
WeekPicker: ra,
|
|
511
|
+
QuarterPicker: ca
|
|
512
|
+
} = Ot;
|
|
513
|
+
function da(e) {
|
|
514
|
+
let a = e.reduce((l, n) => n.order !== void 0 ? Math.max(l, n.order) : l, 0);
|
|
515
|
+
return e.forEach((l) => {
|
|
516
|
+
l.order === void 0 && (a += 1, l.order = a);
|
|
517
|
+
}), e.sort((l, n) => l.order - n.order), e;
|
|
518
|
+
}
|
|
519
|
+
const fa = {
|
|
520
|
+
modal: ce.modalScroll,
|
|
521
|
+
searchMap: {
|
|
522
|
+
type: Array,
|
|
523
|
+
default: () => []
|
|
524
|
+
},
|
|
525
|
+
loading: ce.loading,
|
|
526
|
+
cardBordered: ce.cardBordered,
|
|
527
|
+
prefixCls: String,
|
|
528
|
+
defaultParams: Object,
|
|
529
|
+
onSearch: Function
|
|
530
|
+
}, Et = /* @__PURE__ */ ne({
|
|
531
|
+
name: "ProTableForm",
|
|
532
|
+
props: fa,
|
|
533
|
+
setup(e, {
|
|
534
|
+
slots: a,
|
|
535
|
+
expose: l
|
|
536
|
+
}) {
|
|
537
|
+
const {
|
|
538
|
+
wrapSSR: n,
|
|
539
|
+
hashId: u
|
|
540
|
+
} = He("ProTableForm", [aa], e.prefixCls), o = Rt(), c = oa(), {
|
|
541
|
+
manualSearch: h,
|
|
542
|
+
searchConfig: x,
|
|
543
|
+
searchActions: y
|
|
544
|
+
} = fe(), {
|
|
545
|
+
formState: r,
|
|
546
|
+
resetFormState: C,
|
|
547
|
+
changeFormState: d
|
|
548
|
+
} = la(e.defaultParams || {}, e.searchMap || []), m = P(x.value?.collapsed ?? x.value?.defaultCollapsed), b = S(() => le(y.value?.reset) ? y.value?.reset : h.value), v = S(() => I(x.value?.span)), F = S(() => x.value?.label);
|
|
549
|
+
N(() => x.value?.collapsed, (t) => {
|
|
550
|
+
m.value = t;
|
|
551
|
+
});
|
|
552
|
+
function I(t) {
|
|
553
|
+
let f = 4;
|
|
554
|
+
for (let R = 0; R < Xe.length; R += 1) {
|
|
555
|
+
const $ = Xe[R].value;
|
|
556
|
+
if (c.value[$]) {
|
|
557
|
+
f = t?.[$] || (e.modal ? 3 : Xe[R].span);
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return f;
|
|
562
|
+
}
|
|
563
|
+
const k = (t) => {
|
|
564
|
+
m.value = t;
|
|
565
|
+
}, E = (t, f, R) => (t + 1) % f === 0 ? {
|
|
566
|
+
...R,
|
|
567
|
+
marginRight: 0
|
|
568
|
+
} : {
|
|
569
|
+
...R,
|
|
570
|
+
marginRight: "2%"
|
|
571
|
+
}, L = () => {
|
|
572
|
+
const t = jt(r), f = e.searchMap.find((T) => T.valueType === "text") || "", R = e.searchMap.find((T) => T.valueType === "dateRange") || "", $ = e.searchMap.find((T) => T.valueType === "treeSelect");
|
|
573
|
+
return f && (t[f.name] = r[f.name] || f.initialValue || ""), R && (t[R.rangeStartName || "start"] = t[R.name] ? t[R.name][0] : "", t[R.rangeEndName || "end"] = t[R.name] ? t[R.name][1] : "", delete t[R.name]), $ && ($?.name && V(r[$?.name]) && (t[$.name] = r[$.name].length ? r[$.name].map((T) => T[$.valueKey === "text" ? "label" : "value"]).join() : ""), $?.name && V(t[$?.name]) && (t[$.name] = t[$.name].length ? t[$.name].map((T) => T[$.valueKey === "text" ? "label" : "value"]) : "")), t;
|
|
574
|
+
}, W = (t = !1, f) => {
|
|
575
|
+
(!h.value || t) && e.onSearch?.(L(), t ? f ? "reset" : "submit" : void 0);
|
|
576
|
+
}, O = (t, f, R) => {
|
|
577
|
+
const $ = r[f.name || ""];
|
|
578
|
+
switch (f.valueType) {
|
|
579
|
+
case "text":
|
|
580
|
+
d(f.name || "", t || "");
|
|
581
|
+
break;
|
|
582
|
+
case "number":
|
|
583
|
+
d(f.name || "", t || void 0);
|
|
584
|
+
break;
|
|
585
|
+
case "numberRange":
|
|
586
|
+
De(R?.key) && ($[R.key] = t, d(f.name || "", $ || []));
|
|
587
|
+
break;
|
|
588
|
+
case "select":
|
|
589
|
+
d(f.name || "", t ?? void 0);
|
|
590
|
+
break;
|
|
591
|
+
case "treeSelect":
|
|
592
|
+
d(f.name || "", t ?? (f.field?.treeCheckable || f.field?.multiple ? [] : null));
|
|
593
|
+
break;
|
|
594
|
+
case "date":
|
|
595
|
+
d(f.name || "", t ? me(t, Pe(f.valueFormat, f.showTime)) : null);
|
|
596
|
+
break;
|
|
597
|
+
case "dateWeek":
|
|
598
|
+
d(f.name || "", t ? me(t, "YYYY-wo") : null);
|
|
599
|
+
break;
|
|
600
|
+
case "dateMonth":
|
|
601
|
+
d(f.name || "", t ? me(t, "YYYY-MM") : null);
|
|
602
|
+
break;
|
|
603
|
+
case "dateQuarter":
|
|
604
|
+
d(f.name || "", t ? me(t, "YYYY-QQ") : null);
|
|
605
|
+
break;
|
|
606
|
+
case "dateYear":
|
|
607
|
+
d(f.name || "", t ? me(t, "YYYY") : null);
|
|
608
|
+
break;
|
|
609
|
+
case "dateRange":
|
|
610
|
+
d(f.name || "", t && V(t) && t.length === 2 ? St(t, Pe(f.valueFormat, f.showTime)) : null);
|
|
611
|
+
break;
|
|
612
|
+
case "time":
|
|
613
|
+
d(f.name || "", t ? me(t, f.valueFormat || "HH:mm:ss") : null);
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
f.valueType === "treeSelect" || f.valueType, W();
|
|
617
|
+
}, j = (t = !0) => {
|
|
618
|
+
C(), W(!0, t);
|
|
619
|
+
};
|
|
620
|
+
l({
|
|
621
|
+
getFormState: () => L(),
|
|
622
|
+
resetForm: j
|
|
623
|
+
});
|
|
624
|
+
const D = () => {
|
|
625
|
+
const t = o?.emptyText?.value;
|
|
626
|
+
if (t) {
|
|
627
|
+
const f = U(t), R = f ? Tt(t) : Bt(t || []);
|
|
628
|
+
return i("div", {
|
|
629
|
+
class: re(`${e.prefixCls}-search-empty-text`, u.value)
|
|
630
|
+
}, [f ? R : V(R) ? R.map(($) => Ve($)) : void 0]);
|
|
631
|
+
}
|
|
632
|
+
}, ee = () => (h.value || b.value) && i(ge, null, {
|
|
633
|
+
default: () => [b.value && i(Ct, {
|
|
634
|
+
onClick: () => j()
|
|
635
|
+
}, {
|
|
636
|
+
default: () => [y.value?.resetText || "重置"]
|
|
637
|
+
}), h.value && i(Ct, {
|
|
638
|
+
loading: e.loading,
|
|
639
|
+
type: "primary",
|
|
640
|
+
onClick: () => W(!0)
|
|
641
|
+
}, {
|
|
642
|
+
default: () => [y.value?.searchText || "查询"]
|
|
643
|
+
})]
|
|
644
|
+
}), oe = ({
|
|
645
|
+
formItemStyle: t,
|
|
646
|
+
collapsed: f,
|
|
647
|
+
collapseRender: R = !0
|
|
648
|
+
}) => i("div", {
|
|
649
|
+
style: t,
|
|
650
|
+
class: `${e.prefixCls}-search-collapse-buttons ${u.value}`
|
|
651
|
+
}, [i(ge, {
|
|
652
|
+
size: 16
|
|
653
|
+
}, {
|
|
654
|
+
default: () => [ee(), x.value?.collapseRender !== !1 && R && i(ke, null, [typeof x.value?.collapseRender == "function" ? x.value?.collapseRender(f) : i("span", {
|
|
655
|
+
class: `${e.prefixCls}-a ${u.value}`,
|
|
656
|
+
onClick: () => k(!f)
|
|
657
|
+
}, [f ? "收起" : "展开", f ? i(hl, null, null) : i(ml, null, null)])])]
|
|
658
|
+
})]);
|
|
659
|
+
function ie(t) {
|
|
660
|
+
return t === void 0 ? void 0 : t ? i(Dt, {
|
|
661
|
+
size: "small",
|
|
662
|
+
indicator: o?.indicator?.value
|
|
663
|
+
}, null) : D();
|
|
664
|
+
}
|
|
665
|
+
function ae(t, f) {
|
|
666
|
+
return i(ta, M(t.request, {
|
|
667
|
+
loading: t.loading,
|
|
668
|
+
notFoundContent: ie
|
|
669
|
+
}), na(f) ? f : {
|
|
670
|
+
default: () => [f]
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
const pe = (t) => {
|
|
674
|
+
let f;
|
|
675
|
+
const R = h.value ? Ke : Ke.Search, $ = je(t.field || {}, "rules");
|
|
676
|
+
let T = null;
|
|
677
|
+
switch (t.valueType) {
|
|
678
|
+
case "text":
|
|
679
|
+
f = i(R, M({
|
|
680
|
+
style: {
|
|
681
|
+
width: "100%"
|
|
682
|
+
},
|
|
683
|
+
value: r[t.name],
|
|
684
|
+
placeholder: t.placeholder || "请输入",
|
|
685
|
+
allowClear: t.allowClear ?? !0,
|
|
686
|
+
onChange: (s) => O(s.target.value, t),
|
|
687
|
+
onSearch: (s) => W()
|
|
688
|
+
}, $), null);
|
|
689
|
+
break;
|
|
690
|
+
case "number":
|
|
691
|
+
f = i(Qe, M({
|
|
692
|
+
style: {
|
|
693
|
+
width: "100%"
|
|
694
|
+
},
|
|
695
|
+
value: r[t.name],
|
|
696
|
+
placeholder: t.placeholder || "请输入",
|
|
697
|
+
onChange: (s) => O(s, t)
|
|
698
|
+
}, $), null);
|
|
699
|
+
break;
|
|
700
|
+
case "numberRange":
|
|
701
|
+
f = i(Ke.Group, {
|
|
702
|
+
compact: !0,
|
|
703
|
+
class: re(u.value, `${e.prefixCls}-search-input-compact`)
|
|
704
|
+
}, {
|
|
705
|
+
default: () => [i(Qe, {
|
|
706
|
+
value: r[t.name]?.[0],
|
|
707
|
+
onChange: (s) => O(s, t, {
|
|
708
|
+
key: 0
|
|
709
|
+
}),
|
|
710
|
+
placeholder: V(t.placeholder) && t.placeholder?.[0] || "请输入"
|
|
711
|
+
}, null), i(Ke, {
|
|
712
|
+
disabled: !0,
|
|
713
|
+
placeholder: "~"
|
|
714
|
+
}, null), i(Qe, {
|
|
715
|
+
value: r[t.name]?.[1],
|
|
716
|
+
onChange: (s) => O(s, t, {
|
|
717
|
+
key: 1
|
|
718
|
+
}),
|
|
719
|
+
placeholder: V(t.placeholder) && t.placeholder?.[1] || "请输入"
|
|
720
|
+
}, null)]
|
|
721
|
+
});
|
|
722
|
+
break;
|
|
723
|
+
case "select":
|
|
724
|
+
T = i(Yl, M({
|
|
725
|
+
style: {
|
|
726
|
+
width: "100%"
|
|
727
|
+
},
|
|
728
|
+
value: t.loading ? void 0 : r[t.name],
|
|
729
|
+
optionFilterProp: "label",
|
|
730
|
+
placeholder: t.placeholder || "请选择",
|
|
731
|
+
showSearch: t.showSearch,
|
|
732
|
+
allowClear: t.allowClear ?? !0,
|
|
733
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
734
|
+
notFoundContent: ie(t.loading),
|
|
735
|
+
onChange: (s) => O(s, t),
|
|
736
|
+
options: t.loading ? [] : t?.valueEnum || []
|
|
737
|
+
}, $), null);
|
|
738
|
+
break;
|
|
739
|
+
case "treeSelect":
|
|
740
|
+
T = i(zl, M({
|
|
741
|
+
style: {
|
|
742
|
+
width: "100%"
|
|
743
|
+
},
|
|
744
|
+
value: r[t.name],
|
|
745
|
+
placeholder: t.placeholder || "请选择",
|
|
746
|
+
allowClear: t.allowClear ?? !0,
|
|
747
|
+
treeData: t.loading ? [] : t.valueEnum || [],
|
|
748
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
749
|
+
notFoundContent: ie(t.loading),
|
|
750
|
+
onChange: (s) => O(s, t)
|
|
751
|
+
}, $), null);
|
|
752
|
+
break;
|
|
753
|
+
case "date":
|
|
754
|
+
f = i(Ot, M({
|
|
755
|
+
style: {
|
|
756
|
+
width: "100%"
|
|
757
|
+
},
|
|
758
|
+
value: r[t.name] ? H(r[t.name]) : void 0,
|
|
759
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
760
|
+
placeholder: t.placeholder || "请选择",
|
|
761
|
+
allowClear: t.allowClear ?? !0,
|
|
762
|
+
format: Pe(t.valueFormat, t.showTime),
|
|
763
|
+
showTime: t.showTime,
|
|
764
|
+
showToday: t.showToday || !0,
|
|
765
|
+
onChange: (s) => O(s, t)
|
|
766
|
+
}, $), null);
|
|
767
|
+
break;
|
|
768
|
+
case "dateWeek":
|
|
769
|
+
f = i(ra, M({
|
|
770
|
+
style: {
|
|
771
|
+
width: "100%"
|
|
772
|
+
},
|
|
773
|
+
value: r[t.name] ? H(r[t.name], t.valueFormat || "YYYY-wo") : void 0,
|
|
774
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
775
|
+
allowClear: t.allowClear ?? !0,
|
|
776
|
+
placeholder: t.placeholder || "请选择",
|
|
777
|
+
onChange: (s) => O(s, t)
|
|
778
|
+
}, $), null);
|
|
779
|
+
break;
|
|
780
|
+
case "dateMonth":
|
|
781
|
+
f = i(ia, M({
|
|
782
|
+
style: {
|
|
783
|
+
width: "100%"
|
|
784
|
+
},
|
|
785
|
+
value: r[t.name] ? H(r[t.name], t.valueFormat || "YYYY-MM") : void 0,
|
|
786
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
787
|
+
allowClear: t.allowClear ?? !0,
|
|
788
|
+
placeholder: t.placeholder || "请选择",
|
|
789
|
+
onChange: (s) => O(s, t)
|
|
790
|
+
}, $), null);
|
|
791
|
+
break;
|
|
792
|
+
case "dateQuarter":
|
|
793
|
+
f = i(ca, M({
|
|
794
|
+
style: {
|
|
795
|
+
width: "100%"
|
|
796
|
+
},
|
|
797
|
+
value: r[t.name] ? H(r[t.name], t.valueFormat || "YYYY-QQ") : void 0,
|
|
798
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
799
|
+
allowClear: t.allowClear ?? !0,
|
|
800
|
+
placeholder: t.placeholder || "请选择",
|
|
801
|
+
onChange: (s) => O(s, t)
|
|
802
|
+
}, $), null);
|
|
803
|
+
break;
|
|
804
|
+
case "dateYear":
|
|
805
|
+
f = i(sa, M({
|
|
806
|
+
style: {
|
|
807
|
+
width: "100%"
|
|
808
|
+
},
|
|
809
|
+
value: r[t.name] ? H(r[t.name], t.valueFormat || "YYYY") : void 0,
|
|
810
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
811
|
+
allowClear: t.allowClear ?? !0,
|
|
812
|
+
placeholder: t.placeholder || "请选择",
|
|
813
|
+
onChange: (s) => O(s, t)
|
|
814
|
+
}, $), null);
|
|
815
|
+
break;
|
|
816
|
+
case "dateRange":
|
|
817
|
+
f = i(ua, M({
|
|
818
|
+
style: {
|
|
819
|
+
width: "100%"
|
|
820
|
+
},
|
|
821
|
+
value: r[t.name] && V(r[t.name]) && r[t.name]?.length === 2 ? St(r[t.name], Pe(t.valueFormat, t.showTime), "dayjs") : void 0,
|
|
822
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
823
|
+
placeholder: t.placeholder || ["开始日期", "结束日期"],
|
|
824
|
+
format: Pe(t.valueFormat, t.showTime),
|
|
825
|
+
showTime: t.showTime,
|
|
826
|
+
onChange: (s) => O(s, t)
|
|
827
|
+
}, $), null);
|
|
828
|
+
break;
|
|
829
|
+
case "time":
|
|
830
|
+
f = i(Kl, M({
|
|
831
|
+
style: {
|
|
832
|
+
width: "100%"
|
|
833
|
+
},
|
|
834
|
+
value: r[t.name] ? H(r[t.name], t.valueFormat || "HH:mm:ss") : void 0,
|
|
835
|
+
getPopupContainer: (s) => s && s.parentNode ? s.parentNode : s,
|
|
836
|
+
placeholder: t.placeholder || "请选择",
|
|
837
|
+
allowClear: t.allowClear || t.allowClear === !1 ? t.allowClear : !0,
|
|
838
|
+
use12Hours: t.use12Hours,
|
|
839
|
+
format: t.valueFormat || "HH:mm:ss",
|
|
840
|
+
onChange: (s) => O(s, t)
|
|
841
|
+
}, $), null);
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
return t.valueType && ["select", "treeSelect"].includes(t.valueType) && (f = t.request ? ae(t, T) : T), f;
|
|
845
|
+
}, he = ({
|
|
846
|
+
formItemStyle: t = {},
|
|
847
|
+
item: f
|
|
848
|
+
}) => {
|
|
849
|
+
const R = U(f) ? f.props?.label : f.label, $ = (U(f) ? f.props?.labelWidth : f.labelWidth) || F.value?.width, T = (U(f) ? f.props?.labelAlign : f.labelAlign) || F.value?.align;
|
|
850
|
+
return i("div", {
|
|
851
|
+
class: `${e.prefixCls}-search-item`,
|
|
852
|
+
style: {
|
|
853
|
+
...t,
|
|
854
|
+
gap: F.value?.gap ? yt(F.value?.gap) : void 0
|
|
855
|
+
}
|
|
856
|
+
}, [R && i("div", {
|
|
857
|
+
class: re(`${e.prefixCls}-search-item-label`, F.value?.colon === !1 && `${e.prefixCls}-search-item-label-no-colon`, T && `${e.prefixCls}-search-item-label-${T}`),
|
|
858
|
+
style: {
|
|
859
|
+
width: $ ? yt($) : void 0
|
|
860
|
+
}
|
|
861
|
+
}, [R]), i("div", {
|
|
862
|
+
class: re(`${e.prefixCls}-search-item-children`)
|
|
863
|
+
}, [U(f) ? f : pe(f)])]);
|
|
864
|
+
}, Te = () => {
|
|
865
|
+
let t = a.default?.() || [];
|
|
866
|
+
t.length === 1 && t[0].type === "template" && (t = t[0]?.children || []);
|
|
867
|
+
const f = da([...e.searchMap, ...t.map(($) => ({
|
|
868
|
+
...$,
|
|
869
|
+
order: $.props?.order || void 0
|
|
870
|
+
}))]), R = {
|
|
871
|
+
width: `${(100 - (v.value - 1) * 2) / v.value}%`
|
|
872
|
+
};
|
|
873
|
+
return f.map(($, T) => {
|
|
874
|
+
const s = E(T, v.value, R);
|
|
875
|
+
return f.length < v.value || m.value ? i(ke, null, [he({
|
|
876
|
+
formItemStyle: s,
|
|
877
|
+
item: $
|
|
878
|
+
}), T === f.length - 1 && oe({
|
|
879
|
+
formItemStyle: {
|
|
880
|
+
flex: 1,
|
|
881
|
+
justifyContent: "flex-end"
|
|
882
|
+
},
|
|
883
|
+
collapsed: m.value,
|
|
884
|
+
collapseRender: !!m.value
|
|
885
|
+
})]) : i(ke, null, [T < v.value - 1 && he({
|
|
886
|
+
formItemStyle: s,
|
|
887
|
+
item: $
|
|
888
|
+
}), T === v.value - 1 && (v.value - 1 === 0 || f.length === v.value) && he({
|
|
889
|
+
formItemStyle: s,
|
|
890
|
+
item: $
|
|
891
|
+
}), T === v.value - 1 && f.length >= v.value && oe({
|
|
892
|
+
formItemStyle: {
|
|
893
|
+
flex: 1,
|
|
894
|
+
justifyContent: "flex-end"
|
|
895
|
+
},
|
|
896
|
+
collapsed: !1,
|
|
897
|
+
collapseRender: f.length !== v.value
|
|
898
|
+
})]);
|
|
899
|
+
});
|
|
900
|
+
};
|
|
901
|
+
return () => {
|
|
902
|
+
const t = e.cardBordered && `${e.prefixCls}-search-border`;
|
|
903
|
+
return n(i("div", {
|
|
904
|
+
class: re(u.value, `${e.prefixCls}-search`, t, u.value, x.value?.className)
|
|
905
|
+
}, [Te()]));
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
Et.inheritAttrs = !1;
|
|
910
|
+
const Oe = (e) => {
|
|
911
|
+
const a = P(null);
|
|
912
|
+
return a.value = e, (...l) => a.value?.(...l);
|
|
913
|
+
}, ha = (e) => ({
|
|
914
|
+
[`${e.componentCls}`]: {
|
|
915
|
+
width: "auto",
|
|
916
|
+
"&-title": {
|
|
917
|
+
display: "flex",
|
|
918
|
+
alignItems: "center",
|
|
919
|
+
justifyContent: "space-between",
|
|
920
|
+
height: 32
|
|
921
|
+
},
|
|
922
|
+
"&-overlay": {
|
|
923
|
+
[`${e.antCls}-popover-inner-content`]: {
|
|
924
|
+
width: "200px",
|
|
925
|
+
paddingBlock: 0,
|
|
926
|
+
paddingInline: 0,
|
|
927
|
+
paddingBlockEnd: 8
|
|
928
|
+
},
|
|
929
|
+
[`${e.antCls}-tree-node-content-wrapper:hover`]: {
|
|
930
|
+
backgroundColor: "transparent"
|
|
931
|
+
},
|
|
932
|
+
[`${e.antCls}-tree-draggable-icon`]: { cursor: "grab" },
|
|
933
|
+
[`${e.antCls}-tree-switcher`]: { display: "none" },
|
|
934
|
+
[`${e.antCls}-tree-treenode`]: {
|
|
935
|
+
alignItems: "center",
|
|
936
|
+
"&:hover": {
|
|
937
|
+
[`${e.componentCls}-list-item-option`]: {
|
|
938
|
+
display: "block"
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
[`${e.antCls}-tree-checkbox`]: {
|
|
942
|
+
marginInlineEnd: "4px",
|
|
943
|
+
alignSelf: "flex-start"
|
|
944
|
+
},
|
|
945
|
+
[`${e.antCls}-tree-title`]: {
|
|
946
|
+
width: "100%"
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
[`${e.componentCls}-action-rest-button`]: {
|
|
952
|
+
color: e.colorPrimary
|
|
953
|
+
},
|
|
954
|
+
[`${e.componentCls}-list`]: {
|
|
955
|
+
display: "flex",
|
|
956
|
+
flexDirection: "column",
|
|
957
|
+
width: "100%",
|
|
958
|
+
paddingBlockStart: 8,
|
|
959
|
+
[`&${e.componentCls}-list-group`]: {
|
|
960
|
+
paddingBlockStart: 0
|
|
961
|
+
},
|
|
962
|
+
"&-title": {
|
|
963
|
+
marginBlockStart: "6px",
|
|
964
|
+
marginBlockEnd: "6px",
|
|
965
|
+
paddingInlineStart: "24px",
|
|
966
|
+
color: e.colorTextSecondary,
|
|
967
|
+
fontSize: "12px"
|
|
968
|
+
},
|
|
969
|
+
"&-item": {
|
|
970
|
+
display: "flex",
|
|
971
|
+
alignItems: "center",
|
|
972
|
+
maxHeight: 24,
|
|
973
|
+
justifyContent: "space-between",
|
|
974
|
+
"&-title": {
|
|
975
|
+
textOverflow: "ellipsis",
|
|
976
|
+
overflow: "hidden",
|
|
977
|
+
wordBreak: "break-all",
|
|
978
|
+
whiteSpace: "nowrap"
|
|
979
|
+
},
|
|
980
|
+
"&-option": {
|
|
981
|
+
display: "none",
|
|
982
|
+
float: "right",
|
|
983
|
+
cursor: "pointer",
|
|
984
|
+
"> span": {
|
|
985
|
+
"> span.anticon": {
|
|
986
|
+
color: e.colorPrimary
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
"> span + span": {
|
|
990
|
+
marginInlineStart: 4
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}), Ue = ({
|
|
996
|
+
title: e,
|
|
997
|
+
show: a,
|
|
998
|
+
treeKey: l,
|
|
999
|
+
fixed: n
|
|
1000
|
+
}, {
|
|
1001
|
+
slots: u
|
|
1002
|
+
}) => {
|
|
1003
|
+
const {
|
|
1004
|
+
cacheColumns: o,
|
|
1005
|
+
settingsAction: c
|
|
1006
|
+
} = fe();
|
|
1007
|
+
return a ? i(de, {
|
|
1008
|
+
title: e
|
|
1009
|
+
}, {
|
|
1010
|
+
default: () => [i("span", {
|
|
1011
|
+
onClick: (h) => {
|
|
1012
|
+
h.stopPropagation(), h.preventDefault();
|
|
1013
|
+
const x = p(o)?.find((d) => d.uuid === l)?.key || "", y = c?.columnsMap[x] || {};
|
|
1014
|
+
if (typeof y.disable == "boolean" ? y.disable : y.disable?.icon) return;
|
|
1015
|
+
const C = {
|
|
1016
|
+
...c?.columnsMap,
|
|
1017
|
+
[x]: {
|
|
1018
|
+
...y,
|
|
1019
|
+
fixed: n
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
c?.setColumnsMap(C, "fixed");
|
|
1023
|
+
}
|
|
1024
|
+
}, [u.default?.()])]
|
|
1025
|
+
}) : null;
|
|
1026
|
+
}, ma = /* @__PURE__ */ ne({
|
|
1027
|
+
props: {
|
|
1028
|
+
treeKey: String,
|
|
1029
|
+
hashId: String,
|
|
1030
|
+
className: String,
|
|
1031
|
+
title: [String, Function, Object, Boolean],
|
|
1032
|
+
autoScroll: [Boolean],
|
|
1033
|
+
fixed: [Boolean, String]
|
|
1034
|
+
},
|
|
1035
|
+
setup(e) {
|
|
1036
|
+
const {
|
|
1037
|
+
cacheColumns: a
|
|
1038
|
+
} = fe(), l = S(() => p(a)?.find((u) => u.uuid === e.treeKey)?.key || ""), n = S(() => l.value === "action" && e.autoScroll);
|
|
1039
|
+
return () => {
|
|
1040
|
+
const u = i("span", {
|
|
1041
|
+
class: [`${e.className}-list-item-option`, e.hashId]
|
|
1042
|
+
}, [i(Ue, {
|
|
1043
|
+
treeKey: e.treeKey || "",
|
|
1044
|
+
fixed: "left",
|
|
1045
|
+
title: "固定在列首",
|
|
1046
|
+
show: e.fixed !== "left" && !n.value
|
|
1047
|
+
}, {
|
|
1048
|
+
default: () => [i(vl, null, null)]
|
|
1049
|
+
}), i(Ue, {
|
|
1050
|
+
treeKey: e.treeKey || "",
|
|
1051
|
+
fixed: void 0,
|
|
1052
|
+
title: "不固定",
|
|
1053
|
+
show: !!e.fixed && !n.value
|
|
1054
|
+
}, {
|
|
1055
|
+
default: () => [i(gl, null, null)]
|
|
1056
|
+
}), i(Ue, {
|
|
1057
|
+
treeKey: e.treeKey || "",
|
|
1058
|
+
fixed: "right",
|
|
1059
|
+
title: "固定在列尾",
|
|
1060
|
+
show: e.fixed !== "right"
|
|
1061
|
+
}, {
|
|
1062
|
+
default: () => [i(pl, null, null)]
|
|
1063
|
+
})]);
|
|
1064
|
+
return i("span", {
|
|
1065
|
+
class: [`${e.className}-list-item`, e.hashId],
|
|
1066
|
+
key: e.treeKey
|
|
1067
|
+
}, [i("div", {
|
|
1068
|
+
class: [`${e.className}-list-item-title`, e.hashId]
|
|
1069
|
+
}, [e.title]), u]);
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
}), Je = /* @__PURE__ */ ne({
|
|
1073
|
+
props: {
|
|
1074
|
+
list: Array,
|
|
1075
|
+
keys: Array,
|
|
1076
|
+
hashId: String,
|
|
1077
|
+
className: String,
|
|
1078
|
+
title: String,
|
|
1079
|
+
checkable: Boolean,
|
|
1080
|
+
draggable: Boolean,
|
|
1081
|
+
showTitle: {
|
|
1082
|
+
type: Boolean,
|
|
1083
|
+
default: !0
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
setup(e) {
|
|
1087
|
+
const a = P(tt().uuid(15)), l = S(() => e.list && e.list.length > 0), n = P([]), u = P([]), {
|
|
1088
|
+
cacheColumns: o,
|
|
1089
|
+
slots: c,
|
|
1090
|
+
settingsAction: h
|
|
1091
|
+
} = fe(), x = (d, m) => d.map(({
|
|
1092
|
+
key: b,
|
|
1093
|
+
children: v,
|
|
1094
|
+
uuid: F,
|
|
1095
|
+
...I
|
|
1096
|
+
}) => {
|
|
1097
|
+
const k = h?.columnsMap[b || "null"] || {
|
|
1098
|
+
show: !0
|
|
1099
|
+
};
|
|
1100
|
+
let E = !1;
|
|
1101
|
+
k.show !== !1 && m?.show !== !1 && !v && (E = !0);
|
|
1102
|
+
const L = {
|
|
1103
|
+
key: F || "",
|
|
1104
|
+
...je(I, ["dataIndex"]),
|
|
1105
|
+
checked: E,
|
|
1106
|
+
selectable: !1,
|
|
1107
|
+
disabled: k.disable === !0,
|
|
1108
|
+
disableCheckbox: typeof k.disable == "boolean" ? k.disable : k.disable?.checkbox,
|
|
1109
|
+
isLeaf: !0
|
|
1110
|
+
};
|
|
1111
|
+
return v && (L.children = x(v, k)), L;
|
|
1112
|
+
});
|
|
1113
|
+
Ne(() => {
|
|
1114
|
+
const d = x(e.list || []);
|
|
1115
|
+
n.value = d, u.value = d.filter((m) => m.checked).map((m) => m.key), h?.operationType.value === "fixed" && (a.value = tt().uuid(15));
|
|
1116
|
+
});
|
|
1117
|
+
const y = Oe((d, m, b) => {
|
|
1118
|
+
const v = p(o).find((j) => j.uuid === d)?.key || "", F = p(o).find((j) => j.uuid === m)?.key || "", I = {
|
|
1119
|
+
...h?.columnsMap
|
|
1120
|
+
}, k = [...h.sortKeyColumns.value], E = k.findIndex((j) => j === v), L = k.findIndex((j) => j === F), W = b > E;
|
|
1121
|
+
if (E < 0)
|
|
1122
|
+
return;
|
|
1123
|
+
const O = k[E];
|
|
1124
|
+
k.splice(E, 1), b === 0 ? k.unshift(O) : k.splice(W ? L : L + 1, 0, O), k.forEach((j, D) => {
|
|
1125
|
+
I[j] = {
|
|
1126
|
+
...I[j] || {},
|
|
1127
|
+
order: D
|
|
1128
|
+
};
|
|
1129
|
+
}), h?.setColumnsMap(I, "drop"), h?.setSortKeyColumns(k);
|
|
1130
|
+
}), r = Oe((d) => {
|
|
1131
|
+
const m = d.node.key, b = p(o).find((k) => k.uuid === m)?.key || "", F = {
|
|
1132
|
+
...h?.columnsMap[b] || {}
|
|
1133
|
+
};
|
|
1134
|
+
F.show = d.checked;
|
|
1135
|
+
const I = {
|
|
1136
|
+
...h?.columnsMap,
|
|
1137
|
+
[b]: F
|
|
1138
|
+
};
|
|
1139
|
+
h?.setColumnsMap(I, "show");
|
|
1140
|
+
}), C = (d) => {
|
|
1141
|
+
const m = p(o).find((b) => b.uuid === d.key);
|
|
1142
|
+
return d.title || ol(c, "headerCell", {
|
|
1143
|
+
title: m.title,
|
|
1144
|
+
column: m
|
|
1145
|
+
}, () => [m.title]);
|
|
1146
|
+
};
|
|
1147
|
+
return () => l.value ? i(ke, null, [e.showTitle && i("span", {
|
|
1148
|
+
class: [`${e.className}-list-title`, e.hashId]
|
|
1149
|
+
}, [e.title]), i(Vl, {
|
|
1150
|
+
key: a.value,
|
|
1151
|
+
draggable: e.draggable && !!n.value?.length && n.value?.length > 1,
|
|
1152
|
+
checkable: e.checkable,
|
|
1153
|
+
blockNode: !0,
|
|
1154
|
+
showLine: !1,
|
|
1155
|
+
checkedKeys: u.value,
|
|
1156
|
+
height: 280,
|
|
1157
|
+
onDrop: (d) => {
|
|
1158
|
+
const m = d.node.key, b = d.dragNode.key, {
|
|
1159
|
+
dropPosition: v,
|
|
1160
|
+
dropToGap: F
|
|
1161
|
+
} = d, I = v === -1 || !F ? v + 1 : v;
|
|
1162
|
+
y(b, m, I);
|
|
1163
|
+
},
|
|
1164
|
+
onCheck: (d, m) => r(m),
|
|
1165
|
+
treeData: n.value
|
|
1166
|
+
}, {
|
|
1167
|
+
title: (d) => {
|
|
1168
|
+
const m = {
|
|
1169
|
+
...d,
|
|
1170
|
+
children: void 0,
|
|
1171
|
+
title: C(d),
|
|
1172
|
+
autoScroll: h?.autoScroll?.value
|
|
1173
|
+
};
|
|
1174
|
+
return i(ma, M({
|
|
1175
|
+
hashId: e.hashId,
|
|
1176
|
+
className: e.className
|
|
1177
|
+
}, m, {
|
|
1178
|
+
treeKey: m.key
|
|
1179
|
+
}), null);
|
|
1180
|
+
}
|
|
1181
|
+
})]) : null;
|
|
1182
|
+
}
|
|
1183
|
+
}), va = /* @__PURE__ */ ne({
|
|
1184
|
+
props: {
|
|
1185
|
+
hashId: String,
|
|
1186
|
+
className: String,
|
|
1187
|
+
draggable: Boolean,
|
|
1188
|
+
checkable: Boolean
|
|
1189
|
+
},
|
|
1190
|
+
setup(e) {
|
|
1191
|
+
const {
|
|
1192
|
+
columns: a
|
|
1193
|
+
} = fe(), l = P([]), n = P([]), u = P([]), o = P([]);
|
|
1194
|
+
N(() => a.value, (x) => {
|
|
1195
|
+
l.value = [], n.value = [], u.value = [], x.forEach((y) => {
|
|
1196
|
+
if (y.hideInSetting)
|
|
1197
|
+
return;
|
|
1198
|
+
const {
|
|
1199
|
+
fixed: r,
|
|
1200
|
+
show: C,
|
|
1201
|
+
uuid: d
|
|
1202
|
+
} = y;
|
|
1203
|
+
if ((C || C === void 0) && d && o.value.push(d), r === "left") {
|
|
1204
|
+
n.value.push(y);
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
if (r === "right") {
|
|
1208
|
+
l.value.push(y);
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
u.value.push(y);
|
|
1212
|
+
});
|
|
1213
|
+
}, {
|
|
1214
|
+
immediate: !0
|
|
1215
|
+
});
|
|
1216
|
+
const c = S(() => l.value && l.value.length > 0), h = S(() => n.value && n.value.length > 0);
|
|
1217
|
+
return () => i("div", {
|
|
1218
|
+
class: {
|
|
1219
|
+
[`${e.hashId}`]: !0,
|
|
1220
|
+
[`${e.className}-list`]: !0,
|
|
1221
|
+
[`${e.className}-list-group`]: c.value || h.value
|
|
1222
|
+
}
|
|
1223
|
+
}, [i(Je, {
|
|
1224
|
+
title: "固定在左侧",
|
|
1225
|
+
list: n.value,
|
|
1226
|
+
keys: o.value,
|
|
1227
|
+
hashId: e.hashId,
|
|
1228
|
+
draggable: e.draggable,
|
|
1229
|
+
checkable: e.checkable,
|
|
1230
|
+
className: e.className
|
|
1231
|
+
}, null), i(Je, {
|
|
1232
|
+
list: u.value,
|
|
1233
|
+
keys: o.value,
|
|
1234
|
+
hashId: e.hashId,
|
|
1235
|
+
draggable: e.draggable,
|
|
1236
|
+
checkable: e.checkable,
|
|
1237
|
+
title: "不固定",
|
|
1238
|
+
showTitle: h.value || c.value,
|
|
1239
|
+
className: e.className
|
|
1240
|
+
}, null), i(Je, {
|
|
1241
|
+
title: "固定在右侧",
|
|
1242
|
+
list: l.value,
|
|
1243
|
+
keys: o.value,
|
|
1244
|
+
hashId: e.hashId,
|
|
1245
|
+
draggable: e.draggable,
|
|
1246
|
+
checkable: e.checkable,
|
|
1247
|
+
className: e.className
|
|
1248
|
+
}, null)]);
|
|
1249
|
+
}
|
|
1250
|
+
}), ga = /* @__PURE__ */ ne({
|
|
1251
|
+
props: {
|
|
1252
|
+
draggable: {
|
|
1253
|
+
type: Boolean,
|
|
1254
|
+
default: void 0
|
|
1255
|
+
},
|
|
1256
|
+
checkable: {
|
|
1257
|
+
type: Boolean,
|
|
1258
|
+
default: void 0
|
|
1259
|
+
},
|
|
1260
|
+
checkedReset: Boolean,
|
|
1261
|
+
extra: [Function, Object, String, Boolean]
|
|
1262
|
+
},
|
|
1263
|
+
setup(e) {
|
|
1264
|
+
const a = lt({
|
|
1265
|
+
suffixCls: "table-column-setting",
|
|
1266
|
+
isPor: !0
|
|
1267
|
+
}), {
|
|
1268
|
+
wrapSSR: l,
|
|
1269
|
+
hashId: n
|
|
1270
|
+
} = He("ColumnSetting", [ha], a), {
|
|
1271
|
+
columns: u,
|
|
1272
|
+
settingsAction: o
|
|
1273
|
+
} = fe(), c = Oe((C = !0) => {
|
|
1274
|
+
const d = {}, m = (b) => {
|
|
1275
|
+
b.forEach(({
|
|
1276
|
+
key: v,
|
|
1277
|
+
fixed: F,
|
|
1278
|
+
index: I,
|
|
1279
|
+
children: k
|
|
1280
|
+
}) => {
|
|
1281
|
+
const E = Pt(v, I);
|
|
1282
|
+
E && (d[E] = {
|
|
1283
|
+
show: C,
|
|
1284
|
+
fixed: F
|
|
1285
|
+
}), k && m(k);
|
|
1286
|
+
});
|
|
1287
|
+
};
|
|
1288
|
+
m(u.value), o?.setColumnsMap(d, "show");
|
|
1289
|
+
}), h = Oe((C) => {
|
|
1290
|
+
C.target.checked ? c() : c(!1);
|
|
1291
|
+
}), x = Oe(() => {
|
|
1292
|
+
o?.setColumnsMap(o?.cacheColumnsMap, "fixed");
|
|
1293
|
+
}), y = S(() => (
|
|
1294
|
+
// @ts-ignore
|
|
1295
|
+
Object.values(o?.columnsMap).filter((C) => !C || C.show === !1)
|
|
1296
|
+
)), r = S(() => p(y).length > 0 && p(y).length !== u.value.length);
|
|
1297
|
+
return () => l(i(Ll, {
|
|
1298
|
+
arrowPointAtCenter: !0,
|
|
1299
|
+
title: i("div", {
|
|
1300
|
+
class: [`${a}-title`, n.value]
|
|
1301
|
+
}, [i(Wl, {
|
|
1302
|
+
indeterminate: r.value,
|
|
1303
|
+
checked: p(y).length === 0 && p(y).length !== u.value.length,
|
|
1304
|
+
onChange: (C) => h(C)
|
|
1305
|
+
}, {
|
|
1306
|
+
default: () => [Ae("列展示")]
|
|
1307
|
+
}), e.checkedReset ? i("a", {
|
|
1308
|
+
onClick: x,
|
|
1309
|
+
class: [`${a}-action-rest-button`, n.value]
|
|
1310
|
+
}, [Ae("重置")]) : null, e?.extra ? i(ge, {
|
|
1311
|
+
size: 12,
|
|
1312
|
+
align: "center"
|
|
1313
|
+
}, {
|
|
1314
|
+
default: () => [e.extra]
|
|
1315
|
+
}) : null]),
|
|
1316
|
+
overlayClassName: `${a}-overlay ${n.value}`,
|
|
1317
|
+
trigger: "click",
|
|
1318
|
+
placement: "bottomRight",
|
|
1319
|
+
content: i(va, {
|
|
1320
|
+
hashId: n.value,
|
|
1321
|
+
checkable: e.checkable ?? !0,
|
|
1322
|
+
draggable: e.draggable ?? !0,
|
|
1323
|
+
className: a
|
|
1324
|
+
}, null)
|
|
1325
|
+
}, {
|
|
1326
|
+
default: () => [i(de, {
|
|
1327
|
+
title: "列设置"
|
|
1328
|
+
}, {
|
|
1329
|
+
default: () => [i($t, null, null)]
|
|
1330
|
+
})]
|
|
1331
|
+
}));
|
|
1332
|
+
}
|
|
1333
|
+
}), pa = (e) => ({
|
|
1334
|
+
[`${e.componentCls}`]: {
|
|
1335
|
+
lineHeight: 1,
|
|
1336
|
+
"&-container": {
|
|
1337
|
+
display: "flex",
|
|
1338
|
+
alignItems: "center",
|
|
1339
|
+
justifyContent: "space-between",
|
|
1340
|
+
paddingBottom: e.paddingMD,
|
|
1341
|
+
"&-mobile": {
|
|
1342
|
+
flexDirection: "column",
|
|
1343
|
+
flexWrap: "wrap",
|
|
1344
|
+
alignItems: "flex-start",
|
|
1345
|
+
[`${e.componentCls}-left`]: {
|
|
1346
|
+
flexWrap: "wrap",
|
|
1347
|
+
width: "100%",
|
|
1348
|
+
marginBottom: 16
|
|
1349
|
+
},
|
|
1350
|
+
[`${e.componentCls}-right`]: {
|
|
1351
|
+
width: "100%"
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
"&-title": {
|
|
1356
|
+
display: "flex",
|
|
1357
|
+
alignItems: "center",
|
|
1358
|
+
justifyContent: "flex-start",
|
|
1359
|
+
color: e.colorTextHeading,
|
|
1360
|
+
fontWeight: "500",
|
|
1361
|
+
fontSize: e.fontSizeLG,
|
|
1362
|
+
gap: 4
|
|
1363
|
+
},
|
|
1364
|
+
"&-left": {
|
|
1365
|
+
display: "flex",
|
|
1366
|
+
alignItems: "center",
|
|
1367
|
+
justifyContent: "flex-start"
|
|
1368
|
+
},
|
|
1369
|
+
"&-right": {
|
|
1370
|
+
display: "flex",
|
|
1371
|
+
justifyContent: "flex-end"
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
function wt(e) {
|
|
1376
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
1377
|
+
}
|
|
1378
|
+
const {
|
|
1379
|
+
useBreakpoint: ya
|
|
1380
|
+
} = at;
|
|
1381
|
+
function ba(e) {
|
|
1382
|
+
if (U(e))
|
|
1383
|
+
return e;
|
|
1384
|
+
if (e) {
|
|
1385
|
+
const a = e, {
|
|
1386
|
+
icon: l,
|
|
1387
|
+
tooltip: n,
|
|
1388
|
+
onClick: u,
|
|
1389
|
+
key: o
|
|
1390
|
+
} = a;
|
|
1391
|
+
return l && n ? i(de, {
|
|
1392
|
+
title: n
|
|
1393
|
+
}, {
|
|
1394
|
+
default: () => [i("span", {
|
|
1395
|
+
key: o,
|
|
1396
|
+
onClick: () => {
|
|
1397
|
+
u && u(o);
|
|
1398
|
+
}
|
|
1399
|
+
}, [l])]
|
|
1400
|
+
}) : l;
|
|
1401
|
+
}
|
|
1402
|
+
return null;
|
|
1403
|
+
}
|
|
1404
|
+
const Mt = /* @__PURE__ */ ne({
|
|
1405
|
+
props: {
|
|
1406
|
+
actions: ce.toolBarBtn,
|
|
1407
|
+
settings: [Array],
|
|
1408
|
+
titleTip: ce.titleTip,
|
|
1409
|
+
prefixCls: String,
|
|
1410
|
+
headerTitle: ce.headerTitle,
|
|
1411
|
+
titleTipText: ce.titleTipText,
|
|
1412
|
+
optionsExtra: ce.optionsExtra
|
|
1413
|
+
},
|
|
1414
|
+
setup(e) {
|
|
1415
|
+
const {
|
|
1416
|
+
wrapSSR: a,
|
|
1417
|
+
hashId: l
|
|
1418
|
+
} = He("ListToolBar", [pa], e.prefixCls), n = ya(), {
|
|
1419
|
+
isMobile: u
|
|
1420
|
+
} = fe(), o = S(() => !!(e.titleTip || e.headerTitle || e.actions?.length)), c = S(() => !!(e.settings?.length || e.optionsExtra)), h = S(() => !!(e.titleTip || e.headerTitle)), x = S(() => {
|
|
1421
|
+
let d;
|
|
1422
|
+
return Array.isArray(e.actions) ? e.actions?.length < 1 ? null : i(ge, {
|
|
1423
|
+
align: "center"
|
|
1424
|
+
}, wt(d = e.actions.map((m, b) => U(m) ? Ve(m, {
|
|
1425
|
+
key: b,
|
|
1426
|
+
...m?.props
|
|
1427
|
+
}) : i("template", {
|
|
1428
|
+
key: b
|
|
1429
|
+
}, [m]))) ? d : {
|
|
1430
|
+
default: () => [d]
|
|
1431
|
+
}) : e.actions;
|
|
1432
|
+
}), y = We(() => !o.value && c.value ? i("div", {
|
|
1433
|
+
class: `${e.prefixCls}-left ${l.value}`
|
|
1434
|
+
}, null) : h.value ? i(ge, {
|
|
1435
|
+
class: `${e.prefixCls}-left ${l.value}`
|
|
1436
|
+
}, {
|
|
1437
|
+
default: () => [i("div", {
|
|
1438
|
+
class: `${e.prefixCls}-title ${l.value}`
|
|
1439
|
+
}, [e.headerTitle, e.titleTip && i(de, {
|
|
1440
|
+
title: e.titleTipText
|
|
1441
|
+
}, {
|
|
1442
|
+
default: () => [le(e.titleTip) && e.titleTip ? i(yl, null, null) : e.titleTip]
|
|
1443
|
+
})]), x.value && i("div", {
|
|
1444
|
+
class: `${e.prefixCls}-actions ${l.value}`
|
|
1445
|
+
}, [x.value])]
|
|
1446
|
+
}) : i(ge, {
|
|
1447
|
+
class: `${e.prefixCls}-left ${l.value}`
|
|
1448
|
+
}, {
|
|
1449
|
+
default: () => [x.value && i("div", {
|
|
1450
|
+
class: `${e.prefixCls}-actions`
|
|
1451
|
+
}, [x.value])]
|
|
1452
|
+
}), [() => o.value, () => c.value, () => h.value, () => e.prefixCls, () => e.headerTitle, () => e.titleTipText, () => e.titleTip]), r = We(() => {
|
|
1453
|
+
let d;
|
|
1454
|
+
return c.value ? i(ge, {
|
|
1455
|
+
size: 16,
|
|
1456
|
+
class: `${e.prefixCls}-right ${l.value}`,
|
|
1457
|
+
align: n.value.lg ? "center" : "end",
|
|
1458
|
+
direction: n.value.lg ? "horizontal" : "vertical"
|
|
1459
|
+
}, {
|
|
1460
|
+
default: () => [e.optionsExtra, e.settings?.length ? i(ge, {
|
|
1461
|
+
size: 12,
|
|
1462
|
+
align: "center",
|
|
1463
|
+
class: `${e.prefixCls}-setting-items`
|
|
1464
|
+
}, wt(d = e.settings.map((m, b) => {
|
|
1465
|
+
const v = ba(m);
|
|
1466
|
+
return i("div", {
|
|
1467
|
+
key: b,
|
|
1468
|
+
class: `${e.prefixCls}-setting-item`
|
|
1469
|
+
}, [v]);
|
|
1470
|
+
})) ? d : {
|
|
1471
|
+
default: () => [d]
|
|
1472
|
+
}) : null]
|
|
1473
|
+
}) : null;
|
|
1474
|
+
}, [() => n.value, () => c.value, () => e.prefixCls, () => h.value, () => x.value, () => e.settings]), C = We(() => {
|
|
1475
|
+
if (!c.value && !o.value) return null;
|
|
1476
|
+
const d = {
|
|
1477
|
+
[`${l.value}`]: !0,
|
|
1478
|
+
[`${e.prefixCls}-container`]: !0,
|
|
1479
|
+
[`${e.prefixCls}-container-mobile`]: u.value
|
|
1480
|
+
};
|
|
1481
|
+
return i("div", {
|
|
1482
|
+
class: d
|
|
1483
|
+
}, [y.value, r.value]);
|
|
1484
|
+
}, [() => u.value, () => o.value, () => c.value, () => y.value, () => e.prefixCls, () => r.value]);
|
|
1485
|
+
return () => a(i("div", {
|
|
1486
|
+
class: `${e.prefixCls} ${l.value}`
|
|
1487
|
+
}, [C.value]));
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
Mt.inheritAttrs = !1;
|
|
1491
|
+
const Ca = () => {
|
|
1492
|
+
const {
|
|
1493
|
+
action: e,
|
|
1494
|
+
tableSize: a
|
|
1495
|
+
} = fe();
|
|
1496
|
+
return i(Hl, {
|
|
1497
|
+
overlay: i(ze, {
|
|
1498
|
+
selectedKeys: [a.value],
|
|
1499
|
+
onClick: ({
|
|
1500
|
+
key: l
|
|
1501
|
+
}) => {
|
|
1502
|
+
e.setTableSize?.(l);
|
|
1503
|
+
},
|
|
1504
|
+
style: {
|
|
1505
|
+
width: 80
|
|
1506
|
+
}
|
|
1507
|
+
}, {
|
|
1508
|
+
default: () => [i(ze.Item, {
|
|
1509
|
+
key: "large"
|
|
1510
|
+
}, {
|
|
1511
|
+
default: () => [Ae("默认")]
|
|
1512
|
+
}), i(ze.Item, {
|
|
1513
|
+
key: "middle"
|
|
1514
|
+
}, {
|
|
1515
|
+
default: () => [Ae("中等")]
|
|
1516
|
+
}), i(ze.Item, {
|
|
1517
|
+
key: "small"
|
|
1518
|
+
}, {
|
|
1519
|
+
default: () => [Ae("紧凑")]
|
|
1520
|
+
})]
|
|
1521
|
+
}),
|
|
1522
|
+
trigger: ["click"]
|
|
1523
|
+
}, {
|
|
1524
|
+
default: () => [i(de, {
|
|
1525
|
+
title: "表格密度"
|
|
1526
|
+
}, {
|
|
1527
|
+
default: () => [i(bl, null, null)]
|
|
1528
|
+
})]
|
|
1529
|
+
});
|
|
1530
|
+
}, Kt = /* @__PURE__ */ ne({
|
|
1531
|
+
setup() {
|
|
1532
|
+
const {
|
|
1533
|
+
isFullscreen: e
|
|
1534
|
+
} = At();
|
|
1535
|
+
return () => e.value ? i(de, {
|
|
1536
|
+
title: "退出全屏"
|
|
1537
|
+
}, {
|
|
1538
|
+
default: () => [i(Cl, null, null)]
|
|
1539
|
+
}) : i(de, {
|
|
1540
|
+
title: "全屏"
|
|
1541
|
+
}, {
|
|
1542
|
+
default: () => [i(xl, null, null)]
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
});
|
|
1546
|
+
function xa() {
|
|
1547
|
+
return {
|
|
1548
|
+
reload: {
|
|
1549
|
+
text: "刷新",
|
|
1550
|
+
icon: i(Sl, null, null)
|
|
1551
|
+
},
|
|
1552
|
+
density: {
|
|
1553
|
+
text: "表格密度",
|
|
1554
|
+
icon: i(Ca, null, null)
|
|
1555
|
+
},
|
|
1556
|
+
setting: {
|
|
1557
|
+
text: "列设置",
|
|
1558
|
+
icon: i($t, null, null)
|
|
1559
|
+
},
|
|
1560
|
+
fullScreen: {
|
|
1561
|
+
text: "全屏",
|
|
1562
|
+
icon: i(Kt, null, null)
|
|
1563
|
+
}
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
function Sa(e, a) {
|
|
1567
|
+
return Object.keys(e).filter((l) => l).map((l) => {
|
|
1568
|
+
const n = e[l];
|
|
1569
|
+
if (!n)
|
|
1570
|
+
return null;
|
|
1571
|
+
let u = n === !0 ? a[l] : () => n?.();
|
|
1572
|
+
if (typeof u != "function" && (u = () => {
|
|
1573
|
+
}), l === "setting")
|
|
1574
|
+
return i(ga, M(e[l], {
|
|
1575
|
+
key: l
|
|
1576
|
+
}), null);
|
|
1577
|
+
if (l === "fullScreen")
|
|
1578
|
+
return i("span", {
|
|
1579
|
+
key: l,
|
|
1580
|
+
onClick: u
|
|
1581
|
+
}, [i(Kt, null, null)]);
|
|
1582
|
+
const o = xa()[l];
|
|
1583
|
+
return o ? i("span", {
|
|
1584
|
+
key: l,
|
|
1585
|
+
onClick: u
|
|
1586
|
+
}, [i(de, {
|
|
1587
|
+
title: o.text
|
|
1588
|
+
}, {
|
|
1589
|
+
default: () => [o.icon]
|
|
1590
|
+
})]) : null;
|
|
1591
|
+
}).filter((l) => l);
|
|
1592
|
+
}
|
|
1593
|
+
const wa = {
|
|
1594
|
+
options: [Boolean, Object, Array],
|
|
1595
|
+
titleTip: [Function, Boolean, Object, String],
|
|
1596
|
+
settingExtra: [Function, Boolean, Object, Array],
|
|
1597
|
+
optionsExtra: [Function, Boolean, Object, Array],
|
|
1598
|
+
titleTipText: [String],
|
|
1599
|
+
toolBarBtn: [Function, Boolean, Object, Array],
|
|
1600
|
+
headerTitle: [Function, Boolean, Object, Array, String]
|
|
1601
|
+
}, Ta = /* @__PURE__ */ ne({
|
|
1602
|
+
props: wa,
|
|
1603
|
+
inheritAttrs: !1,
|
|
1604
|
+
setup(e) {
|
|
1605
|
+
const a = lt({
|
|
1606
|
+
suffixCls: "table-list-toolbar",
|
|
1607
|
+
isPor: !0
|
|
1608
|
+
}), {
|
|
1609
|
+
action: l
|
|
1610
|
+
} = fe(), n = We(() => {
|
|
1611
|
+
const u = {
|
|
1612
|
+
reload: () => l?.reload(),
|
|
1613
|
+
density: !0,
|
|
1614
|
+
setting: !0,
|
|
1615
|
+
fullScreen: () => l?.toggle()
|
|
1616
|
+
};
|
|
1617
|
+
if (e.options === !1 || Object.keys(e.options)?.length === 0) return [];
|
|
1618
|
+
const o = {
|
|
1619
|
+
...u,
|
|
1620
|
+
...e.options
|
|
1621
|
+
};
|
|
1622
|
+
return o.setting !== !1 && e.settingExtra && (o.setting = {}, o.setting.extra = e.settingExtra), Sa(o, {
|
|
1623
|
+
...u
|
|
1624
|
+
});
|
|
1625
|
+
}, [() => l, () => e.options]);
|
|
1626
|
+
return () => {
|
|
1627
|
+
const u = e.toolBarBtn || [];
|
|
1628
|
+
return i(Mt, {
|
|
1629
|
+
prefixCls: a,
|
|
1630
|
+
optionsExtra: e.optionsExtra,
|
|
1631
|
+
headerTitle: e.headerTitle,
|
|
1632
|
+
actions: u,
|
|
1633
|
+
settings: p(n),
|
|
1634
|
+
titleTip: e.titleTip,
|
|
1635
|
+
titleTipText: e.titleTipText
|
|
1636
|
+
}, null);
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
function $a(e) {
|
|
1641
|
+
return sl();
|
|
1642
|
+
}
|
|
1643
|
+
function Ra(e, a = !0, l) {
|
|
1644
|
+
$a() ? il(e, l) : a ? e() : ul(e);
|
|
1645
|
+
}
|
|
1646
|
+
function Fa(e) {
|
|
1647
|
+
const a = S(() => e.draggable), l = S(() => e.neverScroll), n = S(() => e.autoScroll);
|
|
1648
|
+
return {
|
|
1649
|
+
draggable: a,
|
|
1650
|
+
neverScroll: l,
|
|
1651
|
+
autoScroll: n
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
function Ba({ scroll: e, columns: a, breakpoint: l, draggable: n, autoScroll: u, neverScroll: o }) {
|
|
1655
|
+
const c = P([]), h = P([]);
|
|
1656
|
+
N([
|
|
1657
|
+
() => e.value,
|
|
1658
|
+
() => a.value,
|
|
1659
|
+
() => l.value,
|
|
1660
|
+
() => n.value,
|
|
1661
|
+
() => l.value,
|
|
1662
|
+
() => u.value,
|
|
1663
|
+
() => o.value
|
|
1664
|
+
], () => {
|
|
1665
|
+
const b = r(ve(a.value));
|
|
1666
|
+
Ye(b, ve(c.value)) || (c.value = Z(b)), Ye(b, ve(h.value)) || (h.value = Z(b));
|
|
1667
|
+
}, {
|
|
1668
|
+
deep: !0,
|
|
1669
|
+
immediate: !0
|
|
1670
|
+
});
|
|
1671
|
+
const x = S(() => {
|
|
1672
|
+
const b = y(p(c).filter((I) => I.fixed === "left")), v = y(p(c).filter((I) => I.fixed !== "left" && I.fixed !== "right")), F = y(p(c).filter((I) => I.fixed === "right"));
|
|
1673
|
+
return [
|
|
1674
|
+
...b,
|
|
1675
|
+
...v,
|
|
1676
|
+
...F
|
|
1677
|
+
];
|
|
1678
|
+
});
|
|
1679
|
+
function y(b) {
|
|
1680
|
+
return b.sort((v, F) => Rl(v, F, "order", 0));
|
|
1681
|
+
}
|
|
1682
|
+
function r(b) {
|
|
1683
|
+
return Z(b).map((v, F) => {
|
|
1684
|
+
if (v.dataIndex === "action" || F === b.length - 1 ? v.resizable = !1 : v.resizable = le(v.resizable) ? v.resizable : !!(De(v.width) && p(n)), !v.width || p(o))
|
|
1685
|
+
return v;
|
|
1686
|
+
if (v.dataIndex === "action" && p(u))
|
|
1687
|
+
if (p(e)?.x || !p(l))
|
|
1688
|
+
v.width = v.width || 100, v.fixed = "right";
|
|
1689
|
+
else {
|
|
1690
|
+
const I = p(a).find((k) => k.dataIndex === v.dataIndex);
|
|
1691
|
+
v.width = I?.width || "", v.fixed = I?.fixed;
|
|
1692
|
+
}
|
|
1693
|
+
return v;
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
function C(b, v) {
|
|
1697
|
+
c.value = c.value.map((F) => (F.uuid === v.uuid && (F.width = b), F));
|
|
1698
|
+
}
|
|
1699
|
+
function d(b) {
|
|
1700
|
+
if (b.length <= 0) {
|
|
1701
|
+
c.value = [];
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
Ye(r(b), ve(c.value)) || (c.value = r(b));
|
|
1705
|
+
}
|
|
1706
|
+
function m(b) {
|
|
1707
|
+
d(Z(ve(a.value)).map((v) => {
|
|
1708
|
+
const F = v.key ? {
|
|
1709
|
+
show: b[v.key]?.show,
|
|
1710
|
+
fixed: b[v.key]?.fixed,
|
|
1711
|
+
order: b[v.key]?.order
|
|
1712
|
+
} : {};
|
|
1713
|
+
return { ...v, ...F };
|
|
1714
|
+
}));
|
|
1715
|
+
}
|
|
1716
|
+
return {
|
|
1717
|
+
breakpoint: l,
|
|
1718
|
+
proColumns: x,
|
|
1719
|
+
cacheProColumns: h,
|
|
1720
|
+
setColumns: d,
|
|
1721
|
+
changeColumns: m,
|
|
1722
|
+
resizeColumnWidth: C
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
function Pa({ columns: e, columnsState: a, changeColumns: l }) {
|
|
1726
|
+
const n = P(void 0), u = be({}), o = be({}), c = be({}), h = P([]);
|
|
1727
|
+
N(() => e.value, () => {
|
|
1728
|
+
p(e)?.forEach(({ show: C, key: d, fixed: m }, b) => {
|
|
1729
|
+
const v = Pt(d, b);
|
|
1730
|
+
v && (c[v] = { show: C === void 0 ? !0 : C, fixed: m });
|
|
1731
|
+
});
|
|
1732
|
+
const r = p(e).map((C) => C.key);
|
|
1733
|
+
y(r);
|
|
1734
|
+
}, { deep: !0, immediate: !0 }), Ne(() => {
|
|
1735
|
+
const r = {
|
|
1736
|
+
...p(a)?.value,
|
|
1737
|
+
...p(c)
|
|
1738
|
+
};
|
|
1739
|
+
Object.assign(u, r), Object.assign(o, r);
|
|
1740
|
+
});
|
|
1741
|
+
function x(r, C) {
|
|
1742
|
+
n.value = C, Object.assign(u, r), l?.(u, C === "fixed");
|
|
1743
|
+
}
|
|
1744
|
+
function y(r) {
|
|
1745
|
+
h.value = r;
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
columnsMap: u,
|
|
1749
|
+
operationType: n,
|
|
1750
|
+
setColumnsMap: x,
|
|
1751
|
+
sortKeyColumns: h,
|
|
1752
|
+
cacheColumnsMap: o,
|
|
1753
|
+
setSortKeyColumns: y
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1756
|
+
function Ia(e, a) {
|
|
1757
|
+
const l = S(() => a), n = P(), u = P(e);
|
|
1758
|
+
function o() {
|
|
1759
|
+
n.value && clearTimeout(n.value);
|
|
1760
|
+
}
|
|
1761
|
+
async function c(...h) {
|
|
1762
|
+
return l.value === 0 || l.value === void 0 ? u.value(...h) : (o(), new Promise(async (x) => {
|
|
1763
|
+
h[0]?.immediate ? x(await u.value(...h)) : n.value = setTimeout(async () => {
|
|
1764
|
+
x(await u.value(...h));
|
|
1765
|
+
}, l.value);
|
|
1766
|
+
}));
|
|
1767
|
+
}
|
|
1768
|
+
return Jl(o), {
|
|
1769
|
+
cancel: o,
|
|
1770
|
+
run: c
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
function ka(e) {
|
|
1774
|
+
const a = S(() => e.rowKey), l = S(() => e.polling), n = S(() => e.debounceTime), u = S(() => e.dataSource);
|
|
1775
|
+
return {
|
|
1776
|
+
rowKey: a,
|
|
1777
|
+
polling: l,
|
|
1778
|
+
request: e.request,
|
|
1779
|
+
postData: e.postData,
|
|
1780
|
+
debounceTime: n,
|
|
1781
|
+
dataSource: u
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
function Aa({ rowKey: e, polling: a, request: l, postData: n, dataSource: u, waitRequest: o, debounceTime: c }, { search: h, columns: x, loading: y, setLoading: r, setColumns: C, removeRowKeys: d, syncSelectedRows: m, formParamsRef: b, setPagination: v, paginationInfo: F, onBeforeSearchSubmit: I, hasCustomRender: k }, E) {
|
|
1785
|
+
const L = P(), W = P(!0), O = P(!1), j = P(!1), D = P([]), ee = P(), oe = S(() => q(h.value) ? h.value?.manualRequest : !1), ie = async (T = {}) => {
|
|
1786
|
+
const { pagination: s, filters: K = {}, sorter: G = {}, removeKeys: te = [], isPolling: Ce = !1 } = T;
|
|
1787
|
+
if (!l || !Ie(l) || p(o) && y.value || O.value)
|
|
1788
|
+
return u.value || [];
|
|
1789
|
+
if (O.value = !0, !Ce || p(o) || W.value ? r(!0) : t(!0), p(o)) {
|
|
1790
|
+
W.value = !1, O.value = !1;
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
s && v(s);
|
|
1794
|
+
try {
|
|
1795
|
+
let Y = {};
|
|
1796
|
+
if (le(s) && !s || le(F))
|
|
1797
|
+
Y = {};
|
|
1798
|
+
else {
|
|
1799
|
+
const { current: _ = 1, pageSize: ye = 10, total: J } = p(F) || {};
|
|
1800
|
+
Y.pageNum = Pl({ current: _, pageSize: ye, total: J }, te.length), te.length && d(te), Y.pageSize = ye;
|
|
1801
|
+
}
|
|
1802
|
+
const Ee = q(G) ? [G] : G;
|
|
1803
|
+
Ee.forEach((_) => {
|
|
1804
|
+
const ye = _?.columnKey || _?.field;
|
|
1805
|
+
_ && _?.order ? C(p(x).map((J) => (J.dataIndex === ye ? J.sortOrder = _?.order : J.sortOrder = null, J))) : _ && C(p(x).map((J) => (J.dataIndex === ye && (J.sortOrder = null), J)));
|
|
1806
|
+
});
|
|
1807
|
+
let $e = {
|
|
1808
|
+
...Y || {},
|
|
1809
|
+
...T.params,
|
|
1810
|
+
...b
|
|
1811
|
+
};
|
|
1812
|
+
I && Ie(I) && ($e = await I($e, G, K));
|
|
1813
|
+
let ue = [];
|
|
1814
|
+
const xe = await l?.(Z(ve($e)), Ee, K);
|
|
1815
|
+
if (O.value = !1, xe && xe?.success) {
|
|
1816
|
+
ue = xe.data || [], n && Ie(n) && (ue = await n?.(ue)), m(ue);
|
|
1817
|
+
const _ = xe.total || ue?.length || 0;
|
|
1818
|
+
return _ !== p(F)?.total && v({
|
|
1819
|
+
total: _ || 0
|
|
1820
|
+
}), R(ue), ue;
|
|
1821
|
+
} else
|
|
1822
|
+
return [];
|
|
1823
|
+
} catch (Y) {
|
|
1824
|
+
D.value === void 0 && R([]), E("requestError", Y);
|
|
1825
|
+
} finally {
|
|
1826
|
+
W.value = !1, r(!1);
|
|
1827
|
+
}
|
|
1828
|
+
return [];
|
|
1829
|
+
}, ae = Ia(async (T) => {
|
|
1830
|
+
ee.value && clearTimeout(ee.value);
|
|
1831
|
+
const s = await ie(T), K = Fl(a.value, s);
|
|
1832
|
+
return K && !L.value && (ee.value = setTimeout(() => {
|
|
1833
|
+
ae.run({ ...T, isPolling: K });
|
|
1834
|
+
}, Math.max(K, 2e3))), s;
|
|
1835
|
+
}, c.value || 10);
|
|
1836
|
+
rl(() => {
|
|
1837
|
+
L.value = !0, clearTimeout(ee.value);
|
|
1838
|
+
}), cl(() => {
|
|
1839
|
+
L.value = !0, clearTimeout(ee.value);
|
|
1840
|
+
}), N(() => a.value, () => {
|
|
1841
|
+
a.value ? ae.run({ isPolling: !0 }) : clearTimeout(ee.value);
|
|
1842
|
+
}, { immediate: !0 }), N([() => o.value, () => u.value], () => {
|
|
1843
|
+
pe();
|
|
1844
|
+
}, { deep: !0, immediate: !0 }), N([() => b], () => {
|
|
1845
|
+
oe.value || pe();
|
|
1846
|
+
}, {
|
|
1847
|
+
deep: !0,
|
|
1848
|
+
immediate: !0
|
|
1849
|
+
});
|
|
1850
|
+
function pe() {
|
|
1851
|
+
we(l) ? (!W.value || !a.value) && ae.run({ isPolling: !1 }) : R(u.value || []);
|
|
1852
|
+
}
|
|
1853
|
+
const he = S(() => {
|
|
1854
|
+
if (k.value)
|
|
1855
|
+
return p(D);
|
|
1856
|
+
const T = x.value.filter((s) => s.show || s.show === void 0);
|
|
1857
|
+
return !p(D) || !T || T.length === 0 ? [] : p(D);
|
|
1858
|
+
}), Te = S(() => p(D).some((T) => V(T.children) && T.children.length > 0));
|
|
1859
|
+
function t(T) {
|
|
1860
|
+
j.value = T;
|
|
1861
|
+
}
|
|
1862
|
+
function f(T, s, K, G) {
|
|
1863
|
+
ae.run({ pagination: T, filters: s, sorter: K, extra: G, isPolling: !1 }), E("change", T, s, K, G);
|
|
1864
|
+
}
|
|
1865
|
+
function R(T) {
|
|
1866
|
+
const s = Bl(Z(T), p(F.value));
|
|
1867
|
+
if (!Ye(s, D.value) && (D.value = s, !l || !Ie(l))) {
|
|
1868
|
+
const K = s.length || 0;
|
|
1869
|
+
K !== p(F)?.total && v({
|
|
1870
|
+
total: K
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return {
|
|
1875
|
+
dataSource: he,
|
|
1876
|
+
isTreeDataRef: Te,
|
|
1877
|
+
reSetDataList: R,
|
|
1878
|
+
changeDataValue: ({ key: T, params: s, value: K, type: G = "update" }) => {
|
|
1879
|
+
const te = T ?? e.value, Ce = s?.[te] ?? K;
|
|
1880
|
+
switch (G) {
|
|
1881
|
+
case "update":
|
|
1882
|
+
te && Ce && s && (D.value = D.value.map((Y) => Ce === Y[te] ? It(Y, s, {
|
|
1883
|
+
omitNil: !1,
|
|
1884
|
+
omitEmpty: !1
|
|
1885
|
+
}) : Y)), Le(!!s, "params is required");
|
|
1886
|
+
break;
|
|
1887
|
+
case "push":
|
|
1888
|
+
s && D.value.push(s), Le(!!s, "params is required");
|
|
1889
|
+
break;
|
|
1890
|
+
case "unshift":
|
|
1891
|
+
s && D.value.unshift(s), Le(!!s, "params is required");
|
|
1892
|
+
break;
|
|
1893
|
+
case "delete":
|
|
1894
|
+
te && (D.value = D.value.filter((Y) => K !== Y[te]));
|
|
1895
|
+
break;
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
handleTableChange: f,
|
|
1899
|
+
reload: async (T) => {
|
|
1900
|
+
we(l) ? await ae.run({ ...T, isPolling: !1 }) : E("reload");
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
function Oa({ emit: e, loading: a }) {
|
|
1905
|
+
const l = P(le(a.value) ? a.value : q(a.value) ? a.value?.spinning : !1);
|
|
1906
|
+
N(() => a.value, (o) => {
|
|
1907
|
+
l.value = le(o) ? o : q(o) ? o?.spinning : l.value;
|
|
1908
|
+
});
|
|
1909
|
+
const n = S(() => l.value);
|
|
1910
|
+
function u(o) {
|
|
1911
|
+
l.value = o, e("loadingChange", !0);
|
|
1912
|
+
}
|
|
1913
|
+
return { loadingComputed: n, loading: l, setLoading: u };
|
|
1914
|
+
}
|
|
1915
|
+
function Da({
|
|
1916
|
+
pagination: e,
|
|
1917
|
+
pageItemRender: a
|
|
1918
|
+
}) {
|
|
1919
|
+
const l = be({}), n = P();
|
|
1920
|
+
N(() => e.value, () => {
|
|
1921
|
+
if (le(e.value) && !e.value) {
|
|
1922
|
+
n.value = !1;
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
const o = Ie(a) ? {
|
|
1926
|
+
itemRender: ({
|
|
1927
|
+
page: h,
|
|
1928
|
+
type: x,
|
|
1929
|
+
originalElement: y
|
|
1930
|
+
}) => a ? a({
|
|
1931
|
+
page: h,
|
|
1932
|
+
type: x,
|
|
1933
|
+
originalElement: y
|
|
1934
|
+
}) : null
|
|
1935
|
+
} : null, c = {
|
|
1936
|
+
current: 1,
|
|
1937
|
+
pageSize: 10,
|
|
1938
|
+
size: "default",
|
|
1939
|
+
showQuickJumper: !0,
|
|
1940
|
+
showSizeChanger: !0,
|
|
1941
|
+
pageSizeOptions: ["10", "20", "50", "100"],
|
|
1942
|
+
...e.value || {},
|
|
1943
|
+
...o || {}
|
|
1944
|
+
};
|
|
1945
|
+
e.value?.showTotal || (c.showTotal = (h) => `共${h < c.pageSize ? 1 : Math.ceil(h / (c.pageSize || 10))}页 ${h}条记录`), n.value = c, Object.assign(l, {
|
|
1946
|
+
pageNum: c.current,
|
|
1947
|
+
pageSize: c.pageSize
|
|
1948
|
+
});
|
|
1949
|
+
}, {
|
|
1950
|
+
deep: 1,
|
|
1951
|
+
immediate: !0
|
|
1952
|
+
});
|
|
1953
|
+
function u(o) {
|
|
1954
|
+
if (q(n.value) && q(o)) {
|
|
1955
|
+
const c = {};
|
|
1956
|
+
Object.keys(o).forEach((h) => {
|
|
1957
|
+
Object.prototype.hasOwnProperty.call(o, h) && n.value[h] === o[h] || (c[h] = o[h]);
|
|
1958
|
+
}), Object.keys(c).length > 0 && (Object.assign(n.value, c), ja(c) && Object.assign(l, c));
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return {
|
|
1962
|
+
paginationInfo: n,
|
|
1963
|
+
requestPagination: l,
|
|
1964
|
+
setPagination: u
|
|
1965
|
+
};
|
|
1966
|
+
}
|
|
1967
|
+
function ja(e) {
|
|
1968
|
+
if (typeof e != "object" || e === null)
|
|
1969
|
+
return !1;
|
|
1970
|
+
const a = Object.keys(e);
|
|
1971
|
+
return a.length === 2 && a.includes("pageNum") && a.includes("pageSize");
|
|
1972
|
+
}
|
|
1973
|
+
function Na(e, a) {
|
|
1974
|
+
const l = P([]), n = P([]);
|
|
1975
|
+
N(() => a.value?.selectedRows, (r) => {
|
|
1976
|
+
n.value = Z(r || []);
|
|
1977
|
+
}, {
|
|
1978
|
+
deep: !0,
|
|
1979
|
+
immediate: !0
|
|
1980
|
+
}), N(() => a.value?.selectedRowKeys, (r) => {
|
|
1981
|
+
l.value = Il([...r || []]);
|
|
1982
|
+
}, {
|
|
1983
|
+
deep: !0,
|
|
1984
|
+
immediate: !0
|
|
1985
|
+
});
|
|
1986
|
+
const u = (r, C) => {
|
|
1987
|
+
const d = a.value?.type || "checkbox";
|
|
1988
|
+
e.value && (C ? r?.[e.value] && d === "checkbox" ? (l.value.push(r[e.value]), n.value.push(r)) : (l.value = [r[e.value]], n.value = [r]) : (l.value = l.value.filter((m) => m !== r[e.value]), n.value = n.value.filter((m) => m[e.value] !== r[e.value])));
|
|
1989
|
+
}, o = () => {
|
|
1990
|
+
a.value && a.value?.onChange?.(l.value, n.value);
|
|
1991
|
+
};
|
|
1992
|
+
return {
|
|
1993
|
+
selectedKeys: l,
|
|
1994
|
+
selectedItems: n,
|
|
1995
|
+
selectRowKey: u,
|
|
1996
|
+
selectAllRowKey: (r, C, d) => {
|
|
1997
|
+
e.value && (r ? C.map((m) => (l.value.every((b) => b !== m?.[e.value]) && m?.[e.value] && (l.value.push(m[e.value]), n.value.push(m)), m)) : d.map((m) => (l.value.includes(m?.[e.value]) && (l.value = l.value.filter((b) => b !== m[e.value]), n.value = n.value.filter((b) => b[e.value] !== m[e.value])), m)));
|
|
1998
|
+
},
|
|
1999
|
+
removeRowKeys: (r) => {
|
|
2000
|
+
l.value = l.value.filter((C) => !r.includes(C)), n.value = n.value.filter((C) => !r.includes(C?.[e.value || ""])), o();
|
|
2001
|
+
},
|
|
2002
|
+
changeRowKey: o,
|
|
2003
|
+
syncSelectedRows: (r) => {
|
|
2004
|
+
if (e.value && l.value.length !== n.value.length) {
|
|
2005
|
+
const C = n.value.map((m) => m[e.value]), d = l.value.filter((m) => !C.includes(m));
|
|
2006
|
+
r.forEach((m) => {
|
|
2007
|
+
d.includes(m[e.value]) && n.value.push(Z(m));
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
2011
|
+
clearAllRowKeys: () => {
|
|
2012
|
+
l.value = [], n.value = [], o();
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
function Ea(e) {
|
|
2017
|
+
const a = {};
|
|
2018
|
+
return e.forEach((l) => {
|
|
2019
|
+
let n = l.initialValue;
|
|
2020
|
+
const u = ["select", "number"], o = ["date", "time", "dateRange"], c = ["treeSelect", "numberRange"];
|
|
2021
|
+
l.valueType ? !n && u.includes(l.valueType) ? n = void 0 : !n && o.includes(l.valueType) ? n = null : !n && c.includes(l.valueType) ? n = [] : n || (n = "") : n || (n = ""), l.name === "dateRange" ? (a[l.rangeStartName || "start"] = n ? n[0] : null, a[l.rangeEndName || "end"] = n ? n[1] : null) : l.name && (a[l.name] = n);
|
|
2022
|
+
}), a;
|
|
2023
|
+
}
|
|
2024
|
+
function Ma({ searchMap: e, params: a, columns: l, setPagination: n }) {
|
|
2025
|
+
const u = be({}), o = be({}), c = P([]);
|
|
2026
|
+
function h(r) {
|
|
2027
|
+
r.forEach((C) => {
|
|
2028
|
+
c.value.some((d) => d.name === C.name) ? c.value = c.value.map((d) => d.name === C.name ? {
|
|
2029
|
+
...d,
|
|
2030
|
+
...C
|
|
2031
|
+
} : d) : c.value.push(C);
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
const x = (r) => {
|
|
2035
|
+
const C = [];
|
|
2036
|
+
if ((r === "all" || r === "searchMap") && (e.value?.forEach((d) => C.push(d)), h(C)), (r === "all" || r === "columns") && l.value?.length && (l.value && l.value.forEach((d) => {
|
|
2037
|
+
d.searchConfig && C.push(d.searchConfig);
|
|
2038
|
+
}), h(C)), r === "all" || r === "searchMap" || r === "columns") {
|
|
2039
|
+
n({ current: 1 });
|
|
2040
|
+
const d = Ea(C);
|
|
2041
|
+
Object.assign(o, { ...d });
|
|
2042
|
+
for (const m in d)
|
|
2043
|
+
u[m] || (u[m] = d[m]);
|
|
2044
|
+
}
|
|
2045
|
+
(r === "all" || r === "params") && (n({ current: 1 }), Object.assign(u, a.value));
|
|
2046
|
+
};
|
|
2047
|
+
dl(() => {
|
|
2048
|
+
x("all");
|
|
2049
|
+
}), N(() => a.value, () => {
|
|
2050
|
+
x("params");
|
|
2051
|
+
}, { deep: !0 }), N(() => e.value, () => {
|
|
2052
|
+
x("searchMap");
|
|
2053
|
+
}, { deep: !0 }), N(() => l.value, () => {
|
|
2054
|
+
x("columns");
|
|
2055
|
+
}, { deep: !0 });
|
|
2056
|
+
function y(r) {
|
|
2057
|
+
n({ current: 1 }), Object.assign(u, r);
|
|
2058
|
+
}
|
|
2059
|
+
return { formDataRef: c, formParamsRef: u, defaultParamsRef: o, setFormParams: y };
|
|
2060
|
+
}
|
|
2061
|
+
function Ka(e) {
|
|
2062
|
+
const a = S(() => e.scroll), l = S(() => e.autoScroll), n = S(() => e.modalScroll), u = S(() => e.neverScroll), o = S(() => e.rowSelection), c = S(() => e.scrollBreakpoint);
|
|
2063
|
+
return {
|
|
2064
|
+
scroll: a,
|
|
2065
|
+
neverScroll: u,
|
|
2066
|
+
rowSelection: o,
|
|
2067
|
+
autoScroll: l,
|
|
2068
|
+
modalScroll: n,
|
|
2069
|
+
scrollBreakpoint: c
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
function za({ scroll: e, columns: a, autoScroll: l, modalScroll: n, neverScroll: u, rowSelection: o, screens: c, innerWidth: h, scrollBreakpoint: x }) {
|
|
2073
|
+
const y = S(() => p(x) ? De(p(x)) ? h.value > p(x) : kt(p(x)) ? c.value?.[p(x)] : c.value?.xl : c.value?.xl), r = S(() => {
|
|
2074
|
+
let d = 0;
|
|
2075
|
+
const m = p(o) ? 60 : 0, b = 150, v = Z(p(a));
|
|
2076
|
+
v.forEach((k) => {
|
|
2077
|
+
d += Number.parseInt(String(k.width)) || 0;
|
|
2078
|
+
});
|
|
2079
|
+
const I = v.filter((k) => !Reflect.has(k, "width")).length;
|
|
2080
|
+
return I !== 0 && (d += I * b), m && (d += m), d;
|
|
2081
|
+
});
|
|
2082
|
+
return { proScroll: S(() => p(u) ? {} : p(e) && Object.keys(p(e)).length ? p(e) : p(n) ? {
|
|
2083
|
+
y: p(e)?.y || (c.value?.xl ? 400 : 235)
|
|
2084
|
+
} : p(l) ? y.value ? {} : le(y.value) ? { x: p(r) } : {} : {}), breakpoint: y };
|
|
2085
|
+
}
|
|
2086
|
+
function Ya({ size: e, emit: a }) {
|
|
2087
|
+
const l = P("middle");
|
|
2088
|
+
Ne(() => {
|
|
2089
|
+
l.value = e.value;
|
|
2090
|
+
});
|
|
2091
|
+
function n(u) {
|
|
2092
|
+
l.value = u, a("sizeChange", u);
|
|
2093
|
+
}
|
|
2094
|
+
return { sizeRef: l, setTableSize: n };
|
|
2095
|
+
}
|
|
2096
|
+
const Ze = {
|
|
2097
|
+
"&::-webkit-scrollbar": {
|
|
2098
|
+
width: 4,
|
|
2099
|
+
height: 4
|
|
2100
|
+
},
|
|
2101
|
+
"&::-webkit-scrollbar-thumb": {
|
|
2102
|
+
backgroundColor: "#d2d4d6",
|
|
2103
|
+
borderRadius: 2
|
|
2104
|
+
},
|
|
2105
|
+
"&::-webkit-scrollbar-track": {
|
|
2106
|
+
backgroundColor: "transparent",
|
|
2107
|
+
borderRadius: 2
|
|
2108
|
+
}
|
|
2109
|
+
}, La = (e) => {
|
|
2110
|
+
const a = `${e.antCls}-table`;
|
|
2111
|
+
return {
|
|
2112
|
+
[e.componentCls]: {
|
|
2113
|
+
"&-a": {
|
|
2114
|
+
cursor: "pointer",
|
|
2115
|
+
color: e.colorPrimary,
|
|
2116
|
+
"&:hover": {
|
|
2117
|
+
color: e.colorPrimaryHover
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
[`${a}`]: {
|
|
2121
|
+
[`${a}-cell-ellipsis`]: {
|
|
2122
|
+
overflow: "unset",
|
|
2123
|
+
whiteSpace: "unset"
|
|
2124
|
+
}
|
|
2125
|
+
},
|
|
2126
|
+
"&-empty-text": {
|
|
2127
|
+
display: "flex",
|
|
2128
|
+
flexDirection: "column",
|
|
2129
|
+
alignItems: "center",
|
|
2130
|
+
justifyContent: "center"
|
|
2131
|
+
},
|
|
2132
|
+
"&-table-tree": {
|
|
2133
|
+
[`${e.antCls}-table-row-cell-ellipsis`]: {
|
|
2134
|
+
overflow: "hidden",
|
|
2135
|
+
textOverflow: "ellipsis",
|
|
2136
|
+
whiteSpace: "nowrap",
|
|
2137
|
+
[`${e.antCls}-table-column-title`]: {
|
|
2138
|
+
overflow: "hidden",
|
|
2139
|
+
textOverflow: "ellipsis",
|
|
2140
|
+
whiteSpace: "nowrap"
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
},
|
|
2144
|
+
"&-full-screen": {
|
|
2145
|
+
[`${e.componentCls}-content`]: {
|
|
2146
|
+
height: "100% !important",
|
|
2147
|
+
padding: 24,
|
|
2148
|
+
backgroundColor: e.colorWhite,
|
|
2149
|
+
boxShadow: "0 4px 8px #0003, 0 6px 20px #00000030 !important"
|
|
2150
|
+
}
|
|
2151
|
+
},
|
|
2152
|
+
"&-no-scroll": {
|
|
2153
|
+
[`${e.antCls}-table`]: {
|
|
2154
|
+
table: {
|
|
2155
|
+
width: "100% !important",
|
|
2156
|
+
minWidth: "unset"
|
|
2157
|
+
}
|
|
2158
|
+
},
|
|
2159
|
+
[`${e.antCls}-table-ping-right:not(${e.antCls}-table-has-fix-right)`]: {
|
|
2160
|
+
[`${e.antCls}-table-container::after`]: {
|
|
2161
|
+
boxShadow: "none"
|
|
2162
|
+
}
|
|
2163
|
+
},
|
|
2164
|
+
[`${e.antCls}-table-bordered ${e.antCls}-table-fixed-left ${e.antCls}-table-thead > tr > th`]: {
|
|
2165
|
+
"&:last-child": {
|
|
2166
|
+
borderRight: 0
|
|
2167
|
+
}
|
|
2168
|
+
},
|
|
2169
|
+
[`${e.antCls}-table-bordered ${e.antCls}-table-fixed-left ${e.antCls}-table-tbody > tr > td`]: {
|
|
2170
|
+
"&:last-child": {
|
|
2171
|
+
borderRight: 0
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
"&-wrapper": {
|
|
2176
|
+
clear: "both",
|
|
2177
|
+
maxWidth: "100%",
|
|
2178
|
+
[`${e.componentCls}-pagination${e.antCls}-pagination`]: {
|
|
2179
|
+
margin: `${e.margin}px 0`
|
|
2180
|
+
},
|
|
2181
|
+
[`${e.componentCls}-pagination`]: {
|
|
2182
|
+
display: "flex",
|
|
2183
|
+
flexWrap: "wrap",
|
|
2184
|
+
rowGap: e.paddingXS,
|
|
2185
|
+
"> *": {
|
|
2186
|
+
flex: "none"
|
|
2187
|
+
},
|
|
2188
|
+
"&-left": {
|
|
2189
|
+
justifyContent: "flex-start"
|
|
2190
|
+
},
|
|
2191
|
+
"&-center": {
|
|
2192
|
+
justifyContent: "center"
|
|
2193
|
+
},
|
|
2194
|
+
"&-right": {
|
|
2195
|
+
justifyContent: "flex-end"
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
},
|
|
2199
|
+
"&-card-border": {
|
|
2200
|
+
paddingInline: e.paddingMD,
|
|
2201
|
+
paddingBlock: e.paddingMD,
|
|
2202
|
+
border: `${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,
|
|
2203
|
+
borderRadius: e.borderRadiusLG,
|
|
2204
|
+
backgroundColor: Ft(e, e.colorBgContainer),
|
|
2205
|
+
[`${e.antCls}-table-wrapper ${e.antCls}-table-pagination${e.antCls}-pagination`]: {
|
|
2206
|
+
marginBottom: 0
|
|
2207
|
+
}
|
|
2208
|
+
},
|
|
2209
|
+
[`${e.componentCls}-copyable`]: {
|
|
2210
|
+
display: "flex",
|
|
2211
|
+
alignItems: "center",
|
|
2212
|
+
[`${e.componentCls}-copyable-icon`]: {
|
|
2213
|
+
marginLeft: 8,
|
|
2214
|
+
color: e.colorPrimary,
|
|
2215
|
+
cursor: "pointer"
|
|
2216
|
+
}
|
|
2217
|
+
},
|
|
2218
|
+
[`${e.componentCls}-ellipsis`]: {
|
|
2219
|
+
overflow: "hidden",
|
|
2220
|
+
textOverflow: "ellipsis",
|
|
2221
|
+
display: "-webkit-box",
|
|
2222
|
+
"-webkit-box-orient": "vertical",
|
|
2223
|
+
"word-break": "break-word"
|
|
2224
|
+
},
|
|
2225
|
+
[`${e.componentCls}-action-size`]: {
|
|
2226
|
+
display: "inline-block"
|
|
2227
|
+
},
|
|
2228
|
+
[`${e.componentCls}-action-columns`]: {
|
|
2229
|
+
display: "inline-block",
|
|
2230
|
+
[`${e.antCls}-popover-inner-content`]: {
|
|
2231
|
+
padding: "8px 0 8px 16px"
|
|
2232
|
+
},
|
|
2233
|
+
[`${e.antCls}-tree ${e.antCls}-tree-switcher-noop`]: {
|
|
2234
|
+
display: "none"
|
|
2235
|
+
},
|
|
2236
|
+
[`${e.antCls}-tree > ${e.antCls}-tree-treenode`]: {
|
|
2237
|
+
width: "100%",
|
|
2238
|
+
alignItems: "center",
|
|
2239
|
+
"&:first-child": {
|
|
2240
|
+
paddingTop: 0
|
|
2241
|
+
},
|
|
2242
|
+
"&:last-child": {
|
|
2243
|
+
paddingBottom: 4
|
|
2244
|
+
},
|
|
2245
|
+
"&:hover": {
|
|
2246
|
+
backgroundColor: "#e6f7ff",
|
|
2247
|
+
[`${e.componentCls}-action-columns-list-item-actions`]: {
|
|
2248
|
+
display: "block"
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
},
|
|
2252
|
+
[`${e.antCls}-tree ${e.antCls}-tree-node-content-wrapper`]: {
|
|
2253
|
+
flex: "1",
|
|
2254
|
+
"&:hover": {
|
|
2255
|
+
backgroundColor: "transparent"
|
|
2256
|
+
}
|
|
2257
|
+
},
|
|
2258
|
+
"&-popover-title": {
|
|
2259
|
+
display: "flex",
|
|
2260
|
+
alignItems: "center",
|
|
2261
|
+
justifyContent: "space-between",
|
|
2262
|
+
"&-check": {
|
|
2263
|
+
marginRight: 8
|
|
2264
|
+
},
|
|
2265
|
+
[`${e.antCls}-btn-sm`]: {
|
|
2266
|
+
padding: 0
|
|
2267
|
+
}
|
|
2268
|
+
},
|
|
2269
|
+
"&-list-group": {
|
|
2270
|
+
marginTop: 6,
|
|
2271
|
+
marginBottom: 6,
|
|
2272
|
+
fontSize: 12,
|
|
2273
|
+
color: "rgba(0, 0, 0, 0.45)"
|
|
2274
|
+
},
|
|
2275
|
+
"$-list-item": {
|
|
2276
|
+
display: "flex",
|
|
2277
|
+
alignItems: "center",
|
|
2278
|
+
justifyContent: "space-between",
|
|
2279
|
+
"&-actions": {
|
|
2280
|
+
display: "block",
|
|
2281
|
+
float: "right",
|
|
2282
|
+
cursor: "pointer",
|
|
2283
|
+
"> span + span": {
|
|
2284
|
+
marginLeft: 8
|
|
2285
|
+
},
|
|
2286
|
+
"&-disabled": {
|
|
2287
|
+
action: {
|
|
2288
|
+
color: "rgba(0, 0, 0, 0.25)"
|
|
2289
|
+
}
|
|
2290
|
+
},
|
|
2291
|
+
anticon: {
|
|
2292
|
+
color: e.colorPrimary
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
},
|
|
2297
|
+
// ant-class
|
|
2298
|
+
[`${e.antCls}-tooltip-inner`]: {
|
|
2299
|
+
a: {
|
|
2300
|
+
color: e.colorWhite
|
|
2301
|
+
}
|
|
2302
|
+
},
|
|
2303
|
+
[`&${e.componentCls}-beautify-scroll`]: {
|
|
2304
|
+
[`${e.antCls}-table-content`]: Ze,
|
|
2305
|
+
[`${e.antCls}-table-body`]: Ze,
|
|
2306
|
+
[`${e.antCls}-table-empty`]: {
|
|
2307
|
+
[`${e.antCls}-table-content`]: Ze
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2312
|
+
};
|
|
2313
|
+
function Wa(e) {
|
|
2314
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
2315
|
+
}
|
|
2316
|
+
function Va(e, a, l, n) {
|
|
2317
|
+
if (!a) return e;
|
|
2318
|
+
let u = e;
|
|
2319
|
+
if (q(a)) {
|
|
2320
|
+
const o = a.node === "a" ? "span" : a.node;
|
|
2321
|
+
return i(o, M(a?.attr || {}, {
|
|
2322
|
+
class: [a.class, a.node === "a" ? `${l}-a` : ""],
|
|
2323
|
+
onClick: a.click
|
|
2324
|
+
}), Wa(e) ? e : {
|
|
2325
|
+
default: () => [e]
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
switch (a) {
|
|
2329
|
+
case "link":
|
|
2330
|
+
u = i("span", {
|
|
2331
|
+
class: [`${l}-a`, n]
|
|
2332
|
+
}, [e]);
|
|
2333
|
+
break;
|
|
2334
|
+
case "time":
|
|
2335
|
+
u = H(e).format("HH:mm:ss");
|
|
2336
|
+
break;
|
|
2337
|
+
case "dateMonth":
|
|
2338
|
+
u = `${H(e).month() + 1}月`;
|
|
2339
|
+
break;
|
|
2340
|
+
case "date":
|
|
2341
|
+
u = H(e).format("YYYY-MM-DD");
|
|
2342
|
+
break;
|
|
2343
|
+
case "dateTime":
|
|
2344
|
+
u = H(e).format("YYYY-MM-DD HH:mm:ss");
|
|
2345
|
+
break;
|
|
2346
|
+
}
|
|
2347
|
+
return u;
|
|
2348
|
+
}
|
|
2349
|
+
function Ha(e, a) {
|
|
2350
|
+
const l = a && a.current || 1, n = a && a.pageSize || 10;
|
|
2351
|
+
return e.filter((u, o) => o < l * n && o >= n * (l - 1));
|
|
2352
|
+
}
|
|
2353
|
+
function qa(e) {
|
|
2354
|
+
const a = document.createElement("textarea");
|
|
2355
|
+
a.style.position = "absolute", a.style.opacity = "0", a.value = e, document.body.appendChild(a), a.select(), document.execCommand("copy"), document.body.removeChild(a);
|
|
2356
|
+
}
|
|
2357
|
+
function Ga(e) {
|
|
2358
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !U(e);
|
|
2359
|
+
}
|
|
2360
|
+
const {
|
|
2361
|
+
useBreakpoint: _a
|
|
2362
|
+
} = at, Qa = {
|
|
2363
|
+
reload: !0,
|
|
2364
|
+
density: !0,
|
|
2365
|
+
setting: !0,
|
|
2366
|
+
fullScreen: !0
|
|
2367
|
+
}, Xa = ql.useToken, et = /* @__PURE__ */ ne({
|
|
2368
|
+
name: "GProTable",
|
|
2369
|
+
inheritAttrs: !1,
|
|
2370
|
+
props: ce,
|
|
2371
|
+
emits: ["reset", "reload", "submit", "sizeChange", "expandedRowsChange", "expand", "change", "requestError", "columnsStateChange", "loadingChange"],
|
|
2372
|
+
slots: Object,
|
|
2373
|
+
setup(e, {
|
|
2374
|
+
emit: a,
|
|
2375
|
+
slots: l,
|
|
2376
|
+
attrs: n,
|
|
2377
|
+
expose: u
|
|
2378
|
+
}) {
|
|
2379
|
+
const o = lt({
|
|
2380
|
+
suffixCls: "table",
|
|
2381
|
+
isPor: !0
|
|
2382
|
+
}), {
|
|
2383
|
+
wrapSSR: c,
|
|
2384
|
+
hashId: h
|
|
2385
|
+
} = He("ProBaseTable", [La], o), {
|
|
2386
|
+
token: x
|
|
2387
|
+
} = Xa(), y = $l(), r = _a(), {
|
|
2388
|
+
width: C
|
|
2389
|
+
} = El(), d = P(!1), m = Rt(), b = P(), v = P(), F = P(e.waitRequest);
|
|
2390
|
+
Ne(() => F.value = e.waitRequest);
|
|
2391
|
+
const {
|
|
2392
|
+
toggle: I,
|
|
2393
|
+
isFullscreen: k
|
|
2394
|
+
} = At(b), E = S(() => ({
|
|
2395
|
+
...e
|
|
2396
|
+
})), L = S(() => !r.value.xl), W = S(() => (e.virtualScroll && Le(!e.scroll?.y, "参数scroll的Y值不能为空!"), !!(e.scroll?.y && e.virtualScroll))), O = S(() => e.search === !1 ? !1 : q(e.search) ? e.search : {
|
|
2397
|
+
type: "auto",
|
|
2398
|
+
resetText: "重置",
|
|
2399
|
+
searchText: "查询"
|
|
2400
|
+
}), j = S(() => O.value === !1 ? {} : O.value), D = S(() => j.value?.manualRequest ?? !1), ee = S(() => j.value?.actions), oe = S(() => {
|
|
2401
|
+
const g = (e.columns || []).filter((w) => w.key || w.dataIndex).map((w) => {
|
|
2402
|
+
const B = w.key || w.dataIndex;
|
|
2403
|
+
return w.key = B, w.dataIndex = B, w.align = w.align || e.align, w.uuid = w.uuid || tt().uuid(15), w;
|
|
2404
|
+
});
|
|
2405
|
+
return kl(g, {
|
|
2406
|
+
align: e.align ?? "left",
|
|
2407
|
+
showIndex: e.showIndex ?? !1
|
|
2408
|
+
});
|
|
2409
|
+
}), {
|
|
2410
|
+
loadingComputed: ie,
|
|
2411
|
+
loading: ae,
|
|
2412
|
+
setLoading: pe
|
|
2413
|
+
} = Oa({
|
|
2414
|
+
emit: a,
|
|
2415
|
+
loading: se(e, "loading")
|
|
2416
|
+
}), {
|
|
2417
|
+
sizeRef: he,
|
|
2418
|
+
setTableSize: Te
|
|
2419
|
+
} = Ya({
|
|
2420
|
+
emit: a,
|
|
2421
|
+
size: se(e, "size")
|
|
2422
|
+
}), {
|
|
2423
|
+
paginationInfo: t,
|
|
2424
|
+
requestPagination: f,
|
|
2425
|
+
setPagination: R
|
|
2426
|
+
} = Da({
|
|
2427
|
+
pagination: se(e, "pagination"),
|
|
2428
|
+
pageItemRender: bt({
|
|
2429
|
+
slots: l,
|
|
2430
|
+
props: e,
|
|
2431
|
+
key: "pageItemRender"
|
|
2432
|
+
})
|
|
2433
|
+
}), $ = Ka(e), {
|
|
2434
|
+
proScroll: T,
|
|
2435
|
+
breakpoint: s
|
|
2436
|
+
} = za({
|
|
2437
|
+
...$,
|
|
2438
|
+
innerWidth: C,
|
|
2439
|
+
columns: oe,
|
|
2440
|
+
screens: r
|
|
2441
|
+
}), K = Fa(e), {
|
|
2442
|
+
proColumns: G,
|
|
2443
|
+
cacheProColumns: te,
|
|
2444
|
+
setColumns: Ce,
|
|
2445
|
+
changeColumns: Y,
|
|
2446
|
+
resizeColumnWidth: Ee
|
|
2447
|
+
} = Ba({
|
|
2448
|
+
...K,
|
|
2449
|
+
breakpoint: s,
|
|
2450
|
+
scroll: T,
|
|
2451
|
+
columns: oe
|
|
2452
|
+
}), {
|
|
2453
|
+
columnsMap: $e,
|
|
2454
|
+
operationType: ue,
|
|
2455
|
+
setColumnsMap: xe,
|
|
2456
|
+
sortKeyColumns: _,
|
|
2457
|
+
cacheColumnsMap: ye,
|
|
2458
|
+
setSortKeyColumns: J
|
|
2459
|
+
} = Pa({
|
|
2460
|
+
columns: te,
|
|
2461
|
+
columnsState: se(e, "columnsState"),
|
|
2462
|
+
changeColumns: Y
|
|
2463
|
+
}), {
|
|
2464
|
+
formDataRef: nt,
|
|
2465
|
+
formParamsRef: ot,
|
|
2466
|
+
defaultParamsRef: zt,
|
|
2467
|
+
setFormParams: qe
|
|
2468
|
+
} = Ma({
|
|
2469
|
+
searchMap: se(e, "searchMap"),
|
|
2470
|
+
params: se(e, "params"),
|
|
2471
|
+
columns: oe,
|
|
2472
|
+
setPagination: R
|
|
2473
|
+
}), {
|
|
2474
|
+
selectedKeys: it,
|
|
2475
|
+
selectedItems: Yt,
|
|
2476
|
+
changeRowKey: Lt,
|
|
2477
|
+
selectRowKey: ut,
|
|
2478
|
+
selectAllRowKey: st,
|
|
2479
|
+
syncSelectedRows: rt,
|
|
2480
|
+
removeRowKeys: ct,
|
|
2481
|
+
clearAllRowKeys: Wt
|
|
2482
|
+
} = Na(se(e, "rowKey"), se(e, "rowSelection")), Vt = ka(e), {
|
|
2483
|
+
reload: Re,
|
|
2484
|
+
reSetDataList: Ht,
|
|
2485
|
+
changeDataValue: qt,
|
|
2486
|
+
isTreeDataRef: Gt,
|
|
2487
|
+
dataSource: Fe,
|
|
2488
|
+
handleTableChange: dt
|
|
2489
|
+
} = Aa({
|
|
2490
|
+
...Vt,
|
|
2491
|
+
waitRequest: F
|
|
2492
|
+
}, {
|
|
2493
|
+
loading: ie,
|
|
2494
|
+
paginationInfo: t,
|
|
2495
|
+
setPagination: R,
|
|
2496
|
+
removeRowKeys: ct,
|
|
2497
|
+
syncSelectedRows: rt,
|
|
2498
|
+
setLoading: pe,
|
|
2499
|
+
setColumns: Ce,
|
|
2500
|
+
search: O,
|
|
2501
|
+
columns: G,
|
|
2502
|
+
formParamsRef: ot,
|
|
2503
|
+
onBeforeSearchSubmit: e.onBeforeSearchSubmit,
|
|
2504
|
+
hasCustomRender: S(() => we(e.customRender || l?.customRender))
|
|
2505
|
+
}, a), Be = S(() => e.options ? {
|
|
2506
|
+
...Qa,
|
|
2507
|
+
...q(e.options) ? e.options : {}
|
|
2508
|
+
} : !1), _t = S(() => ({
|
|
2509
|
+
size: p(he),
|
|
2510
|
+
scroll: p(T),
|
|
2511
|
+
dataSource: p(Fe),
|
|
2512
|
+
pagination: p(t),
|
|
2513
|
+
virtualScroll: W.value,
|
|
2514
|
+
columns: p(G).filter((g) => g.show || g.show === void 0)
|
|
2515
|
+
})), ft = S(() => {
|
|
2516
|
+
const g = q(e.loading) ? je(e.loading, "spinning") : {};
|
|
2517
|
+
return !g.indicator && m?.indicator?.value && (g.indicator = m?.indicator?.value), {
|
|
2518
|
+
spinning: e.showLoading ? we(ae.value) : !1,
|
|
2519
|
+
...g
|
|
2520
|
+
};
|
|
2521
|
+
}), ht = S(() => {
|
|
2522
|
+
let g;
|
|
2523
|
+
const w = p(E).direction === "rtl" ? "bottomLeft" : "right", B = p(t)?.position;
|
|
2524
|
+
if (B !== null && Array.isArray(B)) {
|
|
2525
|
+
const z = B.find((X) => X.includes("top")), Q = B.find((X) => X.includes("bottom")), A = B.every((X) => `${X}` == "none");
|
|
2526
|
+
!z && !Q && !A && (g = w), z && (g = z.toLowerCase().replace("top", "")), Q && (g = Q.toLowerCase().replace("bottom", ""));
|
|
2527
|
+
} else
|
|
2528
|
+
g = w;
|
|
2529
|
+
return g;
|
|
2530
|
+
});
|
|
2531
|
+
Ra(() => {
|
|
2532
|
+
d.value && e.keepAliveReload ? Re() : d.value = !0;
|
|
2533
|
+
});
|
|
2534
|
+
const mt = async (g, w) => {
|
|
2535
|
+
D.value ? ee.value?.reload && w ? (qe(g), await Re()) : qe(g) : (qe({
|
|
2536
|
+
...e.params || {},
|
|
2537
|
+
...g
|
|
2538
|
+
}), await Re());
|
|
2539
|
+
}, Qt = async (g, w) => {
|
|
2540
|
+
w === "reset" ? (a("reset", g), e.request && await mt(g, w)) : e.request ? (a("submit", g), await mt(g, w)) : a("submit", g);
|
|
2541
|
+
}, vt = (g, w, B, z) => {
|
|
2542
|
+
R(xt(g, ["current", "pageSize"])), dt(g, w, B, z);
|
|
2543
|
+
}, Xt = (g, w) => {
|
|
2544
|
+
R({
|
|
2545
|
+
current: g,
|
|
2546
|
+
pageSize: w
|
|
2547
|
+
}), dt({
|
|
2548
|
+
current: g,
|
|
2549
|
+
pageSize: w,
|
|
2550
|
+
total: t.value && t.value?.total || 0
|
|
2551
|
+
}, {}, {});
|
|
2552
|
+
}, Ut = (g) => {
|
|
2553
|
+
a("expandedRowsChange", g);
|
|
2554
|
+
}, Jt = (g, w) => {
|
|
2555
|
+
a("expand", g, w);
|
|
2556
|
+
}, Zt = (g, w) => Ee(g, w), el = (g, w, B) => {
|
|
2557
|
+
let z = g;
|
|
2558
|
+
if (w) {
|
|
2559
|
+
const Q = V(g) ? typeof g?.[0]?.children == "string" ? g?.[0]?.children : "" : g ? g.toString() : "", A = B.tooltip === !1 ? {} : B.tooltip, X = B.tooltip === !1 ? 1 : De(A?.hiddenLine) && A?.hiddenLine > 0 ? A?.hiddenLine : 1, Se = B.tooltip === !1 ? 0 : De(A?.width) ? A?.width : 0, al = B.tooltip !== !1 && kt(Q) && Se > 0 ? Dl(Q, {
|
|
2560
|
+
cssObject: {
|
|
2561
|
+
fontSize: "14px",
|
|
2562
|
+
lineHeight: "22px",
|
|
2563
|
+
fontFamily: y?.token?.value?.fontFamily || x?.value?.fontFamily,
|
|
2564
|
+
...A?.targetStyle || {}
|
|
2565
|
+
}
|
|
2566
|
+
}) : 0, nl = document.querySelector(`.${o} .ant-table-tbody`), Me = i("div", {
|
|
2567
|
+
class: `${o}-ellipsis-text`
|
|
2568
|
+
}, [g]), pt = () => B.tooltip === !1 || q(B.tooltip) && al < Se && Se > 0 ? Me : i(de, M({
|
|
2569
|
+
title: g,
|
|
2570
|
+
getPopupContainer: (Ge) => nl ?? Ge?.parentNode?.parentNode
|
|
2571
|
+
}, q(B.tooltip) ? B.tooltip : {}, {
|
|
2572
|
+
destroyTooltipOnHide: !0
|
|
2573
|
+
}), Ga(Me) ? Me : {
|
|
2574
|
+
default: () => [Me]
|
|
2575
|
+
});
|
|
2576
|
+
if (z = i("div", {
|
|
2577
|
+
class: `${o}-ellipsis ${A?.class ?? ""}`,
|
|
2578
|
+
style: {
|
|
2579
|
+
"-webkit-line-clamp": X
|
|
2580
|
+
}
|
|
2581
|
+
}, [pt()]), B.copyable) {
|
|
2582
|
+
const Ge = typeof B.copyText == "function" ? B.copyText?.(B) : B.copyText || Q;
|
|
2583
|
+
z = i("div", {
|
|
2584
|
+
class: `${o}-copyable`
|
|
2585
|
+
}, [i("div", {
|
|
2586
|
+
class: `${o}-ellipsis ${A?.class ?? ""}`,
|
|
2587
|
+
style: {
|
|
2588
|
+
"-webkit-line-clamp": X
|
|
2589
|
+
}
|
|
2590
|
+
}, [pt()]), i(wl, {
|
|
2591
|
+
class: `${o}-copyable-icon`,
|
|
2592
|
+
onClick: () => {
|
|
2593
|
+
qa(Ge), Ql.success("复制成功");
|
|
2594
|
+
}
|
|
2595
|
+
}, null)]);
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
return z;
|
|
2599
|
+
};
|
|
2600
|
+
function gt() {
|
|
2601
|
+
const g = jl({
|
|
2602
|
+
slots: l,
|
|
2603
|
+
props: e,
|
|
2604
|
+
key: "emptyText"
|
|
2605
|
+
});
|
|
2606
|
+
if (g !== !1 && m?.emptyText?.value !== !1) {
|
|
2607
|
+
const B = e.emptyTextProps?.extraProps || {}, z = g || m?.emptyText?.value, Q = U(z), A = Q ? Tt(z, B) : Bt(V(z) ? z : [z]);
|
|
2608
|
+
return i("div", {
|
|
2609
|
+
class: re(`${o}-empty-text`, h.value, e.emptyTextProps?.class),
|
|
2610
|
+
style: e.emptyTextProps?.style
|
|
2611
|
+
}, [Q ? A : V(A) ? A.map((X) => Ve(X, B)) : i(Xl, null, null)]);
|
|
2612
|
+
}
|
|
2613
|
+
return null;
|
|
2614
|
+
}
|
|
2615
|
+
const tl = () => {
|
|
2616
|
+
const g = bt({
|
|
2617
|
+
slots: l,
|
|
2618
|
+
props: e,
|
|
2619
|
+
key: "customRender"
|
|
2620
|
+
});
|
|
2621
|
+
if (g) {
|
|
2622
|
+
if (Fe.value?.length) {
|
|
2623
|
+
const w = Z(p(Fe));
|
|
2624
|
+
return g?.({
|
|
2625
|
+
dataSource: w,
|
|
2626
|
+
currentData: Ha(w, t.value)
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
return gt();
|
|
2630
|
+
}
|
|
2631
|
+
return i(ke, null, null);
|
|
2632
|
+
}, ll = (g) => {
|
|
2633
|
+
const w = Ol({
|
|
2634
|
+
slots: l,
|
|
2635
|
+
props: e,
|
|
2636
|
+
keys: ["headerTitle", "titleTip", "toolBarBtn", "settingExtra", "optionsExtra"],
|
|
2637
|
+
render: !0
|
|
2638
|
+
});
|
|
2639
|
+
return i(Ta, {
|
|
2640
|
+
titleTipText: e.titleTipText,
|
|
2641
|
+
options: le(Be.value) ? Be.value : {
|
|
2642
|
+
...Be.value,
|
|
2643
|
+
setting: g ? !1 : Be.value?.setting,
|
|
2644
|
+
density: g ? !1 : Be.value?.density
|
|
2645
|
+
},
|
|
2646
|
+
headerTitle: w.headerTitle,
|
|
2647
|
+
titleTip: w.titleTip,
|
|
2648
|
+
settingExtra: w.settingExtra,
|
|
2649
|
+
optionsExtra: w.optionsExtra,
|
|
2650
|
+
toolBarBtn: w.toolBarBtn
|
|
2651
|
+
}, null);
|
|
2652
|
+
};
|
|
2653
|
+
return ea({
|
|
2654
|
+
tableSize: he,
|
|
2655
|
+
columns: G,
|
|
2656
|
+
cacheColumns: oe,
|
|
2657
|
+
isMobile: L,
|
|
2658
|
+
searchConfig: j,
|
|
2659
|
+
manualSearch: D,
|
|
2660
|
+
searchActions: ee,
|
|
2661
|
+
action: {
|
|
2662
|
+
setTableSize: Te,
|
|
2663
|
+
reload: (g) => Re(g),
|
|
2664
|
+
toggle: I
|
|
2665
|
+
},
|
|
2666
|
+
settingsAction: {
|
|
2667
|
+
autoScroll: se(e, "autoScroll"),
|
|
2668
|
+
columnsMap: $e,
|
|
2669
|
+
operationType: ue,
|
|
2670
|
+
setColumnsMap: xe,
|
|
2671
|
+
sortKeyColumns: _,
|
|
2672
|
+
cacheColumnsMap: ye,
|
|
2673
|
+
setSortKeyColumns: J
|
|
2674
|
+
},
|
|
2675
|
+
setPagination: R,
|
|
2676
|
+
changeColumns: Y,
|
|
2677
|
+
slots: l
|
|
2678
|
+
}), u({
|
|
2679
|
+
formRef: () => ({
|
|
2680
|
+
getFormState: () => p(ot),
|
|
2681
|
+
getFormInnerState: () => v.value?.getFormState() || {},
|
|
2682
|
+
restFormState: (g) => {
|
|
2683
|
+
F.value = !0, g && g?.(), v.value?.resetForm(!1), F.value = !1;
|
|
2684
|
+
}
|
|
2685
|
+
}),
|
|
2686
|
+
actionRef: () => ({
|
|
2687
|
+
loading: ae,
|
|
2688
|
+
dataSource: Fe,
|
|
2689
|
+
pageState: f,
|
|
2690
|
+
pagination: t.value,
|
|
2691
|
+
selectedKeys: S(() => it.value),
|
|
2692
|
+
selectedItems: S(() => Yt.value),
|
|
2693
|
+
rowsSelection: {
|
|
2694
|
+
clear: Wt,
|
|
2695
|
+
select: ut,
|
|
2696
|
+
remove: ct,
|
|
2697
|
+
sync: rt,
|
|
2698
|
+
selectAll: st
|
|
2699
|
+
},
|
|
2700
|
+
reload: Re,
|
|
2701
|
+
getLoadingStatus: () => p(ie),
|
|
2702
|
+
reloadAndReset: async (g) => {
|
|
2703
|
+
F.value = !0, R({
|
|
2704
|
+
current: 1,
|
|
2705
|
+
pageSize: f?.pageSize || 10
|
|
2706
|
+
}), g?.callBack && (g?.wait ? await g?.callBack?.() : g?.callBack?.()), v.value?.resetForm(!1), F.value = !1;
|
|
2707
|
+
},
|
|
2708
|
+
reSetDataList: Ht,
|
|
2709
|
+
setPageAndReload: vt,
|
|
2710
|
+
setPagination: R,
|
|
2711
|
+
setDataValue: qt,
|
|
2712
|
+
setLoading: pe
|
|
2713
|
+
})
|
|
2714
|
+
}), () => {
|
|
2715
|
+
const g = we(e.customRender || l.customRender);
|
|
2716
|
+
return c(i("div", {
|
|
2717
|
+
ref: b,
|
|
2718
|
+
class: re([{
|
|
2719
|
+
[`${h.value}`]: !0,
|
|
2720
|
+
[`${o}`]: !0,
|
|
2721
|
+
[`${n.class}`]: n.class,
|
|
2722
|
+
[`${o}-beautify-scroll`]: le(e.useDefaultScrollStyle) ? !e.useDefaultScrollStyle : !0,
|
|
2723
|
+
[`${o}-no-scroll`]: !Object.keys(p(T) || {}).length,
|
|
2724
|
+
[`${o}-table-tree`]: Gt.value,
|
|
2725
|
+
[`${o}-full-screen`]: k.value
|
|
2726
|
+
}]),
|
|
2727
|
+
style: n.style
|
|
2728
|
+
}, [i("div", {
|
|
2729
|
+
class: [`${o}-content`, h.value]
|
|
2730
|
+
}, [(nt.value.length > 0 || we(l.search)) && e.search !== !1 && i(Et, {
|
|
2731
|
+
ref: v,
|
|
2732
|
+
modal: e.modalScroll,
|
|
2733
|
+
cardBordered: e.cardBordered,
|
|
2734
|
+
searchMap: nt.value,
|
|
2735
|
+
prefixCls: o,
|
|
2736
|
+
loading: !!p(ie),
|
|
2737
|
+
onSearch: Qt,
|
|
2738
|
+
defaultParams: zt
|
|
2739
|
+
}, {
|
|
2740
|
+
default: l.search ? () => l.search?.() : null
|
|
2741
|
+
}), i("div", {
|
|
2742
|
+
class: re(h.value, `${o}-card`, e.cardBordered && `${o}-card-border`)
|
|
2743
|
+
}, [ll(g), g ? i(Dt, ft.value, {
|
|
2744
|
+
default: () => [i("div", {
|
|
2745
|
+
class: `${o}-wrapper ${h.value}`
|
|
2746
|
+
}, [i("div", {
|
|
2747
|
+
class: re(`${o}-list`, h.value, e.tableProps?.class),
|
|
2748
|
+
style: e.tableProps?.style
|
|
2749
|
+
}, [tl()]), e.pagination !== !1 && Fe.value?.length > 0 && i(Gl, M({
|
|
2750
|
+
class: {
|
|
2751
|
+
[`${o}-pagination ${h.value}`]: !0,
|
|
2752
|
+
[`${o}-pagination-${ht.value} ${h.value}`]: !!ht.value
|
|
2753
|
+
}
|
|
2754
|
+
}, ve(p(t)), {
|
|
2755
|
+
onChange: Xt
|
|
2756
|
+
}), null)])]
|
|
2757
|
+
}) : i(_l, M(xt(e, Object.keys(Nt)), _t.value, {
|
|
2758
|
+
style: e.tableProps?.style,
|
|
2759
|
+
class: e.tableProps?.class,
|
|
2760
|
+
loading: ft.value,
|
|
2761
|
+
rowKey: (w) => w[e.rowKey],
|
|
2762
|
+
transformCellText: (w) => {
|
|
2763
|
+
e.transformCellText && typeof e.transformCellText && e.transformCellText?.(w);
|
|
2764
|
+
const {
|
|
2765
|
+
column: B
|
|
2766
|
+
} = w;
|
|
2767
|
+
if (!B) return w.text;
|
|
2768
|
+
const z = B?.key || B?.dataIndex;
|
|
2769
|
+
let Q = !0, A = w.text;
|
|
2770
|
+
if (V(A))
|
|
2771
|
+
if (A.length === 0 || A.length === 1 && !U(A[0])) {
|
|
2772
|
+
A = A?.[0];
|
|
2773
|
+
const X = Al(A, B?.columnEmptyText || e?.columnEmptyText || "");
|
|
2774
|
+
Q = X.success, A = Va(X.value, B?.valueType || e.columns?.find((Se) => (Se.key || Se.dataIndex) === z)?.valueType, o, h.value);
|
|
2775
|
+
} else A[0]?.type === "template" && (A = A[0]?.children);
|
|
2776
|
+
return B?.ellipsis ? el(A, Q, B) : A;
|
|
2777
|
+
},
|
|
2778
|
+
rowSelection: e.rowSelection ? {
|
|
2779
|
+
...je(e.rowSelection, ["onSelect", "onSelectAll", "onChange", "selectedRowKeys"]),
|
|
2780
|
+
selectedRowKeys: it.value || [],
|
|
2781
|
+
onSelect: ut,
|
|
2782
|
+
onSelectAll: st,
|
|
2783
|
+
onChange: Lt
|
|
2784
|
+
} : void 0,
|
|
2785
|
+
onChange: vt,
|
|
2786
|
+
onExpandedRowsChange: Ut,
|
|
2787
|
+
onExpand: Jt,
|
|
2788
|
+
onResizeColumn: (w, B) => Zt(w, B)
|
|
2789
|
+
}), {
|
|
2790
|
+
...l,
|
|
2791
|
+
emptyText: () => gt()
|
|
2792
|
+
})])])]));
|
|
2793
|
+
};
|
|
2794
|
+
}
|
|
2795
|
+
});
|
|
2796
|
+
et.install = (e) => (e.component(et.name, et), e);
|
|
2797
|
+
function dn(e, a) {
|
|
2798
|
+
function l() {
|
|
2799
|
+
if (a?.state) {
|
|
2800
|
+
if (_e(a.state) && q(a.state.value))
|
|
2801
|
+
return Z({
|
|
2802
|
+
...a.state.value,
|
|
2803
|
+
params: a.state.value?.params || {}
|
|
2804
|
+
});
|
|
2805
|
+
if (q(a.state) && !_e(a.state))
|
|
2806
|
+
return Z({
|
|
2807
|
+
...ve(a.state),
|
|
2808
|
+
params: a.state?.params || {}
|
|
2809
|
+
});
|
|
2810
|
+
}
|
|
2811
|
+
return {};
|
|
2812
|
+
}
|
|
2813
|
+
const n = P({
|
|
2814
|
+
...l(),
|
|
2815
|
+
request: a?.request
|
|
2816
|
+
});
|
|
2817
|
+
a?.state && (_e(a.state) ? N(() => a.state.value, () => {
|
|
2818
|
+
x();
|
|
2819
|
+
}, { deep: !0 }) : fl(a.state) && N(() => a?.state, () => {
|
|
2820
|
+
x();
|
|
2821
|
+
}, { deep: !0 }));
|
|
2822
|
+
const u = S(() => e?.value?.actionRef?.()), o = S(() => e?.value?.formRef?.()), c = S(() => ({
|
|
2823
|
+
...u.value?.pageState || {},
|
|
2824
|
+
...o.value?.getFormState?.() || {}
|
|
2825
|
+
})), h = P(!!u.value?.loading?.value);
|
|
2826
|
+
N(() => u.value?.loading?.value, (y) => {
|
|
2827
|
+
h.value = !!y;
|
|
2828
|
+
}), N(h, (y) => {
|
|
2829
|
+
u.value?.setLoading?.(!!y);
|
|
2830
|
+
});
|
|
2831
|
+
function x() {
|
|
2832
|
+
n.value = It(n.value, l(), {
|
|
2833
|
+
omitNil: !0,
|
|
2834
|
+
omitEmpty: !0
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
return {
|
|
2838
|
+
formRef: o,
|
|
2839
|
+
actionRef: u,
|
|
2840
|
+
tableState: Ml(n),
|
|
2841
|
+
requestSearch: c,
|
|
2842
|
+
loading: h,
|
|
2843
|
+
dataSource: S(() => u?.value?.dataSource?.value || []),
|
|
2844
|
+
selectedKeys: S(() => u?.value?.selectedKeys?.value || []),
|
|
2845
|
+
selectedItems: S(() => u?.value?.selectedItems?.value || []),
|
|
2846
|
+
rowsSelection: u?.value?.rowsSelection,
|
|
2847
|
+
mutate: (y) => u.value?.reSetDataList?.(y),
|
|
2848
|
+
reloadAndReset: (y) => u.value?.reloadAndReset?.(y),
|
|
2849
|
+
setPageAndReload: (y, r, C, d) => u.value?.setPageAndReload?.(y, r, C, d),
|
|
2850
|
+
setPagination: (y) => u.value?.setPagination?.(y),
|
|
2851
|
+
setLoading: (y) => h.value = y,
|
|
2852
|
+
setDataValue: (y) => u.value?.setDataValue?.(y),
|
|
2853
|
+
reload: (y) => u.value?.reload?.(y)
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2856
|
+
export {
|
|
2857
|
+
et as GProTable,
|
|
2858
|
+
ce as proTableProps,
|
|
2859
|
+
dn as useTable
|
|
2860
|
+
};
|