@scvzerng/element-plus-search-vue2 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
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
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
3
  import { useDebounceFn as X, useMutationObserver as V, watchDebounced as J } from "@vueuse/core";
4
- const st = (r) => ({
4
+ const st = (a) => ({
5
5
  model: {
6
- value: E(r, "value"),
6
+ value: E(a, "value"),
7
7
  callback: (e) => {
8
- I(r, "value", e);
8
+ I(a, "value", e);
9
9
  }
10
10
  }
11
11
  }), Q = S({
@@ -15,21 +15,21 @@ const st = (r) => ({
15
15
  props: {
16
16
  tags: null
17
17
  },
18
- setup(r) {
19
- const e = r, t = f(), s = () => {
18
+ setup(a) {
19
+ const e = a, 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 = f(!1), l = () => {
26
+ }, r = f(!1), l = () => {
27
27
  const p = Array.from(t.value.children);
28
28
  return k(
29
29
  p.map((m) => m.getBoundingClientRect().width)
30
30
  );
31
31
  }, n = () => t.value.getBoundingClientRect().width, c = () => {
32
- t.value && (a.value = l() > n());
32
+ t.value && (r.value = l() > n());
33
33
  };
34
34
  return W(
35
35
  () => e.tags,
@@ -39,13 +39,13 @@ const st = (r) => ({
39
39
  });
40
40
  },
41
41
  { immediate: !0, deep: !0 }
42
- ), { __sfc: !0, props: e, scrollContainer: t, scrollLeft: s, scrollRight: i, showScrollBar: a, getTagsWidth: l, getContainerWidth: n, checkScrollBar: c };
42
+ ), { __sfc: !0, props: e, scrollContainer: t, scrollLeft: s, scrollRight: i, showScrollBar: r, getTagsWidth: l, getContainerWidth: n, checkScrollBar: c };
43
43
  }
44
44
  });
45
- function w(r, e, t, s, i, a, l, n) {
46
- var c = typeof r == "function" ? r.options : r;
47
- return e && (c.render = e, c.staticRenderFns = t, c._compiled = !0), a && (c._scopeId = "data-v-" + a), {
48
- exports: r,
45
+ function w(a, e, t, s, i, r, l, n) {
46
+ var c = typeof a == "function" ? a.options : a;
47
+ return e && (c.render = e, c.staticRenderFns = t, c._compiled = !0), r && (c._scopeId = "data-v-" + r), {
48
+ exports: a,
49
49
  options: c
50
50
  };
51
51
  }
@@ -63,13 +63,13 @@ var ee = function() {
63
63
  null
64
64
  );
65
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);
66
+ var ae = Object.defineProperty, re = (a, e, t) => e in a ? ae(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, h = (a, e, t) => re(a, typeof e != "symbol" ? e + "" : e, t);
67
67
  const j = 6;
68
68
  class ne {
69
69
  constructor(e, t, s) {
70
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));
71
+ var i, r, 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 = (r = e.span) != null ? r : 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));
73
73
  }
74
74
  clean() {
75
75
  Array.isArray(this.value) ? this.value = [] : this.value = void 0;
@@ -84,7 +84,7 @@ class ne {
84
84
  return A(this.disabled) ? this.disabled(e.getSearchObject()) : this.disabled;
85
85
  }
86
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);
87
+ var le = Object.defineProperty, oe = (a, e, t) => e in a ? le(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, ce = (a, e, t) => oe(a, e + "", t);
88
88
  class ue {
89
89
  cacheKey(e) {
90
90
  return `searches_layouts_${e}`;
@@ -92,9 +92,9 @@ class ue {
92
92
  async load(e) {
93
93
  const t = localStorage.getItem(this.cacheKey(e));
94
94
  return t ? t.split(",").map((s) => {
95
- const [i, a, l, n, c] = s.split("_");
95
+ const [i, r, l, n, c] = s.split("_");
96
96
  return {
97
- field: a,
97
+ field: r,
98
98
  span: Number(l),
99
99
  index: Number(i),
100
100
  visible: n === "true",
@@ -119,10 +119,10 @@ class it {
119
119
  this.cache.set(e, t);
120
120
  }
121
121
  }
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);
122
+ var he = Object.defineProperty, de = (a, e, t) => e in a ? he(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, _ = (a, e, t) => de(a, typeof e != "symbol" ? e + "" : e, t);
123
123
  class y {
124
- constructor(e, t, s, i, a) {
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;
124
+ constructor(e, t, s, i, r) {
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 = r;
126
126
  }
127
127
  static fromSearchItem(e, t) {
128
128
  return new y(
@@ -134,13 +134,13 @@ class y {
134
134
  );
135
135
  }
136
136
  static formSearchConfig(e, t) {
137
- var s, i, a;
137
+ var s, i, r;
138
138
  return new y(
139
139
  e.field,
140
140
  (s = e.span) != null ? s : j,
141
141
  t ?? e,
142
142
  (i = e.visible) != null ? i : !0,
143
- (a = e.pinned) != null ? a : !1
143
+ (r = e.pinned) != null ? r : !1
144
144
  );
145
145
  }
146
146
  static fromLayoutData(e) {
@@ -173,9 +173,9 @@ class fe {
173
173
  sync(e, t, s) {
174
174
  if (e.length !== Object.keys(this.itemLayouts).length)
175
175
  throw new Error("同步布局字段数量不一致");
176
- e.forEach((i, a) => {
176
+ e.forEach((i, r) => {
177
177
  const l = this.itemLayouts[i];
178
- l.index = a, l.visible = t.has(i), l.pinned = s.has(i);
178
+ l.index = r, l.visible = t.has(i), l.pinned = s.has(i);
179
179
  });
180
180
  }
181
181
  async persistent() {
@@ -191,7 +191,7 @@ class fe {
191
191
  });
192
192
  }
193
193
  }
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);
194
+ var pe = Object.defineProperty, ve = (a, e, t) => e in a ? pe(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, g = (a, e, t) => ve(a, typeof e != "symbol" ? e + "" : e, t);
195
195
  class B {
196
196
  constructor(e, t, s) {
197
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");
@@ -212,13 +212,13 @@ class B {
212
212
  this.item.clean(), await this.state.doSearch();
213
213
  }
214
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();
215
+ var _e = Object.defineProperty, ge = (a, e, t) => e in a ? _e(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, me = (a, e, t) => ge(a, e + "", t);
216
+ const at = (a) => R(a), rt = () => !0, nt = (a, e) => {
217
+ const t = a.getSearchObject();
218
218
  let s = !0;
219
- for (const [i, a] of Object.entries(e)) {
219
+ for (const [i, r] of Object.entries(e)) {
220
220
  const l = t[i];
221
- s = a(l), s || (s = !1);
221
+ s = r(l), s || (s = !1);
222
222
  }
223
223
  return () => s;
224
224
  };
@@ -229,10 +229,10 @@ class P {
229
229
  static from(e) {
230
230
  const t = e.filter((s) => s.value === void 0 ? !1 : Array.isArray(s.value) ? s.value.length > 0 : !0).reduce(
231
231
  (s, i) => {
232
- const a = i.transform ? i.transform(i.value) : i.value;
232
+ const r = i.transform ? i.transform(i.value) : i.value;
233
233
  return {
234
234
  ...s,
235
- ...H(a) ? a : { [i.field]: a }
235
+ ...H(r) ? r : { [i.field]: r }
236
236
  };
237
237
  },
238
238
  {}
@@ -247,7 +247,7 @@ class P {
247
247
  return { ...this.record, ...e };
248
248
  }
249
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);
250
+ var be = Object.defineProperty, ye = (a, e, t) => e in a ? be(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, $ = (a, e, t) => ye(a, typeof e != "symbol" ? e + "" : e, t);
251
251
  class Se {
252
252
  constructor(e) {
253
253
  $(this, "config"), $(this, "_state"), $(this, "listeners", /* @__PURE__ */ new Set()), $(this, "debounceTimers", /* @__PURE__ */ new Map()), this.config = e, this._state = {
@@ -279,11 +279,11 @@ class Se {
279
279
  }
280
280
  setValue(e, t, s) {
281
281
  this._state.values[e] = t;
282
- const i = this.config.searches.find((a) => a.field === e);
282
+ const i = this.config.searches.find((r) => r.field === e);
283
283
  if (i != null && i.onChange)
284
284
  if (s) {
285
- const a = this.debounceTimers.get(e);
286
- a && clearTimeout(a), this.debounceTimers.set(e, setTimeout(() => {
285
+ const r = this.debounceTimers.get(e);
286
+ r && clearTimeout(r), this.debounceTimers.set(e, setTimeout(() => {
287
287
  i.onChange(t, this.createContext()), this.debounceTimers.delete(e);
288
288
  }, s));
289
289
  } else
@@ -326,11 +326,11 @@ class Se {
326
326
  var e, t;
327
327
  const s = [];
328
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({
329
+ const r = this._state.values[i.field];
330
+ (i.tagFilter ? i.tagFilter(r) : this.defaultHasValue(r)) && s.push({
331
331
  field: i.field,
332
332
  label: i.label,
333
- value: a,
333
+ value: r,
334
334
  valueText: void 0,
335
335
  required: (e = i.required) != null ? e : !1,
336
336
  closable: !((t = i.required) != null && t)
@@ -353,14 +353,14 @@ class Se {
353
353
  };
354
354
  }
355
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);
356
+ var we = Object.defineProperty, xe = (a, e, t) => e in a ? we(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, v = (a, e, t) => xe(a, typeof e != "symbol" ? e + "" : e, t);
357
357
  let Ce = class N {
358
- constructor(e, t, s, i, a, l) {
358
+ constructor(e, t, s, i, r, l) {
359
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
360
  this,
361
361
  t.map((n, c) => y.formSearchConfig(n, c)),
362
362
  l
363
- ), this.componentTextGetters = a, this.sourceSearchable = t, this.searching = !1, this.searchCallback = s, this.tags = [], this.core = new Se({
363
+ ), this.componentTextGetters = r, this.sourceSearchable = t, this.searching = !1, this.searchCallback = s, this.tags = [], this.core = new Se({
364
364
  id: e,
365
365
  searches: t.map((n) => ({
366
366
  field: n.field,
@@ -417,7 +417,7 @@ let Ce = class N {
417
417
  this.items.forEach((t) => t.reset()), this.core.reset(), e && await this.doSearch();
418
418
  }
419
419
  setSearchValue(e, t, s = (i) => !0) {
420
- const i = this.items.find((a) => a.field === e);
420
+ const i = this.items.find((r) => r.field === e);
421
421
  i && s && s(i.value) && (i.value = t, this.core.setValue(e, t));
422
422
  }
423
423
  destroy() {
@@ -426,12 +426,12 @@ let Ce = class N {
426
426
  }
427
427
  };
428
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 = [
429
+ const a = z(), e = f(), t = f([]), s = f(!1), i = f(), r = f([]), l = f(300), n = (o) => {
430
+ a.value = o, t.value = [
431
431
  {
432
432
  label: "全部",
433
433
  id: "all",
434
- children: r.value.items.sort(
434
+ children: a.value.items.sort(
435
435
  (u, d) => o.config.itemLayouts[u.field].index - o.config.itemLayouts[d.field].index
436
436
  ).map((u) => ({
437
437
  label: u.label,
@@ -458,20 +458,20 @@ const Te = () => {
458
458
  n(o), s.value = !0;
459
459
  },
460
460
  save: () => {
461
- r.value.config.sync(
461
+ a.value.config.sync(
462
462
  t.value[0].children.map((o) => o.id),
463
463
  new Set(e.value.getCheckedKeys()),
464
464
  new Set(t.value[0].children.filter((o) => o.pinned).map((o) => o.id))
465
- ), r.value.config.persistent(), s.value = !1;
465
+ ), a.value.config.persistent(), s.value = !1;
466
466
  },
467
467
  reset: () => {
468
- r.value.config.reset(), n(r.value);
468
+ a.value.config.reset(), n(a.value);
469
469
  },
470
470
  keepSelection: () => {
471
- a.value = e.value.getCheckedKeys();
471
+ r.value = e.value.getCheckedKeys();
472
472
  },
473
473
  restoreSelection: () => {
474
- e.value.setCheckedKeys(a.value), a.value = [];
474
+ e.value.setCheckedKeys(r.value), r.value = [];
475
475
  },
476
476
  allowDrop: (o, u, d) => d !== "inner",
477
477
  allowDrag: (o) => !o.disabled,
@@ -479,23 +479,41 @@ const Te = () => {
479
479
  o.data.pinned = !o.data.pinned;
480
480
  }
481
481
  };
482
- }, $e = [
482
+ };
483
+ function lt(a, e, t) {
484
+ return {
485
+ refreshCallback: async (s) => {
486
+ const i = e.value.getSearchObject();
487
+ try {
488
+ return e.value.updateSearching(!0), await a(i, s);
489
+ } finally {
490
+ e.value.updateSearching(!1), e.value.updateTags();
491
+ }
492
+ },
493
+ searchCallback: async () => {
494
+ var s;
495
+ for (const i of t)
496
+ await ((s = i.value) == null ? void 0 : s.refresh());
497
+ }
498
+ };
499
+ }
500
+ const $e = [
483
501
  {
484
- isApply(r) {
485
- return r.contains("el-radio-group");
502
+ isApply(a) {
503
+ return a.contains("el-radio-group");
486
504
  },
487
- getText(r) {
505
+ getText(a) {
488
506
  var e, t;
489
- return (t = (e = r.querySelector(".is-active")) == null ? void 0 : e.querySelector("input")) == null ? void 0 : t.value;
507
+ return (t = (e = a.querySelector(".is-active")) == null ? void 0 : e.querySelector("input")) == null ? void 0 : t.value;
490
508
  }
491
509
  },
492
510
  {
493
- isApply(r) {
494
- return r.contains("el-checkbox-group");
511
+ isApply(a) {
512
+ return a.contains("el-checkbox-group");
495
513
  },
496
- getText(r) {
514
+ getText(a) {
497
515
  var e;
498
- const t = Array.from((e = r.querySelectorAll(".el-checkbox__input.is-checked")) != null ? e : []).map((s) => {
516
+ const t = Array.from((e = a.querySelectorAll(".el-checkbox__input.is-checked")) != null ? e : []).map((s) => {
499
517
  var i;
500
518
  return (i = s.querySelector("input")) == null ? void 0 : i.value;
501
519
  }).filter((s) => s);
@@ -506,62 +524,62 @@ const Te = () => {
506
524
  }
507
525
  },
508
526
  {
509
- isApply(r) {
510
- return r.contains("el-input");
527
+ isApply(a) {
528
+ return a.contains("el-input");
511
529
  },
512
- getText(r, e) {
530
+ getText(a, e) {
513
531
  return e.value;
514
532
  }
515
533
  },
516
534
  {
517
- isApply(r) {
518
- return r.contains("el-input-number");
535
+ isApply(a) {
536
+ return a.contains("el-input-number");
519
537
  },
520
- getText(r, e) {
538
+ getText(a, e) {
521
539
  return e.value;
522
540
  }
523
541
  },
524
542
  {
525
- isApply(r) {
526
- return r.contains("el-select");
543
+ isApply(a) {
544
+ return a.contains("el-select");
527
545
  },
528
- getText(r, e) {
546
+ getText(a, e) {
529
547
  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;
548
+ const i = a.querySelectorAll(".el-select__tags-text");
549
+ return i.length > 0 ? e.value.length > 1 ? `${i[0].textContent} 等${e.value.length}条` : (t = i[0].textContent) != null ? t : void 0 : (s = a.querySelector("input")) == null ? void 0 : s.value;
532
550
  }
533
551
  },
534
552
  {
535
- isApply(r) {
536
- return r.contains("el-cascader");
553
+ isApply(a) {
554
+ return a.contains("el-cascader");
537
555
  },
538
- getText(r) {
556
+ getText(a) {
539
557
  var e;
540
- return (e = r.querySelector("input")) == null ? void 0 : e.value;
558
+ return (e = a.querySelector("input")) == null ? void 0 : e.value;
541
559
  }
542
560
  },
543
561
  {
544
- isApply(r) {
545
- return r.contains("el-switch");
562
+ isApply(a) {
563
+ return a.contains("el-switch");
546
564
  },
547
- getText(r) {
548
- const e = r.querySelector(".is-active");
565
+ getText(a) {
566
+ const e = a.querySelector(".is-active");
549
567
  return e == null ? void 0 : e.innerHTML;
550
568
  }
551
569
  },
552
570
  {
553
- isApply(r) {
554
- return r.contains("el-slider");
571
+ isApply(a) {
572
+ return a.contains("el-slider");
555
573
  },
556
- getText(r, e) {
574
+ getText(a, e) {
557
575
  return e.value;
558
576
  }
559
577
  },
560
578
  {
561
- isApply(r) {
562
- return r.contains("el-date-editor");
579
+ isApply(a) {
580
+ return a.contains("el-date-editor");
563
581
  },
564
- getText(r, e) {
582
+ getText(a, e) {
565
583
  return Array.isArray(e.value) ? e.value.join(" ~ ") : e.value;
566
584
  }
567
585
  }
@@ -595,12 +613,12 @@ var Pe = function() {
595
613
  );
596
614
  const Fe = De.exports, Ve = /* @__PURE__ */ S({
597
615
  __name: "SearchSettingsDrawer",
598
- setup(r, { expose: e }) {
616
+ setup(a, { expose: e }) {
599
617
  const {
600
618
  treeRef: t,
601
619
  visible: s,
602
620
  snapshot: i,
603
- drawerWidth: a,
621
+ drawerWidth: r,
604
622
  defaultCheckedKeys: l,
605
623
  show: n,
606
624
  allowDrop: c,
@@ -613,7 +631,7 @@ const Fe = De.exports, Ve = /* @__PURE__ */ S({
613
631
  } = Te();
614
632
  return e({
615
633
  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 };
634
+ }), { __sfc: !0, treeRef: t, visible: s, snapshot: i, drawerWidth: r, defaultCheckedKeys: l, show: n, allowDrop: c, allowDrag: p, keepSelection: m, restoreSelection: x, save: b, reset: C, onPinnedChange: T, PinIcon: Fe };
617
635
  }
618
636
  });
619
637
  var Be = function() {
@@ -621,7 +639,7 @@ var Be = function() {
621
639
  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) {
622
640
  s.visible = i;
623
641
  } } }, [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 }) {
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) {
642
+ 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(r) {
625
643
  return s.onPinnedChange(i);
626
644
  } } }) : e._e()], 1)];
627
645
  } }]) }), 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)]);
@@ -638,8 +656,8 @@ const Ne = je.exports, qe = /* @__PURE__ */ S({
638
656
  props: {
639
657
  state: null
640
658
  },
641
- setup(r) {
642
- const e = r, t = f();
659
+ setup(a) {
660
+ const e = a, t = f();
643
661
  return { __sfc: !0, props: e, searchSettingDialogRef: t, showSearchLayoutDialog: () => {
644
662
  t.value.show(e.state);
645
663
  }, SearchSettingsDrawer: Ne };
@@ -667,26 +685,27 @@ const Me = ke.exports, Ke = {
667
685
  type: Object
668
686
  }
669
687
  },
670
- render(r, e) {
688
+ render(a, e) {
671
689
  var t;
672
690
  const { props: s } = e, i = s.search.render(s.search);
673
691
  if (i.componentOptions.propsData || (i.componentOptions.propsData = {}), i.componentOptions.listeners || (i.componentOptions.listeners = {}), i.componentOptions.listeners || (i.componentOptions.listeners = {}), (t = i.data) != null && t.attrs || (i.data.attrs = {}), i.data.attrs.labelChange = () => {
674
692
  s.api.updateSearchTag(s.search.field);
675
693
  }, i.componentOptions.listeners.input) {
676
- const a = i.componentOptions.listeners.input;
677
- i.componentOptions.listeners.input = (l) => {
678
- s.search.onChange && s.search.onChange(l, s.api), a(l);
694
+ const l = i.componentOptions.listeners.input;
695
+ i.componentOptions.listeners.input = (n) => {
696
+ s.search.onChange && s.search.onChange(n, s.api), l(n);
679
697
  };
680
698
  }
681
- return i.componentOptions.propsData.disabled = s.search.isDisabled(s.api), i;
699
+ const r = s.search.isDisabled(s.api);
700
+ return i.componentOptions.propsData.disabled = r, i.data.attrs.disabled = r, i;
682
701
  }
683
702
  }, Ge = /* @__PURE__ */ S({
684
703
  __name: "SearchBarItem",
685
704
  props: {
686
705
  item: null
687
706
  },
688
- setup(r) {
689
- const e = r, t = D("search-bar-state"), s = D("search-bar-id");
707
+ setup(a) {
708
+ const e = a, t = D("search-bar-state"), s = D("search-bar-id");
690
709
  return { __sfc: !0, props: e, state: t, id: s, SearchItemRender: Ke };
691
710
  }
692
711
  });
@@ -713,8 +732,8 @@ const ze = Ue.exports, Ye = /* @__PURE__ */ S({
713
732
  resetAutoSearch: { type: Boolean, default: !0 }
714
733
  },
715
734
  emits: ["change"],
716
- setup(r, { expose: e, emit: t }) {
717
- const s = r, i = Y(new Le(s.id, s.searches, s.onSearch)), a = f(!1), l = f(), n = f();
735
+ setup(a, { expose: e, emit: t }) {
736
+ const s = a, i = Y(new Le(s.id, s.searches, s.onSearch)), r = f(!1), l = f(), n = f();
718
737
  V(
719
738
  l,
720
739
  () => {
@@ -752,7 +771,7 @@ const ze = Ue.exports, Ye = /* @__PURE__ */ S({
752
771
  getSearchObject: T,
753
772
  updateSearching: L,
754
773
  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 };
774
+ }), { __sfc: !0, props: s, state: i, expanded: r, 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 };
756
775
  }
757
776
  });
758
777
  var Xe = function() {
@@ -772,29 +791,15 @@ var Xe = function() {
772
791
  null,
773
792
  null
774
793
  );
775
- const lt = Qe.exports, ot = (r, e, t) => ({
776
- refreshCallback: async (s) => {
777
- const i = e.value.getSearchObject();
778
- try {
779
- return e.value.updateSearching(!0), await r(i, s);
780
- } finally {
781
- e.value.updateSearching(!1), e.value.updateTags();
782
- }
783
- },
784
- searchCallback: async () => {
785
- var s;
786
- for (const i of t)
787
- await ((s = i.value) == null ? void 0 : s.refresh());
788
- }
789
- });
794
+ const ot = Qe.exports;
790
795
  export {
791
- at as APPLY_ALWAYS,
792
- rt as APPLY_WHEN_NOT_VALUE,
796
+ rt as APPLY_ALWAYS,
797
+ at as APPLY_WHEN_NOT_VALUE,
793
798
  nt as APPLY_WITH_MULTIPLE_VALUE,
794
799
  j as DEFAULT_SEARCH_SPAN,
795
800
  ue as LocalStorage,
796
801
  it as MemoryStorage,
797
- lt as SearchBar,
802
+ ot as SearchBar,
798
803
  Se as SearchBarCore,
799
804
  Ce as SearchBarState,
800
805
  fe as SearchConfig,
@@ -802,7 +807,7 @@ export {
802
807
  y as SearchItemLayout,
803
808
  B as SearchTag,
804
809
  P as Searches,
805
- ot as useSearchProxy,
810
+ lt as useSearchProxy,
806
811
  Te as useSetting,
807
812
  st as vModel
808
813
  };
@@ -1 +1 @@
1
- (function(c,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("lodash-unified"),require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","lodash-unified","vue","@vueuse/core"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.ElementPlusSearch={},c.lodashUnified,c.vue,c.core))})(this,function(c,f,l,P){"use strict";const I=r=>({model:{value:f.get(r,"value"),callback:e=>{f.set(r,"value",e)}}}),k=l.defineComponent({name:"SearchTags"}),M=l.defineComponent({...k,props:{tags:null},setup(r){const e=r,t=l.ref(),s=()=>{t.value.scrollBy({left:-200,behavior:"smooth"})},i=()=>{t.value.scrollBy({left:200,behavior:"smooth"})},a=l.ref(!1),o=()=>{const g=Array.from(t.value.children);return f.sum(g.map(y=>y.getBoundingClientRect().width))},n=()=>t.value.getBoundingClientRect().width,h=()=>{t.value&&(a.value=o()>n())};return l.watch(()=>e.tags,()=>{l.nextTick(()=>{h()})},{immediate:!0,deep:!0}),{__sfc:!0,props:e,scrollContainer:t,scrollLeft:s,scrollRight:i,showScrollBar:a,getTagsWidth:o,getContainerWidth:n,checkScrollBar:h}}});function C(r,e,t,s,i,a,o,n){var h=typeof r=="function"?r.options:r;return e&&(h.render=e,h.staticRenderFns=t,h._compiled=!0),a&&(h._scopeId="data-v-"+a),{exports:r,options:h}}var H=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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){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)}})])}),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)},W=[],K=C(M,H,W,!1,null,null);const G=K.exports;var Y=Object.defineProperty,z=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,p=(r,e,t)=>z(r,typeof e!="symbol"?e+"":e,t);const A=6;class V{constructor(e,t,s){p(this,"field"),p(this,"label"),p(this,"value"),p(this,"required"),p(this,"index"),p(this,"visible"),p(this,"disabled"),p(this,"span"),p(this,"initValue"),p(this,"enable"),p(this,"pinned"),p(this,"tagFilter"),p(this,"render"),p(this,"transform"),p(this,"onChange");var i,a,o,n,h;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:A,this.render=e.render,this.tagFilter=e.tagFilter,this.transform=e.transform,this.enable=(o=e.enable)!=null?o:!0,this.disabled=(n=e.disabled)!=null?n:!1,this.pinned=(h=e.pinned)!=null?h:!1,e.onChange&&s&&(this.onChange=s((g,y)=>e.onChange(g,y),50))}clean(){Array.isArray(this.value)?this.value=[]:this.value=void 0}reset(){this.value=this.initValue}isEnable(e){return f.isFunction(this.enable)?this.enable(e.getSearchObject()):this.enable}isDisabled(e){return f.isFunction(this.disabled)?this.disabled(e.getSearchObject()):this.disabled}}var U=Object.defineProperty,X=(r,e,t)=>e in r?U(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,J=(r,e,t)=>X(r,e+"",t);class B{cacheKey(e){return`searches_layouts_${e}`}async load(e){const t=localStorage.getItem(this.cacheKey(e));return t?t.split(",").map(s=>{const[i,a,o,n,h]=s.split("_");return{field:a,span:Number(o),index:Number(i),visible:n==="true",pinned:h==="true"}}):null}async save(e,t){const s=t.map(i=>`${i.index}_${i.field}_${i.span}_${i.visible}_${i.pinned}`).join(",");localStorage.setItem(this.cacheKey(e),s)}}class Q{constructor(){J(this,"cache",new Map)}async load(e){var t;return(t=this.cache.get(e))!=null?t:null}async save(e,t){this.cache.set(e,t)}}var Z=Object.defineProperty,ee=(r,e,t)=>e in r?Z(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,v=(r,e,t)=>ee(r,typeof e!="symbol"?e+"":e,t);class S{constructor(e,t,s,i,a){v(this,"field"),v(this,"span"),v(this,"index"),v(this,"visible"),v(this,"pinned"),this.field=e,this.span=t,this.index=s,this.visible=i,this.pinned=a}static fromSearchItem(e,t){return new S(e.field,e.span,t??e.index,e.visible,e.pinned)}static formSearchConfig(e,t){var s,i,a;return new S(e.field,(s=e.span)!=null?s:A,t??e,(i=e.visible)!=null?i:!0,(a=e.pinned)!=null?a:!1)}static fromLayoutData(e){return new S(e.field,e.span,e.index,e.visible,e.pinned)}toLayoutData(){return{field:this.field,span:this.span,index:this.index,visible:this.visible,pinned:this.pinned}}merge(e){this.span=e.span,this.index=e.index,this.visible=e.visible,this.pinned=e.pinned}}class E{constructor(e,t,s){v(this,"id"),v(this,"state"),v(this,"itemLayouts"),v(this,"initialLayouts"),v(this,"storage"),this.id=e.id,this.initialLayouts=t,this.state=e,this.storage=s??new B,this.itemLayouts=f.keyBy(e.items.map(S.fromSearchItem),i=>i.field),this.restoreCachedLayouts()}async restoreCachedLayouts(){const e=await this.storage.load(this.id);e&&e.forEach(t=>{const s=this.itemLayouts[t.field];s&&s.merge(S.fromLayoutData(t))})}sync(e,t,s){if(e.length!==Object.keys(this.itemLayouts).length)throw new Error("同步布局字段数量不一致");e.forEach((i,a)=>{const o=this.itemLayouts[i];o.index=a,o.visible=t.has(i),o.pinned=s.has(i)})}async persistent(){await this.storage.save(this.id,Object.values(this.itemLayouts).map(e=>e.toLayoutData())),this.state.updateTags()}reset(){this.initialLayouts.forEach(e=>{const t=this.itemLayouts[e.field];t&&t.merge(e)})}}var te=Object.defineProperty,se=(r,e,t)=>e in r?te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,b=(r,e,t)=>se(r,typeof e!="symbol"?e+"":e,t);class D{constructor(e,t,s){b(this,"id"),b(this,"field"),b(this,"value"),b(this,"label"),b(this,"valueText"),b(this,"required"),b(this,"item"),b(this,"state"),b(this,"componentTextGetters");var i;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()}static hasValue(e){return f.isNumber(e.value)||f.isBoolean(e.value)?!0:!f.isEmpty(e.value)}updateValueText(){const e=document.querySelector(this.id);if(!e||e.children.length!==1)return;const t=e.children[0],s=this.componentTextGetters.find(i=>i.isApply(t.classList));s&&(this.valueText=s.getText(t,this))}async clean(){this.item.clean(),await this.state.doSearch()}}var ie=Object.defineProperty,re=(r,e,t)=>e in r?ie(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ae=(r,e,t)=>re(r,e+"",t);const ne=r=>f.isEmpty(r),le=()=>!0,oe=(r,e)=>{const t=r.getSearchObject();let s=!0;for(const[i,a]of Object.entries(e)){const o=t[i];s=a(o),s||(s=!1)}return()=>s};class ${constructor(e){ae(this,"record"),this.record=e}static from(e){const t=e.filter(s=>s.value===void 0?!1:Array.isArray(s.value)?s.value.length>0:!0).reduce((s,i)=>{const a=i.transform?i.transform(i.value):i.value;return{...s,...f.isPlainObject(a)?a:{[i.field]:a}}},{});return new $(t)}transform(e,t){const s=this.record[e],i=t(s);return delete this.record[e],this.record={...this.record,...i},this}toCondition(e){return{...this.record,...e}}}var ce=Object.defineProperty,ue=(r,e,t)=>e in r?ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,O=(r,e,t)=>ue(r,typeof e!="symbol"?e+"":e,t);class j{constructor(e){O(this,"config"),O(this,"_state"),O(this,"listeners",new Set),O(this,"debounceTimers",new Map),this.config=e,this._state={id:e.id,values:this.initValues(e.searches),tags:[],searching:!1},this.updateTags()}initValues(e){const t={};for(const s of e)t[s.field]=s.initValue;return t}getState(){return{...this._state}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){const e=this.getState();for(const t of this.listeners)t(e)}getValue(e){return this._state.values[e]}setValue(e,t,s){this._state.values[e]=t;const i=this.config.searches.find(a=>a.field===e);if(i!=null&&i.onChange)if(s){const a=this.debounceTimers.get(e);a&&clearTimeout(a),this.debounceTimers.set(e,setTimeout(()=>{i.onChange(t,this.createContext()),this.debounceTimers.delete(e)},s))}else i.onChange(t,this.createContext());this.notify()}createContext(){return{id:this.config.id,getValue:e=>this.getValue(e),setValue:(e,t)=>this.setValue(e,t),getSearchObject:()=>this.getSearchObject(),doSearch:()=>this.doSearch(),reset:()=>this.reset(),updateTags:()=>this.updateTags()}}getSearchObject(){const e={};for(const t of this.config.searches){const s=this._state.values[t.field];s!==void 0&&s!==""&&s!==null&&(t.transform?Object.assign(e,t.transform(s)):e[t.field]=s)}return e}async doSearch(){if(!this._state.searching)try{this._state.searching=!0,this.notify(),await this.config.onSearch(this.getSearchObject()),this.updateTags()}finally{this._state.searching=!1,this.notify()}}reset(){for(const e of this.config.searches)this._state.values[e.field]=e.initValue;this._state.tags=[],this.notify()}updateTags(){var e,t;const s=[];for(const i of this.config.searches){const a=this._state.values[i.field];(i.tagFilter?i.tagFilter(a):this.defaultHasValue(a))&&s.push({field:i.field,label:i.label,value:a,valueText:void 0,required:(e=i.required)!=null?e:!1,closable:!((t=i.required)!=null&&t)})}this._state.tags=s,this.notify()}defaultHasValue(e){return e==null?!1:typeof e=="number"||typeof e=="boolean"?!0:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim()!=="":!0}updateTagValueText(e,t){const s=this._state.tags.find(i=>i.field===e);s&&(s.valueText=t,this.notify())}getApi(){return{...this.createContext(),state:this.getState(),fields:this.config.searches}}}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,m=(r,e,t)=>de(r,typeof e!="symbol"?e+"":e,t);let R=class q{constructor(e,t,s,i,a,o){this.id=e,m(this,"items"),m(this,"config"),m(this,"searching"),m(this,"tags"),m(this,"searchCallback"),m(this,"sourceSearchable"),m(this,"componentTextGetters"),m(this,"core"),m(this,"unsubscribe"),m(this,"_lastSearchObject",{time:0,data:null}),this.id=e,this.items=t.map((n,h)=>new V(n,h,i)),this.config=new E(this,t.map((n,h)=>S.formSearchConfig(n,h)),o),this.componentTextGetters=a,this.sourceSearchable=t,this.searching=!1,this.searchCallback=s,this.tags=[],this.core=new j({id:e,searches:t.map(n=>({field:n.field,label:n.label,render:n.render,initValue:n.initValue,required:n.required,visible:n.visible,pinned:n.pinned,span:n.span,disabled:n.disabled,enable:n.enable,tagFilter:n.tagFilter,transform:n.transform,onChange:n.onChange})),onSearch:s}),this.unsubscribe=this.core.subscribe(n=>{this.searching=n.searching})}static create(e){return new q(e.id,e.searches,e.onSearch,e.debounceFn,e.componentTextGetters,e.storage)}updateSearchTag(e){var t;(t=this.tags.find(s=>s.field===e))==null||t.updateValueText()}updateTags(){this.tags=this.items.filter(e=>e.tagFilter?e.tagFilter(e.value):D.hasValue(e)).map(e=>new D(this,e,this.componentTextGetters)).sort((e,t)=>this.config.itemLayouts[e.field].index-this.config.itemLayouts[t.field].index),this.core.updateTags()}getSearchObject(e){const t=Date.now();return this._lastSearchObject.data&&t-this._lastSearchObject.time<50?this._lastSearchObject.data:(this._lastSearchObject={time:t,data:$.from(this.items).toCondition(e)},this._lastSearchObject.data)}async doSearch(){if(!this.searching)try{this.searching=!0,await this.searchCallback(this.getSearchObject()),this.updateTags()}finally{this.searching=!1}}async reset(e){this.items.forEach(t=>t.reset()),this.core.reset(),e&&await this.doSearch()}setSearchValue(e,t,s=i=>!0){const i=this.items.find(a=>a.field===e);i&&s&&s(i.value)&&(i.value=t,this.core.setValue(e,t))}destroy(){var e;(e=this.unsubscribe)==null||e.call(this)}};const N=()=>{const r=l.shallowRef(),e=l.ref(),t=l.ref([]),s=l.ref(!1),i=l.ref(),a=l.ref([]),o=l.ref(300),n=u=>{r.value=u,t.value=[{label:"全部",id:"all",children:r.value.items.sort((d,_)=>u.config.itemLayouts[d.field].index-u.config.itemLayouts[_.field].index).map(d=>({label:d.label,id:d.field,disabled:!d.isEnable(u),pinned:u.config.itemLayouts[d.field].pinned}))}],i.value=Object.keys(u.config.itemLayouts).filter(d=>{var _;return(_=u.config.itemLayouts[d])==null?void 0:_.visible})};return{treeRef:e,visible:s,snapshot:t,defaultCheckedKeys:i,drawerWidth:o,updateSnapshot:n,show:u=>{n(u),s.value=!0},save:()=>{r.value.config.sync(t.value[0].children.map(u=>u.id),new Set(e.value.getCheckedKeys()),new Set(t.value[0].children.filter(u=>u.pinned).map(u=>u.id))),r.value.config.persistent(),s.value=!1},reset:()=>{r.value.config.reset(),n(r.value)},keepSelection:()=>{a.value=e.value.getCheckedKeys()},restoreSelection:()=>{e.value.setCheckedKeys(a.value),a.value=[]},allowDrop:(u,d,_)=>_!=="inner",allowDrag:u=>!u.disabled,onPinnedChange:u=>{u.data.pinned=!u.data.pinned}}},fe=[{isApply(r){return r.contains("el-radio-group")},getText(r){var e,t;return(t=(e=r.querySelector(".is-active"))==null?void 0:e.querySelector("input"))==null?void 0:t.value}},{isApply(r){return r.contains("el-checkbox-group")},getText(r){var e;const t=Array.from((e=r.querySelectorAll(".el-checkbox__input.is-checked"))!=null?e:[]).map(s=>{var i;return(i=s.querySelector("input"))==null?void 0:i.value}).filter(s=>s);if(t.length===1)return t[0];if(t.length>1)return`${t[0]} 等${t.length}条`}},{isApply(r){return r.contains("el-input")},getText(r,e){return e.value}},{isApply(r){return r.contains("el-input-number")},getText(r,e){return e.value}},{isApply(r){return r.contains("el-select")},getText(r,e){var t,s;const i=r.querySelectorAll(".el-select__tags-text");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}},{isApply(r){return r.contains("el-cascader")},getText(r){var e;return(e=r.querySelector("input"))==null?void 0:e.value}},{isApply(r){return r.contains("el-switch")},getText(r){const e=r.querySelector(".is-active");return e==null?void 0:e.innerHTML}},{isApply(r){return r.contains("el-slider")},getText(r,e){return e.value}},{isApply(r){return r.contains("el-date-editor")},getText(r,e){return Array.isArray(e.value)?e.value.join(" ~ "):e.value}}];class pe extends R{constructor(e,t,s,i){super(e,t,s,P.useDebounceFn,fe,i)}}const _e={name:"PinIcon",props:{active:{type:Boolean,default:!1}}};var ge=function(){var e=this,t=e._self._c;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){return s.stopPropagation(),e.$emit("click")}}},[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"}})])},ve=[],me=C(_e,ge,ve,!1,null,"b04d59bb");const be=me.exports,Se=l.defineComponent({__name:"SearchSettingsDrawer",setup(r,{expose:e}){const{treeRef:t,visible:s,snapshot:i,drawerWidth:a,defaultCheckedKeys:o,show:n,allowDrop:h,allowDrag:g,keepSelection:y,restoreSelection:x,save:w,reset:T,onPinnedChange:L}=N();return e({show:n}),{__sfc:!0,treeRef:t,visible:s,snapshot:i,drawerWidth:a,defaultCheckedKeys:o,show:n,allowDrop:h,allowDrag:g,keepSelection:y,restoreSelection:x,save:w,reset:T,onPinnedChange:L,PinIcon:be}}});var ye=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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){s.visible=i}}},[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}){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){return s.onPinnedChange(i)}}}):e._e()],1)]}}])}),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)])},we=[],Ce=C(Se,ye,we,!1,null,null);const xe=Ce.exports,Te=l.defineComponent({__name:"SettingButton",props:{state:null},setup(r){const e=r,t=l.ref();return{__sfc:!0,props:e,searchSettingDialogRef:t,showSearchLayoutDialog:()=>{t.value.show(e.state)},SearchSettingsDrawer:xe}}});var Le=function(){var e=this,t=e._self._c,s=e._self._setupProxy;return t("el-button",{staticClass:"icon-button",on:{click:s.showSearchLayoutDialog}},[t("i",{staticClass:"el-icon-s-tools"}),t(s.SearchSettingsDrawer,{ref:"searchSettingDialogRef"})],1)},Pe=[],$e=C(Te,Le,Pe,!1,null,"2b748196");const Oe=$e.exports,Ae={functional:!0,props:{search:{type:Object,required:!0},api:{type:Object}},render(r,e){var t;const{props:s}=e,i=s.search.render(s.search);if(i.componentOptions.propsData||(i.componentOptions.propsData={}),i.componentOptions.listeners||(i.componentOptions.listeners={}),i.componentOptions.listeners||(i.componentOptions.listeners={}),(t=i.data)!=null&&t.attrs||(i.data.attrs={}),i.data.attrs.labelChange=()=>{s.api.updateSearchTag(s.search.field)},i.componentOptions.listeners.input){const a=i.componentOptions.listeners.input;i.componentOptions.listeners.input=o=>{s.search.onChange&&s.search.onChange(o,s.api),a(o)}}return i.componentOptions.propsData.disabled=s.search.isDisabled(s.api),i}},De=l.defineComponent({__name:"SearchBarItem",props:{item:null},setup(r){const e=r,t=l.inject("search-bar-state"),s=l.inject("search-bar-id");return{__sfc:!0,props:e,state:t,id:s,SearchItemRender:Ae}}});var Fe=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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)])},Ve=[],Be=C(De,Fe,Ve,!1,null,"73b72e60");const Ee=Be.exports,je=l.defineComponent({__name:"SearchBar",props:{searches:null,id:null,onSearch:{type:Function},defaultSpan:{default:6},maxRows:{default:2},itemHeight:{default:67},resetAutoSearch:{type:Boolean,default:!0}},emits:["change"],setup(r,{expose:e,emit:t}){const s=r,i=l.reactive(new pe(s.id,s.searches,s.onSearch)),a=l.ref(!1),o=l.ref(),n=l.ref();P.useMutationObserver(o,()=>{i.updateTags()},{childList:!0}),P.useMutationObserver(n,()=>{i.updateTags()},{childList:!0});const h=l.computed(()=>x.value.filter(d=>w(d).visible).length>0),g=l.ref([]),y=l.computed(()=>g.value.filter(d=>w(d).pinned)),x=l.computed(()=>g.value.filter(d=>!w(d).pinned));P.watchDebounced(()=>[i.items,i.config.itemLayouts],()=>{const d=[...i.items.filter(_=>_.pinned),...i.items.filter(_=>!_.pinned)];g.value=d.sort((_,Me)=>i.config.itemLayouts[_.field].index-i.config.itemLayouts[Me.field].index).filter(_=>_.isEnable(i)),t("change",i.getSearchObject(),i)},{debounce:100,immediate:!0,deep:!0});const w=d=>i.config.itemLayouts[d.field],T=()=>i.items,L=()=>i.getSearchObject(),F=d=>{i.searching=d},u=()=>i.updateTags();return l.provide("search-bar-state",i),l.provide("search-bar-id",s.id),e({getSearchItems:T,getSearchObject:L,updateSearching:F,updateTags:u}),{__sfc:!0,props:s,state:i,expanded:a,itemContainerRef:o,hideItemContainerRef:n,isShowSpanIcon:h,sortedItems:g,sortedPinnedItems:y,sortedNormalItems:x,emits:t,getLayout:w,getSearchItems:T,getSearchObject:L,updateSearching:F,updateTags:u,SearchTagsRender:G,SettingButton:Oe,SearchBarItem:Ee}}});var Re=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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){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)}),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){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)}),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){s.expanded=!s.expanded}}},[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)},Ne=[],qe=C(je,Re,Ne,!1,null,null);const Ie=qe.exports,ke=(r,e,t)=>({refreshCallback:async s=>{const i=e.value.getSearchObject();try{return e.value.updateSearching(!0),await r(i,s)}finally{e.value.updateSearching(!1),e.value.updateTags()}},searchCallback:async()=>{var s;for(const i of t)await((s=i.value)==null?void 0:s.refresh())}});c.APPLY_ALWAYS=le,c.APPLY_WHEN_NOT_VALUE=ne,c.APPLY_WITH_MULTIPLE_VALUE=oe,c.DEFAULT_SEARCH_SPAN=A,c.LocalStorage=B,c.MemoryStorage=Q,c.SearchBar=Ie,c.SearchBarCore=j,c.SearchBarState=R,c.SearchConfig=E,c.SearchItem=V,c.SearchItemLayout=S,c.SearchTag=D,c.Searches=$,c.useSearchProxy=ke,c.useSetting=N,c.vModel=I,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("lodash-unified"),require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","lodash-unified","vue","@vueuse/core"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.ElementPlusSearch={},c.lodashUnified,c.vue,c.core))})(this,function(c,f,l,P){"use strict";const I=r=>({model:{value:f.get(r,"value"),callback:e=>{f.set(r,"value",e)}}}),k=l.defineComponent({name:"SearchTags"}),M=l.defineComponent({...k,props:{tags:null},setup(r){const e=r,t=l.ref(),s=()=>{t.value.scrollBy({left:-200,behavior:"smooth"})},i=()=>{t.value.scrollBy({left:200,behavior:"smooth"})},a=l.ref(!1),o=()=>{const g=Array.from(t.value.children);return f.sum(g.map(y=>y.getBoundingClientRect().width))},n=()=>t.value.getBoundingClientRect().width,h=()=>{t.value&&(a.value=o()>n())};return l.watch(()=>e.tags,()=>{l.nextTick(()=>{h()})},{immediate:!0,deep:!0}),{__sfc:!0,props:e,scrollContainer:t,scrollLeft:s,scrollRight:i,showScrollBar:a,getTagsWidth:o,getContainerWidth:n,checkScrollBar:h}}});function C(r,e,t,s,i,a,o,n){var h=typeof r=="function"?r.options:r;return e&&(h.render=e,h.staticRenderFns=t,h._compiled=!0),a&&(h._scopeId="data-v-"+a),{exports:r,options:h}}var H=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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){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)}})])}),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)},W=[],K=C(M,H,W,!1,null,null);const G=K.exports;var Y=Object.defineProperty,z=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,p=(r,e,t)=>z(r,typeof e!="symbol"?e+"":e,t);const A=6;class V{constructor(e,t,s){p(this,"field"),p(this,"label"),p(this,"value"),p(this,"required"),p(this,"index"),p(this,"visible"),p(this,"disabled"),p(this,"span"),p(this,"initValue"),p(this,"enable"),p(this,"pinned"),p(this,"tagFilter"),p(this,"render"),p(this,"transform"),p(this,"onChange");var i,a,o,n,h;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:A,this.render=e.render,this.tagFilter=e.tagFilter,this.transform=e.transform,this.enable=(o=e.enable)!=null?o:!0,this.disabled=(n=e.disabled)!=null?n:!1,this.pinned=(h=e.pinned)!=null?h:!1,e.onChange&&s&&(this.onChange=s((g,y)=>e.onChange(g,y),50))}clean(){Array.isArray(this.value)?this.value=[]:this.value=void 0}reset(){this.value=this.initValue}isEnable(e){return f.isFunction(this.enable)?this.enable(e.getSearchObject()):this.enable}isDisabled(e){return f.isFunction(this.disabled)?this.disabled(e.getSearchObject()):this.disabled}}var U=Object.defineProperty,X=(r,e,t)=>e in r?U(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,J=(r,e,t)=>X(r,e+"",t);class B{cacheKey(e){return`searches_layouts_${e}`}async load(e){const t=localStorage.getItem(this.cacheKey(e));return t?t.split(",").map(s=>{const[i,a,o,n,h]=s.split("_");return{field:a,span:Number(o),index:Number(i),visible:n==="true",pinned:h==="true"}}):null}async save(e,t){const s=t.map(i=>`${i.index}_${i.field}_${i.span}_${i.visible}_${i.pinned}`).join(",");localStorage.setItem(this.cacheKey(e),s)}}class Q{constructor(){J(this,"cache",new Map)}async load(e){var t;return(t=this.cache.get(e))!=null?t:null}async save(e,t){this.cache.set(e,t)}}var Z=Object.defineProperty,ee=(r,e,t)=>e in r?Z(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,v=(r,e,t)=>ee(r,typeof e!="symbol"?e+"":e,t);class S{constructor(e,t,s,i,a){v(this,"field"),v(this,"span"),v(this,"index"),v(this,"visible"),v(this,"pinned"),this.field=e,this.span=t,this.index=s,this.visible=i,this.pinned=a}static fromSearchItem(e,t){return new S(e.field,e.span,t??e.index,e.visible,e.pinned)}static formSearchConfig(e,t){var s,i,a;return new S(e.field,(s=e.span)!=null?s:A,t??e,(i=e.visible)!=null?i:!0,(a=e.pinned)!=null?a:!1)}static fromLayoutData(e){return new S(e.field,e.span,e.index,e.visible,e.pinned)}toLayoutData(){return{field:this.field,span:this.span,index:this.index,visible:this.visible,pinned:this.pinned}}merge(e){this.span=e.span,this.index=e.index,this.visible=e.visible,this.pinned=e.pinned}}class E{constructor(e,t,s){v(this,"id"),v(this,"state"),v(this,"itemLayouts"),v(this,"initialLayouts"),v(this,"storage"),this.id=e.id,this.initialLayouts=t,this.state=e,this.storage=s??new B,this.itemLayouts=f.keyBy(e.items.map(S.fromSearchItem),i=>i.field),this.restoreCachedLayouts()}async restoreCachedLayouts(){const e=await this.storage.load(this.id);e&&e.forEach(t=>{const s=this.itemLayouts[t.field];s&&s.merge(S.fromLayoutData(t))})}sync(e,t,s){if(e.length!==Object.keys(this.itemLayouts).length)throw new Error("同步布局字段数量不一致");e.forEach((i,a)=>{const o=this.itemLayouts[i];o.index=a,o.visible=t.has(i),o.pinned=s.has(i)})}async persistent(){await this.storage.save(this.id,Object.values(this.itemLayouts).map(e=>e.toLayoutData())),this.state.updateTags()}reset(){this.initialLayouts.forEach(e=>{const t=this.itemLayouts[e.field];t&&t.merge(e)})}}var te=Object.defineProperty,se=(r,e,t)=>e in r?te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,b=(r,e,t)=>se(r,typeof e!="symbol"?e+"":e,t);class D{constructor(e,t,s){b(this,"id"),b(this,"field"),b(this,"value"),b(this,"label"),b(this,"valueText"),b(this,"required"),b(this,"item"),b(this,"state"),b(this,"componentTextGetters");var i;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()}static hasValue(e){return f.isNumber(e.value)||f.isBoolean(e.value)?!0:!f.isEmpty(e.value)}updateValueText(){const e=document.querySelector(this.id);if(!e||e.children.length!==1)return;const t=e.children[0],s=this.componentTextGetters.find(i=>i.isApply(t.classList));s&&(this.valueText=s.getText(t,this))}async clean(){this.item.clean(),await this.state.doSearch()}}var ie=Object.defineProperty,re=(r,e,t)=>e in r?ie(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ae=(r,e,t)=>re(r,e+"",t);const ne=r=>f.isEmpty(r),le=()=>!0,oe=(r,e)=>{const t=r.getSearchObject();let s=!0;for(const[i,a]of Object.entries(e)){const o=t[i];s=a(o),s||(s=!1)}return()=>s};class ${constructor(e){ae(this,"record"),this.record=e}static from(e){const t=e.filter(s=>s.value===void 0?!1:Array.isArray(s.value)?s.value.length>0:!0).reduce((s,i)=>{const a=i.transform?i.transform(i.value):i.value;return{...s,...f.isPlainObject(a)?a:{[i.field]:a}}},{});return new $(t)}transform(e,t){const s=this.record[e],i=t(s);return delete this.record[e],this.record={...this.record,...i},this}toCondition(e){return{...this.record,...e}}}var ce=Object.defineProperty,ue=(r,e,t)=>e in r?ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,O=(r,e,t)=>ue(r,typeof e!="symbol"?e+"":e,t);class j{constructor(e){O(this,"config"),O(this,"_state"),O(this,"listeners",new Set),O(this,"debounceTimers",new Map),this.config=e,this._state={id:e.id,values:this.initValues(e.searches),tags:[],searching:!1},this.updateTags()}initValues(e){const t={};for(const s of e)t[s.field]=s.initValue;return t}getState(){return{...this._state}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){const e=this.getState();for(const t of this.listeners)t(e)}getValue(e){return this._state.values[e]}setValue(e,t,s){this._state.values[e]=t;const i=this.config.searches.find(a=>a.field===e);if(i!=null&&i.onChange)if(s){const a=this.debounceTimers.get(e);a&&clearTimeout(a),this.debounceTimers.set(e,setTimeout(()=>{i.onChange(t,this.createContext()),this.debounceTimers.delete(e)},s))}else i.onChange(t,this.createContext());this.notify()}createContext(){return{id:this.config.id,getValue:e=>this.getValue(e),setValue:(e,t)=>this.setValue(e,t),getSearchObject:()=>this.getSearchObject(),doSearch:()=>this.doSearch(),reset:()=>this.reset(),updateTags:()=>this.updateTags()}}getSearchObject(){const e={};for(const t of this.config.searches){const s=this._state.values[t.field];s!==void 0&&s!==""&&s!==null&&(t.transform?Object.assign(e,t.transform(s)):e[t.field]=s)}return e}async doSearch(){if(!this._state.searching)try{this._state.searching=!0,this.notify(),await this.config.onSearch(this.getSearchObject()),this.updateTags()}finally{this._state.searching=!1,this.notify()}}reset(){for(const e of this.config.searches)this._state.values[e.field]=e.initValue;this._state.tags=[],this.notify()}updateTags(){var e,t;const s=[];for(const i of this.config.searches){const a=this._state.values[i.field];(i.tagFilter?i.tagFilter(a):this.defaultHasValue(a))&&s.push({field:i.field,label:i.label,value:a,valueText:void 0,required:(e=i.required)!=null?e:!1,closable:!((t=i.required)!=null&&t)})}this._state.tags=s,this.notify()}defaultHasValue(e){return e==null?!1:typeof e=="number"||typeof e=="boolean"?!0:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim()!=="":!0}updateTagValueText(e,t){const s=this._state.tags.find(i=>i.field===e);s&&(s.valueText=t,this.notify())}getApi(){return{...this.createContext(),state:this.getState(),fields:this.config.searches}}}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,m=(r,e,t)=>de(r,typeof e!="symbol"?e+"":e,t);let R=class q{constructor(e,t,s,i,a,o){this.id=e,m(this,"items"),m(this,"config"),m(this,"searching"),m(this,"tags"),m(this,"searchCallback"),m(this,"sourceSearchable"),m(this,"componentTextGetters"),m(this,"core"),m(this,"unsubscribe"),m(this,"_lastSearchObject",{time:0,data:null}),this.id=e,this.items=t.map((n,h)=>new V(n,h,i)),this.config=new E(this,t.map((n,h)=>S.formSearchConfig(n,h)),o),this.componentTextGetters=a,this.sourceSearchable=t,this.searching=!1,this.searchCallback=s,this.tags=[],this.core=new j({id:e,searches:t.map(n=>({field:n.field,label:n.label,render:n.render,initValue:n.initValue,required:n.required,visible:n.visible,pinned:n.pinned,span:n.span,disabled:n.disabled,enable:n.enable,tagFilter:n.tagFilter,transform:n.transform,onChange:n.onChange})),onSearch:s}),this.unsubscribe=this.core.subscribe(n=>{this.searching=n.searching})}static create(e){return new q(e.id,e.searches,e.onSearch,e.debounceFn,e.componentTextGetters,e.storage)}updateSearchTag(e){var t;(t=this.tags.find(s=>s.field===e))==null||t.updateValueText()}updateTags(){this.tags=this.items.filter(e=>e.tagFilter?e.tagFilter(e.value):D.hasValue(e)).map(e=>new D(this,e,this.componentTextGetters)).sort((e,t)=>this.config.itemLayouts[e.field].index-this.config.itemLayouts[t.field].index),this.core.updateTags()}getSearchObject(e){const t=Date.now();return this._lastSearchObject.data&&t-this._lastSearchObject.time<50?this._lastSearchObject.data:(this._lastSearchObject={time:t,data:$.from(this.items).toCondition(e)},this._lastSearchObject.data)}async doSearch(){if(!this.searching)try{this.searching=!0,await this.searchCallback(this.getSearchObject()),this.updateTags()}finally{this.searching=!1}}async reset(e){this.items.forEach(t=>t.reset()),this.core.reset(),e&&await this.doSearch()}setSearchValue(e,t,s=i=>!0){const i=this.items.find(a=>a.field===e);i&&s&&s(i.value)&&(i.value=t,this.core.setValue(e,t))}destroy(){var e;(e=this.unsubscribe)==null||e.call(this)}};const N=()=>{const r=l.shallowRef(),e=l.ref(),t=l.ref([]),s=l.ref(!1),i=l.ref(),a=l.ref([]),o=l.ref(300),n=u=>{r.value=u,t.value=[{label:"全部",id:"all",children:r.value.items.sort((d,_)=>u.config.itemLayouts[d.field].index-u.config.itemLayouts[_.field].index).map(d=>({label:d.label,id:d.field,disabled:!d.isEnable(u),pinned:u.config.itemLayouts[d.field].pinned}))}],i.value=Object.keys(u.config.itemLayouts).filter(d=>{var _;return(_=u.config.itemLayouts[d])==null?void 0:_.visible})};return{treeRef:e,visible:s,snapshot:t,defaultCheckedKeys:i,drawerWidth:o,updateSnapshot:n,show:u=>{n(u),s.value=!0},save:()=>{r.value.config.sync(t.value[0].children.map(u=>u.id),new Set(e.value.getCheckedKeys()),new Set(t.value[0].children.filter(u=>u.pinned).map(u=>u.id))),r.value.config.persistent(),s.value=!1},reset:()=>{r.value.config.reset(),n(r.value)},keepSelection:()=>{a.value=e.value.getCheckedKeys()},restoreSelection:()=>{e.value.setCheckedKeys(a.value),a.value=[]},allowDrop:(u,d,_)=>_!=="inner",allowDrag:u=>!u.disabled,onPinnedChange:u=>{u.data.pinned=!u.data.pinned}}};function fe(r,e,t){return{refreshCallback:async s=>{const i=e.value.getSearchObject();try{return e.value.updateSearching(!0),await r(i,s)}finally{e.value.updateSearching(!1),e.value.updateTags()}},searchCallback:async()=>{var s;for(const i of t)await((s=i.value)==null?void 0:s.refresh())}}}const pe=[{isApply(r){return r.contains("el-radio-group")},getText(r){var e,t;return(t=(e=r.querySelector(".is-active"))==null?void 0:e.querySelector("input"))==null?void 0:t.value}},{isApply(r){return r.contains("el-checkbox-group")},getText(r){var e;const t=Array.from((e=r.querySelectorAll(".el-checkbox__input.is-checked"))!=null?e:[]).map(s=>{var i;return(i=s.querySelector("input"))==null?void 0:i.value}).filter(s=>s);if(t.length===1)return t[0];if(t.length>1)return`${t[0]} 等${t.length}条`}},{isApply(r){return r.contains("el-input")},getText(r,e){return e.value}},{isApply(r){return r.contains("el-input-number")},getText(r,e){return e.value}},{isApply(r){return r.contains("el-select")},getText(r,e){var t,s;const i=r.querySelectorAll(".el-select__tags-text");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}},{isApply(r){return r.contains("el-cascader")},getText(r){var e;return(e=r.querySelector("input"))==null?void 0:e.value}},{isApply(r){return r.contains("el-switch")},getText(r){const e=r.querySelector(".is-active");return e==null?void 0:e.innerHTML}},{isApply(r){return r.contains("el-slider")},getText(r,e){return e.value}},{isApply(r){return r.contains("el-date-editor")},getText(r,e){return Array.isArray(e.value)?e.value.join(" ~ "):e.value}}];class _e extends R{constructor(e,t,s,i){super(e,t,s,P.useDebounceFn,pe,i)}}const ge={name:"PinIcon",props:{active:{type:Boolean,default:!1}}};var ve=function(){var e=this,t=e._self._c;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){return s.stopPropagation(),e.$emit("click")}}},[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"}})])},me=[],be=C(ge,ve,me,!1,null,"b04d59bb");const Se=be.exports,ye=l.defineComponent({__name:"SearchSettingsDrawer",setup(r,{expose:e}){const{treeRef:t,visible:s,snapshot:i,drawerWidth:a,defaultCheckedKeys:o,show:n,allowDrop:h,allowDrag:g,keepSelection:y,restoreSelection:x,save:w,reset:T,onPinnedChange:L}=N();return e({show:n}),{__sfc:!0,treeRef:t,visible:s,snapshot:i,drawerWidth:a,defaultCheckedKeys:o,show:n,allowDrop:h,allowDrag:g,keepSelection:y,restoreSelection:x,save:w,reset:T,onPinnedChange:L,PinIcon:Se}}});var we=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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){s.visible=i}}},[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}){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){return s.onPinnedChange(i)}}}):e._e()],1)]}}])}),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)])},Ce=[],xe=C(ye,we,Ce,!1,null,null);const Te=xe.exports,Le=l.defineComponent({__name:"SettingButton",props:{state:null},setup(r){const e=r,t=l.ref();return{__sfc:!0,props:e,searchSettingDialogRef:t,showSearchLayoutDialog:()=>{t.value.show(e.state)},SearchSettingsDrawer:Te}}});var Pe=function(){var e=this,t=e._self._c,s=e._self._setupProxy;return t("el-button",{staticClass:"icon-button",on:{click:s.showSearchLayoutDialog}},[t("i",{staticClass:"el-icon-s-tools"}),t(s.SearchSettingsDrawer,{ref:"searchSettingDialogRef"})],1)},$e=[],Oe=C(Le,Pe,$e,!1,null,"2b748196");const Ae=Oe.exports,De={functional:!0,props:{search:{type:Object,required:!0},api:{type:Object}},render(r,e){var t;const{props:s}=e,i=s.search.render(s.search);if(i.componentOptions.propsData||(i.componentOptions.propsData={}),i.componentOptions.listeners||(i.componentOptions.listeners={}),i.componentOptions.listeners||(i.componentOptions.listeners={}),(t=i.data)!=null&&t.attrs||(i.data.attrs={}),i.data.attrs.labelChange=()=>{s.api.updateSearchTag(s.search.field)},i.componentOptions.listeners.input){const o=i.componentOptions.listeners.input;i.componentOptions.listeners.input=n=>{s.search.onChange&&s.search.onChange(n,s.api),o(n)}}const a=s.search.isDisabled(s.api);return i.componentOptions.propsData.disabled=a,i.data.attrs.disabled=a,i}},Fe=l.defineComponent({__name:"SearchBarItem",props:{item:null},setup(r){const e=r,t=l.inject("search-bar-state"),s=l.inject("search-bar-id");return{__sfc:!0,props:e,state:t,id:s,SearchItemRender:De}}});var Ve=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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)])},Be=[],Ee=C(Fe,Ve,Be,!1,null,"73b72e60");const je=Ee.exports,Re=l.defineComponent({__name:"SearchBar",props:{searches:null,id:null,onSearch:{type:Function},defaultSpan:{default:6},maxRows:{default:2},itemHeight:{default:67},resetAutoSearch:{type:Boolean,default:!0}},emits:["change"],setup(r,{expose:e,emit:t}){const s=r,i=l.reactive(new _e(s.id,s.searches,s.onSearch)),a=l.ref(!1),o=l.ref(),n=l.ref();P.useMutationObserver(o,()=>{i.updateTags()},{childList:!0}),P.useMutationObserver(n,()=>{i.updateTags()},{childList:!0});const h=l.computed(()=>x.value.filter(d=>w(d).visible).length>0),g=l.ref([]),y=l.computed(()=>g.value.filter(d=>w(d).pinned)),x=l.computed(()=>g.value.filter(d=>!w(d).pinned));P.watchDebounced(()=>[i.items,i.config.itemLayouts],()=>{const d=[...i.items.filter(_=>_.pinned),...i.items.filter(_=>!_.pinned)];g.value=d.sort((_,Me)=>i.config.itemLayouts[_.field].index-i.config.itemLayouts[Me.field].index).filter(_=>_.isEnable(i)),t("change",i.getSearchObject(),i)},{debounce:100,immediate:!0,deep:!0});const w=d=>i.config.itemLayouts[d.field],T=()=>i.items,L=()=>i.getSearchObject(),F=d=>{i.searching=d},u=()=>i.updateTags();return l.provide("search-bar-state",i),l.provide("search-bar-id",s.id),e({getSearchItems:T,getSearchObject:L,updateSearching:F,updateTags:u}),{__sfc:!0,props:s,state:i,expanded:a,itemContainerRef:o,hideItemContainerRef:n,isShowSpanIcon:h,sortedItems:g,sortedPinnedItems:y,sortedNormalItems:x,emits:t,getLayout:w,getSearchItems:T,getSearchObject:L,updateSearching:F,updateTags:u,SearchTagsRender:G,SettingButton:Ae,SearchBarItem:je}}});var Ne=function(){var e=this,t=e._self._c,s=e._self._setupProxy;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){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)}),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){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)}),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){s.expanded=!s.expanded}}},[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)},qe=[],Ie=C(Re,Ne,qe,!1,null,null);const ke=Ie.exports;c.APPLY_ALWAYS=le,c.APPLY_WHEN_NOT_VALUE=ne,c.APPLY_WITH_MULTIPLE_VALUE=oe,c.DEFAULT_SEARCH_SPAN=A,c.LocalStorage=B,c.MemoryStorage=Q,c.SearchBar=ke,c.SearchBarCore=j,c.SearchBarState=R,c.SearchConfig=E,c.SearchItem=V,c.SearchItemLayout=S,c.SearchTag=D,c.Searches=$,c.useSearchProxy=fe,c.useSetting=N,c.vModel=I,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
@@ -5,4 +5,5 @@ export * from './Searches';
5
5
  export * from './setting/use-setting';
