@ys-knife-crud/antd 0.0.0-stage → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/antd/src/advancedFilter/advancedConditionGroup.d.ts +13 -0
- package/dist/antd/src/advancedFilter/advancedConditionGroup.d.ts.map +1 -0
- package/dist/antd/src/advancedFilter/advancedFilterContext.d.ts +40 -0
- package/dist/antd/src/advancedFilter/advancedFilterContext.d.ts.map +1 -0
- package/dist/antd/src/advancedFilter/advancedFilterPanel.d.ts +44 -0
- package/dist/antd/src/advancedFilter/advancedFilterPanel.d.ts.map +1 -0
- package/dist/antd/src/advancedFilter/advancedValueEditor.d.ts +30 -0
- package/dist/antd/src/advancedFilter/advancedValueEditor.d.ts.map +1 -0
- package/dist/antd/src/commandBar/commandBar.d.ts +24 -0
- package/dist/antd/src/commandBar/commandBar.d.ts.map +1 -0
- package/dist/antd/src/commandBar/tableActionMenuButton.d.ts +22 -0
- package/dist/antd/src/commandBar/tableActionMenuButton.d.ts.map +1 -0
- package/dist/antd/src/filter/dateFilterItem.d.ts +21 -0
- package/dist/antd/src/filter/dateFilterItem.d.ts.map +1 -0
- package/dist/antd/src/filter/dateRangeFilterItem.d.ts +23 -0
- package/dist/antd/src/filter/dateRangeFilterItem.d.ts.map +1 -0
- package/dist/antd/src/filter/enumFilterItem.d.ts +25 -0
- package/dist/antd/src/filter/enumFilterItem.d.ts.map +1 -0
- package/dist/antd/src/filter/filterItemLayout.d.ts +19 -0
- package/dist/antd/src/filter/filterItemLayout.d.ts.map +1 -0
- package/dist/antd/src/filter/filterPanel.d.ts +54 -0
- package/dist/antd/src/filter/filterPanel.d.ts.map +1 -0
- package/dist/antd/src/filter/rootFilterPanel.d.ts +27 -0
- package/dist/antd/src/filter/rootFilterPanel.d.ts.map +1 -0
- package/dist/antd/src/filter/textFilterItem.d.ts +19 -0
- package/dist/antd/src/filter/textFilterItem.d.ts.map +1 -0
- package/dist/antd/src/importExcel/formatCell.d.ts +3 -0
- package/dist/antd/src/importExcel/formatCell.d.ts.map +1 -0
- package/dist/antd/src/importExcel/importExcel.d.ts +53 -0
- package/dist/antd/src/importExcel/importExcel.d.ts.map +1 -0
- package/dist/antd/src/importExcel/importRowEditDialog.d.ts +29 -0
- package/dist/antd/src/importExcel/importRowEditDialog.d.ts.map +1 -0
- package/dist/antd/src/index.d.ts +45 -0
- package/dist/antd/src/index.d.ts.map +1 -0
- package/dist/antd/src/mainPanel/mainPanel.d.ts +27 -0
- package/dist/antd/src/mainPanel/mainPanel.d.ts.map +1 -0
- package/dist/antd/src/mainPanel/mainPanelMenuNode.d.ts +16 -0
- package/dist/antd/src/mainPanel/mainPanelMenuNode.d.ts.map +1 -0
- package/dist/antd/src/modal/openDialog.d.ts +10 -0
- package/dist/antd/src/modal/openDialog.d.ts.map +1 -0
- package/dist/antd/src/modal/openModal.d.ts +3 -0
- package/dist/antd/src/modal/openModal.d.ts.map +1 -0
- package/dist/antd/src/shared/button.d.ts +9 -0
- package/dist/antd/src/shared/button.d.ts.map +1 -0
- package/dist/antd/src/shared/icon.d.ts +7 -0
- package/dist/antd/src/shared/icon.d.ts.map +1 -0
- package/dist/antd/src/table/cardView.d.ts +22 -0
- package/dist/antd/src/table/cardView.d.ts.map +1 -0
- package/dist/antd/src/table/columnConfigDialog.d.ts +23 -0
- package/dist/antd/src/table/columnConfigDialog.d.ts.map +1 -0
- package/dist/antd/src/table/contextMenu.d.ts +21 -0
- package/dist/antd/src/table/contextMenu.d.ts.map +1 -0
- package/dist/antd/src/table/exportExcelDialog.d.ts +31 -0
- package/dist/antd/src/table/exportExcelDialog.d.ts.map +1 -0
- package/dist/antd/src/table/infiniteList.d.ts +85 -0
- package/dist/antd/src/table/infiniteList.d.ts.map +1 -0
- package/dist/antd/src/table/listView.d.ts +22 -0
- package/dist/antd/src/table/listView.d.ts.map +1 -0
- package/dist/antd/src/table/rowActionsColumn.d.ts +19 -0
- package/dist/antd/src/table/rowActionsColumn.d.ts.map +1 -0
- package/dist/antd/src/table/selectionBar.d.ts +18 -0
- package/dist/antd/src/table/selectionBar.d.ts.map +1 -0
- package/dist/antd/src/table/table.d.ts +54 -0
- package/dist/antd/src/table/table.d.ts.map +1 -0
- package/dist/antd/src/tablepage/tablePage.d.ts +87 -0
- package/dist/antd/src/tablepage/tablePage.d.ts.map +1 -0
- package/dist/antd/src/tablepage/tablePageTypes.d.ts +9 -0
- package/dist/antd/src/tablepage/tablePageTypes.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3849 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -3
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,3849 @@
|
|
|
1
|
+
import { jsxs as h, jsx as n, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement as Kn, createElement as qn, useEffect as K, forwardRef as be, useRef as x, useState as E, useCallback as he, useMemo as Se, useImperativeHandle as Pe, createContext as zr, useContext as Qr, useReducer as Vr, Suspense as Yr } from "react";
|
|
3
|
+
import { Checkbox as Dt, Empty as ut, Modal as De, Input as Ze, Button as O, Progress as Un, Table as Gn, Pagination as jr, DatePicker as Mt, Popover as Hr, InputNumber as It, Select as je, Radio as Xt, message as Ce, Tooltip as Dn, Tag as Jn, Dropdown as Wr, Spin as rn, Menu as Bn, Tabs as Kr, Alert as qr, Form as $n } from "antd";
|
|
4
|
+
import { visibleActions as ln, isEnabled as Xn, useDefault as Ur, useSelection as Zn, useRowActions as Gr, useCustomConfig as Jr, useExportExcel as er, useAdvancedFilter as Xr, useFilterPanel as Zr, FilterPanelContext as ei, useMainPanelNodes as ti, useMainPanelTabs as ni, filterNodesByKeyword as ri, collectGroupKeys as ii, findNode as Ln, isGroupNode as zn, useFilterItem as li, useTextFilterItem as oi, useDateFilterItem as ai, useDateRangeFilterItem as si, useEnumFilterItem as ci, useImportExcel as ui } from "@ys-knife-crud/react";
|
|
5
|
+
import di, { createPortal as fi } from "react-dom";
|
|
6
|
+
import { Operator as pe, isConditionGroup as At, OPERATOR_LABELS as hi, isNullOperator as tr, emptyFilter as dt, FilterInfo as Je, inferColumnFieldType as mi, filter as Ee, isRangeOperator as yi, isMultiValueOperator as gi } from "@ys-knife-crud/core";
|
|
7
|
+
import { fromArray as eo, fromBool as to, fromObjectItems as no, fromOptions as ro } from "@ys-knife-crud/core";
|
|
8
|
+
import Xe from "dayjs";
|
|
9
|
+
import './index.css';function vi(t) {
|
|
10
|
+
const { rows: e, rowKey: r, showCheckbox: i, loading: l, hasActions: a, isSelected: s, onCheck: o, onContextMenu: c, card: d, empty: _ } = t;
|
|
11
|
+
return /* @__PURE__ */ h("div", { className: "yk-table__cards", children: [
|
|
12
|
+
e.map((b, S) => {
|
|
13
|
+
const v = i && s(b);
|
|
14
|
+
return /* @__PURE__ */ h(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: `yk-table__card${v ? " is-selected" : ""}${a ? " has-actions" : ""}`,
|
|
18
|
+
title: a ? "右键查看行操作" : void 0,
|
|
19
|
+
onContextMenu: (w) => c(w, b),
|
|
20
|
+
children: [
|
|
21
|
+
i ? /* @__PURE__ */ n(
|
|
22
|
+
Dt,
|
|
23
|
+
{
|
|
24
|
+
className: "yk-table__card-checkbox",
|
|
25
|
+
checked: v,
|
|
26
|
+
onChange: (w) => o(b, w.target.checked)
|
|
27
|
+
}
|
|
28
|
+
) : null,
|
|
29
|
+
d ? d(b, S) : /* @__PURE__ */ n("pre", { className: "yk-table__card-json", children: JSON.stringify(b, null, 2) })
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
String(b[r])
|
|
33
|
+
);
|
|
34
|
+
}),
|
|
35
|
+
!l && e.length === 0 ? /* @__PURE__ */ n(X, { children: _ ?? /* @__PURE__ */ n(ut, { className: "yk-table__cards-empty", description: "暂无数据" }) }) : null
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
function Qn(t, e, r) {
|
|
39
|
+
return t.map((i, l) => l === e ? { ...i, ...r } : i);
|
|
40
|
+
}
|
|
41
|
+
function pi({
|
|
42
|
+
open: t,
|
|
43
|
+
drafts: e,
|
|
44
|
+
onCancel: r,
|
|
45
|
+
onSave: i,
|
|
46
|
+
onReset: l,
|
|
47
|
+
onMove: a,
|
|
48
|
+
onDraftsChange: s
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ n(
|
|
51
|
+
De,
|
|
52
|
+
{
|
|
53
|
+
open: t,
|
|
54
|
+
title: "列设置",
|
|
55
|
+
width: 480,
|
|
56
|
+
destroyOnClose: !0,
|
|
57
|
+
onCancel: r,
|
|
58
|
+
footer: /* @__PURE__ */ h(X, { children: [
|
|
59
|
+
/* @__PURE__ */ n(O, { onClick: l, children: "重置" }),
|
|
60
|
+
/* @__PURE__ */ n(O, { onClick: r, children: "取消" }),
|
|
61
|
+
/* @__PURE__ */ n(
|
|
62
|
+
O,
|
|
63
|
+
{
|
|
64
|
+
type: "primary",
|
|
65
|
+
className: "yk-col-config-save",
|
|
66
|
+
onClick: () => void i(),
|
|
67
|
+
children: "保存"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }),
|
|
71
|
+
children: /* @__PURE__ */ n("div", { className: "yk-col-config", children: e.map((o, c) => /* @__PURE__ */ h("div", { className: "yk-col-config-row", children: [
|
|
72
|
+
/* @__PURE__ */ n(
|
|
73
|
+
Dt,
|
|
74
|
+
{
|
|
75
|
+
className: "yk-col-config-name",
|
|
76
|
+
checked: o.visible,
|
|
77
|
+
onChange: (d) => s(
|
|
78
|
+
Qn(e, c, { visible: d.target.checked })
|
|
79
|
+
),
|
|
80
|
+
children: o.displayName
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ n(
|
|
84
|
+
Ze,
|
|
85
|
+
{
|
|
86
|
+
className: "yk-col-config-width",
|
|
87
|
+
size: "small",
|
|
88
|
+
value: o.width,
|
|
89
|
+
placeholder: "宽度(如 120)",
|
|
90
|
+
onChange: (d) => s(
|
|
91
|
+
Qn(e, c, { width: d.target.value })
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ n(
|
|
96
|
+
O,
|
|
97
|
+
{
|
|
98
|
+
type: "link",
|
|
99
|
+
disabled: c === 0,
|
|
100
|
+
onClick: () => a(c, -1),
|
|
101
|
+
children: "上移"
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ n(
|
|
105
|
+
O,
|
|
106
|
+
{
|
|
107
|
+
type: "link",
|
|
108
|
+
disabled: c === e.length - 1,
|
|
109
|
+
onClick: () => a(c, 1),
|
|
110
|
+
children: "下移"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }, o.propertyPath)) })
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
function Bt(t) {
|
|
118
|
+
return t == null || t === !1 ? null : Kn(t) || typeof t == "string" || typeof t == "number" ? t : typeof t == "function" ? qn(t) : null;
|
|
119
|
+
}
|
|
120
|
+
function _i({ menu: t, actions: e, isEnabled: r, onClose: i, onSelect: l }) {
|
|
121
|
+
return K(() => {
|
|
122
|
+
if (!t) return;
|
|
123
|
+
const a = (s) => {
|
|
124
|
+
s.key === "Escape" && i();
|
|
125
|
+
};
|
|
126
|
+
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
127
|
+
}, [t, i]), !t || typeof document > "u" ? null : fi(
|
|
128
|
+
/* @__PURE__ */ h(X, { children: [
|
|
129
|
+
/* @__PURE__ */ n(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: "yk-table__menu-mask",
|
|
133
|
+
onClick: i,
|
|
134
|
+
onContextMenu: (a) => {
|
|
135
|
+
a.preventDefault(), i();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ n("ul", { className: "yk-table__context-menu", style: { left: t.x, top: t.y }, children: e.map((a) => {
|
|
140
|
+
const s = r(a, t.row);
|
|
141
|
+
return /* @__PURE__ */ h(
|
|
142
|
+
"li",
|
|
143
|
+
{
|
|
144
|
+
className: `yk-table__context-menu-item${s ? "" : " is-disabled"}`,
|
|
145
|
+
onClick: () => {
|
|
146
|
+
s && l(a);
|
|
147
|
+
},
|
|
148
|
+
children: [
|
|
149
|
+
a.icon ? /* @__PURE__ */ n("span", { className: "yk-table__context-menu-icon", children: Bt(a.icon) }) : null,
|
|
150
|
+
a.desc
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
a.name
|
|
154
|
+
);
|
|
155
|
+
}) })
|
|
156
|
+
] }),
|
|
157
|
+
document.body
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function ki(t) {
|
|
161
|
+
if (t == null) return null;
|
|
162
|
+
if (t < 60) return `${t} 秒`;
|
|
163
|
+
const e = Math.floor(t / 60), r = t % 60;
|
|
164
|
+
return r > 0 ? `${e} 分 ${r} 秒` : `${e} 分`;
|
|
165
|
+
}
|
|
166
|
+
function nr({
|
|
167
|
+
open: t,
|
|
168
|
+
options: e,
|
|
169
|
+
exporting: r,
|
|
170
|
+
fetched: i,
|
|
171
|
+
total: l,
|
|
172
|
+
totalKnown: a,
|
|
173
|
+
percent: s,
|
|
174
|
+
etaSeconds: o,
|
|
175
|
+
cancelledVisible: c,
|
|
176
|
+
cancelledRows: d,
|
|
177
|
+
onExport: _,
|
|
178
|
+
onCancelExport: b,
|
|
179
|
+
onKeepPartial: S,
|
|
180
|
+
onDiscardPartial: v,
|
|
181
|
+
onClose: w
|
|
182
|
+
}) {
|
|
183
|
+
const T = ki(o);
|
|
184
|
+
return /* @__PURE__ */ h(X, { children: [
|
|
185
|
+
/* @__PURE__ */ n(
|
|
186
|
+
De,
|
|
187
|
+
{
|
|
188
|
+
open: t,
|
|
189
|
+
title: "导出 Excel",
|
|
190
|
+
width: 420,
|
|
191
|
+
destroyOnClose: !0,
|
|
192
|
+
onCancel: w,
|
|
193
|
+
footer: null,
|
|
194
|
+
children: /* @__PURE__ */ n("div", { className: "yk-export-options", children: e.map((P) => /* @__PURE__ */ n(
|
|
195
|
+
O,
|
|
196
|
+
{
|
|
197
|
+
block: !0,
|
|
198
|
+
className: "yk-export-option",
|
|
199
|
+
"data-scope": P.value,
|
|
200
|
+
disabled: P.disabled,
|
|
201
|
+
onClick: () => _(P.value),
|
|
202
|
+
children: P.label
|
|
203
|
+
},
|
|
204
|
+
P.value
|
|
205
|
+
)) })
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
/* @__PURE__ */ h(
|
|
209
|
+
De,
|
|
210
|
+
{
|
|
211
|
+
open: r,
|
|
212
|
+
title: "正在导出",
|
|
213
|
+
width: 420,
|
|
214
|
+
closable: !1,
|
|
215
|
+
maskClosable: !1,
|
|
216
|
+
keyboard: !1,
|
|
217
|
+
destroyOnClose: !0,
|
|
218
|
+
footer: /* @__PURE__ */ n(O, { onClick: b, children: "取消" }),
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ n(Un, { percent: s }),
|
|
221
|
+
/* @__PURE__ */ h("p", { className: "yk-export-progress-text", children: [
|
|
222
|
+
"已加载 ",
|
|
223
|
+
i,
|
|
224
|
+
a ? ` / ${l}` : "",
|
|
225
|
+
" 条",
|
|
226
|
+
T ? `,预计剩余约 ${T}` : ""
|
|
227
|
+
] })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ n(
|
|
232
|
+
De,
|
|
233
|
+
{
|
|
234
|
+
open: c,
|
|
235
|
+
title: "导出已取消",
|
|
236
|
+
width: 420,
|
|
237
|
+
destroyOnClose: !0,
|
|
238
|
+
onCancel: v,
|
|
239
|
+
footer: /* @__PURE__ */ h(X, { children: [
|
|
240
|
+
/* @__PURE__ */ n(O, { className: "yk-export-discard", onClick: v, children: "丢弃" }),
|
|
241
|
+
/* @__PURE__ */ n(
|
|
242
|
+
O,
|
|
243
|
+
{
|
|
244
|
+
className: "yk-export-keep",
|
|
245
|
+
type: "primary",
|
|
246
|
+
onClick: S,
|
|
247
|
+
children: "保留部分文件"
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] }),
|
|
251
|
+
children: /* @__PURE__ */ h("p", { className: "yk-export-cancelled-text", children: [
|
|
252
|
+
"已写入 ",
|
|
253
|
+
d,
|
|
254
|
+
" 条数据,是否保留已导出的部分文件?"
|
|
255
|
+
] })
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] });
|
|
259
|
+
}
|
|
260
|
+
function bi(t) {
|
|
261
|
+
const { rows: e, rowKey: r, showCheckbox: i, loading: l, hasActions: a, isSelected: s, onCheck: o, onContextMenu: c, list: d, empty: _ } = t;
|
|
262
|
+
return /* @__PURE__ */ h("div", { className: "yk-table__list", children: [
|
|
263
|
+
e.map((b, S) => {
|
|
264
|
+
const v = i && s(b);
|
|
265
|
+
return /* @__PURE__ */ h(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
className: `yk-table__list-item${v ? " is-selected" : ""}${a ? " has-actions" : ""}`,
|
|
269
|
+
title: a ? "右键查看行操作" : void 0,
|
|
270
|
+
onContextMenu: (w) => c(w, b),
|
|
271
|
+
children: [
|
|
272
|
+
i ? /* @__PURE__ */ n(
|
|
273
|
+
Dt,
|
|
274
|
+
{
|
|
275
|
+
className: "yk-table__list-item-checkbox",
|
|
276
|
+
checked: v,
|
|
277
|
+
onChange: (w) => o(b, w.target.checked)
|
|
278
|
+
}
|
|
279
|
+
) : null,
|
|
280
|
+
/* @__PURE__ */ n("div", { className: "yk-table__list-item-body", children: d ? d(b, S) : /* @__PURE__ */ n("pre", { className: "yk-table__list-item-json", children: JSON.stringify(b, null, 2) }) })
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
String(b[r])
|
|
284
|
+
);
|
|
285
|
+
}),
|
|
286
|
+
!l && e.length === 0 ? /* @__PURE__ */ n(X, { children: _ ?? /* @__PURE__ */ n(ut, { description: "暂无数据" }) }) : null
|
|
287
|
+
] });
|
|
288
|
+
}
|
|
289
|
+
function un(t, e) {
|
|
290
|
+
return t === "danger" ? { type: e ? "default" : "primary", danger: !0 } : t === "primary" ? { type: "primary" } : { type: "default" };
|
|
291
|
+
}
|
|
292
|
+
function xi({ actions: t, table: e, row: r }) {
|
|
293
|
+
return /* @__PURE__ */ n("div", { className: "yk-row-actions", children: ln(t, r).map((i) => {
|
|
294
|
+
const l = un(i.type, !0);
|
|
295
|
+
return /* @__PURE__ */ h(
|
|
296
|
+
O,
|
|
297
|
+
{
|
|
298
|
+
type: "link",
|
|
299
|
+
size: "small",
|
|
300
|
+
danger: l.danger,
|
|
301
|
+
disabled: !Xn(i, r),
|
|
302
|
+
className: "yk-row-action",
|
|
303
|
+
onClick: () => void i.execute(r, e),
|
|
304
|
+
children: [
|
|
305
|
+
i.icon ? /* @__PURE__ */ n("span", { className: "yk-row-action__icon", children: Bt(i.icon) }) : null,
|
|
306
|
+
i.desc
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
i.name
|
|
310
|
+
);
|
|
311
|
+
}) });
|
|
312
|
+
}
|
|
313
|
+
function wi({ actions: t, table: e }) {
|
|
314
|
+
return t.length === 0 ? null : {
|
|
315
|
+
key: "__actions",
|
|
316
|
+
title: "操作",
|
|
317
|
+
fixed: "right",
|
|
318
|
+
width: t.length * 34 + (t.length - 1) * 12 + 30,
|
|
319
|
+
render: (i, l) => /* @__PURE__ */ n(xi, { actions: t, table: e, row: l })
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
const Ci = 20, Si = [10, 20, 50, 100], Ni = 1e3;
|
|
323
|
+
function Pi(t) {
|
|
324
|
+
if (!t) return;
|
|
325
|
+
const e = Number.parseInt(t, 10);
|
|
326
|
+
return Number.isFinite(e) ? e : void 0;
|
|
327
|
+
}
|
|
328
|
+
function Vn(t) {
|
|
329
|
+
return t == null ? null : Kn(t) || typeof t == "string" || typeof t == "number" ? t : typeof t == "boolean" ? t ? "true" : "false" : String(t);
|
|
330
|
+
}
|
|
331
|
+
const Ii = be(function(e, r) {
|
|
332
|
+
const i = e.pageSize ?? Ci, l = e.pageSizes ?? Si, a = e.rowKey ?? "id", s = e.exportPageSize ?? Ni, o = x(e);
|
|
333
|
+
o.current = e;
|
|
334
|
+
const {
|
|
335
|
+
meta: c,
|
|
336
|
+
paged: d,
|
|
337
|
+
rows: _,
|
|
338
|
+
metaLoading: b,
|
|
339
|
+
dataLoading: S,
|
|
340
|
+
currentPage: v,
|
|
341
|
+
total: w,
|
|
342
|
+
totalKnown: T,
|
|
343
|
+
loadMeta: P,
|
|
344
|
+
setPaged: V,
|
|
345
|
+
setDataLoading: M,
|
|
346
|
+
setCurrentPage: z
|
|
347
|
+
} = Ur({ metaFun: e.metaFun, dataFun: e.dataFun, pageSize: i, pageSizes: l }), {
|
|
348
|
+
selectedRows: p,
|
|
349
|
+
selectedRowKeys: B,
|
|
350
|
+
onSelectionChange: Q,
|
|
351
|
+
isRowSelected: Z,
|
|
352
|
+
toggleRowSelection: fe,
|
|
353
|
+
clearSelection: W,
|
|
354
|
+
selectAllOnPage: ie,
|
|
355
|
+
invertSelectionOnPage: G
|
|
356
|
+
} = Zn({ rows: _, rowKey: a }), { actions: j, actionsLoading: ee, loadActions: U } = Gr({ rowActionsFunc: e.rowActionsFunc }), {
|
|
357
|
+
customConfigs: se,
|
|
358
|
+
customConfigLoading: $,
|
|
359
|
+
defaultPageSize: u,
|
|
360
|
+
configDialogVisible: N,
|
|
361
|
+
columns: F,
|
|
362
|
+
loadCustomConfigs: D,
|
|
363
|
+
updateDefaultPageSize: I,
|
|
364
|
+
updateColumnWidth: J,
|
|
365
|
+
openConfigDialog: q,
|
|
366
|
+
closeConfigDialog: te
|
|
367
|
+
} = Jr(
|
|
368
|
+
{ loadCustomConfigFun: e.loadCustomConfigFun, saveCustomConfigFun: e.saveCustomConfigFun },
|
|
369
|
+
c
|
|
370
|
+
), f = u ?? i, g = w > Math.min(f, ...l) || ((d == null ? void 0 : d.hasNext) ?? !1), Y = e.viewMode, [oe, ge] = E(Y ?? "table");
|
|
371
|
+
K(() => {
|
|
372
|
+
Y !== void 0 && ge(Y);
|
|
373
|
+
}, [Y]);
|
|
374
|
+
const Te = Y ?? oe, Oe = e.showCheckbox, [yt, ne] = E(Oe ?? !1);
|
|
375
|
+
K(() => {
|
|
376
|
+
Oe !== void 0 && ne(Oe);
|
|
377
|
+
}, [Oe]);
|
|
378
|
+
const Ie = Oe ?? yt, Me = e.columnResizable, [qe, Be] = E(Me ?? !0);
|
|
379
|
+
K(() => {
|
|
380
|
+
Me !== void 0 && Be(Me);
|
|
381
|
+
}, [Me]);
|
|
382
|
+
const $e = Me ?? qe, A = e.stickyHeader, [re, H] = E(A ?? !1);
|
|
383
|
+
K(() => {
|
|
384
|
+
A !== void 0 && H(A);
|
|
385
|
+
}, [A]);
|
|
386
|
+
const ae = A ?? re, {
|
|
387
|
+
exportOptions: Le,
|
|
388
|
+
exportDialogVisible: ze,
|
|
389
|
+
exporting: Re,
|
|
390
|
+
exportFetched: nt,
|
|
391
|
+
exportTotal: rt,
|
|
392
|
+
exportTotalKnown: it,
|
|
393
|
+
exportEtaSeconds: Qt,
|
|
394
|
+
exportPercent: Vt,
|
|
395
|
+
exportCancelledVisible: Yt,
|
|
396
|
+
exportCancelledRows: bt,
|
|
397
|
+
openExportDialog: y,
|
|
398
|
+
closeExportDialog: k,
|
|
399
|
+
doExport: L,
|
|
400
|
+
cancelExport: le,
|
|
401
|
+
keepPartialExport: Ue,
|
|
402
|
+
discardPartialExport: lt
|
|
403
|
+
} = er({
|
|
404
|
+
props: { dataFun: e.dataFun, exportSelected: Ie, exportorFunc: e.exportorFunc },
|
|
405
|
+
tableName: (c == null ? void 0 : c.displayName) ?? "数据",
|
|
406
|
+
columns: F,
|
|
407
|
+
currentRows: _,
|
|
408
|
+
selectedRows: p,
|
|
409
|
+
total: w,
|
|
410
|
+
exportPageSize: s,
|
|
411
|
+
hasMorePage: g
|
|
412
|
+
}), xt = he((m) => {
|
|
413
|
+
var C, R;
|
|
414
|
+
ge(m), (R = (C = o.current).onUpdateViewMode) == null || R.call(C, m);
|
|
415
|
+
}, []), wt = he(
|
|
416
|
+
(m) => {
|
|
417
|
+
var C, R;
|
|
418
|
+
ne(m), (R = (C = o.current).onUpdateShowCheckbox) == null || R.call(C, m), m || W();
|
|
419
|
+
},
|
|
420
|
+
[W]
|
|
421
|
+
), xr = he((m) => {
|
|
422
|
+
var C, R;
|
|
423
|
+
Be(m), (R = (C = o.current).onUpdateColumnResizable) == null || R.call(C, m);
|
|
424
|
+
}, []), wr = he((m) => {
|
|
425
|
+
var C, R;
|
|
426
|
+
H(m), (R = (C = o.current).onUpdateStickyHeader) == null || R.call(C, m);
|
|
427
|
+
}, []), fn = x(e.dataFun);
|
|
428
|
+
fn.current = e.dataFun;
|
|
429
|
+
const jt = x(i);
|
|
430
|
+
jt.current = i;
|
|
431
|
+
const hn = x(u);
|
|
432
|
+
hn.current = u;
|
|
433
|
+
const Qe = x(v);
|
|
434
|
+
Qe.current = v;
|
|
435
|
+
const Ct = x(e.onDataLoaded);
|
|
436
|
+
Ct.current = e.onDataLoaded;
|
|
437
|
+
const Ht = x(0), _e = he(
|
|
438
|
+
async (m) => {
|
|
439
|
+
var ue;
|
|
440
|
+
const C = ++Ht.current, R = (m == null ? void 0 : m.limit) ?? hn.current ?? jt.current, ce = (m == null ? void 0 : m.page) ?? Qe.current;
|
|
441
|
+
M(!0);
|
|
442
|
+
try {
|
|
443
|
+
const Ae = await fn.current({ limit: R, offset: (ce - 1) * R }, m == null ? void 0 : m.signal);
|
|
444
|
+
if (C !== Ht.current) return;
|
|
445
|
+
V(Ae), (ue = Ct.current) == null || ue.call(Ct, Ae);
|
|
446
|
+
} finally {
|
|
447
|
+
C === Ht.current && M(!1);
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
[M, V]
|
|
451
|
+
), Cr = he(
|
|
452
|
+
(m) => {
|
|
453
|
+
Qe.current = m, z(m), _e({ page: m });
|
|
454
|
+
},
|
|
455
|
+
[_e, z]
|
|
456
|
+
), Wt = he(
|
|
457
|
+
(m) => {
|
|
458
|
+
I(m), Qe.current = 1, z(1), _e({ limit: m, page: 1 });
|
|
459
|
+
},
|
|
460
|
+
[_e, z, I]
|
|
461
|
+
), mn = x(!1);
|
|
462
|
+
K(() => {
|
|
463
|
+
mn.current || (mn.current = !0, _e({ page: 1 }));
|
|
464
|
+
}, [_e]);
|
|
465
|
+
const [Kt, Sr] = E(0), yn = x(0);
|
|
466
|
+
K(() => {
|
|
467
|
+
Kt !== yn.current && (yn.current = Kt, _e({ page: 1 }));
|
|
468
|
+
}, [Kt, _e]);
|
|
469
|
+
const gn = x(void 0);
|
|
470
|
+
K(() => {
|
|
471
|
+
const m = gn.current;
|
|
472
|
+
gn.current = u, !(m !== void 0 || u === void 0) && u !== jt.current && (Qe.current = 1, z(1), _e({ page: 1 }));
|
|
473
|
+
}, [u, _e, z]);
|
|
474
|
+
const vn = x(i);
|
|
475
|
+
K(() => {
|
|
476
|
+
vn.current !== i && (vn.current = i, Wt(i));
|
|
477
|
+
}, [i, Wt]);
|
|
478
|
+
const pn = x(e.dataFun);
|
|
479
|
+
K(() => {
|
|
480
|
+
pn.current !== e.dataFun && (pn.current = e.dataFun, Qe.current = 1, z(1), _e({ page: 1 }));
|
|
481
|
+
}, [e.dataFun, _e, z]);
|
|
482
|
+
async function Nr() {
|
|
483
|
+
await Promise.all([P(), U(), D()]), Qe.current = 1, z(1), Sr((m) => m + 1);
|
|
484
|
+
}
|
|
485
|
+
function Pr() {
|
|
486
|
+
_e();
|
|
487
|
+
}
|
|
488
|
+
const [St, _n] = E(null);
|
|
489
|
+
function Ir(m, C, R) {
|
|
490
|
+
m.preventDefault(), m.stopPropagation();
|
|
491
|
+
const ce = m.clientX, ue = (gt) => Math.max(40, Math.round(R + gt - ce)), Ae = (gt) => {
|
|
492
|
+
_n({ propertyPath: C, width: ue(gt.clientX) });
|
|
493
|
+
}, Tn = (gt) => {
|
|
494
|
+
window.removeEventListener("mousemove", Ae), window.removeEventListener("mouseup", Tn), document.body.style.userSelect = "";
|
|
495
|
+
const Lr = ue(gt.clientX);
|
|
496
|
+
_n(null), J(C, Lr);
|
|
497
|
+
};
|
|
498
|
+
document.body.style.userSelect = "none", window.addEventListener("mousemove", Ae), window.addEventListener("mouseup", Tn);
|
|
499
|
+
}
|
|
500
|
+
const [ot, qt] = E(null), Rr = ot ? ln(j, ot.row) : [];
|
|
501
|
+
function kn(m, C) {
|
|
502
|
+
if (j.length === 0) return;
|
|
503
|
+
m.preventDefault();
|
|
504
|
+
const R = 176, ue = ln(j, C).length * 34 + 8;
|
|
505
|
+
qt({
|
|
506
|
+
x: Math.min(m.clientX, window.innerWidth - R - 8),
|
|
507
|
+
y: Math.min(m.clientY, window.innerHeight - ue - 8),
|
|
508
|
+
row: C
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
function bn(m, C) {
|
|
512
|
+
fe(m, C);
|
|
513
|
+
}
|
|
514
|
+
function Er(m) {
|
|
515
|
+
const C = ot == null ? void 0 : ot.row;
|
|
516
|
+
qt(null), C && m.execute(C, Pt);
|
|
517
|
+
}
|
|
518
|
+
const [xn, Nt] = E([]), wn = Se(() => ((c == null ? void 0 : c.columns) ?? []).map((m, C) => ({ col: m, index: C })).filter(({ col: m }) => m.showForDisplay ?? !0).sort((m, C) => (m.col.displayOrder ?? m.index) - (C.col.displayOrder ?? C.index)).map(({ col: m }) => m), [c]);
|
|
519
|
+
function Or() {
|
|
520
|
+
const m = se.columns;
|
|
521
|
+
return wn.map((C, R) => ({ col: C, config: m[C.propertyPath], index: R })).sort((C, R) => {
|
|
522
|
+
var ce, ue;
|
|
523
|
+
return (((ce = C.config) == null ? void 0 : ce.order) ?? C.index) - (((ue = R.config) == null ? void 0 : ue.order) ?? R.index);
|
|
524
|
+
}).map(({ col: C, config: R }) => ({
|
|
525
|
+
propertyPath: C.propertyPath,
|
|
526
|
+
displayName: C.displayName ?? C.propertyPath,
|
|
527
|
+
visible: (R == null ? void 0 : R.visible) ?? !0,
|
|
528
|
+
width: (R == null ? void 0 : R.width) ?? ""
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
function Mr() {
|
|
532
|
+
Nt(Or()), q();
|
|
533
|
+
}
|
|
534
|
+
function Ar() {
|
|
535
|
+
Nt(
|
|
536
|
+
wn.map((m) => ({
|
|
537
|
+
propertyPath: m.propertyPath,
|
|
538
|
+
displayName: m.displayName ?? m.propertyPath,
|
|
539
|
+
visible: !0,
|
|
540
|
+
width: ""
|
|
541
|
+
}))
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function Fr(m, C) {
|
|
545
|
+
Nt((R) => {
|
|
546
|
+
const ce = m + C;
|
|
547
|
+
if (ce < 0 || ce >= R.length) return R;
|
|
548
|
+
const ue = [...R], [Ae] = ue.splice(m, 1);
|
|
549
|
+
return Ae ? (ue.splice(ce, 0, Ae), ue) : R;
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
async function Tr() {
|
|
553
|
+
var R, ce;
|
|
554
|
+
const m = {};
|
|
555
|
+
xn.forEach((ue, Ae) => {
|
|
556
|
+
m[ue.propertyPath] = {
|
|
557
|
+
propertyPath: ue.propertyPath,
|
|
558
|
+
visible: ue.visible,
|
|
559
|
+
order: Ae,
|
|
560
|
+
width: ue.width
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
const C = { pageSize: u, columns: m };
|
|
564
|
+
await ((ce = (R = o.current).saveCustomConfigFun) == null ? void 0 : ce.call(R, C)), te(), o.current.loadCustomConfigFun && await D();
|
|
565
|
+
}
|
|
566
|
+
const Ut = b || S || ee || $, Ve = [];
|
|
567
|
+
e.empty != null && Ve.push("empty"), e.footer != null && Ve.push("footer"), e.loading != null && Ve.push("loading"), e.card != null && Ve.push("card"), e.list != null && Ve.push("list"), e.selectionBar != null && Ve.push("selectionBar");
|
|
568
|
+
const Cn = x(c);
|
|
569
|
+
Cn.current = c;
|
|
570
|
+
const Sn = x(d);
|
|
571
|
+
Sn.current = d;
|
|
572
|
+
const Nn = x(Te);
|
|
573
|
+
Nn.current = Te;
|
|
574
|
+
const Pn = x(Ie);
|
|
575
|
+
Pn.current = Ie;
|
|
576
|
+
const In = x($e);
|
|
577
|
+
In.current = $e;
|
|
578
|
+
const Rn = x(ae);
|
|
579
|
+
Rn.current = ae;
|
|
580
|
+
const En = x(p);
|
|
581
|
+
En.current = p;
|
|
582
|
+
const On = x(_);
|
|
583
|
+
On.current = _;
|
|
584
|
+
const Mn = x(Ve);
|
|
585
|
+
Mn.current = Ve;
|
|
586
|
+
const Pt = {
|
|
587
|
+
get meta() {
|
|
588
|
+
return Cn.current;
|
|
589
|
+
},
|
|
590
|
+
get paged() {
|
|
591
|
+
return Sn.current;
|
|
592
|
+
},
|
|
593
|
+
get currentPage() {
|
|
594
|
+
return Qe.current;
|
|
595
|
+
},
|
|
596
|
+
get viewMode() {
|
|
597
|
+
return Nn.current;
|
|
598
|
+
},
|
|
599
|
+
get selectable() {
|
|
600
|
+
return Pn.current;
|
|
601
|
+
},
|
|
602
|
+
get columnResizable() {
|
|
603
|
+
return In.current;
|
|
604
|
+
},
|
|
605
|
+
get stickyHeader() {
|
|
606
|
+
return Rn.current;
|
|
607
|
+
},
|
|
608
|
+
get slotNames() {
|
|
609
|
+
return Mn.current;
|
|
610
|
+
},
|
|
611
|
+
get selectedRows() {
|
|
612
|
+
return En.current;
|
|
613
|
+
},
|
|
614
|
+
get rows() {
|
|
615
|
+
return On.current;
|
|
616
|
+
},
|
|
617
|
+
reload: Nr,
|
|
618
|
+
refresh: Pr,
|
|
619
|
+
setViewMode: xt,
|
|
620
|
+
setSelectable: wt,
|
|
621
|
+
setColumnResizable: xr,
|
|
622
|
+
setStickyHeader: wr,
|
|
623
|
+
clearSelection: W,
|
|
624
|
+
selectAllOnPage: ie,
|
|
625
|
+
invertSelectionOnPage: G,
|
|
626
|
+
openConfigDialog: Mr,
|
|
627
|
+
openExportDialog: y
|
|
628
|
+
}, Gt = x(Pt);
|
|
629
|
+
Gt.current = Pt;
|
|
630
|
+
const Jt = x(null);
|
|
631
|
+
Jt.current === null && (Jt.current = new Proxy({}, {
|
|
632
|
+
get: (m, C) => Reflect.get(Gt.current, C),
|
|
633
|
+
has: (m, C) => Reflect.has(Gt.current, C)
|
|
634
|
+
})), Pe(r, () => Jt.current, []);
|
|
635
|
+
const An = F.map((m) => {
|
|
636
|
+
const C = (St == null ? void 0 : St.propertyPath) === m.propertyPath ? St.width : Pi(m.width);
|
|
637
|
+
return {
|
|
638
|
+
key: m.propertyPath,
|
|
639
|
+
dataIndex: m.propertyPath,
|
|
640
|
+
title: m.displayName ?? m.propertyPath,
|
|
641
|
+
width: C,
|
|
642
|
+
ellipsis: !0,
|
|
643
|
+
render: m.render ? (R, ce) => Vn(m.render(ce, R)) : (R) => Vn(R),
|
|
644
|
+
onHeaderCell: () => ({
|
|
645
|
+
className: `yk-table__col-header${$e ? " yk-table__col-header--resizable" : ""}`,
|
|
646
|
+
...$e ? {
|
|
647
|
+
onMouseDown: (R) => {
|
|
648
|
+
const ce = R.currentTarget.getBoundingClientRect();
|
|
649
|
+
R.clientX < ce.right - 8 || Ir(R, m.propertyPath, C ?? ce.width);
|
|
650
|
+
}
|
|
651
|
+
} : {}
|
|
652
|
+
})
|
|
653
|
+
};
|
|
654
|
+
}), Fn = wi({ actions: j, table: Pt });
|
|
655
|
+
Fn && An.push(Fn);
|
|
656
|
+
const Dr = Ie ? {
|
|
657
|
+
selectedRowKeys: B,
|
|
658
|
+
preserveSelectedRowKeys: !0,
|
|
659
|
+
onChange: (m, C) => Q(C)
|
|
660
|
+
} : void 0, Br = {
|
|
661
|
+
selectedRows: p,
|
|
662
|
+
total: w,
|
|
663
|
+
clearSelection: W,
|
|
664
|
+
selectAllOnPage: ie,
|
|
665
|
+
invertSelectionOnPage: G,
|
|
666
|
+
pageSize: f
|
|
667
|
+
};
|
|
668
|
+
function $r(m, C) {
|
|
669
|
+
if (C !== f) {
|
|
670
|
+
Wt(C);
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
Cr(m);
|
|
674
|
+
}
|
|
675
|
+
return /* @__PURE__ */ h("div", { className: "yk-table", children: [
|
|
676
|
+
e.selectionBar ? /* @__PURE__ */ n("div", { className: "yk-table__selection-bar-slot", children: e.selectionBar(Br) }) : null,
|
|
677
|
+
/* @__PURE__ */ h("div", { className: "yk-table__view-area", children: [
|
|
678
|
+
Te === "table" ? /* @__PURE__ */ n(
|
|
679
|
+
"div",
|
|
680
|
+
{
|
|
681
|
+
className: `yk-table__table-wrap${ae ? " yk-table__table-wrap--sticky-header" : ""}`,
|
|
682
|
+
children: /* @__PURE__ */ n(
|
|
683
|
+
Gn,
|
|
684
|
+
{
|
|
685
|
+
columns: An,
|
|
686
|
+
dataSource: _,
|
|
687
|
+
rowKey: a,
|
|
688
|
+
bordered: !0,
|
|
689
|
+
pagination: !1,
|
|
690
|
+
rowSelection: Dr,
|
|
691
|
+
locale: { emptyText: e.empty ?? /* @__PURE__ */ n(ut, { description: "暂无数据" }) }
|
|
692
|
+
}
|
|
693
|
+
)
|
|
694
|
+
}
|
|
695
|
+
) : Te === "card" ? /* @__PURE__ */ n(
|
|
696
|
+
vi,
|
|
697
|
+
{
|
|
698
|
+
rows: _,
|
|
699
|
+
rowKey: a,
|
|
700
|
+
showCheckbox: Ie,
|
|
701
|
+
loading: Ut,
|
|
702
|
+
hasActions: j.length > 0,
|
|
703
|
+
isSelected: Z,
|
|
704
|
+
onCheck: bn,
|
|
705
|
+
onContextMenu: kn,
|
|
706
|
+
card: e.card,
|
|
707
|
+
empty: e.empty
|
|
708
|
+
}
|
|
709
|
+
) : /* @__PURE__ */ n(
|
|
710
|
+
bi,
|
|
711
|
+
{
|
|
712
|
+
rows: _,
|
|
713
|
+
rowKey: a,
|
|
714
|
+
showCheckbox: Ie,
|
|
715
|
+
loading: Ut,
|
|
716
|
+
hasActions: j.length > 0,
|
|
717
|
+
isSelected: Z,
|
|
718
|
+
onCheck: bn,
|
|
719
|
+
onContextMenu: kn,
|
|
720
|
+
list: e.list,
|
|
721
|
+
empty: e.empty
|
|
722
|
+
}
|
|
723
|
+
),
|
|
724
|
+
Ut ? /* @__PURE__ */ n("div", { className: "yk-table__loading-mask", children: e.loading ?? /* @__PURE__ */ n("span", { className: "yk-table__loading-spinner", "aria-label": "加载中" }) }) : null
|
|
725
|
+
] }),
|
|
726
|
+
g || e.footer != null ? /* @__PURE__ */ h("div", { className: "yk-table__footer", children: [
|
|
727
|
+
/* @__PURE__ */ n("div", { className: "yk-table__footer-extra", children: e.footer }),
|
|
728
|
+
g ? /* @__PURE__ */ n(
|
|
729
|
+
jr,
|
|
730
|
+
{
|
|
731
|
+
className: "yk-table__pagination",
|
|
732
|
+
current: v,
|
|
733
|
+
pageSize: f,
|
|
734
|
+
total: w,
|
|
735
|
+
pageSizeOptions: l,
|
|
736
|
+
showSizeChanger: !0,
|
|
737
|
+
showTotal: T ? (m) => `共 ${m} 条` : void 0,
|
|
738
|
+
onChange: $r
|
|
739
|
+
}
|
|
740
|
+
) : null
|
|
741
|
+
] }) : null,
|
|
742
|
+
/* @__PURE__ */ n(
|
|
743
|
+
_i,
|
|
744
|
+
{
|
|
745
|
+
menu: ot,
|
|
746
|
+
actions: Rr,
|
|
747
|
+
isEnabled: Xn,
|
|
748
|
+
onClose: () => qt(null),
|
|
749
|
+
onSelect: Er
|
|
750
|
+
}
|
|
751
|
+
),
|
|
752
|
+
/* @__PURE__ */ n(
|
|
753
|
+
pi,
|
|
754
|
+
{
|
|
755
|
+
open: N,
|
|
756
|
+
drafts: xn,
|
|
757
|
+
onCancel: te,
|
|
758
|
+
onSave: Tr,
|
|
759
|
+
onReset: Ar,
|
|
760
|
+
onMove: Fr,
|
|
761
|
+
onDraftsChange: Nt
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ n(
|
|
765
|
+
nr,
|
|
766
|
+
{
|
|
767
|
+
open: ze,
|
|
768
|
+
options: Le,
|
|
769
|
+
exporting: Re,
|
|
770
|
+
fetched: nt,
|
|
771
|
+
total: rt,
|
|
772
|
+
totalKnown: it,
|
|
773
|
+
percent: Vt,
|
|
774
|
+
etaSeconds: Qt,
|
|
775
|
+
cancelledVisible: Yt,
|
|
776
|
+
cancelledRows: bt,
|
|
777
|
+
onExport: (m) => void L(m),
|
|
778
|
+
onCancelExport: le,
|
|
779
|
+
onKeepPartial: () => void Ue(),
|
|
780
|
+
onDiscardPartial: () => void lt(),
|
|
781
|
+
onClose: k
|
|
782
|
+
}
|
|
783
|
+
)
|
|
784
|
+
] });
|
|
785
|
+
});
|
|
786
|
+
var ct = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, we = {}, ke = {};
|
|
787
|
+
Object.defineProperty(ke, "__esModule", { value: !0 });
|
|
788
|
+
ke.AggInfoOf = ke.AggInfo = ke.AggItem = ke.AggType = void 0;
|
|
789
|
+
ke.agg = Ri;
|
|
790
|
+
var vt;
|
|
791
|
+
(function(t) {
|
|
792
|
+
t.Sum = "sum", t.Min = "min", t.Max = "max", t.Avg = "avg", t.Count = "count", t.DistinctCount = "distinctcount";
|
|
793
|
+
})(vt || (ke.AggType = vt = {}));
|
|
794
|
+
class rr {
|
|
795
|
+
constructor(e, r, i = null, l) {
|
|
796
|
+
this.path = e, this.type = r, this.name = i, this.filter = l;
|
|
797
|
+
}
|
|
798
|
+
toString() {
|
|
799
|
+
var e, r;
|
|
800
|
+
const i = (r = (e = this.filter) === null || e === void 0 ? void 0 : e.toString()) !== null && r !== void 0 ? r : "";
|
|
801
|
+
return this.name ? `${this.path}.${this.type}(${i}).as(${this.name})` : `${this.path}.${this.type}(${i})`;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
ke.AggItem = rr;
|
|
805
|
+
class ir {
|
|
806
|
+
constructor(...e) {
|
|
807
|
+
this.items = [], this.items.push(...e.filter((r) => r !== null));
|
|
808
|
+
}
|
|
809
|
+
append(e, r = vt.Sum, i = null, l) {
|
|
810
|
+
return this.items.push(new rr(e, r, i, l)), this;
|
|
811
|
+
}
|
|
812
|
+
toString() {
|
|
813
|
+
return this.items.length === 0 ? "" : this.items.filter((e) => e !== null).map((e) => e.toString()).join(",");
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
ke.AggInfo = ir;
|
|
817
|
+
class lr extends ir {
|
|
818
|
+
append(e, r = vt.Sum, i = null, l) {
|
|
819
|
+
return super.append(e, r, i, l), this;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
ke.AggInfoOf = lr;
|
|
823
|
+
function Ri(t, e = vt.Sum, r = null, i) {
|
|
824
|
+
return new lr().append(t, e, r, i);
|
|
825
|
+
}
|
|
826
|
+
var ye = {}, me = {}, We = {};
|
|
827
|
+
Object.defineProperty(We, "__esModule", { value: !0 });
|
|
828
|
+
We.Constant = void 0;
|
|
829
|
+
We.con = Ei;
|
|
830
|
+
class or {
|
|
831
|
+
constructor(e) {
|
|
832
|
+
this.con = e;
|
|
833
|
+
}
|
|
834
|
+
toString() {
|
|
835
|
+
return JSON.stringify(this.con);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
We.Constant = or;
|
|
839
|
+
function Ei(t) {
|
|
840
|
+
return new or(t);
|
|
841
|
+
}
|
|
842
|
+
var tt = {};
|
|
843
|
+
Object.defineProperty(tt, "__esModule", { value: !0 });
|
|
844
|
+
tt.Expression = void 0;
|
|
845
|
+
tt.exp = Oi;
|
|
846
|
+
class ar {
|
|
847
|
+
constructor(e) {
|
|
848
|
+
this.exp = e;
|
|
849
|
+
}
|
|
850
|
+
getExp() {
|
|
851
|
+
return this.exp;
|
|
852
|
+
}
|
|
853
|
+
toString() {
|
|
854
|
+
return this.exp;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
tt.Expression = ar;
|
|
858
|
+
function Oi(t) {
|
|
859
|
+
return new ar(t);
|
|
860
|
+
}
|
|
861
|
+
var Ke = {};
|
|
862
|
+
Object.defineProperty(Ke, "__esModule", { value: !0 });
|
|
863
|
+
Ke.key = Ai;
|
|
864
|
+
Ke.toExp = Fi;
|
|
865
|
+
Ke.toValueExp = Ti;
|
|
866
|
+
const Ft = tt, Mi = We;
|
|
867
|
+
function Ai(t) {
|
|
868
|
+
return t.toString();
|
|
869
|
+
}
|
|
870
|
+
function Fi(t) {
|
|
871
|
+
return t instanceof Ft.Expression ? t : new Ft.Expression(t);
|
|
872
|
+
}
|
|
873
|
+
function Ti(t) {
|
|
874
|
+
return t == null ? null : t instanceof Ft.Expression || t instanceof Mi.Constant ? t : new Ft.Expression(t);
|
|
875
|
+
}
|
|
876
|
+
Object.defineProperty(me, "__esModule", { value: !0 });
|
|
877
|
+
me.FilterInfoOf = me.empty = me.FilterInfo = me.CombinType = me.Operator = void 0;
|
|
878
|
+
me.filter = Bi;
|
|
879
|
+
me.emptyFilter = $i;
|
|
880
|
+
const pt = We, Di = tt, Yn = Ke;
|
|
881
|
+
var Tt;
|
|
882
|
+
(function(t) {
|
|
883
|
+
t.Equals = "==", t.NotEquals = "!=", t.GreaterThan = ">", t.LessThanOrEqual = "<=", t.LessThan = "<", t.GreaterThanOrEqual = ">=", t.Between = "between", t.NotBetween = "not_between", t.In = "in", t.NotIn = "not_in", t.StartsWith = "startswith", t.NotStartsWith = "not_startswith", t.EndsWith = "endswith", t.NotEndsWith = "not_endswith", t.Contains = "contains", t.NotContains = "not_contains";
|
|
884
|
+
})(Tt || (me.Operator = Tt = {}));
|
|
885
|
+
var de;
|
|
886
|
+
(function(t) {
|
|
887
|
+
t[t.AndItems = 1] = "AndItems", t[t.OrItems = 2] = "OrItems", t[t.SingleItem = 0] = "SingleItem";
|
|
888
|
+
})(de || (me.CombinType = de = {}));
|
|
889
|
+
class ve {
|
|
890
|
+
constructor(e, r, i, l = de.SingleItem, a = []) {
|
|
891
|
+
this.items = [], this.left = e, this.right = i, this.op = r, this.combinType = l, this.items = a;
|
|
892
|
+
}
|
|
893
|
+
toString() {
|
|
894
|
+
switch (this.combinType) {
|
|
895
|
+
case de.AndItems: {
|
|
896
|
+
const e = this.items.filter((r) => r && !r.isEmpty());
|
|
897
|
+
return e.length === 1 ? `${e[0].toString()}` : e.map((r) => `(${r.toString()})`).join(` ${ve.Operator_And} `);
|
|
898
|
+
}
|
|
899
|
+
case de.OrItems: {
|
|
900
|
+
const e = this.items.filter((r) => r && !r.isEmpty());
|
|
901
|
+
return e.length === 1 ? `${e[0].toString()}` : e.map((r) => `(${r.toString()})`).join(` ${ve.Operator_Or} `);
|
|
902
|
+
}
|
|
903
|
+
default:
|
|
904
|
+
return this.isEmpty() ? "" : `${this.left} ${this.op} ${this.right}`;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
andAlso(e) {
|
|
908
|
+
return this.combinType == de.AndItems ? (e.combinType == de.AndItems ? this.items = this.items.concat(e.items) : this.items.push(e), this) : ve.createAnd(this, e);
|
|
909
|
+
}
|
|
910
|
+
orElse(e) {
|
|
911
|
+
return this.combinType == de.OrItems ? (e.combinType == de.OrItems ? this.items = this.items.concat(e.items) : this.items.push(e), this) : ve.createOr(this, e);
|
|
912
|
+
}
|
|
913
|
+
static createOr(...e) {
|
|
914
|
+
return new ve(null, null, null, de.OrItems, e);
|
|
915
|
+
}
|
|
916
|
+
static createAnd(...e) {
|
|
917
|
+
return new ve(null, null, null, de.AndItems, e);
|
|
918
|
+
}
|
|
919
|
+
isEmpty() {
|
|
920
|
+
return this.combinType == de.SingleItem && this.op == null;
|
|
921
|
+
}
|
|
922
|
+
static fromSimpleObject(...e) {
|
|
923
|
+
return ve.createAnd(...e.map((r) => {
|
|
924
|
+
var i;
|
|
925
|
+
return new ve((0, Di.exp)(r.name), (i = r.op) !== null && i !== void 0 ? i : Tt.Equals, (0, pt.con)(r.value));
|
|
926
|
+
}));
|
|
927
|
+
}
|
|
928
|
+
static fromSimpleDictionary(e) {
|
|
929
|
+
return ve.fromSimpleObject(...Object.entries(e).map(([r, i]) => ({ name: r, value: i })));
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
me.FilterInfo = ve;
|
|
933
|
+
ve.Operator_And = "and";
|
|
934
|
+
ve.Operator_Or = "or";
|
|
935
|
+
me.empty = new ve((0, pt.con)(1), Tt.Equals, (0, pt.con)(1));
|
|
936
|
+
class He extends ve {
|
|
937
|
+
constructor(e, r, i, l = de.SingleItem, a = []) {
|
|
938
|
+
super((0, Yn.toValueExp)(e), r, (0, Yn.toValueExp)(i), l, a);
|
|
939
|
+
}
|
|
940
|
+
and(e, r, i) {
|
|
941
|
+
const l = new He(e, r, i);
|
|
942
|
+
return this.combinType == de.AndItems ? (l.combinType == de.AndItems ? this.items = this.items.concat(l.items) : this.items.push(l), this) : new He(null, null, null, de.AndItems, [this, l]);
|
|
943
|
+
}
|
|
944
|
+
or(e, r, i) {
|
|
945
|
+
const l = new He(e, r, i);
|
|
946
|
+
return this.combinType == de.OrItems ? (l.combinType == de.OrItems ? this.items = this.items.concat(l.items) : this.items.push(l), this) : new He(null, null, null, de.OrItems, [this, l]);
|
|
947
|
+
}
|
|
948
|
+
andIf(e, r, i, l) {
|
|
949
|
+
return e ? this.and(r, i, l) : this;
|
|
950
|
+
}
|
|
951
|
+
orIf(e, r, i, l) {
|
|
952
|
+
return e ? this.or(r, i, l) : this;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
me.FilterInfoOf = He;
|
|
956
|
+
function Bi(t, e, r) {
|
|
957
|
+
return new He(t, e, r);
|
|
958
|
+
}
|
|
959
|
+
function $i() {
|
|
960
|
+
return new He((0, pt.con)(null), null, (0, pt.con)(null));
|
|
961
|
+
}
|
|
962
|
+
var mt = {};
|
|
963
|
+
Object.defineProperty(mt, "__esModule", { value: !0 });
|
|
964
|
+
mt.queryConfig = void 0;
|
|
965
|
+
mt.queryConfig = {
|
|
966
|
+
defaultLimit: 10,
|
|
967
|
+
maxLimit: 1e3
|
|
968
|
+
};
|
|
969
|
+
var _t = {};
|
|
970
|
+
Object.defineProperty(_t, "__esModule", { value: !0 });
|
|
971
|
+
_t.DataOverflowError = void 0;
|
|
972
|
+
class dn extends Error {
|
|
973
|
+
constructor(e) {
|
|
974
|
+
super(e), this.name = "DataOverflowError", Object.setPrototypeOf(this, dn.prototype);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
_t.DataOverflowError = dn;
|
|
978
|
+
var xe = ct && ct.__awaiter || function(t, e, r, i) {
|
|
979
|
+
function l(a) {
|
|
980
|
+
return a instanceof r ? a : new r(function(s) {
|
|
981
|
+
s(a);
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
return new (r || (r = Promise))(function(a, s) {
|
|
985
|
+
function o(_) {
|
|
986
|
+
try {
|
|
987
|
+
d(i.next(_));
|
|
988
|
+
} catch (b) {
|
|
989
|
+
s(b);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
function c(_) {
|
|
993
|
+
try {
|
|
994
|
+
d(i.throw(_));
|
|
995
|
+
} catch (b) {
|
|
996
|
+
s(b);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
function d(_) {
|
|
1000
|
+
_.done ? a(_.value) : l(_.value).then(o, c);
|
|
1001
|
+
}
|
|
1002
|
+
d((i = i.apply(t, e || [])).next());
|
|
1003
|
+
});
|
|
1004
|
+
};
|
|
1005
|
+
Object.defineProperty(ye, "__esModule", { value: !0 });
|
|
1006
|
+
ye.findBy = cr;
|
|
1007
|
+
ye.findById = zi;
|
|
1008
|
+
ye.count = Qi;
|
|
1009
|
+
ye.distinctCount = Vi;
|
|
1010
|
+
ye.distinctList = Yi;
|
|
1011
|
+
ye.asList = ji;
|
|
1012
|
+
ye.queryPage = Hi;
|
|
1013
|
+
ye.loadAll = Wi;
|
|
1014
|
+
ye.aggValue = Ki;
|
|
1015
|
+
ye.aggProp = kt;
|
|
1016
|
+
ye.sumProp = qi;
|
|
1017
|
+
ye.maxProp = Ui;
|
|
1018
|
+
ye.minProp = Gi;
|
|
1019
|
+
ye.avgProp = Ji;
|
|
1020
|
+
const jn = me, Li = We, ft = ke, $t = mt, sr = _t;
|
|
1021
|
+
function cr(t, e, r, i) {
|
|
1022
|
+
return xe(this, void 0, void 0, function* () {
|
|
1023
|
+
const l = yield t({
|
|
1024
|
+
limit: 1,
|
|
1025
|
+
offset: 0,
|
|
1026
|
+
filter: (0, jn.filter)(e, jn.Operator.Equals, (0, Li.con)(r)).toString(),
|
|
1027
|
+
countAll: !1
|
|
1028
|
+
}, i);
|
|
1029
|
+
return l.items.length > 0 ? l.items[0] : null;
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
function zi(t, e, r) {
|
|
1033
|
+
return xe(this, void 0, void 0, function* () {
|
|
1034
|
+
return cr(t, "id", e, r);
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
function Qi(t, e, r) {
|
|
1038
|
+
return xe(this, void 0, void 0, function* () {
|
|
1039
|
+
var i;
|
|
1040
|
+
return (i = (yield t({
|
|
1041
|
+
limit: 0,
|
|
1042
|
+
offset: 0,
|
|
1043
|
+
filter: e == null ? void 0 : e.toString(),
|
|
1044
|
+
countAll: !0
|
|
1045
|
+
}, r)).totalCount) !== null && i !== void 0 ? i : 0;
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
function Vi(t, e, r, i) {
|
|
1049
|
+
return xe(this, void 0, void 0, function* () {
|
|
1050
|
+
var l;
|
|
1051
|
+
return (l = (yield t({
|
|
1052
|
+
limit: 0,
|
|
1053
|
+
offset: 0,
|
|
1054
|
+
filter: r == null ? void 0 : r.toString(),
|
|
1055
|
+
select: e.toString(),
|
|
1056
|
+
distinct: !0,
|
|
1057
|
+
countAll: !0
|
|
1058
|
+
}, i)).totalCount) !== null && l !== void 0 ? l : 0;
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
function Yi(t, e, r) {
|
|
1062
|
+
return xe(this, void 0, void 0, function* () {
|
|
1063
|
+
var i, l, a, s, o;
|
|
1064
|
+
const c = yield t({
|
|
1065
|
+
limit: (i = e.maxPageSize) !== null && i !== void 0 ? i : $t.queryConfig.maxLimit,
|
|
1066
|
+
offset: 0,
|
|
1067
|
+
filter: (l = e.filter) === null || l === void 0 ? void 0 : l.toString(),
|
|
1068
|
+
select: e.select.toString(),
|
|
1069
|
+
orderBy: (a = e.orderBy) === null || a === void 0 ? void 0 : a.toString(),
|
|
1070
|
+
distinct: !0,
|
|
1071
|
+
countAll: !1
|
|
1072
|
+
}, r);
|
|
1073
|
+
if (c.hasNext && (!((s = e.throwIfOverflow) !== null && s !== void 0) || s))
|
|
1074
|
+
throw new sr.DataOverflowError(`The result data of distinctList is lost. Total: ${(o = c.totalCount) !== null && o !== void 0 ? o : 0}, Max page size: ${c.limit}`);
|
|
1075
|
+
return c.items;
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
function ji(t, e, r) {
|
|
1079
|
+
return xe(this, void 0, void 0, function* () {
|
|
1080
|
+
var i, l, a, s, o, c;
|
|
1081
|
+
const d = yield t({
|
|
1082
|
+
limit: (i = e == null ? void 0 : e.maxPageSize) !== null && i !== void 0 ? i : $t.queryConfig.maxLimit,
|
|
1083
|
+
offset: 0,
|
|
1084
|
+
filter: (l = e == null ? void 0 : e.filter) === null || l === void 0 ? void 0 : l.toString(),
|
|
1085
|
+
select: (a = e == null ? void 0 : e.select) === null || a === void 0 ? void 0 : a.toString(),
|
|
1086
|
+
orderBy: (s = e == null ? void 0 : e.orderBy) === null || s === void 0 ? void 0 : s.toString(),
|
|
1087
|
+
countAll: !1
|
|
1088
|
+
}, r);
|
|
1089
|
+
if (d.hasNext && (!((o = e == null ? void 0 : e.throwIfOverflow) !== null && o !== void 0) || o))
|
|
1090
|
+
throw new sr.DataOverflowError(`The result data of asList is lost. Total: ${(c = d.totalCount) !== null && c !== void 0 ? c : 0}, Max page size: ${d.limit}`);
|
|
1091
|
+
return d.items;
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
function Hi(t, e) {
|
|
1095
|
+
var r, i, l, a, s, o;
|
|
1096
|
+
return t({
|
|
1097
|
+
limit: (r = e.limit) !== null && r !== void 0 ? r : $t.queryConfig.defaultLimit,
|
|
1098
|
+
offset: (i = e.offset) !== null && i !== void 0 ? i : 0,
|
|
1099
|
+
filter: (l = e.filter) === null || l === void 0 ? void 0 : l.toString(),
|
|
1100
|
+
select: (a = e.select) === null || a === void 0 ? void 0 : a.toString(),
|
|
1101
|
+
orderBy: (s = e.orderBy) === null || s === void 0 ? void 0 : s.toString(),
|
|
1102
|
+
agg: (o = e.agg) === null || o === void 0 ? void 0 : o.toString(),
|
|
1103
|
+
distinct: e.distinct,
|
|
1104
|
+
countAll: e.countAll
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
function Wi(t, e, r) {
|
|
1108
|
+
return xe(this, void 0, void 0, function* () {
|
|
1109
|
+
var i, l, a, s, o;
|
|
1110
|
+
let c = [], d = 0;
|
|
1111
|
+
const _ = {
|
|
1112
|
+
limit: (i = e == null ? void 0 : e.maxPageSize) !== null && i !== void 0 ? i : $t.queryConfig.maxLimit,
|
|
1113
|
+
filter: (l = e == null ? void 0 : e.filter) === null || l === void 0 ? void 0 : l.toString(),
|
|
1114
|
+
select: (a = e == null ? void 0 : e.select) === null || a === void 0 ? void 0 : a.toString(),
|
|
1115
|
+
orderBy: (s = e == null ? void 0 : e.orderBy) === null || s === void 0 ? void 0 : s.toString(),
|
|
1116
|
+
distinct: (o = e == null ? void 0 : e.distinct) !== null && o !== void 0 ? o : !1,
|
|
1117
|
+
countAll: !1
|
|
1118
|
+
};
|
|
1119
|
+
for (; !(r != null && r.aborted); ) {
|
|
1120
|
+
const b = yield t(Object.assign(Object.assign({}, _), { offset: d }), r);
|
|
1121
|
+
if (c = c.concat(b.items), d += _.limit, b.items.length == 0 || !b.hasNext || r != null && r.aborted)
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
return c;
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
function Ki(t, e, r, i) {
|
|
1128
|
+
return xe(this, void 0, void 0, function* () {
|
|
1129
|
+
return (yield t({
|
|
1130
|
+
limit: 0,
|
|
1131
|
+
offset: 0,
|
|
1132
|
+
filter: r == null ? void 0 : r.toString(),
|
|
1133
|
+
agg: e.toString(),
|
|
1134
|
+
countAll: !1
|
|
1135
|
+
}, i)).aggs;
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
function kt(t, e) {
|
|
1139
|
+
return xe(this, arguments, void 0, function* (r, i, l = ft.AggType.Sum, a, s) {
|
|
1140
|
+
var o;
|
|
1141
|
+
const c = "__tg0", d = yield r({
|
|
1142
|
+
limit: 0,
|
|
1143
|
+
offset: 0,
|
|
1144
|
+
filter: a == null ? void 0 : a.toString(),
|
|
1145
|
+
agg: (0, ft.agg)(i, l, c, a).toString(),
|
|
1146
|
+
countAll: !1
|
|
1147
|
+
}, s);
|
|
1148
|
+
return Number((o = d.aggs) === null || o === void 0 ? void 0 : o[c]);
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
function qi(t, e, r, i) {
|
|
1152
|
+
return xe(this, void 0, void 0, function* () {
|
|
1153
|
+
return kt(t, e, ft.AggType.Sum, r, i);
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
function Ui(t, e, r, i) {
|
|
1157
|
+
return xe(this, void 0, void 0, function* () {
|
|
1158
|
+
return kt(t, e, ft.AggType.Max, r, i);
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
function Gi(t, e, r, i) {
|
|
1162
|
+
return xe(this, void 0, void 0, function* () {
|
|
1163
|
+
return kt(t, e, ft.AggType.Min, r, i);
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
function Ji(t, e, r, i) {
|
|
1167
|
+
return xe(this, void 0, void 0, function* () {
|
|
1168
|
+
return kt(t, e, ft.AggType.Avg, r, i);
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
var Lt = {};
|
|
1172
|
+
Object.defineProperty(Lt, "__esModule", { value: !0 });
|
|
1173
|
+
Lt.LimitInfo = void 0;
|
|
1174
|
+
class Xi {
|
|
1175
|
+
}
|
|
1176
|
+
Lt.LimitInfo = Xi;
|
|
1177
|
+
var Ne = {};
|
|
1178
|
+
Object.defineProperty(Ne, "__esModule", { value: !0 });
|
|
1179
|
+
Ne.OrderByInfoOf = Ne.OrderByInfo = Ne.OrderByItem = Ne.OrderByType = void 0;
|
|
1180
|
+
Ne.orderby = Zi;
|
|
1181
|
+
const on = Ke;
|
|
1182
|
+
var ht;
|
|
1183
|
+
(function(t) {
|
|
1184
|
+
t.Asc = "asc()", t.Desc = "desc()";
|
|
1185
|
+
})(ht || (Ne.OrderByType = ht = {}));
|
|
1186
|
+
class ur {
|
|
1187
|
+
constructor(e, r) {
|
|
1188
|
+
this.path = e, this.type = r;
|
|
1189
|
+
}
|
|
1190
|
+
toString() {
|
|
1191
|
+
return `${this.path}.${this.type.toString()}`;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
Ne.OrderByItem = ur;
|
|
1195
|
+
class dr {
|
|
1196
|
+
constructor(...e) {
|
|
1197
|
+
this.items = [], this.items.push(...e.filter((r) => r !== null));
|
|
1198
|
+
}
|
|
1199
|
+
toString() {
|
|
1200
|
+
return this.items.length === 0 ? "" : this.items.filter((e) => e !== null).map((e) => e.toString()).join(",");
|
|
1201
|
+
}
|
|
1202
|
+
add(e, r = ht.Asc) {
|
|
1203
|
+
return this.items.push(new ur(e, r)), this;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
Ne.OrderByInfo = dr;
|
|
1207
|
+
class fr extends dr {
|
|
1208
|
+
then(e) {
|
|
1209
|
+
return this.add((0, on.toExp)(e), ht.Asc), this;
|
|
1210
|
+
}
|
|
1211
|
+
thenDesc(e) {
|
|
1212
|
+
return this.add((0, on.toExp)(e), ht.Desc), this;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
Ne.OrderByInfoOf = fr;
|
|
1216
|
+
function Zi(t, e = ht.Asc) {
|
|
1217
|
+
const r = new fr();
|
|
1218
|
+
return r.add((0, on.toExp)(t), e), r;
|
|
1219
|
+
}
|
|
1220
|
+
var hr = {};
|
|
1221
|
+
Object.defineProperty(hr, "__esModule", { value: !0 });
|
|
1222
|
+
var et = {}, Fe = {};
|
|
1223
|
+
Object.defineProperty(Fe, "__esModule", { value: !0 });
|
|
1224
|
+
Fe.SelectInfoOf = Fe.SelectInfo = Fe.SelectItem = void 0;
|
|
1225
|
+
Fe.select = el;
|
|
1226
|
+
class an {
|
|
1227
|
+
constructor(e, r = !1) {
|
|
1228
|
+
this.name = e, this.exclude = r;
|
|
1229
|
+
}
|
|
1230
|
+
toString() {
|
|
1231
|
+
return this.exclude ? `-${this.name}` : this.name;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
Fe.SelectItem = an;
|
|
1235
|
+
class mr {
|
|
1236
|
+
constructor(...e) {
|
|
1237
|
+
this.items = [], this.items.push(...e.filter((r) => r !== null));
|
|
1238
|
+
}
|
|
1239
|
+
toString() {
|
|
1240
|
+
return this.items.length === 0 ? "" : this.items.filter((e) => e !== null).map((e) => e.toString()).join(",");
|
|
1241
|
+
}
|
|
1242
|
+
appendItems(...e) {
|
|
1243
|
+
return this.items ? this.items = this.items.concat(e) : this.items = e, this;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
Fe.SelectInfo = mr;
|
|
1247
|
+
class yr extends mr {
|
|
1248
|
+
include(...e) {
|
|
1249
|
+
return this.appendItems(...e.map((r) => new an(r.toString()))), this;
|
|
1250
|
+
}
|
|
1251
|
+
exclude(...e) {
|
|
1252
|
+
return this.appendItems(...e.map((r) => new an(r.toString(), !0))), this;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
Fe.SelectInfoOf = yr;
|
|
1256
|
+
function el(...t) {
|
|
1257
|
+
return new yr().include(...t);
|
|
1258
|
+
}
|
|
1259
|
+
Object.defineProperty(et, "__esModule", { value: !0 });
|
|
1260
|
+
et.QueryBuilderOf = et.QueryBuilder = void 0;
|
|
1261
|
+
et.query = nl;
|
|
1262
|
+
const Zt = ke, en = me, Ye = Ne, at = Fe, Ge = Ke, tl = mt;
|
|
1263
|
+
class gr {
|
|
1264
|
+
constructor() {
|
|
1265
|
+
this._limit = tl.queryConfig.defaultLimit, this._offset = 0;
|
|
1266
|
+
}
|
|
1267
|
+
build() {
|
|
1268
|
+
const e = {
|
|
1269
|
+
limit: this._limit,
|
|
1270
|
+
offset: this._offset
|
|
1271
|
+
};
|
|
1272
|
+
return this._filterInfo && (e.filter = this._filterInfo.toString()), this._orderByInfo && (e.orderBy = this._orderByInfo.toString()), this._selectInfo && (e.select = this._selectInfo.toString()), this._aggInfo && (e.agg = this._aggInfo.toString()), e;
|
|
1273
|
+
}
|
|
1274
|
+
withAgg(e) {
|
|
1275
|
+
return this._aggInfo = e, this;
|
|
1276
|
+
}
|
|
1277
|
+
withFilter(e) {
|
|
1278
|
+
return this._filterInfo = e, this;
|
|
1279
|
+
}
|
|
1280
|
+
withOrderBy(e) {
|
|
1281
|
+
return this._orderByInfo = e, this;
|
|
1282
|
+
}
|
|
1283
|
+
withSelect(e) {
|
|
1284
|
+
return this._selectInfo = e, this;
|
|
1285
|
+
}
|
|
1286
|
+
offset(e) {
|
|
1287
|
+
return this._offset = e, this;
|
|
1288
|
+
}
|
|
1289
|
+
limit(e) {
|
|
1290
|
+
return this._limit = e, this;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
et.QueryBuilder = gr;
|
|
1294
|
+
class vr extends gr {
|
|
1295
|
+
where(e, r = en.Operator.Equals, i) {
|
|
1296
|
+
return this._filterInfo ? this._filterInfo = this._filterInfo.andAlso(new en.FilterInfo((0, Ge.toValueExp)(e), r, (0, Ge.toValueExp)(i))) : this._filterInfo = new en.FilterInfo((0, Ge.toValueExp)(e), r, (0, Ge.toValueExp)(i)), this;
|
|
1297
|
+
}
|
|
1298
|
+
orderby(e, r = Ye.OrderByType.Asc) {
|
|
1299
|
+
return this._orderByInfo = new Ye.OrderByInfo(new Ye.OrderByItem((0, Ge.toExp)(e), r)), this;
|
|
1300
|
+
}
|
|
1301
|
+
orderbyDesc(e) {
|
|
1302
|
+
return this.orderby(e, Ye.OrderByType.Desc);
|
|
1303
|
+
}
|
|
1304
|
+
thenby(e, r = Ye.OrderByType.Asc) {
|
|
1305
|
+
return this._orderByInfo ? this._orderByInfo.add((0, Ge.toExp)(e), r) : this._orderByInfo = new Ye.OrderByInfo(new Ye.OrderByItem((0, Ge.toExp)(e), r)), this;
|
|
1306
|
+
}
|
|
1307
|
+
thenbyDesc(e) {
|
|
1308
|
+
return this.thenby(e, Ye.OrderByType.Desc);
|
|
1309
|
+
}
|
|
1310
|
+
agg(e, r = Zt.AggType.Sum, i = null) {
|
|
1311
|
+
return this._aggInfo ? this._aggInfo.append(e, r, i) : this._aggInfo = new Zt.AggInfo(new Zt.AggItem(e, r, i)), this;
|
|
1312
|
+
}
|
|
1313
|
+
include(...e) {
|
|
1314
|
+
return this._selectInfo ? this._selectInfo.appendItems(...e.map((r) => new at.SelectItem(r.toString()))) : this._selectInfo = new at.SelectInfo(...e.map((r) => new at.SelectItem(r.toString()))), this;
|
|
1315
|
+
}
|
|
1316
|
+
exclude(...e) {
|
|
1317
|
+
return this._selectInfo ? this._selectInfo.appendItems(...e.map((r) => new at.SelectItem(r.toString(), !0))) : this._selectInfo = new at.SelectInfo(...e.map((r) => new at.SelectItem(r.toString(), !0))), this;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
et.QueryBuilderOf = vr;
|
|
1321
|
+
function nl() {
|
|
1322
|
+
return new vr();
|
|
1323
|
+
}
|
|
1324
|
+
(function(t) {
|
|
1325
|
+
var e = ct && ct.__createBinding || (Object.create ? function(i, l, a, s) {
|
|
1326
|
+
s === void 0 && (s = a);
|
|
1327
|
+
var o = Object.getOwnPropertyDescriptor(l, a);
|
|
1328
|
+
(!o || ("get" in o ? !l.__esModule : o.writable || o.configurable)) && (o = { enumerable: !0, get: function() {
|
|
1329
|
+
return l[a];
|
|
1330
|
+
} }), Object.defineProperty(i, s, o);
|
|
1331
|
+
} : function(i, l, a, s) {
|
|
1332
|
+
s === void 0 && (s = a), i[s] = l[a];
|
|
1333
|
+
}), r = ct && ct.__exportStar || function(i, l) {
|
|
1334
|
+
for (var a in i) a !== "default" && !Object.prototype.hasOwnProperty.call(l, a) && e(l, i, a);
|
|
1335
|
+
};
|
|
1336
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), r(ke, t), r(ye, t), r(We, t), r(mt, t), r(tt, t), r(me, t), r(Lt, t), r(Ne, t), r(hr, t), r(et, t), r(Fe, t), r(Ke, t), r(_t, t);
|
|
1337
|
+
})(we);
|
|
1338
|
+
const rl = zr(null), il = [
|
|
1339
|
+
{ label: "是", value: !0 },
|
|
1340
|
+
{ label: "否", value: !1 }
|
|
1341
|
+
];
|
|
1342
|
+
function Rt(t) {
|
|
1343
|
+
const e = Xe();
|
|
1344
|
+
return [e.subtract(t, "day"), e];
|
|
1345
|
+
}
|
|
1346
|
+
function ll(t) {
|
|
1347
|
+
const [e, r] = E(7), i = t.valueFormat ?? "YYYY-MM-DD", l = t.op === pe.Between || t.op === pe.NotBetween, a = t.op === pe.In || t.op === pe.NotIn, s = t.value, o = typeof s == "string" ? s : "", c = typeof s == "number" ? s : void 0, d = typeof s == "boolean" ? s : void 0, _ = typeof s == "string" || typeof s == "number" || typeof s == "boolean" ? s : void 0, b = Array.isArray(s) ? s : [], S = Array.isArray(s) && s.length === 2 && typeof s[0] == "string" && typeof s[1] == "string" ? [Xe(s[0]), Xe(s[1])] : null, v = Array.isArray(s) && typeof s[0] == "number" ? s[0] : void 0, w = Array.isArray(s) && typeof s[1] == "number" ? s[1] : void 0, T = (t.options ?? []).map((p) => ({
|
|
1348
|
+
label: p.label,
|
|
1349
|
+
value: p.value
|
|
1350
|
+
})), P = (p) => {
|
|
1351
|
+
var B;
|
|
1352
|
+
return (B = t.onChange) == null ? void 0 : B.call(t, p);
|
|
1353
|
+
}, V = () => {
|
|
1354
|
+
const p = e;
|
|
1355
|
+
if (!p || p < 1) return;
|
|
1356
|
+
const [B, Q] = Rt(p);
|
|
1357
|
+
P([B.format(i), Q.format(i)]);
|
|
1358
|
+
};
|
|
1359
|
+
let M;
|
|
1360
|
+
t.fieldType === "string" && a ? M = /* @__PURE__ */ n(
|
|
1361
|
+
je,
|
|
1362
|
+
{
|
|
1363
|
+
mode: "tags",
|
|
1364
|
+
value: b,
|
|
1365
|
+
onChange: (p) => P(p),
|
|
1366
|
+
tokenSeparators: [",", ","],
|
|
1367
|
+
placeholder: "输入后回车添加",
|
|
1368
|
+
style: { width: "100%" }
|
|
1369
|
+
}
|
|
1370
|
+
) : t.fieldType === "string" ? M = /* @__PURE__ */ n(
|
|
1371
|
+
Ze,
|
|
1372
|
+
{
|
|
1373
|
+
value: o,
|
|
1374
|
+
onChange: (p) => P(p.target.value),
|
|
1375
|
+
placeholder: "请输入",
|
|
1376
|
+
allowClear: !0
|
|
1377
|
+
}
|
|
1378
|
+
) : t.fieldType === "number" && l ? M = /* @__PURE__ */ h(X, { children: [
|
|
1379
|
+
/* @__PURE__ */ n(
|
|
1380
|
+
It,
|
|
1381
|
+
{
|
|
1382
|
+
className: "yk-advanced-value-editor__num",
|
|
1383
|
+
value: v,
|
|
1384
|
+
onChange: (p) => P([p ?? null, w ?? null]),
|
|
1385
|
+
placeholder: "最小值",
|
|
1386
|
+
controls: !1
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
/* @__PURE__ */ n("span", { className: "yk-advanced-value-editor__sep", children: "~" }),
|
|
1390
|
+
/* @__PURE__ */ n(
|
|
1391
|
+
It,
|
|
1392
|
+
{
|
|
1393
|
+
className: "yk-advanced-value-editor__num",
|
|
1394
|
+
value: w,
|
|
1395
|
+
onChange: (p) => P([v ?? null, p ?? null]),
|
|
1396
|
+
placeholder: "最大值",
|
|
1397
|
+
controls: !1
|
|
1398
|
+
}
|
|
1399
|
+
)
|
|
1400
|
+
] }) : t.fieldType === "number" ? M = /* @__PURE__ */ n(
|
|
1401
|
+
It,
|
|
1402
|
+
{
|
|
1403
|
+
value: c,
|
|
1404
|
+
onChange: (p) => P(p ?? null),
|
|
1405
|
+
placeholder: "请输入数字",
|
|
1406
|
+
controls: !1,
|
|
1407
|
+
style: { width: "100%" }
|
|
1408
|
+
}
|
|
1409
|
+
) : t.fieldType === "date" && l ? M = /* @__PURE__ */ h(X, { children: [
|
|
1410
|
+
/* @__PURE__ */ n(
|
|
1411
|
+
Mt.RangePicker,
|
|
1412
|
+
{
|
|
1413
|
+
className: "yk-advanced-value-editor__daterange-picker",
|
|
1414
|
+
value: S,
|
|
1415
|
+
format: i,
|
|
1416
|
+
placeholder: ["开始日期", "结束日期"],
|
|
1417
|
+
presets: [
|
|
1418
|
+
{ label: "最近 7 天", value: () => Rt(7) },
|
|
1419
|
+
{ label: "最近 30 天", value: () => Rt(30) },
|
|
1420
|
+
{ label: "最近 90 天", value: () => Rt(90) }
|
|
1421
|
+
],
|
|
1422
|
+
onChange: (p, B) => {
|
|
1423
|
+
P(p ? [B[0], B[1]] : null);
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
/* @__PURE__ */ n(
|
|
1428
|
+
Hr,
|
|
1429
|
+
{
|
|
1430
|
+
trigger: "click",
|
|
1431
|
+
placement: "bottom",
|
|
1432
|
+
content: /* @__PURE__ */ h("div", { className: "yk-advanced-value-editor__recent-pop", children: [
|
|
1433
|
+
/* @__PURE__ */ n("span", { children: "最近" }),
|
|
1434
|
+
/* @__PURE__ */ n(
|
|
1435
|
+
It,
|
|
1436
|
+
{
|
|
1437
|
+
className: "yk-advanced-value-editor__recent-input",
|
|
1438
|
+
value: e,
|
|
1439
|
+
onChange: (p) => r(typeof p == "number" ? p : 1),
|
|
1440
|
+
min: 1,
|
|
1441
|
+
controls: !1
|
|
1442
|
+
}
|
|
1443
|
+
),
|
|
1444
|
+
/* @__PURE__ */ n("span", { children: "天" }),
|
|
1445
|
+
/* @__PURE__ */ n(O, { type: "primary", size: "small", onClick: V, children: "应用" })
|
|
1446
|
+
] }),
|
|
1447
|
+
children: /* @__PURE__ */ n(O, { className: "yk-advanced-value-editor__recent-trigger", style: { flex: "0 0 auto" }, children: "最近 N 天" })
|
|
1448
|
+
}
|
|
1449
|
+
)
|
|
1450
|
+
] }) : t.fieldType === "date" ? M = /* @__PURE__ */ n(
|
|
1451
|
+
Mt,
|
|
1452
|
+
{
|
|
1453
|
+
value: typeof s == "string" ? Xe(s) : null,
|
|
1454
|
+
format: i,
|
|
1455
|
+
onChange: (p, B) => P(B || null),
|
|
1456
|
+
placeholder: "选择日期",
|
|
1457
|
+
allowClear: !0
|
|
1458
|
+
}
|
|
1459
|
+
) : t.fieldType === "boolean" ? M = /* @__PURE__ */ n(
|
|
1460
|
+
je,
|
|
1461
|
+
{
|
|
1462
|
+
value: d,
|
|
1463
|
+
options: il.map((p) => ({
|
|
1464
|
+
label: p.label,
|
|
1465
|
+
value: p.value
|
|
1466
|
+
})),
|
|
1467
|
+
onChange: (p) => P(p),
|
|
1468
|
+
placeholder: "请选择",
|
|
1469
|
+
allowClear: !0
|
|
1470
|
+
}
|
|
1471
|
+
) : t.fieldType === "enum" && a ? M = /* @__PURE__ */ n(
|
|
1472
|
+
je,
|
|
1473
|
+
{
|
|
1474
|
+
mode: "multiple",
|
|
1475
|
+
value: b,
|
|
1476
|
+
options: T,
|
|
1477
|
+
onChange: (p) => P(p),
|
|
1478
|
+
placeholder: "请选择",
|
|
1479
|
+
allowClear: !0,
|
|
1480
|
+
loading: t.optionsLoading
|
|
1481
|
+
}
|
|
1482
|
+
) : M = /* @__PURE__ */ n(
|
|
1483
|
+
je,
|
|
1484
|
+
{
|
|
1485
|
+
value: _,
|
|
1486
|
+
options: T,
|
|
1487
|
+
onChange: (p) => P(p ?? null),
|
|
1488
|
+
placeholder: "请选择",
|
|
1489
|
+
allowClear: !0,
|
|
1490
|
+
loading: t.optionsLoading
|
|
1491
|
+
}
|
|
1492
|
+
);
|
|
1493
|
+
const z = [
|
|
1494
|
+
"yk-advanced-value-editor",
|
|
1495
|
+
l ? "yk-advanced-value-editor--range" : "",
|
|
1496
|
+
t.fieldType === "date" && l ? "yk-advanced-value-editor--daterange" : "",
|
|
1497
|
+
t.className ?? ""
|
|
1498
|
+
].filter(Boolean).join(" ");
|
|
1499
|
+
return /* @__PURE__ */ n("div", { className: z, children: M });
|
|
1500
|
+
}
|
|
1501
|
+
function pr(t) {
|
|
1502
|
+
const e = Qr(rl);
|
|
1503
|
+
if (!e) return null;
|
|
1504
|
+
const { group: r, level: i = 0 } = t, l = (o) => {
|
|
1505
|
+
(o === "and" || o === "or") && e.api.setGroupCombinator(r.id, o);
|
|
1506
|
+
}, a = (o) => e.columns.find((c) => c.propertyPath === o), s = (o) => {
|
|
1507
|
+
var c;
|
|
1508
|
+
return ((c = a(o)) == null ? void 0 : c.displayFormat) ?? "YYYY-MM-DD";
|
|
1509
|
+
};
|
|
1510
|
+
return /* @__PURE__ */ h("div", { className: `yk-adv-group level-${i}${i === 0 ? " is-root" : ""}`, children: [
|
|
1511
|
+
/* @__PURE__ */ h("div", { className: "yk-adv-group__header", children: [
|
|
1512
|
+
/* @__PURE__ */ n("span", { className: "yk-adv-group__comb-label", children: "满足" }),
|
|
1513
|
+
/* @__PURE__ */ h(
|
|
1514
|
+
Xt.Group,
|
|
1515
|
+
{
|
|
1516
|
+
size: "small",
|
|
1517
|
+
value: r.combinator,
|
|
1518
|
+
onChange: (o) => l(o.target.value),
|
|
1519
|
+
children: [
|
|
1520
|
+
/* @__PURE__ */ n(Xt.Button, { value: "and", children: "全部" }),
|
|
1521
|
+
/* @__PURE__ */ n(Xt.Button, { value: "or", children: "任一" })
|
|
1522
|
+
]
|
|
1523
|
+
}
|
|
1524
|
+
),
|
|
1525
|
+
/* @__PURE__ */ n("span", { className: "yk-adv-group__comb-label", children: "条件" }),
|
|
1526
|
+
/* @__PURE__ */ h("span", { className: "yk-adv-group__actions", children: [
|
|
1527
|
+
/* @__PURE__ */ n(O, { type: "link", onClick: () => e.api.addLeaf(r.id), children: "+ 条件" }),
|
|
1528
|
+
/* @__PURE__ */ n(O, { type: "link", onClick: () => e.api.addNestedGroup(r.id), children: "+ 嵌套组" }),
|
|
1529
|
+
i > 0 && /* @__PURE__ */ n(O, { type: "link", danger: !0, onClick: () => e.api.removeNode(r.id), children: "删除组" })
|
|
1530
|
+
] })
|
|
1531
|
+
] }),
|
|
1532
|
+
/* @__PURE__ */ h("div", { className: "yk-adv-group__children", children: [
|
|
1533
|
+
r.children.map((o) => {
|
|
1534
|
+
if (At(o))
|
|
1535
|
+
return /* @__PURE__ */ n("div", { className: "yk-adv-group__nested", children: /* @__PURE__ */ n(pr, { group: o, level: i + 1 }) }, o.id);
|
|
1536
|
+
const c = o;
|
|
1537
|
+
return /* @__PURE__ */ h("div", { className: "yk-adv-group__row", children: [
|
|
1538
|
+
/* @__PURE__ */ n(
|
|
1539
|
+
je,
|
|
1540
|
+
{
|
|
1541
|
+
className: "yk-adv-group__field",
|
|
1542
|
+
value: c.propertyPath || void 0,
|
|
1543
|
+
options: e.columns.map((d) => ({
|
|
1544
|
+
label: d.displayName ?? d.propertyPath,
|
|
1545
|
+
value: d.propertyPath
|
|
1546
|
+
})),
|
|
1547
|
+
placeholder: "选择字段",
|
|
1548
|
+
showSearch: !0,
|
|
1549
|
+
optionFilterProp: "label",
|
|
1550
|
+
onChange: (d) => e.api.changeField(c.id, d)
|
|
1551
|
+
}
|
|
1552
|
+
),
|
|
1553
|
+
/* @__PURE__ */ n(
|
|
1554
|
+
je,
|
|
1555
|
+
{
|
|
1556
|
+
className: "yk-adv-group__op",
|
|
1557
|
+
value: c.op,
|
|
1558
|
+
options: e.api.operatorsOf(c.propertyPath).map((d) => ({
|
|
1559
|
+
label: hi[d] ?? String(d),
|
|
1560
|
+
value: d
|
|
1561
|
+
})),
|
|
1562
|
+
placeholder: "操作符",
|
|
1563
|
+
showSearch: !0,
|
|
1564
|
+
optionFilterProp: "label",
|
|
1565
|
+
onChange: (d) => e.api.changeOperator(c.id, d)
|
|
1566
|
+
}
|
|
1567
|
+
),
|
|
1568
|
+
!tr(c.op) && /* @__PURE__ */ n(
|
|
1569
|
+
ll,
|
|
1570
|
+
{
|
|
1571
|
+
className: [
|
|
1572
|
+
"yk-adv-group__value",
|
|
1573
|
+
e.api.isConditionEmpty(c) ? "is-invalid" : ""
|
|
1574
|
+
].filter(Boolean).join(" "),
|
|
1575
|
+
fieldType: e.api.fieldTypeOf(c.propertyPath),
|
|
1576
|
+
op: c.op,
|
|
1577
|
+
value: c.value,
|
|
1578
|
+
options: e.optionsMap[c.propertyPath] ?? [],
|
|
1579
|
+
optionsLoading: e.loadingMap[c.propertyPath] === !0,
|
|
1580
|
+
valueFormat: s(c.propertyPath),
|
|
1581
|
+
onChange: (d) => e.updateValue(c.id, d)
|
|
1582
|
+
}
|
|
1583
|
+
),
|
|
1584
|
+
/* @__PURE__ */ n(
|
|
1585
|
+
O,
|
|
1586
|
+
{
|
|
1587
|
+
className: "yk-adv-group__remove",
|
|
1588
|
+
type: "link",
|
|
1589
|
+
danger: !0,
|
|
1590
|
+
onClick: () => e.api.removeNode(c.id),
|
|
1591
|
+
children: "删除"
|
|
1592
|
+
}
|
|
1593
|
+
)
|
|
1594
|
+
] }, c.id);
|
|
1595
|
+
}),
|
|
1596
|
+
r.children.length === 0 && /* @__PURE__ */ n("div", { className: "yk-adv-group__empty", children: "暂无条件,点击「+ 条件」或「+ 嵌套组」" })
|
|
1597
|
+
] })
|
|
1598
|
+
] });
|
|
1599
|
+
}
|
|
1600
|
+
const ol = be(function(e, r) {
|
|
1601
|
+
const i = e.showSearch ?? !0, l = e.showReset ?? !0, a = e.searchButtonText ?? "查询", s = e.resetButtonText ?? "重置", o = e.showSaveQuery ?? !0, c = Xr({
|
|
1602
|
+
columns: e.columns,
|
|
1603
|
+
optionSources: e.optionSources
|
|
1604
|
+
}), { rootGroup: d, fieldTypeOf: _, filter: b, reset: S } = c, [v, w] = E({}), [T, P] = E({}), V = x({}), M = x({}), z = (g) => {
|
|
1605
|
+
var oe;
|
|
1606
|
+
const Y = (oe = e.optionSources) == null ? void 0 : oe[g];
|
|
1607
|
+
Y && (V.current[g] || M.current[g] || (M.current = { ...M.current, [g]: !0 }, P(M.current), Y().then((ge) => {
|
|
1608
|
+
V.current = { ...V.current, [g]: ge }, w(V.current);
|
|
1609
|
+
}).finally(() => {
|
|
1610
|
+
M.current = { ...M.current, [g]: !1 }, P(M.current);
|
|
1611
|
+
})));
|
|
1612
|
+
}, p = (g) => {
|
|
1613
|
+
const Y = /* @__PURE__ */ new Set(), oe = (ge) => {
|
|
1614
|
+
At(ge) ? ge.children.forEach(oe) : _(ge.propertyPath) === "enum" && Y.add(ge.propertyPath);
|
|
1615
|
+
};
|
|
1616
|
+
return g.children.forEach(oe), [...Y];
|
|
1617
|
+
};
|
|
1618
|
+
K(() => {
|
|
1619
|
+
for (const g of p(d)) z(g);
|
|
1620
|
+
}, [d, _, e.optionSources]);
|
|
1621
|
+
const [B, Q] = E([]), Z = e.savedQueries ?? B, fe = (g) => {
|
|
1622
|
+
var Y;
|
|
1623
|
+
Q(g), (Y = e.onUpdateSavedQueries) == null || Y.call(e, g);
|
|
1624
|
+
}, [W, ie] = E(!1), [G, j] = E(""), [ee, U] = E(""), se = x(0), $ = () => {
|
|
1625
|
+
const g = (Y) => Y.children.some((oe) => At(oe) ? g(oe) : c.isConditionEmpty(oe));
|
|
1626
|
+
return g(d);
|
|
1627
|
+
}, u = () => {
|
|
1628
|
+
j(""), U(""), ie(!0);
|
|
1629
|
+
}, N = () => {
|
|
1630
|
+
const g = G.trim();
|
|
1631
|
+
if (!g) return;
|
|
1632
|
+
$() && Ce.warning("当前存在未填值的条件行(标红),保存的预设可能不完整");
|
|
1633
|
+
const Y = JSON.parse(JSON.stringify(d)), oe = {
|
|
1634
|
+
id: `sq-${++se.current}`,
|
|
1635
|
+
name: g,
|
|
1636
|
+
description: ee.trim(),
|
|
1637
|
+
group: Y,
|
|
1638
|
+
filterInfo: b
|
|
1639
|
+
};
|
|
1640
|
+
fe([...Z, oe]), ie(!1);
|
|
1641
|
+
}, F = x(!1), [D, I] = E(0), J = (g) => {
|
|
1642
|
+
const Y = JSON.parse(JSON.stringify(g.group));
|
|
1643
|
+
Object.assign(d, Y), c.setGroupCombinator(d.id, d.combinator), F.current = !0, I((oe) => oe + 1);
|
|
1644
|
+
};
|
|
1645
|
+
K(() => {
|
|
1646
|
+
var g;
|
|
1647
|
+
F.current && (F.current = !1, (g = e.onSearch) == null || g.call(e, b));
|
|
1648
|
+
}, [D, b]);
|
|
1649
|
+
const q = (g) => {
|
|
1650
|
+
fe(Z.filter((Y) => Y.id !== g));
|
|
1651
|
+
}, te = () => {
|
|
1652
|
+
var g;
|
|
1653
|
+
return (g = e.onSearch) == null ? void 0 : g.call(e, b);
|
|
1654
|
+
}, f = () => {
|
|
1655
|
+
var g;
|
|
1656
|
+
S(), (g = e.onReset) == null || g.call(e);
|
|
1657
|
+
};
|
|
1658
|
+
return Pe(
|
|
1659
|
+
r,
|
|
1660
|
+
() => ({
|
|
1661
|
+
get filter() {
|
|
1662
|
+
return b;
|
|
1663
|
+
},
|
|
1664
|
+
reset: f,
|
|
1665
|
+
openSaveDialog: u,
|
|
1666
|
+
applySavedQuery: J,
|
|
1667
|
+
removeSavedQuery: q,
|
|
1668
|
+
get savedQueries() {
|
|
1669
|
+
return Z;
|
|
1670
|
+
}
|
|
1671
|
+
}),
|
|
1672
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1673
|
+
[b, Z, d]
|
|
1674
|
+
), e.columns, /* @__PURE__ */ h(
|
|
1675
|
+
"div",
|
|
1676
|
+
{
|
|
1677
|
+
className: "yk-advanced-filter",
|
|
1678
|
+
onKeyDown: (g) => {
|
|
1679
|
+
g.key === "Enter" && te();
|
|
1680
|
+
},
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ n(pr, { group: d, level: 0 }),
|
|
1683
|
+
(i || l || o) && /* @__PURE__ */ h("div", { className: "yk-advanced-filter__actions", children: [
|
|
1684
|
+
i && /* @__PURE__ */ n(O, { type: "primary", onClick: te, children: a }),
|
|
1685
|
+
l && /* @__PURE__ */ n(O, { onClick: f, children: s }),
|
|
1686
|
+
o && /* @__PURE__ */ n(O, { onClick: u, children: "保存" })
|
|
1687
|
+
] }),
|
|
1688
|
+
/* @__PURE__ */ h(
|
|
1689
|
+
De,
|
|
1690
|
+
{
|
|
1691
|
+
open: W,
|
|
1692
|
+
title: "保存查询",
|
|
1693
|
+
width: 440,
|
|
1694
|
+
onCancel: () => ie(!1),
|
|
1695
|
+
onOk: N,
|
|
1696
|
+
okText: "确定",
|
|
1697
|
+
cancelText: "取消",
|
|
1698
|
+
okButtonProps: { disabled: !G.trim() },
|
|
1699
|
+
children: [
|
|
1700
|
+
/* @__PURE__ */ h("div", { className: "yk-advanced-filter__form-item", children: [
|
|
1701
|
+
/* @__PURE__ */ n("label", { className: "yk-advanced-filter__form-label", children: "名称" }),
|
|
1702
|
+
/* @__PURE__ */ n(
|
|
1703
|
+
Ze,
|
|
1704
|
+
{
|
|
1705
|
+
value: G,
|
|
1706
|
+
onChange: (g) => j(g.target.value),
|
|
1707
|
+
placeholder: "请输入查询名称",
|
|
1708
|
+
maxLength: 50,
|
|
1709
|
+
showCount: !0,
|
|
1710
|
+
onPressEnter: N
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1713
|
+
] }),
|
|
1714
|
+
/* @__PURE__ */ h("div", { className: "yk-advanced-filter__form-item", children: [
|
|
1715
|
+
/* @__PURE__ */ n("label", { className: "yk-advanced-filter__form-label", children: "描述" }),
|
|
1716
|
+
/* @__PURE__ */ n(
|
|
1717
|
+
Ze.TextArea,
|
|
1718
|
+
{
|
|
1719
|
+
value: ee,
|
|
1720
|
+
onChange: (g) => U(g.target.value),
|
|
1721
|
+
rows: 2,
|
|
1722
|
+
placeholder: "可选,描述此查询的用途(hover 标签时显示)",
|
|
1723
|
+
maxLength: 200,
|
|
1724
|
+
showCount: !0
|
|
1725
|
+
}
|
|
1726
|
+
)
|
|
1727
|
+
] })
|
|
1728
|
+
]
|
|
1729
|
+
}
|
|
1730
|
+
)
|
|
1731
|
+
]
|
|
1732
|
+
}
|
|
1733
|
+
);
|
|
1734
|
+
}), al = be(
|
|
1735
|
+
function(e, r) {
|
|
1736
|
+
const i = Zr(), l = x(i);
|
|
1737
|
+
l.current = i;
|
|
1738
|
+
const a = Se(
|
|
1739
|
+
() => ({
|
|
1740
|
+
get filter() {
|
|
1741
|
+
return l.current.filter;
|
|
1742
|
+
},
|
|
1743
|
+
reset: () => l.current.reset(),
|
|
1744
|
+
register: i.register,
|
|
1745
|
+
notify: i.notify
|
|
1746
|
+
}),
|
|
1747
|
+
[i.register, i.notify]
|
|
1748
|
+
), s = Se(() => {
|
|
1749
|
+
const o = [];
|
|
1750
|
+
e.extraFilter && o.push(e.extraFilter);
|
|
1751
|
+
const c = i.filter;
|
|
1752
|
+
return c && !c.isEmpty() && o.push(c), o.length === 0 ? dt() : o.length === 1 ? o[0] : Je.createAnd(
|
|
1753
|
+
...o
|
|
1754
|
+
);
|
|
1755
|
+
}, [e.extraFilter, i.filter]);
|
|
1756
|
+
return Pe(
|
|
1757
|
+
r,
|
|
1758
|
+
() => ({
|
|
1759
|
+
filter: s,
|
|
1760
|
+
reset: () => i.reset()
|
|
1761
|
+
}),
|
|
1762
|
+
[s, i]
|
|
1763
|
+
), /* @__PURE__ */ n(ei.Provider, { value: a, children: e.children });
|
|
1764
|
+
}
|
|
1765
|
+
);
|
|
1766
|
+
function sl(t, e) {
|
|
1767
|
+
const r = /* @__PURE__ */ new Map();
|
|
1768
|
+
for (const i of t)
|
|
1769
|
+
r.set(
|
|
1770
|
+
i.propertyPath,
|
|
1771
|
+
mi(i, (e == null ? void 0 : e[i.propertyPath]) !== void 0)
|
|
1772
|
+
);
|
|
1773
|
+
return (i) => r.get(i) ?? "string";
|
|
1774
|
+
}
|
|
1775
|
+
function cl(t, e) {
|
|
1776
|
+
if (tr(t.op)) return !1;
|
|
1777
|
+
const r = e(t.propertyPath), i = t.value;
|
|
1778
|
+
return yi(t.op) ? !Array.isArray(i) || i.length !== 2 ? !0 : i[0] === null || i[0] === void 0 || i[0] === "" || i[1] === null || i[1] === void 0 || i[1] === "" : gi(t.op) ? !Array.isArray(i) || i.length === 0 : r === "boolean" || r === "number" || r === "date" ? i == null || i === "" : i == null || typeof i == "string" && i.trim() === "";
|
|
1779
|
+
}
|
|
1780
|
+
function ul(t, e) {
|
|
1781
|
+
if (cl(t, e)) return null;
|
|
1782
|
+
if (t.op === "is_null") {
|
|
1783
|
+
const r = e(t.propertyPath);
|
|
1784
|
+
return r === "string" ? Je.createOr(
|
|
1785
|
+
Ee(t.propertyPath, pe.Equals, we.con(null)),
|
|
1786
|
+
Ee(t.propertyPath, pe.Equals, we.con(""))
|
|
1787
|
+
) : r === "array" ? Je.createOr(
|
|
1788
|
+
Ee(t.propertyPath, pe.Equals, we.con(null)),
|
|
1789
|
+
Ee(`${t.propertyPath}.count`, pe.Equals, we.con(0))
|
|
1790
|
+
) : Ee(
|
|
1791
|
+
t.propertyPath,
|
|
1792
|
+
pe.Equals,
|
|
1793
|
+
we.con(null)
|
|
1794
|
+
);
|
|
1795
|
+
}
|
|
1796
|
+
if (t.op === "is_not_null") {
|
|
1797
|
+
const r = e(t.propertyPath);
|
|
1798
|
+
return r === "string" ? Je.createAnd(
|
|
1799
|
+
Ee(t.propertyPath, pe.NotEquals, we.con(null)),
|
|
1800
|
+
Ee(t.propertyPath, pe.NotEquals, we.con(""))
|
|
1801
|
+
) : r === "array" ? Je.createAnd(
|
|
1802
|
+
Ee(t.propertyPath, pe.NotEquals, we.con(null)),
|
|
1803
|
+
Ee(`${t.propertyPath}.count`, pe.GreaterThan, we.con(0))
|
|
1804
|
+
) : Ee(
|
|
1805
|
+
t.propertyPath,
|
|
1806
|
+
pe.NotEquals,
|
|
1807
|
+
we.con(null)
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
return Ee(
|
|
1811
|
+
t.propertyPath,
|
|
1812
|
+
t.op,
|
|
1813
|
+
we.con(t.value)
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
function _r(t, e) {
|
|
1817
|
+
if (At(t)) {
|
|
1818
|
+
const r = t.children.map((i) => _r(i, e)).filter((i) => i !== null);
|
|
1819
|
+
return r.length === 0 ? null : r.length === 1 ? r[0] : t.combinator === "or" ? Je.createOr(...r) : Je.createAnd(...r);
|
|
1820
|
+
}
|
|
1821
|
+
return ul(t, e);
|
|
1822
|
+
}
|
|
1823
|
+
function dl(t, e, r) {
|
|
1824
|
+
const i = sl(e, r);
|
|
1825
|
+
return _r(t, i) ?? dt();
|
|
1826
|
+
}
|
|
1827
|
+
const fl = be(
|
|
1828
|
+
function(e, r) {
|
|
1829
|
+
const i = e.showSearch ?? !0, l = e.showReset ?? !0, a = e.searchButtonText ?? "查询", s = e.resetButtonText ?? "重置", o = e.enableAdvancedFilter ?? !1, c = e.advancedColumns ?? [], d = e.showQuickQuery ?? !1, _ = e.singleLine ?? !1, b = x(null), S = x(null), [v, w] = E("simple"), [T, P] = E(!0), [V, M] = E(0), z = x(null), [p, B] = E([]), Q = e.quickQueries ?? p, Z = () => {
|
|
1830
|
+
var u, N;
|
|
1831
|
+
return v === "advanced" ? ((u = S.current) == null ? void 0 : u.filter) ?? dt() : ((N = b.current) == null ? void 0 : N.filter) ?? dt();
|
|
1832
|
+
}, fe = () => {
|
|
1833
|
+
var u;
|
|
1834
|
+
return (u = e.onSearch) == null ? void 0 : u.call(e, Z());
|
|
1835
|
+
}, W = () => {
|
|
1836
|
+
var u, N, F;
|
|
1837
|
+
v === "advanced" ? (u = S.current) == null || u.reset() : (N = b.current) == null || N.reset(), (F = e.onReset) == null || F.call(e);
|
|
1838
|
+
};
|
|
1839
|
+
Pe(
|
|
1840
|
+
r,
|
|
1841
|
+
() => ({
|
|
1842
|
+
get filter() {
|
|
1843
|
+
return Z();
|
|
1844
|
+
},
|
|
1845
|
+
get mode() {
|
|
1846
|
+
return v;
|
|
1847
|
+
},
|
|
1848
|
+
reset: W
|
|
1849
|
+
}),
|
|
1850
|
+
[v]
|
|
1851
|
+
);
|
|
1852
|
+
const ie = (u) => {
|
|
1853
|
+
var N;
|
|
1854
|
+
B(u), (N = e.onUpdateQuickQueries) == null || N.call(e, u);
|
|
1855
|
+
}, G = async (u) => {
|
|
1856
|
+
const N = new Set(Q.map((D) => D.id)), F = u.filter((D) => !N.has(D.id));
|
|
1857
|
+
if (e.saveQuickQueryFun && F.length > 0) {
|
|
1858
|
+
const D = [];
|
|
1859
|
+
for (const J of F)
|
|
1860
|
+
try {
|
|
1861
|
+
const q = await e.saveQuickQueryFun(J);
|
|
1862
|
+
D.push(q ?? J);
|
|
1863
|
+
} catch {
|
|
1864
|
+
Ce.error(`保存快速查询「${J.name}」失败`), D.push(J);
|
|
1865
|
+
}
|
|
1866
|
+
let I = u;
|
|
1867
|
+
if (D.some((J, q) => J !== F[q])) {
|
|
1868
|
+
const J = new Map(F.map((q, te) => [q.id, D[te] ?? q]));
|
|
1869
|
+
I = u.map((q) => J.get(q.id) ?? q);
|
|
1870
|
+
}
|
|
1871
|
+
ie(I);
|
|
1872
|
+
} else
|
|
1873
|
+
ie(u);
|
|
1874
|
+
};
|
|
1875
|
+
K(() => {
|
|
1876
|
+
if (!e.loadQuickQueryFun) return;
|
|
1877
|
+
let u = !1;
|
|
1878
|
+
return e.loadQuickQueryFun().then((N) => {
|
|
1879
|
+
var D;
|
|
1880
|
+
if (u) return;
|
|
1881
|
+
const F = N.map((I) => ({
|
|
1882
|
+
...I,
|
|
1883
|
+
filterInfo: I.filterInfo ?? dl(I.group, c, e.advancedOptionSources)
|
|
1884
|
+
}));
|
|
1885
|
+
B(F), (D = e.onUpdateQuickQueries) == null || D.call(e, F);
|
|
1886
|
+
}).catch(() => {
|
|
1887
|
+
u || Ce.error("加载快速查询失败");
|
|
1888
|
+
}), () => {
|
|
1889
|
+
u = !0;
|
|
1890
|
+
};
|
|
1891
|
+
}, []);
|
|
1892
|
+
const j = (u) => {
|
|
1893
|
+
var N, F;
|
|
1894
|
+
v === "advanced" ? (N = S.current) == null || N.applySavedQuery(u) : (F = e.onSearch) == null || F.call(e, u.filterInfo);
|
|
1895
|
+
}, ee = (u) => {
|
|
1896
|
+
const N = Q.find((D) => D.id === u), F = (N == null ? void 0 : N.name) ?? "该查询";
|
|
1897
|
+
De.confirm({
|
|
1898
|
+
title: "删除确认",
|
|
1899
|
+
content: `确定要删除快速查询「${F}」吗?`,
|
|
1900
|
+
okText: "删除",
|
|
1901
|
+
cancelText: "取消",
|
|
1902
|
+
okButtonProps: { danger: !0 },
|
|
1903
|
+
onOk: () => {
|
|
1904
|
+
G(Q.filter((D) => D.id !== u));
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
}, U = () => {
|
|
1908
|
+
const u = z.current;
|
|
1909
|
+
if (!u) return;
|
|
1910
|
+
for (const te of Array.from(u.children))
|
|
1911
|
+
te.style.display = "";
|
|
1912
|
+
if (!_ || !T) {
|
|
1913
|
+
M(0), u.style.maxWidth = "";
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
const N = u.nextElementSibling, F = N ? N.offsetWidth : 0, D = 16;
|
|
1917
|
+
u.style.maxWidth = `calc(100% - ${F + D}px)`;
|
|
1918
|
+
const I = u.clientWidth;
|
|
1919
|
+
let J = 0, q = 0;
|
|
1920
|
+
for (const te of Array.from(u.children)) {
|
|
1921
|
+
const f = te, g = f.offsetWidth;
|
|
1922
|
+
J > 0 && J + g + D > I ? (f.style.display = "none", q++) : J += g + D;
|
|
1923
|
+
}
|
|
1924
|
+
M(q);
|
|
1925
|
+
};
|
|
1926
|
+
K(() => {
|
|
1927
|
+
U();
|
|
1928
|
+
const u = z.current;
|
|
1929
|
+
if (!u) return;
|
|
1930
|
+
const N = new ResizeObserver(() => U());
|
|
1931
|
+
return N.observe(u), () => N.disconnect();
|
|
1932
|
+
}, [_, T, v]);
|
|
1933
|
+
const se = () => P((u) => !u), $ = T ? /* @__PURE__ */ h(
|
|
1934
|
+
"svg",
|
|
1935
|
+
{
|
|
1936
|
+
viewBox: "0 0 24 24",
|
|
1937
|
+
width: "16",
|
|
1938
|
+
height: "16",
|
|
1939
|
+
fill: "none",
|
|
1940
|
+
stroke: "currentColor",
|
|
1941
|
+
strokeWidth: "2",
|
|
1942
|
+
strokeLinecap: "round",
|
|
1943
|
+
strokeLinejoin: "round",
|
|
1944
|
+
children: [
|
|
1945
|
+
/* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }),
|
|
1946
|
+
/* @__PURE__ */ n("polyline", { points: "6 14 12 20 18 14" })
|
|
1947
|
+
]
|
|
1948
|
+
}
|
|
1949
|
+
) : /* @__PURE__ */ h(
|
|
1950
|
+
"svg",
|
|
1951
|
+
{
|
|
1952
|
+
viewBox: "0 0 24 24",
|
|
1953
|
+
width: "16",
|
|
1954
|
+
height: "16",
|
|
1955
|
+
fill: "none",
|
|
1956
|
+
stroke: "currentColor",
|
|
1957
|
+
strokeWidth: "2",
|
|
1958
|
+
strokeLinecap: "round",
|
|
1959
|
+
strokeLinejoin: "round",
|
|
1960
|
+
children: [
|
|
1961
|
+
/* @__PURE__ */ n("polyline", { points: "18 15 12 9 6 15" }),
|
|
1962
|
+
/* @__PURE__ */ n("polyline", { points: "18 10 12 4 6 10" })
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
);
|
|
1966
|
+
return /* @__PURE__ */ n(
|
|
1967
|
+
"div",
|
|
1968
|
+
{
|
|
1969
|
+
className: [
|
|
1970
|
+
"yk-filter-panel",
|
|
1971
|
+
_ ? "is-single-line" : "",
|
|
1972
|
+
_ && T ? "is-collapsed" : ""
|
|
1973
|
+
].filter(Boolean).join(" "),
|
|
1974
|
+
onKeyDown: (u) => {
|
|
1975
|
+
u.key === "Enter" && v === "simple" && fe();
|
|
1976
|
+
},
|
|
1977
|
+
children: v === "simple" ? /* @__PURE__ */ h(X, { children: [
|
|
1978
|
+
_ && /* @__PURE__ */ n(
|
|
1979
|
+
O,
|
|
1980
|
+
{
|
|
1981
|
+
type: "text",
|
|
1982
|
+
className: "yk-filter-panel__toggle",
|
|
1983
|
+
"aria-label": T ? "展开更多条件" : "折叠",
|
|
1984
|
+
title: T ? V ? `展开(${V} 个条件被隐藏)` : "展开" : "折叠",
|
|
1985
|
+
onClick: se,
|
|
1986
|
+
children: $
|
|
1987
|
+
}
|
|
1988
|
+
),
|
|
1989
|
+
/* @__PURE__ */ n("div", { className: "yk-filter-panel__items", ref: z, children: /* @__PURE__ */ n(al, { ref: b, children: e.children }) }),
|
|
1990
|
+
(i || l || o) && /* @__PURE__ */ h("div", { className: "yk-filter-panel__actions", children: [
|
|
1991
|
+
i && /* @__PURE__ */ n(O, { type: "primary", onClick: fe, children: a }),
|
|
1992
|
+
l && /* @__PURE__ */ n(O, { onClick: W, children: s }),
|
|
1993
|
+
o && !(_ && T) && /* @__PURE__ */ n(O, { type: "link", onClick: () => w("advanced"), children: "高级查询" })
|
|
1994
|
+
] }),
|
|
1995
|
+
d && Q.length > 0 && /* @__PURE__ */ h("div", { className: "yk-filter-panel__saved", children: [
|
|
1996
|
+
/* @__PURE__ */ n("span", { className: "yk-filter-panel__saved-label", children: "快速查询:" }),
|
|
1997
|
+
Q.map((u) => /* @__PURE__ */ n(Dn, { title: u.description || void 0, children: /* @__PURE__ */ n(O, { size: "small", onClick: () => j(u), children: u.name }) }, u.id))
|
|
1998
|
+
] })
|
|
1999
|
+
] }) : /* @__PURE__ */ h(X, { children: [
|
|
2000
|
+
/* @__PURE__ */ n("div", { className: "yk-filter-panel__mode-bar", children: /* @__PURE__ */ n(O, { type: "link", onClick: () => w("simple"), children: "← 简单查询" }) }),
|
|
2001
|
+
/* @__PURE__ */ n(
|
|
2002
|
+
ol,
|
|
2003
|
+
{
|
|
2004
|
+
ref: S,
|
|
2005
|
+
columns: c,
|
|
2006
|
+
optionSources: e.advancedOptionSources,
|
|
2007
|
+
savedQueries: Q,
|
|
2008
|
+
onSearch: (u) => {
|
|
2009
|
+
var N;
|
|
2010
|
+
return (N = e.onSearch) == null ? void 0 : N.call(e, u);
|
|
2011
|
+
},
|
|
2012
|
+
onReset: () => {
|
|
2013
|
+
var u;
|
|
2014
|
+
return (u = e.onReset) == null ? void 0 : u.call(e);
|
|
2015
|
+
},
|
|
2016
|
+
onUpdateSavedQueries: G
|
|
2017
|
+
}
|
|
2018
|
+
),
|
|
2019
|
+
Q.length > 0 && /* @__PURE__ */ h("div", { className: "yk-filter-panel__saved", children: [
|
|
2020
|
+
/* @__PURE__ */ n("span", { className: "yk-filter-panel__saved-label", children: "已存查询:" }),
|
|
2021
|
+
Q.map((u) => /* @__PURE__ */ n(Dn, { title: u.description || void 0, children: /* @__PURE__ */ n(
|
|
2022
|
+
Jn,
|
|
2023
|
+
{
|
|
2024
|
+
className: "yk-filter-panel__saved-tag",
|
|
2025
|
+
closable: !0,
|
|
2026
|
+
onClick: () => j(u),
|
|
2027
|
+
onClose: () => ee(u.id),
|
|
2028
|
+
children: u.name
|
|
2029
|
+
}
|
|
2030
|
+
) }, u.id))
|
|
2031
|
+
] })
|
|
2032
|
+
] })
|
|
2033
|
+
}
|
|
2034
|
+
);
|
|
2035
|
+
}
|
|
2036
|
+
);
|
|
2037
|
+
function hl({ count: t, onSelectAll: e, onInvert: r, onClear: i }) {
|
|
2038
|
+
return t <= 0 ? null : /* @__PURE__ */ h("div", { className: "yk-table__selection-bar", children: [
|
|
2039
|
+
/* @__PURE__ */ h("span", { className: "yk-table__selection-bar__count", children: [
|
|
2040
|
+
"已选 ",
|
|
2041
|
+
t,
|
|
2042
|
+
" 项"
|
|
2043
|
+
] }),
|
|
2044
|
+
/* @__PURE__ */ n("span", { className: "yk-table__selection-bar__sep", children: "|" }),
|
|
2045
|
+
/* @__PURE__ */ n(O, { type: "link", className: "yk-table__selection-bar__btn", onClick: e, children: "全选" }),
|
|
2046
|
+
/* @__PURE__ */ n(O, { type: "link", className: "yk-table__selection-bar__btn", onClick: r, children: "反选" }),
|
|
2047
|
+
/* @__PURE__ */ n("span", { className: "yk-table__selection-bar__sep", children: "|" }),
|
|
2048
|
+
/* @__PURE__ */ n(O, { type: "link", className: "yk-table__selection-bar__btn", onClick: i, children: "清空" })
|
|
2049
|
+
] });
|
|
2050
|
+
}
|
|
2051
|
+
function ml() {
|
|
2052
|
+
return /* @__PURE__ */ h(
|
|
2053
|
+
"svg",
|
|
2054
|
+
{
|
|
2055
|
+
viewBox: "0 0 24 24",
|
|
2056
|
+
width: "16",
|
|
2057
|
+
height: "16",
|
|
2058
|
+
fill: "none",
|
|
2059
|
+
stroke: "currentColor",
|
|
2060
|
+
strokeWidth: "2",
|
|
2061
|
+
strokeLinecap: "round",
|
|
2062
|
+
"aria-hidden": "true",
|
|
2063
|
+
children: [
|
|
2064
|
+
/* @__PURE__ */ n("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
|
|
2065
|
+
/* @__PURE__ */ n("circle", { cx: "9", cy: "6", r: "2.4", fill: "#fff" }),
|
|
2066
|
+
/* @__PURE__ */ n("line", { x1: "3", y1: "12", x2: "21", y2: "12" }),
|
|
2067
|
+
/* @__PURE__ */ n("circle", { cx: "15", cy: "12", r: "2.4", fill: "#fff" }),
|
|
2068
|
+
/* @__PURE__ */ n("line", { x1: "3", y1: "18", x2: "21", y2: "18" }),
|
|
2069
|
+
/* @__PURE__ */ n("circle", { cx: "9", cy: "18", r: "2.4", fill: "#fff" })
|
|
2070
|
+
]
|
|
2071
|
+
}
|
|
2072
|
+
);
|
|
2073
|
+
}
|
|
2074
|
+
function yl() {
|
|
2075
|
+
return /* @__PURE__ */ h(
|
|
2076
|
+
"svg",
|
|
2077
|
+
{
|
|
2078
|
+
viewBox: "0 0 24 24",
|
|
2079
|
+
width: "14",
|
|
2080
|
+
height: "14",
|
|
2081
|
+
fill: "none",
|
|
2082
|
+
stroke: "currentColor",
|
|
2083
|
+
strokeWidth: "2",
|
|
2084
|
+
strokeLinecap: "round",
|
|
2085
|
+
strokeLinejoin: "round",
|
|
2086
|
+
className: "yk-table-action-menu-button__icon",
|
|
2087
|
+
"aria-hidden": "true",
|
|
2088
|
+
children: [
|
|
2089
|
+
/* @__PURE__ */ n("polyline", { points: "23 4 23 10 17 10" }),
|
|
2090
|
+
/* @__PURE__ */ n("polyline", { points: "1 20 1 14 7 14" }),
|
|
2091
|
+
/* @__PURE__ */ n("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
|
|
2092
|
+
]
|
|
2093
|
+
}
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
2096
|
+
function gl() {
|
|
2097
|
+
return /* @__PURE__ */ h(
|
|
2098
|
+
"svg",
|
|
2099
|
+
{
|
|
2100
|
+
viewBox: "0 0 24 24",
|
|
2101
|
+
width: "14",
|
|
2102
|
+
height: "14",
|
|
2103
|
+
fill: "none",
|
|
2104
|
+
stroke: "currentColor",
|
|
2105
|
+
strokeWidth: "2",
|
|
2106
|
+
strokeLinecap: "round",
|
|
2107
|
+
strokeLinejoin: "round",
|
|
2108
|
+
className: "yk-table-action-menu-button__icon",
|
|
2109
|
+
"aria-hidden": "true",
|
|
2110
|
+
children: [
|
|
2111
|
+
/* @__PURE__ */ n("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2112
|
+
/* @__PURE__ */ n("polyline", { points: "7 10 12 15 17 10" }),
|
|
2113
|
+
/* @__PURE__ */ n("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
2114
|
+
]
|
|
2115
|
+
}
|
|
2116
|
+
);
|
|
2117
|
+
}
|
|
2118
|
+
function vl() {
|
|
2119
|
+
return /* @__PURE__ */ h(
|
|
2120
|
+
"svg",
|
|
2121
|
+
{
|
|
2122
|
+
viewBox: "0 0 24 24",
|
|
2123
|
+
width: "14",
|
|
2124
|
+
height: "14",
|
|
2125
|
+
fill: "none",
|
|
2126
|
+
stroke: "currentColor",
|
|
2127
|
+
strokeWidth: "2",
|
|
2128
|
+
strokeLinecap: "round",
|
|
2129
|
+
strokeLinejoin: "round",
|
|
2130
|
+
className: "yk-table-action-menu-button__icon",
|
|
2131
|
+
"aria-hidden": "true",
|
|
2132
|
+
children: [
|
|
2133
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2134
|
+
/* @__PURE__ */ n("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
2135
|
+
]
|
|
2136
|
+
}
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
function st({ checked: t }) {
|
|
2140
|
+
return /* @__PURE__ */ n("span", { className: "yk-table-action-menu-button__check", children: t ? "✓" : "" });
|
|
2141
|
+
}
|
|
2142
|
+
const kr = be(function({ table: e, trigger: r, className: i }, l) {
|
|
2143
|
+
const [, a] = Vr((c) => c + 1, 0);
|
|
2144
|
+
function s(c) {
|
|
2145
|
+
switch (c) {
|
|
2146
|
+
case "refresh":
|
|
2147
|
+
e.refresh();
|
|
2148
|
+
break;
|
|
2149
|
+
case "config":
|
|
2150
|
+
e.openConfigDialog();
|
|
2151
|
+
break;
|
|
2152
|
+
case "export":
|
|
2153
|
+
e.openExportDialog();
|
|
2154
|
+
break;
|
|
2155
|
+
case "view-table":
|
|
2156
|
+
e.setViewMode("table");
|
|
2157
|
+
break;
|
|
2158
|
+
case "view-card":
|
|
2159
|
+
e.setViewMode("card");
|
|
2160
|
+
break;
|
|
2161
|
+
case "view-list":
|
|
2162
|
+
e.setViewMode("list");
|
|
2163
|
+
break;
|
|
2164
|
+
case "toggle-checkbox":
|
|
2165
|
+
e.setSelectable(!e.selectable);
|
|
2166
|
+
break;
|
|
2167
|
+
case "toggle-column-resize":
|
|
2168
|
+
e.setColumnResizable(!e.columnResizable);
|
|
2169
|
+
break;
|
|
2170
|
+
case "toggle-sticky-header":
|
|
2171
|
+
e.setStickyHeader(!e.stickyHeader);
|
|
2172
|
+
break;
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
const o = [
|
|
2176
|
+
{ key: "refresh", label: /* @__PURE__ */ h(X, { children: [
|
|
2177
|
+
/* @__PURE__ */ n(yl, {}),
|
|
2178
|
+
"刷新"
|
|
2179
|
+
] }) },
|
|
2180
|
+
{ key: "export", label: /* @__PURE__ */ h(X, { children: [
|
|
2181
|
+
/* @__PURE__ */ n(gl, {}),
|
|
2182
|
+
"导出 Excel"
|
|
2183
|
+
] }) },
|
|
2184
|
+
{ key: "config", label: /* @__PURE__ */ h(X, { children: [
|
|
2185
|
+
/* @__PURE__ */ n(vl, {}),
|
|
2186
|
+
"列设置"
|
|
2187
|
+
] }) },
|
|
2188
|
+
{ type: "divider" },
|
|
2189
|
+
{
|
|
2190
|
+
key: "view-table",
|
|
2191
|
+
label: /* @__PURE__ */ h(X, { children: [
|
|
2192
|
+
/* @__PURE__ */ n(st, { checked: e.viewMode === "table" }),
|
|
2193
|
+
"表格视图"
|
|
2194
|
+
] })
|
|
2195
|
+
},
|
|
2196
|
+
...e.slotNames.includes("card") ? [{
|
|
2197
|
+
key: "view-card",
|
|
2198
|
+
label: /* @__PURE__ */ h(X, { children: [
|
|
2199
|
+
/* @__PURE__ */ n(st, { checked: e.viewMode === "card" }),
|
|
2200
|
+
"卡片视图"
|
|
2201
|
+
] })
|
|
2202
|
+
}] : [],
|
|
2203
|
+
...e.slotNames.includes("list") ? [{
|
|
2204
|
+
key: "view-list",
|
|
2205
|
+
label: /* @__PURE__ */ h(X, { children: [
|
|
2206
|
+
/* @__PURE__ */ n(st, { checked: e.viewMode === "list" }),
|
|
2207
|
+
"列表视图"
|
|
2208
|
+
] })
|
|
2209
|
+
}] : [],
|
|
2210
|
+
{ type: "divider" },
|
|
2211
|
+
{
|
|
2212
|
+
key: "toggle-checkbox",
|
|
2213
|
+
label: /* @__PURE__ */ h(X, { children: [
|
|
2214
|
+
/* @__PURE__ */ n(st, { checked: e.selectable }),
|
|
2215
|
+
"选择行"
|
|
2216
|
+
] })
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
key: "toggle-column-resize",
|
|
2220
|
+
label: /* @__PURE__ */ h(X, { children: [
|
|
2221
|
+
/* @__PURE__ */ n(st, { checked: e.columnResizable }),
|
|
2222
|
+
"列宽拖动"
|
|
2223
|
+
] })
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
key: "toggle-sticky-header",
|
|
2227
|
+
label: /* @__PURE__ */ h(X, { children: [
|
|
2228
|
+
/* @__PURE__ */ n(st, { checked: e.stickyHeader }),
|
|
2229
|
+
"锁定表头"
|
|
2230
|
+
] })
|
|
2231
|
+
}
|
|
2232
|
+
];
|
|
2233
|
+
return /* @__PURE__ */ n(
|
|
2234
|
+
Wr,
|
|
2235
|
+
{
|
|
2236
|
+
trigger: ["click"],
|
|
2237
|
+
placement: "bottomRight",
|
|
2238
|
+
onOpenChange: (c) => {
|
|
2239
|
+
c && a();
|
|
2240
|
+
},
|
|
2241
|
+
menu: { items: o, onClick: ({ key: c }) => s(c) },
|
|
2242
|
+
children: r ? /* @__PURE__ */ n("span", { className: "yk-table-action-menu-button__trigger", children: r }) : /* @__PURE__ */ n(
|
|
2243
|
+
O,
|
|
2244
|
+
{
|
|
2245
|
+
ref: l,
|
|
2246
|
+
className: `yk-table-action-menu-button__btn${i ? ` ${i}` : ""}`,
|
|
2247
|
+
title: "表格操作",
|
|
2248
|
+
"aria-label": "表格操作",
|
|
2249
|
+
children: /* @__PURE__ */ n(ml, {})
|
|
2250
|
+
}
|
|
2251
|
+
)
|
|
2252
|
+
}
|
|
2253
|
+
);
|
|
2254
|
+
});
|
|
2255
|
+
kr.displayName = "YsTableActionMenuButton";
|
|
2256
|
+
function pl({
|
|
2257
|
+
actions: t,
|
|
2258
|
+
table: e = null,
|
|
2259
|
+
showActionMenuButton: r = !0,
|
|
2260
|
+
children: i
|
|
2261
|
+
}) {
|
|
2262
|
+
const [l, a] = E(null);
|
|
2263
|
+
async function s(o) {
|
|
2264
|
+
if (!(!e || l !== null)) {
|
|
2265
|
+
a(o.name);
|
|
2266
|
+
try {
|
|
2267
|
+
await o.execute(e);
|
|
2268
|
+
} finally {
|
|
2269
|
+
a(null);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
return /* @__PURE__ */ h("div", { className: "yk-command-bar", children: [
|
|
2274
|
+
/* @__PURE__ */ h("div", { className: "yk-command-bar__actions", children: [
|
|
2275
|
+
t.map((o) => /* @__PURE__ */ n(
|
|
2276
|
+
O,
|
|
2277
|
+
{
|
|
2278
|
+
...un(o.type, o.plain),
|
|
2279
|
+
icon: Bt(o.icon),
|
|
2280
|
+
loading: l === o.name,
|
|
2281
|
+
disabled: l !== null && l !== o.name,
|
|
2282
|
+
onClick: () => void s(o),
|
|
2283
|
+
children: o.desc
|
|
2284
|
+
},
|
|
2285
|
+
o.name
|
|
2286
|
+
)),
|
|
2287
|
+
e && /* @__PURE__ */ n(
|
|
2288
|
+
hl,
|
|
2289
|
+
{
|
|
2290
|
+
count: e.selectedRows.length,
|
|
2291
|
+
onSelectAll: () => e.selectAllOnPage(),
|
|
2292
|
+
onInvert: () => e.invertSelectionOnPage(),
|
|
2293
|
+
onClear: () => e.clearSelection()
|
|
2294
|
+
}
|
|
2295
|
+
),
|
|
2296
|
+
i
|
|
2297
|
+
] }),
|
|
2298
|
+
r && e && /* @__PURE__ */ n(kr, { table: e, className: "yk-command-bar__menu" })
|
|
2299
|
+
] });
|
|
2300
|
+
}
|
|
2301
|
+
const _l = [10, 20, 50, 100], kl = [], bl = [], xl = [], wl = [], Cl = [];
|
|
2302
|
+
function Hn(t) {
|
|
2303
|
+
if (t != null)
|
|
2304
|
+
return typeof t == "function" ? t : () => t;
|
|
2305
|
+
}
|
|
2306
|
+
function tn(t) {
|
|
2307
|
+
return typeof t == "function" ? t() : t;
|
|
2308
|
+
}
|
|
2309
|
+
const Sl = be(
|
|
2310
|
+
function(e, r) {
|
|
2311
|
+
const {
|
|
2312
|
+
metaFun: i,
|
|
2313
|
+
dataFun: l,
|
|
2314
|
+
rowActionsFunc: a,
|
|
2315
|
+
pageSize: s = 20,
|
|
2316
|
+
pageSizes: o = _l,
|
|
2317
|
+
showCheckbox: c = !1,
|
|
2318
|
+
columnResizable: d = !0,
|
|
2319
|
+
stickyHeader: _ = !1,
|
|
2320
|
+
loadCustomConfigFun: b,
|
|
2321
|
+
saveCustomConfigFun: S,
|
|
2322
|
+
exportPageSize: v = 1e3,
|
|
2323
|
+
exportorFunc: w,
|
|
2324
|
+
rowKey: T = "id",
|
|
2325
|
+
viewMode: P = "table",
|
|
2326
|
+
actions: V = bl,
|
|
2327
|
+
showActionMenuButton: M = !0,
|
|
2328
|
+
showSearch: z = !0,
|
|
2329
|
+
showReset: p = !0,
|
|
2330
|
+
searchButtonText: B = "查询",
|
|
2331
|
+
resetButtonText: Q = "重置",
|
|
2332
|
+
enableAdvancedFilter: Z = !1,
|
|
2333
|
+
advancedColumns: fe = kl,
|
|
2334
|
+
advancedOptionSources: W,
|
|
2335
|
+
showQuickQuery: ie = !1,
|
|
2336
|
+
quickQueries: G,
|
|
2337
|
+
loadQuickQueryFun: j,
|
|
2338
|
+
saveQuickQueryFun: ee,
|
|
2339
|
+
singleLine: U = !1
|
|
2340
|
+
} = e, se = x(dt()), $ = x(null), [u, N] = E(null), F = x(null), D = he(
|
|
2341
|
+
(f) => {
|
|
2342
|
+
$.current = f, N(f);
|
|
2343
|
+
},
|
|
2344
|
+
[]
|
|
2345
|
+
), I = he(
|
|
2346
|
+
() => $.current,
|
|
2347
|
+
[]
|
|
2348
|
+
), J = he(
|
|
2349
|
+
(f, g) => l(f, se.current, g),
|
|
2350
|
+
[l]
|
|
2351
|
+
), q = he(
|
|
2352
|
+
(f) => {
|
|
2353
|
+
var g, Y;
|
|
2354
|
+
se.current = f, (g = e.onSearch) == null || g.call(e, f), (Y = $.current) == null || Y.reload();
|
|
2355
|
+
},
|
|
2356
|
+
[e.onSearch]
|
|
2357
|
+
), te = he(() => {
|
|
2358
|
+
var f, g;
|
|
2359
|
+
se.current = dt(), (f = e.onReset) == null || f.call(e), (g = $.current) == null || g.reload();
|
|
2360
|
+
}, [e.onReset]);
|
|
2361
|
+
return Pe(
|
|
2362
|
+
r,
|
|
2363
|
+
() => ({
|
|
2364
|
+
get table() {
|
|
2365
|
+
return I();
|
|
2366
|
+
},
|
|
2367
|
+
get filterPanel() {
|
|
2368
|
+
return F.current;
|
|
2369
|
+
},
|
|
2370
|
+
get meta() {
|
|
2371
|
+
var f;
|
|
2372
|
+
return ((f = I()) == null ? void 0 : f.meta) ?? null;
|
|
2373
|
+
},
|
|
2374
|
+
get paged() {
|
|
2375
|
+
var f;
|
|
2376
|
+
return ((f = I()) == null ? void 0 : f.paged) ?? null;
|
|
2377
|
+
},
|
|
2378
|
+
get currentPage() {
|
|
2379
|
+
var f;
|
|
2380
|
+
return ((f = I()) == null ? void 0 : f.currentPage) ?? 1;
|
|
2381
|
+
},
|
|
2382
|
+
get viewMode() {
|
|
2383
|
+
var f;
|
|
2384
|
+
return ((f = I()) == null ? void 0 : f.viewMode) ?? "table";
|
|
2385
|
+
},
|
|
2386
|
+
get selectable() {
|
|
2387
|
+
var f;
|
|
2388
|
+
return ((f = I()) == null ? void 0 : f.selectable) ?? !1;
|
|
2389
|
+
},
|
|
2390
|
+
get columnResizable() {
|
|
2391
|
+
var f;
|
|
2392
|
+
return ((f = I()) == null ? void 0 : f.columnResizable) ?? !0;
|
|
2393
|
+
},
|
|
2394
|
+
get stickyHeader() {
|
|
2395
|
+
var f;
|
|
2396
|
+
return ((f = I()) == null ? void 0 : f.stickyHeader) ?? !1;
|
|
2397
|
+
},
|
|
2398
|
+
get slotNames() {
|
|
2399
|
+
var f;
|
|
2400
|
+
return ((f = I()) == null ? void 0 : f.slotNames) ?? Cl;
|
|
2401
|
+
},
|
|
2402
|
+
get selectedRows() {
|
|
2403
|
+
var f;
|
|
2404
|
+
return ((f = I()) == null ? void 0 : f.selectedRows) ?? xl;
|
|
2405
|
+
},
|
|
2406
|
+
get rows() {
|
|
2407
|
+
var f;
|
|
2408
|
+
return ((f = I()) == null ? void 0 : f.rows) ?? wl;
|
|
2409
|
+
},
|
|
2410
|
+
reload: () => {
|
|
2411
|
+
var f;
|
|
2412
|
+
(f = I()) == null || f.reload();
|
|
2413
|
+
},
|
|
2414
|
+
refresh: () => {
|
|
2415
|
+
var f;
|
|
2416
|
+
(f = I()) == null || f.refresh();
|
|
2417
|
+
},
|
|
2418
|
+
setViewMode: (f) => {
|
|
2419
|
+
var g;
|
|
2420
|
+
(g = I()) == null || g.setViewMode(f);
|
|
2421
|
+
},
|
|
2422
|
+
setSelectable: (f) => {
|
|
2423
|
+
var g;
|
|
2424
|
+
(g = I()) == null || g.setSelectable(f);
|
|
2425
|
+
},
|
|
2426
|
+
setColumnResizable: (f) => {
|
|
2427
|
+
var g;
|
|
2428
|
+
(g = I()) == null || g.setColumnResizable(f);
|
|
2429
|
+
},
|
|
2430
|
+
setStickyHeader: (f) => {
|
|
2431
|
+
var g;
|
|
2432
|
+
(g = I()) == null || g.setStickyHeader(f);
|
|
2433
|
+
},
|
|
2434
|
+
clearSelection: () => {
|
|
2435
|
+
var f;
|
|
2436
|
+
(f = I()) == null || f.clearSelection();
|
|
2437
|
+
},
|
|
2438
|
+
selectAllOnPage: () => {
|
|
2439
|
+
var f;
|
|
2440
|
+
(f = I()) == null || f.selectAllOnPage();
|
|
2441
|
+
},
|
|
2442
|
+
invertSelectionOnPage: () => {
|
|
2443
|
+
var f;
|
|
2444
|
+
(f = I()) == null || f.invertSelectionOnPage();
|
|
2445
|
+
},
|
|
2446
|
+
openConfigDialog: () => {
|
|
2447
|
+
var f;
|
|
2448
|
+
(f = I()) == null || f.openConfigDialog();
|
|
2449
|
+
},
|
|
2450
|
+
openExportDialog: () => {
|
|
2451
|
+
var f;
|
|
2452
|
+
(f = I()) == null || f.openExportDialog();
|
|
2453
|
+
}
|
|
2454
|
+
}),
|
|
2455
|
+
[I]
|
|
2456
|
+
), /* @__PURE__ */ h("div", { className: "yk-table-page", children: [
|
|
2457
|
+
/* @__PURE__ */ n("div", { className: "yk-table-page__filter", children: /* @__PURE__ */ n(
|
|
2458
|
+
fl,
|
|
2459
|
+
{
|
|
2460
|
+
ref: F,
|
|
2461
|
+
showSearch: z,
|
|
2462
|
+
showReset: p,
|
|
2463
|
+
searchButtonText: B,
|
|
2464
|
+
resetButtonText: Q,
|
|
2465
|
+
enableAdvancedFilter: Z,
|
|
2466
|
+
advancedColumns: fe,
|
|
2467
|
+
advancedOptionSources: W,
|
|
2468
|
+
showQuickQuery: ie,
|
|
2469
|
+
quickQueries: G,
|
|
2470
|
+
loadQuickQueryFun: j,
|
|
2471
|
+
saveQuickQueryFun: ee,
|
|
2472
|
+
singleLine: U,
|
|
2473
|
+
onSearch: q,
|
|
2474
|
+
onReset: te,
|
|
2475
|
+
onUpdateQuickQueries: e.onUpdateQuickQueries,
|
|
2476
|
+
children: e.children
|
|
2477
|
+
}
|
|
2478
|
+
) }),
|
|
2479
|
+
/* @__PURE__ */ n("div", { className: "yk-table-page__command", children: /* @__PURE__ */ n(
|
|
2480
|
+
pl,
|
|
2481
|
+
{
|
|
2482
|
+
actions: V,
|
|
2483
|
+
table: u,
|
|
2484
|
+
showActionMenuButton: M,
|
|
2485
|
+
children: e.commandBar
|
|
2486
|
+
}
|
|
2487
|
+
) }),
|
|
2488
|
+
/* @__PURE__ */ n("div", { className: "yk-table-page__table", children: /* @__PURE__ */ n(
|
|
2489
|
+
Ii,
|
|
2490
|
+
{
|
|
2491
|
+
ref: D,
|
|
2492
|
+
metaFun: i,
|
|
2493
|
+
dataFun: J,
|
|
2494
|
+
rowActionsFunc: a,
|
|
2495
|
+
pageSize: s,
|
|
2496
|
+
pageSizes: o,
|
|
2497
|
+
showCheckbox: c,
|
|
2498
|
+
columnResizable: d,
|
|
2499
|
+
stickyHeader: _,
|
|
2500
|
+
loadCustomConfigFun: b,
|
|
2501
|
+
saveCustomConfigFun: S,
|
|
2502
|
+
exportPageSize: v,
|
|
2503
|
+
exportorFunc: w,
|
|
2504
|
+
rowKey: T,
|
|
2505
|
+
viewMode: P,
|
|
2506
|
+
onDataLoaded: e.onDataLoaded,
|
|
2507
|
+
onUpdateViewMode: e.onUpdateViewMode,
|
|
2508
|
+
onUpdateShowCheckbox: e.onUpdateShowCheckbox,
|
|
2509
|
+
onUpdateColumnResizable: e.onUpdateColumnResizable,
|
|
2510
|
+
onUpdateStickyHeader: e.onUpdateStickyHeader,
|
|
2511
|
+
card: Hn(e.card),
|
|
2512
|
+
list: Hn(e.list),
|
|
2513
|
+
empty: tn(e.empty),
|
|
2514
|
+
loading: tn(e.loading),
|
|
2515
|
+
footer: tn(e.footer)
|
|
2516
|
+
}
|
|
2517
|
+
) })
|
|
2518
|
+
] });
|
|
2519
|
+
}
|
|
2520
|
+
);
|
|
2521
|
+
Sl.displayName = "YsTablePage";
|
|
2522
|
+
const Nl = be(
|
|
2523
|
+
function(e, r) {
|
|
2524
|
+
const {
|
|
2525
|
+
dataFun: i,
|
|
2526
|
+
pageSize: l = 20,
|
|
2527
|
+
threshold: a = 100,
|
|
2528
|
+
rowKey: s = "id",
|
|
2529
|
+
height: o = "100%",
|
|
2530
|
+
immediate: c = !0,
|
|
2531
|
+
showCheckbox: d = !1,
|
|
2532
|
+
metaFun: _,
|
|
2533
|
+
exportorFunc: b,
|
|
2534
|
+
exportPageSize: S = 1e3
|
|
2535
|
+
} = e, [v, w] = E([]), [T, P] = E(!1), [V, M] = E(!1), [z, p] = E(!0), [B, Q] = E(null), [Z, fe] = E(0), [W, ie] = E(null), G = x([]), j = x(!1), ee = x(!1), U = x(!0), se = x(null), $ = x(e.dataFun), u = x(e.metaFun), N = x(l), F = x({
|
|
2536
|
+
onDataLoaded: e.onDataLoaded,
|
|
2537
|
+
onError: e.onError,
|
|
2538
|
+
onSelectionChange: e.onSelectionChange
|
|
2539
|
+
});
|
|
2540
|
+
$.current = e.dataFun, u.current = e.metaFun, N.current = l, se.current = W, F.current = {
|
|
2541
|
+
onDataLoaded: e.onDataLoaded,
|
|
2542
|
+
onError: e.onError,
|
|
2543
|
+
onSelectionChange: e.onSelectionChange
|
|
2544
|
+
};
|
|
2545
|
+
const D = Zn({ rows: v, rowKey: s }), I = x(D);
|
|
2546
|
+
I.current = D;
|
|
2547
|
+
const J = x(!1);
|
|
2548
|
+
K(() => {
|
|
2549
|
+
var A, re;
|
|
2550
|
+
if (!J.current) {
|
|
2551
|
+
J.current = !0;
|
|
2552
|
+
return;
|
|
2553
|
+
}
|
|
2554
|
+
(re = (A = F.current).onSelectionChange) == null || re.call(A, [...D.selectedRows]);
|
|
2555
|
+
}, [D.selectedRows]);
|
|
2556
|
+
const q = he(async (A) => {
|
|
2557
|
+
var re, H, ae, Le;
|
|
2558
|
+
if (A) {
|
|
2559
|
+
if (ee.current || j.current || !U.current) return;
|
|
2560
|
+
ee.current = !0, M(!0);
|
|
2561
|
+
} else {
|
|
2562
|
+
if (j.current) return;
|
|
2563
|
+
j.current = !0, P(!0), Q(null);
|
|
2564
|
+
}
|
|
2565
|
+
try {
|
|
2566
|
+
const ze = A ? G.current.length : 0, Re = await $.current({
|
|
2567
|
+
limit: N.current,
|
|
2568
|
+
offset: ze
|
|
2569
|
+
}), nt = Re.items, rt = A ? [...G.current, ...nt] : nt;
|
|
2570
|
+
G.current = rt, w(rt);
|
|
2571
|
+
const it = Re.hasNext ?? !1;
|
|
2572
|
+
U.current = it, p(it), Re.totalCount != null && fe(Re.totalCount), (H = (re = F.current).onDataLoaded) == null || H.call(re, Re, A);
|
|
2573
|
+
} catch (ze) {
|
|
2574
|
+
Q(ze), (Le = (ae = F.current).onError) == null || Le.call(ae, ze);
|
|
2575
|
+
} finally {
|
|
2576
|
+
A ? (ee.current = !1, M(!1)) : (j.current = !1, P(!1));
|
|
2577
|
+
}
|
|
2578
|
+
}, []), te = he(() => {
|
|
2579
|
+
q(!0);
|
|
2580
|
+
}, [q]), f = he(() => {
|
|
2581
|
+
U.current = !0, p(!0), q(!1);
|
|
2582
|
+
}, [q]), g = he(async () => {
|
|
2583
|
+
const A = u.current;
|
|
2584
|
+
if (!A) {
|
|
2585
|
+
ie(null);
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
try {
|
|
2589
|
+
ie(await A());
|
|
2590
|
+
} catch {
|
|
2591
|
+
ie(null);
|
|
2592
|
+
}
|
|
2593
|
+
}, []), Y = x(null), oe = x(null);
|
|
2594
|
+
K(() => {
|
|
2595
|
+
const A = Y.current, re = oe.current;
|
|
2596
|
+
if (!A || !re || typeof IntersectionObserver > "u") return;
|
|
2597
|
+
const H = new IntersectionObserver(
|
|
2598
|
+
(ae) => {
|
|
2599
|
+
ae.some((Le) => Le.isIntersecting) && U.current && !j.current && !ee.current && te();
|
|
2600
|
+
},
|
|
2601
|
+
{
|
|
2602
|
+
root: A,
|
|
2603
|
+
rootMargin: `0px 0px ${a}px 0px`,
|
|
2604
|
+
threshold: 0
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
return H.observe(re), () => H.disconnect();
|
|
2608
|
+
}, [a, te]), K(() => {
|
|
2609
|
+
g(), c && q(!1);
|
|
2610
|
+
}, []);
|
|
2611
|
+
const ge = x(e.dataFun);
|
|
2612
|
+
K(() => {
|
|
2613
|
+
ge.current !== e.dataFun && (ge.current = e.dataFun, f());
|
|
2614
|
+
}, [e.dataFun, f]);
|
|
2615
|
+
const Te = x(e.metaFun);
|
|
2616
|
+
K(() => {
|
|
2617
|
+
Te.current !== e.metaFun && (Te.current = e.metaFun, g());
|
|
2618
|
+
}, [e.metaFun, g]);
|
|
2619
|
+
const Oe = Se(() => {
|
|
2620
|
+
if (W)
|
|
2621
|
+
return W.columns.map((H, ae) => ({ column: H, index: ae })).filter(({ column: H }) => H.showForDisplay !== !1).sort(
|
|
2622
|
+
(H, ae) => (H.column.displayOrder ?? H.index) - (ae.column.displayOrder ?? ae.index)
|
|
2623
|
+
).map(({ column: H }) => H);
|
|
2624
|
+
const A = /* @__PURE__ */ new Set(), re = [];
|
|
2625
|
+
for (const H of v)
|
|
2626
|
+
for (const ae of Object.keys(H))
|
|
2627
|
+
A.has(ae) || (A.add(ae), re.push({ propertyPath: ae }));
|
|
2628
|
+
return re;
|
|
2629
|
+
}, [W, v]), yt = (W == null ? void 0 : W.displayName) ?? "数据", ne = er({
|
|
2630
|
+
props: { dataFun: i, exportSelected: d, exportorFunc: b },
|
|
2631
|
+
tableName: yt,
|
|
2632
|
+
columns: Oe,
|
|
2633
|
+
currentRows: v,
|
|
2634
|
+
selectedRows: D.selectedRows,
|
|
2635
|
+
total: Z,
|
|
2636
|
+
exportPageSize: S,
|
|
2637
|
+
hasMorePage: z,
|
|
2638
|
+
pageScopeLabel: "导出当前已加载"
|
|
2639
|
+
}), Ie = x(ne);
|
|
2640
|
+
Ie.current = ne;
|
|
2641
|
+
const Me = he(() => {
|
|
2642
|
+
Ie.current.onExportClick();
|
|
2643
|
+
}, []);
|
|
2644
|
+
Pe(
|
|
2645
|
+
r,
|
|
2646
|
+
() => ({
|
|
2647
|
+
get items() {
|
|
2648
|
+
return G.current;
|
|
2649
|
+
},
|
|
2650
|
+
get loading() {
|
|
2651
|
+
return j.current;
|
|
2652
|
+
},
|
|
2653
|
+
get loadingMore() {
|
|
2654
|
+
return ee.current;
|
|
2655
|
+
},
|
|
2656
|
+
get hasMore() {
|
|
2657
|
+
return U.current;
|
|
2658
|
+
},
|
|
2659
|
+
get meta() {
|
|
2660
|
+
return se.current;
|
|
2661
|
+
},
|
|
2662
|
+
get selectedRows() {
|
|
2663
|
+
return I.current.selectedRows;
|
|
2664
|
+
},
|
|
2665
|
+
get rows() {
|
|
2666
|
+
return G.current;
|
|
2667
|
+
},
|
|
2668
|
+
reload: f,
|
|
2669
|
+
refresh: f,
|
|
2670
|
+
loadNextPage: te,
|
|
2671
|
+
isRowSelected: (A) => I.current.isRowSelected(A),
|
|
2672
|
+
toggleRowSelection: (A, re) => I.current.toggleRowSelection(A, re),
|
|
2673
|
+
clearSelection: () => I.current.clearSelection(),
|
|
2674
|
+
selectAllOnPage: () => I.current.selectAllOnPage(),
|
|
2675
|
+
invertSelectionOnPage: () => I.current.invertSelectionOnPage(),
|
|
2676
|
+
openExportDialog: Me
|
|
2677
|
+
}),
|
|
2678
|
+
[te, Me, f]
|
|
2679
|
+
);
|
|
2680
|
+
function qe(A, re) {
|
|
2681
|
+
const H = e.children;
|
|
2682
|
+
return typeof H == "function" ? H(
|
|
2683
|
+
A,
|
|
2684
|
+
re
|
|
2685
|
+
) : H ?? /* @__PURE__ */ n("pre", { className: "yk-infinite-list__item-json", children: JSON.stringify(A, null, 2) });
|
|
2686
|
+
}
|
|
2687
|
+
const Be = e.error, $e = typeof Be == "function" ? Be({ error: B }) : Be;
|
|
2688
|
+
return /* @__PURE__ */ h("div", { ref: Y, className: "yk-infinite-list", style: { height: o }, children: [
|
|
2689
|
+
v.map((A, re) => /* @__PURE__ */ h(
|
|
2690
|
+
"div",
|
|
2691
|
+
{
|
|
2692
|
+
className: `yk-infinite-list__item${d && D.isRowSelected(A) ? " is-selected" : ""}`,
|
|
2693
|
+
children: [
|
|
2694
|
+
d ? /* @__PURE__ */ n(
|
|
2695
|
+
Dt,
|
|
2696
|
+
{
|
|
2697
|
+
className: "yk-infinite-list__item-checkbox",
|
|
2698
|
+
checked: D.isRowSelected(A),
|
|
2699
|
+
onChange: (H) => D.toggleRowSelection(A, H.target.checked)
|
|
2700
|
+
}
|
|
2701
|
+
) : null,
|
|
2702
|
+
/* @__PURE__ */ n("div", { className: "yk-infinite-list__item-body", children: qe(A, re) })
|
|
2703
|
+
]
|
|
2704
|
+
},
|
|
2705
|
+
String(A[s])
|
|
2706
|
+
)),
|
|
2707
|
+
B ? /* @__PURE__ */ n("div", { className: "yk-infinite-list__status", children: $e ?? /* @__PURE__ */ n(ut, { description: `加载失败:${String(B)}`, children: /* @__PURE__ */ n(O, { type: "primary", onClick: f, children: "重试" }) }) }) : !T && v.length === 0 ? (
|
|
2708
|
+
/* 空状态:非加载中、无数据、无错误时显示 */
|
|
2709
|
+
/* @__PURE__ */ n("div", { className: "yk-infinite-list__status", children: e.empty ?? /* @__PURE__ */ n(ut, { description: "暂无数据" }) })
|
|
2710
|
+
) : null,
|
|
2711
|
+
/* @__PURE__ */ n("div", { ref: oe, className: "yk-infinite-list__sentinel" }),
|
|
2712
|
+
V ? /* @__PURE__ */ n("div", { className: "yk-infinite-list__loading-more", children: e.loading ?? /* @__PURE__ */ h(X, { children: [
|
|
2713
|
+
/* @__PURE__ */ n("span", { className: "yk-infinite-list__spinner" }),
|
|
2714
|
+
/* @__PURE__ */ n("span", { children: "加载中..." })
|
|
2715
|
+
] }) }) : null,
|
|
2716
|
+
!z && v.length > 0 && !T ? /* @__PURE__ */ n("div", { className: "yk-infinite-list__no-more", children: e.noMore ?? /* @__PURE__ */ n("span", { children: "— 没有更多了 —" }) }) : null,
|
|
2717
|
+
/* @__PURE__ */ n(
|
|
2718
|
+
nr,
|
|
2719
|
+
{
|
|
2720
|
+
open: ne.exportDialogVisible,
|
|
2721
|
+
options: ne.exportOptions,
|
|
2722
|
+
exporting: ne.exporting,
|
|
2723
|
+
fetched: ne.exportFetched,
|
|
2724
|
+
total: ne.exportTotal,
|
|
2725
|
+
totalKnown: ne.exportTotalKnown,
|
|
2726
|
+
percent: ne.exportPercent,
|
|
2727
|
+
etaSeconds: ne.exportEtaSeconds,
|
|
2728
|
+
cancelledVisible: ne.exportCancelledVisible,
|
|
2729
|
+
cancelledRows: ne.exportCancelledRows,
|
|
2730
|
+
onExport: (A) => void ne.doExport(A),
|
|
2731
|
+
onCancelExport: ne.cancelExport,
|
|
2732
|
+
onKeepPartial: () => void ne.keepPartialExport(),
|
|
2733
|
+
onDiscardPartial: () => void ne.discardPartialExport(),
|
|
2734
|
+
onClose: ne.closeExportDialog
|
|
2735
|
+
}
|
|
2736
|
+
)
|
|
2737
|
+
] });
|
|
2738
|
+
}
|
|
2739
|
+
);
|
|
2740
|
+
Nl.displayName = "YsInfiniteList";
|
|
2741
|
+
function Pl(t) {
|
|
2742
|
+
return t.icon ? /* @__PURE__ */ n("i", { className: "yk-main-panel__menu-icon", children: t.icon }) : void 0;
|
|
2743
|
+
}
|
|
2744
|
+
function sn(t) {
|
|
2745
|
+
const e = [];
|
|
2746
|
+
for (const r of t) {
|
|
2747
|
+
const i = Pl(r), l = /* @__PURE__ */ n("span", { className: "yk-main-panel__menu-text", children: r.label });
|
|
2748
|
+
r.children && r.children.length > 0 ? e.push({
|
|
2749
|
+
key: r.key,
|
|
2750
|
+
icon: i,
|
|
2751
|
+
label: l,
|
|
2752
|
+
children: sn(r.children)
|
|
2753
|
+
}) : e.push({ key: r.key, icon: i, label: l });
|
|
2754
|
+
}
|
|
2755
|
+
return e;
|
|
2756
|
+
}
|
|
2757
|
+
function Il() {
|
|
2758
|
+
return /* @__PURE__ */ n(
|
|
2759
|
+
"svg",
|
|
2760
|
+
{
|
|
2761
|
+
viewBox: "0 0 1024 1024",
|
|
2762
|
+
width: "14",
|
|
2763
|
+
height: "14",
|
|
2764
|
+
"aria-hidden": "true",
|
|
2765
|
+
className: "yk-main-panel__search-icon",
|
|
2766
|
+
children: /* @__PURE__ */ n(
|
|
2767
|
+
"path",
|
|
2768
|
+
{
|
|
2769
|
+
fill: "currentColor",
|
|
2770
|
+
d: "M909.098 839.904l-181.22-181.248a341.5 341.5 0 1 0-47.734 48.58l180.56 180.588a33.92 33.92 0 0 0 48.394-47.92zM454.4 745.6a291.2 291.2 0 1 1 291.2-291.2 291.2 291.2 0 0 1-291.2 291.2z"
|
|
2771
|
+
}
|
|
2772
|
+
)
|
|
2773
|
+
}
|
|
2774
|
+
);
|
|
2775
|
+
}
|
|
2776
|
+
function Hl({
|
|
2777
|
+
nodesFunc: t,
|
|
2778
|
+
componentMap: e,
|
|
2779
|
+
defaultActive: r = "",
|
|
2780
|
+
showMenuSearch: i = !0,
|
|
2781
|
+
menuKeyword: l = "",
|
|
2782
|
+
onUpdateMenuKeyword: a,
|
|
2783
|
+
onTabChange: s
|
|
2784
|
+
}) {
|
|
2785
|
+
const [o, c] = E(!1), [d, _] = E(l);
|
|
2786
|
+
K(() => {
|
|
2787
|
+
_(l);
|
|
2788
|
+
}, [l]);
|
|
2789
|
+
const b = (u) => {
|
|
2790
|
+
_(u), a == null || a(u);
|
|
2791
|
+
}, S = d.trim().length > 0, { nodes: v, menuLoading: w } = ti({ nodesFunc: t }), { openTabs: T, activeKey: P, setActiveKey: V, openTab: M, removeTab: z, getComponent: p } = ni({ componentMap: e }), B = Se(
|
|
2792
|
+
() => ri(v, d),
|
|
2793
|
+
[v, d]
|
|
2794
|
+
), Q = Se(
|
|
2795
|
+
() => ii(B),
|
|
2796
|
+
[B]
|
|
2797
|
+
), Z = Se(() => sn(v), [v]), fe = Se(
|
|
2798
|
+
() => sn(B),
|
|
2799
|
+
[B]
|
|
2800
|
+
), W = ({ key: u }) => {
|
|
2801
|
+
const N = Ln(v, u);
|
|
2802
|
+
N && !zn(N) && M(N);
|
|
2803
|
+
}, ie = x(v), G = x(!1), j = x(!1);
|
|
2804
|
+
K(() => {
|
|
2805
|
+
if (!G.current)
|
|
2806
|
+
if (v !== ie.current) G.current = !0;
|
|
2807
|
+
else return;
|
|
2808
|
+
if (j.current || (j.current = !0, !r)) return;
|
|
2809
|
+
const u = Ln(v, r);
|
|
2810
|
+
u && !zn(u) && M(u);
|
|
2811
|
+
}, [v, r, M]);
|
|
2812
|
+
const ee = x(P), U = x(s);
|
|
2813
|
+
U.current = s, K(() => {
|
|
2814
|
+
var u;
|
|
2815
|
+
ee.current !== P && (ee.current = P, (u = U.current) == null || u.call(U, P));
|
|
2816
|
+
}, [P]);
|
|
2817
|
+
const se = T.map((u) => {
|
|
2818
|
+
const N = u.componentPath ? p(u.componentPath) : null;
|
|
2819
|
+
return {
|
|
2820
|
+
key: u.key,
|
|
2821
|
+
label: u.label,
|
|
2822
|
+
closable: !0,
|
|
2823
|
+
forceRender: !0,
|
|
2824
|
+
children: N ? /* @__PURE__ */ n(Yr, { fallback: /* @__PURE__ */ n("div", { className: "yk-main-panel__loading", children: /* @__PURE__ */ n(rn, { size: "small" }) }), children: /* @__PURE__ */ n(N, { ...u.props ?? {} }) }) : null
|
|
2825
|
+
};
|
|
2826
|
+
}), $ = "yk-main-panel__menu";
|
|
2827
|
+
return /* @__PURE__ */ h("div", { className: "yk-main-panel", children: [
|
|
2828
|
+
/* @__PURE__ */ h("aside", { className: `yk-main-panel__aside${o ? " is-collapsed" : ""}`, children: [
|
|
2829
|
+
/* @__PURE__ */ h("div", { className: "yk-main-panel__aside-header", children: [
|
|
2830
|
+
/* @__PURE__ */ n(
|
|
2831
|
+
O,
|
|
2832
|
+
{
|
|
2833
|
+
type: "text",
|
|
2834
|
+
size: "small",
|
|
2835
|
+
className: "yk-main-panel__collapse-btn",
|
|
2836
|
+
title: o ? "展开菜单" : "折叠菜单",
|
|
2837
|
+
onClick: () => c((u) => !u),
|
|
2838
|
+
children: "☰"
|
|
2839
|
+
}
|
|
2840
|
+
),
|
|
2841
|
+
i && !o && /* @__PURE__ */ n(
|
|
2842
|
+
Ze,
|
|
2843
|
+
{
|
|
2844
|
+
className: "yk-main-panel__aside-search",
|
|
2845
|
+
size: "small",
|
|
2846
|
+
allowClear: !0,
|
|
2847
|
+
placeholder: "搜索功能",
|
|
2848
|
+
"aria-label": "搜索功能",
|
|
2849
|
+
value: d,
|
|
2850
|
+
prefix: /* @__PURE__ */ n(Il, {}),
|
|
2851
|
+
onChange: (u) => b(u.target.value)
|
|
2852
|
+
}
|
|
2853
|
+
)
|
|
2854
|
+
] }),
|
|
2855
|
+
/* @__PURE__ */ n("div", { className: "yk-main-panel__menu-wrap", children: /* @__PURE__ */ n(rn, { spinning: w, size: "small", children: S ? /* @__PURE__ */ h(X, { children: [
|
|
2856
|
+
/* @__PURE__ */ n(
|
|
2857
|
+
Bn,
|
|
2858
|
+
{
|
|
2859
|
+
mode: "inline",
|
|
2860
|
+
className: $,
|
|
2861
|
+
inlineCollapsed: o,
|
|
2862
|
+
items: fe,
|
|
2863
|
+
selectedKeys: P ? [P] : [],
|
|
2864
|
+
defaultOpenKeys: Q,
|
|
2865
|
+
onClick: W
|
|
2866
|
+
},
|
|
2867
|
+
`search-${d}`
|
|
2868
|
+
),
|
|
2869
|
+
B.length === 0 && !w && /* @__PURE__ */ n("div", { className: "yk-main-panel__menu-empty", children: "未找到匹配的功能" })
|
|
2870
|
+
] }) : /* @__PURE__ */ n(
|
|
2871
|
+
Bn,
|
|
2872
|
+
{
|
|
2873
|
+
mode: "inline",
|
|
2874
|
+
className: $,
|
|
2875
|
+
inlineCollapsed: o,
|
|
2876
|
+
items: Z,
|
|
2877
|
+
selectedKeys: P ? [P] : [],
|
|
2878
|
+
onClick: W
|
|
2879
|
+
},
|
|
2880
|
+
"full"
|
|
2881
|
+
) }) })
|
|
2882
|
+
] }),
|
|
2883
|
+
/* @__PURE__ */ n("main", { className: "yk-main-panel__main", children: T.length > 0 ? /* @__PURE__ */ n(
|
|
2884
|
+
Kr,
|
|
2885
|
+
{
|
|
2886
|
+
className: "yk-main-panel__tabs",
|
|
2887
|
+
type: "editable-card",
|
|
2888
|
+
hideAdd: !0,
|
|
2889
|
+
activeKey: P,
|
|
2890
|
+
items: se,
|
|
2891
|
+
onChange: (u) => V(u),
|
|
2892
|
+
onEdit: (u, N) => {
|
|
2893
|
+
N === "remove" && typeof u != "object" && z(u);
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
) : /* @__PURE__ */ n("div", { className: "yk-main-panel__empty", children: /* @__PURE__ */ n(ut, { description: "暂无打开的功能,从左侧菜单选择" }) }) })
|
|
2897
|
+
] });
|
|
2898
|
+
}
|
|
2899
|
+
function zt(t) {
|
|
2900
|
+
li(t.api);
|
|
2901
|
+
const e = t.minWidth ?? 200;
|
|
2902
|
+
return /* @__PURE__ */ h("div", { className: "yk-filter-item", style: { minWidth: `${e}px` }, children: [
|
|
2903
|
+
/* @__PURE__ */ n("label", { className: "yk-filter-item__label", children: t.label }),
|
|
2904
|
+
/* @__PURE__ */ n("div", { className: "yk-filter-item__control", children: t.children })
|
|
2905
|
+
] });
|
|
2906
|
+
}
|
|
2907
|
+
const Wl = be(
|
|
2908
|
+
function(e, r) {
|
|
2909
|
+
const { value: i, setValue: l, filter: a, reset: s } = oi(e), o = Se(
|
|
2910
|
+
() => ({
|
|
2911
|
+
get filter() {
|
|
2912
|
+
return a;
|
|
2913
|
+
},
|
|
2914
|
+
reset: s
|
|
2915
|
+
}),
|
|
2916
|
+
[a, s]
|
|
2917
|
+
);
|
|
2918
|
+
return Pe(r, () => o, [o]), /* @__PURE__ */ n(zt, { label: e.label, api: o, children: /* @__PURE__ */ n(
|
|
2919
|
+
Ze,
|
|
2920
|
+
{
|
|
2921
|
+
value: i,
|
|
2922
|
+
onChange: (c) => l(c.target.value),
|
|
2923
|
+
placeholder: e.placeholder,
|
|
2924
|
+
allowClear: !0
|
|
2925
|
+
}
|
|
2926
|
+
) });
|
|
2927
|
+
}
|
|
2928
|
+
), Kl = be(
|
|
2929
|
+
function(e, r) {
|
|
2930
|
+
const { value: i, setValue: l, filter: a, reset: s } = ai(e), o = e.valueFormat ?? "YYYY-MM-DD", c = Se(
|
|
2931
|
+
() => ({
|
|
2932
|
+
get filter() {
|
|
2933
|
+
return a;
|
|
2934
|
+
},
|
|
2935
|
+
reset: s
|
|
2936
|
+
}),
|
|
2937
|
+
[a, s]
|
|
2938
|
+
);
|
|
2939
|
+
return Pe(r, () => c, [c]), /* @__PURE__ */ n(zt, { label: e.label, api: c, children: /* @__PURE__ */ n(
|
|
2940
|
+
Mt,
|
|
2941
|
+
{
|
|
2942
|
+
value: i ? Xe(i) : null,
|
|
2943
|
+
format: o,
|
|
2944
|
+
onChange: (d, _) => l(typeof _ == "string" ? _ : ""),
|
|
2945
|
+
placeholder: e.placeholder,
|
|
2946
|
+
allowClear: !0
|
|
2947
|
+
}
|
|
2948
|
+
) });
|
|
2949
|
+
}
|
|
2950
|
+
), ql = be(
|
|
2951
|
+
function(e, r) {
|
|
2952
|
+
const { value: i, setValue: l, filter: a, reset: s } = si({
|
|
2953
|
+
propertyPath: e.propertyPath,
|
|
2954
|
+
defaultValue: e.defaultValue
|
|
2955
|
+
}), o = e.valueFormat ?? "YYYY-MM-DD", c = Se(
|
|
2956
|
+
() => ({
|
|
2957
|
+
get filter() {
|
|
2958
|
+
return a;
|
|
2959
|
+
},
|
|
2960
|
+
reset: s
|
|
2961
|
+
}),
|
|
2962
|
+
[a, s]
|
|
2963
|
+
);
|
|
2964
|
+
Pe(r, () => c, [c]);
|
|
2965
|
+
const d = i && i.length === 2 ? [Xe(i[0]), Xe(i[1])] : null;
|
|
2966
|
+
return /* @__PURE__ */ n(zt, { label: e.label, api: c, minWidth: 240, children: /* @__PURE__ */ n(
|
|
2967
|
+
Mt.RangePicker,
|
|
2968
|
+
{
|
|
2969
|
+
value: d,
|
|
2970
|
+
format: o,
|
|
2971
|
+
onChange: (_, b) => {
|
|
2972
|
+
l(_ ? [b[0], b[1]] : null);
|
|
2973
|
+
},
|
|
2974
|
+
placeholder: [
|
|
2975
|
+
e.startPlaceholder ?? "开始日期",
|
|
2976
|
+
e.endPlaceholder ?? "结束日期"
|
|
2977
|
+
],
|
|
2978
|
+
disabledDate: e.disabledDate ? (_) => {
|
|
2979
|
+
var b;
|
|
2980
|
+
return ((b = e.disabledDate) == null ? void 0 : b.call(e, _.toDate())) ?? !1;
|
|
2981
|
+
} : void 0,
|
|
2982
|
+
allowClear: !0
|
|
2983
|
+
}
|
|
2984
|
+
) });
|
|
2985
|
+
}
|
|
2986
|
+
), Ul = be(
|
|
2987
|
+
function(e, r) {
|
|
2988
|
+
const { value: i, setValue: l, filter: a, reset: s } = ci({
|
|
2989
|
+
op: e.op,
|
|
2990
|
+
propertyPath: e.propertyPath,
|
|
2991
|
+
defaultValue: e.defaultValue,
|
|
2992
|
+
multiple: e.multiple
|
|
2993
|
+
}), [o, c] = E([]), [d, _] = E(!1), b = x(e.optionsSource);
|
|
2994
|
+
b.current = e.optionsSource, K(() => {
|
|
2995
|
+
let w = !0;
|
|
2996
|
+
return _(!0), b.current().then((T) => {
|
|
2997
|
+
w && c(T);
|
|
2998
|
+
}).finally(() => {
|
|
2999
|
+
w && _(!1);
|
|
3000
|
+
}), () => {
|
|
3001
|
+
w = !1;
|
|
3002
|
+
};
|
|
3003
|
+
}, []);
|
|
3004
|
+
const S = Se(
|
|
3005
|
+
() => ({
|
|
3006
|
+
get filter() {
|
|
3007
|
+
return a;
|
|
3008
|
+
},
|
|
3009
|
+
reset: s
|
|
3010
|
+
}),
|
|
3011
|
+
[a, s]
|
|
3012
|
+
);
|
|
3013
|
+
Pe(r, () => S, [S]);
|
|
3014
|
+
const v = o.map((w) => ({
|
|
3015
|
+
label: w.label,
|
|
3016
|
+
value: w.value
|
|
3017
|
+
}));
|
|
3018
|
+
return /* @__PURE__ */ n(zt, { label: e.label, api: S, children: e.multiple ? /* @__PURE__ */ n(
|
|
3019
|
+
je,
|
|
3020
|
+
{
|
|
3021
|
+
mode: "multiple",
|
|
3022
|
+
value: Array.isArray(i) ? i : [],
|
|
3023
|
+
options: v,
|
|
3024
|
+
onChange: (w) => l(w),
|
|
3025
|
+
placeholder: e.placeholder,
|
|
3026
|
+
allowClear: e.clearable ?? !0,
|
|
3027
|
+
loading: d
|
|
3028
|
+
}
|
|
3029
|
+
) : /* @__PURE__ */ n(
|
|
3030
|
+
je,
|
|
3031
|
+
{
|
|
3032
|
+
value: i ?? void 0,
|
|
3033
|
+
options: v,
|
|
3034
|
+
onChange: (w) => l(w ?? null),
|
|
3035
|
+
placeholder: e.placeholder,
|
|
3036
|
+
allowClear: e.clearable ?? !0,
|
|
3037
|
+
loading: d
|
|
3038
|
+
}
|
|
3039
|
+
) });
|
|
3040
|
+
}
|
|
3041
|
+
);
|
|
3042
|
+
function br(t) {
|
|
3043
|
+
if (t == null) return "";
|
|
3044
|
+
if (typeof t == "object")
|
|
3045
|
+
try {
|
|
3046
|
+
return JSON.stringify(t);
|
|
3047
|
+
} catch {
|
|
3048
|
+
return String(t);
|
|
3049
|
+
}
|
|
3050
|
+
return String(t);
|
|
3051
|
+
}
|
|
3052
|
+
function Rl({
|
|
3053
|
+
open: t,
|
|
3054
|
+
row: e,
|
|
3055
|
+
columns: r,
|
|
3056
|
+
saver: i,
|
|
3057
|
+
onClose: l,
|
|
3058
|
+
onSaved: a
|
|
3059
|
+
}) {
|
|
3060
|
+
const [s, o] = E({}), [c, d] = E([]);
|
|
3061
|
+
K(() => {
|
|
3062
|
+
if (!t || !e) return;
|
|
3063
|
+
const S = {};
|
|
3064
|
+
for (const v of r)
|
|
3065
|
+
S[v.name] = br(e.data[v.name]);
|
|
3066
|
+
o(S), d([]);
|
|
3067
|
+
}, [t, e, r]);
|
|
3068
|
+
function _() {
|
|
3069
|
+
l == null || l();
|
|
3070
|
+
}
|
|
3071
|
+
function b() {
|
|
3072
|
+
if (!e) return;
|
|
3073
|
+
const S = {};
|
|
3074
|
+
for (const T of r)
|
|
3075
|
+
S[T.name] = s[T.name] ?? "";
|
|
3076
|
+
const { row: v, errors: w } = i(e, S);
|
|
3077
|
+
d(w), !(w.length > 0) && (a == null || a(v), _());
|
|
3078
|
+
}
|
|
3079
|
+
return /* @__PURE__ */ h(
|
|
3080
|
+
De,
|
|
3081
|
+
{
|
|
3082
|
+
open: t,
|
|
3083
|
+
title: e ? `编辑第 ${e.rowNumber} 行` : "编辑数据行",
|
|
3084
|
+
width: 480,
|
|
3085
|
+
maskClosable: !1,
|
|
3086
|
+
destroyOnClose: !0,
|
|
3087
|
+
onCancel: _,
|
|
3088
|
+
footer: /* @__PURE__ */ h(X, { children: [
|
|
3089
|
+
/* @__PURE__ */ n(O, { onClick: _, children: "取消" }),
|
|
3090
|
+
/* @__PURE__ */ n(O, { type: "primary", onClick: b, children: "保存并重新校验" })
|
|
3091
|
+
] }),
|
|
3092
|
+
children: [
|
|
3093
|
+
c.length > 0 ? /* @__PURE__ */ n(
|
|
3094
|
+
qr,
|
|
3095
|
+
{
|
|
3096
|
+
className: "yk-import-row-edit-dialog__alert",
|
|
3097
|
+
type: "error",
|
|
3098
|
+
showIcon: !0,
|
|
3099
|
+
message: /* @__PURE__ */ n(X, { children: c.map((S, v) => /* @__PURE__ */ n("div", { children: S }, v)) })
|
|
3100
|
+
}
|
|
3101
|
+
) : null,
|
|
3102
|
+
/* @__PURE__ */ n($n, { labelCol: { flex: "0 0 92px" }, wrapperCol: { flex: "auto" }, children: r.map((S) => /* @__PURE__ */ n($n.Item, { label: S.name, required: !S.optional, children: /* @__PURE__ */ n(
|
|
3103
|
+
Ze,
|
|
3104
|
+
{
|
|
3105
|
+
value: s[S.name] ?? "",
|
|
3106
|
+
placeholder: S.optional ? "可留空" : `请输入${S.name}`,
|
|
3107
|
+
onChange: (v) => o((w) => ({ ...w, [S.name]: v.target.value })),
|
|
3108
|
+
onPressEnter: b
|
|
3109
|
+
}
|
|
3110
|
+
) }, S.name)) })
|
|
3111
|
+
]
|
|
3112
|
+
}
|
|
3113
|
+
);
|
|
3114
|
+
}
|
|
3115
|
+
const nn = {
|
|
3116
|
+
valid: { label: "待处理" },
|
|
3117
|
+
invalid: { label: "校验失败", color: "red" },
|
|
3118
|
+
processing: { label: "处理中", color: "orange" },
|
|
3119
|
+
success: { label: "成功", color: "green" },
|
|
3120
|
+
failed: { label: "失败", color: "red" }
|
|
3121
|
+
};
|
|
3122
|
+
function El(t) {
|
|
3123
|
+
const e = Math.max(0, Math.ceil(t / 1e3));
|
|
3124
|
+
if (e < 60) return `${e} 秒`;
|
|
3125
|
+
const r = Math.floor(e / 60), i = e % 60;
|
|
3126
|
+
return i > 0 ? `${r} 分 ${i} 秒` : `${r} 分`;
|
|
3127
|
+
}
|
|
3128
|
+
function Et(t) {
|
|
3129
|
+
var e;
|
|
3130
|
+
return Array.from(((e = t.dataTransfer) == null ? void 0 : e.types) ?? []).includes("Files");
|
|
3131
|
+
}
|
|
3132
|
+
function Ol() {
|
|
3133
|
+
return /* @__PURE__ */ h(
|
|
3134
|
+
"svg",
|
|
3135
|
+
{
|
|
3136
|
+
className: "yk-import-excel__action-icon",
|
|
3137
|
+
viewBox: "0 0 24 24",
|
|
3138
|
+
fill: "none",
|
|
3139
|
+
stroke: "currentColor",
|
|
3140
|
+
strokeWidth: "2",
|
|
3141
|
+
strokeLinecap: "round",
|
|
3142
|
+
strokeLinejoin: "round",
|
|
3143
|
+
"aria-hidden": "true",
|
|
3144
|
+
children: [
|
|
3145
|
+
/* @__PURE__ */ n("path", { d: "M12 20h9" }),
|
|
3146
|
+
/* @__PURE__ */ n("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
3147
|
+
]
|
|
3148
|
+
}
|
|
3149
|
+
);
|
|
3150
|
+
}
|
|
3151
|
+
function Ml() {
|
|
3152
|
+
return /* @__PURE__ */ h(
|
|
3153
|
+
"svg",
|
|
3154
|
+
{
|
|
3155
|
+
className: "yk-import-excel__action-icon",
|
|
3156
|
+
viewBox: "0 0 24 24",
|
|
3157
|
+
fill: "none",
|
|
3158
|
+
stroke: "currentColor",
|
|
3159
|
+
strokeWidth: "2",
|
|
3160
|
+
strokeLinecap: "round",
|
|
3161
|
+
strokeLinejoin: "round",
|
|
3162
|
+
"aria-hidden": "true",
|
|
3163
|
+
children: [
|
|
3164
|
+
/* @__PURE__ */ n("polyline", { points: "3 6 5 6 21 6" }),
|
|
3165
|
+
/* @__PURE__ */ n("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
|
|
3166
|
+
/* @__PURE__ */ n("line", { x1: "10", y1: "11", x2: "10", y2: "17" }),
|
|
3167
|
+
/* @__PURE__ */ n("line", { x1: "14", y1: "11", x2: "14", y2: "17" })
|
|
3168
|
+
]
|
|
3169
|
+
}
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3172
|
+
const Gl = be(
|
|
3173
|
+
function(e, r) {
|
|
3174
|
+
var bt;
|
|
3175
|
+
const {
|
|
3176
|
+
columns: i,
|
|
3177
|
+
processor: l,
|
|
3178
|
+
parser: a,
|
|
3179
|
+
accept: s = ".xlsx",
|
|
3180
|
+
autoScroll: o = !0,
|
|
3181
|
+
title: c,
|
|
3182
|
+
maxHeight: d
|
|
3183
|
+
} = e, {
|
|
3184
|
+
rows: _,
|
|
3185
|
+
fileName: b,
|
|
3186
|
+
sheetName: S,
|
|
3187
|
+
loading: v,
|
|
3188
|
+
processing: w,
|
|
3189
|
+
stopping: T,
|
|
3190
|
+
processingTotal: P,
|
|
3191
|
+
progressDone: V,
|
|
3192
|
+
progressSuccess: M,
|
|
3193
|
+
progressFailed: z,
|
|
3194
|
+
hasData: p,
|
|
3195
|
+
invalidCount: B,
|
|
3196
|
+
selectedCount: Q,
|
|
3197
|
+
pendingCount: Z,
|
|
3198
|
+
loadFile: fe,
|
|
3199
|
+
syncSelection: W,
|
|
3200
|
+
saveRowEdit: ie,
|
|
3201
|
+
removeRow: G,
|
|
3202
|
+
startProcessing: j,
|
|
3203
|
+
stopProcessing: ee,
|
|
3204
|
+
clear: U
|
|
3205
|
+
} = ui({ columns: i, processor: l, parser: a }), se = x(null), $ = x(null), u = x(S);
|
|
3206
|
+
u.current = S;
|
|
3207
|
+
const [N, F] = E(0), D = N > 0;
|
|
3208
|
+
function I(y) {
|
|
3209
|
+
const k = s.split(",").map((le) => le.trim().toLowerCase()).filter(Boolean);
|
|
3210
|
+
if (k.length === 0) return !0;
|
|
3211
|
+
const L = y.name.toLowerCase();
|
|
3212
|
+
return k.some((le) => L.endsWith(le));
|
|
3213
|
+
}
|
|
3214
|
+
async function J(y) {
|
|
3215
|
+
var k;
|
|
3216
|
+
if (!v) {
|
|
3217
|
+
if (!I(y)) {
|
|
3218
|
+
Ce.error(`仅支持 ${s} 格式的文件`);
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
try {
|
|
3222
|
+
const L = await fe(y);
|
|
3223
|
+
(k = e.onLoaded) == null || k.call(e, L), setTimeout(() => {
|
|
3224
|
+
const le = u.current;
|
|
3225
|
+
Ce.success(
|
|
3226
|
+
`已加载 ${L.length} 行${le ? `(工作表「${le}」)` : ""}`
|
|
3227
|
+
);
|
|
3228
|
+
}, 0);
|
|
3229
|
+
} catch (L) {
|
|
3230
|
+
Ce.error(L instanceof Error ? L.message : String(L));
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
async function q(y) {
|
|
3235
|
+
var le;
|
|
3236
|
+
const k = y.target, L = (le = k.files) == null ? void 0 : le[0];
|
|
3237
|
+
k.value = "", L && await J(L);
|
|
3238
|
+
}
|
|
3239
|
+
function te() {
|
|
3240
|
+
var y;
|
|
3241
|
+
(y = se.current) == null || y.click();
|
|
3242
|
+
}
|
|
3243
|
+
function f(y) {
|
|
3244
|
+
Et(y) && F((k) => k + 1);
|
|
3245
|
+
}
|
|
3246
|
+
function g(y) {
|
|
3247
|
+
Et(y) && (y.preventDefault(), y.dataTransfer && (y.dataTransfer.dropEffect = "copy"));
|
|
3248
|
+
}
|
|
3249
|
+
function Y(y) {
|
|
3250
|
+
Et(y) && F((k) => Math.max(0, k - 1));
|
|
3251
|
+
}
|
|
3252
|
+
function oe(y) {
|
|
3253
|
+
var L, le;
|
|
3254
|
+
if (!Et(y)) return;
|
|
3255
|
+
y.preventDefault(), F(0);
|
|
3256
|
+
const k = (le = (L = y.dataTransfer) == null ? void 0 : L.files) == null ? void 0 : le[0];
|
|
3257
|
+
k && J(k);
|
|
3258
|
+
}
|
|
3259
|
+
const ge = x(0), [Te, Oe] = E(0);
|
|
3260
|
+
K(() => {
|
|
3261
|
+
if (!w) return;
|
|
3262
|
+
ge.current = Date.now(), Oe(Date.now());
|
|
3263
|
+
const y = setInterval(() => Oe(Date.now()), 500);
|
|
3264
|
+
return () => clearInterval(y);
|
|
3265
|
+
}, [w]);
|
|
3266
|
+
const yt = P <= 0 ? 0 : Math.min(100, V / P * 100), ne = !w || V === 0 ? "预计剩余 计算中…" : `预计剩余 ${El(
|
|
3267
|
+
(Te - ge.current) / V * (P - V)
|
|
3268
|
+
)}`, [Ie, Me] = E(360);
|
|
3269
|
+
K(() => {
|
|
3270
|
+
const y = $.current;
|
|
3271
|
+
if (!y) return;
|
|
3272
|
+
const k = () => {
|
|
3273
|
+
var lt;
|
|
3274
|
+
const le = ((lt = y.querySelector(".ant-table-thead")) == null ? void 0 : lt.getBoundingClientRect().height) ?? 39;
|
|
3275
|
+
let Ue = Math.max(120, Math.floor(y.clientHeight - le - 1));
|
|
3276
|
+
typeof d == "number" && (Ue = Math.min(Ue, d)), Me(Ue);
|
|
3277
|
+
};
|
|
3278
|
+
k();
|
|
3279
|
+
const L = new ResizeObserver(k);
|
|
3280
|
+
return L.observe(y), () => L.disconnect();
|
|
3281
|
+
}, [d, p]);
|
|
3282
|
+
const qe = ((bt = _.find((y) => y.status === "processing")) == null ? void 0 : bt.rowNumber) ?? null;
|
|
3283
|
+
K(() => {
|
|
3284
|
+
var xt, wt;
|
|
3285
|
+
if (qe === null || !o) return;
|
|
3286
|
+
const y = (xt = $.current) == null ? void 0 : xt.querySelector(".ant-table-body"), k = (wt = $.current) == null ? void 0 : wt.querySelector(
|
|
3287
|
+
`.ant-table-tbody tr[data-row-key="${qe}"]`
|
|
3288
|
+
);
|
|
3289
|
+
if (!y || !k) return;
|
|
3290
|
+
const L = y.getBoundingClientRect(), le = k.getBoundingClientRect(), Ue = Math.max(0, y.scrollHeight - y.clientHeight), lt = y.scrollTop + (le.top - L.top) - (y.clientHeight - le.height) / 2;
|
|
3291
|
+
y.scrollTop = Math.min(Ue, Math.max(0, Math.round(lt)));
|
|
3292
|
+
}, [qe, o]);
|
|
3293
|
+
const Be = _.filter((y) => y.selected).map((y) => y.rowNumber);
|
|
3294
|
+
function $e(y) {
|
|
3295
|
+
return y.status !== "invalid";
|
|
3296
|
+
}
|
|
3297
|
+
function A(y) {
|
|
3298
|
+
var L;
|
|
3299
|
+
const k = _.filter((le) => y.includes(le.rowNumber));
|
|
3300
|
+
W(k), (L = e.onSelectionChange) == null || L.call(e, k);
|
|
3301
|
+
}
|
|
3302
|
+
async function re() {
|
|
3303
|
+
var y;
|
|
3304
|
+
try {
|
|
3305
|
+
const k = await j();
|
|
3306
|
+
if (!k) return;
|
|
3307
|
+
if ((y = e.onProcessed) == null || y.call(e, k), k.stopped) {
|
|
3308
|
+
const L = k.total - k.success - k.failed;
|
|
3309
|
+
Ce.warning(
|
|
3310
|
+
`已停止:成功 ${k.success} 行,失败 ${k.failed} 行,剩余 ${L} 行未处理(可再次「开始处理」续跑)`
|
|
3311
|
+
);
|
|
3312
|
+
} else k.failed === 0 ? Ce.success(`全部处理完成,共 ${k.success} 行`) : Ce.warning(
|
|
3313
|
+
`处理完成:成功 ${k.success} 行,失败 ${k.failed} 行`
|
|
3314
|
+
);
|
|
3315
|
+
} catch (k) {
|
|
3316
|
+
Ce.error(k instanceof Error ? k.message : String(k));
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
const [H, ae] = E(!1), [Le, ze] = E(null);
|
|
3320
|
+
function Re(y) {
|
|
3321
|
+
return !w && (y.status === "invalid" || y.status === "failed");
|
|
3322
|
+
}
|
|
3323
|
+
function nt(y) {
|
|
3324
|
+
Re(y) && (ze(y), ae(!0));
|
|
3325
|
+
}
|
|
3326
|
+
function rt(y) {
|
|
3327
|
+
var k;
|
|
3328
|
+
(k = e.onRowUpdate) == null || k.call(e, y), Ce.success(`第 ${y.rowNumber} 行已修正,可重新处理`);
|
|
3329
|
+
}
|
|
3330
|
+
function it(y) {
|
|
3331
|
+
Re(y) && De.confirm({
|
|
3332
|
+
title: "删除数据行",
|
|
3333
|
+
content: `确定删除第 ${y.rowNumber} 行吗?删除后不可恢复。`,
|
|
3334
|
+
okText: "删除",
|
|
3335
|
+
cancelText: "取消",
|
|
3336
|
+
okButtonProps: { danger: !0 },
|
|
3337
|
+
onOk: () => {
|
|
3338
|
+
var k;
|
|
3339
|
+
G(y), (k = e.onRowRemove) == null || k.call(e, y), Ce.success(`已删除第 ${y.rowNumber} 行`);
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3343
|
+
Pe(r, () => ({
|
|
3344
|
+
openFilePicker: te,
|
|
3345
|
+
startProcessing: re,
|
|
3346
|
+
stopProcessing: ee,
|
|
3347
|
+
clear: U
|
|
3348
|
+
}));
|
|
3349
|
+
const Qt = Object.keys(nn).map(
|
|
3350
|
+
(y) => ({
|
|
3351
|
+
text: `${nn[y].label}(${_.filter((k) => k.status === y).length})`,
|
|
3352
|
+
value: y
|
|
3353
|
+
})
|
|
3354
|
+
), Vt = [
|
|
3355
|
+
// 数据序号(从 1 开始,与是否有表头/空行无关);title 保留真实 Excel 行号便于溯源
|
|
3356
|
+
{
|
|
3357
|
+
title: "行号",
|
|
3358
|
+
key: "rowNumber",
|
|
3359
|
+
width: 70,
|
|
3360
|
+
align: "center",
|
|
3361
|
+
fixed: "left",
|
|
3362
|
+
render: (y, k, L) => /* @__PURE__ */ n("span", { title: `Excel 第 ${k.rowNumber} 行`, children: L + 1 })
|
|
3363
|
+
},
|
|
3364
|
+
...i.map((y) => ({
|
|
3365
|
+
title: y.name,
|
|
3366
|
+
key: y.name,
|
|
3367
|
+
width: 120,
|
|
3368
|
+
ellipsis: { showTitle: !0 },
|
|
3369
|
+
render: (k, L) => br(L.data[y.name])
|
|
3370
|
+
})),
|
|
3371
|
+
{
|
|
3372
|
+
title: "状态",
|
|
3373
|
+
key: "status",
|
|
3374
|
+
dataIndex: "status",
|
|
3375
|
+
width: 200,
|
|
3376
|
+
fixed: "right",
|
|
3377
|
+
className: "yk-import-excel__status-cell",
|
|
3378
|
+
filters: Qt,
|
|
3379
|
+
filterMultiple: !1,
|
|
3380
|
+
onFilter: (y, k) => k.status === y,
|
|
3381
|
+
render: (y, k) => {
|
|
3382
|
+
const L = nn[k.status];
|
|
3383
|
+
return /* @__PURE__ */ h(X, { children: [
|
|
3384
|
+
/* @__PURE__ */ h(Jn, { color: L.color, children: [
|
|
3385
|
+
k.status === "processing" ? /* @__PURE__ */ n("span", { className: "yk-import-excel__spin" }) : null,
|
|
3386
|
+
L.label
|
|
3387
|
+
] }),
|
|
3388
|
+
k.status === "invalid" ? /* @__PURE__ */ n("div", { className: "yk-import-excel__msg yk-import-excel__msg--danger", children: k.errors.join(";") }) : k.message ? /* @__PURE__ */ n("div", { className: "yk-import-excel__msg yk-import-excel__msg--danger", children: k.message }) : null
|
|
3389
|
+
] });
|
|
3390
|
+
}
|
|
3391
|
+
},
|
|
3392
|
+
// 操作列:仅校验失败/处理失败行提供编辑、删除,处理中禁用
|
|
3393
|
+
{
|
|
3394
|
+
title: "操作",
|
|
3395
|
+
key: "action",
|
|
3396
|
+
width: 110,
|
|
3397
|
+
align: "center",
|
|
3398
|
+
fixed: "right",
|
|
3399
|
+
render: (y, k) => Re(k) ? /* @__PURE__ */ h("div", { className: "yk-import-excel__actions", children: [
|
|
3400
|
+
/* @__PURE__ */ n(
|
|
3401
|
+
O,
|
|
3402
|
+
{
|
|
3403
|
+
type: "link",
|
|
3404
|
+
size: "small",
|
|
3405
|
+
icon: /* @__PURE__ */ n(Ol, {}),
|
|
3406
|
+
onClick: () => nt(k),
|
|
3407
|
+
children: "编辑"
|
|
3408
|
+
}
|
|
3409
|
+
),
|
|
3410
|
+
/* @__PURE__ */ n(
|
|
3411
|
+
O,
|
|
3412
|
+
{
|
|
3413
|
+
type: "link",
|
|
3414
|
+
size: "small",
|
|
3415
|
+
danger: !0,
|
|
3416
|
+
icon: /* @__PURE__ */ n(Ml, {}),
|
|
3417
|
+
onClick: () => it(k),
|
|
3418
|
+
children: "删除"
|
|
3419
|
+
}
|
|
3420
|
+
)
|
|
3421
|
+
] }) : /* @__PURE__ */ n("span", { className: "yk-import-excel__action-placeholder", children: "—" })
|
|
3422
|
+
}
|
|
3423
|
+
], Yt = {
|
|
3424
|
+
selectedRowKeys: Be,
|
|
3425
|
+
columnWidth: 44,
|
|
3426
|
+
getCheckboxProps: (y) => ({ disabled: !$e(y) }),
|
|
3427
|
+
onChange: A
|
|
3428
|
+
};
|
|
3429
|
+
return /* @__PURE__ */ h(
|
|
3430
|
+
"div",
|
|
3431
|
+
{
|
|
3432
|
+
className: "yk-import-excel",
|
|
3433
|
+
onDragEnter: f,
|
|
3434
|
+
onDragOver: g,
|
|
3435
|
+
onDragLeave: Y,
|
|
3436
|
+
onDrop: oe,
|
|
3437
|
+
children: [
|
|
3438
|
+
/* @__PURE__ */ n(
|
|
3439
|
+
"input",
|
|
3440
|
+
{
|
|
3441
|
+
ref: se,
|
|
3442
|
+
className: "yk-import-excel__file",
|
|
3443
|
+
type: "file",
|
|
3444
|
+
accept: s,
|
|
3445
|
+
onChange: q
|
|
3446
|
+
}
|
|
3447
|
+
),
|
|
3448
|
+
c ? /* @__PURE__ */ n("div", { className: "yk-import-excel__title", children: c }) : null,
|
|
3449
|
+
/* @__PURE__ */ h("div", { className: "yk-import-excel__toolbar", children: [
|
|
3450
|
+
/* @__PURE__ */ n(O, { type: "primary", loading: v, onClick: te, children: "选择 Excel 文件" }),
|
|
3451
|
+
/* @__PURE__ */ h(
|
|
3452
|
+
O,
|
|
3453
|
+
{
|
|
3454
|
+
type: "primary",
|
|
3455
|
+
loading: w,
|
|
3456
|
+
disabled: Z === 0,
|
|
3457
|
+
onClick: re,
|
|
3458
|
+
children: [
|
|
3459
|
+
"开始处理",
|
|
3460
|
+
Z > 0 ? `(${Z} 行)` : ""
|
|
3461
|
+
]
|
|
3462
|
+
}
|
|
3463
|
+
),
|
|
3464
|
+
w ? /* @__PURE__ */ n(O, { danger: !0, disabled: T, onClick: ee, children: T ? "正在停止…" : "停止" }) : null,
|
|
3465
|
+
/* @__PURE__ */ n(O, { disabled: !p || w, onClick: U, children: "清空" }),
|
|
3466
|
+
b ? /* @__PURE__ */ h("span", { className: "yk-import-excel__file-name", title: b, children: [
|
|
3467
|
+
b,
|
|
3468
|
+
S ? `(工作表:${S})` : ""
|
|
3469
|
+
] }) : null,
|
|
3470
|
+
p ? /* @__PURE__ */ h("div", { className: "yk-import-excel__stats", children: [
|
|
3471
|
+
/* @__PURE__ */ h("span", { className: "yk-import-excel__stat", children: [
|
|
3472
|
+
"共 ",
|
|
3473
|
+
_.length,
|
|
3474
|
+
" 行"
|
|
3475
|
+
] }),
|
|
3476
|
+
/* @__PURE__ */ h("span", { className: "yk-import-excel__stat", children: [
|
|
3477
|
+
"已选 ",
|
|
3478
|
+
Q
|
|
3479
|
+
] }),
|
|
3480
|
+
/* @__PURE__ */ h("span", { className: "yk-import-excel__stat yk-import-excel__stat--danger", children: [
|
|
3481
|
+
"校验失败 ",
|
|
3482
|
+
B
|
|
3483
|
+
] })
|
|
3484
|
+
] }) : null
|
|
3485
|
+
] }),
|
|
3486
|
+
w ? /* @__PURE__ */ h("div", { className: "yk-import-excel__progress", children: [
|
|
3487
|
+
/* @__PURE__ */ n(
|
|
3488
|
+
Un,
|
|
3489
|
+
{
|
|
3490
|
+
className: "yk-import-excel__progress-bar",
|
|
3491
|
+
percent: yt,
|
|
3492
|
+
status: "active",
|
|
3493
|
+
format: () => `${V}/${P}`
|
|
3494
|
+
}
|
|
3495
|
+
),
|
|
3496
|
+
/* @__PURE__ */ h("span", { className: "yk-import-excel__progress-meta", children: [
|
|
3497
|
+
"成功 ",
|
|
3498
|
+
M,
|
|
3499
|
+
/* @__PURE__ */ h("span", { className: "yk-import-excel__danger-text", children: [
|
|
3500
|
+
" ",
|
|
3501
|
+
"/ 失败 ",
|
|
3502
|
+
z
|
|
3503
|
+
] })
|
|
3504
|
+
] }),
|
|
3505
|
+
/* @__PURE__ */ n("span", { className: "yk-import-excel__progress-eta", children: ne })
|
|
3506
|
+
] }) : null,
|
|
3507
|
+
/* @__PURE__ */ n("div", { ref: $, className: "yk-import-excel__body", children: /* @__PURE__ */ n(rn, { spinning: v, wrapperClassName: "yk-import-excel__loading", children: p ? /* @__PURE__ */ n(
|
|
3508
|
+
Gn,
|
|
3509
|
+
{
|
|
3510
|
+
className: "yk-import-excel__table",
|
|
3511
|
+
rowKey: "rowNumber",
|
|
3512
|
+
columns: Vt,
|
|
3513
|
+
dataSource: _,
|
|
3514
|
+
bordered: !0,
|
|
3515
|
+
size: "small",
|
|
3516
|
+
pagination: !1,
|
|
3517
|
+
rowSelection: Yt,
|
|
3518
|
+
scroll: { x: "max-content", y: Ie },
|
|
3519
|
+
rowClassName: (y, k) => k % 2 === 1 ? "yk-import-excel__row-alt" : ""
|
|
3520
|
+
}
|
|
3521
|
+
) : /* @__PURE__ */ h("div", { className: "yk-import-excel__empty", onClick: te, children: [
|
|
3522
|
+
/* @__PURE__ */ h(
|
|
3523
|
+
"svg",
|
|
3524
|
+
{
|
|
3525
|
+
className: "yk-import-excel__empty-icon",
|
|
3526
|
+
viewBox: "0 0 24 24",
|
|
3527
|
+
fill: "none",
|
|
3528
|
+
stroke: "currentColor",
|
|
3529
|
+
strokeWidth: "1.6",
|
|
3530
|
+
strokeLinecap: "round",
|
|
3531
|
+
strokeLinejoin: "round",
|
|
3532
|
+
"aria-hidden": "true",
|
|
3533
|
+
children: [
|
|
3534
|
+
/* @__PURE__ */ n("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
3535
|
+
/* @__PURE__ */ n("polyline", { points: "14 2 14 8 20 8" }),
|
|
3536
|
+
/* @__PURE__ */ n("path", { d: "M12 18v-6" }),
|
|
3537
|
+
/* @__PURE__ */ n("polyline", { points: "9.5 14.5 12 12l2.5 2.5" })
|
|
3538
|
+
]
|
|
3539
|
+
}
|
|
3540
|
+
),
|
|
3541
|
+
/* @__PURE__ */ n("p", { className: "yk-import-excel__empty-title", children: "点击选择 Excel 文件,或将文件拖拽到此处" }),
|
|
3542
|
+
/* @__PURE__ */ h("p", { className: "yk-import-excel__empty-hint", children: [
|
|
3543
|
+
"支持 ",
|
|
3544
|
+
s,
|
|
3545
|
+
" 格式,首行需为表头"
|
|
3546
|
+
] })
|
|
3547
|
+
] }) }) }),
|
|
3548
|
+
D ? /* @__PURE__ */ n("div", { className: "yk-import-excel__drop-mask", children: /* @__PURE__ */ h("div", { className: "yk-import-excel__drop-tip", children: [
|
|
3549
|
+
/* @__PURE__ */ h(
|
|
3550
|
+
"svg",
|
|
3551
|
+
{
|
|
3552
|
+
viewBox: "0 0 24 24",
|
|
3553
|
+
fill: "none",
|
|
3554
|
+
stroke: "currentColor",
|
|
3555
|
+
strokeWidth: "1.6",
|
|
3556
|
+
strokeLinecap: "round",
|
|
3557
|
+
strokeLinejoin: "round",
|
|
3558
|
+
"aria-hidden": "true",
|
|
3559
|
+
children: [
|
|
3560
|
+
/* @__PURE__ */ n("path", { d: "M12 15V3" }),
|
|
3561
|
+
/* @__PURE__ */ n("polyline", { points: "7 8 12 3 17 8" }),
|
|
3562
|
+
/* @__PURE__ */ n("path", { d: "M3 15v4a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-4" })
|
|
3563
|
+
]
|
|
3564
|
+
}
|
|
3565
|
+
),
|
|
3566
|
+
/* @__PURE__ */ n("span", { children: "松开鼠标,加载 Excel 文件" })
|
|
3567
|
+
] }) }) : null,
|
|
3568
|
+
/* @__PURE__ */ n(
|
|
3569
|
+
Rl,
|
|
3570
|
+
{
|
|
3571
|
+
open: H,
|
|
3572
|
+
row: Le,
|
|
3573
|
+
columns: i,
|
|
3574
|
+
saver: ie,
|
|
3575
|
+
onClose: () => ae(!1),
|
|
3576
|
+
onSaved: rt
|
|
3577
|
+
}
|
|
3578
|
+
)
|
|
3579
|
+
]
|
|
3580
|
+
}
|
|
3581
|
+
);
|
|
3582
|
+
}
|
|
3583
|
+
);
|
|
3584
|
+
var cn, Ot = di;
|
|
3585
|
+
if (process.env.NODE_ENV === "production")
|
|
3586
|
+
cn = Ot.createRoot, Ot.hydrateRoot;
|
|
3587
|
+
else {
|
|
3588
|
+
var Wn = Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
3589
|
+
cn = function(t, e) {
|
|
3590
|
+
Wn.usingClientEntryPoint = !0;
|
|
3591
|
+
try {
|
|
3592
|
+
return Ot.createRoot(t, e);
|
|
3593
|
+
} finally {
|
|
3594
|
+
Wn.usingClientEntryPoint = !1;
|
|
3595
|
+
}
|
|
3596
|
+
};
|
|
3597
|
+
}
|
|
3598
|
+
function Al() {
|
|
3599
|
+
return /* @__PURE__ */ n(
|
|
3600
|
+
"svg",
|
|
3601
|
+
{
|
|
3602
|
+
viewBox: "0 0 24 24",
|
|
3603
|
+
width: "16",
|
|
3604
|
+
height: "16",
|
|
3605
|
+
fill: "none",
|
|
3606
|
+
stroke: "currentColor",
|
|
3607
|
+
strokeWidth: "2",
|
|
3608
|
+
strokeLinecap: "round",
|
|
3609
|
+
strokeLinejoin: "round",
|
|
3610
|
+
"aria-hidden": "true",
|
|
3611
|
+
children: /* @__PURE__ */ n("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" })
|
|
3612
|
+
}
|
|
3613
|
+
);
|
|
3614
|
+
}
|
|
3615
|
+
function Fl() {
|
|
3616
|
+
return /* @__PURE__ */ h(
|
|
3617
|
+
"svg",
|
|
3618
|
+
{
|
|
3619
|
+
viewBox: "0 0 24 24",
|
|
3620
|
+
width: "16",
|
|
3621
|
+
height: "16",
|
|
3622
|
+
fill: "none",
|
|
3623
|
+
stroke: "currentColor",
|
|
3624
|
+
strokeWidth: "2",
|
|
3625
|
+
strokeLinecap: "round",
|
|
3626
|
+
strokeLinejoin: "round",
|
|
3627
|
+
"aria-hidden": "true",
|
|
3628
|
+
children: [
|
|
3629
|
+
/* @__PURE__ */ n("rect", { x: "8", y: "8", width: "12", height: "12", rx: "2" }),
|
|
3630
|
+
/* @__PURE__ */ n("path", { d: "M4 16V6a2 2 0 0 1 2-2h10" })
|
|
3631
|
+
]
|
|
3632
|
+
}
|
|
3633
|
+
);
|
|
3634
|
+
}
|
|
3635
|
+
const Tl = be(
|
|
3636
|
+
function(e, r) {
|
|
3637
|
+
const {
|
|
3638
|
+
title: i,
|
|
3639
|
+
width: l,
|
|
3640
|
+
heightValue: a,
|
|
3641
|
+
component: s,
|
|
3642
|
+
componentProps: o,
|
|
3643
|
+
actions: c,
|
|
3644
|
+
onCancel: d,
|
|
3645
|
+
onClosed: _,
|
|
3646
|
+
closeOnClickModal: b,
|
|
3647
|
+
closeOnPressEscape: S,
|
|
3648
|
+
maximizable: v,
|
|
3649
|
+
defaultMaximized: w,
|
|
3650
|
+
contentRef: T,
|
|
3651
|
+
modalHandle: P,
|
|
3652
|
+
destroy: V
|
|
3653
|
+
} = e, [M, z] = E(!0), [p, B] = E(-1), [Q, Z] = E(v && w), fe = () => {
|
|
3654
|
+
v && Z(($) => !$);
|
|
3655
|
+
}, W = () => {
|
|
3656
|
+
z(!1);
|
|
3657
|
+
}, ie = () => {
|
|
3658
|
+
p >= 0 || (d == null || d(), z(!1));
|
|
3659
|
+
}, G = async ($, u) => {
|
|
3660
|
+
if (!(p >= 0)) {
|
|
3661
|
+
B(u);
|
|
3662
|
+
try {
|
|
3663
|
+
await $.execute(P);
|
|
3664
|
+
} finally {
|
|
3665
|
+
B(-1);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
};
|
|
3669
|
+
Pe(r, () => ({
|
|
3670
|
+
close: W,
|
|
3671
|
+
toggleMaximize: fe,
|
|
3672
|
+
isMaximized: () => Q
|
|
3673
|
+
}), [v, Q]);
|
|
3674
|
+
const j = v ? /* @__PURE__ */ h("div", { className: "yk-modal__title-row", children: [
|
|
3675
|
+
/* @__PURE__ */ n("span", { className: "yk-modal__title-text", children: i }),
|
|
3676
|
+
/* @__PURE__ */ n(
|
|
3677
|
+
O,
|
|
3678
|
+
{
|
|
3679
|
+
type: "text",
|
|
3680
|
+
size: "small",
|
|
3681
|
+
className: "yk-modal__maximize",
|
|
3682
|
+
title: Q ? "还原" : "最大化",
|
|
3683
|
+
"aria-label": Q ? "还原" : "最大化",
|
|
3684
|
+
onClick: fe,
|
|
3685
|
+
children: Q ? /* @__PURE__ */ n(Fl, {}) : /* @__PURE__ */ n(Al, {})
|
|
3686
|
+
}
|
|
3687
|
+
)
|
|
3688
|
+
] }) : i, ee = c && c.length > 0 ? /* @__PURE__ */ n("div", { className: "yk-modal__footer", children: c.map(($, u) => {
|
|
3689
|
+
const { type: N, danger: F } = un($.type);
|
|
3690
|
+
return /* @__PURE__ */ n(
|
|
3691
|
+
O,
|
|
3692
|
+
{
|
|
3693
|
+
type: N,
|
|
3694
|
+
danger: F,
|
|
3695
|
+
title: $.desc,
|
|
3696
|
+
disabled: p >= 0 && p !== u,
|
|
3697
|
+
loading: p === u,
|
|
3698
|
+
onClick: () => void G($, u),
|
|
3699
|
+
icon: $.icon ? /* @__PURE__ */ n("span", { className: "yk-modal__action-icon", children: Bt($.icon) }) : void 0,
|
|
3700
|
+
children: $.desc
|
|
3701
|
+
},
|
|
3702
|
+
$.name
|
|
3703
|
+
);
|
|
3704
|
+
}) }) : null, U = {
|
|
3705
|
+
...Q ? { top: 0 } : {},
|
|
3706
|
+
...a && !Q ? { "--yk-modal-height": a } : {}
|
|
3707
|
+
}, se = [
|
|
3708
|
+
"yk-modal",
|
|
3709
|
+
Q ? "yk-modal--maximized" : a ? "yk-modal--fixed-height" : ""
|
|
3710
|
+
].filter(Boolean).join(" ");
|
|
3711
|
+
return /* @__PURE__ */ n(
|
|
3712
|
+
De,
|
|
3713
|
+
{
|
|
3714
|
+
open: M,
|
|
3715
|
+
title: j,
|
|
3716
|
+
width: l,
|
|
3717
|
+
style: U,
|
|
3718
|
+
wrapClassName: se,
|
|
3719
|
+
closable: p < 0,
|
|
3720
|
+
maskClosable: b,
|
|
3721
|
+
keyboard: S,
|
|
3722
|
+
destroyOnClose: !0,
|
|
3723
|
+
onCancel: ie,
|
|
3724
|
+
afterClose: () => {
|
|
3725
|
+
_ == null || _(), V();
|
|
3726
|
+
},
|
|
3727
|
+
footer: ee,
|
|
3728
|
+
children: qn(s, {
|
|
3729
|
+
...o ?? {},
|
|
3730
|
+
onClose: W,
|
|
3731
|
+
ref: T
|
|
3732
|
+
})
|
|
3733
|
+
}
|
|
3734
|
+
);
|
|
3735
|
+
}
|
|
3736
|
+
);
|
|
3737
|
+
function Dl(t) {
|
|
3738
|
+
if (t != null)
|
|
3739
|
+
return typeof t == "number" ? `${t}px` : t;
|
|
3740
|
+
}
|
|
3741
|
+
function Bl(t) {
|
|
3742
|
+
const {
|
|
3743
|
+
title: e = "",
|
|
3744
|
+
width: r = "500px",
|
|
3745
|
+
height: i,
|
|
3746
|
+
component: l,
|
|
3747
|
+
props: a,
|
|
3748
|
+
actions: s,
|
|
3749
|
+
onCancel: o,
|
|
3750
|
+
onClosed: c,
|
|
3751
|
+
closeOnClickModal: d = !1,
|
|
3752
|
+
closeOnPressEscape: _ = !1,
|
|
3753
|
+
maximizable: b = !1,
|
|
3754
|
+
defaultMaximized: S = !1
|
|
3755
|
+
} = t, v = document.createElement("div");
|
|
3756
|
+
document.body.appendChild(v);
|
|
3757
|
+
const w = cn(v);
|
|
3758
|
+
let T = !1;
|
|
3759
|
+
const P = () => {
|
|
3760
|
+
T || (T = !0, w.unmount(), v.remove());
|
|
3761
|
+
}, V = { current: null }, M = { current: null }, z = {
|
|
3762
|
+
close: () => {
|
|
3763
|
+
var p;
|
|
3764
|
+
return (p = V.current) == null ? void 0 : p.close();
|
|
3765
|
+
},
|
|
3766
|
+
toggleMaximize: () => {
|
|
3767
|
+
var p;
|
|
3768
|
+
return (p = V.current) == null ? void 0 : p.toggleMaximize();
|
|
3769
|
+
},
|
|
3770
|
+
isMaximized: () => {
|
|
3771
|
+
var p;
|
|
3772
|
+
return ((p = V.current) == null ? void 0 : p.isMaximized()) ?? !1;
|
|
3773
|
+
},
|
|
3774
|
+
getContentInstance: () => M.current ?? null
|
|
3775
|
+
};
|
|
3776
|
+
return w.render(
|
|
3777
|
+
/* @__PURE__ */ n(
|
|
3778
|
+
Tl,
|
|
3779
|
+
{
|
|
3780
|
+
ref: V,
|
|
3781
|
+
title: e,
|
|
3782
|
+
width: r,
|
|
3783
|
+
heightValue: Dl(i),
|
|
3784
|
+
component: l,
|
|
3785
|
+
componentProps: a,
|
|
3786
|
+
actions: s,
|
|
3787
|
+
onCancel: o,
|
|
3788
|
+
onClosed: c,
|
|
3789
|
+
closeOnClickModal: d,
|
|
3790
|
+
closeOnPressEscape: _,
|
|
3791
|
+
maximizable: b,
|
|
3792
|
+
defaultMaximized: S,
|
|
3793
|
+
contentRef: M,
|
|
3794
|
+
modalHandle: z,
|
|
3795
|
+
destroy: P
|
|
3796
|
+
}
|
|
3797
|
+
)
|
|
3798
|
+
), z;
|
|
3799
|
+
}
|
|
3800
|
+
function Jl(t) {
|
|
3801
|
+
const {
|
|
3802
|
+
confirmText: e = "确定",
|
|
3803
|
+
cancelText: r = "取消",
|
|
3804
|
+
confirmType: i = "primary",
|
|
3805
|
+
onConfirm: l,
|
|
3806
|
+
...a
|
|
3807
|
+
} = t;
|
|
3808
|
+
return Bl({ ...a, actions: [
|
|
3809
|
+
{ name: "cancel", desc: r, execute: (o) => o.close() },
|
|
3810
|
+
{
|
|
3811
|
+
name: "confirm",
|
|
3812
|
+
desc: e,
|
|
3813
|
+
type: i,
|
|
3814
|
+
execute: async (o) => {
|
|
3815
|
+
if (!l) {
|
|
3816
|
+
o.close();
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
await l(o) !== !1 && o.close();
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
] });
|
|
3823
|
+
}
|
|
3824
|
+
export {
|
|
3825
|
+
pr as YsAdvancedConditionGroup,
|
|
3826
|
+
ol as YsAdvancedFilterPanel,
|
|
3827
|
+
ll as YsAdvancedValueEditor,
|
|
3828
|
+
pl as YsCommandBar,
|
|
3829
|
+
Kl as YsDateFilterItem,
|
|
3830
|
+
ql as YsDateRangeFilterItem,
|
|
3831
|
+
Ul as YsEnumFilterItem,
|
|
3832
|
+
zt as YsFilterItemLayout,
|
|
3833
|
+
fl as YsFilterPanel,
|
|
3834
|
+
Gl as YsImportExcel,
|
|
3835
|
+
Nl as YsInfiniteList,
|
|
3836
|
+
Hl as YsMainPanel,
|
|
3837
|
+
al as YsRootFilterPanel,
|
|
3838
|
+
Ii as YsTable,
|
|
3839
|
+
kr as YsTableActionMenuButton,
|
|
3840
|
+
Sl as YsTablePage,
|
|
3841
|
+
Wl as YsTextFilterItem,
|
|
3842
|
+
eo as fromArray,
|
|
3843
|
+
to as fromBool,
|
|
3844
|
+
no as fromObjectItems,
|
|
3845
|
+
ro as fromOptions,
|
|
3846
|
+
Jl as openDialog,
|
|
3847
|
+
Bl as openModal
|
|
3848
|
+
};
|
|
3849
|
+
//# sourceMappingURL=index.js.map
|