wlwy-package 4.0.0-beta.20 → 4.0.0-beta.21

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.
@@ -3,6 +3,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WFormMulti
3
3
  default?: ((props: {
4
4
  form: import("vue").ComputedRef<object>;
5
5
  model: string;
6
+ value: any;
6
7
  }) => any) | undefined;
7
8
  }>;
8
9
  export default _default;
@@ -9,8 +9,8 @@ declare const _default: import("vue").DefineComponent<WInputMatchProps, {}, {},
9
9
  allowClear: boolean;
10
10
  tokenSeparators: string[];
11
11
  labelModel: string;
12
- afterModel: string;
13
12
  labelOptions: WDropdownListItem[];
13
+ afterModel: string;
14
14
  afterOptions: {
15
15
  key: import("../../../../type.ts").KeyType;
16
16
  value: import("../../../../type.ts").KeyType;
@@ -1,5 +1,7 @@
1
1
  export { default as useRenderCell, toFormatCellOptions, resolveLegacyEnumMap, type RenderCellProps, type RenderCellFormatByType, type RenderCellFormatType, type RenderCellLegacyProps } from './src/useRenderCell';
2
2
  export { default as useKey } from './src/useKey';
3
3
  export { default as useFormItemProps } from './src/useFormItemProps';
4
+ export { default as useFormFieldRegister } from './src/useFormFieldRegister';
5
+ export { default as useFormDefaultValue, useMultiItemContext, type UseFormDefaultValueOptions } from './src/useFormDefaultValue';
4
6
  export { default as useFormContext } from './src/useFormContext';
5
7
  export { default as useTabsNav } from './src/useTabsNav';
@@ -0,0 +1,42 @@
1
+ import type { DefaultValueType } from '../../../utils/type';
2
+ /**
3
+ * MultiItem 上下文能力(供表单控件统一使用):
4
+ * - `isInactive()`:处于 `w-form-multi-item` 内且当前不是本 Option
5
+ * - `registerClear()`:注册「切换离开本 Option」时的字段清理(多字段控件用)
6
+ *
7
+ * 不在 MultiItem 内时 `isInactive()` 恒为 false,`registerClear()` 为空实现。
8
+ */
9
+ export declare function useMultiItemContext(): {
10
+ isInactive: () => boolean;
11
+ registerClear: (clear: () => void) => void;
12
+ };
13
+ export type UseFormDefaultValueOptions<T> = {
14
+ /** defaultValue 取值(getter,保证读到最新 props) */
15
+ getDefaultValue: () => DefaultValueType<T> | undefined;
16
+ /** 目标字段是否为空(非 force 场景判定;异步解析完成后会再判一次) */
17
+ isEmpty: () => boolean;
18
+ /** 写入解析结果 */
19
+ write: (resolved: T) => void;
20
+ /**
21
+ * 其余回写:label / after 默认值、未传 defaultValue 时 force 写空值等。
22
+ * 与 defaultValue 回写一样受 MultiItem 守卫保护。
23
+ */
24
+ extra?: (force: boolean) => void;
25
+ /** 是否在挂载时写入默认值,默认 true */
26
+ applyOnMount?: boolean;
27
+ };
28
+ /**
29
+ * 表单默认值 + 搜索重置统一处理:
30
+ * - 挂载时写入默认值(非 force:仅当字段为空)
31
+ * - 在 `w-list-search` / `w-detail-search` 内注册重置回调(force:强制回写)
32
+ * - 处于 `w-form-multi-item` 内且非当前选中项时跳过回写(含异步 defaultValue 解析完成后,
33
+ * 避免 Search 清空又被 default-value 钩子写回)
34
+ *
35
+ * @see WSearchRegisterResetKey
36
+ * @see FormMultiItemContextKey
37
+ */
38
+ export declare function useFormDefaultValue<T>(options: UseFormDefaultValueOptions<T>): {
39
+ applyDefaultValue: (force?: boolean) => void;
40
+ isInactive: () => boolean;
41
+ };
42
+ export default useFormDefaultValue;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 向最近的搜索区(`w-search` / `w-list-search` / `w-detail-search`)上报本控件占用的 form 字段名。
3
+ *
4
+ * - 传入 getter(而非快照),字段名随 props 变化时无需重新注册
5
+ * - 不在搜索区内时为空实现,对详情 / 编辑等场景无副作用
6
+ * - 挂载时注册、卸载时取消;`w-form-multi-item` 下未激活的 Option 不挂载故不上报,
7
+ * 其字段由 MultiItem 自身上报全部 `option.model` 兜底
8
+ *
9
+ * @param getKeys 返回本控件占用的 form 字段名(如 `[model, startKey, endKey, labelModel]`)
10
+ * @see WSearchRegisterFieldKey
11
+ */
12
+ export declare function useFormFieldRegister(getKeys: () => string[]): void;
13
+ export default useFormFieldRegister;
@@ -7,6 +7,19 @@ export declare const WIconSizeKey: InjectionKey<NonNullable<WIconProp['size']>>;
7
7
  /** WSearch 重置时回调注册(如 DateRange 回写 defaultValue;可异步) */
8
8
  export type WSearchRegisterReset = (fn: () => void | Promise<void>) => () => void;
9
9
  export declare const WSearchRegisterResetKey: InjectionKey<WSearchRegisterReset>;
10
+ /**
11
+ * WSearch 字段注册(表单控件自报本控件占用的 form 字段名)。
12
+ * 传入 getter(而非快照),字段名随 props 变化时无需重新注册。
13
+ */
14
+ export type WSearchRegisterField = (getKeys: () => string[]) => () => void;
15
+ export declare const WSearchRegisterFieldKey: InjectionKey<WSearchRegisterField>;
16
+ /** WSearch 字段注册域:首行(main)/ 折叠区(more) */
17
+ export type WSearchFieldScope = 'main' | 'more';
18
+ /** WSearch 内部字段注册表(供内部作用域组件切换注册域) */
19
+ export interface WSearchFieldRegistry {
20
+ add: (getKeys: () => string[], scope: WSearchFieldScope) => () => void;
21
+ }
22
+ export declare const WSearchFieldRegistryKey: InjectionKey<WSearchFieldRegistry>;
10
23
  /**
11
24
  * w-form-multi-item 已注册的 option 快照(由 WFormMultiItemOption 上报)
12
25
  */