ling-yun-custom-components 0.0.36 → 0.0.38

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,592 +0,0 @@
1
- import { renderSlot as k, createElementBlock as $, openBlock as r, Fragment as x, renderList as E, createBlock as m, unref as t, withCtx as n, createTextVNode as D, toDisplayString as M, useCssVars as le, defineAsyncComponent as Y, ref as V, computed as U, withModifiers as pe, normalizeClass as N, mergeProps as g, createCommentVNode as O, withKeys as ke, onMounted as be, watch as ge, createElementVNode as w, createVNode as f, createSlots as F, normalizeProps as A, guardReactiveProps as H, normalizeStyle as we } from "vue";
2
- import { ElButton as z, ElForm as Ve, ElFormItem as oe, ElInput as Z, ElDatePicker as De, ElInputNumber as Ce, ElSwitch as $e, ElRadioGroup as Ee, ElRadio as Fe, ElCheckboxGroup as Ue, ElCheckbox as xe, ElAutoResizer as _, ElPopover as Me, ElIcon as ee, ElDrawer as Se } from "element-plus";
3
- import { IconMagnify as Le, IconCheck as Pe, IconUp as We, IconDown as Be, IconShrink as Ie } from "color-message-lingyun-vue";
4
- import { operationConfigMap as C, labelPositionMap as I, componentType as p, dateParamsMap as Ne, dateFormat as ae, emitsMap as B } from "ling-yun-methods";
5
- import { _ as ne } from "./_plugin-vue_export-helper.CHgC5LLL.js";
6
- import { C as te } from "./layout.D_fCzVf0.js";
7
- import '../assets/layout2.css';const Oe = [
8
- {
9
- type: "primary",
10
- label: "查询",
11
- value: C.search
12
- },
13
- {
14
- type: "default",
15
- label: "重置",
16
- value: C.reset
17
- }
18
- ], re = 320, K = {
19
- __name: "OperationButtons",
20
- props: {
21
- operationList: {
22
- type: Array,
23
- default: () => []
24
- }
25
- },
26
- emits: ["operation"],
27
- setup(a, { emit: S }) {
28
- const L = S, c = (v) => {
29
- L("operation", v);
30
- };
31
- return (v, i) => v.$slots.operation ? k(v.$slots, "operation", {
32
- key: 0,
33
- operationList: a.operationList
34
- }) : (r(!0), $(x, { key: 1 }, E(a.operationList, (y) => (r(), m(t(z), {
35
- key: y.value,
36
- type: y.type,
37
- icon: y.icon,
38
- onClick: (u) => c(y.value)
39
- }, {
40
- default: n(() => [
41
- D(M(y.label), 1)
42
- ]),
43
- _: 2
44
- }, 1032, ["type", "icon", "onClick"]))), 128));
45
- }
46
- }, ze = /* @__PURE__ */ Object.assign({
47
- name: "FormWrapper"
48
- }, {
49
- __name: "FormWrapper",
50
- props: {
51
- // 表单项配置
52
- items: {
53
- type: Array,
54
- default: () => []
55
- },
56
- // 表单数据
57
- formData: {
58
- type: Object,
59
- default: () => ({})
60
- },
61
- // 表单验证规则
62
- rules: {
63
- type: Object,
64
- default: () => ({})
65
- },
66
- // 标签宽度
67
- labelWidth: {
68
- type: [String, Number],
69
- default: "auto"
70
- },
71
- // 标签位置
72
- labelPosition: {
73
- type: String,
74
- default: I.right
75
- },
76
- // 是否显示标签
77
- showLabel: {
78
- type: Boolean,
79
- default: !0
80
- },
81
- // 是否内联布局
82
- inline: {
83
- type: Boolean,
84
- default: !1
85
- },
86
- // 是否为筛选器模式
87
- isFilter: {
88
- type: Boolean,
89
- default: !1
90
- },
91
- // 是否为筛选器预览模式
92
- isFilterPreview: {
93
- type: Boolean,
94
- default: !1
95
- },
96
- minWidth: {
97
- type: Number,
98
- default: re
99
- }
100
- },
101
- emits: ["change", "enter"],
102
- setup(a, { expose: S }) {
103
- le((u) => ({
104
- v21117ed0: a.minWidth + "px"
105
- }));
106
- const L = Y(() => import("./layout.2Mabaug0.js")), c = Y(() => import("./layout.CRtj9xK9.js")), v = a, i = V(null), y = U(() => v.isFilter ? "filter-form" : v.isFilterPreview ? "filter-preview-form" : "search-bar-form");
107
- return S({
108
- validate: (u) => i.value ? i.value.validate(u) : Promise.resolve(!0),
109
- resetFields: () => {
110
- i.value && i.value.resetFields();
111
- },
112
- clearValidate: (u) => {
113
- i.value && i.value.clearValidate(u);
114
- },
115
- scrollToField: (u) => {
116
- i.value && i.value.scrollToField(u);
117
- }
118
- }), (u, h) => (r(), m(t(Ve), {
119
- ref_key: "formRef",
120
- ref: i,
121
- model: a.formData,
122
- "label-width": a.labelWidth,
123
- "label-position": a.labelPosition,
124
- inline: a.inline,
125
- rules: a.rules,
126
- class: N({
127
- [y.value]: !0,
128
- "items-end display-grid": !a.isFilterPreview
129
- }),
130
- onSubmit: h[0] || (h[0] = pe(() => {
131
- }, ["prevent", "stop"]))
132
- }, {
133
- default: n(() => [
134
- (r(!0), $(x, null, E(a.items, (e) => (r(), m(t(oe), g({
135
- key: e.key,
136
- label: a.showLabel ? e.label : "",
137
- prop: e.key,
138
- "show-label": a.showLabel,
139
- class: [
140
- {
141
- "search-bar-item--wide": e.wide
142
- }
143
- ]
144
- }, { ref_for: !0 }, e), {
145
- default: n(() => [
146
- k(u.$slots, e.key, {
147
- item: e,
148
- formData: a.formData
149
- }, () => [
150
- e.type === t(p).text ? (r(), m(t(Z), g({
151
- key: 0,
152
- modelValue: a.formData[e.key],
153
- "onUpdate:modelValue": (l) => a.formData[e.key] = l
154
- }, { ref_for: !0 }, e, {
155
- class: "w-full",
156
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key]),
157
- onKeyup: ke((l) => u.$emit("enter", e.key, a.formData[e.key]), ["enter"])
158
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onChange", "onKeyup"])) : e.type === t(p).select ? (r(), m(t(L), g({
159
- key: 1,
160
- modelValue: a.formData[e.key],
161
- "onUpdate:modelValue": (l) => a.formData[e.key] = l,
162
- "static-options": e.options
163
- }, { ref_for: !0 }, e, {
164
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key]),
165
- class: "w-full"
166
- }), null, 16, ["modelValue", "onUpdate:modelValue", "static-options", "onChange"])) : e.type === t(p).date ? (r(), m(t(De), g({
167
- key: 2,
168
- modelValue: a.formData[e.key],
169
- "onUpdate:modelValue": (l) => a.formData[e.key] = l
170
- }, { ref_for: !0 }, {
171
- ...e,
172
- ...t(Ne)[e.dateType]
173
- }, {
174
- type: e.dateType,
175
- format: e.format || t(ae).date,
176
- "value-format": e.valueFormat || t(ae).dateTime,
177
- class: "w-full",
178
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key])
179
- }), null, 16, ["modelValue", "onUpdate:modelValue", "type", "format", "value-format", "onChange"])) : e.type === t(p).inputNumber ? (r(), m(t(Ce), g({
180
- key: 3,
181
- modelValue: a.formData[e.key],
182
- "onUpdate:modelValue": (l) => a.formData[e.key] = l
183
- }, { ref_for: !0 }, e, {
184
- class: "w-full",
185
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key])
186
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(p).switch ? (r(), m(t($e), g({
187
- key: 4,
188
- modelValue: a.formData[e.key],
189
- "onUpdate:modelValue": (l) => a.formData[e.key] = l
190
- }, { ref_for: !0 }, e, {
191
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key])
192
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(p).radio ? (r(), m(t(Ee), {
193
- key: 5,
194
- modelValue: a.formData[e.key],
195
- "onUpdate:modelValue": (l) => a.formData[e.key] = l,
196
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key])
197
- }, {
198
- default: n(() => [
199
- (r(!0), $(x, null, E(e.options, (l) => (r(), m(t(Fe), {
200
- key: l.value,
201
- label: l.value,
202
- value: l.value,
203
- disabled: l.disabled
204
- }, {
205
- default: n(() => [
206
- D(M(l.label), 1)
207
- ]),
208
- _: 2
209
- }, 1032, ["label", "value", "disabled"]))), 128))
210
- ]),
211
- _: 2
212
- }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(p).checkbox ? (r(), m(t(Ue), {
213
- key: 6,
214
- modelValue: a.formData[e.key],
215
- "onUpdate:modelValue": (l) => a.formData[e.key] = l,
216
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key])
217
- }, {
218
- default: n(() => [
219
- (r(!0), $(x, null, E(e.options, (l) => (r(), m(t(xe), {
220
- key: l.value,
221
- label: l.value,
222
- value: l.value
223
- }, {
224
- default: n(() => [
225
- D(M(l.label), 1)
226
- ]),
227
- _: 2
228
- }, 1032, ["label", "value"]))), 128))
229
- ]),
230
- _: 2
231
- }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(p).textarea ? (r(), m(t(Z), g({
232
- key: 7,
233
- modelValue: a.formData[e.key],
234
- "onUpdate:modelValue": (l) => a.formData[e.key] = l
235
- }, { ref_for: !0 }, e, {
236
- class: "w-full",
237
- type: "textarea",
238
- onChange: (l) => u.$emit("change", e.key, a.formData[e.key])
239
- }), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(p).upload ? (r(), m(t(c), g({
240
- key: 8,
241
- modelValue: a.formData[e.key],
242
- "onUpdate:modelValue": (l) => a.formData[e.key] = l
243
- }, { ref_for: !0 }, e), null, 16, ["modelValue", "onUpdate:modelValue"])) : O("", !0)
244
- ], !0)
245
- ]),
246
- _: 2
247
- }, 1040, ["label", "prop", "show-label", "class"]))), 128)),
248
- k(u.$slots, "default", {}, void 0, !0)
249
- ]),
250
- _: 3
251
- }, 8, ["model", "label-width", "label-position", "inline", "rules", "class"]));
252
- }
253
- }), q = /* @__PURE__ */ ne(ze, [["__scopeId", "data-v-6092c6e2"]]), Re = { class: "h-32 w-full" }, Te = { class: "flex items-center justify-between pd-b-20" }, je = { class: "text-right" }, Ae = { class: "drawer-header" }, He = { class: "flex-1 pd-l-16 pd-r-16 overflow-y-auto" }, Ke = { class: "text-right border-top pd-t-16 pd-l-16 pd-r-16" }, qe = /* @__PURE__ */ Object.assign({
254
- name: "SearchBar"
255
- }, {
256
- __name: "layout",
257
- props: {
258
- // 搜索项配置
259
- items: {
260
- type: Array,
261
- default: () => []
262
- },
263
- // 初始值
264
- modelValue: {
265
- type: Object,
266
- default: () => ({})
267
- },
268
- // 标签宽度
269
- labelWidth: {
270
- type: [String, Number],
271
- default: "auto"
272
- },
273
- // 标签位置
274
- labelPosition: {
275
- type: String,
276
- default: I.right,
277
- validator: (a) => [I.left, I.right, I.top].includes(a)
278
- },
279
- // 是否可以展开
280
- isExpand: {
281
- type: Boolean,
282
- default: !0
283
- },
284
- // 最大的高度
285
- maxHeight: {
286
- type: Number,
287
- default: 84
288
- },
289
- // 每项最小宽度
290
- minWidth: {
291
- type: Number,
292
- default: re
293
- },
294
- operationList: {
295
- type: Array,
296
- default: Oe
297
- },
298
- // 是否为筛选器模式
299
- filterMode: {
300
- type: Boolean,
301
- default: !0
302
- }
303
- },
304
- emits: [B.updateModelValue, B.operation],
305
- setup(a, { expose: S, emit: L }) {
306
- le((o) => ({
307
- v1bbac240: a.maxHeight + "px",
308
- v84cfd7f0: j.value ? j.value + "px" : "100%"
309
- }));
310
- const c = a, v = L, i = V({}), y = V(!c.isExpand), u = V(null), h = V(!1), e = V(!1), l = U(() => {
311
- const o = {};
312
- return c.items.forEach((s) => {
313
- if (s.required) {
314
- const d = [{ required: !0, message: `${s.label}不能为空`, trigger: "blur" }];
315
- typeof s.validator == "function" && d.push({ validator: s.validator, trigger: "blur" }), o[s.key] = d;
316
- }
317
- }), o;
318
- }), R = U(() => c.items?.filter((o) => !o.hidden) || []), G = U(() => c.filterMode ? R.value?.slice(0, 2) || [] : R.value), P = U(() => c.filterMode ? R.value.slice(2) : []), J = (o) => {
319
- i.value = { ...o };
320
- }, ue = () => {
321
- v(B.updateModelValue, { ...i.value });
322
- }, ie = (o, s) => {
323
- i.value[o] = s, W(C.search);
324
- }, de = () => i.value, T = (o, s) => {
325
- v(B.operation, C.search, i.value);
326
- }, W = (o) => {
327
- ue(), v(B.operation, o, i.value), (o === C.search || o === C.reset) && (h.value = !1, e.value = !1);
328
- }, se = (o) => u.value.validate(o), j = V(0), fe = (o) => {
329
- j.value = o + 32;
330
- }, me = () => {
331
- y.value = !y.value;
332
- }, ye = () => {
333
- h.value = !1, e.value = !0;
334
- }, ce = () => {
335
- e.value = !1, h.value = !0;
336
- }, Q = V(!1), X = (o) => {
337
- Q.value = o > c.maxHeight;
338
- }, ve = U(() => c.filterMode || y.value ? "10px" : "0");
339
- return be(() => {
340
- J(c.modelValue), X();
341
- }), ge(
342
- () => c.modelValue,
343
- (o) => {
344
- J(o);
345
- },
346
- { immediate: !0, deep: !0 }
347
- ), S({
348
- validate: se,
349
- getFormData: de,
350
- // clearValidate,
351
- // resetFields,
352
- // scrollToField,
353
- formRef: u
354
- }), (o, s) => (r(), $("div", {
355
- class: N(["relative overflow-hidden w-full", { flex: a.filterMode }])
356
- }, [
357
- w("div", {
358
- class: N({
359
- "is-collapsed overflow-hidden": !y.value
360
- })
361
- }, [
362
- f(t(_), null, {
363
- default: n(({ height: d }) => [
364
- D(M(X(d)) + " ", 1),
365
- f(q, {
366
- ref_key: "formRef",
367
- ref: u,
368
- items: G.value,
369
- "form-data": i.value,
370
- rules: l.value,
371
- "label-width": a.labelWidth,
372
- "label-position": a.labelPosition,
373
- inline: !0,
374
- "show-label": !a.filterMode,
375
- "min-width": a.minWidth,
376
- "is-filter-preview": a.filterMode,
377
- onChange: ie,
378
- onEnter: T
379
- }, F({
380
- default: n(() => [
381
- a.isExpand && !a.filterMode ? (r(), m(t(oe), {
382
- key: 0,
383
- "label-width": "0"
384
- }, {
385
- default: n(() => [
386
- w("div", Re, [
387
- f(t(_), null, {
388
- default: n(({ width: b }) => [
389
- D(M(fe(b)), 1)
390
- ]),
391
- _: 1
392
- })
393
- ])
394
- ]),
395
- _: 1
396
- })) : O("", !0)
397
- ]),
398
- _: 2
399
- }, [
400
- E(G.value, (b) => ({
401
- name: b.key,
402
- fn: n((he) => [
403
- k(o.$slots, b.key, A(H(he)), void 0, !0)
404
- ])
405
- }))
406
- ]), 1032, ["items", "form-data", "rules", "label-width", "label-position", "show-label", "min-width", "is-filter-preview"])
407
- ]),
408
- _: 3
409
- })
410
- ], 2),
411
- w("div", {
412
- class: N(["operation-buttons", {
413
- "absolute right-0 bg-fff text-right": a.isExpand && !a.filterMode,
414
- "text-left": a.filterMode
415
- }]),
416
- style: we({ bottom: ve.value })
417
- }, [
418
- a.filterMode ? (r(), $(x, { key: 0 }, [
419
- f(t(z), {
420
- onClick: s[0] || (s[0] = (d) => W(t(C).reset)),
421
- type: "default"
422
- }, {
423
- default: n(() => [...s[3] || (s[3] = [
424
- D("重置", -1)
425
- ])]),
426
- _: 1
427
- }),
428
- P.value?.length ? (r(), m(t(Me), {
429
- key: 0,
430
- visible: h.value,
431
- placement: "bottom-start",
432
- width: 628,
433
- trigger: "click"
434
- }, {
435
- reference: n(() => [
436
- f(t(z), {
437
- onClick: s[1] || (s[1] = (d) => h.value = !h.value),
438
- icon: t(Pe),
439
- type: "default"
440
- }, {
441
- default: n(() => [...s[4] || (s[4] = [
442
- D(" 筛选器 ", -1)
443
- ])]),
444
- _: 1
445
- }, 8, ["icon"])
446
- ]),
447
- default: n(() => [
448
- w("div", Te, [
449
- f(te, {
450
- content: "筛选器",
451
- fontSize: 16
452
- }),
453
- f(t(ee), {
454
- size: 16,
455
- onClick: ye
456
- }, {
457
- default: n(() => [
458
- f(t(Le))
459
- ]),
460
- _: 1
461
- })
462
- ]),
463
- f(q, {
464
- items: P.value,
465
- "form-data": i.value,
466
- "label-width": "auto",
467
- "label-position": "top",
468
- inline: !1,
469
- "show-label": !0,
470
- "is-filter": !0,
471
- "min-width": a.minWidth,
472
- class: "filter-form-popover overflow-y-auto",
473
- onEnter: T
474
- }, F({ _: 2 }, [
475
- E(P.value, (d) => ({
476
- name: d.key,
477
- fn: n((b) => [
478
- k(o.$slots, d.key, A(H(b)), void 0, !0)
479
- ])
480
- }))
481
- ]), 1032, ["items", "form-data", "min-width"]),
482
- w("div", je, [
483
- f(K, {
484
- "operation-list": a.operationList,
485
- onOperation: W
486
- }, F({ _: 2 }, [
487
- o.$slots.operation ? {
488
- name: "operation",
489
- fn: n(({ operationList: d }) => [
490
- k(o.$slots, "operation", { operationList: d }, void 0, !0)
491
- ]),
492
- key: "0"
493
- } : void 0
494
- ]), 1032, ["operation-list"])
495
- ])
496
- ]),
497
- _: 3
498
- }, 8, ["visible"])) : O("", !0)
499
- ], 64)) : (r(), $(x, { key: 1 }, [
500
- Q.value && a.isExpand ? (r(), m(t(z), {
501
- key: 0,
502
- icon: y.value ? t(We) : t(Be),
503
- text: "",
504
- onClick: me
505
- }, {
506
- default: n(() => [
507
- D(M(y.value ? "收起" : "展开"), 1)
508
- ]),
509
- _: 1
510
- }, 8, ["icon"])) : O("", !0),
511
- f(K, {
512
- "operation-list": a.operationList,
513
- onOperation: W
514
- }, F({ _: 2 }, [
515
- o.$slots.operation ? {
516
- name: "operation",
517
- fn: n(({ operationList: d }) => [
518
- k(o.$slots, "operation", { operationList: d }, void 0, !0)
519
- ]),
520
- key: "0"
521
- } : void 0
522
- ]), 1032, ["operation-list"])
523
- ], 64))
524
- ], 6),
525
- f(t(Se), {
526
- modelValue: e.value,
527
- "onUpdate:modelValue": s[2] || (s[2] = (d) => e.value = d),
528
- size: "628",
529
- "show-close": !1
530
- }, {
531
- header: n(() => [
532
- w("div", Ae, [
533
- f(te, {
534
- content: "筛选器",
535
- fontSize: 16
536
- }),
537
- f(t(ee), {
538
- size: 16,
539
- onClick: ce,
540
- class: "shrink-button"
541
- }, {
542
- default: n(() => [
543
- f(t(Ie))
544
- ]),
545
- _: 1
546
- })
547
- ])
548
- ]),
549
- default: n(() => [
550
- w("div", He, [
551
- f(q, {
552
- items: P.value,
553
- "form-data": i.value,
554
- "label-width": "auto",
555
- "label-position": "top",
556
- inline: !1,
557
- "show-label": !0,
558
- "is-filter": !0,
559
- "min-width": a.minWidth,
560
- onEnter: T
561
- }, F({ _: 2 }, [
562
- E(P.value, (d) => ({
563
- name: d.key,
564
- fn: n((b) => [
565
- k(o.$slots, d.key, A(H(b)), void 0, !0)
566
- ])
567
- }))
568
- ]), 1032, ["items", "form-data", "min-width"])
569
- ]),
570
- w("div", Ke, [
571
- f(K, {
572
- "operation-list": a.operationList,
573
- onOperation: W
574
- }, F({ _: 2 }, [
575
- o.$slots.operation ? {
576
- name: "operation",
577
- fn: n(({ operationList: d }) => [
578
- k(o.$slots, "operation", { operationList: d }, void 0, !0)
579
- ]),
580
- key: "0"
581
- } : void 0
582
- ]), 1032, ["operation-list"])
583
- ])
584
- ]),
585
- _: 3
586
- }, 8, ["modelValue"])
587
- ], 2));
588
- }
589
- }), _e = /* @__PURE__ */ ne(qe, [["__scopeId", "data-v-146b7880"]]);
590
- export {
591
- _e as S
592
- };