color-star-custom-components 0.0.15 → 0.0.16
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/es/CustomSelect.mjs +1 -1
- package/es/IconRenderer.mjs +1 -1
- package/es/IconSelect.mjs +1 -1
- package/es/SearchBar.mjs +23 -26
- package/es/TreeShowSelect.mjs +26 -28
- package/es/assets/SearchBar.css +1 -1
- package/es/assets/TreeShowSelect.css +1 -1
- package/es/chunks/BatchImport.B5inubHt.js +173 -0
- package/es/chunks/CustomSelect.DvKTT1Kn.js +5 -0
- package/es/chunks/CustomTitle.BBrGK8vA.js +5 -0
- package/es/chunks/FileList.CLb0j2ca.js +5 -0
- package/es/chunks/GlassProxy.Dek3zo-k.js +176 -0
- package/es/chunks/IconEmpty.DoCNu0jY.js +5 -0
- package/es/chunks/IconRenderer.DbLSQXFZ.js +60 -0
- package/es/chunks/IconSelect.DjNvTfvM.js +162 -0
- package/es/chunks/SearchBar.Dw1qAtAa.js +582 -0
- package/es/chunks/TreeSelect.BkF207wh.js +5 -0
- package/es/chunks/TreeShowSelect.DuVWWk73.js +87 -0
- package/es/chunks/UploadFile.Cll5_hce.js +5 -0
- package/es/chunks/_plugin-vue_export-helper.BgwWMokO.js +6 -0
- package/es/chunks/chunk.CWVlkNTZ.js +18 -0
- package/es/chunks/config.SfJn1-ON.js +24 -0
- package/es/chunks/config.j-piuAWF.js +24 -0
- package/es/chunks/config.t_HHFoB9.js +18 -0
- package/es/chunks/global.31sZWaXJ.js +15282 -0
- package/es/chunks/global.BEeKea4u.js +1955 -0
- package/es/chunks/global.ChqJEry4.js +7973 -0
- package/es/chunks/global.CnGuevjX.js +8168 -0
- package/es/chunks/layout.4utLpDo3.js +120 -0
- package/es/chunks/layout.84FMC7pU.js +121 -0
- package/es/chunks/layout.BsFtxlIJ.js +31 -0
- package/es/chunks/layout.C5pEEv-d.js +207 -0
- package/es/chunks/layout.CokqBzin.js +338 -0
- package/es/chunks/layout.Dix22XYV.js +113 -0
- package/es/chunks/layout.FqoRQKdx.js +59 -0
- package/es/chunks/utils.BFFtVZUp.js +10 -0
- package/es/index.mjs +1 -1
- package/lib/CustomSelect.js +1 -1
- package/lib/IconRenderer.js +1 -1
- package/lib/IconSelect.js +1 -1
- package/lib/SearchBar.js +1 -1
- package/lib/TreeShowSelect.js +1 -1
- package/lib/assets/SearchBar.css +1 -1
- package/lib/assets/TreeShowSelect.css +1 -1
- package/lib/chunks/BatchImport.Be1Oddwm.js +1 -0
- package/lib/chunks/CustomSelect.qmizu8jb.js +1 -0
- package/lib/chunks/CustomTitle.C_V_RLwQ.js +1 -0
- package/lib/chunks/FileList.DK7Iz3hw.js +1 -0
- package/lib/chunks/GlassProxy.BurTd4Wo.js +1 -0
- package/lib/chunks/IconEmpty.MspO8cAH.js +1 -0
- package/lib/chunks/IconRenderer.CepZVN9N.js +1 -0
- package/lib/chunks/IconSelect.GFCG4dmy.js +1 -0
- package/lib/chunks/SearchBar.C1eP9H7z.js +1 -0
- package/lib/chunks/TreeSelect.CKdd24_v.js +1 -0
- package/lib/chunks/TreeShowSelect.D06Kgg9y.js +1 -0
- package/lib/chunks/UploadFile.FAeNJfgq.js +1 -0
- package/lib/chunks/_plugin-vue_export-helper.Bgn9wawX.js +1 -0
- package/lib/chunks/chunk.D6xVHP8F.js +1 -0
- package/lib/chunks/config.CQdd5R1R.js +1 -0
- package/lib/chunks/config.x7rWDsG1.js +1 -0
- package/lib/chunks/global.BwmaGr1r.js +1 -0
- package/lib/chunks/global.C-GuAavy.js +1 -0
- package/lib/chunks/global.CCgRKoj5.js +1 -0
- package/lib/chunks/layout.0C5st371.js +1 -0
- package/lib/chunks/layout.966lkT12.js +1 -0
- package/lib/chunks/layout.C4airLP9.js +1 -0
- package/lib/chunks/layout.ChiWtlly.js +1 -0
- package/lib/chunks/layout.DF2j_cdu.js +1 -0
- package/lib/chunks/layout.DjMFll_s.js +1 -0
- package/lib/chunks/layout.DutPtWqI.js +1 -0
- package/lib/chunks/utils.a5Y3RKNY.js +1 -0
- package/lib/index.js +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.BgwWMokO.js";
|
|
2
|
+
import { t as IconEmpty } from "./IconEmpty.DoCNu0jY.js";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, h, mergeProps, nextTick, normalizeClass, onMounted, openBlock, ref, renderSlot, toDisplayString, unref, useAttrs, watch, withCtx, withModifiers } from "vue";
|
|
4
|
+
import { ElAutoResizer, ElIcon, ElInput, ElTreeV2 } from "element-plus";
|
|
5
|
+
import { IconDelete, IconRighttop, IconSearch } from "color-message-lingyun-vue";
|
|
6
|
+
import '../assets/layout4.css';function getComConfig(t) {
|
|
7
|
+
return {
|
|
8
|
+
name: "element-tree-line",
|
|
9
|
+
props: {
|
|
10
|
+
node: {
|
|
11
|
+
type: Object,
|
|
12
|
+
required: !0
|
|
13
|
+
},
|
|
14
|
+
data: { type: Object },
|
|
15
|
+
treeData: { type: Array },
|
|
16
|
+
indent: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default() {
|
|
19
|
+
return 16;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
showLabelLine: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !0
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
render(l) {
|
|
28
|
+
let u = t || l, d = this.getScopedSlot("default"), f = this.getScopedSlot("node-label"), p = this.getScopedSlot("after-node-label"), m = d ? this.getScopedSlotValue(d, {
|
|
29
|
+
node: this.node,
|
|
30
|
+
data: this.data
|
|
31
|
+
}) : [
|
|
32
|
+
f ? this.getScopedSlotValue(f, {
|
|
33
|
+
node: this.node,
|
|
34
|
+
data: this.data
|
|
35
|
+
}) : u("span", { class: "element-tree-node-label" }, this.node.label),
|
|
36
|
+
this.showLabelLine ? u("span", { class: "element-tree-node-label-line" }) : null,
|
|
37
|
+
this.getScopedSlotValue(p, {
|
|
38
|
+
node: this.node,
|
|
39
|
+
data: this.data
|
|
40
|
+
})
|
|
41
|
+
], g = [], _ = this.node;
|
|
42
|
+
for (; _;) {
|
|
43
|
+
let t = _.parent;
|
|
44
|
+
if (_.level === 1 && !_.parent) {
|
|
45
|
+
if (!this.treeData || !Array.isArray(this.treeData)) throw Error("if you using el-tree-v2 (Virtualized Tree) of element-plus,element-tree-line required data.");
|
|
46
|
+
t = {
|
|
47
|
+
children: Array.isArray(this.treeData) ? this.treeData.map((t) => ({
|
|
48
|
+
...t,
|
|
49
|
+
key: t.id
|
|
50
|
+
})) : [],
|
|
51
|
+
level: 0,
|
|
52
|
+
key: "node-0",
|
|
53
|
+
parent: null
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (t) {
|
|
57
|
+
let l = (t.children || t.childNodes).findIndex((t) => (t.key || t.id) === (_.key || _.id));
|
|
58
|
+
g.unshift(l === (t.children || t.childNodes).length - 1);
|
|
59
|
+
}
|
|
60
|
+
_ = t;
|
|
61
|
+
}
|
|
62
|
+
let v = [];
|
|
63
|
+
for (let t = 0; t < this.node.level; t++) g[t] && this.node.level - 1 !== t || v.push(u("span", {
|
|
64
|
+
class: {
|
|
65
|
+
"element-tree-node-line-ver": !0,
|
|
66
|
+
"last-node-isLeaf-line": g[t] && this.node.level - 1 === t
|
|
67
|
+
},
|
|
68
|
+
style: { left: this.indent * t + "px" }
|
|
69
|
+
}));
|
|
70
|
+
return u("span", { class: "element-tree-node-label-wrapper" }, [m].concat(v, [u("span", {
|
|
71
|
+
class: "element-tree-node-line-hor",
|
|
72
|
+
style: {
|
|
73
|
+
width: (this.node.isLeaf ? 24 : 8) + "px",
|
|
74
|
+
left: (this.node.level - 1) * this.indent + "px"
|
|
75
|
+
}
|
|
76
|
+
})]));
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
getScopedSlot(t) {
|
|
80
|
+
if (!t) return null;
|
|
81
|
+
let l = t.split("||"), u = null;
|
|
82
|
+
for (let t = 0; t < l.length; t++) {
|
|
83
|
+
let d = l[t], f = (this.$slots || {})[d];
|
|
84
|
+
if (f) {
|
|
85
|
+
u = f;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if (u = (this.$scopedSlots || {})[d], u) break;
|
|
89
|
+
}
|
|
90
|
+
return u;
|
|
91
|
+
},
|
|
92
|
+
getScopedSlotValue(t, l, u = null) {
|
|
93
|
+
return typeof t == "function" ? t(l) || u : t || u;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function getElementLabelLine(t) {
|
|
99
|
+
let l = getComConfig(t);
|
|
100
|
+
return t && (l.methods.getScopedSlot = function(t) {
|
|
101
|
+
if (!t) return null;
|
|
102
|
+
let l = t.split("||"), u = null;
|
|
103
|
+
for (let t = 0; t < l.length; t++) {
|
|
104
|
+
let d = l[t], f = (this.$slots || {})[d];
|
|
105
|
+
if (f) {
|
|
106
|
+
u = f;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return u;
|
|
111
|
+
}), l;
|
|
112
|
+
}
|
|
113
|
+
getElementLabelLine();
|
|
114
|
+
var _hoisted_1 = { class: "w-full h-full flex flex-col overflow-hidden" }, _hoisted_2 = {
|
|
115
|
+
key: 0,
|
|
116
|
+
class: "mg-b-16"
|
|
117
|
+
}, _hoisted_3 = {
|
|
118
|
+
key: 0,
|
|
119
|
+
class: "list-item flex justify-between pd-l-6 pd-r-6 radius-8 items-center w-full"
|
|
120
|
+
}, _hoisted_4 = ["onClick"], _hoisted_5 = { key: 1 }, layout_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ name: "TreeSelect" }, {
|
|
121
|
+
__name: "layout",
|
|
122
|
+
props: {
|
|
123
|
+
modelValue: {
|
|
124
|
+
type: Object,
|
|
125
|
+
default: () => []
|
|
126
|
+
},
|
|
127
|
+
treeProps: {
|
|
128
|
+
type: Object,
|
|
129
|
+
default: () => ({
|
|
130
|
+
value: "id",
|
|
131
|
+
label: "label",
|
|
132
|
+
children: "children"
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
apiConfig: { type: Function },
|
|
136
|
+
reqParams: {
|
|
137
|
+
type: Object,
|
|
138
|
+
default: () => ({})
|
|
139
|
+
},
|
|
140
|
+
autoLoad: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: !0
|
|
143
|
+
},
|
|
144
|
+
isMultiple: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: !0
|
|
147
|
+
},
|
|
148
|
+
hasFilter: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: !1
|
|
151
|
+
},
|
|
152
|
+
isListMode: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: !1
|
|
155
|
+
},
|
|
156
|
+
treeList: {
|
|
157
|
+
type: Array,
|
|
158
|
+
default: () => []
|
|
159
|
+
},
|
|
160
|
+
hasTreeLine: {
|
|
161
|
+
type: Boolean,
|
|
162
|
+
default: !0
|
|
163
|
+
},
|
|
164
|
+
includeParentSelected: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: !1
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
emits: [
|
|
170
|
+
"handleCheck",
|
|
171
|
+
"handleDeleteNode",
|
|
172
|
+
"initFinish"
|
|
173
|
+
],
|
|
174
|
+
setup(t, { expose: y, emit: b }) {
|
|
175
|
+
let x = getElementLabelLine(h), S = t, C = b, w = useAttrs(), T = () => h(IconRighttop, { style: {
|
|
176
|
+
color: "var(--text-color-2)",
|
|
177
|
+
fontSize: "16px"
|
|
178
|
+
} }), E = S.isMultiple ? 20 : 10, D = S.isMultiple ? 15 : 11, O = ref([]), k = ref(null), A = ref(null), j = computed(() => S.treeProps.value), M = computed(() => S.treeProps.label), N = computed(() => S.treeProps.children), P = ref(!1), F = computed(() => !S.isMultiple && P.value), I = computed(() => typeof S.apiConfig == "function"), L = () => {
|
|
179
|
+
let t = k.value?.getCheckedNodes(), l = t.map((t) => t[j.value]), u = [];
|
|
180
|
+
return t.length && !S.includeParentSelected && (t = t.filter((t) => !t[N.value]), l = t.map((t) => t[j.value])), S.includeParentSelected && (u = R(O.value, l)), {
|
|
181
|
+
selectedNodeValues: l,
|
|
182
|
+
selectedNodes: t,
|
|
183
|
+
selectedParentNodes: u
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
function R(t, l) {
|
|
187
|
+
let u = /* @__PURE__ */ new Map();
|
|
188
|
+
function d(t, f = []) {
|
|
189
|
+
for (let p of t) {
|
|
190
|
+
let t = [...f, p];
|
|
191
|
+
p.children && p.children.length > 0 ? d(p.children, t) : l.includes(p.id) && f.forEach((t) => {
|
|
192
|
+
u.has(t.id) || u.set(t.id, { ...t });
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return d(t), Array.from(u.values());
|
|
197
|
+
}
|
|
198
|
+
let z = (t) => {
|
|
199
|
+
!S.isMultiple || S.isListMode || K();
|
|
200
|
+
}, B = (t, l) => {
|
|
201
|
+
S.isMultiple || S.isListMode || (P.value = !0, A.value = l.key, C("handleCheck", {
|
|
202
|
+
selectedValue: [A.value],
|
|
203
|
+
selectedNode: [l.data]
|
|
204
|
+
}));
|
|
205
|
+
}, V = ref(""), H = (t) => {
|
|
206
|
+
k.value.filter(t);
|
|
207
|
+
}, U = (t, l) => l[M.value].includes(t), W = (t) => {
|
|
208
|
+
let l = 0;
|
|
209
|
+
function u(t) {
|
|
210
|
+
for (let d of t) {
|
|
211
|
+
let t = d[N.value] && d[N.value].length > 0;
|
|
212
|
+
S.includeParentSelected ? l++ : t || l++, t && u(d[N.value]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return u(t), l;
|
|
216
|
+
}, G = computed(() => W(O.value));
|
|
217
|
+
function K() {
|
|
218
|
+
let { selectedNodeValues: t, selectedNodes: l, selectedParentNodes: u } = L();
|
|
219
|
+
C("handleCheck", {
|
|
220
|
+
selectedValue: t,
|
|
221
|
+
selectedNode: l,
|
|
222
|
+
selectedParentNodes: u
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
let q = (t, l) => {
|
|
226
|
+
k.value?.setChecked(t, l), K();
|
|
227
|
+
}, J = () => {
|
|
228
|
+
w["default-checked-keys"] && nextTick(() => {
|
|
229
|
+
K();
|
|
230
|
+
});
|
|
231
|
+
}, Y = (t) => {
|
|
232
|
+
C("handleDeleteNode", t);
|
|
233
|
+
}, X = (t) => t?.map((t) => ({
|
|
234
|
+
...t,
|
|
235
|
+
[N.value]: t[N.value]?.length ? X(t[N.value]) : void 0
|
|
236
|
+
})), Z = async () => {
|
|
237
|
+
I.value ? S.apiConfig(S.reqParams)?.then((t) => {
|
|
238
|
+
O.value = X(t?.data || []), J(), $(S.modelValue), C("initFinish", O.value);
|
|
239
|
+
}) : Q();
|
|
240
|
+
}, Q = () => {
|
|
241
|
+
S.isListMode ? O.value = X(S.treeList || []) : (O.value = X(S.treeList || []), O.value.length && (J(), $(S.modelValue)));
|
|
242
|
+
}, $ = (t) => {
|
|
243
|
+
let l = t && t.length && t.map((t) => t[S.treeProps.value]);
|
|
244
|
+
nextTick(() => {
|
|
245
|
+
k.value?.setCheckedKeys(l);
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
return watch(() => S.treeList, () => {
|
|
249
|
+
Q();
|
|
250
|
+
}, { deep: !0 }), watch(() => S.modelValue, (t) => {
|
|
251
|
+
nextTick(() => {
|
|
252
|
+
$(t);
|
|
253
|
+
});
|
|
254
|
+
}, { deep: !0 }), onMounted(() => {
|
|
255
|
+
Z();
|
|
256
|
+
}), y({
|
|
257
|
+
allNodeNumbers: G,
|
|
258
|
+
loadData: Z,
|
|
259
|
+
setNodeCheckStatus: q
|
|
260
|
+
}), (u, _) => (openBlock(), createElementBlock("div", _hoisted_1, [t.hasFilter ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(ElInput), {
|
|
261
|
+
modelValue: V.value,
|
|
262
|
+
"onUpdate:modelValue": _[0] ||= (t) => V.value = t,
|
|
263
|
+
placeholder: "请输入",
|
|
264
|
+
onInput: H
|
|
265
|
+
}, {
|
|
266
|
+
prefix: withCtx(() => [createVNode(unref(ElIcon), {
|
|
267
|
+
size: 16,
|
|
268
|
+
color: "var(--neutral-color-12)",
|
|
269
|
+
class: "mg-r-4"
|
|
270
|
+
}, {
|
|
271
|
+
default: withCtx(() => [createVNode(unref(IconSearch))]),
|
|
272
|
+
_: 1
|
|
273
|
+
})]),
|
|
274
|
+
_: 1
|
|
275
|
+
}, 8, ["modelValue"])])) : createCommentVNode("", !0), createElementVNode("div", { class: normalizeClass([t.hasFilter ? "pd-l-8 pd-r-8" : "", "flex-1 overflow-hidden"]) }, [createVNode(unref(ElAutoResizer), null, {
|
|
276
|
+
default: withCtx(({ width: f, height: _ }) => [createVNode(unref(ElTreeV2), mergeProps({
|
|
277
|
+
ref_key: "treeRef",
|
|
278
|
+
ref: k,
|
|
279
|
+
height: _,
|
|
280
|
+
width: f,
|
|
281
|
+
data: O.value,
|
|
282
|
+
props: t.treeProps,
|
|
283
|
+
"node-key": j.value,
|
|
284
|
+
"show-checkbox": t.isMultiple && !t.isListMode,
|
|
285
|
+
"item-size": 34,
|
|
286
|
+
indent: unref(E),
|
|
287
|
+
"highlight-current": F.value,
|
|
288
|
+
icon: t.isListMode ? "" : T,
|
|
289
|
+
"filter-method": U
|
|
290
|
+
}, unref(w), {
|
|
291
|
+
onNodeClick: B,
|
|
292
|
+
onCheck: z
|
|
293
|
+
}), {
|
|
294
|
+
default: withCtx(({ node: l }) => [t.isListMode ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(u.$slots, "node", {
|
|
295
|
+
node: l,
|
|
296
|
+
data: l.data
|
|
297
|
+
}, () => [createElementVNode("span", null, toDisplayString(l.data[M.value]), 1)], !0), createElementVNode("div", {
|
|
298
|
+
class: "flex items-center",
|
|
299
|
+
onClick: withModifiers((t) => Y(l.data), ["stop"])
|
|
300
|
+
}, [createVNode(unref(ElIcon), {
|
|
301
|
+
size: 14,
|
|
302
|
+
color: "var(--neutral-color-5)"
|
|
303
|
+
}, {
|
|
304
|
+
default: withCtx(() => [createVNode(unref(IconDelete))]),
|
|
305
|
+
_: 1
|
|
306
|
+
})], 8, _hoisted_4)])) : renderSlot(u.$slots, "node", {
|
|
307
|
+
key: 1,
|
|
308
|
+
node: l,
|
|
309
|
+
data: l.data
|
|
310
|
+
}, () => [t.hasTreeLine ? (openBlock(), createBlock(unref(x), {
|
|
311
|
+
key: 0,
|
|
312
|
+
node: l,
|
|
313
|
+
treeData: O.value,
|
|
314
|
+
showLabelLine: !1,
|
|
315
|
+
indent: unref(D)
|
|
316
|
+
}, null, 8, [
|
|
317
|
+
"node",
|
|
318
|
+
"treeData",
|
|
319
|
+
"indent"
|
|
320
|
+
])) : (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(l.data[M.value]), 1))], !0)]),
|
|
321
|
+
empty: withCtx(() => [createVNode(unref(IconEmpty))]),
|
|
322
|
+
_: 3
|
|
323
|
+
}, 16, [
|
|
324
|
+
"height",
|
|
325
|
+
"width",
|
|
326
|
+
"data",
|
|
327
|
+
"props",
|
|
328
|
+
"node-key",
|
|
329
|
+
"show-checkbox",
|
|
330
|
+
"indent",
|
|
331
|
+
"highlight-current",
|
|
332
|
+
"icon"
|
|
333
|
+
])]),
|
|
334
|
+
_: 3
|
|
335
|
+
})], 2)]));
|
|
336
|
+
}
|
|
337
|
+
}), [["__scopeId", "data-v-1466e8fd"]]);
|
|
338
|
+
export { layout_default as t };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { computed, createBlock, mergeProps, nextTick, onMounted, openBlock, ref, resolveDynamicComponent, unref, watch } from "vue";
|
|
2
|
+
import { ElSelectV2, ElTreeSelect } from "element-plus";
|
|
3
|
+
import { emitsMap } from "color-star-custom-methods";
|
|
4
|
+
var layout_default = /* @__PURE__ */ Object.assign({ name: "CustomSelect" }, {
|
|
5
|
+
__name: "layout",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: [
|
|
9
|
+
String,
|
|
10
|
+
Number,
|
|
11
|
+
Array,
|
|
12
|
+
Object
|
|
13
|
+
],
|
|
14
|
+
default: () => null
|
|
15
|
+
},
|
|
16
|
+
clearable: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !0
|
|
19
|
+
},
|
|
20
|
+
filterable: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !0
|
|
23
|
+
},
|
|
24
|
+
collapseTags: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !0
|
|
27
|
+
},
|
|
28
|
+
multiple: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
apiConfig: { type: Function },
|
|
33
|
+
mapping: {
|
|
34
|
+
type: Object,
|
|
35
|
+
default: () => ({
|
|
36
|
+
label: "label",
|
|
37
|
+
value: "value",
|
|
38
|
+
disabled: "disabled",
|
|
39
|
+
children: "children"
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
staticOptions: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: () => []
|
|
45
|
+
},
|
|
46
|
+
autoLoad: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !0
|
|
49
|
+
},
|
|
50
|
+
params: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => ({})
|
|
53
|
+
},
|
|
54
|
+
isTreeSelect: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: !1
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
emits: [emitsMap.updateModelValue, emitsMap.change],
|
|
60
|
+
setup(p, { expose: m, emit: h }) {
|
|
61
|
+
let g = p, _ = h, v = ref(g.modelValue), y = ref([]), b = computed(() => typeof g.apiConfig == "function"), x = computed(() => g.staticOptions.length > 0 ? g.staticOptions : y.value), S = computed(() => g.isTreeSelect ? "data" : "options"), C = computed(() => g.isTreeSelect ? "children" : "options"), w = computed(() => ({
|
|
62
|
+
...g.mapping,
|
|
63
|
+
[C.value]: g.mapping.children
|
|
64
|
+
})), T = async () => {
|
|
65
|
+
b.value && g.apiConfig(g.params)?.then((e) => {
|
|
66
|
+
y.value = E(e?.data || []);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
function E(e, u = !1) {
|
|
70
|
+
return e.map((e) => {
|
|
71
|
+
let d = u || e.isEnabled === 0, f = {
|
|
72
|
+
...e,
|
|
73
|
+
disabled: d
|
|
74
|
+
};
|
|
75
|
+
return e.children && e.children.length > 0 && (f.children = E(e.children, d)), f;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
let D = () => {
|
|
79
|
+
_(emitsMap.updateModelValue, v.value), _(emitsMap.change, v.value);
|
|
80
|
+
};
|
|
81
|
+
return m({
|
|
82
|
+
clear: () => {
|
|
83
|
+
y.value = [], v.value = g.multiple ? [] : null;
|
|
84
|
+
},
|
|
85
|
+
loadData: T
|
|
86
|
+
}), onMounted(() => {
|
|
87
|
+
g.autoLoad && b.value && nextTick(() => {
|
|
88
|
+
T();
|
|
89
|
+
});
|
|
90
|
+
}), watch(() => g.modelValue, (e) => {
|
|
91
|
+
v.value = e;
|
|
92
|
+
}, { immediate: !0 }), (e, f) => (openBlock(), createBlock(resolveDynamicComponent(p.isTreeSelect ? unref(ElTreeSelect) : unref(ElSelectV2)), mergeProps({
|
|
93
|
+
modelValue: v.value,
|
|
94
|
+
"onUpdate:modelValue": f[0] ||= (e) => v.value = e,
|
|
95
|
+
props: w.value,
|
|
96
|
+
multiple: p.multiple,
|
|
97
|
+
"collapse-tags": p.collapseTags,
|
|
98
|
+
filterable: p.filterable,
|
|
99
|
+
clearable: p.clearable,
|
|
100
|
+
[S.value || ""]: x.value,
|
|
101
|
+
"node-key": p.mapping.value
|
|
102
|
+
}, e.$attrs, { onChange: D }), null, 16, [
|
|
103
|
+
"modelValue",
|
|
104
|
+
"props",
|
|
105
|
+
"multiple",
|
|
106
|
+
"collapse-tags",
|
|
107
|
+
"filterable",
|
|
108
|
+
"clearable",
|
|
109
|
+
"node-key"
|
|
110
|
+
]));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
export { layout_default as t };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, normalizeStyle, onMounted, openBlock, ref, resolveDynamicComponent, shallowRef, toDisplayString, unref, withCtx } from "vue";
|
|
2
|
+
import { ElIcon } from "element-plus";
|
|
3
|
+
var _hoisted_1 = { class: "icon-empty flex flex-col items-center justify-center" }, layout_default = /* @__PURE__ */ Object.assign({ name: "IconEmpty" }, {
|
|
4
|
+
__name: "layout",
|
|
5
|
+
props: {
|
|
6
|
+
icon: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
iconSize: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 64
|
|
13
|
+
},
|
|
14
|
+
iconColor: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "#c0c4cc"
|
|
17
|
+
},
|
|
18
|
+
text: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "暂无数据"
|
|
21
|
+
},
|
|
22
|
+
textColor: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "#909399"
|
|
25
|
+
},
|
|
26
|
+
textSize: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 14
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
setup(h) {
|
|
32
|
+
let g = h, _ = computed(() => ({
|
|
33
|
+
color: g.textColor,
|
|
34
|
+
fontSize: `${g.textSize}px`
|
|
35
|
+
})), v = shallowRef(null), y = async () => {
|
|
36
|
+
if (g.icon) return g.icon;
|
|
37
|
+
try {
|
|
38
|
+
return (await import("color-message-lingyun-vue")).IconEmpty;
|
|
39
|
+
} catch {
|
|
40
|
+
return console.warn("color-message-lingyun-vue not found, IconEmpty will not be displayed"), null;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return onMounted(async () => {
|
|
44
|
+
v.value = await y();
|
|
45
|
+
}), (e, m) => (openBlock(), createElementBlock("div", _hoisted_1, [v.value ? (openBlock(), createBlock(unref(ElIcon), {
|
|
46
|
+
key: 0,
|
|
47
|
+
size: h.iconSize,
|
|
48
|
+
color: h.iconColor,
|
|
49
|
+
class: "icon-empty-icon"
|
|
50
|
+
}, {
|
|
51
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(v.value)))]),
|
|
52
|
+
_: 1
|
|
53
|
+
}, 8, ["size", "color"])) : createCommentVNode("", !0), createElementVNode("div", {
|
|
54
|
+
class: "icon-empty-text",
|
|
55
|
+
style: normalizeStyle(_.value)
|
|
56
|
+
}, toDisplayString(h.text), 5)]));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export { layout_default as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "./chunk.CWVlkNTZ.js";
|
|
2
|
+
var require___vite_browser_external = /* @__PURE__ */ __commonJSMin(((e, n) => {
|
|
3
|
+
n.exports = {};
|
|
4
|
+
}));
|
|
5
|
+
require___vite_browser_external(), require___vite_browser_external();
|
|
6
|
+
const withInstall = (e) => (e.install = (n) => {
|
|
7
|
+
let r = e.name || e.__name;
|
|
8
|
+
n.component(r, e);
|
|
9
|
+
}, e);
|
|
10
|
+
export { withInstall as t };
|
package/es/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { FileList as a } from "./FileList.mjs";
|
|
|
10
10
|
import { BatchImport as s } from "./BatchImport.mjs";
|
|
11
11
|
import { TreeSelect as S } from "./TreeSelect.mjs";
|
|
12
12
|
import { TreeShowSelect as d } from "./TreeShowSelect.mjs";
|
|
13
|
-
import { i as u } from "./chunks/config.
|
|
13
|
+
import { i as u } from "./chunks/config.j-piuAWF.js";
|
|
14
14
|
import { dayjs as y } from "element-plus";
|
|
15
15
|
const o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
16
16
|
__proto__: null,
|
package/lib/CustomSelect.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./chunks/index.CkihWzK6.js"),u=require("./chunks/layout.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./chunks/index.CkihWzK6.js"),u=require("./chunks/layout.DF2j_cdu.js"),e=t.withInstall(u._sfc_main);exports.CustomSelect=e;exports.default=e;
|
package/lib/IconRenderer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/IconRenderer.css');const u=require("./chunks/index.CkihWzK6.js"),e=require("vue"),s=require("element-plus"),a=require("./chunks/config.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/IconRenderer.css');const u=require("./chunks/index.CkihWzK6.js"),e=require("vue"),s=require("element-plus"),a=require("./chunks/config.CQdd5R1R.js"),d=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),m=Object.assign({name:"IconRenderer"},{__name:"layout",props:{iconName:{type:String,default:""},iconLibrary:{type:String,default:a.iconLibraryMap.lingyun,validator:o=>Object.values(a.iconLibraryMap).includes(o)},size:{type:Number,default:16},color:{type:String,default:""}},setup(o){e.useCssVars(n=>({c078896a:o.color}));const t=o,r=e.shallowRef(null),c=e.ref(!1),l=async()=>{if(!t.iconName){r.value=null;return}if(!c.value){c.value=!0;try{const n=await a.getIconComponent(t.iconLibrary,t.iconName);r.value=n}catch(n){console.error("Failed to load icon component:",n),r.value=null}finally{c.value=!1}}};return e.watch(()=>[t.iconLibrary,t.iconName],()=>{l()},{immediate:!1}),e.onMounted(()=>{l()}),(n,y)=>o.iconName&&r.value?(e.openBlock(),e.createBlock(e.unref(s.ElIcon),e.mergeProps({key:0,size:o.size,color:o.color},n.$attrs),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value)))]),_:1},16,["size","color"])):e.createCommentVNode("",!0)}}),p=d._export_sfc(m,[["__scopeId","data-v-563503ea"]]),i=u.withInstall(p);exports.iconLibraryMap=a.iconLibraryMap;exports.IconRenderer=i;exports.default=i;
|
package/lib/IconSelect.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./assets/IconSelect.css');var S=Object.create;var b=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var j=(o,a,l,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of V(a))!N.call(o,r)&&r!==l&&b(o,r,{get:()=>a[r],enumerable:!(m=_(a,r))||m.enumerable});return o};var z=(o,a,l)=>(l=o!=null?S(E(o)):{},j(a||!o||!o.__esModule?b(l,"default",{value:o,enumerable:!0}):l,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./chunks/index.CkihWzK6.js"),e=require("vue"),s=require("element-plus"),A=require("./chunks/layout.ikdn8BHo.js"),y=require("./chunks/config.
|
|
1
|
+
"use strict";require('./assets/IconSelect.css');var S=Object.create;var b=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var j=(o,a,l,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of V(a))!N.call(o,r)&&r!==l&&b(o,r,{get:()=>a[r],enumerable:!(m=_(a,r))||m.enumerable});return o};var z=(o,a,l)=>(l=o!=null?S(E(o)):{},j(a||!o||!o.__esModule?b(l,"default",{value:o,enumerable:!0}):l,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./chunks/index.CkihWzK6.js"),e=require("vue"),s=require("element-plus"),A=require("./chunks/layout.ikdn8BHo.js"),y=require("./chunks/config.CQdd5R1R.js"),M=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),O={class:"icon-select-content flex flex-col overflow-hidden"},q={key:0,class:"no-data flex items-center justify-center w-full"},D={key:1,class:"icon-select-grid overflow-y-auto display-grid"},P={key:0,class:"loading-text flex items-center justify-center w-full"},F=["title","onClick"],R=Object.assign({name:"IconSelect"},{__name:"layout",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:"请选择图标"},width:{type:Number,default:520},iconSize:{type:Number,default:62},library:{type:String,default:y.iconLibraryMap.lingyun,validator:o=>Object.values(y.iconLibraryMap).includes(o)},iconSearch:{type:Object,default:null},iconAdd:{type:Object,default:null},iconEmpty:{type:Object,default:null},iconColor:{type:String,default:""}},emits:["update:modelValue"],setup(o,{emit:a}){e.useCssVars(t=>({v051e54a2:o.iconColor}));const l=o,m=a,r=e.ref(!1),f=e.ref(""),i=e.ref(l.modelValue),u=e.ref(null),p=e.ref([]),k=e.ref(!1),d=e.shallowRef({IconSearch:null,IconAdd:null}),h=async t=>{const n=t==="search"?l.iconSearch:l.iconAdd;if(n)return n;try{return(await import("color-message-lingyun-vue"))[t==="search"?"IconSearch":"IconAdd"]}catch{return console.warn(`color-message-lingyun-vue not found, ${t} icon will not be displayed`),null}},B=async()=>{const[t,n]=await Promise.all([h("search"),h("add")]);return{IconSearch:t,IconAdd:n}},w=async()=>{k.value=!0;try{const t=await y.getIconLibrary(l.library);p.value=Object.entries(t).filter(([n])=>n.toLowerCase()&&!["default","icons"].includes(n)).map(([n,c])=>({name:n,component:e.markRaw(c)}))}catch(t){console.error("Failed to load icons:",t),p.value=[]}finally{k.value=!1}},I=e.computed(()=>f.value?p.value.filter(t=>t.name.toLowerCase().includes(f.value.toLowerCase())):p.value),v=async()=>{if(!i.value){u.value=null;return}const t=await y.getIconComponent(l.library,i.value);u.value=t?e.markRaw(t):null},C=t=>{i.value=t.name,m("update:modelValue",t.name),r.value=!1};return e.watch(()=>l.modelValue,t=>{i.value=t,v()}),e.watch(()=>l.library,()=>{w(),v()}),e.watch(()=>i.value,()=>{v()}),e.onMounted(async()=>{d.value=await B(),w(),v()}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(s.ElPopover),{visible:r.value,"onUpdate:visible":n[1]||(n[1]=c=>r.value=c),placement:"bottom-start",width:o.width,trigger:"click"},{reference:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center pointer radius-16 justify-center w-icon-item",{"select-icon-box bg-fcfdff text-202434 fz-14 flex-col":!u.value,"icon-item":i.value}])},[u.value?(e.openBlock(),e.createBlock(e.unref(s.ElIcon),{key:0,size:o.iconSize},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value)))]),_:1},8,["size"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[d.value.IconAdd?(e.openBlock(),e.createBlock(e.unref(s.ElIcon),{key:0,size:16},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value.IconAdd)))]),_:1})):e.createCommentVNode("",!0),n[2]||(n[2]=e.createTextVNode(" 上传 ",-1))],64))],2)]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(e.unref(s.ElInput),{class:"mg-b-12",modelValue:f.value,"onUpdate:modelValue":n[0]||(n[0]=c=>f.value=c),placeholder:"搜索图标",clearable:""},e.createSlots({_:2},[d.value.IconSearch?{name:"prefix",fn:e.withCtx(()=>[e.createVNode(e.unref(s.ElIcon),{size:16},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value.IconSearch)))]),_:1})]),key:"0"}:void 0]),1032,["modelValue"]),I.value.length===0?(e.openBlock(),e.createElementBlock("div",q,[e.createVNode(A._sfc_main,{icon:o.iconEmpty,text:"未找到相关图标"},null,8,["icon"])])):(e.openBlock(),e.createElementBlock("div",D,[k.value?(e.openBlock(),e.createElementBlock("div",P," 加载中... ")):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(I.value,c=>(e.openBlock(),e.createElementBlock("div",{key:c.name,class:e.normalizeClass(["icon-item radius-8 justify-center items-center pointer flex w-icon-item",{active:i.value===c.name}]),title:c.name,onClick:x=>C(c)},[e.createVNode(e.unref(s.ElIcon),{size:50},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.component)))]),_:2},1024)],10,F))),128))]))])]),_:1},8,["visible","width"]))}}),T=M._export_sfc(R,[["__scopeId","data-v-4106dcd4"]]),g=L.withInstall(T);exports.IconSelect=g;exports.default=g;
|
package/lib/SearchBar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/SearchBar.css');const K=require("./chunks/index.CkihWzK6.js"),e=require("vue"),d=require("element-plus"),g=require("color-message-lingyun-vue"),o=require("color-star-custom-methods"),G=require("./chunks/layout.Ch_1hhpJ.js"),J=require("./chunks/layout.whToBh0O.js"),P=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),S=require("./chunks/layout.DDB7i4jV.js"),Q=[{type:"primary",label:"查询",value:o.operationConfigMap.search},{type:"default",label:"重置",value:o.operationConfigMap.reset,plain:!0}],F=320,x={__name:"OperationButtons",props:{operationList:{type:Array,default:()=>[]}},emits:[o.emitsMap.operation],setup(a,{emit:h}){const p=h,i=c=>{p(o.emitsMap.operation,c)};return(c,n)=>c.$slots.operation?e.renderSlot(c.$slots,"operation",{key:0,operationList:a.operationList}):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.operationList,f=>(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:f.value,type:f.type,icon:f.icon,plain:f.plain,onClick:t=>i(f.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["type","icon","plain","onClick"]))),128))}},X=Object.assign({name:"FormWrapper"},{__name:"FormWrapper",props:{items:{type:Array,default:()=>[]},formData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:"auto"},labelPosition:{type:String,default:o.labelPositionMap.right},showLabel:{type:Boolean,default:!0},inline:{type:Boolean,default:!1},isFilter:{type:Boolean,default:!1},isFilterPreview:{type:Boolean,default:!1},minWidth:{type:Number,default:F},fixedWidth:{type:Boolean,default:!1}},emits:[o.emitsMap.change,o.emitsMap.enter],setup(a,{expose:h}){e.useCssVars(n=>({v1bc7ee80:a.minWidth+"px"}));const p=a,i=e.ref(null),c=e.computed(()=>p.isFilter?"filter-form":p.isFilterPreview?"filter-preview-form":p.fixedWidth?"search-bar-form search-bar-form-fixed":"search-bar-form");return h({validate:n=>i.value?i.value.validate(n):Promise.resolve(!0),resetFields:()=>{i.value&&i.value.resetFields()},clearValidate:n=>{i.value&&i.value.clearValidate(n)},scrollToField:n=>{i.value&&i.value.scrollToField(n)}}),(n,f)=>(e.openBlock(),e.createBlock(e.unref(d.ElForm),{ref_key:"formRef",ref:i,model:a.formData,"label-width":a.labelWidth,"label-position":a.labelPosition,inline:a.inline,rules:a.rules,class:e.normalizeClass({[c.value]:!0,"items-end display-grid":!a.isFilterPreview}),onSubmit:f[0]||(f[0]=e.withModifiers(()=>{},["prevent","stop"]))},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.items,t=>(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),e.mergeProps({key:t.key,label:a.showLabel?t.label:"",prop:t.key,"show-label":a.showLabel,class:[{"search-bar-item--wide":t.wide}]},{ref_for:!0},t),{default:e.withCtx(()=>[e.renderSlot(n.$slots,t.key,{item:t,formData:a.formData},()=>[t.type===e.unref(o.componentType).text?(e.openBlock(),e.createBlock(e.unref(d.ElInput),e.mergeProps({key:0,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{class:"w-full",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key]),onKeyup:e.withKeys(l=>n.$emit(e.unref(o.emitsMap).enter,t.key,a.formData[t.key]),["enter"])}),null,16,["modelValue","onUpdate:modelValue","onChange","onKeyup"])):t.type===e.unref(o.componentType).select?(e.openBlock(),e.createBlock(G._sfc_main,e.mergeProps({key:1,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l,"static-options":t.options},{ref_for:!0},t,{onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key]),class:"w-full"}),null,16,["modelValue","onUpdate:modelValue","static-options","onChange"])):t.type===e.unref(o.componentType).date?(e.openBlock(),e.createBlock(e.unref(d.ElDatePicker),e.mergeProps({key:2,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},{...e.unref(o.dateParamsMap)[t.dateType],...t},{type:t.dateType,format:t.format||e.unref(o.dateFormat).date,"value-format":t.valueFormat||e.unref(o.dateFormat).dateTime,class:"w-full",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","type","format","value-format","onChange"])):t.type===e.unref(o.componentType).inputNumber?(e.openBlock(),e.createBlock(e.unref(d.ElInputNumber),e.mergeProps({key:3,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{class:"w-full",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).switch?(e.openBlock(),e.createBlock(e.unref(d.ElSwitch),e.mergeProps({key:4,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).radio?(e.openBlock(),e.createBlock(e.unref(d.ElRadioGroup),{key:5,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l,onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,l=>(e.openBlock(),e.createBlock(e.unref(d.ElRadio),{key:l.value,label:l.value,value:l.value,disabled:l.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).checkbox?(e.openBlock(),e.createBlock(e.unref(d.ElCheckboxGroup),{key:6,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l,onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,l=>(e.openBlock(),e.createBlock(e.unref(d.ElCheckbox),{key:l.value,label:l.value,value:l.value,disabled:l.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).textarea?(e.openBlock(),e.createBlock(e.unref(d.ElInput),e.mergeProps({key:7,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{class:"w-full",type:"textarea",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).upload?(e.openBlock(),e.createBlock(J._layout,e.mergeProps({key:8,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t),null,16,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],!0)]),_:2},1040,["label","prop","show-label","class"]))),128)),e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["model","label-width","label-position","inline","rules","class"]))}}),E=P._export_sfc(X,[["__scopeId","data-v-79352bf5"]]),Y={class:"h-32 w-full"},Z={class:"flex items-center justify-between pd-b-20"},_={class:"text-right"},ee={class:"drawer-header"},te={class:"flex-1 pd-l-16 pd-r-16 overflow-y-auto"},ae={class:"text-right border-top pd-t-16 pd-l-16 pd-r-16"},le=Object.assign({name:"SearchBar"},{__name:"layout",props:{items:{type:Array,default:()=>[]},modelValue:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:"auto"},labelPosition:{type:String,default:o.labelPositionMap.right,validator:a=>[o.labelPositionMap.left,o.labelPositionMap.right,o.labelPositionMap.top].includes(a)},isExpand:{type:Boolean,default:!0},maxHeight:{type:Number,default:84},minWidth:{type:Number,default:F},operationList:{type:Array,default:Q},filterMode:{type:Boolean,default:!0},hideExpandButton:{type:Boolean,default:!0},fixedWidth:{type:Boolean,default:!1}},emits:[o.emitsMap.updateModelValue,o.emitsMap.operation,o.emitsMap.change],setup(a,{expose:h,emit:p}){e.useCssVars(r=>({c43334b4:a.maxHeight+"px",v002cf482:b.value?b.value+"px":"100%"}));const i=a,c=p,n=e.ref({}),f=e.ref(!i.isExpand),t=e.ref(null),l=e.ref(!1),y=e.ref(!1),V=e.ref(!1),W=e.computed(()=>{const r={};return i.items.forEach(u=>{if(u.required){const s=[{required:!0,message:`${u.label}不能为空`,trigger:"blur"}];typeof u.validator=="function"&&s.push({validator:u.validator,trigger:"blur"}),r[u.key]=s}}),r}),w=e.computed(()=>i.items?.filter(r=>!r.hidden)||[]),M=e.computed(()=>i.filterMode?w.value?.slice(0,2)||[]:w.value),k=e.computed(()=>i.filterMode?w.value.slice(2):[]),D=r=>{n.value={...r}},L=()=>{c(o.emitsMap.updateModelValue,{...n.value})},U=(r,u)=>{n.value[r]=u,V.value=!0,v(o.operationConfigMap.search),setTimeout(()=>{V.value=!1},200),C(r,u)},C=(r,u)=>{r&&c(o.emitsMap.change,r,u)},I=()=>n.value,B=(r,u)=>{V.value||c(o.emitsMap.operation,o.operationConfigMap.search,n.value)},v=r=>{L(),c(o.emitsMap.operation,r,n.value),(r===o.operationConfigMap.search||r===o.operationConfigMap.reset)&&(l.value=!1,y.value=!1)},z=r=>t.value.validate(r),b=e.ref(0),O=r=>{if(i.fixedWidth){b.value=132;return}b.value=r+32},R=()=>{f.value=!f.value},q=()=>{l.value=!1,y.value=!0},j=()=>{y.value=!1,l.value=!0},N=e.ref(!1),$=r=>{N.value=r>i.maxHeight},A=e.computed(()=>i.filterMode||f.value?"10px":"0");return e.onMounted(()=>{D(i.modelValue),$()}),e.watch(()=>i.modelValue,r=>{D(r)},{immediate:!0,deep:!0}),h({validate:z,getFormData:I,formRef:t}),(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative overflow-hidden w-full",{flex:a.filterMode}])},[e.createElementVNode("div",{class:e.normalizeClass({"is-collapsed overflow-hidden":!f.value})},[e.createVNode(e.unref(d.ElAutoResizer),null,{default:e.withCtx(({height:s})=>[e.createTextVNode(e.toDisplayString($(s))+" ",1),e.createVNode(E,{ref_key:"formRef",ref:t,items:M.value,"form-data":n.value,rules:W.value,"label-width":a.labelWidth,"label-position":a.labelPosition,inline:!0,"show-label":!a.filterMode,"min-width":a.minWidth,"is-filter-preview":a.filterMode,fixedWidth:a.fixedWidth,onChange:U,onEnter:B},e.createSlots({default:e.withCtx(()=>[a.isExpand&&!a.filterMode?(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),{key:0,"label-width":"0"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.createVNode(e.unref(d.ElAutoResizer),null,{default:e.withCtx(({width:m})=>[e.createTextVNode(e.toDisplayString(O(m)),1)]),_:1})])]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.renderList(M.value,m=>({name:m.key,fn:e.withCtx(H=>[e.renderSlot(r.$slots,m.key,e.normalizeProps(e.guardReactiveProps(H)),void 0,!0)])}))]),1032,["items","form-data","rules","label-width","label-position","show-label","min-width","is-filter-preview","fixedWidth"])]),_:3})],2),e.createElementVNode("div",{class:e.normalizeClass(["operation-buttons",{"absolute right-0 text-right":a.isExpand&&!a.filterMode,"text-left":a.filterMode,"bg-fff":a.isExpand&&!a.filterMode&&!a.fixedWidth}]),style:e.normalizeStyle({bottom:A.value})},[a.filterMode?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(d.ElButton),{onClick:u[0]||(u[0]=s=>v(e.unref(o.operationConfigMap).reset)),type:"default"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("重置",-1)])]),_:1}),k.value?.length?(e.openBlock(),e.createBlock(e.unref(d.ElPopover),{key:0,visible:l.value,placement:"bottom-start",width:628,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:u[1]||(u[1]=s=>l.value=!l.value),icon:e.unref(g.IconCheck),type:"default"},{default:e.withCtx(()=>[...u[4]||(u[4]=[e.createTextVNode(" 筛选器 ",-1)])]),_:1},8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(S.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:q},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconMagnify))]),_:1})]),e.createVNode(E,{items:k.value,"form-data":n.value,"label-width":"auto","label-position":"top",inline:!1,"show-label":!0,"is-filter":!0,"min-width":a.minWidth,class:"filter-form-popover overflow-y-auto",onChange:C,onEnter:B},e.createSlots({_:2},[e.renderList(k.value,s=>({name:s.key,fn:e.withCtx(m=>[e.renderSlot(r.$slots,s.key,e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)])}))]),1032,["items","form-data","min-width"]),e.createElementVNode("div",_,[e.createVNode(x,{"operation-list":a.operationList,onOperation:v},e.createSlots({_:2},[r.$slots.operation?{name:"operation",fn:e.withCtx(({operationList:s})=>[e.renderSlot(r.$slots,"operation",{operationList:s},void 0,!0)]),key:"0"}:void 0]),1032,["operation-list"])])]),_:3},8,["visible"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[N.value&&a.isExpand&&a.hideExpandButton?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,icon:f.value?e.unref(g.IconUp):e.unref(g.IconDown),text:"",onClick:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value?"收起":"展开"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),e.createVNode(x,{"operation-list":a.operationList,onOperation:v},e.createSlots({_:2},[r.$slots.operation?{name:"operation",fn:e.withCtx(({operationList:s})=>[e.renderSlot(r.$slots,"operation",{operationList:s},void 0,!0)]),key:"0"}:void 0]),1032,["operation-list"])],64))],6),e.createVNode(e.unref(d.ElDrawer),{modelValue:y.value,"onUpdate:modelValue":u[2]||(u[2]=s=>y.value=s),size:"628","show-close":!1},{header:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(S.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:j,class:"shrink-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconShrink))]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",te,[e.createVNode(E,{items:k.value,"form-data":n.value,"label-width":"auto","label-position":"top",inline:!1,"show-label":!0,"is-filter":!0,"min-width":a.minWidth,onChange:C,onEnter:B},e.createSlots({_:2},[e.renderList(k.value,s=>({name:s.key,fn:e.withCtx(m=>[e.renderSlot(r.$slots,s.key,e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)])}))]),1032,["items","form-data","min-width"])]),e.createElementVNode("div",ae,[e.createVNode(x,{"operation-list":a.operationList,onOperation:v},e.createSlots({_:2},[r.$slots.operation?{name:"operation",fn:e.withCtx(({operationList:s})=>[e.renderSlot(r.$slots,"operation",{operationList:s},void 0,!0)]),key:"0"}:void 0]),1032,["operation-list"])])]),_:3},8,["modelValue"])],2))}}),oe=P._export_sfc(le,[["__scopeId","data-v-3877c183"]]),T=K.withInstall(oe);exports.SearchBar=T;exports.default=T;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/SearchBar.css');const K=require("./chunks/index.CkihWzK6.js"),e=require("vue"),d=require("element-plus"),g=require("color-message-lingyun-vue"),o=require("color-star-custom-methods"),G=require("./chunks/layout.DF2j_cdu.js"),J=require("./chunks/layout.whToBh0O.js"),P=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),S=require("./chunks/layout.DDB7i4jV.js"),Q=[{type:"primary",label:"查询",value:o.operationConfigMap.search},{type:"default",label:"重置",value:o.operationConfigMap.reset,plain:!0}],F=320,x={__name:"OperationButtons",props:{operationList:{type:Array,default:()=>[]}},emits:[o.emitsMap.operation],setup(a,{emit:h}){const p=h,i=c=>{p(o.emitsMap.operation,c)};return(c,n)=>c.$slots.operation?e.renderSlot(c.$slots,"operation",{key:0,operationList:a.operationList}):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(a.operationList,f=>(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:f.value,type:f.type,icon:f.icon,plain:f.plain,onClick:t=>i(f.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["type","icon","plain","onClick"]))),128))}},X=Object.assign({name:"FormWrapper"},{__name:"FormWrapper",props:{items:{type:Array,default:()=>[]},formData:{type:Object,default:()=>({})},rules:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:"auto"},labelPosition:{type:String,default:o.labelPositionMap.right},showLabel:{type:Boolean,default:!0},inline:{type:Boolean,default:!1},isFilter:{type:Boolean,default:!1},isFilterPreview:{type:Boolean,default:!1},minWidth:{type:Number,default:F},fixedWidth:{type:Boolean,default:!1}},emits:[o.emitsMap.change,o.emitsMap.enter],setup(a,{expose:h}){e.useCssVars(n=>({v1bc7ee80:a.minWidth+"px"}));const p=a,i=e.ref(null),c=e.computed(()=>p.isFilter?"filter-form":p.isFilterPreview?"filter-preview-form":p.fixedWidth?"search-bar-form search-bar-form-fixed":"search-bar-form");return h({validate:n=>i.value?i.value.validate(n):Promise.resolve(!0),resetFields:()=>{i.value&&i.value.resetFields()},clearValidate:n=>{i.value&&i.value.clearValidate(n)},scrollToField:n=>{i.value&&i.value.scrollToField(n)}}),(n,f)=>(e.openBlock(),e.createBlock(e.unref(d.ElForm),{ref_key:"formRef",ref:i,model:a.formData,"label-width":a.labelWidth,"label-position":a.labelPosition,inline:a.inline,rules:a.rules,class:e.normalizeClass({[c.value]:!0,"items-end display-grid":!a.isFilterPreview}),onSubmit:f[0]||(f[0]=e.withModifiers(()=>{},["prevent","stop"]))},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.items,t=>(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),e.mergeProps({key:t.key,label:a.showLabel?t.label:"",prop:t.key,"show-label":a.showLabel,class:[{"search-bar-item--wide":t.wide}]},{ref_for:!0},t),{default:e.withCtx(()=>[e.renderSlot(n.$slots,t.key,{item:t,formData:a.formData},()=>[t.type===e.unref(o.componentType).text?(e.openBlock(),e.createBlock(e.unref(d.ElInput),e.mergeProps({key:0,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{class:"w-full",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key]),onKeyup:e.withKeys(l=>n.$emit(e.unref(o.emitsMap).enter,t.key,a.formData[t.key]),["enter"])}),null,16,["modelValue","onUpdate:modelValue","onChange","onKeyup"])):t.type===e.unref(o.componentType).select?(e.openBlock(),e.createBlock(G._sfc_main,e.mergeProps({key:1,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l,"static-options":t.options},{ref_for:!0},t,{onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key]),class:"w-full"}),null,16,["modelValue","onUpdate:modelValue","static-options","onChange"])):t.type===e.unref(o.componentType).date?(e.openBlock(),e.createBlock(e.unref(d.ElDatePicker),e.mergeProps({key:2,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},{...e.unref(o.dateParamsMap)[t.dateType],...t},{type:t.dateType,format:t.format||e.unref(o.dateFormat).date,"value-format":t.valueFormat||e.unref(o.dateFormat).dateTime,class:"w-full",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","type","format","value-format","onChange"])):t.type===e.unref(o.componentType).inputNumber?(e.openBlock(),e.createBlock(e.unref(d.ElInputNumber),e.mergeProps({key:3,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{class:"w-full",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).switch?(e.openBlock(),e.createBlock(e.unref(d.ElSwitch),e.mergeProps({key:4,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).radio?(e.openBlock(),e.createBlock(e.unref(d.ElRadioGroup),{key:5,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l,onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,l=>(e.openBlock(),e.createBlock(e.unref(d.ElRadio),{key:l.value,label:l.value,value:l.value,disabled:l.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).checkbox?(e.openBlock(),e.createBlock(e.unref(d.ElCheckboxGroup),{key:6,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l,onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,l=>(e.openBlock(),e.createBlock(e.unref(d.ElCheckbox),{key:l.value,label:l.value,value:l.value,disabled:l.disabled},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["label","value","disabled"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).textarea?(e.openBlock(),e.createBlock(e.unref(d.ElInput),e.mergeProps({key:7,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t,{class:"w-full",type:"textarea",onChange:l=>n.$emit(e.unref(o.emitsMap).change,t.key,a.formData[t.key])}),null,16,["modelValue","onUpdate:modelValue","onChange"])):t.type===e.unref(o.componentType).upload?(e.openBlock(),e.createBlock(J._layout,e.mergeProps({key:8,modelValue:a.formData[t.key],"onUpdate:modelValue":l=>a.formData[t.key]=l},{ref_for:!0},t),null,16,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],!0)]),_:2},1040,["label","prop","show-label","class"]))),128)),e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},8,["model","label-width","label-position","inline","rules","class"]))}}),E=P._export_sfc(X,[["__scopeId","data-v-79352bf5"]]),Y={class:"h-32 w-full"},Z={class:"flex items-center justify-between pd-b-20"},_={class:"text-right"},ee={class:"drawer-header"},te={class:"flex-1 pd-l-16 pd-r-16 overflow-y-auto"},ae={class:"text-right border-top pd-t-16 pd-l-16 pd-r-16"},le=Object.assign({name:"SearchBar"},{__name:"layout",props:{items:{type:Array,default:()=>[]},modelValue:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:"auto"},labelPosition:{type:String,default:o.labelPositionMap.right,validator:a=>[o.labelPositionMap.left,o.labelPositionMap.right,o.labelPositionMap.top].includes(a)},isExpand:{type:Boolean,default:!0},maxHeight:{type:Number,default:84},minWidth:{type:Number,default:F},operationList:{type:Array,default:Q},filterMode:{type:Boolean,default:!0},hideExpandButton:{type:Boolean,default:!0},fixedWidth:{type:Boolean,default:!1}},emits:[o.emitsMap.updateModelValue,o.emitsMap.operation,o.emitsMap.change],setup(a,{expose:h,emit:p}){e.useCssVars(r=>({v6f01ec42:a.maxHeight+"px",v0a879a66:b.value?b.value+"px":"100%"}));const i=a,c=p,n=e.ref({}),f=e.ref(!i.isExpand),t=e.ref(null),l=e.ref(!1),y=e.ref(!1),V=e.ref(!1),W=e.computed(()=>{const r={};return i.items.forEach(u=>{if(u.required){const s=[{required:!0,message:`${u.label}不能为空`,trigger:"blur"}];typeof u.validator=="function"&&s.push({validator:u.validator,trigger:"blur"}),r[u.key]=s}}),r}),w=e.computed(()=>i.items?.filter(r=>!r.hidden)||[]),M=e.computed(()=>i.filterMode?w.value?.slice(0,2)||[]:w.value),k=e.computed(()=>i.filterMode?w.value.slice(2):[]),D=r=>{n.value={...r}},L=()=>{c(o.emitsMap.updateModelValue,{...n.value})},U=(r,u)=>{n.value[r]=u,V.value=!0,v(o.operationConfigMap.search),setTimeout(()=>{V.value=!1},200),C(r,u)},C=(r,u)=>{r&&c(o.emitsMap.change,r,u)},I=()=>n.value,B=(r,u)=>{V.value||c(o.emitsMap.operation,o.operationConfigMap.search,n.value)},v=r=>{L(),c(o.emitsMap.operation,r,n.value),(r===o.operationConfigMap.search||r===o.operationConfigMap.reset)&&(l.value=!1,y.value=!1)},z=r=>t.value.validate(r),b=e.ref(0),O=r=>{if(i.fixedWidth){b.value=132;return}b.value=r+32},R=()=>{f.value=!f.value},q=()=>{l.value=!1,y.value=!0},j=()=>{y.value=!1,l.value=!0},N=e.ref(!1),$=r=>{N.value=r>i.maxHeight},A=e.computed(()=>i.filterMode||f.value?"10px":"0");return e.onMounted(()=>{D(i.modelValue),$()}),e.watch(()=>i.modelValue,r=>{D(r)},{immediate:!0,deep:!0}),h({validate:z,getFormData:I,formRef:t}),(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative overflow-hidden w-full",{flex:a.filterMode}])},[e.createElementVNode("div",{class:e.normalizeClass({"is-collapsed overflow-hidden":!f.value})},[e.createVNode(e.unref(d.ElAutoResizer),null,{default:e.withCtx(({height:s})=>[e.createTextVNode(e.toDisplayString($(s))+" ",1),e.createVNode(E,{ref_key:"formRef",ref:t,items:M.value,"form-data":n.value,rules:W.value,"label-width":a.labelWidth,"label-position":a.labelPosition,inline:!0,"show-label":!a.filterMode,"min-width":a.minWidth,"is-filter-preview":a.filterMode,fixedWidth:a.fixedWidth,onChange:U,onEnter:B},e.createSlots({default:e.withCtx(()=>[a.isExpand&&!a.filterMode?(e.openBlock(),e.createBlock(e.unref(d.ElFormItem),{key:0},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.createVNode(e.unref(d.ElAutoResizer),null,{default:e.withCtx(({width:m})=>[e.createTextVNode(e.toDisplayString(O(m)),1)]),_:1})])]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.renderList(M.value,m=>({name:m.key,fn:e.withCtx(H=>[e.renderSlot(r.$slots,m.key,e.normalizeProps(e.guardReactiveProps(H)),void 0,!0)])}))]),1032,["items","form-data","rules","label-width","label-position","show-label","min-width","is-filter-preview","fixedWidth"])]),_:3})],2),e.createElementVNode("div",{class:e.normalizeClass(["operation-buttons",{"absolute right-0 text-right":a.isExpand&&!a.filterMode,"text-left":a.filterMode,"bg-fff":a.isExpand&&!a.filterMode&&!a.fixedWidth}]),style:e.normalizeStyle({bottom:A.value})},[a.filterMode?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(d.ElButton),{onClick:u[0]||(u[0]=s=>v(e.unref(o.operationConfigMap).reset)),type:"default"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("重置",-1)])]),_:1}),k.value?.length?(e.openBlock(),e.createBlock(e.unref(d.ElPopover),{key:0,visible:l.value,placement:"bottom-start",width:628,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:u[1]||(u[1]=s=>l.value=!l.value),icon:e.unref(g.IconCheck),type:"default"},{default:e.withCtx(()=>[...u[4]||(u[4]=[e.createTextVNode(" 筛选器 ",-1)])]),_:1},8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(S.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:q},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconMagnify))]),_:1})]),e.createVNode(E,{items:k.value,"form-data":n.value,"label-width":"auto","label-position":"top",inline:!1,"show-label":!0,"is-filter":!0,"min-width":a.minWidth,class:"filter-form-popover overflow-y-auto",onChange:C,onEnter:B},e.createSlots({_:2},[e.renderList(k.value,s=>({name:s.key,fn:e.withCtx(m=>[e.renderSlot(r.$slots,s.key,e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)])}))]),1032,["items","form-data","min-width"]),e.createElementVNode("div",_,[e.createVNode(x,{"operation-list":a.operationList,onOperation:v},e.createSlots({_:2},[r.$slots.operation?{name:"operation",fn:e.withCtx(({operationList:s})=>[e.renderSlot(r.$slots,"operation",{operationList:s},void 0,!0)]),key:"0"}:void 0]),1032,["operation-list"])])]),_:3},8,["visible"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[N.value&&a.isExpand&&a.hideExpandButton?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,icon:f.value?e.unref(g.IconUp):e.unref(g.IconDown),text:"",onClick:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value?"收起":"展开"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),e.createVNode(x,{"operation-list":a.operationList,onOperation:v},e.createSlots({_:2},[r.$slots.operation?{name:"operation",fn:e.withCtx(({operationList:s})=>[e.renderSlot(r.$slots,"operation",{operationList:s},void 0,!0)]),key:"0"}:void 0]),1032,["operation-list"])],64))],6),e.createVNode(e.unref(d.ElDrawer),{modelValue:y.value,"onUpdate:modelValue":u[2]||(u[2]=s=>y.value=s),size:"628","show-close":!1},{header:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(S.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:j,class:"shrink-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconShrink))]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",te,[e.createVNode(E,{items:k.value,"form-data":n.value,"label-width":"auto","label-position":"top",inline:!1,"show-label":!0,"is-filter":!0,"min-width":a.minWidth,onChange:C,onEnter:B},e.createSlots({_:2},[e.renderList(k.value,s=>({name:s.key,fn:e.withCtx(m=>[e.renderSlot(r.$slots,s.key,e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)])}))]),1032,["items","form-data","min-width"])]),e.createElementVNode("div",ae,[e.createVNode(x,{"operation-list":a.operationList,onOperation:v},e.createSlots({_:2},[r.$slots.operation?{name:"operation",fn:e.withCtx(({operationList:s})=>[e.renderSlot(r.$slots,"operation",{operationList:s},void 0,!0)]),key:"0"}:void 0]),1032,["operation-list"])])]),_:3},8,["modelValue"])],2))}}),oe=P._export_sfc(le,[["__scopeId","data-v-43e6f39f"]]),T=K.withInstall(oe);exports.SearchBar=T;exports.default=T;
|