@yeepay/yee-boss-ui 0.1.17 → 0.1.19

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.
@@ -1,463 +0,0 @@
1
- import { shallowRef as S, defineComponent as D, reactive as ne, useTemplateRef as U, computed as d, onMounted as Q, onBeforeUnmount as K, openBlock as w, createBlock as L, unref as A, mergeProps as J, withCtx as v, createElementVNode as P, normalizeStyle as ae, renderSlot as V, createTextVNode as X, toDisplayString as Z, nextTick as $, useSlots as le, inject as W, watch as se, onUnmounted as ue, createElementBlock as B, normalizeClass as ce, withDirectives as me, vShow as de, createCommentVNode as E, createVNode as M, toHandlers as pe, createSlots as fe, normalizeProps as F, guardReactiveProps as I, renderList as ge, h as ve } from "vue";
2
- import { Tooltip as ee, Modal as he, Select as be } from "ant-design-vue";
3
- import te from "vxe-table/es/grid";
4
- import _ from "vxe-table/es/ui";
5
- import { p as ye } from "./context-DJQ4f46a.js";
6
- import { a as xe, Y as Te } from "./form-api-DbIL_dvg.js";
7
- import { p as Ce } from "./context-C5gszWl6.js";
8
- import we from "vxe-pc-ui/es/button";
9
- import Ve from "vxe-pc-ui/es/checkbox";
10
- import Se from "vxe-pc-ui/es/icon";
11
- import He from "vxe-pc-ui/es/input";
12
- import ze from "vxe-pc-ui/es/loading";
13
- import Ae from "vxe-pc-ui/es/modal";
14
- import Pe from "vxe-pc-ui/es/number-input";
15
- import _e from "vxe-pc-ui/es/pager";
16
- import Ne from "vxe-pc-ui/es/radio-group";
17
- import Ee from "vxe-pc-ui/es/select";
18
- import ke from "vxe-table/es/colgroup";
19
- import Ge from "vxe-table/es/column";
20
- import Oe from "vxe-table/es/table";
21
- import Re from "vxe-table/es/toolbar";
22
- import { _ as Ye } from "./_plugin-vue_export-helper-CHgC5LLL.js";
23
- class $e {
24
- /** 查询表单控制器。 */
25
- formApi = new xe();
26
- /** 查询表单当前是否可见。 */
27
- searchFormVisible;
28
- /** 当前 Grid 初始化配置。 */
29
- state;
30
- grid;
31
- constructor(e) {
32
- this.state = S(e), this.searchFormVisible = S(e.showSearchForm ?? !0);
33
- }
34
- /** @internal 由 YeeGrid 挂载底层 VXE Grid 实例。 */
35
- mount(e) {
36
- this.grid = e;
37
- }
38
- /** 保留当前页码并执行查询,可在查询前合并表单值。 */
39
- query = async (e) => (e && this.formApi.setValues(e), this.grid?.commitProxy("query"));
40
- /** 回到第一页并重新查询,可在查询前合并表单值。 */
41
- reload = async (e) => (e && this.formApi.setValues(e), this.grid?.commitProxy("reload"));
42
- /** 合并更新 VXE Grid 配置。 */
43
- setGridOptions(e) {
44
- this.setState({
45
- gridOptions: {
46
- ...this.state.value.gridOptions,
47
- ...e
48
- }
49
- });
50
- }
51
- /** 设置表格加载状态。 */
52
- setLoading(e) {
53
- this.setGridOptions({ loading: e });
54
- }
55
- /** 合并更新 useYeeGrid 初始化配置。 */
56
- setState(e) {
57
- this.state.value = {
58
- ...this.state.value,
59
- ...e
60
- };
61
- }
62
- /** 切换查询表单显隐,并返回切换后的状态。 */
63
- toggleSearchForm(e) {
64
- return this.searchFormVisible.value = e ?? !this.searchFormVisible.value, this.searchFormVisible.value;
65
- }
66
- /** @internal 清理底层 VXE Grid 实例引用。 */
67
- unmount() {
68
- this.grid = void 0;
69
- }
70
- }
71
- const Be = /* @__PURE__ */ D({
72
- inheritAttrs: !1,
73
- name: "VxeTooltip",
74
- __name: "YeeGridTooltip",
75
- props: {
76
- content: {},
77
- enterDelay: {},
78
- enterable: { type: Boolean },
79
- height: {},
80
- isArrow: { type: Boolean, default: !0 },
81
- leaveDelay: {},
82
- maxHeight: {},
83
- maxWidth: {},
84
- minHeight: {},
85
- minWidth: {},
86
- modelValue: { type: Boolean },
87
- popupClassName: {},
88
- selector: {},
89
- theme: {},
90
- trigger: {},
91
- useHTML: { type: Boolean },
92
- width: {},
93
- zIndex: {}
94
- },
95
- emits: ["update:modelValue"],
96
- setup(n, { expose: e, emit: l }) {
97
- const t = n, a = l, T = ee, s = ne({ visible: !1 }), C = U("tooltip"), h = S(), b = S(""), y = S(), x = S(!1);
98
- let p;
99
- function f(o) {
100
- if (!(o === void 0 || o === ""))
101
- return typeof o == "number" ? `${o}px` : o;
102
- }
103
- const k = d(() => {
104
- const o = h.value;
105
- return !o || !s.visible ? { display: "none" } : {
106
- height: `${Math.max(o.height, 1)}px`,
107
- left: `${o.left}px`,
108
- pointerEvents: "none",
109
- position: "fixed",
110
- top: `${o.top}px`,
111
- width: `${Math.max(o.width, 1)}px`
112
- };
113
- }), G = d(() => ({
114
- cursor: t.enterable ? "text" : void 0,
115
- height: f(t.height),
116
- maxHeight: f(t.maxHeight),
117
- maxWidth: f(t.maxWidth),
118
- minHeight: f(t.minHeight),
119
- minWidth: f(t.minWidth),
120
- userSelect: t.enterable ? "text" : void 0,
121
- width: f(t.width)
122
- })), O = d(() => ({
123
- ...t.popupClassName ? { overlayClassName: t.popupClassName } : {},
124
- ...t.zIndex === void 0 ? {} : { zIndex: Number(t.zIndex) }
125
- }));
126
- function R(o) {
127
- return o.closest("body") ?? document.body;
128
- }
129
- function Y(o) {
130
- return o || (typeof t.selector == "string" ? document.querySelector(t.selector) ?? void 0 : t.selector);
131
- }
132
- function i() {
133
- const o = y.value;
134
- if (!o?.isConnected)
135
- return m();
136
- const c = o.getBoundingClientRect();
137
- return h.value = {
138
- height: c.height,
139
- left: c.left,
140
- top: c.top,
141
- width: c.width
142
- }, $(() => C.value?.forcePopupAlign?.());
143
- }
144
- function r(o, c) {
145
- const z = Y(o);
146
- return z ? (y.value = z, b.value = c ?? t.content ?? "", x.value = !0, s.visible = !0, a("update:modelValue", !0), i()) : $();
147
- }
148
- function u(o, c, z) {
149
- const re = o.currentTarget instanceof HTMLElement ? o.currentTarget : void 0;
150
- return r(c ?? re, z);
151
- }
152
- function m() {
153
- return x.value = !1, y.value = void 0, h.value = void 0, s.visible = !1, a("update:modelValue", !1), $();
154
- }
155
- function g(o) {
156
- o && p && (clearTimeout(p), p = void 0), x.value = o;
157
- }
158
- function H() {
159
- return x.value;
160
- }
161
- function N() {
162
- s.visible && i();
163
- }
164
- function ie() {
165
- g(!1), t.enterable && (p = setTimeout(() => {
166
- p = void 0, x.value || m();
167
- }, t.leaveDelay ?? 0));
168
- }
169
- return Q(() => {
170
- window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), t.modelValue && r(void 0, t.content);
171
- }), K(() => {
172
- p && clearTimeout(p), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
173
- }), e({
174
- close: m,
175
- isActived: H,
176
- open: r,
177
- openByEvent: u,
178
- reactData: s,
179
- setActived: g,
180
- toVisible: r,
181
- updatePlacement: i
182
- }), (o, c) => (w(), L(A(T), J({ ref: "tooltip" }, O.value, {
183
- arrow: t.isArrow !== !1,
184
- "get-popup-container": R,
185
- open: s.visible,
186
- "overlay-inner-style": G.value,
187
- placement: "top"
188
- }), {
189
- title: v(() => [
190
- P("div", {
191
- class: "yee-ui-grid-tooltip-content",
192
- onMouseenter: c[0] || (c[0] = (z) => t.enterable && g(!0)),
193
- onMouseleave: ie
194
- }, [
195
- V(o.$slots, "content", {}, () => [
196
- X(Z(b.value), 1)
197
- ])
198
- ], 32)
199
- ]),
200
- default: v(() => [
201
- P("span", {
202
- "aria-hidden": "true",
203
- class: "yee-ui-grid-tooltip-anchor",
204
- style: ae(k.value)
205
- }, null, 4)
206
- ]),
207
- _: 3
208
- }, 16, ["arrow", "open", "overlay-inner-style"]));
209
- }
210
- });
211
- let q = !1;
212
- const j = /* @__PURE__ */ new Set();
213
- function Me() {
214
- const n = _.modal.confirm.bind(_.modal);
215
- _.modal.confirm = ((e, l, t) => {
216
- const a = typeof e == "object" && e !== null ? e : typeof t == "object" && t !== null ? t : void 0;
217
- if ((typeof a?.className == "string" ? a.className.split(/\s+/) : []).includes("vxe-table--ignore-clear")) {
218
- const s = [...j], C = s[s.length - 1];
219
- if (C) {
220
- const h = typeof a?.content == "string" ? a.content : String(a?.content ?? e);
221
- return C(h);
222
- }
223
- }
224
- return n(e, l, t);
225
- });
226
- }
227
- function Fe(n) {
228
- return j.add(n), () => j.delete(n);
229
- }
230
- function oe() {
231
- if (q) return;
232
- [
233
- Oe,
234
- Ge,
235
- ke,
236
- te,
237
- Re,
238
- we,
239
- Ve,
240
- Se,
241
- He,
242
- ze,
243
- Ae,
244
- Pe,
245
- _e,
246
- Ne,
247
- Ee,
248
- Be
249
- ].forEach((e) => _.component(e)), Me(), q = !0;
250
- }
251
- const Ie = {
252
- key: 1,
253
- class: "yee-ui-grid__separator"
254
- }, Le = { class: "yee-ui-grid__table-container" }, je = {
255
- key: 0,
256
- class: "yee-ui-grid__title"
257
- }, De = /* @__PURE__ */ D({
258
- name: "YeeGrid",
259
- __name: "YeeGrid",
260
- props: {
261
- api: {},
262
- tableTitle: {},
263
- tableTitleHelp: {}
264
- },
265
- setup(n) {
266
- const e = n, l = le(), t = U("gridRef"), a = W(ye), T = W(Ce, void 0), [s, C] = he.useModal();
267
- oe();
268
- const h = Fe((i) => new Promise((r) => {
269
- s.confirm({
270
- title: "恢复默认列配置",
271
- content: i,
272
- centered: !0,
273
- okText: "确认",
274
- cancelText: "取消",
275
- keyboard: !0,
276
- wrapClassName: "vxe-table--ignore-clear",
277
- onOk: () => r("confirm"),
278
- onCancel: () => r("cancel")
279
- });
280
- })), b = d(() => e.api.state.value), y = d(() => b.value.formOptions), x = d(() => !!(e.tableTitle || l["table-title"] || l["toolbar-actions"] || l["toolbar-tools"])), p = d(() => Object.keys(l).filter((i) => ![
281
- "empty",
282
- "loading",
283
- "table-title",
284
- "toolbar-actions",
285
- "toolbar-tools"
286
- ].includes(i))), f = d(() => T?.value ?? !1), k = d(() => {
287
- const i = b.value.gridOptions, r = i.proxyConfig, u = r?.ajax?.query, m = i.toolbarConfig, g = i.pagerConfig;
288
- return {
289
- align: "left",
290
- border: "inner",
291
- minHeight: 180,
292
- showHeaderOverflow: "tooltip",
293
- showOverflow: "tooltip",
294
- size: "medium",
295
- ...f.value ? { height: "auto" } : {},
296
- ...i,
297
- columnConfig: {
298
- resizable: !0,
299
- ...i.columnConfig
300
- },
301
- tooltipConfig: {
302
- enterable: !0,
303
- leaveDelay: 300,
304
- ...i.tooltipConfig
305
- },
306
- ...g ? {
307
- pagerConfig: {
308
- pageSize: 20,
309
- pageSizes: [10, 20, 30, 50, 100, 200],
310
- layouts: ["Total", "Sizes", "Home", "PrevPage", "Number", "NextPage", "End"],
311
- ...g,
312
- slots: {
313
- sizes: "pagerSizes",
314
- ...g.slots
315
- }
316
- }
317
- } : {},
318
- ...r ? {
319
- proxyConfig: {
320
- autoLoad: !0,
321
- showResponseMsg: !1,
322
- ...r,
323
- response: {
324
- list: "items",
325
- result: "items",
326
- total: "total",
327
- ...r.response
328
- },
329
- ...r.ajax ? {
330
- ajax: {
331
- ...r.ajax,
332
- ...u ? {
333
- query: (H) => u(H, e.api.formApi.getValues())
334
- } : {}
335
- }
336
- } : {}
337
- }
338
- } : {},
339
- ...m || x.value ? {
340
- toolbarConfig: {
341
- custom: !0,
342
- refresh: !0,
343
- zoom: !0,
344
- ...m,
345
- slots: {
346
- ...e.tableTitle || l["table-title"] || l["toolbar-actions"] ? { buttons: "toolbarActions" } : {},
347
- ...l["toolbar-tools"] ? { tools: "toolbarTools" } : {}
348
- }
349
- }
350
- } : {}
351
- };
352
- }), G = d(() => b.value.gridEvents ?? {});
353
- se(
354
- () => a?.value.mode ?? "light",
355
- (i) => _.setTheme(i),
356
- { immediate: !0 }
357
- );
358
- async function O() {
359
- await e.api.reload();
360
- }
361
- async function R() {
362
- await e.api.reload();
363
- }
364
- function Y(i, r) {
365
- typeof r != "number" && typeof r != "string" || i.setPageSizeByEvent(new Event("change"), r);
366
- }
367
- return Q(() => {
368
- t.value && e.api.mount(t.value);
369
- }), ue(() => {
370
- h(), e.api.unmount();
371
- }), (i, r) => (w(), B("section", {
372
- class: ce(["yee-ui-grid", { "yee-ui-grid--fill-page-content": f.value }])
373
- }, [
374
- y.value ? me((w(), L(Te, {
375
- key: 0,
376
- api: n.api.formApi,
377
- options: y.value,
378
- "on-reset": R,
379
- "on-submit": O
380
- }, null, 8, ["api", "options"])), [
381
- [de, n.api.searchFormVisible.value]
382
- ]) : E("", !0),
383
- y.value && b.value.separator !== !1 ? (w(), B("div", Ie)) : E("", !0),
384
- P("div", Le, [
385
- M(A(te), J({
386
- ref_key: "gridRef",
387
- ref: t,
388
- class: "yee-ui-grid__table"
389
- }, k.value, pe(G.value)), fe({
390
- toolbarActions: v((u) => [
391
- V(i.$slots, "table-title", {}, () => [
392
- n.tableTitle ? (w(), B("div", je, [
393
- X(Z(n.tableTitle) + " ", 1),
394
- n.tableTitleHelp ? (w(), L(A(ee), {
395
- key: 0,
396
- title: n.tableTitleHelp
397
- }, {
398
- default: v(() => [...r[0] || (r[0] = [
399
- P("span", {
400
- class: "yee-ui-grid__help",
401
- tabindex: "0"
402
- }, "?", -1)
403
- ])]),
404
- _: 1
405
- }, 8, ["title"])) : E("", !0)
406
- ])) : E("", !0)
407
- ], !0),
408
- V(i.$slots, "toolbar-actions", F(I(u)), void 0, !0)
409
- ]),
410
- toolbarTools: v((u) => [
411
- V(i.$slots, "toolbar-tools", F(I(u)), void 0, !0)
412
- ]),
413
- pagerSizes: v(({ $pager: u, options: m, pageSize: g }) => [
414
- M(A(be), {
415
- class: "yee-ui-grid__page-size",
416
- options: m,
417
- value: g,
418
- onChange: (H) => Y(u, H)
419
- }, null, 8, ["options", "value", "onChange"])
420
- ]),
421
- empty: v(() => [
422
- V(i.$slots, "empty", {}, () => [
423
- r[1] || (r[1] = P("div", { class: "yee-ui-grid__empty" }, "暂无数据", -1))
424
- ], !0)
425
- ]),
426
- _: 2
427
- }, [
428
- ge(p.value, (u) => ({
429
- name: u,
430
- fn: v((m) => [
431
- V(i.$slots, u, F(I(m)), void 0, !0)
432
- ])
433
- }))
434
- ]), 1040)
435
- ]),
436
- M(A(C))
437
- ], 2));
438
- }
439
- }), We = /* @__PURE__ */ Ye(De, [["__scopeId", "data-v-bc8ae91c"]]);
440
- function gt(n) {
441
- oe();
442
- const e = new $e(n), l = We;
443
- return [D({
444
- name: "YeeGrid",
445
- inheritAttrs: !1,
446
- props: {
447
- tableTitle: String,
448
- tableTitleHelp: String
449
- },
450
- setup(a, { attrs: T, slots: s }) {
451
- return K(() => e.unmount()), () => ve(l, {
452
- ...T,
453
- api: e,
454
- ...a.tableTitle ? { tableTitle: a.tableTitle } : {},
455
- ...a.tableTitleHelp ? { tableTitleHelp: a.tableTitleHelp } : {}
456
- }, s);
457
- }
458
- }), e];
459
- }
460
- export {
461
- $e as Y,
462
- gt as u
463
- };
File without changes
File without changes