@dazhicheng/ui 1.6.26 → 1.6.28

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,5 +1,6 @@
1
1
  import { getAllBasicAirline as O, getDictItemsByCodes as R, listChainByTypeAirportRegionLevel as A } from "../api/basicData.js";
2
- import { queryAllRoles as L, pageUser as I } from "../api/dataTypeContext.js";
2
+ import { queryAllRoles as L } from "../api/dataTypeContext.js";
3
+ import { fetchUserListOnce as I } from "./userListCache.js";
3
4
  import { secondaryDropdownListLossReason as T, primaryDropdownListLossReason as C } from "../api/lossReason.js";
4
5
  import { listAllSupplierPurchase as P, listAllValidSupplierManage as _, getAllConfigListSupplierConfigManage as h } from "../api/supplier.js";
5
6
  const o = {
@@ -56,7 +57,7 @@ const o = {
56
57
  REFUND: "退票",
57
58
  REBOOK: "改签"
58
59
  };
59
- function J(a, e) {
60
+ function Q(a, e) {
60
61
  if (!Array.isArray(a) || !a.length) return a || [];
61
62
  if (e === d.PINYIN || e === d.NONE) return a;
62
63
  const l = b[e];
@@ -77,7 +78,7 @@ function J(a, e) {
77
78
  n.get(i).children.push(u);
78
79
  }), s.map((u) => n.get(u));
79
80
  }
80
- function Q(a) {
81
+ function X(a) {
81
82
  const e = /* @__PURE__ */ new Map();
82
83
  return (Array.isArray(a) ? a : []).forEach((l) => {
83
84
  const n = l.purchaseInfo || l, s = (n == null ? void 0 : n.supplierSubType) ?? "其他";
@@ -89,7 +90,7 @@ function Q(a) {
89
90
  }, e.set(s, r)), r.children.push(l);
90
91
  }), Array.from(e.values());
91
92
  }
92
- function X(a, e) {
93
+ function Z(a, e) {
93
94
  return e || (a === o.CONTINENT ? d.NONE : a === o.AIRPORT || a === o.CITY ? d.COUNTRY : a === o.COUNTRY || a === o.REGION ? d.CONTINENT : a === o.LOSS_REASON ? d.BUSINESS_TYPE : a === o.LOSS_REASON_SECONDARY ? d.PRIMARY_REASON : a === o.SUPPLIER_CONFIG ? d.SUPPLIER_MANAGE_NAME : d.PINYIN);
94
95
  }
95
96
  const v = {
@@ -155,10 +156,10 @@ o.CONTINENT, o.REGION, o.COUNTRY, o.CITY;
155
156
  function N(a) {
156
157
  return U.includes(a);
157
158
  }
158
- function Z(a, e) {
159
+ function ee(a, e) {
159
160
  return !N(a) || !N(e) ? !1 : y[a] > y[e];
160
161
  }
161
- function ee(a, e) {
162
+ function ae(a, e) {
162
163
  if (!N(e)) return [];
163
164
  const { codeKey: l, nameKey: n } = F[e], s = /* @__PURE__ */ new Map();
164
165
  return (Array.isArray(a) ? a : []).forEach((r) => {
@@ -172,7 +173,7 @@ function ee(a, e) {
172
173
  });
173
174
  }), Array.from(s.values());
174
175
  }
175
- function ae(a) {
176
+ function re(a) {
176
177
  let e;
177
178
  for (const l of a)
178
179
  N(l) && (!e || y[l] > y[e]) && (e = l);
@@ -231,14 +232,14 @@ function S(a, e = D) {
231
232
  }
232
233
  };
233
234
  }
234
- function x(a = []) {
235
+ function m(a = []) {
235
236
  return (Array.isArray(a) ? a : []).filter((e) => (e == null ? void 0 : e.id) !== void 0 && (e == null ? void 0 : e.id) !== null).map((e) => ({
236
237
  ...e,
237
238
  label: e.fullName || e.username || String(e.id),
238
239
  value: e.id
239
240
  }));
240
241
  }
241
- function m(a = []) {
242
+ function x(a = []) {
242
243
  return (Array.isArray(a) ? a : []).filter((e) => (e == null ? void 0 : e.id) !== void 0 && (e == null ? void 0 : e.id) !== null).map((e) => ({
243
244
  ...e,
244
245
  label: e.roleName || e.roleCode || String(e.id),
@@ -293,7 +294,7 @@ function H(a = []) {
293
294
  }
294
295
  }));
295
296
  }
296
- const re = {
297
+ const le = {
297
298
  [o.AIRLINE]: {
298
299
  defaultFieldName: "airlineCodes",
299
300
  defaultLabel: "航司",
@@ -386,8 +387,8 @@ const re = {
386
387
  defaultShowAll: !1,
387
388
  async fetchOptions() {
388
389
  try {
389
- const a = await I({ pageNo: 1, pageSize: 9999 });
390
- return x((a == null ? void 0 : a.records) || []);
390
+ const a = await I();
391
+ return m(a);
391
392
  } catch {
392
393
  return [];
393
394
  }
@@ -402,7 +403,7 @@ const re = {
402
403
  async fetchOptions() {
403
404
  try {
404
405
  const a = await L();
405
- return m(a || []);
406
+ return x(a || []);
406
407
  } catch {
407
408
  return [];
408
409
  }
@@ -492,14 +493,14 @@ const re = {
492
493
  };
493
494
  export {
494
495
  o as CODES,
495
- re as CODE_REGISTRY,
496
+ le as CODE_REGISTRY,
496
497
  U as GEO_LEVEL_CODES,
497
498
  d as GROUP_BY,
498
- Z as canDeriveGeoLevel,
499
- ee as deriveRegionLevelOptionsFromGeoSource,
500
- J as groupBasicDataOptions,
501
- Q as groupPurchasePlaceOptions,
499
+ ee as canDeriveGeoLevel,
500
+ ae as deriveRegionLevelOptionsFromGeoSource,
501
+ Q as groupBasicDataOptions,
502
+ X as groupPurchasePlaceOptions,
502
503
  N as isGeoLevelCode,
503
- X as resolveDefaultGroupBy,
504
- ae as resolveHighestGeoLevelCode
504
+ Z as resolveDefaultGroupBy,
505
+ re as resolveHighestGeoLevelCode
505
506
  };
@@ -1,26 +1,39 @@
1
1
  import { MaybeRef, Ref } from 'vue';
2
- export type BudinessDataType = "platformId" | "shopId" | "purchasePlaceId" | "businessType" | "lockUserId" | "userId";
2
+ /** 数据权限维度的 code 标识,对应平台、店铺、采购地、业务类型、锁单人、用户 */
3
+ export type BusinessDataType = "platformId" | "shopId" | "purchasePlaceId" | "businessType" | "lockUserId" | "userId";
4
+ /** 下拉选项条目,label 和 value 由 toNormalizedOptions 从原始字段映射而来 */
3
5
  export type DataPermissionOptionItem = Record<string, any> & {
4
6
  label?: string;
5
7
  value?: string | number;
6
8
  };
7
- export type DataPermissionOptionsMap = Partial<Record<BudinessDataType, DataPermissionOptionItem[]>>;
8
- export interface UseBudinessDataOptions {
9
- codes: BudinessDataType[];
9
+ /** code 到选项列表的映射,Partial 因为不一定每个 code 都有数据 */
10
+ export type DataPermissionOptionsMap = Partial<Record<BusinessDataType, DataPermissionOptionItem[]>>;
11
+ /** useDataPermissionOptions 的入参 */
12
+ export interface UseBusinessDataOptions {
13
+ /** 需要获取的数据权限维度 */
14
+ codes: BusinessDataType[];
15
+ /** 外部数据源,传入后优先使用,不走接口请求,不回写共享缓存 */
10
16
  dataSource?: MaybeRef<DataPermissionOptionsMap | undefined>;
11
- showAll?: boolean | Partial<Record<BudinessDataType, boolean>>;
17
+ /** 是否在选项列表头部插入「全部」选项。传 boolean 对所有 code 生效,传对象可按 code 单独控制 */
18
+ showAll?: boolean | Partial<Record<BusinessDataType, boolean>>;
12
19
  }
13
20
  /**
21
+ * 获取当前用户的数据权限下拉选项(平台 / 店铺 / 采购地 / 业务类型 / 锁单人 / 用户)。
14
22
  *
23
+ * 同路由多个实例共享缓存,microtask 合并同 tick 请求,pending 去重跨 tick 请求。
24
+ * 返回的 dataSource 是只读 Proxy,访问未声明的 code 返回空数组,赋值会报错。
25
+ *
26
+ * @param options 配置项
27
+ * @returns dataSource — 响应式选项数据源;reload — 清空当前路由缓存并重新请求
15
28
  * @example
16
29
  * ```ts
17
30
  * const { dataSource } = useDataPermissionOptions({
18
- * codes:['userId','shopId]
19
- * })
20
- *
21
- * dataSource.value.userId
31
+ * codes: ["userId", "shopId"],
32
+ * });
33
+ * dataSource.value.userId // [{ label: "张三", value: 1 }, ...]
34
+ * ```
22
35
  */
23
- export declare function useDataPermissionOptions(options: UseBudinessDataOptions): {
24
- dataSource: Ref<Record<BudinessDataType, DataPermissionOptionItem[]>>;
36
+ export declare function useDataPermissionOptions(options: UseBusinessDataOptions): {
37
+ dataSource: Ref<Record<BusinessDataType, DataPermissionOptionItem[]>>;
25
38
  reload: () => Promise<void>;
26
39
  };
@@ -1,146 +1,103 @@
1
- import { queryDataPermissionDetailDataTypeContext as j } from "../api/dataTypeContext.js";
2
- import { fetchUserListOnce as k, clearUserListCache as B } from "./userListCache.js";
3
- import { ref as F, watchEffect as W, unref as U, computed as G } from "vue";
4
- import { useOwnerRoutePath as H } from "./useOwnerRoutePath.js";
5
- const u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), J = "all", Q = { label: "全部", value: J }, b = /* @__PURE__ */ new WeakMap(), X = {
1
+ import { queryDataPermissionDetailDataTypeContext as M } from "../api/dataTypeContext.js";
2
+ import { fetchUserListOnce as N, clearUserListCache as R } from "./userListCache.js";
3
+ import { computed as O, unref as S, ref as A } from "vue";
4
+ import { useOwnerRoutePath as D } from "./useOwnerRoutePath.js";
5
+ const F = { label: "全部", value: "all" }, T = {
6
6
  platformId: ["platformName", "platformId"],
7
7
  shopId: ["shopName", "shopId"],
8
8
  purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
9
9
  businessType: ["itemName", "itemCode"],
10
10
  lockUserId: ["userName", "userId"],
11
11
  userId: ["fullName", "id"]
12
- };
13
- function Y(n, a = []) {
14
- const i = b.get(a) || /* @__PURE__ */ new Map(), o = i.get(n);
15
- if (o) return o.slice();
16
- const [y, S] = X[n], m = a.map((h) => {
17
- const c = n === "purchasePlaceId" ? h.purchaseInfo || {} : h;
18
- return {
19
- ...h,
20
- label: c == null ? void 0 : c[y],
21
- value: c == null ? void 0 : c[S]
22
- };
12
+ }, f = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap();
13
+ function v(e) {
14
+ let s = y.get(e);
15
+ return s || (s = A(0), y.set(e, s)), s;
16
+ }
17
+ function q(e) {
18
+ v(e).value++;
19
+ }
20
+ function x(e, s = []) {
21
+ let o = I.get(s);
22
+ o || (o = /* @__PURE__ */ new Map(), I.set(s, o));
23
+ const a = o.get(e);
24
+ if (a) return a.slice();
25
+ const [l, r] = T[e], c = s.map((t) => {
26
+ const n = e === "purchasePlaceId" ? t.purchaseInfo || {} : t;
27
+ return { ...t, label: n[l], value: n[r] };
23
28
  });
24
- return i.set(n, m), b.set(a, i), m.slice();
29
+ return o.set(e, c), c.slice();
25
30
  }
26
- function re(n) {
27
- const a = H(), i = F({});
28
- function o(t = {}) {
29
- i.value = n.codes.reduce(
30
- (e, r) => (e[r] = Y(r, t[r]), e),
31
- {}
32
- );
33
- }
34
- function y(t) {
35
- var e;
36
- return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
37
- }
38
- function S() {
39
- p.clear(), f.clear(), u.clear(), d.clear(), I.clear(), B();
31
+ async function L(e) {
32
+ const s = e.filter((t) => t !== "userId"), o = e.includes("userId"), [a, l] = await Promise.allSettled([
33
+ s.length ? M({ dataTypeName: s }).then(
34
+ (t) => t
35
+ ) : Promise.resolve([]),
36
+ o ? N() : Promise.resolve(void 0)
37
+ ]), r = {};
38
+ if (a.status === "fulfilled") {
39
+ for (const t of s)
40
+ r[t] = [];
41
+ for (const t of a.value) {
42
+ const n = t == null ? void 0 : t.dataTypeCode;
43
+ n && (r[n] = t.originalItems || []);
44
+ }
40
45
  }
41
- function m(t) {
42
- u.delete(t), d.delete(t), f.delete(t);
46
+ const c = l.status === "fulfilled" ? l.value : void 0;
47
+ return c != null && c.length && (r.userId = c), r;
48
+ }
49
+ async function C(e, s = !1) {
50
+ const o = d.get(e);
51
+ o && await o;
52
+ const a = f.get(e) ?? {}, l = [...h.get(e) ?? []], r = s ? l : l.filter((n) => !Object.hasOwn(a, n));
53
+ if (!r.length) return;
54
+ const c = p.get(e) ?? 0, t = (async () => {
55
+ const n = await L(r);
56
+ if ((p.get(e) ?? 0) !== c) return;
57
+ const m = { ...f.get(e) ?? {}, ...n };
58
+ f.set(e, m), q(e);
59
+ })();
60
+ d.set(e, t);
61
+ try {
62
+ await t;
63
+ } finally {
64
+ d.get(e) === t && d.delete(e);
43
65
  }
44
- function h(t) {
45
- const e = d.get(t) || /* @__PURE__ */ new Set(), r = e.size;
46
- n.codes.forEach((l) => e.add(l)), d.set(t, e), e.size !== r && A(t);
66
+ }
67
+ function U(e) {
68
+ g.has(e) || (g.add(e), Promise.resolve().then(() => {
69
+ g.delete(e), C(e);
70
+ }));
71
+ }
72
+ function E(e) {
73
+ const s = D(), o = v(s), a = h.get(s) ?? /* @__PURE__ */ new Set();
74
+ e.codes.forEach((t) => a.add(t)), h.set(s, a), U(s);
75
+ function l(t) {
76
+ var n;
77
+ return typeof e.showAll == "boolean" ? e.showAll : ((n = e.showAll) == null ? void 0 : n[t]) ?? !1;
47
78
  }
48
- async function c(t = !1) {
49
- const e = a, r = U(n.dataSource);
50
- if (r) {
51
- o({ ...u.get(e) || {}, ...r });
52
- return;
79
+ const r = O(() => {
80
+ o.value;
81
+ const t = S(e.dataSource), n = f.get(s) ?? {}, w = t ? { ...n, ...t } : n, m = {};
82
+ for (const i of e.codes) {
83
+ const u = x(i, w[i]);
84
+ m[i] = l(i) ? [F, ...u] : u;
53
85
  }
54
- const l = /* @__PURE__ */ new Set(), V = 32;
55
- for (let L = 0; L < V; L++) {
56
- const v = u.get(e) || {}, M = [...d.get(e) || n.codes], g = t ? M : M.filter((s) => !Object.prototype.hasOwnProperty.call(v, s));
57
- if (t = !1, !g.length) {
58
- o(v);
59
- return;
60
- }
61
- const N = p.get(e);
62
- if (N) {
63
- await N;
64
- continue;
65
- }
66
- if (g.every((s) => l.has(s))) {
67
- o(v);
68
- return;
69
- }
70
- g.forEach((s) => l.add(s));
71
- const x = g.filter((s) => s !== "userId"), _ = g.includes("userId"), D = Promise.allSettled([
72
- x.length ? j({ dataTypeName: x }).then(
73
- (s) => s
74
- ) : Promise.resolve([]),
75
- _ ? k() : Promise.resolve(void 0)
76
- ]).then(([s, q]) => {
77
- const w = s.status === "fulfilled" ? s.value : [], C = q.status === "fulfilled" ? q.value : void 0;
78
- return {
79
- ...C != null && C.length ? { userId: C } : {},
80
- ...w.reduce((O, P) => {
81
- const T = P == null ? void 0 : P.dataTypeCode;
82
- return T && (O[T] = P.originalItems || []), O;
83
- }, {})
84
- };
85
- }), R = (I.get(e) || 0) + 1;
86
- I.set(e, R), p.set(e, D);
87
- try {
88
- const s = await D;
89
- if (I.get(e) !== R) continue;
90
- const w = { ...u.get(e) || {}, ...s };
91
- u.set(e, w), o(w);
92
- } finally {
93
- p.get(e) === D && p.delete(e);
86
+ return new Proxy(m, {
87
+ get(i, u, b) {
88
+ return typeof u == "symbol" ? Reflect.get(i, u, b) : i[u] ?? [];
89
+ },
90
+ set(i, u) {
91
+ return !0;
94
92
  }
95
- }
96
- o(u.get(e) || {});
97
- }
98
- async function E() {
99
- const t = a, e = new Set(d.get(t) || n.codes);
100
- S(), m(t), d.set(t, e), await c(!0);
101
- }
102
- function A(t) {
103
- const e = f.get(t);
104
- if (e) return e;
105
- const r = Promise.resolve().then(() => c());
106
- return f.set(t, r), r.finally(() => {
107
- f.get(t) === r && f.delete(t);
108
- }), r;
109
- }
110
- W(() => {
111
- const t = U(n.dataSource);
112
- t && o({ ...u.get(a) || {}, ...t });
93
+ });
113
94
  });
114
- function z(t) {
115
- o(u.get(t));
95
+ async function c() {
96
+ const t = (p.get(s) ?? 0) + 1;
97
+ p.set(s, t), f.delete(s), d.delete(s), R(), await C(s, !0);
116
98
  }
117
- return h(a), A(a).then(() => z(a)), {
118
- /**
119
- * 数据源
120
- */
121
- dataSource: G(() => {
122
- const t = n.codes.reduce(
123
- (e, r) => {
124
- const l = i.value[r] || [];
125
- return e[r] = y(r) ? [Q, ...l] : l, e;
126
- },
127
- {}
128
- );
129
- return new Proxy(t, {
130
- get(e, r) {
131
- return typeof r != "string" ? [] : t[r] || [];
132
- },
133
- set() {
134
- return !1;
135
- }
136
- });
137
- }),
138
- /**
139
- * @description 清空所有缓存,重新请求
140
- */
141
- reload: E
142
- };
99
+ return { dataSource: r, reload: c };
143
100
  }
144
101
  export {
145
- re as useDataPermissionOptions
102
+ E as useDataPermissionOptions
146
103
  };
@@ -1,8 +1,12 @@
1
1
  import { TtFormSchema } from '../components/tt-form';
2
2
  import { Recordable } from '../../../utils/src';
3
3
  import { MaybeRef, Ref } from 'vue';
4
- import { BudinessDataType, DataPermissionOptionsMap } from './useDataPermissionOptions';
5
- type DataType = Exclude<BudinessDataType, "userId">;
4
+ import { BusinessDataType, DataPermissionOptionsMap } from './useDataPermissionOptions';
5
+ /**
6
+ * 参与表单联动的业务数据类型(平台、店铺、采购地、业务线、锁单人)。
7
+ * 排除 userId(用户数据独立拉取,不参与通用联动构建)。
8
+ */
9
+ type DataType = Exclude<BusinessDataType, "userId">;
6
10
  /**
7
11
  * 表单使用场景。
8
12
  *
@@ -11,7 +15,13 @@ type DataType = Exclude<BudinessDataType, "userId">;
11
15
  * 且店铺默认值设为 showAllField ?? 'all'。
12
16
  */
13
17
  export type FormScene = "list" | "action";
18
+ /**
19
+ * 透传给字段组件的 props 类型,支持静态对象或根据当前表单状态计算的函数。
20
+ */
14
21
  type FieldComponentProps = Recordable | ((values: Recordable, actions: any, options: SelectOption[]) => Recordable);
22
+ /**
23
+ * 针对单个数据类型字段的 schema 覆盖与扩展配置。
24
+ */
15
25
  type FieldSchemaConfig = Partial<TtFormSchema> & UseFormSchemasLinkFieldConfig;
16
26
  /**
17
27
  * 字段 onChange 回调上下文。
@@ -40,8 +50,9 @@ export interface FieldOnChangeContext {
40
50
  * 组件 props、校验规则、依赖关系和追加 onChange 行为。
41
51
  */
42
52
  export interface UseFormSchemasLinkFieldConfig {
43
- /** 字段组件,默认使用 TtApiComponent 包装 ElSelectV2 */
53
+ /** 字段组件,默认使用 TtApiComponent 包装 ElSelectV2 或 TtPanelSelect */
44
54
  component?: TtFormSchema["component"];
55
+ /** 是否支持多选,默认为 true */
45
56
  multiple?: boolean;
46
57
  /** 透传给字段组件的 props;传函数时会在渲染时接收表单值、操作对象和当前选项 */
47
58
  componentProps?: FieldComponentProps;
@@ -54,19 +65,22 @@ export interface UseFormSchemasLinkFieldConfig {
54
65
  /** “全部”选项的值,默认为 "all"。用于自定义“全部”选项对应的 value,与 TtPanelSelect 的 showAllField 对齐 */
55
66
  showAllField?: string | number;
56
67
  /**
57
- * @description 自定义过滤数据源
58
- * @param values 表单对象
59
- * @param options 下拉数据源(完整的)
68
+ * 自定义过滤数据源
69
+ * @param values - 当前表单值对象
70
+ * @param options - 完整的下拉数据源
71
+ * @returns 过滤后的下拉数据源
60
72
  */
61
73
  customOptions?: (values: Recordable, options: SelectOption[]) => SelectOption[];
62
74
  }
63
75
  /**
64
- * useFormSchemasLink 的批量配置
76
+ * useFormSchemasLink 的批量配置选项。
65
77
  * 可以通过 fromOptions(options) 一次性传入,也可以使用 builder 链式方法逐项配置。
66
78
  */
67
79
  export interface UseFormSchemasLinkOptions {
68
80
  /** 表单场景,默认 list */
69
81
  scene?: FormScene;
82
+ /** 字段路径前缀,用于嵌套对象或数组行(如 "condition" 或 "tableData[0]") */
83
+ basePath?: string;
70
84
  /** 外部数据源。未传时会按 codes 调用 queryDataPermissionDetailDataTypeContext。 */
71
85
  dataSource?: MaybeRef<DataPermissionOptionsMap | undefined>;
72
86
  /** 字段级配置,key 为 DataType */
@@ -75,7 +89,7 @@ export interface UseFormSchemasLinkOptions {
75
89
  schemas?: Partial<Record<DataType, FieldSchemaConfig>>;
76
90
  }
77
91
  /**
78
- * ElSelectV2 消费的统一选项结构。
92
+ * 下拉组件消费的统一选项结构。
79
93
  */
80
94
  export type SelectOption = Recordable & {
81
95
  /** 展示文案 */
@@ -86,11 +100,21 @@ export type SelectOption = Recordable & {
86
100
  platformId?: string | number;
87
101
  };
88
102
  /**
89
- * 返回值会包含每个 DataType 对应的 TtFormSchema,以及当前已归一化的下拉数据源。
103
+ * useFormSchemasLink 构建结果,包含各数据维度的 TtFormSchema、归一化数据源及数组行 schema 工厂函数。
90
104
  */
91
105
  type UseFormSchemasLinkResult = Record<DataType, TtFormSchema> & {
92
- dataSource: Ref<Record<BudinessDataType, SelectOption[]>>;
106
+ /** 响应式数据源对象 */
107
+ dataSource: Ref<Record<BusinessDataType, SelectOption[]>>;
108
+ /**
109
+ * 为指定行路径(如 tableData[0])生成对应行 schema 映射,共享同一个数据源与配置
110
+ * @param itemPath - 行路径或嵌套前缀
111
+ * @returns 对应行的字段 schema 映射
112
+ */
113
+ createRowSchemas: (itemPath: string) => Record<DataType, TtFormSchema>;
93
114
  };
115
+ /**
116
+ * useFormSchemasLink 的链式配置构建器。
117
+ */
94
118
  type FormSchemasLinkBuilder = {
95
119
  /** 设置为查询筛选场景 */
96
120
  list(): FormSchemasLinkBuilder;
@@ -98,13 +122,22 @@ type FormSchemasLinkBuilder = {
98
122
  action(): FormSchemasLinkBuilder;
99
123
  /** 设置表单场景 */
100
124
  scene(scene: FormScene): FormSchemasLinkBuilder;
125
+ /** 设置路径前缀,支持嵌套对象或数组行路径(如 "items[0]" 或 "query") */
126
+ basePath(basePath: string): FormSchemasLinkBuilder;
101
127
  /** 指定需要请求和构建的字段类型,默认包含全部 DataType */
102
- codes(codes: BudinessDataType[]): FormSchemasLinkBuilder;
128
+ codes(codes: BusinessDataType[]): FormSchemasLinkBuilder;
103
129
  /** 使用外部数据源,跳过内部接口请求 */
104
130
  dataSource(dataSource: MaybeRef<DataPermissionOptionsMap | undefined>): FormSchemasLinkBuilder;
105
131
  /** 覆盖单个字段配置 */
106
132
  field(dataType: DataType, config: FieldSchemaConfig): FormSchemasLinkBuilder;
133
+ /** 构建顶层 schemas 与数据源 */
107
134
  build(): UseFormSchemasLinkResult;
135
+ /**
136
+ * 为数组子行或嵌套路径生成 schemas,复用当前数据源与配置
137
+ * @param itemPath - 行或嵌套路径,例如 "tableData[0]"
138
+ * @returns 对应行的字段 schema 映射
139
+ */
140
+ createRowSchemas(itemPath: string): Record<DataType, TtFormSchema>;
108
141
  };
109
142
  /**
110
143
  * 构建数据权限相关的表单联动 schema。
@@ -116,10 +149,11 @@ type FormSchemasLinkBuilder = {
116
149
  * - 平台变更时清空店铺值,并按平台过滤店铺选项
117
150
  * - 多选字段支持“全部”互斥选择逻辑
118
151
  * - action 场景下平台为“全部”或多平台时禁用店铺并取消必填
152
+ * - 支持深层嵌套字段(如 a.b.c)与数组行(arraySchema)
119
153
  *
120
154
  * @example
121
155
  * ```ts
122
- * const { platformId, shopId, businessType } = useFormSchemasLink()
156
+ * const { platformId, shopId, businessType, createRowSchemas } = useFormSchemasLink()
123
157
  * .list()
124
158
  * .codes(["platformId", "shopId", "businessType"])
125
159
  * .field("platformId", {
@@ -133,6 +167,8 @@ type FormSchemasLinkBuilder = {
133
167
  *
134
168
  * const schemas = [platformId, shopId, businessType];
135
169
  * ```
170
+ *
171
+ * @returns FormSchemasLinkBuilder 链式构建器
136
172
  */
137
173
  export declare function useFormSchemasLink(): FormSchemasLinkBuilder;
138
174
  export {};