@yeepay/yee-boss-ui 0.1.27 → 0.1.29

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/README.md CHANGED
@@ -397,6 +397,8 @@ Drawer 模式使用 `<YeeModal v-model:open="open" type="drawer" placement="righ
397
397
 
398
398
  查询区默认使用 `layout: 'horizontal'`,标签右对齐;未设置 `labelWidth` 或传入 `labelWidth: 'auto'` 时,标签列按当前标签内容自适应。传入数字时使用固定标签宽度,例如 `labelWidth: 120`;需要上下排列时传入 `layout: 'vertical'`,此时标签左对齐且不使用 `labelWidth`。当字段的 `label` 为空字符串时,标签节点和标签间距都会省略,控件会占满当前字段区域。
399
399
 
400
+ 标签冒号默认遵循 Ant Design Vue `Form` 的默认行为(显示冒号);可通过 `formOptions.colon: false` 关闭,或设为 `true` 显示。
401
+
400
402
  查询字段默认占用 1 列。可以在字段 Schema 上设置 `span` 控制字段(包括标签和值)横跨的网格列数,支持 `1`、`2`、`3`,例如 `span: 2` 表示占用两列:
401
403
 
402
404
  ```ts
@@ -0,0 +1,644 @@
1
+ import { defineComponent as he, reactive as Be, useTemplateRef as U, shallowRef as S, computed as h, onMounted as re, onBeforeUnmount as ye, openBlock as p, createBlock as R, unref as g, mergeProps as ae, withCtx as f, createElementVNode as w, normalizeStyle as be, renderSlot as z, createTextVNode as Y, toDisplayString as K, nextTick as q, useSlots as Fe, inject as me, watch as pe, watchPostEffect as Ie, onUnmounted as He, createElementBlock as I, normalizeClass as ee, withDirectives as $e, withModifiers as Oe, Fragment as fe, renderList as ve, createCommentVNode as _, resolveDynamicComponent as Le, createVNode as P, vShow as De, toHandlers as qe, createSlots as Ge, normalizeProps as te, guardReactiveProps as oe, Teleport as We } from "vue";
2
+ import { SettingOutlined as je } from "@ant-design/icons-vue";
3
+ import { TreeSelect as Ue, TimeRangePicker as Ye, TimePicker as Ke, Textarea as Qe, Switch as Je, Slider as Xe, Select as Ce, Segmented as Ze, Rate as et, RangePicker as tt, RadioGroup as ot, Radio as nt, Mentions as rt, InputPassword as at, InputNumber as it, Input as lt, DatePicker as st, CheckboxGroup as ut, Checkbox as ct, Cascader as dt, AutoComplete as mt, Tooltip as xe, Modal as pt, Form as ft, FormItem as vt, Button as ne } from "ant-design-vue";
4
+ import { ChevronDown as gt } from "lucide-vue-next";
5
+ import we from "vxe-table/es/grid";
6
+ import k from "vxe-table/es/ui";
7
+ import { p as ht } from "./context-DJQ4f46a.js";
8
+ import { Y as yt } from "./YeeFileUpload-BUFoWs8x.js";
9
+ import { p as bt } from "./context-C5gszWl6.js";
10
+ import Ct from "vxe-pc-ui/es/button";
11
+ import xt from "vxe-pc-ui/es/checkbox";
12
+ import wt from "vxe-pc-ui/es/icon";
13
+ import Tt from "vxe-pc-ui/es/input";
14
+ import _t from "vxe-pc-ui/es/loading";
15
+ import St from "vxe-pc-ui/es/modal";
16
+ import kt from "vxe-pc-ui/es/number-input";
17
+ import Nt from "vxe-pc-ui/es/pager";
18
+ import Vt from "vxe-pc-ui/es/radio-group";
19
+ import Pt from "vxe-pc-ui/es/select";
20
+ import Rt from "vxe-table/es/colgroup";
21
+ import zt from "vxe-table/es/column";
22
+ import Et from "vxe-table/es/locale/lang/zh-CN";
23
+ import At from "vxe-table/es/table";
24
+ import Mt from "vxe-table/es/toolbar";
25
+ import { _ as Bt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
26
+ const Ft = {
27
+ AutoComplete: mt,
28
+ Cascader: dt,
29
+ Checkbox: ct,
30
+ CheckboxGroup: ut,
31
+ DatePicker: st,
32
+ Input: lt,
33
+ InputNumber: it,
34
+ InputPassword: at,
35
+ Mentions: rt,
36
+ Radio: nt,
37
+ RadioGroup: ot,
38
+ RangePicker: tt,
39
+ Rate: et,
40
+ Segmented: Ze,
41
+ Select: Ce,
42
+ Slider: Xe,
43
+ Switch: Je,
44
+ Textarea: Qe,
45
+ TimePicker: Ke,
46
+ TimeRangePicker: Ye,
47
+ TreeSelect: Ue,
48
+ Upload: yt
49
+ }, It = {
50
+ Checkbox: "checked",
51
+ Radio: "checked",
52
+ Switch: "checked",
53
+ Upload: "fileList"
54
+ }, Ht = /* @__PURE__ */ he({
55
+ inheritAttrs: !1,
56
+ name: "VxeTooltip",
57
+ __name: "YeeGridTooltip",
58
+ props: {
59
+ content: {},
60
+ enterDelay: {},
61
+ enterable: { type: Boolean },
62
+ height: {},
63
+ isArrow: { type: Boolean, default: !0 },
64
+ leaveDelay: {},
65
+ maxHeight: {},
66
+ maxWidth: {},
67
+ minHeight: {},
68
+ minWidth: {},
69
+ modelValue: { type: Boolean },
70
+ popupClassName: {},
71
+ selector: {},
72
+ theme: {},
73
+ trigger: {},
74
+ useHTML: { type: Boolean },
75
+ width: {},
76
+ zIndex: {}
77
+ },
78
+ emits: ["update:modelValue"],
79
+ setup(l, { expose: a, emit: v }) {
80
+ const n = l, y = v, E = xe, b = Be({ visible: !1 }), A = U("tooltip"), N = S(), G = S(""), H = S(), C = S(!1);
81
+ let i;
82
+ function s(r) {
83
+ if (!(r === void 0 || r === ""))
84
+ return typeof r == "number" ? `${r}px` : r;
85
+ }
86
+ const $ = h(() => {
87
+ const r = N.value;
88
+ return !r || !b.visible ? { display: "none" } : {
89
+ height: `${Math.max(r.height, 1)}px`,
90
+ left: `${r.left}px`,
91
+ pointerEvents: "none",
92
+ position: "fixed",
93
+ top: `${r.top}px`,
94
+ width: `${Math.max(r.width, 1)}px`
95
+ };
96
+ }), W = h(() => ({
97
+ cursor: n.enterable ? "text" : void 0,
98
+ height: s(n.height),
99
+ maxHeight: s(n.maxHeight),
100
+ maxWidth: s(n.maxWidth),
101
+ minHeight: s(n.minHeight),
102
+ minWidth: s(n.minWidth),
103
+ userSelect: n.enterable ? "text" : void 0,
104
+ width: s(n.width)
105
+ })), d = h(() => ({
106
+ ...n.popupClassName ? { overlayClassName: n.popupClassName } : {},
107
+ ...n.zIndex === void 0 ? {} : { zIndex: Number(n.zIndex) }
108
+ }));
109
+ function O(r) {
110
+ return r.closest("body") ?? document.body;
111
+ }
112
+ function Q(r) {
113
+ return r || (typeof n.selector == "string" ? document.querySelector(n.selector) ?? void 0 : n.selector);
114
+ }
115
+ function L() {
116
+ const r = H.value;
117
+ if (!r?.isConnected)
118
+ return T();
119
+ const m = r.getBoundingClientRect();
120
+ return N.value = {
121
+ height: m.height,
122
+ left: m.left,
123
+ top: m.top,
124
+ width: m.width
125
+ }, q(() => A.value?.forcePopupAlign?.());
126
+ }
127
+ function M(r, m) {
128
+ const x = Q(r);
129
+ return x ? (H.value = x, G.value = m ?? n.content ?? "", C.value = !0, b.visible = !0, y("update:modelValue", !0), L()) : q();
130
+ }
131
+ function j(r, m, x) {
132
+ const X = r.currentTarget instanceof HTMLElement ? r.currentTarget : void 0;
133
+ return M(m ?? X, x);
134
+ }
135
+ function T() {
136
+ return C.value = !1, H.value = void 0, N.value = void 0, b.visible = !1, y("update:modelValue", !1), q();
137
+ }
138
+ function B(r) {
139
+ r && i && (clearTimeout(i), i = void 0), C.value = r;
140
+ }
141
+ function D() {
142
+ return C.value;
143
+ }
144
+ function V() {
145
+ b.visible && L();
146
+ }
147
+ function J() {
148
+ B(!1), n.enterable && (i = setTimeout(() => {
149
+ i = void 0, C.value || T();
150
+ }, n.leaveDelay ?? 0));
151
+ }
152
+ return re(() => {
153
+ window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), n.modelValue && M(void 0, n.content);
154
+ }), ye(() => {
155
+ i && clearTimeout(i), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0);
156
+ }), a({
157
+ close: T,
158
+ isActived: D,
159
+ open: M,
160
+ openByEvent: j,
161
+ reactData: b,
162
+ setActived: B,
163
+ toVisible: M,
164
+ updatePlacement: L
165
+ }), (r, m) => (p(), R(g(E), ae({ ref: "tooltip" }, d.value, {
166
+ arrow: n.isArrow !== !1,
167
+ "get-popup-container": O,
168
+ open: b.visible,
169
+ "overlay-inner-style": W.value,
170
+ placement: "top"
171
+ }), {
172
+ title: f(() => [
173
+ w("div", {
174
+ class: "yee-ui-grid-tooltip-content",
175
+ onMouseenter: m[0] || (m[0] = (x) => n.enterable && B(!0)),
176
+ onMouseleave: J
177
+ }, [
178
+ z(r.$slots, "content", {}, () => [
179
+ Y(K(G.value), 1)
180
+ ])
181
+ ], 32)
182
+ ]),
183
+ default: f(() => [
184
+ w("span", {
185
+ "aria-hidden": "true",
186
+ class: "yee-ui-grid-tooltip-anchor",
187
+ style: be($.value)
188
+ }, null, 4)
189
+ ]),
190
+ _: 3
191
+ }, 16, ["arrow", "open", "overlay-inner-style"]));
192
+ }
193
+ });
194
+ let ge = !1;
195
+ const ie = /* @__PURE__ */ new Set();
196
+ function $t() {
197
+ const l = k.modal.confirm.bind(k.modal);
198
+ k.modal.confirm = ((a, v, n) => {
199
+ const y = typeof a == "object" && a !== null ? a : typeof n == "object" && n !== null ? n : void 0;
200
+ if ((typeof y?.className == "string" ? y.className.split(/\s+/) : []).includes("vxe-table--ignore-clear")) {
201
+ const b = [...ie], A = b[b.length - 1];
202
+ if (A) {
203
+ const N = typeof y?.content == "string" ? y.content : String(y?.content ?? a);
204
+ return A(N);
205
+ }
206
+ }
207
+ return l(a, v, n);
208
+ });
209
+ }
210
+ function Ot(l) {
211
+ return ie.add(l), () => ie.delete(l);
212
+ }
213
+ function Lt() {
214
+ if (ge) return;
215
+ k.hasLanguage("zh-CN") || (k.setI18n("zh-CN", Et), k.setLanguage("zh-CN")), [
216
+ At,
217
+ zt,
218
+ Rt,
219
+ we,
220
+ Mt,
221
+ Ct,
222
+ xt,
223
+ wt,
224
+ Tt,
225
+ _t,
226
+ St,
227
+ kt,
228
+ Nt,
229
+ Vt,
230
+ Pt,
231
+ Ht
232
+ ].forEach((a) => k.component(a)), $t(), ge = !0;
233
+ }
234
+ const Dt = {
235
+ key: 0,
236
+ class: "yee-ui-grid__label"
237
+ }, qt = { class: "yee-ui-grid__control" }, Gt = { class: "yee-ui-grid__form-actions" }, Wt = {
238
+ key: 1,
239
+ class: "yee-ui-grid__separator"
240
+ }, jt = { class: "yee-ui-grid__table-container" }, Ut = {
241
+ key: 0,
242
+ class: "yee-ui-grid__title"
243
+ }, Yt = /* @__PURE__ */ he({
244
+ name: "YeeGrid",
245
+ __name: "YeeGrid",
246
+ props: {
247
+ api: {},
248
+ tableTitle: {},
249
+ tableTitleHelp: {}
250
+ },
251
+ setup(l) {
252
+ const a = l, v = Fe(), n = U("gridRef"), y = U("wrapperRef"), E = S(null), b = me(ht), A = me(bt, void 0), [N, G] = pt.useModal();
253
+ Lt();
254
+ const H = Ot((e) => new Promise((t) => {
255
+ N.confirm({
256
+ title: "恢复默认列配置",
257
+ content: e,
258
+ centered: !0,
259
+ okText: "确认",
260
+ cancelText: "取消",
261
+ keyboard: !0,
262
+ wrapClassName: "vxe-table--ignore-clear",
263
+ onOk: () => t("confirm"),
264
+ onCancel: () => t("cancel")
265
+ });
266
+ })), C = h(() => a.api.state.value), i = h(() => C.value.formOptions), s = S(i.value?.collapsed ?? !0), $ = S(3), W = U("formElement"), d = S(/* @__PURE__ */ new Set());
267
+ let O;
268
+ const Q = /* @__PURE__ */ new Set([
269
+ "AutoComplete",
270
+ "Cascader",
271
+ "DatePicker",
272
+ "Input",
273
+ "InputNumber",
274
+ "InputPassword",
275
+ "Mentions",
276
+ "RangePicker",
277
+ "Select",
278
+ "Textarea",
279
+ "TimePicker",
280
+ "TimeRangePicker",
281
+ "TreeSelect"
282
+ ]), L = h(() => !!(a.tableTitle || v["table-title"] || v["toolbar-actions"] || v["toolbar-tools"])), M = h(() => Object.keys(v).filter((e) => ![
283
+ "empty",
284
+ "loading",
285
+ "table-title",
286
+ "toolbar-actions",
287
+ "toolbar-tools"
288
+ ].includes(e) && !e.startsWith("form-"))), j = h(() => A?.value ?? !1), T = h(() => a.api.formApi.schema.value.filter((e) => !e.hide)), B = h(() => {
289
+ if (!i.value?.showCollapseButton || !s.value) return T.value;
290
+ const e = Math.max(1, i.value.collapsedRows ?? 1), t = $.value, o = [];
291
+ let u = 1, c = 0;
292
+ for (const F of T.value) {
293
+ const de = J(F, t);
294
+ if (c > 0 && c + de > t && (u += 1, c = 0), u > e) break;
295
+ o.push(F), c += de, c === t && (u += 1, c = 0);
296
+ }
297
+ return o;
298
+ });
299
+ function D() {
300
+ const e = W.value?.$el;
301
+ if (!e) return;
302
+ const t = getComputedStyle(e).gridTemplateColumns.split(" ").map((o) => o.trim()).filter(Boolean);
303
+ t.length > 0 && ($.value = t.length);
304
+ }
305
+ function V(e) {
306
+ return a.api.formApi.getFieldValue(e.fieldName);
307
+ }
308
+ function J(e, t = $.value) {
309
+ const o = e.span ?? 1;
310
+ return Math.min(o, t);
311
+ }
312
+ function r(e) {
313
+ const t = e.span ?? 1;
314
+ return {
315
+ "yee-ui-grid__field--error": d.value.has(e.fieldName),
316
+ "yee-ui-grid__field--no-label": !e.label,
317
+ "yee-ui-grid__field--required": !!(e.required && e.label),
318
+ "yee-ui-grid__field--span-2": t === 2,
319
+ "yee-ui-grid__field--span-3": t === 3,
320
+ "yee-ui-grid__field--vertical": i.value?.layout === "vertical"
321
+ };
322
+ }
323
+ function m(e) {
324
+ if (i.value?.layout === "vertical" || !e.label) return;
325
+ const t = i.value?.labelWidth ?? "auto";
326
+ return {
327
+ "--yee-grid-label-width": t === "auto" ? "max-content" : `${t}px`
328
+ };
329
+ }
330
+ function x(e) {
331
+ return e !== "Custom";
332
+ }
333
+ function X(e) {
334
+ return x(e.component) ? Ft[e.component] : void 0;
335
+ }
336
+ function Te(e) {
337
+ return x(e.component) ? It[e.component] ?? "value" : "value";
338
+ }
339
+ function _e(e) {
340
+ const t = V(e), o = Te(e), u = d.value.has(e.fieldName);
341
+ return {
342
+ ...e.componentProps,
343
+ ...t === void 0 ? {} : { [o]: t },
344
+ ...u ? { "aria-invalid": !0 } : {},
345
+ ...u && x(e.component) && Q.has(e.component) ? { status: "error" } : {},
346
+ [`onUpdate:${o}`]: (c) => le(e, c)
347
+ };
348
+ }
349
+ function le(e, t) {
350
+ a.api.formApi.setFieldValue(e.fieldName, t), d.value.has(e.fieldName) && a.api.formApi.validateField(e.fieldName) && (d.value = new Set([...d.value].filter((o) => o !== e.fieldName))), i.value?.submitOnChange && Z();
351
+ }
352
+ function Se() {
353
+ const e = /* @__PURE__ */ new Set();
354
+ for (const t of T.value)
355
+ t.required && !a.api.formApi.validateField(t.fieldName) && e.add(t.fieldName);
356
+ return d.value = e, e.size === 0;
357
+ }
358
+ async function ke() {
359
+ a.api.formApi.resetForm(), d.value = /* @__PURE__ */ new Set(), await Ae();
360
+ }
361
+ async function Z() {
362
+ if (!Se()) {
363
+ Ve();
364
+ return;
365
+ }
366
+ await Ee();
367
+ }
368
+ function Ne(e) {
369
+ e.key === "Enter" && i.value?.submitOnEnter && !(e.target instanceof HTMLTextAreaElement) && (e.preventDefault(), Z());
370
+ }
371
+ function se(e) {
372
+ s.value !== e && (s.value = e, i.value?.handleCollapsedChange?.(e));
373
+ }
374
+ function Ve() {
375
+ if (!s.value) return;
376
+ const e = new Set(B.value.map((o) => o.fieldName));
377
+ T.value.some((o) => !e.has(o.fieldName) && d.value.has(o.fieldName)) && se(!1);
378
+ }
379
+ function Pe() {
380
+ se(!s.value);
381
+ }
382
+ function ue(e) {
383
+ return `form-${e.fieldName}`;
384
+ }
385
+ function Re(e) {
386
+ return !!v[ue(e)];
387
+ }
388
+ pe(i, (e) => {
389
+ if (!e) {
390
+ d.value = /* @__PURE__ */ new Set();
391
+ return;
392
+ }
393
+ a.api.formApi.configure(e), s.value = e.collapsed ?? !0, d.value = /* @__PURE__ */ new Set(), q(D);
394
+ }, { immediate: !0 }), re(async () => {
395
+ await q(), D();
396
+ const e = W.value?.$el;
397
+ typeof ResizeObserver < "u" && e && (O = new ResizeObserver(D), O.observe(e));
398
+ }), ye(() => {
399
+ O?.disconnect();
400
+ });
401
+ const ce = h(() => {
402
+ const e = C.value.gridOptions, t = e.proxyConfig, o = t?.ajax?.query, u = e.toolbarConfig, c = e.pagerConfig;
403
+ return {
404
+ align: "left",
405
+ border: "inner",
406
+ minHeight: 180,
407
+ showHeaderOverflow: "tooltip",
408
+ showOverflow: "tooltip",
409
+ size: "medium",
410
+ ...j.value ? { height: "auto" } : {},
411
+ ...e,
412
+ columnConfig: {
413
+ resizable: !0,
414
+ ...e.columnConfig
415
+ },
416
+ tooltipConfig: {
417
+ enterable: !0,
418
+ leaveDelay: 300,
419
+ ...e.tooltipConfig
420
+ },
421
+ ...c ? {
422
+ pagerConfig: {
423
+ pageSize: 20,
424
+ pageSizes: [10, 20, 30, 50, 100, 200],
425
+ layouts: ["Total", "Sizes", "Home", "PrevPage", "Number", "NextPage", "End"],
426
+ ...c,
427
+ slots: {
428
+ sizes: "pagerSizes",
429
+ ...c.slots
430
+ }
431
+ }
432
+ } : {},
433
+ ...t ? {
434
+ proxyConfig: {
435
+ autoLoad: !0,
436
+ showResponseMsg: !1,
437
+ ...t,
438
+ response: {
439
+ list: "items",
440
+ result: "items",
441
+ total: "total",
442
+ ...t.response
443
+ },
444
+ ...t.ajax ? {
445
+ ajax: {
446
+ ...t.ajax,
447
+ ...o ? {
448
+ query: (F) => o(F, a.api.formApi.getValues())
449
+ } : {}
450
+ }
451
+ } : {}
452
+ }
453
+ } : {},
454
+ ...u || L.value ? {
455
+ toolbarConfig: {
456
+ custom: !0,
457
+ refresh: !0,
458
+ zoom: !0,
459
+ ...u,
460
+ slots: {
461
+ ...a.tableTitle || v["table-title"] || v["toolbar-actions"] ? { buttons: "toolbarActions" } : {},
462
+ ...v["toolbar-tools"] ? { tools: "toolbarTools" } : {}
463
+ }
464
+ }
465
+ } : {}
466
+ };
467
+ }), ze = h(() => C.value.gridEvents ?? {});
468
+ Ie(() => {
469
+ const e = ce.value.toolbarConfig;
470
+ E.value = e?.custom && e.enabled !== !1 ? y.value?.querySelector(
471
+ ".vxe-toolbar-custom-target .vxe-button--prefix-icon"
472
+ ) ?? null : null;
473
+ }), pe(
474
+ () => b?.value.mode ?? "light",
475
+ (e) => k.setTheme(e),
476
+ { immediate: !0 }
477
+ );
478
+ async function Ee() {
479
+ await a.api.reload();
480
+ }
481
+ async function Ae() {
482
+ await a.api.reload();
483
+ }
484
+ function Me(e, t) {
485
+ typeof t != "number" && typeof t != "string" || e.setPageSizeByEvent(new Event("change"), t);
486
+ }
487
+ return re(() => {
488
+ n.value && a.api.mount(n.value);
489
+ }), He(() => {
490
+ H(), a.api.unmount();
491
+ }), (e, t) => (p(), I("section", {
492
+ ref_key: "wrapperRef",
493
+ ref: y,
494
+ class: ee(["yee-ui-grid", { "yee-ui-grid--fill-page-content": j.value }])
495
+ }, [
496
+ i.value ? $e((p(), R(g(ft), {
497
+ key: 0,
498
+ ref: "formElement",
499
+ class: "yee-ui-grid__search-form",
500
+ colon: i.value.colon ?? !0,
501
+ layout: i.value.layout ?? "horizontal",
502
+ model: l.api.formApi.getModel(),
503
+ onKeydown: Ne,
504
+ onSubmit: Oe(Z, ["prevent"])
505
+ }, {
506
+ default: f(() => [
507
+ (p(!0), I(fe, null, ve(B.value, (o) => (p(), R(g(vt), {
508
+ key: o.fieldName,
509
+ "no-style": "",
510
+ name: o.fieldName,
511
+ required: !!o.required,
512
+ "validate-status": d.value.has(o.fieldName) ? "error" : ""
513
+ }, {
514
+ default: f(() => [
515
+ w("label", {
516
+ class: ee(["yee-ui-grid__field", r(o)]),
517
+ style: be(m(o))
518
+ }, [
519
+ o.label ? (p(), I("span", Dt, K(o.label), 1)) : _("", !0),
520
+ w("div", qt, [
521
+ Re(o) ? z(e.$slots, ue(o), {
522
+ key: 0,
523
+ field: o,
524
+ setValue: (u) => le(o, u),
525
+ value: V(o),
526
+ values: l.api.formApi.getValues()
527
+ }, void 0, !0) : (p(), I(fe, { key: 1 }, [
528
+ o.component !== "Custom" ? (p(), R(Le(X(o)), ae({
529
+ key: 0,
530
+ ref_for: !0
531
+ }, _e(o)), null, 16)) : _("", !0)
532
+ ], 64))
533
+ ])
534
+ ], 6)
535
+ ]),
536
+ _: 2
537
+ }, 1032, ["name", "required", "validate-status"]))), 128)),
538
+ w("div", Gt, [
539
+ P(g(ne), {
540
+ "html-type": "button",
541
+ onClick: ke
542
+ }, {
543
+ default: f(() => [...t[0] || (t[0] = [
544
+ Y(" 重置 ", -1)
545
+ ])]),
546
+ _: 1
547
+ }),
548
+ P(g(ne), {
549
+ type: "primary",
550
+ "html-type": "submit"
551
+ }, {
552
+ default: f(() => [...t[1] || (t[1] = [
553
+ Y(" 查询 ", -1)
554
+ ])]),
555
+ _: 1
556
+ }),
557
+ i.value.showCollapseButton ? (p(), R(g(ne), {
558
+ key: 0,
559
+ class: "yee-ui-grid__collapse-button",
560
+ type: "link",
561
+ "html-type": "button",
562
+ onClick: Pe
563
+ }, {
564
+ default: f(() => [
565
+ w("span", null, K(s.value ? "展开" : "收起"), 1),
566
+ P(g(gt), {
567
+ "aria-hidden": "true",
568
+ class: ee(["yee-ui-grid__collapse-icon", { "yee-ui-grid__collapse-icon--expanded": !s.value }])
569
+ }, null, 8, ["class"])
570
+ ]),
571
+ _: 1
572
+ })) : _("", !0)
573
+ ])
574
+ ]),
575
+ _: 3
576
+ }, 8, ["colon", "layout", "model"])), [
577
+ [De, l.api.searchFormVisible.value]
578
+ ]) : _("", !0),
579
+ i.value && C.value.separator !== !1 ? (p(), I("div", Wt)) : _("", !0),
580
+ w("div", jt, [
581
+ P(g(we), ae({
582
+ ref_key: "gridRef",
583
+ ref: n,
584
+ class: "yee-ui-grid__table"
585
+ }, ce.value, qe(ze.value)), Ge({
586
+ toolbarActions: f((o) => [
587
+ z(e.$slots, "table-title", {}, () => [
588
+ l.tableTitle ? (p(), I("div", Ut, [
589
+ Y(K(l.tableTitle) + " ", 1),
590
+ l.tableTitleHelp ? (p(), R(g(xe), {
591
+ key: 0,
592
+ title: l.tableTitleHelp
593
+ }, {
594
+ default: f(() => [...t[2] || (t[2] = [
595
+ w("span", {
596
+ class: "yee-ui-grid__help",
597
+ tabindex: "0"
598
+ }, "?", -1)
599
+ ])]),
600
+ _: 1
601
+ }, 8, ["title"])) : _("", !0)
602
+ ])) : _("", !0)
603
+ ], !0),
604
+ z(e.$slots, "toolbar-actions", te(oe(o)), void 0, !0)
605
+ ]),
606
+ toolbarTools: f((o) => [
607
+ z(e.$slots, "toolbar-tools", te(oe(o)), void 0, !0)
608
+ ]),
609
+ pagerSizes: f(({ $pager: o, options: u, pageSize: c }) => [
610
+ P(g(Ce), {
611
+ class: "yee-ui-grid__page-size",
612
+ options: u,
613
+ value: c,
614
+ onChange: (F) => Me(o, F)
615
+ }, null, 8, ["options", "value", "onChange"])
616
+ ]),
617
+ empty: f(() => [
618
+ z(e.$slots, "empty", {}, () => [
619
+ t[3] || (t[3] = w("div", { class: "yee-ui-grid__empty" }, "暂无数据", -1))
620
+ ], !0)
621
+ ]),
622
+ _: 2
623
+ }, [
624
+ ve(M.value, (o) => ({
625
+ name: o,
626
+ fn: f((u) => [
627
+ z(e.$slots, o, te(oe(u)), void 0, !0)
628
+ ])
629
+ }))
630
+ ]), 1040)
631
+ ]),
632
+ E.value ? (p(), R(We, {
633
+ key: 2,
634
+ to: E.value
635
+ }, [
636
+ P(g(je))
637
+ ], 8, ["to"])) : _("", !0),
638
+ P(g(G))
639
+ ], 2));
640
+ }
641
+ }), xo = /* @__PURE__ */ Bt(Yt, [["__scopeId", "data-v-ac73277b"]]);
642
+ export {
643
+ xo as default
644
+ };
@@ -109,6 +109,8 @@ export interface YeeGridFormOptions<TValues extends object = YeeGridFormValues>
109
109
  handleCollapsedChange?: (collapsed: boolean) => void;