6
6
  export * from './core';
7
7
  export * from './storage';
8
+ export * from './useSearchProxy';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../shared/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AACrC,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../shared/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AACrC,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { Ref } from 'vue';
2
+ import type { SearchValueLike } from './types';
3
+ export interface RefreshInstance<SEARCH_OBJECT> {
4
+ refresh: (searchObject?: SEARCH_OBJECT) => void | Promise<void>;
5
+ }
6
+ export type SearchBarInstance<T> = {
7
+ getSearchItems(): SearchValueLike[];
8
+ getSearchObject(): T;
9
+ updateSearching(searching: boolean): void;
10
+ updateTags(): void;
11
+ };
12
+ export declare function useSearchProxy<C_PARAM, SEARCH_OBJECT, VALUE>(callback: (searchObject: SEARCH_OBJECT, params: C_PARAM) => VALUE, instance: Ref<SearchBarInstance<SEARCH_OBJECT> | undefined>, refreshInstance: Ref<RefreshInstance<any> | undefined>[]): {
13
+ refreshCallback: (param: C_PARAM) => Promise<Awaited<VALUE>>;
14
+ searchCallback: () => Promise<void>;
15
+ };
16
+ //# sourceMappingURL=useSearchProxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSearchProxy.d.ts","sourceRoot":"","sources":["../../../../../shared/src/useSearchProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,MAAM,WAAW,eAAe,CAAC,aAAa;IAC5C,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,cAAc,IAAI,eAAe,EAAE,CAAA;IACnC,eAAe,IAAI,CAAC,CAAA;IACpB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAA;IACzC,UAAU,IAAI,IAAI,CAAA;CACnB,CAAA;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAC1D,QAAQ,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,KAAK,KAAK,EACjE,QAAQ,EAAE,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC,EAC3D,eAAe,EAAE,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,GACvD;IACD,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5D,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACpC,CAkBA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchItemRender.d.ts","sourceRoot":"","sources":["../../../../src/SearchItemRender.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;;;;;kBAMhC,QAAQ,CAAC,UAAU,CAAC;;;;kBAIpB,QAAQ,CAAC,cAAc,CAAC;;;cAGlC,GAAG,WAAW;QAAE,KAAK,EAAE;YAAE,MAAM,EAAE,UAAU,CAAC;YAAC,GAAG,EAAE,cAAc,CAAA;SAAE,CAAA;KAAE;;AAXhF,wBAgDC"}
1
+ {"version":3,"file":"SearchItemRender.d.ts","sourceRoot":"","sources":["../../../../src/SearchItemRender.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;;;;;kBAMhC,QAAQ,CAAC,UAAU,CAAC;;;;kBAIpB,QAAQ,CAAC,cAAc,CAAC;;;cAGlC,GAAG,WAAW;QAAE,KAAK,EAAE;YAAE,MAAM,EAAE,UAAU,CAAC;YAAC,GAAG,EAAE,cAAc,CAAA;SAAE,CAAA;KAAE;;AAXhF,wBAkDC"}
@@ -1,19 +1,4 @@
1
1
  export * from './helper/vModel';
2
2
  export { default as SearchBar } from './SearchBar.vue';
3
3
  export * from '../../shared/src';
4
- import type { Ref } from 'vue';
5
- import type { SearchValueLike } from '../../shared/src';
6
- export interface RefreshInstance<SEARCH_OBJECT> {
7
- refresh: (searchObject?: SEARCH_OBJECT) => void | Promise<void>;
8
- }
9
- export declare const useSearchProxy: <C_PARAM, SEARCH_OBJECT, VALUE>(callback: (searchObject: SEARCH_OBJECT, params: C_PARAM) => VALUE, instance: Ref<SearchBarInstance<SEARCH_OBJECT>>, refreshInstance: Ref<RefreshInstance<SEARCH_OBJECT>>[]) => {
10
- refreshCallback: (param: C_PARAM) => Promise<VALUE>;
11
- searchCallback: () => Promise<void>;
12
- };
13
- export type SearchBarInstance<T> = {
14
- getSearchItems(): SearchValueLike[];
15
- getSearchObject(): T;
16
- updateSearching(searching: boolean): void;
17
- updateTags(): void;
18
- };
19
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,cAAc,6BAA6B,CAAA;AAE3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAElE,MAAM,WAAW,eAAe,CAAC,aAAa;IAC5C,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,EAAE,aAAa,EAAE,KAAK,EAC1D,UAAU,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,KAAK,KAAK,EACjE,UAAU,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,EAC/C,iBAAiB,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,EAAE;6BAGrB,OAAO;;CAgBzC,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,cAAc,IAAI,eAAe,EAAE,CAAA;IACnC,eAAe,IAAI,CAAC,CAAA;IACpB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAA;IACzC,UAAU,IAAI,IAAI,CAAA;CACnB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,cAAc,6BAA6B,CAAA"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@scvzerng/element-plus-search-vue2",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "scripts": {
7
7
  "dev": "vite",
8
- "build": "vite build && vue-tsc --declaration --emitDeclarationOnly",
8
+ "build": "vite build && vue-tsc --declaration --emitDeclarationOnly && node ../../scripts/fix-type-imports.mjs vue2",
9
9
  "lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
10
10
  "lint": "run-s lint:*",
11
11
  "format": "prettier --write src/"