@dazhicheng/ui 1.5.252 → 1.5.254

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.
@@ -23,7 +23,7 @@ const de = /* @__PURE__ */ O({
23
23
  },
24
24
  emits: ["update:modelValue"],
25
25
  setup(S, { expose: $ }) {
26
- const [n, j] = Q(), c = _(S, "modelValue"), { prefixCls: V } = J("form-submit-btn"), D = E(), h = d(() => ({
26
+ const [n, j] = Q(), c = _(S, "modelValue"), { prefixCls: V } = J("form-submit-btn"), D = E(), w = d(() => ({
27
27
  content: "重置",
28
28
  show: !0,
29
29
  ...o(n).resetButtonOptions
@@ -32,7 +32,7 @@ const de = /* @__PURE__ */ O({
32
32
  show: !0,
33
33
  ...o(n).submitButtonOptions
34
34
  })), f = L(!1), T = d(() => o(n).showCollapseButton && f.value);
35
- async function w(e) {
35
+ async function h(e) {
36
36
  var a;
37
37
  e == null || e.preventDefault(), e == null || e.stopPropagation();
38
38
  const t = o(n);
@@ -83,7 +83,7 @@ const de = /* @__PURE__ */ O({
83
83
  const y = a.getBoundingClientRect();
84
84
  y.top !== 0 && s.add(y.top);
85
85
  }
86
- s.size === 1 ? p() : f.value = !0;
86
+ s.size <= (o(n).collapsedRows ?? 1) ? p() : f.value = !0;
87
87
  }
88
88
  }
89
89
  M(
@@ -134,7 +134,7 @@ const de = /* @__PURE__ */ O({
134
134
  }, 200);
135
135
  }), $({
136
136
  handleReset: A,
137
- handleSubmit: w
137
+ handleSubmit: h
138
138
  }), (e, t) => (l(), C("div", {
139
139
  class: I(o(G)(N.value))
140
140
  }, [
@@ -143,7 +143,7 @@ const de = /* @__PURE__ */ O({
143
143
  i.value.show ? (l(), v(b(o(P)), g({ key: 0 }, i.value, {
144
144
  class: o(V),
145
145
  type: "primary",
146
- onClick: w
146
+ onClick: h
147
147
  }), {
148
148
  default: k(() => [
149
149
  B(R(i.value.content), 1)
@@ -152,9 +152,9 @@ const de = /* @__PURE__ */ O({
152
152
  }, 16, ["class"])) : u("", !0)
153
153
  ], 64)) : u("", !0),
154
154
  m(e.$slots, "reset-before"),
155
- h.value.show ? (l(), v(b(o(P)), g({ key: 1 }, h.value, { onClick: A }), {
155
+ w.value.show ? (l(), v(b(o(P)), g({ key: 1 }, w.value, { onClick: A }), {
156
156
  default: k(() => [
157
- B(R(h.value.content), 1)
157
+ B(R(w.value.content), 1)
158
158
  ]),
159
159
  _: 1
160
160
  }, 16)) : u("", !0),
@@ -164,7 +164,7 @@ const de = /* @__PURE__ */ O({
164
164
  key: 0,
165
165
  type: "primary",
166
166
  class: o(V)
167
- }, i.value, { onClick: w }), {
167
+ }, i.value, { onClick: h }), {
168
168
  default: k(() => [
169
169
  B(R(i.value.content), 1)
170
170
  ]),
@@ -1,47 +1,52 @@
1
- import { useTemplateRef as y, ref as m, computed as b, watch as x, nextTick as f, onMounted as k } from "vue";
1
+ import { useTemplateRef as y, ref as f, computed as b, watch as x, nextTick as m, onMounted as k } from "vue";
2
2
  import { useElementVisibility as C, useBreakpoints as B, breakpointsTailwind as I } from "@vueuse/core";
3
- function H(t) {
4
- const a = y("wrapperRef"), w = C(a), i = m({}), s = m(!1), d = B(I), g = b(() => {
5
- const e = t.collapsedRows ?? 1, l = i.value;
6
- let o = 0;
7
- for (let n = 1; n <= e; n++)
8
- o += (l == null ? void 0 : l[n]) ?? 0;
9
- return Math.max(o - 1, 1);
3
+ function H(n) {
4
+ const i = y("wrapperRef"), w = C(i), l = f({}), s = f(!1), d = B(I), g = b(() => {
5
+ const e = n.collapsedRows ?? 1, o = l.value;
6
+ let t = 0;
7
+ for (let a = 1; a <= e; a++)
8
+ t += (o == null ? void 0 : o[a]) ?? 0;
9
+ return Math.max(t - 1, 1);
10
10
  });
11
11
  x(
12
12
  [
13
- () => t.showCollapseButton,
13
+ () => n.showCollapseButton,
14
14
  () => d.active().value,
15
15
  () => {
16
16
  var e;
17
- return (e = t.schema) == null ? void 0 : e.length;
17
+ return (e = n.schema) == null ? void 0 : e.length;
18
18
  },
19
19
  () => w.value
20
20
  ],
21
- async ([e]) => {
22
- e && (await f(), i.value = {}, s.value = !1, await c());
21
+ async ([e, , , o]) => {
22
+ var t;
23
+ if (e && o) {
24
+ if (await m(), !((t = i.value) != null && t.offsetParent))
25
+ return;
26
+ l.value = {}, s.value = !1, await c();
27
+ }
23
28
  }
24
29
  );
25
30
  async function c() {
26
- if (!t.showCollapseButton || (await f(), !a.value))
31
+ if (!n.showCollapseButton || (await m(), !i.value))
27
32
  return;
28
- const e = a.value, o = window.getComputedStyle(e).getPropertyValue("grid-template-rows").split(" "), n = e == null ? void 0 : e.getBoundingClientRect();
29
- if (o[0] === "none" || n.height === 0)
33
+ const e = i.value, t = window.getComputedStyle(e).getPropertyValue("grid-template-rows").split(" "), a = e == null ? void 0 : e.getBoundingClientRect();
34
+ if (t[0] === "none" || a.height === 0)
30
35
  return;
31
36
  Array.from(e.children).forEach((h) => {
32
- const p = h.getBoundingClientRect().top - n.top;
37
+ const v = h.getBoundingClientRect().top - a.top;
33
38
  let r = 0, u = 0;
34
- for (const [v, R] of o.entries())
35
- if (u += Number.parseFloat(R), p < u) {
36
- r = v + 1;
39
+ for (const [p, R] of t.entries())
40
+ if (u += Number.parseFloat(R), v < u) {
41
+ r = p + 1;
37
42
  break;
38
43
  }
39
- r > ((t == null ? void 0 : t.collapsedRows) ?? 1) || (i.value[r] = (i.value[r] ?? 0) + 1, s.value = !0);
44
+ r > ((n == null ? void 0 : n.collapsedRows) ?? 1) || (l.value[r] = (l.value[r] ?? 0) + 1, s.value = !0);
40
45
  });
41
46
  }
42
47
  return k(() => {
43
48
  c();
44
- }), { isCalculated: s, keepFormItemIndex: g, wrapperRef: a };
49
+ }), { isCalculated: s, keepFormItemIndex: g, wrapperRef: i };
45
50
  }
46
51
  export {
47
52
  H as useExpandable
@@ -91,6 +91,28 @@ export type BasicDataCodeRegistryItem = {
91
91
  /** 拉取并归一化为 label/value 选项 */
92
92
  fetchOptions: (ctx?: BasicDataFetchContext) => Promise<BasicDataOption[]>;
93
93
  };
94
+ /**
95
+ * 地理层级(数字越大越细)。
96
+ * 更细层级的扁平字段已含上级 code/name,可去重派生上级,避免同页重复请求。
97
+ * 机场 → 城市/国家/区域/洲;城市 → 国家/区域/洲;国家 → 区域/洲;区域 → 洲
98
+ */
99
+ export declare const GEO_LEVEL_CODES: readonly ["continent", "region", "country", "city", "airport"];
100
+ export type GeoLevelCode = (typeof GEO_LEVEL_CODES)[number];
101
+ /** @deprecated 使用 GEO_LEVEL_CODES;保留兼容「从机场可派生」语义 */
102
+ export declare const GEO_CODES_DERIVABLE_FROM_AIRPORT: readonly ["continent", "region", "country", "city"];
103
+ export declare function isGeoLevelCode(code: BasicDataCode): code is GeoLevelCode;
104
+ export declare function isGeoCodeDerivableFromAirport(code: BasicDataCode): boolean;
105
+ /** source 是否可派生 target(source 更细) */
106
+ export declare function canDeriveGeoLevel(source: BasicDataCode, target: BasicDataCode): boolean;
107
+ /**
108
+ * 从任一地理层级 options 去重生成更粗层级 options。
109
+ * 扁平字段已含 continentCode / regionCode / countryCode / cityCode 等。
110
+ */
111
+ export declare function deriveRegionLevelOptionsFromGeoSource(sourceOptions: BasicDataOption[], targetCode: BasicDataCode): BasicDataOption[];
112
+ /** @deprecated 使用 deriveRegionLevelOptionsFromGeoSource */
113
+ export declare function deriveRegionLevelOptionsFromAirports(airports: BasicDataOption[], code: BasicDataCode): BasicDataOption[];
114
+ /** 在候选 code 中取最细的地理层级(机场 > 城市 > 国家 > 区域 > 洲) */
115
+ export declare function resolveHighestGeoLevelCode(codes: Iterable<BasicDataCode>): GeoLevelCode | undefined;
94
116
  /**
95
117
  * code → 接口与默认展示配置。
96
118
  * 后续扩展航线/舱位等,只需在此追加。