110
110
  /** 表单初始值。 */
111
111
  initialValues?: Partial<TValues>;
112
+ /** 是否在查询表单标签后显示冒号;默认遵循 Ant Design Vue Form 的默认值。 */
113
+ colon?: boolean;
112
114
  /** 表单项布局;horizontal 为标签和值同行,vertical 为上下排列。 */
113
115
  layout?: 'horizontal' | 'vertical';
114
116
  /** 水平布局时标签的宽度;未设置或传入 auto 时按标签内容自适应。 */
package/dist/grid.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Y as i, a, u as s } from "./use-yee-grid-DA5Rk7Bo.js";
1
+ import { Y as i, a, u as s } from "./use-yee-grid-TEuO4cKf.js";
2
2
  export {
3
3
  i as YeeGridApi,
4
4
  a as YeeGridFormApi,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { Y as f } from "./YeePage-Duxhrl0F.js";
9
9
  import { Y as l } from "./YeeFileUpload-BUFoWs8x.js";
10
10
  import { Y as n } from "./YeeEllipsisText-BTSbIuBl.js";
11
11
  import { Y as T } from "./YeeDescriptions-DyYySPuw.js";
12
- import { Y as M, a as N, u as R } from "./use-yee-grid-DA5Rk7Bo.js";
12
+ import { Y as M, a as N, u as R } from "./use-yee-grid-TEuO4cKf.js";
13
13
  const d = {
14
14
  PlatformConfigProvider: r,
15
15
  YeeAppShell: Y,
package/dist/style.css CHANGED
@@ -135,7 +135,7 @@ html.dark,
135
135
  /*$vite$:1*/
136
136
  .yee-ui-file-upload[data-v-ac555a97],.yee-ui-file-upload[data-v-ac555a97] .ant-upload-wrapper,.yee-ui-file-upload[data-v-ac555a97] .yee-upload-wrapper{min-width:0}.yee-ui-file-upload[data-v-ac555a97] .ant-upload-select,.yee-ui-file-upload[data-v-ac555a97] .yee-upload-select{width:auto;height:auto;margin-inline-end:0}.yee-ui-file-upload[data-v-ac555a97] .ant-upload-list-item-action,.yee-ui-file-upload[data-v-ac555a97] .yee-upload-list-item-action{background:transparent!important}.yee-ui-file-upload__trigger[data-v-ac555a97]{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:center;box-sizing:border-box;color:var(--yee-muted-foreground);font-size:var(--yee-font-size-sm)}.yee-ui-file-upload__trigger-sign[data-v-ac555a97]{color:var(--yee-foreground);font-size:24px;line-height:1}.yee-ui-file-upload__empty[data-v-ac555a97]{color:var(--yee-muted-foreground);font-size:var(--yee-font-size)}.yee-ui-file-upload__preview[data-v-ac555a97]{display:none}
137
137
  /*$vite$:1*/
138
- .yee-ui-grid[data-v-94e4a5a9]{display:flex;flex-direction:column;min-width:0;height:100%;min-height:0;box-sizing:border-box;overflow:hidden;color:var(--yee-foreground);background:var(--yee-card);border-radius:var(--yee-radius)}.yee-ui-grid--fill-page-content[data-v-94e4a5a9]{height:100%}.yee-ui-grid__search-form[data-v-94e4a5a9]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 24px;align-items:center;padding:16px;background:var(--yee-card)}.yee-ui-grid__field[data-v-94e4a5a9]{display:grid;grid-template-columns:var(--yee-grid-label-width, max-content) minmax(0,1fr);gap:8px;align-items:center;min-width:0}.yee-ui-grid__field--span-2[data-v-94e4a5a9]{grid-column:span 2}.yee-ui-grid__field--span-3[data-v-94e4a5a9]{grid-column:span 3}.yee-ui-grid__field--vertical[data-v-94e4a5a9]{grid-template-columns:minmax(0,1fr);gap:4px;align-items:stretch}.yee-ui-grid__field--no-label[data-v-94e4a5a9]{grid-template-columns:minmax(0,1fr);gap:0}.yee-ui-grid__control[data-v-94e4a5a9]{display:flex;flex-direction:column;min-width:0}.yee-ui-grid__label[data-v-94e4a5a9]{color:var(--yee-foreground);font-size:var(--yee-font-size);text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yee-ui-grid__field--vertical .yee-ui-grid__label[data-v-94e4a5a9]{justify-self:start;text-align:left}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-checkbox-wrapper,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-radio-wrapper,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-rate{color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-checkbox-wrapper .ant-checkbox-inner,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-radio-wrapper .ant-radio-inner{border-color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-switch{background:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-segmented,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-upload-select-picture-card{border-color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-slider .ant-slider-track,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-94e4a5a9]>.ant-slider .ant-slider-handle{background:var(--yee-destructive);border-color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__label[data-v-94e4a5a9]:before,.yee-ui-grid__field--required .yee-ui-grid__label[data-v-94e4a5a9]:before{margin-right:2px;color:var(--yee-destructive);content:"*"}.yee-ui-grid__form-actions[data-v-94e4a5a9]{display:flex;gap:8px;align-items:center;grid-column:-2 / -1;justify-content:flex-end}.yee-ui-grid__collapse-button[data-v-94e4a5a9]{display:inline-flex;gap:2px;align-items:center;padding-left:0;padding-right:0}.yee-ui-grid__collapse-icon[data-v-94e4a5a9]{flex:0 0 auto;width:16px;height:16px;transition:transform .3s ease}.yee-ui-grid__collapse-icon--expanded[data-v-94e4a5a9]{transform:rotate(180deg)}.yee-ui-grid__separator[data-v-94e4a5a9]{flex:0 0 12px;background:var(--yee-background-deep)}.yee-ui-grid__table-container[data-v-94e4a5a9]{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden}.yee-ui-grid__table[data-v-94e4a5a9]{min-height:0;box-sizing:border-box;padding:16px}.yee-ui-grid__title[data-v-94e4a5a9]{display:inline-flex;gap:6px;align-items:center;margin-right:12px;font-size:var(--yee-font-size-lg);font-weight:600}.yee-ui-grid__help[data-v-94e4a5a9]{display:inline-grid;width:16px;height:16px;color:var(--yee-muted-foreground);font-size:11px;border:1px solid var(--yee-border);border-radius:50%;place-items:center}.yee-ui-grid__empty[data-v-94e4a5a9]{padding:32px 0;color:var(--yee-muted-foreground);text-align:center}@media not (min-width:1024px){.yee-ui-grid__search-form[data-v-94e4a5a9]{grid-template-columns:repeat(2,minmax(0,1fr))}.yee-ui-grid__field--span-3[data-v-94e4a5a9]{grid-column:span 2}}@media not (min-width:768px){.yee-ui-grid__search-form[data-v-94e4a5a9]{grid-template-columns:minmax(0,1fr)}.yee-ui-grid__field--span-2[data-v-94e4a5a9],.yee-ui-grid__field--span-3[data-v-94e4a5a9]{grid-column:span 1}}
138
+ [data-v-ac73277b] .vxe-toolbar-custom-target .vxe-button--prefix-icon:has(>.anticon-setting):before{content:none}.yee-ui-grid[data-v-ac73277b]{display:flex;flex-direction:column;min-width:0;height:100%;min-height:0;box-sizing:border-box;overflow:hidden;color:var(--yee-foreground);background:var(--yee-card);border-radius:var(--yee-radius)}.yee-ui-grid--fill-page-content[data-v-ac73277b]{height:100%}.yee-ui-grid__search-form[data-v-ac73277b]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 24px;align-items:center;padding:16px;background:var(--yee-card)}.yee-ui-grid__field[data-v-ac73277b]{display:grid;grid-template-columns:var(--yee-grid-label-width, max-content) minmax(0,1fr);gap:8px;align-items:center;min-width:0}.yee-ui-grid__field--span-2[data-v-ac73277b]{grid-column:span 2}.yee-ui-grid__field--span-3[data-v-ac73277b]{grid-column:span 3}.yee-ui-grid__field--vertical[data-v-ac73277b]{grid-template-columns:minmax(0,1fr);gap:4px;align-items:stretch}.yee-ui-grid__field--no-label[data-v-ac73277b]{grid-template-columns:minmax(0,1fr);gap:0}.yee-ui-grid__control[data-v-ac73277b]{display:flex;flex-direction:column;min-width:0}.yee-ui-grid__label[data-v-ac73277b]{color:var(--yee-foreground);font-size:var(--yee-font-size);text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yee-ui-grid__field--vertical .yee-ui-grid__label[data-v-ac73277b]{justify-self:start;text-align:left}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-checkbox-wrapper,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-radio-wrapper,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-rate{color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-checkbox-wrapper .ant-checkbox-inner,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-radio-wrapper .ant-radio-inner{border-color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-switch{background:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-segmented,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-upload-select-picture-card{border-color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-slider .ant-slider-track,.yee-ui-grid__field--error .yee-ui-grid__control[data-v-ac73277b]>.ant-slider .ant-slider-handle{background:var(--yee-destructive);border-color:var(--yee-destructive)}.yee-ui-grid__field--error .yee-ui-grid__label[data-v-ac73277b]:before,.yee-ui-grid__field--required .yee-ui-grid__label[data-v-ac73277b]:before{margin-right:2px;color:var(--yee-destructive);content:"*"}.yee-ui-grid__form-actions[data-v-ac73277b]{display:flex;gap:8px;align-items:center;grid-column:-2 / -1;justify-content:flex-end}.yee-ui-grid__collapse-button[data-v-ac73277b]{display:inline-flex;gap:2px;align-items:center;padding-left:0;padding-right:0}.yee-ui-grid__collapse-icon[data-v-ac73277b]{flex:0 0 auto;width:16px;height:16px;transition:transform .3s ease}.yee-ui-grid__collapse-icon--expanded[data-v-ac73277b]{transform:rotate(180deg)}.yee-ui-grid__separator[data-v-ac73277b]{flex:0 0 12px;background:var(--yee-background-deep)}.yee-ui-grid__table-container[data-v-ac73277b]{flex:1 1 auto;min-width:0;min-height:0;overflow:hidden}.yee-ui-grid__table[data-v-ac73277b]{min-height:0;box-sizing:border-box;padding:16px}.yee-ui-grid__title[data-v-ac73277b]{display:inline-flex;gap:6px;align-items:center;margin-right:12px;font-size:var(--yee-font-size-lg);font-weight:600}.yee-ui-grid__help[data-v-ac73277b]{display:inline-grid;width:16px;height:16px;color:var(--yee-muted-foreground);font-size:11px;border:1px solid var(--yee-border);border-radius:50%;place-items:center}.yee-ui-grid__empty[data-v-ac73277b]{padding:32px 0;color:var(--yee-muted-foreground);text-align:center}@media not (min-width:1024px){.yee-ui-grid__search-form[data-v-ac73277b]{grid-template-columns:repeat(2,minmax(0,1fr))}.yee-ui-grid__field--span-3[data-v-ac73277b]{grid-column:span 2}}@media not (min-width:768px){.yee-ui-grid__search-form[data-v-ac73277b]{grid-template-columns:minmax(0,1fr)}.yee-ui-grid__field--span-2[data-v-ac73277b],.yee-ui-grid__field--span-3[data-v-ac73277b]{grid-column:span 1}}
139
139
  /*$vite$:1*/
140
140
  .yee-ui-page[data-v-ba7ea0ff]{display:flex;flex-direction:column;min-width:0;min-height:100%;box-sizing:border-box;color:var(--yee-foreground);background:var(--yee-background-deep)}.yee-ui-page--auto-height[data-v-ba7ea0ff]{height:calc(var(--yee-content-height, 100%) - var(--yee-page-height-offset));min-height:0;overflow:hidden}.yee-ui-page__header[data-v-ba7ea0ff],.yee-ui-page__footer[data-v-ba7ea0ff]{display:flex;flex:0 0 auto;gap:16px;align-items:center;box-sizing:border-box;padding:16px 24px;background:var(--yee-card)}.yee-ui-page__header[data-v-ba7ea0ff]{justify-content:space-between;border-bottom:1px solid var(--yee-border-secondary)}.yee-ui-page__footer[data-v-ba7ea0ff]{justify-content:flex-end;border-top:1px solid var(--yee-border-secondary)}.yee-ui-page__heading[data-v-ba7ea0ff]{min-width:0}.yee-ui-page__title[data-v-ba7ea0ff],.yee-ui-page__description[data-v-ba7ea0ff]{margin:0}.yee-ui-page__title[data-v-ba7ea0ff]{font-size:var(--yee-font-size-lg);font-weight:600;line-height:1.5}.yee-ui-page__description[data-v-ba7ea0ff]{margin-top:4px;color:var(--yee-muted-foreground);font-size:var(--yee-font-size);line-height:var(--yee-line-height)}.yee-ui-page__extra[data-v-ba7ea0ff]{flex:0 0 auto}.yee-ui-page__content[data-v-ba7ea0ff]{flex:1 1 auto;min-width:0;min-height:0;box-sizing:border-box}.yee-ui-page--auto-height>.yee-ui-page__content[data-v-ba7ea0ff]{flex:0 0 auto}
141
141
  /*$vite$:1*/
@@ -124,7 +124,7 @@ function g() {
124
124
  r = !0, import("@yeepay/yee-boss-ui/grid.css");
125
125
  }
126
126
  }
127
- const y = m(() => import("./YeeGrid-VyTwTuPz.js"));
127
+ const y = m(() => import("./YeeGrid-Cb_c68bm.js"));
128
128
  function b(i) {
129
129
  g();
130
130
  const e = new p(i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeepay/yee-boss-ui",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "运营后台平台公共 UI 与主题基础能力",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,629 +0,0 @@
1
- import { defineComponent as ge, reactive as Ae, useTemplateRef as ne, shallowRef as R, computed as g, onMounted as re, onBeforeUnmount as he, openBlock as v, createBlock as $, unref as b, mergeProps as ae, withCtx as p, createElementVNode as T, normalizeStyle as ye, renderSlot as z, createTextVNode as G, toDisplayString as W, nextTick as L, useSlots as Me, inject as de, watch as me, onUnmounted as Be, createElementBlock as H, normalizeClass as Z, withDirectives as Fe, withModifiers as He, Fragment as pe, renderList as fe, createCommentVNode as P, resolveDynamicComponent as Ie, createVNode as I, vShow as $e, toHandlers as Oe, createSlots as Le, normalizeProps as ee, guardReactiveProps as te } from "vue";
2
- import { TreeSelect as De, TimeRangePicker as qe, TimePicker as Ge, Textarea as We, Switch as je, Slider as Ue, Select as be, Segmented as Ye, Rate as Ke, RangePicker as Qe, RadioGroup as Je, Radio as Xe, Mentions as Ze, InputPassword as et, InputNumber as tt, Input as ot, DatePicker as nt, CheckboxGroup as rt, Checkbox as at, Cascader as it, AutoComplete as lt, Tooltip as Ce, Modal as st, Form as ut, FormItem as ct, Button as oe } from "ant-design-vue";
3
- import { ChevronDown as dt } from "lucide-vue-next";
4
- import xe from "vxe-table/es/grid";
5
- import _ from "vxe-table/es/ui";
6
- import { p as mt } from "./context-DJQ4f46a.js";
7
- import { Y as pt } from "./YeeFileUpload-BUFoWs8x.js";
8
- import { p as ft } from "./context-C5gszWl6.js";
9
- import vt from "vxe-pc-ui/es/button";
10
- import gt from "vxe-pc-ui/es/checkbox";
11
- import ht from "vxe-pc-ui/es/icon";
12
- import yt from "vxe-pc-ui/es/input";
13
- import bt from "vxe-pc-ui/es/loading";
14
- import Ct from "vxe-pc-ui/es/modal";
15
- import xt from "vxe-pc-ui/es/number-input";
16
- import wt from "vxe-pc-ui/es/pager";
17
- import Tt from "vxe-pc-ui/es/radio-group";
18
- import _t from "vxe-pc-ui/es/select";
19
- import St from "vxe-table/es/colgroup";
20
- import kt from "vxe-table/es/column";
21
- import Nt from "vxe-table/es/locale/lang/zh-CN";
22
- import Vt from "vxe-table/es/table";
23
- import Pt from "vxe-table/es/toolbar";
24
- import { _ as zt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
25
- const Rt = {
26
- AutoComplete: lt,
27
- Cascader: it,
28
- Checkbox: at,
29
- CheckboxGroup: rt,
30
- DatePicker: nt,
31
- Input: ot,
32
- InputNumber: tt,
33
- InputPassword: et,
34
- Mentions: Ze,
35
- Radio: Xe,
36
- RadioGroup: Je,
37
- RangePicker: Qe,
38
- Rate: Ke,
39
- Segmented: Ye,
40
- Select: be,
41
- Slider: Ue,
42
- Switch: je,
43
- Textarea: We,
44
- TimePicker: Ge,
45
- TimeRangePicker: qe,
46
- TreeSelect: De,
47
- Upload: pt
48
- }, Et = {
49
- Checkbox: "checked",
50
- Radio: "checked",
51
- Switch: "checked",
52
- Upload: "fileList"
53
- }, At = /* @__PURE__ */ ge({
54
- inheritAttrs: !1,
55
- name: "VxeTooltip",
56
- __name: "YeeGridTooltip",
57
- props: {
58
- content: {},
59
- enterDelay: {},
60
- enterable: { type: Boolean },
61
- height: {},
62
- isArrow: { type: Boolean, default: !0 },
63
- leaveDelay: {},
64
- maxHeight: {},
65
- maxWidth: {},
66
- minHeight: {},
67
- minWidth: {},
68
- modelValue: { type: Boolean },
69
- popupClassName: {},
70
- selector: {},
71
- theme: {},
72
- trigger: {},
73
- useHTML: { type: Boolean },
74
- width: {},
75
- zIndex: {}
76
- },
77
- emits: ["update:modelValue"],
78
- setup(l, { expose: a, emit: f }) {
79
- const r = l, C = f, D = Ce, h = Ae({ visible: !1 }), E = ne("tooltip"), S = R(), k = R(""), i = R(), u = R(!1);
80
- let y;
81
- function x(n) {
82
- if (!(n === void 0 || n === ""))
83
- return typeof n == "number" ? `${n}px` : n;
84
- }
85
- const d = g(() => {
86
- const n = S.value;
87
- return !n || !h.visible ? { display: "none" } : {
88
- height: `${Math.max(n.height, 1)}px`,
89
- left: `${n.left}px`,
90
- pointerEvents: "none",
91
- position: "fixed",
92
- top: `${n.top}px`,
93
- width: `${Math.max(n.width, 1)}px`
94
- };
95
- }), O = g(() => ({
96
- cursor: r.enterable ? "text" : void 0,
97
- height: x(r.height),
98
- maxHeight: x(r.maxHeight),
99
- maxWidth: x(r.maxWidth),
100
- minHeight: x(r.minHeight),
101
- minWidth: x(r.minWidth),
102
- userSelect: r.enterable ? "text" : void 0,
103
- width: x(r.width)
104
- })), j = g(() => ({
105
- ...r.popupClassName ? { overlayClassName: r.popupClassName } : {},
106
- ...r.zIndex === void 0 ? {} : { zIndex: Number(r.zIndex) }
107
- }));
108
- function U(n) {
109
- return n.closest("body") ?? document.body;
110
- }
111
- function Y(n) {
112
- return n || (typeof r.selector == "string" ? document.querySelector(r.selector) ?? void 0 : r.selector);
113
- }
114
- function A() {
115
- const n = i.value;
116
- if (!n?.isConnected)
117
- return N();
118
- const m = n.getBoundingClientRect();
119
- return S.value = {
120
- height: m.height,
121
- left: m.left,
122
- top: m.top,
123
- width: m.width
124
- }, L(() => E.value?.forcePopupAlign?.());
125
- }
126
- function w(n, m) {
127
- const V = Y(n);
128
- return V ? (i.value = V, k.value = m ?? r.content ?? "", u.value = !0, h.visible = !0, C("update:modelValue", !0), A()) : L();
129
- }
130
- function q(n, m, V) {
131
- const J = n.currentTarget instanceof HTMLElement ? n.currentTarget : void 0;
132
- return w(m ?? J, V);
133
- }
134
- function N() {
135
- return u.value = !1, i.value = void 0, S.value = void 0, h.visible = !1, C("update:modelValue", !1), L();
136
- }
137
- function M(n) {
138
- n && y && (clearTimeout(y), y = void 0), u.value = n;
139
- }
140
- function K() {
141
- return u.value;
142
- }
143
- function B() {
144
- h.visible && A();
145
- }
146
- function Q() {
147
- M(!1), r.enterable && (y = setTimeout(() => {
148
- y = void 0, u.value || N();
149
- }, r.leaveDelay ?? 0));
150
- }
151
- return re(() => {
152
- window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), r.modelValue && w(void 0, r.content);
153
- }), he(() => {
154
- y && clearTimeout(y), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0);
155
- }), a({
156
- close: N,
157
- isActived: K,
158
- open: w,
159
- openByEvent: q,
160
- reactData: h,
161
- setActived: M,
162
- toVisible: w,
163
- updatePlacement: A
164
- }), (n, m) => (v(), $(b(D), ae({ ref: "tooltip" }, j.value, {
165
- arrow: r.isArrow !== !1,
166
- "get-popup-container": U,
167
- open: h.visible,
168
- "overlay-inner-style": O.value,
169
- placement: "top"
170
- }), {
171
- title: p(() => [
172
- T("div", {
173
- class: "yee-ui-grid-tooltip-content",
174
- onMouseenter: m[0] || (m[0] = (V) => r.enterable && M(!0)),
175
- onMouseleave: Q
176
- }, [
177
- z(n.$slots, "content", {}, () => [
178
- G(W(k.value), 1)
179
- ])
180
- ], 32)
181
- ]),
182
- default: p(() => [
183
- T("span", {
184
- "aria-hidden": "true",
185
- class: "yee-ui-grid-tooltip-anchor",
186
- style: ye(d.value)
187
- }, null, 4)
188
- ]),
189
- _: 3
190
- }, 16, ["arrow", "open", "overlay-inner-style"]));
191
- }
192
- });
193
- let ve = !1;
194
- const ie = /* @__PURE__ */ new Set();
195
- function Mt() {
196
- const l = _.modal.confirm.bind(_.modal);
197
- _.modal.confirm = ((a, f, r) => {
198
- const C = typeof a == "object" && a !== null ? a : typeof r == "object" && r !== null ? r : void 0;
199
- if ((typeof C?.className == "string" ? C.className.split(/\s+/) : []).includes("vxe-table--ignore-clear")) {
200
- const h = [...ie], E = h[h.length - 1];
201
- if (E) {
202
- const S = typeof C?.content == "string" ? C.content : String(C?.content ?? a);
203
- return E(S);
204
- }
205
- }
206
- return l(a, f, r);
207
- });
208
- }
209
- function Bt(l) {
210
- return ie.add(l), () => ie.delete(l);
211
- }
212
- function Ft() {
213
- if (ve) return;
214
- _.hasLanguage("zh-CN") || (_.setI18n("zh-CN", Nt), _.setLanguage("zh-CN")), [
215
- Vt,
216
- kt,
217
- St,
218
- xe,
219
- Pt,
220
- vt,
221
- gt,
222
- ht,
223
- yt,
224
- bt,
225
- Ct,
226
- xt,
227
- wt,
228
- Tt,
229
- _t,
230
- At
231
- ].forEach((a) => _.component(a)), Mt(), ve = !0;
232
- }
233
- const Ht = {
234
- key: 0,
235
- class: "yee-ui-grid__label"
236
- }, It = { class: "yee-ui-grid__control" }, $t = { class: "yee-ui-grid__form-actions" }, Ot = {
237
- key: 1,
238
- class: "yee-ui-grid__separator"
239
- }, Lt = { class: "yee-ui-grid__table-container" }, Dt = {
240
- key: 0,
241
- class: "yee-ui-grid__title"
242
- }, qt = /* @__PURE__ */ ge({
243
- name: "YeeGrid",
244
- __name: "YeeGrid",
245
- props: {
246
- api: {},
247
- tableTitle: {},
248
- tableTitleHelp: {}
249
- },
250
- setup(l) {
251
- const a = l, f = Me(), r = ne("gridRef"), C = de(mt), D = de(ft, void 0), [h, E] = st.useModal();
252
- Ft();
253
- const S = Bt((e) => new Promise((t) => {
254
- h.confirm({
255
- title: "恢复默认列配置",
256
- content: e,
257
- centered: !0,
258
- okText: "确认",
259
- cancelText: "取消",
260
- keyboard: !0,
261
- wrapClassName: "vxe-table--ignore-clear",
262
- onOk: () => t("confirm"),
263
- onCancel: () => t("cancel")
264
- });
265
- })), k = g(() => a.api.state.value), i = g(() => k.value.formOptions), u = R(i.value?.collapsed ?? !0), y = R(3), x = ne("formElement"), d = R(/* @__PURE__ */ new Set());
266
- let O;
267
- const j = /* @__PURE__ */ new Set([
268
- "AutoComplete",
269
- "Cascader",
270
- "DatePicker",
271
- "Input",
272
- "InputNumber",
273
- "InputPassword",
274
- "Mentions",
275
- "RangePicker",
276
- "Select",
277
- "Textarea",
278
- "TimePicker",
279
- "TimeRangePicker",
280
- "TreeSelect"
281
- ]), U = g(() => !!(a.tableTitle || f["table-title"] || f["toolbar-actions"] || f["toolbar-tools"])), Y = g(() => Object.keys(f).filter((e) => ![
282
- "empty",
283
- "loading",
284
- "table-title",
285
- "toolbar-actions",
286
- "toolbar-tools"
287
- ].includes(e) && !e.startsWith("form-"))), A = g(() => D?.value ?? !1), w = g(() => a.api.formApi.schema.value.filter((e) => !e.hide)), q = g(() => {
288
- if (!i.value?.showCollapseButton || !u.value) return w.value;
289
- const e = Math.max(1, i.value.collapsedRows ?? 1), t = y.value, o = [];
290
- let s = 1, c = 0;
291
- for (const F of w.value) {
292
- const ce = K(F, t);
293
- if (c > 0 && c + ce > t && (s += 1, c = 0), s > e) break;
294
- o.push(F), c += ce, c === t && (s += 1, c = 0);
295
- }
296
- return o;
297
- });
298
- function N() {
299
- const e = x.value?.$el;
300
- if (!e) return;
301
- const t = getComputedStyle(e).gridTemplateColumns.split(" ").map((o) => o.trim()).filter(Boolean);
302
- t.length > 0 && (y.value = t.length);
303
- }
304
- function M(e) {
305
- return a.api.formApi.getFieldValue(e.fieldName);
306
- }
307
- function K(e, t = y.value) {
308
- const o = e.span ?? 1;
309
- return Math.min(o, t);
310
- }
311
- function B(e) {
312
- const t = e.span ?? 1;
313
- return {
314
- "yee-ui-grid__field--error": d.value.has(e.fieldName),
315
- "yee-ui-grid__field--no-label": !e.label,
316
- "yee-ui-grid__field--required": !!(e.required && e.label),
317
- "yee-ui-grid__field--span-2": t === 2,
318
- "yee-ui-grid__field--span-3": t === 3,
319
- "yee-ui-grid__field--vertical": i.value?.layout === "vertical"
320
- };
321
- }
322
- function Q(e) {
323
- if (i.value?.layout === "vertical" || !e.label) return;
324
- const t = i.value?.labelWidth ?? "auto";
325
- return {
326
- "--yee-grid-label-width": t === "auto" ? "max-content" : `${t}px`
327
- };
328
- }
329
- function n(e) {
330
- return e !== "Custom";
331
- }
332
- function m(e) {
333
- return n(e.component) ? Rt[e.component] : void 0;
334
- }
335
- function V(e) {
336
- return n(e.component) ? Et[e.component] ?? "value" : "value";
337
- }
338
- function J(e) {
339
- const t = M(e), o = V(e), s = d.value.has(e.fieldName);
340
- return {
341
- ...e.componentProps,
342
- ...t === void 0 ? {} : { [o]: t },
343
- ...s ? { "aria-invalid": !0 } : {},
344
- ...s && n(e.component) && j.has(e.component) ? { status: "error" } : {},
345
- [`onUpdate:${o}`]: (c) => le(e, c)
346
- };
347
- }
348
- function le(e, t) {
349
- a.api.formApi.setFieldValue(e.fieldName, t), d.value.has(e.fieldName) && a.api.formApi.validateField(e.fieldName) && (d.value = new Set([...d.value].filter((o) => o !== e.fieldName))), i.value?.submitOnChange && X();
350
- }
351
- function we() {
352
- const e = /* @__PURE__ */ new Set();
353
- for (const t of w.value)
354
- t.required && !a.api.formApi.validateField(t.fieldName) && e.add(t.fieldName);
355
- return d.value = e, e.size === 0;
356
- }
357
- async function Te() {
358
- a.api.formApi.resetForm(), d.value = /* @__PURE__ */ new Set(), await Re();
359
- }
360
- async function X() {
361
- if (!we()) {
362
- Se();
363
- return;
364
- }
365
- await ze();
366
- }
367
- function _e(e) {
368
- e.key === "Enter" && i.value?.submitOnEnter && !(e.target instanceof HTMLTextAreaElement) && (e.preventDefault(), X());
369
- }
370
- function se(e) {
371
- u.value !== e && (u.value = e, i.value?.handleCollapsedChange?.(e));
372
- }
373
- function Se() {
374
- if (!u.value) return;
375
- const e = new Set(q.value.map((o) => o.fieldName));
376
- w.value.some((o) => !e.has(o.fieldName) && d.value.has(o.fieldName)) && se(!1);
377
- }
378
- function ke() {
379
- se(!u.value);
380
- }
381
- function ue(e) {
382
- return `form-${e.fieldName}`;
383
- }
384
- function Ne(e) {
385
- return !!f[ue(e)];
386
- }
387
- me(i, (e) => {
388
- if (!e) {
389
- d.value = /* @__PURE__ */ new Set();
390
- return;
391
- }
392
- a.api.formApi.configure(e), u.value = e.collapsed ?? !0, d.value = /* @__PURE__ */ new Set(), L(N);
393
- }, { immediate: !0 }), re(async () => {
394
- await L(), N();
395
- const e = x.value?.$el;
396
- typeof ResizeObserver < "u" && e && (O = new ResizeObserver(N), O.observe(e));
397
- }), he(() => {
398
- O?.disconnect();
399
- });
400
- const Ve = g(() => {
401
- const e = k.value.gridOptions, t = e.proxyConfig, o = t?.ajax?.query, s = e.toolbarConfig, c = e.pagerConfig;
402
- return {
403
- align: "left",
404
- border: "inner",
405
- minHeight: 180,
406
- showHeaderOverflow: "tooltip",
407
- showOverflow: "tooltip",
408
- size: "medium",
409
- ...A.value ? { height: "auto" } : {},
410
- ...e,
411
- columnConfig: {
412
- resizable: !0,
413
- ...e.columnConfig
414
- },
415
- tooltipConfig: {
416
- enterable: !0,
417
- leaveDelay: 300,
418
- ...e.tooltipConfig
419
- },
420
- ...c ? {
421
- pagerConfig: {
422
- pageSize: 20,
423
- pageSizes: [10, 20, 30, 50, 100, 200],
424
- layouts: ["Total", "Sizes", "Home", "PrevPage", "Number", "NextPage", "End"],
425
- ...c,
426
- slots: {
427
- sizes: "pagerSizes",
428
- ...c.slots
429
- }
430
- }
431
- } : {},
432
- ...t ? {
433
- proxyConfig: {
434
- autoLoad: !0,
435
- showResponseMsg: !1,
436
- ...t,
437
- response: {
438
- list: "items",
439
- result: "items",
440
- total: "total",
441
- ...t.response
442
- },
443
- ...t.ajax ? {
444
- ajax: {
445
- ...t.ajax,
446
- ...o ? {
447
- query: (F) => o(F, a.api.formApi.getValues())
448
- } : {}
449
- }
450
- } : {}
451
- }
452
- } : {},
453
- ...s || U.value ? {
454
- toolbarConfig: {
455
- custom: !0,
456
- refresh: !0,
457
- zoom: !0,
458
- ...s,
459
- slots: {
460
- ...a.tableTitle || f["table-title"] || f["toolbar-actions"] ? { buttons: "toolbarActions" } : {},
461
- ...f["toolbar-tools"] ? { tools: "toolbarTools" } : {}
462
- }
463
- }
464
- } : {}
465
- };
466
- }), Pe = g(() => k.value.gridEvents ?? {});
467
- me(
468
- () => C?.value.mode ?? "light",
469
- (e) => _.setTheme(e),
470
- { immediate: !0 }
471
- );
472
- async function ze() {
473
- await a.api.reload();
474
- }
475
- async function Re() {
476
- await a.api.reload();
477
- }
478
- function Ee(e, t) {
479
- typeof t != "number" && typeof t != "string" || e.setPageSizeByEvent(new Event("change"), t);
480
- }
481
- return re(() => {
482
- r.value && a.api.mount(r.value);
483
- }), Be(() => {
484
- S(), a.api.unmount();
485
- }), (e, t) => (v(), H("section", {
486
- class: Z(["yee-ui-grid", { "yee-ui-grid--fill-page-content": A.value }])
487
- }, [
488
- i.value ? Fe((v(), $(b(ut), {
489
- key: 0,
490
- ref: "formElement",
491
- class: "yee-ui-grid__search-form",
492
- layout: i.value.layout ?? "horizontal",
493
- model: l.api.formApi.getModel(),
494
- onKeydown: _e,
495
- onSubmit: He(X, ["prevent"])
496
- }, {
497
- default: p(() => [
498
- (v(!0), H(pe, null, fe(q.value, (o) => (v(), $(b(ct), {
499
- key: o.fieldName,
500
- "no-style": "",
501
- name: o.fieldName,
502
- required: !!o.required,
503
- "validate-status": d.value.has(o.fieldName) ? "error" : ""
504
- }, {
505
- default: p(() => [
506
- T("label", {
507
- class: Z(["yee-ui-grid__field", B(o)]),
508
- style: ye(Q(o))
509
- }, [
510
- o.label ? (v(), H("span", Ht, W(o.label), 1)) : P("", !0),
511
- T("div", It, [
512
- Ne(o) ? z(e.$slots, ue(o), {
513
- key: 0,
514
- field: o,
515
- setValue: (s) => le(o, s),
516
- value: M(o),
517
- values: l.api.formApi.getValues()
518
- }, void 0, !0) : (v(), H(pe, { key: 1 }, [
519
- o.component !== "Custom" ? (v(), $(Ie(m(o)), ae({
520
- key: 0,
521
- ref_for: !0
522
- }, J(o)), null, 16)) : P("", !0)
523
- ], 64))
524
- ])
525
- ], 6)
526
- ]),
527
- _: 2
528
- }, 1032, ["name", "required", "validate-status"]))), 128)),
529
- T("div", $t, [
530
- I(b(oe), {
531
- "html-type": "button",
532
- onClick: Te
533
- }, {
534
- default: p(() => [...t[0] || (t[0] = [
535
- G(" 重置 ", -1)
536
- ])]),
537
- _: 1
538
- }),
539
- I(b(oe), {
540
- type: "primary",
541
- "html-type": "submit"
542
- }, {
543
- default: p(() => [...t[1] || (t[1] = [
544
- G(" 查询 ", -1)
545
- ])]),
546
- _: 1
547
- }),
548
- i.value.showCollapseButton ? (v(), $(b(oe), {
549
- key: 0,
550
- class: "yee-ui-grid__collapse-button",
551
- type: "link",
552
- "html-type": "button",
553
- onClick: ke
554
- }, {
555
- default: p(() => [
556
- T("span", null, W(u.value ? "展开" : "收起"), 1),
557
- I(b(dt), {
558
- "aria-hidden": "true",
559
- class: Z(["yee-ui-grid__collapse-icon", { "yee-ui-grid__collapse-icon--expanded": !u.value }])
560
- }, null, 8, ["class"])
561
- ]),
562
- _: 1
563
- })) : P("", !0)
564
- ])
565
- ]),
566
- _: 3
567
- }, 8, ["layout", "model"])), [
568
- [$e, l.api.searchFormVisible.value]
569
- ]) : P("", !0),
570
- i.value && k.value.separator !== !1 ? (v(), H("div", Ot)) : P("", !0),
571
- T("div", Lt, [
572
- I(b(xe), ae({
573
- ref_key: "gridRef",
574
- ref: r,
575
- class: "yee-ui-grid__table"
576
- }, Ve.value, Oe(Pe.value)), Le({
577
- toolbarActions: p((o) => [
578
- z(e.$slots, "table-title", {}, () => [
579
- l.tableTitle ? (v(), H("div", Dt, [
580
- G(W(l.tableTitle) + " ", 1),
581
- l.tableTitleHelp ? (v(), $(b(Ce), {
582
- key: 0,
583
- title: l.tableTitleHelp
584
- }, {
585
- default: p(() => [...t[2] || (t[2] = [
586
- T("span", {
587
- class: "yee-ui-grid__help",
588
- tabindex: "0"
589
- }, "?", -1)
590
- ])]),
591
- _: 1
592
- }, 8, ["title"])) : P("", !0)
593
- ])) : P("", !0)
594
- ], !0),
595
- z(e.$slots, "toolbar-actions", ee(te(o)), void 0, !0)
596
- ]),
597
- toolbarTools: p((o) => [
598
- z(e.$slots, "toolbar-tools", ee(te(o)), void 0, !0)
599
- ]),
600
- pagerSizes: p(({ $pager: o, options: s, pageSize: c }) => [
601
- I(b(be), {
602
- class: "yee-ui-grid__page-size",
603
- options: s,
604
- value: c,
605
- onChange: (F) => Ee(o, F)
606
- }, null, 8, ["options", "value", "onChange"])
607
- ]),
608
- empty: p(() => [
609
- z(e.$slots, "empty", {}, () => [
610
- t[3] || (t[3] = T("div", { class: "yee-ui-grid__empty" }, "暂无数据", -1))
611
- ], !0)
612
- ]),
613
- _: 2
614
- }, [
615
- fe(Y.value, (o) => ({
616
- name: o,
617
- fn: p((s) => [
618
- z(e.$slots, o, ee(te(s)), void 0, !0)
619
- ])
620
- }))
621
- ]), 1040)
622
- ]),
623
- I(b(E))
624
- ], 2));
625
- }
626
- }), vo = /* @__PURE__ */ zt(qt, [["__scopeId", "data-v-94e4a5a9"]]);
627
- export {
628
- vo as default
629
- };