color-star-custom-components 0.0.22 → 0.0.23
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/SearchBar.mjs +58 -55
- package/es/assets/SearchBar.css +1 -1
- package/lib/SearchBar.js +1 -1
- package/lib/assets/SearchBar.css +1 -1
- package/package.json +3 -3
package/es/SearchBar.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { w as
|
|
2
|
-
import { renderSlot as
|
|
1
|
+
import { w as ke } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { renderSlot as p, createElementBlock as x, openBlock as i, Fragment as M, renderList as D, createBlock as y, unref as t, withCtx as r, createTextVNode as $, toDisplayString as B, useCssVars as oe, ref as g, computed as F, withModifiers as be, normalizeClass as T, mergeProps as w, createCommentVNode as z, withKeys as ge, onMounted as we, watch as Ve, createElementVNode as V, createVNode as m, createSlots as W, normalizeProps as N, guardReactiveProps as O, normalizeStyle as $e } from "vue";
|
|
3
3
|
import { ElButton as R, ElForm as De, ElFormItem as ne, ElInput as _, ElDatePicker as Ce, ElInputNumber as Ee, ElSwitch as xe, ElRadioGroup as We, ElRadio as Fe, ElCheckboxGroup as Me, ElCheckbox as Be, ElAutoResizer as ee, ElPopover as Ue, ElIcon as ae, ElDrawer as Le } from "element-plus";
|
|
4
4
|
import { IconMagnify as Ie, IconCheck as Pe, IconUp as Se, IconDown as Ne, IconShrink as Oe } from "color-message-lingyun-vue";
|
|
5
|
-
import { operationConfigMap as
|
|
5
|
+
import { operationConfigMap as E, emitsMap as f, labelPositionMap as P, componentType as b, dateParamsMap as Te, dateFormat as te } from "color-star-custom-methods";
|
|
6
6
|
import { _ as ze } from "./chunks/layout.CWN3wQtZ.js";
|
|
7
7
|
import { _ as Re } from "./chunks/layout.8QJjTbpS.js";
|
|
8
8
|
import { _ as re } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
@@ -11,12 +11,12 @@ import './assets/SearchBar.css';const je = [
|
|
|
11
11
|
{
|
|
12
12
|
type: "primary",
|
|
13
13
|
label: "查询",
|
|
14
|
-
value:
|
|
14
|
+
value: E.search
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
type: "default",
|
|
18
18
|
label: "重置",
|
|
19
|
-
value:
|
|
19
|
+
value: E.reset,
|
|
20
20
|
plain: !0
|
|
21
21
|
}
|
|
22
22
|
], ie = 320, J = {
|
|
@@ -29,13 +29,13 @@ import './assets/SearchBar.css';const je = [
|
|
|
29
29
|
},
|
|
30
30
|
emits: [f.operation],
|
|
31
31
|
setup(a, { emit: U }) {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const k = U, u = (h) => {
|
|
33
|
+
k(f.operation, h);
|
|
34
34
|
};
|
|
35
|
-
return (h, c) => h.$slots.operation ?
|
|
35
|
+
return (h, c) => h.$slots.operation ? p(h.$slots, "operation", {
|
|
36
36
|
key: 0,
|
|
37
37
|
operationList: a.operationList
|
|
38
|
-
}) : (i(!0),
|
|
38
|
+
}) : (i(!0), x(M, { key: 1 }, D(a.operationList, (n) => (i(), y(t(R), {
|
|
39
39
|
key: n.value,
|
|
40
40
|
type: n.type,
|
|
41
41
|
icon: n.icon,
|
|
@@ -111,9 +111,12 @@ import './assets/SearchBar.css';const je = [
|
|
|
111
111
|
emits: [f.change, f.enter],
|
|
112
112
|
setup(a, { expose: U }) {
|
|
113
113
|
oe((n) => ({
|
|
114
|
-
|
|
114
|
+
v52e2daf2: a.minWidth + "px"
|
|
115
115
|
}));
|
|
116
|
-
const
|
|
116
|
+
const k = a, u = g(null), h = F(() => k.isFilter ? "filter-form" : k.isFilterPreview ? "filter-preview-form" : k.fixedWidth ? "search-bar-form search-bar-form-fixed" : "search-bar-form"), c = () => {
|
|
117
|
+
if (!k.fixedWidth && k.showLabel)
|
|
118
|
+
return k.labelWidth;
|
|
119
|
+
};
|
|
117
120
|
return U({
|
|
118
121
|
validate: (n) => u.value ? u.value.validate(n) : Promise.resolve(!0),
|
|
119
122
|
resetFields: () => {
|
|
@@ -129,7 +132,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
129
132
|
ref_key: "formRef",
|
|
130
133
|
ref: u,
|
|
131
134
|
model: a.formData,
|
|
132
|
-
"label-width": c
|
|
135
|
+
"label-width": c(),
|
|
133
136
|
"label-position": a.labelPosition,
|
|
134
137
|
inline: a.inline,
|
|
135
138
|
rules: a.rules,
|
|
@@ -137,11 +140,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
137
140
|
[h.value]: !0,
|
|
138
141
|
"items-end display-grid": !a.isFilterPreview
|
|
139
142
|
}),
|
|
140
|
-
onSubmit: C[0] || (C[0] =
|
|
143
|
+
onSubmit: C[0] || (C[0] = be(() => {
|
|
141
144
|
}, ["prevent", "stop"]))
|
|
142
145
|
}, {
|
|
143
146
|
default: r(() => [
|
|
144
|
-
(i(!0),
|
|
147
|
+
(i(!0), x(M, null, D(a.items, (e) => (i(), y(t(ne), w({
|
|
145
148
|
key: e.key,
|
|
146
149
|
label: a.showLabel ? e.label : "",
|
|
147
150
|
prop: e.key,
|
|
@@ -153,17 +156,17 @@ import './assets/SearchBar.css';const je = [
|
|
|
153
156
|
]
|
|
154
157
|
}, { ref_for: !0 }, e), {
|
|
155
158
|
label: r(() => [
|
|
156
|
-
|
|
159
|
+
p(n.$slots, `${e.key}-label`, {
|
|
157
160
|
item: e,
|
|
158
161
|
formData: a.formData
|
|
159
162
|
}, void 0, !0)
|
|
160
163
|
]),
|
|
161
164
|
default: r(() => [
|
|
162
|
-
|
|
165
|
+
p(n.$slots, e.key, {
|
|
163
166
|
item: e,
|
|
164
167
|
formData: a.formData
|
|
165
168
|
}, () => [
|
|
166
|
-
e.type === t(
|
|
169
|
+
e.type === t(b).text ? (i(), y(t(_), w({
|
|
167
170
|
key: 0,
|
|
168
171
|
modelValue: a.formData[e.key],
|
|
169
172
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l
|
|
@@ -171,7 +174,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
171
174
|
class: "w-full",
|
|
172
175
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key]),
|
|
173
176
|
onKeyup: ge((l) => n.$emit(t(f).enter, e.key, a.formData[e.key]), ["enter"])
|
|
174
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange", "onKeyup"])) : e.type === t(
|
|
177
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange", "onKeyup"])) : e.type === t(b).select ? (i(), y(ze, w({
|
|
175
178
|
key: 1,
|
|
176
179
|
modelValue: a.formData[e.key],
|
|
177
180
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l,
|
|
@@ -179,7 +182,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
179
182
|
}, { ref_for: !0 }, e, {
|
|
180
183
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key]),
|
|
181
184
|
class: "w-full"
|
|
182
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "static-options", "onChange"])) : e.type === t(
|
|
185
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "static-options", "onChange"])) : e.type === t(b).date ? (i(), y(t(Ce), w({
|
|
183
186
|
key: 2,
|
|
184
187
|
modelValue: a.formData[e.key],
|
|
185
188
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l
|
|
@@ -192,27 +195,27 @@ import './assets/SearchBar.css';const je = [
|
|
|
192
195
|
"value-format": e.valueFormat || t(te).dateTime,
|
|
193
196
|
class: "w-full",
|
|
194
197
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key])
|
|
195
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "type", "format", "value-format", "onChange"])) : e.type === t(
|
|
198
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "type", "format", "value-format", "onChange"])) : e.type === t(b).inputNumber ? (i(), y(t(Ee), w({
|
|
196
199
|
key: 3,
|
|
197
200
|
modelValue: a.formData[e.key],
|
|
198
201
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l
|
|
199
202
|
}, { ref_for: !0 }, e, {
|
|
200
203
|
class: "w-full",
|
|
201
204
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key])
|
|
202
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(
|
|
205
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(b).switch ? (i(), y(t(xe), w({
|
|
203
206
|
key: 4,
|
|
204
207
|
modelValue: a.formData[e.key],
|
|
205
208
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l
|
|
206
209
|
}, { ref_for: !0 }, e, {
|
|
207
210
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key])
|
|
208
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(
|
|
211
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(b).radio ? (i(), y(t(We), {
|
|
209
212
|
key: 5,
|
|
210
213
|
modelValue: a.formData[e.key],
|
|
211
214
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l,
|
|
212
215
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key])
|
|
213
216
|
}, {
|
|
214
217
|
default: r(() => [
|
|
215
|
-
(i(!0),
|
|
218
|
+
(i(!0), x(M, null, D(e.options, (l) => (i(), y(t(Fe), {
|
|
216
219
|
key: l.value,
|
|
217
220
|
label: l.value,
|
|
218
221
|
value: l.value,
|
|
@@ -225,14 +228,14 @@ import './assets/SearchBar.css';const je = [
|
|
|
225
228
|
}, 1032, ["label", "value", "disabled"]))), 128))
|
|
226
229
|
]),
|
|
227
230
|
_: 2
|
|
228
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(
|
|
231
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(b).checkbox ? (i(), y(t(Me), {
|
|
229
232
|
key: 6,
|
|
230
233
|
modelValue: a.formData[e.key],
|
|
231
234
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l,
|
|
232
235
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key])
|
|
233
236
|
}, {
|
|
234
237
|
default: r(() => [
|
|
235
|
-
(i(!0),
|
|
238
|
+
(i(!0), x(M, null, D(e.options, (l) => (i(), y(t(Be), {
|
|
236
239
|
key: l.value,
|
|
237
240
|
label: l.value,
|
|
238
241
|
value: l.value,
|
|
@@ -245,7 +248,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
245
248
|
}, 1032, ["label", "value", "disabled"]))), 128))
|
|
246
249
|
]),
|
|
247
250
|
_: 2
|
|
248
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(
|
|
251
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(b).textarea ? (i(), y(t(_), w({
|
|
249
252
|
key: 7,
|
|
250
253
|
modelValue: a.formData[e.key],
|
|
251
254
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l
|
|
@@ -253,7 +256,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
253
256
|
class: "w-full",
|
|
254
257
|
type: "textarea",
|
|
255
258
|
onChange: (l) => n.$emit(t(f).change, e.key, a.formData[e.key])
|
|
256
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(
|
|
259
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onChange"])) : e.type === t(b).upload ? (i(), y(Re, w({
|
|
257
260
|
key: 8,
|
|
258
261
|
modelValue: a.formData[e.key],
|
|
259
262
|
"onUpdate:modelValue": (l) => a.formData[e.key] = l
|
|
@@ -262,12 +265,12 @@ import './assets/SearchBar.css';const je = [
|
|
|
262
265
|
]),
|
|
263
266
|
_: 2
|
|
264
267
|
}, 1040, ["label", "prop", "show-label", "class"]))), 128)),
|
|
265
|
-
|
|
268
|
+
p(n.$slots, "default", {}, void 0, !0)
|
|
266
269
|
]),
|
|
267
270
|
_: 3
|
|
268
271
|
}, 8, ["model", "label-width", "label-position", "inline", "rules", "class"]));
|
|
269
272
|
}
|
|
270
|
-
}), Q = /* @__PURE__ */ re(Ae, [["__scopeId", "data-v-
|
|
273
|
+
}), Q = /* @__PURE__ */ re(Ae, [["__scopeId", "data-v-048c4699"]]), He = { class: "h-32 w-full" }, Ke = { class: "flex items-center justify-between pd-b-20" }, qe = { class: "text-right" }, Ge = { class: "drawer-header" }, Je = { class: "flex-1 pd-l-16 pd-r-16 overflow-y-auto" }, Qe = { class: "text-right border-top pd-t-16 pd-l-16 pd-r-16" }, Xe = /* @__PURE__ */ Object.assign({
|
|
271
274
|
name: "SearchBar"
|
|
272
275
|
}, {
|
|
273
276
|
__name: "layout",
|
|
@@ -329,12 +332,12 @@ import './assets/SearchBar.css';const je = [
|
|
|
329
332
|
}
|
|
330
333
|
},
|
|
331
334
|
emits: [f.updateModelValue, f.operation, f.change],
|
|
332
|
-
setup(a, { expose: U, emit:
|
|
335
|
+
setup(a, { expose: U, emit: k }) {
|
|
333
336
|
oe((o) => ({
|
|
334
337
|
v433e4c12: a.maxHeight + "px",
|
|
335
338
|
v24a83611: S.value ? S.value + "px" : "100%"
|
|
336
339
|
}));
|
|
337
|
-
const u = a, h =
|
|
340
|
+
const u = a, h = k, c = g({}), n = g(!u.isExpand), C = g(null), e = g(!1), l = g(!1), j = g(!1), ue = F(() => {
|
|
338
341
|
const o = {};
|
|
339
342
|
return u.items.forEach((d) => {
|
|
340
343
|
if (d.required) {
|
|
@@ -342,20 +345,20 @@ import './assets/SearchBar.css';const je = [
|
|
|
342
345
|
typeof d.validator == "function" && s.push({ validator: d.validator, trigger: "blur" }), o[d.key] = s;
|
|
343
346
|
}
|
|
344
347
|
}), o;
|
|
345
|
-
}), A =
|
|
348
|
+
}), A = F(() => u.items?.filter((o) => !o.hidden) || []), H = F(() => u.filterMode ? A.value?.slice(0, 2) || [] : A.value), L = F(() => u.filterMode ? A.value.slice(2) : []), X = (o) => {
|
|
346
349
|
c.value = { ...o };
|
|
347
350
|
}, de = () => {
|
|
348
351
|
h(f.updateModelValue, { ...c.value });
|
|
349
352
|
}, se = (o, d) => {
|
|
350
|
-
c.value[o] = d, j.value = !0, I(
|
|
353
|
+
c.value[o] = d, j.value = !0, I(E.search), setTimeout(() => {
|
|
351
354
|
j.value = !1;
|
|
352
355
|
}, 200), K(o, d);
|
|
353
356
|
}, K = (o, d) => {
|
|
354
357
|
o && h(f.change, o, d);
|
|
355
358
|
}, fe = () => c.value, q = (o, d) => {
|
|
356
|
-
j.value || h(f.operation,
|
|
359
|
+
j.value || h(f.operation, E.search, c.value);
|
|
357
360
|
}, I = (o) => {
|
|
358
|
-
de(), h(f.operation, o, c.value), (o ===
|
|
361
|
+
de(), h(f.operation, o, c.value), (o === E.search || o === E.reset) && (e.value = !1, l.value = !1);
|
|
359
362
|
}, me = (o) => C.value.validate(o), S = g(0), ye = (o) => {
|
|
360
363
|
if (u.fixedWidth) {
|
|
361
364
|
S.value = 132;
|
|
@@ -370,7 +373,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
370
373
|
l.value = !1, e.value = !0;
|
|
371
374
|
}, Y = g(!1), Z = (o) => {
|
|
372
375
|
Y.value = o > u.maxHeight;
|
|
373
|
-
},
|
|
376
|
+
}, pe = F(() => u.filterMode || n.value ? "10px" : "0");
|
|
374
377
|
return we(() => {
|
|
375
378
|
X(u.modelValue), Z();
|
|
376
379
|
}), Ve(
|
|
@@ -386,7 +389,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
386
389
|
// resetFields,
|
|
387
390
|
// scrollToField,
|
|
388
391
|
formRef: C
|
|
389
|
-
}), (o, d) => (i(),
|
|
392
|
+
}), (o, d) => (i(), x("div", {
|
|
390
393
|
class: T(["relative overflow-hidden w-full", { flex: a.filterMode }])
|
|
391
394
|
}, [
|
|
392
395
|
V("div", {
|
|
@@ -412,7 +415,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
412
415
|
fixedWidth: a.fixedWidth,
|
|
413
416
|
onChange: se,
|
|
414
417
|
onEnter: q
|
|
415
|
-
},
|
|
418
|
+
}, W({
|
|
416
419
|
default: r(() => [
|
|
417
420
|
a.isExpand && !a.filterMode ? (i(), y(t(ne), { key: 0 }, {
|
|
418
421
|
default: r(() => [
|
|
@@ -433,13 +436,13 @@ import './assets/SearchBar.css';const je = [
|
|
|
433
436
|
D(H.value, (v) => ({
|
|
434
437
|
name: v.key,
|
|
435
438
|
fn: r((G) => [
|
|
436
|
-
|
|
439
|
+
p(o.$slots, v.key, N(O(G)), void 0, !0)
|
|
437
440
|
])
|
|
438
441
|
})),
|
|
439
442
|
D(H.value, (v) => ({
|
|
440
443
|
name: `${v.key}-label`,
|
|
441
444
|
fn: r((G) => [
|
|
442
|
-
|
|
445
|
+
p(o.$slots, `${v.key}-label`, N(O(G)), void 0, !0)
|
|
443
446
|
])
|
|
444
447
|
}))
|
|
445
448
|
]), 1032, ["items", "form-data", "rules", "label-width", "label-position", "show-label", "min-width", "is-filter-preview", "fixedWidth"])
|
|
@@ -453,11 +456,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
453
456
|
"text-left": a.filterMode,
|
|
454
457
|
"bg-fff": a.isExpand && !a.filterMode && !a.fixedWidth
|
|
455
458
|
}]),
|
|
456
|
-
style: $e({ bottom:
|
|
459
|
+
style: $e({ bottom: pe.value })
|
|
457
460
|
}, [
|
|
458
|
-
a.filterMode ? (i(),
|
|
461
|
+
a.filterMode ? (i(), x(M, { key: 0 }, [
|
|
459
462
|
m(t(R), {
|
|
460
|
-
onClick: d[0] || (d[0] = (s) => I(t(
|
|
463
|
+
onClick: d[0] || (d[0] = (s) => I(t(E).reset)),
|
|
461
464
|
type: "default"
|
|
462
465
|
}, {
|
|
463
466
|
default: r(() => [...d[3] || (d[3] = [
|
|
@@ -512,11 +515,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
512
515
|
class: "filter-form-popover overflow-y-auto",
|
|
513
516
|
onChange: K,
|
|
514
517
|
onEnter: q
|
|
515
|
-
},
|
|
518
|
+
}, W({ _: 2 }, [
|
|
516
519
|
D(L.value, (s) => ({
|
|
517
520
|
name: s.key,
|
|
518
521
|
fn: r((v) => [
|
|
519
|
-
|
|
522
|
+
p(o.$slots, s.key, N(O(v)), void 0, !0)
|
|
520
523
|
])
|
|
521
524
|
}))
|
|
522
525
|
]), 1032, ["items", "form-data", "min-width"]),
|
|
@@ -524,11 +527,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
524
527
|
m(J, {
|
|
525
528
|
"operation-list": a.operationList,
|
|
526
529
|
onOperation: I
|
|
527
|
-
},
|
|
530
|
+
}, W({ _: 2 }, [
|
|
528
531
|
o.$slots.operation ? {
|
|
529
532
|
name: "operation",
|
|
530
533
|
fn: r(({ operationList: s }) => [
|
|
531
|
-
|
|
534
|
+
p(o.$slots, "operation", { operationList: s }, void 0, !0)
|
|
532
535
|
]),
|
|
533
536
|
key: "0"
|
|
534
537
|
} : void 0
|
|
@@ -537,7 +540,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
537
540
|
]),
|
|
538
541
|
_: 3
|
|
539
542
|
}, 8, ["visible"])) : z("", !0)
|
|
540
|
-
], 64)) : (i(),
|
|
543
|
+
], 64)) : (i(), x(M, { key: 1 }, [
|
|
541
544
|
Y.value && a.isExpand && a.hideExpandButton ? (i(), y(t(R), {
|
|
542
545
|
key: 0,
|
|
543
546
|
icon: n.value ? t(Se) : t(Ne),
|
|
@@ -552,11 +555,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
552
555
|
m(J, {
|
|
553
556
|
"operation-list": a.operationList,
|
|
554
557
|
onOperation: I
|
|
555
|
-
},
|
|
558
|
+
}, W({ _: 2 }, [
|
|
556
559
|
o.$slots.operation ? {
|
|
557
560
|
name: "operation",
|
|
558
561
|
fn: r(({ operationList: s }) => [
|
|
559
|
-
|
|
562
|
+
p(o.$slots, "operation", { operationList: s }, void 0, !0)
|
|
560
563
|
]),
|
|
561
564
|
key: "0"
|
|
562
565
|
} : void 0
|
|
@@ -600,11 +603,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
600
603
|
"min-width": a.minWidth,
|
|
601
604
|
onChange: K,
|
|
602
605
|
onEnter: q
|
|
603
|
-
},
|
|
606
|
+
}, W({ _: 2 }, [
|
|
604
607
|
D(L.value, (s) => ({
|
|
605
608
|
name: s.key,
|
|
606
609
|
fn: r((v) => [
|
|
607
|
-
|
|
610
|
+
p(o.$slots, s.key, N(O(v)), void 0, !0)
|
|
608
611
|
])
|
|
609
612
|
}))
|
|
610
613
|
]), 1032, ["items", "form-data", "min-width"])
|
|
@@ -613,11 +616,11 @@ import './assets/SearchBar.css';const je = [
|
|
|
613
616
|
m(J, {
|
|
614
617
|
"operation-list": a.operationList,
|
|
615
618
|
onOperation: I
|
|
616
|
-
},
|
|
619
|
+
}, W({ _: 2 }, [
|
|
617
620
|
o.$slots.operation ? {
|
|
618
621
|
name: "operation",
|
|
619
622
|
fn: r(({ operationList: s }) => [
|
|
620
|
-
|
|
623
|
+
p(o.$slots, "operation", { operationList: s }, void 0, !0)
|
|
621
624
|
]),
|
|
622
625
|
key: "0"
|
|
623
626
|
} : void 0
|
|
@@ -628,7 +631,7 @@ import './assets/SearchBar.css';const je = [
|
|
|
628
631
|
}, 8, ["modelValue"])
|
|
629
632
|
], 2));
|
|
630
633
|
}
|
|
631
|
-
}), Ye = /* @__PURE__ */ re(Xe, [["__scopeId", "data-v-0faf3524"]]), ia =
|
|
634
|
+
}), Ye = /* @__PURE__ */ re(Xe, [["__scopeId", "data-v-0faf3524"]]), ia = ke(Ye);
|
|
632
635
|
export {
|
|
633
636
|
ia as SearchBar,
|
|
634
637
|
ia as default
|
package/es/assets/SearchBar.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.filter-form[data-v-
|
|
1
|
+
.filter-form[data-v-048c4699]{grid-template-columns:repeat(2,1fr);gap:10px}.filter-preview-form[data-v-048c4699]{display:flex}.filter-preview-form .el-form-item[data-v-048c4699]{width:var(--v52e2daf2);margin-right:10px}.search-bar-form[data-v-048c4699]{grid-template-columns:repeat(auto-fit,minmax(var(--v52e2daf2),1fr));gap:10px}.search-bar-form.search-bar-form-fixed[data-v-048c4699]{grid-template-columns:repeat(auto-fit,var(--v52e2daf2))}.search-bar-form.search-bar-form-fixed.el-form--inline .el-form-item[data-v-048c4699]{margin-bottom:18px}.search-bar-form.el-form--inline .el-form-item[data-v-048c4699]{margin-right:0;margin-bottom:10px}.search-bar-form.el-form--inline .el-form-item.el-form-item--label-left[data-v-048c4699]{display:flex;padding:0 14px;background:var(--neutral-color-18);border-radius:8px;border:1px solid var(--parting-line)}.search-bar-form.el-form--inline .el-form-item.el-form-item--label-left[data-v-048c4699] .el-form-item__content{justify-content:end}.search-bar-form.el-form--inline.el-form--label-top[data-v-048c4699]{display:grid}.search-bar-item--wide[data-v-048c4699]{grid-column:span 2}.is-collapsed[data-v-0faf3524]{max-height:var(--v433e4c12)}.operation-buttons[data-v-0faf3524]{width:var(--v24a83611);z-index:1}.h-32[data-v-0faf3524]{height:32px}.drawer-header[data-v-0faf3524]{display:flex;justify-content:space-between;align-items:center;width:100%}.drawer-header .shrink-button[data-v-0faf3524]{margin-left:auto}.border-top[data-v-0faf3524]{border-top:1px solid var(--parting-line)}[data-v-0faf3524] .el-drawer__body{padding:16px 0;display:flex;flex-direction:column;overflow:hidden}.filter-form-popover[data-v-0faf3524]{max-height:400px}[data-v-0faf3524] .el-drawer__header{margin-bottom:0;padding:16px 16px 0}
|
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.CCFaLYCo.js"),J=require("./chunks/layout.whToBh0O.js"),F=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),P=require("./chunks/layout.DDB7i4jV.js"),Q=[{type:"primary",label:"查询",value:o.operationConfigMap.search},{type:"default",label:"重置",value:o.operationConfigMap.reset,plain:!0}],T=320,M={__name:"OperationButtons",props:{operationList:{type:Array,default:()=>[]}},emits:[o.emitsMap.operation],setup(a,{emit:y}){const p=y,i=c=>{p(o.emitsMap.operation,c)};return(c,f)=>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,n=>(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:n.value,type:n.type,icon:n.icon,plain:n.plain,onClick:h=>i(n.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.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:T},fixedWidth:{type:Boolean,default:!1}},emits:[o.emitsMap.change,o.emitsMap.enter],setup(a,{expose:y}){e.useCssVars(n=>({v6b381c92: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"),f=e.computed(()=>p.showLabel?p.labelWidth:"");return y({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,h)=>(e.openBlock(),e.createBlock(e.unref(d.ElForm),{ref_key:"formRef",ref:i,model:a.formData,"label-width":f.value,"label-position":a.labelPosition,inline:a.inline,rules:a.rules,class:e.normalizeClass({[c.value]:!0,"items-end display-grid":!a.isFilterPreview}),onSubmit:h[0]||(h[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),{label:e.withCtx(()=>[e.renderSlot(n.$slots,`${t.key}-label`,{item:t,formData:a.formData},void 0,!0)]),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"]))}}),D=F._export_sfc(X,[["__scopeId","data-v-aebbdb9c"]]),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:T},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:y,emit:p}){e.useCssVars(r=>({v433e4c12:a.maxHeight+"px",v24a83611:b.value?b.value+"px":"100%"}));const i=a,c=p,f=e.ref({}),n=e.ref(!i.isExpand),h=e.ref(null),t=e.ref(!1),l=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)||[]),C=e.computed(()=>i.filterMode?w.value?.slice(0,2)||[]:w.value),k=e.computed(()=>i.filterMode?w.value.slice(2):[]),N=r=>{f.value={...r}},U=()=>{c(o.emitsMap.updateModelValue,{...f.value})},I=(r,u)=>{f.value[r]=u,V.value=!0,v(o.operationConfigMap.search),setTimeout(()=>{V.value=!1},200),B(r,u)},B=(r,u)=>{r&&c(o.emitsMap.change,r,u)},z=()=>f.value,x=(r,u)=>{V.value||c(o.emitsMap.operation,o.operationConfigMap.search,f.value)},v=r=>{U(),c(o.emitsMap.operation,r,f.value),(r===o.operationConfigMap.search||r===o.operationConfigMap.reset)&&(t.value=!1,l.value=!1)},R=r=>h.value.validate(r),b=e.ref(0),O=r=>{if(i.fixedWidth){b.value=132;return}b.value=r+32},q=()=>{n.value=!n.value},j=()=>{t.value=!1,l.value=!0},A=()=>{l.value=!1,t.value=!0},$=e.ref(!1),S=r=>{$.value=r>i.maxHeight},H=e.computed(()=>i.filterMode||n.value?"10px":"0");return e.onMounted(()=>{N(i.modelValue),S()}),e.watch(()=>i.modelValue,r=>{N(r)},{immediate:!0,deep:!0}),y({validate:R,getFormData:z,formRef:h}),(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":!n.value})},[e.createVNode(e.unref(d.ElAutoResizer),null,{default:e.withCtx(({height:s})=>[e.createTextVNode(e.toDisplayString(S(s))+" ",1),e.createVNode(D,{ref_key:"formRef",ref:h,items:C.value,"form-data":f.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:I,onEnter:x},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(C.value,m=>({name:m.key,fn:e.withCtx(E=>[e.renderSlot(r.$slots,m.key,e.normalizeProps(e.guardReactiveProps(E)),void 0,!0)])})),e.renderList(C.value,m=>({name:`${m.key}-label`,fn:e.withCtx(E=>[e.renderSlot(r.$slots,`${m.key}-label`,e.normalizeProps(e.guardReactiveProps(E)),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:H.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:t.value,placement:"bottom-start",width:628,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:u[1]||(u[1]=s=>t.value=!t.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(P.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:j},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconMagnify))]),_:1})]),e.createVNode(D,{items:k.value,"form-data":f.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:B,onEnter:x},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(M,{"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},[$.value&&a.isExpand&&a.hideExpandButton?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,icon:n.value?e.unref(g.IconUp):e.unref(g.IconDown),text:"",onClick:q},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.value?"收起":"展开"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),e.createVNode(M,{"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:l.value,"onUpdate:modelValue":u[2]||(u[2]=s=>l.value=s),size:"628","show-close":!1},{header:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(P.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:A,class:"shrink-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconShrink))]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",te,[e.createVNode(D,{items:k.value,"form-data":f.value,"label-width":"auto","label-position":"top",inline:!1,"show-label":!0,"is-filter":!0,"min-width":a.minWidth,onChange:B,onEnter:x},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(M,{"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=F._export_sfc(le,[["__scopeId","data-v-0faf3524"]]),L=K.withInstall(oe);exports.SearchBar=L;exports.default=L;
|
|
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.CCFaLYCo.js"),J=require("./chunks/layout.whToBh0O.js"),F=require("./chunks/_plugin-vue_export-helper.BHFhmbuH.js"),P=require("./chunks/layout.DDB7i4jV.js"),Q=[{type:"primary",label:"查询",value:o.operationConfigMap.search},{type:"default",label:"重置",value:o.operationConfigMap.reset,plain:!0}],T=320,M={__name:"OperationButtons",props:{operationList:{type:Array,default:()=>[]}},emits:[o.emitsMap.operation],setup(a,{emit:y}){const p=y,i=c=>{p(o.emitsMap.operation,c)};return(c,f)=>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,n=>(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:n.value,type:n.type,icon:n.icon,plain:n.plain,onClick:h=>i(n.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.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:T},fixedWidth:{type:Boolean,default:!1}},emits:[o.emitsMap.change,o.emitsMap.enter],setup(a,{expose:y}){e.useCssVars(n=>({v52e2daf2: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"),f=()=>{if(!p.fixedWidth&&p.showLabel)return p.labelWidth};return y({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,h)=>(e.openBlock(),e.createBlock(e.unref(d.ElForm),{ref_key:"formRef",ref:i,model:a.formData,"label-width":f(),"label-position":a.labelPosition,inline:a.inline,rules:a.rules,class:e.normalizeClass({[c.value]:!0,"items-end display-grid":!a.isFilterPreview}),onSubmit:h[0]||(h[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),{label:e.withCtx(()=>[e.renderSlot(n.$slots,`${t.key}-label`,{item:t,formData:a.formData},void 0,!0)]),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"]))}}),D=F._export_sfc(X,[["__scopeId","data-v-048c4699"]]),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:T},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:y,emit:p}){e.useCssVars(r=>({v433e4c12:a.maxHeight+"px",v24a83611:b.value?b.value+"px":"100%"}));const i=a,c=p,f=e.ref({}),n=e.ref(!i.isExpand),h=e.ref(null),t=e.ref(!1),l=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)||[]),C=e.computed(()=>i.filterMode?w.value?.slice(0,2)||[]:w.value),k=e.computed(()=>i.filterMode?w.value.slice(2):[]),N=r=>{f.value={...r}},U=()=>{c(o.emitsMap.updateModelValue,{...f.value})},I=(r,u)=>{f.value[r]=u,V.value=!0,v(o.operationConfigMap.search),setTimeout(()=>{V.value=!1},200),B(r,u)},B=(r,u)=>{r&&c(o.emitsMap.change,r,u)},z=()=>f.value,x=(r,u)=>{V.value||c(o.emitsMap.operation,o.operationConfigMap.search,f.value)},v=r=>{U(),c(o.emitsMap.operation,r,f.value),(r===o.operationConfigMap.search||r===o.operationConfigMap.reset)&&(t.value=!1,l.value=!1)},R=r=>h.value.validate(r),b=e.ref(0),O=r=>{if(i.fixedWidth){b.value=132;return}b.value=r+32},q=()=>{n.value=!n.value},j=()=>{t.value=!1,l.value=!0},A=()=>{l.value=!1,t.value=!0},$=e.ref(!1),S=r=>{$.value=r>i.maxHeight},H=e.computed(()=>i.filterMode||n.value?"10px":"0");return e.onMounted(()=>{N(i.modelValue),S()}),e.watch(()=>i.modelValue,r=>{N(r)},{immediate:!0,deep:!0}),y({validate:R,getFormData:z,formRef:h}),(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":!n.value})},[e.createVNode(e.unref(d.ElAutoResizer),null,{default:e.withCtx(({height:s})=>[e.createTextVNode(e.toDisplayString(S(s))+" ",1),e.createVNode(D,{ref_key:"formRef",ref:h,items:C.value,"form-data":f.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:I,onEnter:x},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(C.value,m=>({name:m.key,fn:e.withCtx(E=>[e.renderSlot(r.$slots,m.key,e.normalizeProps(e.guardReactiveProps(E)),void 0,!0)])})),e.renderList(C.value,m=>({name:`${m.key}-label`,fn:e.withCtx(E=>[e.renderSlot(r.$slots,`${m.key}-label`,e.normalizeProps(e.guardReactiveProps(E)),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:H.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:t.value,placement:"bottom-start",width:628,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(e.unref(d.ElButton),{onClick:u[1]||(u[1]=s=>t.value=!t.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(P.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:j},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconMagnify))]),_:1})]),e.createVNode(D,{items:k.value,"form-data":f.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:B,onEnter:x},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(M,{"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},[$.value&&a.isExpand&&a.hideExpandButton?(e.openBlock(),e.createBlock(e.unref(d.ElButton),{key:0,icon:n.value?e.unref(g.IconUp):e.unref(g.IconDown),text:"",onClick:q},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.value?"收起":"展开"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),e.createVNode(M,{"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:l.value,"onUpdate:modelValue":u[2]||(u[2]=s=>l.value=s),size:"628","show-close":!1},{header:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(P.CustomTitle,{content:"筛选器",fontSize:16}),e.createVNode(e.unref(d.ElIcon),{size:16,onClick:A,class:"shrink-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.IconShrink))]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",te,[e.createVNode(D,{items:k.value,"form-data":f.value,"label-width":"auto","label-position":"top",inline:!1,"show-label":!0,"is-filter":!0,"min-width":a.minWidth,onChange:B,onEnter:x},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(M,{"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=F._export_sfc(le,[["__scopeId","data-v-0faf3524"]]),L=K.withInstall(oe);exports.SearchBar=L;exports.default=L;
|
package/lib/assets/SearchBar.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.filter-form[data-v-
|
|
1
|
+
.filter-form[data-v-048c4699]{grid-template-columns:repeat(2,1fr);gap:10px}.filter-preview-form[data-v-048c4699]{display:flex}.filter-preview-form .el-form-item[data-v-048c4699]{width:var(--v52e2daf2);margin-right:10px}.search-bar-form[data-v-048c4699]{grid-template-columns:repeat(auto-fit,minmax(var(--v52e2daf2),1fr));gap:10px}.search-bar-form.search-bar-form-fixed[data-v-048c4699]{grid-template-columns:repeat(auto-fit,var(--v52e2daf2))}.search-bar-form.search-bar-form-fixed.el-form--inline .el-form-item[data-v-048c4699]{margin-bottom:18px}.search-bar-form.el-form--inline .el-form-item[data-v-048c4699]{margin-right:0;margin-bottom:10px}.search-bar-form.el-form--inline .el-form-item.el-form-item--label-left[data-v-048c4699]{display:flex;padding:0 14px;background:var(--neutral-color-18);border-radius:8px;border:1px solid var(--parting-line)}.search-bar-form.el-form--inline .el-form-item.el-form-item--label-left[data-v-048c4699] .el-form-item__content{justify-content:end}.search-bar-form.el-form--inline.el-form--label-top[data-v-048c4699]{display:grid}.search-bar-item--wide[data-v-048c4699]{grid-column:span 2}.is-collapsed[data-v-0faf3524]{max-height:var(--v433e4c12)}.operation-buttons[data-v-0faf3524]{width:var(--v24a83611);z-index:1}.h-32[data-v-0faf3524]{height:32px}.drawer-header[data-v-0faf3524]{display:flex;justify-content:space-between;align-items:center;width:100%}.drawer-header .shrink-button[data-v-0faf3524]{margin-left:auto}.border-top[data-v-0faf3524]{border-top:1px solid var(--parting-line)}[data-v-0faf3524] .el-drawer__body{padding:16px 0;display:flex;flex-direction:column;overflow:hidden}.filter-form-popover[data-v-0faf3524]{max-height:400px}[data-v-0faf3524] .el-drawer__header{margin-bottom:0;padding:16px 16px 0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-star-custom-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"color-star-custom-components",
|
|
6
6
|
"component library",
|
|
@@ -175,9 +175,9 @@
|
|
|
175
175
|
"axios": "^1.8.2",
|
|
176
176
|
"vue": "^3.5.26",
|
|
177
177
|
"color-message-aibox-vue": "0.0.80",
|
|
178
|
+
"color-star-custom-methods": "0.0.20",
|
|
178
179
|
"color-message-lingyun-vue": "0.0.30",
|
|
179
|
-
"color-star-atom-style": "0.0.2"
|
|
180
|
-
"color-star-custom-methods": "0.0.17"
|
|
180
|
+
"color-star-atom-style": "0.0.2"
|
|
181
181
|
},
|
|
182
182
|
"optionalDependencies": {
|
|
183
183
|
"@ast-grep/napi-linux-x64-musl": "^0.39.6",
|