@jctrans-materials/comps-vue2 1.0.6 → 1.0.7

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/index.esm.js CHANGED
@@ -1,12 +1,12 @@
1
- import le, { ref as S, computed as $, onMounted as ce, onBeforeUnmount as Kt, defineComponent as ue, toRef as Et, watch as ht, reactive as Ot } from "vue";
1
+ import le, { ref as S, computed as X, onMounted as ce, onBeforeUnmount as Kt, defineComponent as ue, toRef as Et, watch as ht, reactive as Ot } from "vue";
2
2
  import { locationSearchV2 as Yt, emitter as K, MODAL_ACTION as Y, initSharedConfig as fe } from "@jctrans-materials/shared";
3
3
  import { MODAL_ACTION as Vn, emitter as Hn } from "@jctrans-materials/shared";
4
4
  import { Col as _t, Row as kt, Checkbox as Tt, Button as It, Input as Lt, FormItem as Ft, Form as Bt, Dialog as Mt } from "jctrans-ui";
5
5
  le.util.warn;
6
6
  function de(e) {
7
- const t = S([]), n = "_search_history_cache", o = typeof window < "u" && typeof localStorage < "u", s = $(
7
+ const t = S([]), n = "_search_history_cache", o = typeof window < "u" && typeof localStorage < "u", s = X(
8
8
  () => (e.value || "") + n
9
- ), i = $(
9
+ ), i = X(
10
10
  () => !!e.value && e.value !== ""
11
11
  ), r = (l) => {
12
12
  if (!l || !o) return;
@@ -58,7 +58,7 @@ async function me(e, t = [
58
58
  }
59
59
  const gt = (e, t) => Yt.searchByIdWithType(e, t);
60
60
  function pe(e, t) {
61
- const n = S([]), o = S(!1), s = S(!1), i = S(1), r = S(0), a = S(10), l = $(() => r.value === 0 ? !1 : n.value.length >= r.value), u = $(() => {
61
+ const n = S([]), o = S(!1), s = S(!1), i = S(1), r = S(0), a = S(10), l = X(() => r.value === 0 ? !1 : n.value.length >= r.value), u = X(() => {
62
62
  const m = [...t.value];
63
63
  return m.includes("Country") && !m.includes("Region") && m.push("Region"), m;
64
64
  }), c = (m) => !m || !Array.isArray(m) ? [] : m.filter(
@@ -126,19 +126,19 @@ function st(e) {
126
126
  function jt(e) {
127
127
  return e === "x" ? "y" : "x";
128
128
  }
129
- function zt(e) {
129
+ function $t(e) {
130
130
  return e === "y" ? "height" : "width";
131
131
  }
132
132
  const ye = /* @__PURE__ */ new Set(["top", "bottom"]);
133
133
  function U(e) {
134
134
  return ye.has(W(e)) ? "y" : "x";
135
135
  }
136
- function Xt(e) {
136
+ function zt(e) {
137
137
  return jt(U(e));
138
138
  }
139
139
  function ve(e, t, n) {
140
140
  n === void 0 && (n = !1);
141
- const o = st(e), s = Xt(e), i = zt(s);
141
+ const o = st(e), s = zt(e), i = $t(s);
142
142
  let r = s === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
143
143
  return t.reference[i] > t.floating[i] && (r = ct(r)), [r, ct(r)];
144
144
  }
@@ -210,7 +210,7 @@ function Vt(e, t, n) {
210
210
  reference: o,
211
211
  floating: s
212
212
  } = e;
213
- const i = U(t), r = Xt(t), a = zt(r), l = W(t), u = i === "y", c = o.x + o.width / 2 - s.width / 2, f = o.y + o.height / 2 - s.height / 2, m = o[a] / 2 - s[a] / 2;
213
+ const i = U(t), r = zt(t), a = $t(r), l = W(t), u = i === "y", c = o.x + o.width / 2 - s.width / 2, f = o.y + o.height / 2 - s.height / 2, m = o[a] / 2 - s[a] / 2;
214
214
  let d;
215
215
  switch (l) {
216
216
  case "top":
@@ -422,7 +422,7 @@ const Ee = function(e) {
422
422
  T === "y";
423
423
  }
424
424
  return !0;
425
- }).map((b) => [b.placement, b.overflows.filter((T) => T > 0).reduce((T, z) => T + z, 0)]).sort((b, T) => b[1] - T[1])[0]) == null ? void 0 : v[0];
425
+ }).map((b) => [b.placement, b.overflows.filter((T) => T > 0).reduce((T, $) => T + $, 0)]).sort((b, T) => b[1] - T[1])[0]) == null ? void 0 : v[0];
426
426
  D && (F = D);
427
427
  break;
428
428
  }
@@ -591,7 +591,7 @@ function ft() {
591
591
  return typeof window < "u";
592
592
  }
593
593
  function et(e) {
594
- return $t(e) ? (e.nodeName || "").toLowerCase() : "#document";
594
+ return Xt(e) ? (e.nodeName || "").toLowerCase() : "#document";
595
595
  }
596
596
  function _(e) {
597
597
  var t;
@@ -599,9 +599,9 @@ function _(e) {
599
599
  }
600
600
  function Q(e) {
601
601
  var t;
602
- return (t = ($t(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
602
+ return (t = (Xt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
603
603
  }
604
- function $t(e) {
604
+ function Xt(e) {
605
605
  return ft() ? e instanceof Node || e instanceof _(e).Node : !1;
606
606
  }
607
607
  function B(e) {
@@ -714,7 +714,7 @@ function te(e) {
714
714
  function Ct(e) {
715
715
  return B(e) ? e : e.contextElement;
716
716
  }
717
- function X(e) {
717
+ function z(e) {
718
718
  const t = Ct(e);
719
719
  if (!N(t))
720
720
  return P(1);
@@ -744,14 +744,14 @@ function j(e, t, n, o) {
744
744
  t === void 0 && (t = !1), n === void 0 && (n = !1);
745
745
  const s = e.getBoundingClientRect(), i = Ct(e);
746
746
  let r = P(1);
747
- t && (o ? B(o) && (r = X(o)) : r = X(e));
747
+ t && (o ? B(o) && (r = z(o)) : r = z(e));
748
748
  const a = qe(i, n, o) ? ee(i) : P(0);
749
749
  let l = (s.left + a.x) / r.x, u = (s.top + a.y) / r.y, c = s.width / r.x, f = s.height / r.y;
750
750
  if (i) {
751
751
  const m = _(i), d = o && B(o) ? _(o) : o;
752
752
  let p = m, h = At(p);
753
753
  for (; h && o && d !== p; ) {
754
- const y = X(h), g = h.getBoundingClientRect(), A = M(h), w = g.left + (h.clientLeft + parseFloat(A.paddingLeft)) * y.x, C = g.top + (h.clientTop + parseFloat(A.paddingTop)) * y.y;
754
+ const y = z(h), g = h.getBoundingClientRect(), A = M(h), w = g.left + (h.clientLeft + parseFloat(A.paddingLeft)) * y.x, C = g.top + (h.clientTop + parseFloat(A.paddingTop)) * y.y;
755
755
  l *= y.x, u *= y.y, c *= y.x, f *= y.y, l += w, u += C, p = _(h), h = At(p);
756
756
  }
757
757
  }
@@ -790,7 +790,7 @@ function We(e) {
790
790
  const c = P(0), f = N(o);
791
791
  if ((f || !f && !i) && ((et(o) !== "body" || it(r)) && (l = mt(o)), N(o))) {
792
792
  const d = j(o);
793
- u = X(o), c.x = d.x + o.clientLeft, c.y = d.y + o.clientTop;
793
+ u = z(o), c.x = d.x + o.clientLeft, c.y = d.y + o.clientTop;
794
794
  }
795
795
  const m = r && !f && !i ? ne(r, l) : P(0);
796
796
  return {
@@ -837,7 +837,7 @@ function Ke(e, t) {
837
837
  }
838
838
  const Ye = /* @__PURE__ */ new Set(["absolute", "fixed"]);
839
839
  function je(e, t) {
840
- const n = j(e, !0, t === "fixed"), o = n.top + e.clientTop, s = n.left + e.clientLeft, i = N(e) ? X(e) : P(1), r = e.clientWidth * i.x, a = e.clientHeight * i.y, l = s * i.x, u = o * i.y;
840
+ const n = j(e, !0, t === "fixed"), o = n.top + e.clientTop, s = n.left + e.clientLeft, i = N(e) ? z(e) : P(1), r = e.clientWidth * i.x, a = e.clientHeight * i.y, l = s * i.x, u = o * i.y;
841
841
  return {
842
842
  width: r,
843
843
  height: a,
@@ -868,7 +868,7 @@ function oe(e, t) {
868
868
  const n = J(e);
869
869
  return n === t || !B(n) || tt(n) ? !1 : M(n).position === "fixed" || oe(n, t);
870
870
  }
871
- function ze(e, t) {
871
+ function $e(e, t) {
872
872
  const n = t.get(e);
873
873
  if (n)
874
874
  return n;
@@ -881,14 +881,14 @@ function ze(e, t) {
881
881
  }
882
882
  return t.set(e, o), o;
883
883
  }
884
- function Xe(e) {
884
+ function ze(e) {
885
885
  let {
886
886
  element: t,
887
887
  boundary: n,
888
888
  rootBoundary: o,
889
889
  strategy: s
890
890
  } = e;
891
- const r = [...n === "clippingAncestors" ? dt(t) ? [] : ze(t, this._c) : [].concat(n), o], a = r[0], l = r.reduce((u, c) => {
891
+ const r = [...n === "clippingAncestors" ? dt(t) ? [] : $e(t, this._c) : [].concat(n), o], a = r[0], l = r.reduce((u, c) => {
892
892
  const f = qt(t, c, s);
893
893
  return u.top = O(f.top, u.top), u.right = Z(f.right, u.right), u.bottom = Z(f.bottom, u.bottom), u.left = O(f.left, u.left), u;
894
894
  }, qt(t, a, s));
@@ -899,7 +899,7 @@ function Xe(e) {
899
899
  y: l.top
900
900
  };
901
901
  }
902
- function $e(e) {
902
+ function Xe(e) {
903
903
  const {
904
904
  width: t,
905
905
  height: n
@@ -980,12 +980,12 @@ function en(e) {
980
980
  const nn = {
981
981
  convertOffsetParentRelativeRectToViewportRelativeRect: We,
982
982
  getDocumentElement: Q,
983
- getClippingRect: Xe,
983
+ getClippingRect: ze,
984
984
  getOffsetParent: se,
985
985
  getElementRects: tn,
986
986
  getClientRects: Je,
987
- getDimensions: $e,
988
- getScale: X,
987
+ getDimensions: Xe,
988
+ getScale: z,
989
989
  isElement: B,
990
990
  isRTL: en
991
991
  };
@@ -1195,7 +1195,7 @@ const dn = "data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20clas
1195
1195
  }
1196
1196
  r.value && clearTimeout(r.value), r.value = setTimeout(() => A(1, !1), 300);
1197
1197
  });
1198
- const G = $(() => e.lang ? e.lang === "en" || e.lang === "en-US" : typeof document < "u" ? /(^|;\s*)jc-language=en(-US)?(;|$)/.test(document.cookie || "") : !1), q = (v) => G.value ? v.displayEn || v.display || v.nameEn || "" : v.displayCn || v.display || v.nameCn || v.name || "";
1198
+ const G = X(() => e.lang ? e.lang === "en" || e.lang === "en-US" : typeof document < "u" ? /(^|;\s*)jc-language=en(-US)?(;|$)/.test(document.cookie || "") : !1), q = (v) => G.value ? v.displayEn || v.display || v.nameEn || "" : v.displayCn || v.display || v.nameCn || v.name || "";
1199
1199
  return ht(
1200
1200
  () => e.value,
1201
1201
  async (v, E) => {
@@ -1206,17 +1206,17 @@ const dn = "data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20clas
1206
1206
  );
1207
1207
  if (D.length > 0)
1208
1208
  try {
1209
- const b = D.map((z) => z.id), T = await gt(
1209
+ const b = D.map(($) => $.id), T = await gt(
1210
1210
  b,
1211
1211
  D[0].type
1212
1212
  );
1213
1213
  if (T && T.records) {
1214
- let z = !1;
1214
+ let $ = !1;
1215
1215
  const Rt = F.map((rt) => {
1216
1216
  const Dt = T.records.find((ae) => ae.id === rt.id);
1217
- return Dt && !rt.display ? (z = !0, { ...rt, ...Dt }) : rt;
1217
+ return Dt && !rt.display ? ($ = !0, { ...rt, ...Dt }) : rt;
1218
1218
  });
1219
- z && (t("input", Rt), t("update:value", Rt));
1219
+ $ && (t("input", Rt), t("update:value", Rt));
1220
1220
  }
1221
1221
  } catch (b) {
1222
1222
  console.error("Batch fetch detail failed:", b);
@@ -1318,7 +1318,7 @@ const dn = "data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20clas
1318
1318
  return this.multiple ? this.query ? `${this.query.length * 10 + 20}px` : "10px" : "100%";
1319
1319
  },
1320
1320
  currentPlaceholder() {
1321
- return this.multiple && this.selectedItems.length > 0 ? "" : this.isSelected && !this.multiple ? this.selectedLabel : this.placeholder || this.isEn ? "Please enter..." : "请输入...";
1321
+ return this.multiple && this.selectedItems.length > 0 ? "" : this.isSelected && !this.multiple ? this.selectedLabel : this.placeholder ? this.placeholder : this.isEn ? "Please enter..." : "请输入...";
1322
1322
  }
1323
1323
  },
1324
1324
  methods: {
@@ -1357,7 +1357,7 @@ const dn = "data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20clas
1357
1357
  return this.selectedItems.some((t) => t.id === e.id);
1358
1358
  },
1359
1359
  selectItem(e) {
1360
- this.saveToHistory(e), this.multiple ? this.isItemActive(e) || (this.$emit("input", [...this.selectedItems, e]), this.$emit("update:value", [...this.selectedItems, e])) : (this.isSelected = !0, this.selectedLabel = this.getItemLabel(e), this.$emit("input", e), this.$emit("update:value", e), this.isDropdownVisible = !1), this.query = "", this.$emit("select", e);
1360
+ this.saveToHistory(e), this.multiple ? this.isItemActive(e) || (this.$emit("input", [...this.selectedItems, e]), this.$emit("update:value", [...this.selectedItems, e])) : (this.isSelected = !0, this.selectedLabel = this.getItemLabel(e), this.$emit("input", e), this.$emit("update:value", e), this.isDropdownVisible = !1), this.query = "", this.$emit("select", e), this.$emit("change", e);
1361
1361
  },
1362
1362
  removeItem(e) {
1363
1363
  const t = this.selectedItems.filter((n) => n.id !== e.id);
@@ -1438,7 +1438,7 @@ var An = function() {
1438
1438
  wn,
1439
1439
  !1,
1440
1440
  null,
1441
- "4a9cd69d"
1441
+ "74864ae1"
1442
1442
  );
1443
1443
  const re = xn.exports, bn = {
1444
1444
  __name: "ApplyDataDialog",
@@ -1472,7 +1472,7 @@ const re = xn.exports, bn = {
1472
1472
  }), r = Ot({
1473
1473
  name: "",
1474
1474
  type: "City"
1475
- }), a = $(() => {
1475
+ }), a = X(() => {
1476
1476
  if (n.lang && n.lang !== "")
1477
1477
  return n.lang === "en" || n.lang === "en-US";
1478
1478
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jctrans-materials/comps-vue2",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "private": false,
5
5
  "description": "JCtrans Search Component compatible with Vue 2.6+ and Vue 3",
6
6
  "main": "dist/index.cjs.js",
@@ -28,7 +28,7 @@
28
28
  "@floating-ui/dom": "^1.7.4",
29
29
  "jctrans-ui": "^2.15.15",
30
30
  "sass": "^1.94.2",
31
- "@jctrans-materials/shared": "1.0.6"
31
+ "@jctrans-materials/shared": "1.0.7"
32
32
  },
33
33
  "devDependencies": {
34
34
  "vue": "^2.6.14",