@yeepay/yee-boss-ui 0.1.18 → 0.1.20

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