@scvzerng/element-plus-search-vue2 0.0.17 → 0.1.0
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/dist/ElementPlusSearch.es.js +515 -309
- package/dist/ElementPlusSearch.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/shared/src/SearchBarState.d.ts +38 -0
- package/dist/types/shared/src/SearchBarState.d.ts.map +1 -0
- package/dist/types/shared/src/Searches.d.ts +15 -0
- package/dist/types/shared/src/Searches.d.ts.map +1 -0
- package/dist/types/shared/src/core/SearchBarCore.d.ts +25 -0
- package/dist/types/shared/src/core/SearchBarCore.d.ts.map +1 -0
- package/dist/types/shared/src/core/index.d.ts +2 -0
- package/dist/types/shared/src/core/index.d.ts.map +1 -0
- package/dist/types/shared/src/index.d.ts +8 -0
- package/dist/types/shared/src/index.d.ts.map +1 -0
- package/dist/types/{model → shared/src/model}/SearchConfig.d.ts +10 -17
- package/dist/types/shared/src/model/SearchConfig.d.ts.map +1 -0
- package/dist/types/shared/src/model/SearchItem.d.ts +28 -0
- package/dist/types/shared/src/model/SearchItem.d.ts.map +1 -0
- package/dist/types/{model → shared/src/model}/SearchTag.d.ts +6 -6
- package/dist/types/shared/src/model/SearchTag.d.ts.map +1 -0
- package/dist/types/shared/src/model/index.d.ts +4 -0
- package/dist/types/shared/src/model/index.d.ts.map +1 -0
- package/dist/types/shared/src/setting/use-setting.d.ts +43 -0
- package/dist/types/shared/src/setting/use-setting.d.ts.map +1 -0
- package/dist/types/shared/src/storage/ConfigStorage.d.ts +22 -0
- package/dist/types/shared/src/storage/ConfigStorage.d.ts.map +1 -0
- package/dist/types/shared/src/storage/index.d.ts +2 -0
- package/dist/types/shared/src/storage/index.d.ts.map +1 -0
- package/dist/types/shared/src/types/SearchBarState.d.ts +17 -0
- package/dist/types/shared/src/types/SearchBarState.d.ts.map +1 -0
- package/dist/types/shared/src/types/SearchValueLike.d.ts +6 -0
- package/dist/types/shared/src/types/SearchValueLike.d.ts.map +1 -0
- package/dist/types/shared/src/types/Searchable.d.ts +20 -0
- package/dist/types/shared/src/types/Searchable.d.ts.map +1 -0
- package/dist/types/shared/src/types/index.d.ts +52 -0
- package/dist/types/shared/src/types/index.d.ts.map +1 -0
- package/dist/types/{SearchBar.vue.d.ts → vue2/src/SearchBar.vue.d.ts} +9 -9
- package/dist/types/vue2/src/SearchBar.vue.d.ts.map +1 -0
- package/dist/types/{SearchBarItem.vue.d.ts → vue2/src/SearchBarItem.vue.d.ts} +2 -1
- package/dist/types/vue2/src/SearchBarItem.vue.d.ts.map +1 -0
- package/dist/types/vue2/src/SearchBarState.d.ts +7 -0
- package/dist/types/vue2/src/SearchBarState.d.ts.map +1 -0
- package/dist/types/{SearchItemRender.d.ts → vue2/src/SearchItemRender.d.ts} +4 -3
- package/dist/types/vue2/src/SearchItemRender.d.ts.map +1 -0
- package/dist/types/{SearchTagsRender.vue.d.ts → vue2/src/SearchTagsRender.vue.d.ts} +1 -0
- package/dist/types/vue2/src/SearchTagsRender.vue.d.ts.map +1 -0
- package/dist/types/vue2/src/asserts/PinIcon.vue.d.ts +15 -0
- package/dist/types/vue2/src/asserts/PinIcon.vue.d.ts.map +1 -0
- package/dist/types/vue2/src/componentTextGetters.d.ts +3 -0
- package/dist/types/vue2/src/componentTextGetters.d.ts.map +1 -0
- package/dist/types/{helper → vue2/src/helper}/vModel.d.ts +2 -1
- package/dist/types/vue2/src/helper/vModel.d.ts.map +1 -0
- package/dist/types/vue2/src/index.d.ts +19 -0
- package/dist/types/vue2/src/index.d.ts.map +1 -0
- package/dist/types/{setting → vue2/src/setting}/SearchSettingsDrawer.vue.d.ts +2 -1
- package/dist/types/vue2/src/setting/SearchSettingsDrawer.vue.d.ts.map +1 -0
- package/dist/types/{setting → vue2/src/setting}/SettingButton.vue.d.ts +1 -0
- package/dist/types/vue2/src/setting/SettingButton.vue.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/favicon.ico +0 -0
- package/dist/types/SearchBarState.d.ts +0 -22
- package/dist/types/index.d.ts +0 -44
- package/dist/types/model/SearchItem.d.ts +0 -28
- package/dist/types/setting/use-setting.d.ts +0 -22
- package/dist/types/types/SearchValueLike.d.ts +0 -5
- package/dist/types/types/Searchable.d.ts +0 -44
|
@@ -1,71 +1,75 @@
|
|
|
1
|
-
import { get as
|
|
2
|
-
import { defineComponent as S, ref as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { get as E, set as I, sum as k, isFunction as A, keyBy as M, isNumber as K, isBoolean as G, isEmpty as R, isPlainObject as H } from "lodash-unified";
|
|
2
|
+
import { defineComponent as S, ref as f, watch as W, nextTick as U, shallowRef as z, inject as D, reactive as Y, computed as O, provide as F } from "vue";
|
|
3
|
+
import { useDebounceFn as X, useMutationObserver as V, watchDebounced as J } from "@vueuse/core";
|
|
4
|
+
const st = (r) => ({
|
|
5
5
|
model: {
|
|
6
|
-
value:
|
|
6
|
+
value: E(r, "value"),
|
|
7
7
|
callback: (e) => {
|
|
8
|
-
|
|
8
|
+
I(r, "value", e);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
}),
|
|
11
|
+
}), Q = S({
|
|
12
12
|
name: "SearchTags"
|
|
13
|
-
}),
|
|
14
|
-
...
|
|
13
|
+
}), Z = /* @__PURE__ */ S({
|
|
14
|
+
...Q,
|
|
15
15
|
props: {
|
|
16
16
|
tags: null
|
|
17
17
|
},
|
|
18
18
|
setup(r) {
|
|
19
|
-
const e = r, t =
|
|
19
|
+
const e = r, t = f(), s = () => {
|
|
20
20
|
t.value.scrollBy({ left: -200, behavior: "smooth" });
|
|
21
21
|
}, i = () => {
|
|
22
22
|
t.value.scrollBy({
|
|
23
23
|
left: 200,
|
|
24
24
|
behavior: "smooth"
|
|
25
25
|
});
|
|
26
|
-
}, a =
|
|
27
|
-
const
|
|
28
|
-
return
|
|
29
|
-
|
|
26
|
+
}, a = f(!1), l = () => {
|
|
27
|
+
const p = Array.from(t.value.children);
|
|
28
|
+
return k(
|
|
29
|
+
p.map((m) => m.getBoundingClientRect().width)
|
|
30
30
|
);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
}, n = () => t.value.getBoundingClientRect().width, c = () => {
|
|
32
|
+
t.value && (a.value = l() > n());
|
|
33
|
+
};
|
|
34
|
+
return W(
|
|
35
|
+
() => e.tags,
|
|
34
36
|
() => {
|
|
35
|
-
|
|
37
|
+
U(() => {
|
|
38
|
+
c();
|
|
39
|
+
});
|
|
36
40
|
},
|
|
37
|
-
{
|
|
38
|
-
), { __sfc: !0, props: e, scrollContainer: t, scrollLeft: s, scrollRight: i, showScrollBar: a, getTagsWidth: l, getContainerWidth:
|
|
41
|
+
{ immediate: !0, deep: !0 }
|
|
42
|
+
), { __sfc: !0, props: e, scrollContainer: t, scrollLeft: s, scrollRight: i, showScrollBar: a, getTagsWidth: l, getContainerWidth: n, checkScrollBar: c };
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
|
-
function
|
|
45
|
+
function w(r, e, t, s, i, a, l, n) {
|
|
42
46
|
var c = typeof r == "function" ? r.options : r;
|
|
43
47
|
return e && (c.render = e, c.staticRenderFns = t, c._compiled = !0), a && (c._scopeId = "data-v-" + a), {
|
|
44
48
|
exports: r,
|
|
45
49
|
options: c
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
|
-
var
|
|
52
|
+
var ee = function() {
|
|
49
53
|
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
50
54
|
return t("div", { staticClass: "tags-scroll-container" }, [t("el-tag", { directives: [{ name: "show", rawName: "v-show", value: s.showScrollBar, expression: "showScrollBar" }], staticClass: "scroll-left-bar", attrs: { "disable-transitions": "", size: "medium", type: "info" }, on: { click: s.scrollLeft } }, [t("i", { staticClass: "el-icon-arrow-left" })]), t("div", { ref: "scrollContainer", staticClass: "search-tags" }, e._l(e.tags, function(i) {
|
|
51
55
|
return t("el-tag", { key: i.field, staticClass: "search-tag", attrs: { "disable-transitions": "", closable: !i.required, type: i.required ? "primary" : "info" }, on: { close: () => i.clean() } }, [t("span", [e._v(" " + e._s(i.label) + " ")]), e._v(": "), t("span", { domProps: { innerHTML: e._s(i.valueText) } })]);
|
|
52
56
|
}), 1), t("el-tag", { directives: [{ name: "show", rawName: "v-show", value: s.showScrollBar, expression: "showScrollBar" }], staticClass: "scroll-right-bar", attrs: { "disable-transitions": "", size: "medium", type: "info" }, on: { click: s.scrollRight } }, [t("i", { staticClass: "el-icon-arrow-right" })])], 1);
|
|
53
|
-
},
|
|
54
|
-
J,
|
|
57
|
+
}, te = [], se = /* @__PURE__ */ w(
|
|
55
58
|
Z,
|
|
56
59
|
ee,
|
|
60
|
+
te,
|
|
57
61
|
!1,
|
|
58
62
|
null,
|
|
59
63
|
null
|
|
60
64
|
);
|
|
61
|
-
const
|
|
62
|
-
var
|
|
63
|
-
const
|
|
64
|
-
class
|
|
65
|
-
constructor(e, t) {
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
this.field = e.field, this.label = e.label, this.value = e.initValue, this.required = e.required, this.initValue = e.initValue, this.index = t, this.visible = (
|
|
65
|
+
const ie = se.exports;
|
|
66
|
+
var re = Object.defineProperty, ae = (r, e, t) => e in r ? re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, h = (r, e, t) => ae(r, typeof e != "symbol" ? e + "" : e, t);
|
|
67
|
+
const j = 6;
|
|
68
|
+
class ne {
|
|
69
|
+
constructor(e, t, s) {
|
|
70
|
+
h(this, "field"), h(this, "label"), h(this, "value"), h(this, "required"), h(this, "index"), h(this, "visible"), h(this, "disabled"), h(this, "span"), h(this, "initValue"), h(this, "enable"), h(this, "pinned"), h(this, "tagFilter"), h(this, "render"), h(this, "transform"), h(this, "onChange");
|
|
71
|
+
var i, a, l, n, c;
|
|
72
|
+
this.field = e.field, this.label = e.label, this.value = e.initValue, this.required = e.required, this.initValue = e.initValue, this.index = t, this.visible = (i = e.visible) != null ? i : !0, this.span = (a = e.span) != null ? a : j, this.render = e.render, this.tagFilter = e.tagFilter, this.transform = e.transform, this.enable = (l = e.enable) != null ? l : !0, this.disabled = (n = e.disabled) != null ? n : !1, this.pinned = (c = e.pinned) != null ? c : !1, e.onChange && s && (this.onChange = s((p, m) => e.onChange(p, m), 50));
|
|
69
73
|
}
|
|
70
74
|
clean() {
|
|
71
75
|
Array.isArray(this.value) ? this.value = [] : this.value = void 0;
|
|
@@ -74,19 +78,54 @@ class ae {
|
|
|
74
78
|
this.value = this.initValue;
|
|
75
79
|
}
|
|
76
80
|
isEnable(e) {
|
|
77
|
-
return
|
|
81
|
+
return A(this.enable) ? this.enable(e.getSearchObject()) : this.enable;
|
|
78
82
|
}
|
|
79
83
|
isDisabled(e) {
|
|
80
|
-
return
|
|
84
|
+
return A(this.disabled) ? this.disabled(e.getSearchObject()) : this.disabled;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
var le = Object.defineProperty, oe = (r, e, t) => e in r ? le(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, ce = (r, e, t) => oe(r, e + "", t);
|
|
88
|
+
class ue {
|
|
89
|
+
cacheKey(e) {
|
|
90
|
+
return `searches_layouts_${e}`;
|
|
91
|
+
}
|
|
92
|
+
async load(e) {
|
|
93
|
+
const t = localStorage.getItem(this.cacheKey(e));
|
|
94
|
+
return t ? t.split(",").map((s) => {
|
|
95
|
+
const [i, a, l, n, c] = s.split("_");
|
|
96
|
+
return {
|
|
97
|
+
field: a,
|
|
98
|
+
span: Number(l),
|
|
99
|
+
index: Number(i),
|
|
100
|
+
visible: n === "true",
|
|
101
|
+
pinned: c === "true"
|
|
102
|
+
};
|
|
103
|
+
}) : null;
|
|
104
|
+
}
|
|
105
|
+
async save(e, t) {
|
|
106
|
+
const s = t.map((i) => `${i.index}_${i.field}_${i.span}_${i.visible}_${i.pinned}`).join(",");
|
|
107
|
+
localStorage.setItem(this.cacheKey(e), s);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
class it {
|
|
111
|
+
constructor() {
|
|
112
|
+
ce(this, "cache", /* @__PURE__ */ new Map());
|
|
113
|
+
}
|
|
114
|
+
async load(e) {
|
|
115
|
+
var t;
|
|
116
|
+
return (t = this.cache.get(e)) != null ? t : null;
|
|
117
|
+
}
|
|
118
|
+
async save(e, t) {
|
|
119
|
+
this.cache.set(e, t);
|
|
81
120
|
}
|
|
82
121
|
}
|
|
83
|
-
var
|
|
84
|
-
class
|
|
122
|
+
var he = Object.defineProperty, de = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, _ = (r, e, t) => de(r, typeof e != "symbol" ? e + "" : e, t);
|
|
123
|
+
class y {
|
|
85
124
|
constructor(e, t, s, i, a) {
|
|
86
|
-
|
|
125
|
+
_(this, "field"), _(this, "span"), _(this, "index"), _(this, "visible"), _(this, "pinned"), this.field = e, this.span = t, this.index = s, this.visible = i, this.pinned = a;
|
|
87
126
|
}
|
|
88
127
|
static fromSearchItem(e, t) {
|
|
89
|
-
return new
|
|
128
|
+
return new y(
|
|
90
129
|
e.field,
|
|
91
130
|
e.span,
|
|
92
131
|
t ?? e.index,
|
|
@@ -96,39 +135,39 @@ class b {
|
|
|
96
135
|
}
|
|
97
136
|
static formSearchConfig(e, t) {
|
|
98
137
|
var s, i, a;
|
|
99
|
-
return new
|
|
138
|
+
return new y(
|
|
100
139
|
e.field,
|
|
101
|
-
(s = e.span) != null ? s :
|
|
140
|
+
(s = e.span) != null ? s : j,
|
|
102
141
|
t ?? e,
|
|
103
142
|
(i = e.visible) != null ? i : !0,
|
|
104
143
|
(a = e.pinned) != null ? a : !1
|
|
105
144
|
);
|
|
106
145
|
}
|
|
107
|
-
static
|
|
108
|
-
|
|
109
|
-
return new b(s, Number(i), Number(t), a === "true", l === "true");
|
|
146
|
+
static fromLayoutData(e) {
|
|
147
|
+
return new y(e.field, e.span, e.index, e.visible, e.pinned);
|
|
110
148
|
}
|
|
111
|
-
|
|
112
|
-
return
|
|
149
|
+
toLayoutData() {
|
|
150
|
+
return {
|
|
151
|
+
field: this.field,
|
|
152
|
+
span: this.span,
|
|
153
|
+
index: this.index,
|
|
154
|
+
visible: this.visible,
|
|
155
|
+
pinned: this.pinned
|
|
156
|
+
};
|
|
113
157
|
}
|
|
114
158
|
merge(e) {
|
|
115
159
|
this.span = e.span, this.index = e.index, this.visible = e.visible, this.pinned = e.pinned;
|
|
116
160
|
}
|
|
117
161
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
restoreCachedLayouts() {
|
|
128
|
-
const e = localStorage.getItem(B(this.id));
|
|
129
|
-
e && e.split(",").forEach((t) => {
|
|
130
|
-
const s = b.fromString(t), i = this.itemLayouts[s.field];
|
|
131
|
-
i && i.merge(s);
|
|
162
|
+
class fe {
|
|
163
|
+
constructor(e, t, s) {
|
|
164
|
+
_(this, "id"), _(this, "state"), _(this, "itemLayouts"), _(this, "initialLayouts"), _(this, "storage"), this.id = e.id, this.initialLayouts = t, this.state = e, this.storage = s ?? new ue(), this.itemLayouts = M(e.items.map(y.fromSearchItem), (i) => i.field), this.restoreCachedLayouts();
|
|
165
|
+
}
|
|
166
|
+
async restoreCachedLayouts() {
|
|
167
|
+
const e = await this.storage.load(this.id);
|
|
168
|
+
e && e.forEach((t) => {
|
|
169
|
+
const s = this.itemLayouts[t.field];
|
|
170
|
+
s && s.merge(y.fromLayoutData(t));
|
|
132
171
|
});
|
|
133
172
|
}
|
|
134
173
|
sync(e, t, s) {
|
|
@@ -139,10 +178,10 @@ class oe {
|
|
|
139
178
|
l.index = a, l.visible = t.has(i), l.pinned = s.has(i);
|
|
140
179
|
});
|
|
141
180
|
}
|
|
142
|
-
persistent() {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Object.values(this.itemLayouts).map((e) => e.
|
|
181
|
+
async persistent() {
|
|
182
|
+
await this.storage.save(
|
|
183
|
+
this.id,
|
|
184
|
+
Object.values(this.itemLayouts).map((e) => e.toLayoutData())
|
|
146
185
|
), this.state.updateTags();
|
|
147
186
|
}
|
|
148
187
|
reset() {
|
|
@@ -152,8 +191,295 @@ class oe {
|
|
|
152
191
|
});
|
|
153
192
|
}
|
|
154
193
|
}
|
|
155
|
-
var
|
|
156
|
-
|
|
194
|
+
var pe = Object.defineProperty, ve = (r, e, t) => e in r ? pe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, g = (r, e, t) => ve(r, typeof e != "symbol" ? e + "" : e, t);
|
|
195
|
+
class B {
|
|
196
|
+
constructor(e, t, s) {
|
|
197
|
+
g(this, "id"), g(this, "field"), g(this, "value"), g(this, "label"), g(this, "valueText"), g(this, "required"), g(this, "item"), g(this, "state"), g(this, "componentTextGetters");
|
|
198
|
+
var i;
|
|
199
|
+
this.id = `#${e.id}-${t.field}`, this.state = e, this.field = t.field, this.value = t.value, this.label = t.label, this.item = t, this.required = (i = t.required) != null ? i : !1, this.componentTextGetters = s, this.updateValueText();
|
|
200
|
+
}
|
|
201
|
+
static hasValue(e) {
|
|
202
|
+
return K(e.value) || G(e.value) ? !0 : !R(e.value);
|
|
203
|
+
}
|
|
204
|
+
updateValueText() {
|
|
205
|
+
const e = document.querySelector(this.id);
|
|
206
|
+
if (!e || e.children.length !== 1)
|
|
207
|
+
return;
|
|
208
|
+
const t = e.children[0], s = this.componentTextGetters.find((i) => i.isApply(t.classList));
|
|
209
|
+
s && (this.valueText = s.getText(t, this));
|
|
210
|
+
}
|
|
211
|
+
async clean() {
|
|
212
|
+
this.item.clean(), await this.state.doSearch();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
var _e = Object.defineProperty, ge = (r, e, t) => e in r ? _e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, me = (r, e, t) => ge(r, e + "", t);
|
|
216
|
+
const rt = (r) => R(r), at = () => !0, nt = (r, e) => {
|
|
217
|
+
const t = r.getSearchObject();
|
|
218
|
+
let s = !0;
|
|
219
|
+
for (const [i, a] of Object.entries(e)) {
|
|
220
|
+
const l = t[i];
|
|
221
|
+
s = a(l), s || (s = !1);
|
|
222
|
+
}
|
|
223
|
+
return () => s;
|
|
224
|
+
};
|
|
225
|
+
class P {
|
|
226
|
+
constructor(e) {
|
|
227
|
+
me(this, "record"), this.record = e;
|
|
228
|
+
}
|
|
229
|
+
static from(e) {
|
|
230
|
+
const t = e.filter((s) => s.value === void 0 ? !1 : Array.isArray(s.value) ? s.value.length > 0 : !0).reduce(
|
|
231
|
+
(s, i) => {
|
|
232
|
+
const a = i.transform ? i.transform(i.value) : i.value;
|
|
233
|
+
return {
|
|
234
|
+
...s,
|
|
235
|
+
...H(a) ? a : { [i.field]: a }
|
|
236
|
+
};
|
|
237
|
+
},
|
|
238
|
+
{}
|
|
239
|
+
);
|
|
240
|
+
return new P(t);
|
|
241
|
+
}
|
|
242
|
+
transform(e, t) {
|
|
243
|
+
const s = this.record[e], i = t(s);
|
|
244
|
+
return delete this.record[e], this.record = { ...this.record, ...i }, this;
|
|
245
|
+
}
|
|
246
|
+
toCondition(e) {
|
|
247
|
+
return { ...this.record, ...e };
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
var be = Object.defineProperty, ye = (r, e, t) => e in r ? be(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, $ = (r, e, t) => ye(r, typeof e != "symbol" ? e + "" : e, t);
|
|
251
|
+
class Se {
|
|
252
|
+
constructor(e) {
|
|
253
|
+
$(this, "config"), $(this, "_state"), $(this, "listeners", /* @__PURE__ */ new Set()), $(this, "debounceTimers", /* @__PURE__ */ new Map()), this.config = e, this._state = {
|
|
254
|
+
id: e.id,
|
|
255
|
+
values: this.initValues(e.searches),
|
|
256
|
+
tags: [],
|
|
257
|
+
searching: !1
|
|
258
|
+
}, this.updateTags();
|
|
259
|
+
}
|
|
260
|
+
initValues(e) {
|
|
261
|
+
const t = {};
|
|
262
|
+
for (const s of e)
|
|
263
|
+
t[s.field] = s.initValue;
|
|
264
|
+
return t;
|
|
265
|
+
}
|
|
266
|
+
getState() {
|
|
267
|
+
return { ...this._state };
|
|
268
|
+
}
|
|
269
|
+
subscribe(e) {
|
|
270
|
+
return this.listeners.add(e), () => this.listeners.delete(e);
|
|
271
|
+
}
|
|
272
|
+
notify() {
|
|
273
|
+
const e = this.getState();
|
|
274
|
+
for (const t of this.listeners)
|
|
275
|
+
t(e);
|
|
276
|
+
}
|
|
277
|
+
getValue(e) {
|
|
278
|
+
return this._state.values[e];
|
|
279
|
+
}
|
|
280
|
+
setValue(e, t, s) {
|
|
281
|
+
this._state.values[e] = t;
|
|
282
|
+
const i = this.config.searches.find((a) => a.field === e);
|
|
283
|
+
if (i != null && i.onChange)
|
|
284
|
+
if (s) {
|
|
285
|
+
const a = this.debounceTimers.get(e);
|
|
286
|
+
a && clearTimeout(a), this.debounceTimers.set(e, setTimeout(() => {
|
|
287
|
+
i.onChange(t, this.createContext()), this.debounceTimers.delete(e);
|
|
288
|
+
}, s));
|
|
289
|
+
} else
|
|
290
|
+
i.onChange(t, this.createContext());
|
|
291
|
+
this.notify();
|
|
292
|
+
}
|
|
293
|
+
createContext() {
|
|
294
|
+
return {
|
|
295
|
+
id: this.config.id,
|
|
296
|
+
getValue: (e) => this.getValue(e),
|
|
297
|
+
setValue: (e, t) => this.setValue(e, t),
|
|
298
|
+
getSearchObject: () => this.getSearchObject(),
|
|
299
|
+
doSearch: () => this.doSearch(),
|
|
300
|
+
reset: () => this.reset(),
|
|
301
|
+
updateTags: () => this.updateTags()
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
getSearchObject() {
|
|
305
|
+
const e = {};
|
|
306
|
+
for (const t of this.config.searches) {
|
|
307
|
+
const s = this._state.values[t.field];
|
|
308
|
+
s !== void 0 && s !== "" && s !== null && (t.transform ? Object.assign(e, t.transform(s)) : e[t.field] = s);
|
|
309
|
+
}
|
|
310
|
+
return e;
|
|
311
|
+
}
|
|
312
|
+
async doSearch() {
|
|
313
|
+
if (!this._state.searching)
|
|
314
|
+
try {
|
|
315
|
+
this._state.searching = !0, this.notify(), await this.config.onSearch(this.getSearchObject()), this.updateTags();
|
|
316
|
+
} finally {
|
|
317
|
+
this._state.searching = !1, this.notify();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
reset() {
|
|
321
|
+
for (const e of this.config.searches)
|
|
322
|
+
this._state.values[e.field] = e.initValue;
|
|
323
|
+
this._state.tags = [], this.notify();
|
|
324
|
+
}
|
|
325
|
+
updateTags() {
|
|
326
|
+
var e, t;
|
|
327
|
+
const s = [];
|
|
328
|
+
for (const i of this.config.searches) {
|
|
329
|
+
const a = this._state.values[i.field];
|
|
330
|
+
(i.tagFilter ? i.tagFilter(a) : this.defaultHasValue(a)) && s.push({
|
|
331
|
+
field: i.field,
|
|
332
|
+
label: i.label,
|
|
333
|
+
value: a,
|
|
334
|
+
valueText: void 0,
|
|
335
|
+
required: (e = i.required) != null ? e : !1,
|
|
336
|
+
closable: !((t = i.required) != null && t)
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
this._state.tags = s, this.notify();
|
|
340
|
+
}
|
|
341
|
+
defaultHasValue(e) {
|
|
342
|
+
return e == null ? !1 : typeof e == "number" || typeof e == "boolean" ? !0 : Array.isArray(e) ? e.length > 0 : typeof e == "string" ? e.trim() !== "" : !0;
|
|
343
|
+
}
|
|
344
|
+
updateTagValueText(e, t) {
|
|
345
|
+
const s = this._state.tags.find((i) => i.field === e);
|
|
346
|
+
s && (s.valueText = t, this.notify());
|
|
347
|
+
}
|
|
348
|
+
getApi() {
|
|
349
|
+
return {
|
|
350
|
+
...this.createContext(),
|
|
351
|
+
state: this.getState(),
|
|
352
|
+
fields: this.config.searches
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
var we = Object.defineProperty, xe = (r, e, t) => e in r ? we(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, v = (r, e, t) => xe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
357
|
+
let Ce = class N {
|
|
358
|
+
constructor(e, t, s, i, a, l) {
|
|
359
|
+
this.id = e, v(this, "items"), v(this, "config"), v(this, "searching"), v(this, "tags"), v(this, "searchCallback"), v(this, "sourceSearchable"), v(this, "componentTextGetters"), v(this, "core"), v(this, "unsubscribe"), v(this, "_lastSearchObject", { time: 0, data: null }), this.id = e, this.items = t.map((n, c) => new ne(n, c, i)), this.config = new fe(
|
|
360
|
+
this,
|
|
361
|
+
t.map((n, c) => y.formSearchConfig(n, c)),
|
|
362
|
+
l
|
|
363
|
+
), this.componentTextGetters = a, this.sourceSearchable = t, this.searching = !1, this.searchCallback = s, this.tags = [], this.core = new Se({
|
|
364
|
+
id: e,
|
|
365
|
+
searches: t.map((n) => ({
|
|
366
|
+
field: n.field,
|
|
367
|
+
label: n.label,
|
|
368
|
+
render: n.render,
|
|
369
|
+
initValue: n.initValue,
|
|
370
|
+
required: n.required,
|
|
371
|
+
visible: n.visible,
|
|
372
|
+
pinned: n.pinned,
|
|
373
|
+
span: n.span,
|
|
374
|
+
disabled: n.disabled,
|
|
375
|
+
enable: n.enable,
|
|
376
|
+
tagFilter: n.tagFilter,
|
|
377
|
+
transform: n.transform,
|
|
378
|
+
onChange: n.onChange
|
|
379
|
+
})),
|
|
380
|
+
onSearch: s
|
|
381
|
+
}), this.unsubscribe = this.core.subscribe((n) => {
|
|
382
|
+
this.searching = n.searching;
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
static create(e) {
|
|
386
|
+
return new N(
|
|
387
|
+
e.id,
|
|
388
|
+
e.searches,
|
|
389
|
+
e.onSearch,
|
|
390
|
+
e.debounceFn,
|
|
391
|
+
e.componentTextGetters,
|
|
392
|
+
e.storage
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
updateSearchTag(e) {
|
|
396
|
+
var t;
|
|
397
|
+
(t = this.tags.find((s) => s.field === e)) == null || t.updateValueText();
|
|
398
|
+
}
|
|
399
|
+
updateTags() {
|
|
400
|
+
this.tags = this.items.filter((e) => e.tagFilter ? e.tagFilter(e.value) : B.hasValue(e)).map((e) => new B(this, e, this.componentTextGetters)).sort(
|
|
401
|
+
(e, t) => this.config.itemLayouts[e.field].index - this.config.itemLayouts[t.field].index
|
|
402
|
+
), this.core.updateTags();
|
|
403
|
+
}
|
|
404
|
+
getSearchObject(e) {
|
|
405
|
+
const t = Date.now();
|
|
406
|
+
return this._lastSearchObject.data && t - this._lastSearchObject.time < 50 ? this._lastSearchObject.data : (this._lastSearchObject = { time: t, data: P.from(this.items).toCondition(e) }, this._lastSearchObject.data);
|
|
407
|
+
}
|
|
408
|
+
async doSearch() {
|
|
409
|
+
if (!this.searching)
|
|
410
|
+
try {
|
|
411
|
+
this.searching = !0, await this.searchCallback(this.getSearchObject()), this.updateTags();
|
|
412
|
+
} finally {
|
|
413
|
+
this.searching = !1;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
async reset(e) {
|
|
417
|
+
this.items.forEach((t) => t.reset()), this.core.reset(), e && await this.doSearch();
|
|
418
|
+
}
|
|
419
|
+
setSearchValue(e, t, s = (i) => !0) {
|
|
420
|
+
const i = this.items.find((a) => a.field === e);
|
|
421
|
+
i && s && s(i.value) && (i.value = t, this.core.setValue(e, t));
|
|
422
|
+
}
|
|
423
|
+
destroy() {
|
|
424
|
+
var e;
|
|
425
|
+
(e = this.unsubscribe) == null || e.call(this);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
const Te = () => {
|
|
429
|
+
const r = z(), e = f(), t = f([]), s = f(!1), i = f(), a = f([]), l = f(300), n = (o) => {
|
|
430
|
+
r.value = o, t.value = [
|
|
431
|
+
{
|
|
432
|
+
label: "全部",
|
|
433
|
+
id: "all",
|
|
434
|
+
children: r.value.items.sort(
|
|
435
|
+
(u, d) => o.config.itemLayouts[u.field].index - o.config.itemLayouts[d.field].index
|
|
436
|
+
).map((u) => ({
|
|
437
|
+
label: u.label,
|
|
438
|
+
id: u.field,
|
|
439
|
+
disabled: !u.isEnable(o),
|
|
440
|
+
pinned: o.config.itemLayouts[u.field].pinned
|
|
441
|
+
}))
|
|
442
|
+
}
|
|
443
|
+
], i.value = Object.keys(o.config.itemLayouts).filter(
|
|
444
|
+
(u) => {
|
|
445
|
+
var d;
|
|
446
|
+
return (d = o.config.itemLayouts[u]) == null ? void 0 : d.visible;
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
return {
|
|
451
|
+
treeRef: e,
|
|
452
|
+
visible: s,
|
|
453
|
+
snapshot: t,
|
|
454
|
+
defaultCheckedKeys: i,
|
|
455
|
+
drawerWidth: l,
|
|
456
|
+
updateSnapshot: n,
|
|
457
|
+
show: (o) => {
|
|
458
|
+
n(o), s.value = !0;
|
|
459
|
+
},
|
|
460
|
+
save: () => {
|
|
461
|
+
r.value.config.sync(
|
|
462
|
+
t.value[0].children.map((o) => o.id),
|
|
463
|
+
new Set(e.value.getCheckedKeys()),
|
|
464
|
+
new Set(t.value[0].children.filter((o) => o.pinned).map((o) => o.id))
|
|
465
|
+
), r.value.config.persistent(), s.value = !1;
|
|
466
|
+
},
|
|
467
|
+
reset: () => {
|
|
468
|
+
r.value.config.reset(), n(r.value);
|
|
469
|
+
},
|
|
470
|
+
keepSelection: () => {
|
|
471
|
+
a.value = e.value.getCheckedKeys();
|
|
472
|
+
},
|
|
473
|
+
restoreSelection: () => {
|
|
474
|
+
e.value.setCheckedKeys(a.value), a.value = [];
|
|
475
|
+
},
|
|
476
|
+
allowDrop: (o, u, d) => d !== "inner",
|
|
477
|
+
allowDrag: (o) => !o.disabled,
|
|
478
|
+
onPinnedChange: (o) => {
|
|
479
|
+
o.data.pinned = !o.data.pinned;
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
}, $e = [
|
|
157
483
|
{
|
|
158
484
|
isApply(r) {
|
|
159
485
|
return r.contains("el-radio-group");
|
|
@@ -173,7 +499,10 @@ const de = [
|
|
|
173
499
|
var i;
|
|
174
500
|
return (i = s.querySelector("input")) == null ? void 0 : i.value;
|
|
175
501
|
}).filter((s) => s);
|
|
176
|
-
|
|
502
|
+
if (t.length === 1)
|
|
503
|
+
return t[0];
|
|
504
|
+
if (t.length > 1)
|
|
505
|
+
return `${t[0]} 等${t.length}条`;
|
|
177
506
|
}
|
|
178
507
|
},
|
|
179
508
|
{
|
|
@@ -197,9 +526,9 @@ const de = [
|
|
|
197
526
|
return r.contains("el-select");
|
|
198
527
|
},
|
|
199
528
|
getText(r, e) {
|
|
200
|
-
var t;
|
|
201
|
-
const
|
|
202
|
-
return
|
|
529
|
+
var t, s;
|
|
530
|
+
const i = r.querySelectorAll(".el-select__tags-text");
|
|
531
|
+
return i.length > 0 ? e.value.length > 1 ? `${i[0].textContent} 等${e.value.length}条` : (t = i[0].textContent) != null ? t : void 0 : (s = r.querySelector("input")) == null ? void 0 : s.value;
|
|
203
532
|
}
|
|
204
533
|
},
|
|
205
534
|
{
|
|
@@ -216,7 +545,8 @@ const de = [
|
|
|
216
545
|
return r.contains("el-switch");
|
|
217
546
|
},
|
|
218
547
|
getText(r) {
|
|
219
|
-
|
|
548
|
+
const e = r.querySelector(".is-active");
|
|
549
|
+
return e == null ? void 0 : e.innerHTML;
|
|
220
550
|
}
|
|
221
551
|
},
|
|
222
552
|
{
|
|
@@ -232,132 +562,38 @@ const de = [
|
|
|
232
562
|
return r.contains("el-date-editor");
|
|
233
563
|
},
|
|
234
564
|
getText(r, e) {
|
|
235
|
-
return e.value ? e.value.join(" ~ ") : e.value;
|
|
565
|
+
return Array.isArray(e.value) ? e.value.join(" ~ ") : e.value;
|
|
236
566
|
}
|
|
237
567
|
}
|
|
238
568
|
];
|
|
239
|
-
class
|
|
240
|
-
constructor(e, t) {
|
|
241
|
-
|
|
242
|
-
var s;
|
|
243
|
-
this.id = `#${e.id}-${t.field}`, this.state = e, this.field = t.field, this.value = t.value, this.label = t.label, this.item = t, this.required = (s = t.required) != null ? s : !1, this.updateValueText();
|
|
244
|
-
}
|
|
245
|
-
static hasValue(e) {
|
|
246
|
-
return Q(e.value) || M(e.value) ? !0 : !$(e.value);
|
|
247
|
-
}
|
|
248
|
-
updateValueText() {
|
|
249
|
-
const e = document.querySelector(this.id);
|
|
250
|
-
if (!e)
|
|
251
|
-
return;
|
|
252
|
-
if (e.children.length !== 1)
|
|
253
|
-
throw new Error("holder children length is not 1");
|
|
254
|
-
const t = e.children[0], s = de.find((i) => i.isApply(t.classList));
|
|
255
|
-
s && (this.valueText = s.getText(t, this));
|
|
256
|
-
}
|
|
257
|
-
async clean() {
|
|
258
|
-
this.item.clean(), await this.state.doSearch();
|
|
569
|
+
class Le extends Ce {
|
|
570
|
+
constructor(e, t, s, i) {
|
|
571
|
+
super(e, t, s, X, $e, i);
|
|
259
572
|
}
|
|
260
573
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
), this.sourceSearchable = t, this.searching = !1, this.searchCallback = s, this.tags = [];
|
|
268
|
-
}
|
|
269
|
-
updateSearchTag(e) {
|
|
270
|
-
var t;
|
|
271
|
-
(t = this.tags.find((s) => s.field === e)) == null || t.updateValueText();
|
|
272
|
-
}
|
|
273
|
-
updateTags() {
|
|
274
|
-
this.tags = this.items.filter((e) => e.tagFilter ? e.tagFilter(e.value) : R.hasValue(e)).map((e) => new R(this, e)).sort(
|
|
275
|
-
(e, t) => this.config.itemLayouts[e.field].index - this.config.itemLayouts[t.field].index
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
getSearchObject(e) {
|
|
279
|
-
const t = Date.now();
|
|
280
|
-
return this._lastSearchObject.data && t - this._lastSearchObject.time < 50 ? this._lastSearchObject.data : (this._lastSearchObject = { time: t, data: D.from(this.items).toCondition(e) }, this._lastSearchObject.data);
|
|
281
|
-
}
|
|
282
|
-
async doSearch() {
|
|
283
|
-
if (!this.searching)
|
|
284
|
-
try {
|
|
285
|
-
this.searching = !0, await this.searchCallback(this.getSearchObject()), this.updateTags();
|
|
286
|
-
} finally {
|
|
287
|
-
this.searching = !1;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
async reset(e) {
|
|
291
|
-
this.items.forEach((t) => t.reset()), e && await this.doSearch();
|
|
292
|
-
}
|
|
293
|
-
setSearchValue(e, t, s = (i) => !0) {
|
|
294
|
-
const i = this.items.find((a) => a.field === e);
|
|
295
|
-
i && s && s(i.value) && (i.value = t);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
const ve = () => {
|
|
299
|
-
const r = H(), e = h(), t = h([]), s = h(!1), i = h(), a = h([]), l = h(300), u = (n) => {
|
|
300
|
-
r.value = n, t.value = [
|
|
301
|
-
{
|
|
302
|
-
label: "全部",
|
|
303
|
-
id: "all",
|
|
304
|
-
children: r.value.items.sort(
|
|
305
|
-
(o, v) => n.config.itemLayouts[o.field].index - n.config.itemLayouts[v.field].index
|
|
306
|
-
).map((o) => ({
|
|
307
|
-
label: o.label,
|
|
308
|
-
id: o.field,
|
|
309
|
-
disabled: !o.isEnable(n),
|
|
310
|
-
pinned: n.config.itemLayouts[o.field].pinned
|
|
311
|
-
}))
|
|
312
|
-
}
|
|
313
|
-
], i.value = Object.keys(n.config.itemLayouts).filter(
|
|
314
|
-
(o) => {
|
|
315
|
-
var v;
|
|
316
|
-
return (v = n.config.itemLayouts[o]) == null ? void 0 : v.visible;
|
|
317
|
-
}
|
|
318
|
-
);
|
|
319
|
-
};
|
|
320
|
-
return {
|
|
321
|
-
treeRef: e,
|
|
322
|
-
visible: s,
|
|
323
|
-
snapshot: t,
|
|
324
|
-
defaultCheckedKeys: i,
|
|
325
|
-
drawerWidth: l,
|
|
326
|
-
updateSnapshot: u,
|
|
327
|
-
show: (n) => {
|
|
328
|
-
u(n), s.value = !0;
|
|
329
|
-
},
|
|
330
|
-
save: () => {
|
|
331
|
-
r.value.config.sync(
|
|
332
|
-
t.value[0].children.map((n) => n.id),
|
|
333
|
-
new Set(e.value.getCheckedKeys()),
|
|
334
|
-
new Set(t.value[0].children.filter((n) => n.pinned).map((n) => n.id))
|
|
335
|
-
), r.value.config.persistent(), s.value = !1;
|
|
336
|
-
},
|
|
337
|
-
reset: () => {
|
|
338
|
-
r.value.config.reset(), u(r.value);
|
|
339
|
-
},
|
|
340
|
-
keepSelection: () => {
|
|
341
|
-
a.value = e.value.getCheckedKeys();
|
|
342
|
-
},
|
|
343
|
-
restoreSelection: () => {
|
|
344
|
-
e.value.setCheckedKeys(a.value), a.value = [];
|
|
345
|
-
},
|
|
346
|
-
allowDrop: (n, o, v) => v === "inner" ? !1 : !((k, I) => {
|
|
347
|
-
let L = k.parent;
|
|
348
|
-
for (; L; ) {
|
|
349
|
-
if (L === I)
|
|
350
|
-
return !0;
|
|
351
|
-
L = L.parent;
|
|
352
|
-
}
|
|
353
|
-
return !1;
|
|
354
|
-
})(n, o),
|
|
355
|
-
allowDrag: (n) => !n.disabled,
|
|
356
|
-
onPinnedChange: (n) => {
|
|
357
|
-
n.data.pinned = !n.data.pinned;
|
|
574
|
+
const Oe = {
|
|
575
|
+
name: "PinIcon",
|
|
576
|
+
props: {
|
|
577
|
+
active: {
|
|
578
|
+
type: Boolean,
|
|
579
|
+
default: !1
|
|
358
580
|
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
var Pe = function() {
|
|
584
|
+
var e = this, t = e._self._c;
|
|
585
|
+
return t("svg", { class: ["pin-icon", { "is-active": e.active }], attrs: { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16" }, on: { click: function(s) {
|
|
586
|
+
return s.stopPropagation(), e.$emit("click");
|
|
587
|
+
} } }, [t("path", { attrs: { d: "M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z" } })]);
|
|
588
|
+
}, Ae = [], De = /* @__PURE__ */ w(
|
|
589
|
+
Oe,
|
|
590
|
+
Pe,
|
|
591
|
+
Ae,
|
|
592
|
+
!1,
|
|
593
|
+
null,
|
|
594
|
+
"b04d59bb"
|
|
595
|
+
);
|
|
596
|
+
const Fe = De.exports, Ve = /* @__PURE__ */ S({
|
|
361
597
|
__name: "SearchSettingsDrawer",
|
|
362
598
|
setup(r, { expose: e }) {
|
|
363
599
|
const {
|
|
@@ -366,61 +602,61 @@ const ve = () => {
|
|
|
366
602
|
snapshot: i,
|
|
367
603
|
drawerWidth: a,
|
|
368
604
|
defaultCheckedKeys: l,
|
|
369
|
-
show:
|
|
605
|
+
show: n,
|
|
370
606
|
allowDrop: c,
|
|
371
|
-
allowDrag:
|
|
372
|
-
keepSelection:
|
|
373
|
-
restoreSelection:
|
|
374
|
-
save:
|
|
375
|
-
reset:
|
|
376
|
-
onPinnedChange:
|
|
377
|
-
} =
|
|
607
|
+
allowDrag: p,
|
|
608
|
+
keepSelection: m,
|
|
609
|
+
restoreSelection: x,
|
|
610
|
+
save: b,
|
|
611
|
+
reset: C,
|
|
612
|
+
onPinnedChange: T
|
|
613
|
+
} = Te();
|
|
378
614
|
return e({
|
|
379
|
-
show:
|
|
380
|
-
}), { __sfc: !0, treeRef: t, visible: s, snapshot: i, drawerWidth: a, defaultCheckedKeys: l, show:
|
|
615
|
+
show: n
|
|
616
|
+
}), { __sfc: !0, treeRef: t, visible: s, snapshot: i, drawerWidth: a, defaultCheckedKeys: l, show: n, allowDrop: c, allowDrag: p, keepSelection: m, restoreSelection: x, save: b, reset: C, onPinnedChange: T, PinIcon: Fe };
|
|
381
617
|
}
|
|
382
618
|
});
|
|
383
|
-
var
|
|
619
|
+
var Be = function() {
|
|
384
620
|
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
385
621
|
return t("el-drawer", { attrs: { size: s.drawerWidth, title: "搜索项配置", visible: s.visible, "modal-append-to-body": !0, "append-to-body": !0 }, on: { "update:visible": function(i) {
|
|
386
622
|
s.visible = i;
|
|
387
623
|
} } }, [t("div", { staticClass: "setting-container" }, [t("el-tree", { ref: "treeRef", staticClass: "tree", attrs: { "default-expand-all": "", "default-checked-keys": s.defaultCheckedKeys, "node-key": "id", draggable: "", "show-checkbox": "", data: s.snapshot, "allow-drop": s.allowDrop, "allow-drag": s.allowDrag, "expand-on-click-node": !1 }, on: { "node-drag-start": s.keepSelection, "node-drag-end": s.restoreSelection }, scopedSlots: e._u([{ key: "default", fn: function({ node: i }) {
|
|
388
|
-
return [t("span", { staticClass: "custom-tree-node" }, [t("span", [e._v(e._s(i.label))]), i.data.id !== "all" ? t(
|
|
624
|
+
return [t("span", { staticClass: "custom-tree-node" }, [t("span", [e._v(e._s(i.label))]), i.data.id !== "all" ? t(s.PinIcon, { attrs: { active: i.data.pinned }, on: { click: function(a) {
|
|
389
625
|
return s.onPinnedChange(i);
|
|
390
|
-
} } }
|
|
626
|
+
} } }) : e._e()], 1)];
|
|
391
627
|
} }]) }), t("div", { staticClass: "footer" }, [t("el-button", { on: { click: s.reset } }, [e._v("重置")]), t("el-button", { attrs: { type: "primary" }, on: { click: s.save } }, [e._v("保存")])], 1)], 1)]);
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
628
|
+
}, Re = [], je = /* @__PURE__ */ w(
|
|
629
|
+
Ve,
|
|
630
|
+
Be,
|
|
631
|
+
Re,
|
|
396
632
|
!1,
|
|
397
633
|
null,
|
|
398
634
|
null
|
|
399
635
|
);
|
|
400
|
-
const
|
|
636
|
+
const Ne = je.exports, qe = /* @__PURE__ */ S({
|
|
401
637
|
__name: "SettingButton",
|
|
402
638
|
props: {
|
|
403
639
|
state: null
|
|
404
640
|
},
|
|
405
641
|
setup(r) {
|
|
406
|
-
const e = r, t =
|
|
642
|
+
const e = r, t = f();
|
|
407
643
|
return { __sfc: !0, props: e, searchSettingDialogRef: t, showSearchLayoutDialog: () => {
|
|
408
644
|
t.value.show(e.state);
|
|
409
|
-
}, SearchSettingsDrawer:
|
|
645
|
+
}, SearchSettingsDrawer: Ne };
|
|
410
646
|
}
|
|
411
647
|
});
|
|
412
|
-
var
|
|
648
|
+
var Ee = function() {
|
|
413
649
|
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
414
|
-
return t("
|
|
415
|
-
},
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
650
|
+
return t("el-button", { staticClass: "icon-button", on: { click: s.showSearchLayoutDialog } }, [t("i", { staticClass: "el-icon-s-tools" }), t(s.SearchSettingsDrawer, { ref: "searchSettingDialogRef" })], 1);
|
|
651
|
+
}, Ie = [], ke = /* @__PURE__ */ w(
|
|
652
|
+
qe,
|
|
653
|
+
Ee,
|
|
654
|
+
Ie,
|
|
419
655
|
!1,
|
|
420
656
|
null,
|
|
421
|
-
"
|
|
657
|
+
"2b748196"
|
|
422
658
|
);
|
|
423
|
-
const
|
|
659
|
+
const Me = ke.exports, Ke = {
|
|
424
660
|
functional: !0,
|
|
425
661
|
props: {
|
|
426
662
|
search: {
|
|
@@ -444,28 +680,28 @@ const Oe = Le.exports, Te = {
|
|
|
444
680
|
}
|
|
445
681
|
return i.componentOptions.propsData.disabled = s.search.isDisabled(s.api), i;
|
|
446
682
|
}
|
|
447
|
-
},
|
|
683
|
+
}, Ge = /* @__PURE__ */ S({
|
|
448
684
|
__name: "SearchBarItem",
|
|
449
685
|
props: {
|
|
450
686
|
item: null
|
|
451
687
|
},
|
|
452
688
|
setup(r) {
|
|
453
|
-
const e = r, t =
|
|
454
|
-
return { __sfc: !0, props: e, state: t, id: s, SearchItemRender:
|
|
689
|
+
const e = r, t = D("search-bar-state"), s = D("search-bar-id");
|
|
690
|
+
return { __sfc: !0, props: e, state: t, id: s, SearchItemRender: Ke };
|
|
455
691
|
}
|
|
456
692
|
});
|
|
457
|
-
var
|
|
693
|
+
var He = function() {
|
|
458
694
|
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
459
695
|
return t("div", { staticClass: "search-item" }, [t("div", { staticClass: "search-item-title" }, [e._v(e._s(e.item.label))]), t("div", { staticClass: "search-item-content", attrs: { id: `${s.id}-${e.item.field}` } }, [t(s.SearchItemRender, { attrs: { search: e.item, api: s.state } })], 1)]);
|
|
460
|
-
},
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
696
|
+
}, We = [], Ue = /* @__PURE__ */ w(
|
|
697
|
+
Ge,
|
|
698
|
+
He,
|
|
699
|
+
We,
|
|
464
700
|
!1,
|
|
465
701
|
null,
|
|
466
|
-
"
|
|
702
|
+
"73b72e60"
|
|
467
703
|
);
|
|
468
|
-
const
|
|
704
|
+
const ze = Ue.exports, Ye = /* @__PURE__ */ S({
|
|
469
705
|
__name: "SearchBar",
|
|
470
706
|
props: {
|
|
471
707
|
searches: null,
|
|
@@ -478,75 +714,65 @@ const Be = Fe.exports, Re = /* @__PURE__ */ S({
|
|
|
478
714
|
},
|
|
479
715
|
emits: ["change"],
|
|
480
716
|
setup(r, { expose: e, emit: t }) {
|
|
481
|
-
const s = r, i =
|
|
482
|
-
|
|
717
|
+
const s = r, i = Y(new Le(s.id, s.searches, s.onSearch)), a = f(!1), l = f(), n = f();
|
|
718
|
+
V(
|
|
483
719
|
l,
|
|
484
720
|
() => {
|
|
485
721
|
i.updateTags();
|
|
486
722
|
},
|
|
487
723
|
{ childList: !0 }
|
|
724
|
+
), V(
|
|
725
|
+
n,
|
|
726
|
+
() => {
|
|
727
|
+
i.updateTags();
|
|
728
|
+
},
|
|
729
|
+
{ childList: !0 }
|
|
488
730
|
);
|
|
489
|
-
const
|
|
490
|
-
() =>
|
|
491
|
-
),
|
|
492
|
-
() =>
|
|
731
|
+
const c = O(() => x.value.filter((u) => b(u).visible).length > 0), p = f([]), m = O(
|
|
732
|
+
() => p.value.filter((u) => b(u).pinned)
|
|
733
|
+
), x = O(
|
|
734
|
+
() => p.value.filter((u) => !b(u).pinned)
|
|
493
735
|
);
|
|
494
|
-
|
|
736
|
+
J(
|
|
495
737
|
() => [i.items, i.config.itemLayouts],
|
|
496
738
|
() => {
|
|
497
|
-
const
|
|
498
|
-
...i.items.filter((
|
|
499
|
-
...i.items.filter((
|
|
739
|
+
const u = [
|
|
740
|
+
...i.items.filter((d) => d.pinned),
|
|
741
|
+
...i.items.filter((d) => !d.pinned)
|
|
500
742
|
];
|
|
501
|
-
|
|
743
|
+
p.value = u.sort((d, q) => i.config.itemLayouts[d.field].index - i.config.itemLayouts[q.field].index).filter((d) => d.isEnable(i)), t("change", i.getSearchObject(), i);
|
|
502
744
|
},
|
|
503
745
|
{ debounce: 100, immediate: !0, deep: !0 }
|
|
504
746
|
);
|
|
505
|
-
const
|
|
506
|
-
i.searching =
|
|
507
|
-
},
|
|
747
|
+
const b = (u) => i.config.itemLayouts[u.field], C = () => i.items, T = () => i.getSearchObject(), L = (u) => {
|
|
748
|
+
i.searching = u;
|
|
749
|
+
}, o = () => i.updateTags();
|
|
508
750
|
return F("search-bar-state", i), F("search-bar-id", s.id), e({
|
|
509
|
-
getSearchItems:
|
|
510
|
-
getSearchObject:
|
|
511
|
-
updateSearching:
|
|
512
|
-
updateTags:
|
|
513
|
-
}), { __sfc: !0, props: s, state: i, expanded: a, itemContainerRef: l, isShowSpanIcon:
|
|
751
|
+
getSearchItems: C,
|
|
752
|
+
getSearchObject: T,
|
|
753
|
+
updateSearching: L,
|
|
754
|
+
updateTags: o
|
|
755
|
+
}), { __sfc: !0, props: s, state: i, expanded: a, itemContainerRef: l, hideItemContainerRef: n, isShowSpanIcon: c, sortedItems: p, sortedPinnedItems: m, sortedNormalItems: x, emits: t, getLayout: b, getSearchItems: C, getSearchObject: T, updateSearching: L, updateTags: o, SearchTagsRender: ie, SettingButton: Me, SearchBarItem: ze };
|
|
514
756
|
}
|
|
515
757
|
});
|
|
516
|
-
var
|
|
758
|
+
var Xe = function() {
|
|
517
759
|
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
518
760
|
return t("div", { staticClass: "search-bar-container" }, [t("el-row", { ref: "itemContainerRef", class: "search", staticStyle: { "flex-wrap": "wrap" }, attrs: { type: "flex", gutter: 16 } }, [e._l(s.sortedPinnedItems, function(i) {
|
|
519
761
|
return t("el-col", { directives: [{ name: "show", rawName: "v-show", value: s.getLayout(i).visible, expression: "getLayout(item).visible" }], key: i.field, attrs: { span: s.getLayout(i).span } }, [t(s.SearchBarItem, { attrs: { item: i } })], 1);
|
|
520
|
-
}), t("el-collapse-transition", [t("div", { directives: [{ name: "show", rawName: "v-show", value: s.expanded, expression: "expanded" }], staticStyle: { width: "100%" } }, e._l(s.sortedNormalItems, function(i) {
|
|
762
|
+
}), t("el-collapse-transition", [t("div", { directives: [{ name: "show", rawName: "v-show", value: s.expanded, expression: "expanded" }], ref: "hideItemContainerRef", staticStyle: { width: "100%" } }, e._l(s.sortedNormalItems, function(i) {
|
|
521
763
|
return t("el-col", { directives: [{ name: "show", rawName: "v-show", value: s.getLayout(i).visible, expression: "getLayout(item).visible" }], key: i.field, attrs: { span: s.getLayout(i).span } }, [t(s.SearchBarItem, { attrs: { item: i } })], 1);
|
|
522
|
-
}), 1)])], 2), t("div", { staticClass: "search-bottom" }, [s.state.tags.length > 0 ? t(s.SearchTagsRender, { attrs: { tags: s.state.tags } }) : e._e(), t("div", { staticClass: "actions" }, [t("el-
|
|
764
|
+
}), 1)])], 2), t("div", { staticClass: "search-bottom" }, [s.state.tags.length > 0 ? t(s.SearchTagsRender, { attrs: { tags: s.state.tags } }) : e._e(), t("div", { staticClass: "actions" }, [t("el-button", { directives: [{ name: "show", rawName: "v-show", value: s.isShowSpanIcon, expression: "isShowSpanIcon" }], staticClass: "icon-button", on: { click: function(i) {
|
|
523
765
|
s.expanded = !s.expanded;
|
|
524
|
-
} } }, [t("i", { class: [s.expanded ? "el-icon-arrow-up" : "el-icon-arrow-down"] })])
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
766
|
+
} } }, [t("i", { class: [s.expanded ? "el-icon-arrow-up" : "el-icon-arrow-down"] })]), t(s.SettingButton, { attrs: { state: s.state } }), t("el-button", { attrs: { type: "primary", loading: s.state.searching, disabled: s.state.searching }, on: { click: () => s.state.doSearch() } }, [e._v("查 询 ")]), t("el-button", { on: { click: () => s.state.reset(e.resetAutoSearch) } }, [e._v("重 置")])], 1)], 1)], 1);
|
|
767
|
+
}, Je = [], Qe = /* @__PURE__ */ w(
|
|
768
|
+
Ye,
|
|
769
|
+
Xe,
|
|
770
|
+
Je,
|
|
529
771
|
!1,
|
|
530
772
|
null,
|
|
531
773
|
null
|
|
532
774
|
);
|
|
533
|
-
const
|
|
534
|
-
var ke = Object.defineProperty, Ie = (r, e, t) => e in r ? ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, Ve = (r, e, t) => Ie(r, e + "", t);
|
|
535
|
-
const He = (r) => $(r), Ke = () => !0, ze = (r, e) => {
|
|
536
|
-
const t = r.getSearchObject();
|
|
537
|
-
let s = !0;
|
|
538
|
-
for (const [i, a] of Object.entries(e)) {
|
|
539
|
-
const l = t[i];
|
|
540
|
-
s = a(l), s || (s = !1);
|
|
541
|
-
}
|
|
542
|
-
return () => s;
|
|
543
|
-
}, We = (r, e, t) => ({
|
|
544
|
-
/**
|
|
545
|
-
* 数据刷新回调代理
|
|
546
|
-
*
|
|
547
|
-
* 填充数据拉取接口的搜索参数
|
|
548
|
-
* @param param
|
|
549
|
-
*/
|
|
775
|
+
const lt = Qe.exports, ot = (r, e, t) => ({
|
|
550
776
|
refreshCallback: async (s) => {
|
|
551
777
|
const i = e.value.getSearchObject();
|
|
552
778
|
try {
|
|
@@ -555,48 +781,28 @@ const He = (r) => $(r), Ke = () => !0, ze = (r, e) => {
|
|
|
555
781
|
e.value.updateSearching(!1), e.value.updateTags();
|
|
556
782
|
}
|
|
557
783
|
},
|
|
558
|
-
/**
|
|
559
|
-
* 搜索项搜索按钮点击时触发
|
|
560
|
-
*
|
|
561
|
-
* 回调所有的可刷新组件
|
|
562
|
-
*/
|
|
563
784
|
searchCallback: async () => {
|
|
564
785
|
var s;
|
|
565
786
|
for (const i of t)
|
|
566
787
|
await ((s = i.value) == null ? void 0 : s.refresh());
|
|
567
788
|
}
|
|
568
789
|
});
|
|
569
|
-
class D {
|
|
570
|
-
constructor(e) {
|
|
571
|
-
Ve(this, "record"), this.record = e;
|
|
572
|
-
}
|
|
573
|
-
static from(e) {
|
|
574
|
-
const t = e.filter((s) => s.value === void 0 ? !1 : Array.isArray(s.value) ? s.value.length > 0 : !0).reduce(
|
|
575
|
-
(s, i) => {
|
|
576
|
-
const a = i.transform ? i.transform(i.value) : i.value;
|
|
577
|
-
return {
|
|
578
|
-
...s,
|
|
579
|
-
...X(a) ? a : { [i.field]: a }
|
|
580
|
-
};
|
|
581
|
-
},
|
|
582
|
-
{}
|
|
583
|
-
);
|
|
584
|
-
return new D(t);
|
|
585
|
-
}
|
|
586
|
-
transform(e, t) {
|
|
587
|
-
const s = this.record[e], i = t(s);
|
|
588
|
-
return delete this.record[e], this.record = { ...this.record, ...i }, this;
|
|
589
|
-
}
|
|
590
|
-
toCondition(e) {
|
|
591
|
-
return { ...this.record, ...e };
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
790
|
export {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
791
|
+
at as APPLY_ALWAYS,
|
|
792
|
+
rt as APPLY_WHEN_NOT_VALUE,
|
|
793
|
+
nt as APPLY_WITH_MULTIPLE_VALUE,
|
|
794
|
+
j as DEFAULT_SEARCH_SPAN,
|
|
795
|
+
ue as LocalStorage,
|
|
796
|
+
it as MemoryStorage,
|
|
797
|
+
lt as SearchBar,
|
|
798
|
+
Se as SearchBarCore,
|
|
799
|
+
Ce as SearchBarState,
|
|
800
|
+
fe as SearchConfig,
|
|
801
|
+
ne as SearchItem,
|
|
802
|
+
y as SearchItemLayout,
|
|
803
|
+
B as SearchTag,
|
|
804
|
+
P as Searches,
|
|
805
|
+
ot as useSearchProxy,
|
|
806
|
+
Te as useSetting,
|
|
807
|
+
st as vModel
|
|
602
808
|
};
|