wlwy-package 3.2.2 → 4.0.0-beta.1

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.
Files changed (55) hide show
  1. package/dist/editor/index.es.js +1 -1
  2. package/dist/{editor-core-D9MSA0yc.js → editor-core-BuQ0a_wZ.js} +2 -2
  3. package/dist/{index-DbAXWdHe.js → index-CcW4jJHZ.js} +1 -1
  4. package/dist/{index-D4mQXwMj.js → index-DHKUfRSS.js} +189 -17
  5. package/dist/style.css +1 -1
  6. package/dist/types/packages/components/antd/src/datePicker.vue.d.ts +1 -1
  7. package/dist/types/packages/components/common/index.d.ts +0 -3
  8. package/dist/types/packages/components/common/src/page.vue.d.ts +1 -1
  9. package/dist/types/packages/components/common/src/rangePicker.vue.d.ts +1 -1
  10. package/dist/types/packages/components/common/type.d.ts +1 -37
  11. package/dist/types/packages/components/form/default/index.d.ts +1 -7
  12. package/dist/types/packages/components/form/default/src/checkbox.vue.d.ts +1 -0
  13. package/dist/types/packages/components/form/default/src/dateRange.vue.d.ts +1 -0
  14. package/dist/types/packages/components/form/default/src/form.vue.d.ts +1 -0
  15. package/dist/types/packages/components/form/default/src/numberRange.vue.d.ts +1 -0
  16. package/dist/types/packages/components/form/default/src/radio.vue.d.ts +1 -0
  17. package/dist/types/packages/components/form/default/src/select.vue.d.ts +1 -0
  18. package/dist/types/packages/components/form/default/src/selectInput.vue.d.ts +1 -0
  19. package/dist/types/packages/components/form/default/type.d.ts +100 -249
  20. package/dist/types/packages/components/index.d.ts +0 -1
  21. package/dist/types/packages/components/table/constants.d.ts +3 -5
  22. package/dist/types/packages/components/table/index.d.ts +1 -1
  23. package/dist/types/packages/components/table/resolveToolbarButtons.d.ts +16 -0
  24. package/dist/types/packages/components/table/src/search.vue.d.ts +9 -3
  25. package/dist/types/packages/components/table/src/table.vue.d.ts +8 -20
  26. package/dist/types/packages/components/{common/src/editTitle.vue.d.ts → table/src/toolbarButtons.vue.d.ts} +7 -7
  27. package/dist/types/packages/components/table/type.d.ts +101 -15
  28. package/dist/types/packages/components/table/useWTableConfig.d.ts +0 -1
  29. package/dist/types/packages/components/table/warnDeprecated.d.ts +3 -5
  30. package/dist/types/packages/hooks/private/src/useRenderCell.d.ts +6 -4
  31. package/dist/types/packages/hooks/web/index.d.ts +1 -4
  32. package/dist/types/packages/hooks/web/src/useDate.d.ts +65 -0
  33. package/dist/types/packages/keys/index.d.ts +3 -0
  34. package/dist/types/packages/utils/formatCellValue.d.ts +5 -1
  35. package/dist/types/packages/utils/index.d.ts +2 -1
  36. package/dist/types/packages/utils/resolveDefaultValue.d.ts +7 -0
  37. package/dist/types/packages/utils/type.d.ts +7 -0
  38. package/dist/wlwy-package.es.js +2599 -4162
  39. package/package.json +1 -1
  40. package/dist/types/packages/components/common/src/pageHead.vue.d.ts +0 -29
  41. package/dist/types/packages/components/form/default/src/modal.vue.d.ts +0 -46
  42. package/dist/types/packages/components/form/default/src/page.vue.d.ts +0 -48
  43. package/dist/types/packages/components/form/default/src/wrap.vue.d.ts +0 -56
  44. package/dist/types/packages/components/list/index.d.ts +0 -7
  45. package/dist/types/packages/components/list/input.d.ts +0 -432
  46. package/dist/types/packages/components/list/src/header.vue.d.ts +0 -44
  47. package/dist/types/packages/components/list/src/index.vue.d.ts +0 -68
  48. package/dist/types/packages/components/list/src/pager.vue.d.ts +0 -10
  49. package/dist/types/packages/components/list/src/table.vue.d.ts +0 -774
  50. package/dist/types/packages/components/list/type.d.ts +0 -346
  51. package/dist/types/packages/components/table/resolveInjectColumns.d.ts +0 -17
  52. package/dist/types/packages/hooks/web/src/useListConfig.d.ts +0 -16
  53. package/dist/types/packages/hooks/web/src/usePageForm.d.ts +0 -9
  54. package/dist/types/packages/hooks/web/src/usePrefixTitle.d.ts +0 -7
  55. package/dist/types/packages/hooks/web/src/useUpload.d.ts +0 -1
@@ -1,6 +1,6 @@
1
- /** toolbar 专属 prop(旧平铺方式已弃用,请改用 toolbar.xxx) */
2
- export declare const TOOLBAR_ONLY_KEYS: readonly ["toolid", "import", "export", "print", "refresh", "custom", "resizable", "zoom"];
3
- /** pager 专属 prop(旧平铺方式已弃用,请改用 pager.xxx) */
1
+ /** toolbar 专属 prop(仅通过 toolbar.xxx 配置) */
2
+ export declare const TOOLBAR_ONLY_KEYS: readonly ["toolid", "import", "export", "print", "refresh", "custom", "resizable", "zoom", "collapseButtons", "showSelectionSummary"];
3
+ /** pager 专属 prop(仅通过 pager.xxx 配置) */
4
4
  export declare const PAGER_ONLY_KEYS: readonly ["currentPage", "pageSize", "pageSizes", "layouts", "total", "pagerCount", "background", "autoHidden", "transfer", "pageSizePlacement", "iconPrevPage", "iconJumpPrev", "iconJumpNext", "iconNextPage", "iconJumpMore", "iconHomePage", "iconEndPage"];
5
5
  /** 多子组件共享,平铺在 WTable 顶层 */
6
6
  export declare const SHARED_PROP_KEYS: readonly ["loading", "size", "perfect", "border", "align"];
@@ -10,6 +10,4 @@ export declare const TABLE_SHARED_KEYS: readonly ["loading", "border", "align"];
10
10
  export declare const WTABLE_OWN_KEYS: readonly ["data", "showPager", "showCheckbox", "showSeq", "showToolbar", "toolbar", "pager"];
11
11
  /** vxe-table 企业版参数,开源版传入会触发控制台警告 */
12
12
  export declare const VXE_TABLE_PRO_ONLY_KEYS: readonly ["areaConfig", "clipConfig", "fnrConfig"];
13
- /** 旧 slot 名 → 新 slot 名 */
14
- export declare const SLOT_ALIASES: readonly [readonly ["buttons", "toolbar-buttons"], readonly ["tools", "toolbar-tools"], readonly ["left", "pager-left"], readonly ["right", "pager-right"]];
15
13
  export declare const RESERVED_SLOT_NAMES: Set<string>;
@@ -1,4 +1,4 @@
1
- export type { WTableInstance, WTableProps, WTableDeprecatedProps, WTableSlots, WToolbarProps, WToolbarOnlyProps, WPagerProps, WPagerOnlyProps, WPagerInstance, ResetPagerParams, PagerState, WColumnProp, WListSearchProps, WListSearchInstance } from './type';
1
+ export type { WTableInstance, WTableProps, WTableSlots, WToolbarProps, WToolbarOnlyProps, WPagerProps, WPagerOnlyProps, WPagerInstance, ResetPagerParams, PagerState, WColumnProp, WListSearchProps, WListSearchInstance } from './type';
2
2
  export { default as WTable } from './src/table.vue';
3
3
  export { default as WPager } from './src/pager.vue';
4
4
  export { default as WColumn } from './src/column.vue';
@@ -0,0 +1,16 @@
1
+ import { type VNode, type VNodeChild } from 'vue';
2
+ export type ToolbarButtonsRender = {
3
+ mode: 'passthrough';
4
+ } | {
5
+ mode: 'collapse';
6
+ visible: VNode[];
7
+ more: VNode[];
8
+ others: VNode[];
9
+ };
10
+ export declare function flattenVNodes(nodes: VNodeChild): VNode[];
11
+ export declare function isWButtonNode(node: VNode): boolean;
12
+ export declare function resolveToolbarButtons(nodes: VNode[], collapseEnabled: boolean): ToolbarButtonsRender;
13
+ export declare function getWButtonLabel(node: VNode, t: (key: string) => string): string;
14
+ /** 与 WButton 一致:优先 props.icon,否则按 authCode 取权限图标 */
15
+ export declare function getWButtonIcon(node: VNode): string | undefined;
16
+ export declare function triggerVNodeClick(node: VNode): boolean;
@@ -1,16 +1,22 @@
1
1
  import type { WListSearchProps } from '../type';
2
+ type __VLS_Props = WListSearchProps;
2
3
  declare function handleSearch(): void;
3
- declare function handleReset(): void;
4
+ declare function handleReset(): Promise<void>;
4
5
  declare function toggleExpanded(): void;
5
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<WListSearchProps, {
6
+ type __VLS_PublicProps = __VLS_Props & {
7
+ 'form'?: any;
8
+ };
9
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_PublicProps, {
6
10
  getFormInstance: () => import("ant-design-vue").FormInstance | undefined;
7
11
  reset: () => void;
8
12
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
13
  reset: () => any;
10
14
  search: () => any;
11
- }, string, import("vue").PublicProps, Readonly<WListSearchProps> & Readonly<{
15
+ "update:form": (value: any) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
17
  onReset?: (() => any) | undefined;
13
18
  onSearch?: (() => any) | undefined;
19
+ "onUpdate:form"?: ((value: any) => any) | undefined;
14
20
  }>, {
15
21
  loading: boolean;
16
22
  bordered: boolean;
@@ -5,34 +5,22 @@ import type { WPagerInstance, WTableProps } from '../type';
5
5
  type __VLS_Props = WTableProps;
6
6
  declare var __VLS_7: {
7
7
  [x: string]: any;
8
- }, __VLS_9: {
8
+ }, __VLS_12: {
9
9
  [x: string]: any;
10
- }, __VLS_15: {
11
- [x: string]: any;
12
- }, __VLS_17: {
13
- [x: string]: any;
14
- }, __VLS_39: string, __VLS_40: any, __VLS_51: any, __VLS_53: any, __VLS_55: any, __VLS_57: any;
10
+ }, __VLS_34: string, __VLS_35: any, __VLS_46: any, __VLS_48: any;
15
11
  type __VLS_Slots = {} & {
16
- [K in NonNullable<typeof __VLS_39>]?: (props: typeof __VLS_40) => any;
12
+ [K in NonNullable<typeof __VLS_34>]?: (props: typeof __VLS_35) => any;
17
13
  } & {
18
14
  'toolbar-tools'?: (props: typeof __VLS_7) => any;
19
15
  } & {
20
- tools?: (props: typeof __VLS_9) => any;
21
- } & {
22
- 'toolbar-buttons'?: (props: typeof __VLS_15) => any;
23
- } & {
24
- buttons?: (props: typeof __VLS_17) => any;
25
- } & {
26
- 'pager-left'?: (props: typeof __VLS_51) => any;
27
- } & {
28
- left?: (props: typeof __VLS_53) => any;
16
+ 'toolbar-buttons'?: (props: typeof __VLS_12) => any;
29
17
  } & {
30
- 'pager-right'?: (props: typeof __VLS_55) => any;
18
+ 'pager-left'?: (props: typeof __VLS_46) => any;
31
19
  } & {
32
- right?: (props: typeof __VLS_57) => any;
20
+ 'pager-right'?: (props: typeof __VLS_48) => any;
33
21
  };
34
22
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_Props, {
35
- getTableInstance: () => VxeTableInstance | undefined;
23
+ getTableInstance: () => VxeTableInstance<any> | undefined;
36
24
  getToolbarInstance: () => VxeToolbarInstance | undefined;
37
25
  getPagerInstance: () => WPagerInstance | undefined;
38
26
  getPagerState: () => import("../type").PagerState;
@@ -140,7 +128,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_Prop
140
128
  }>;
141
129
  $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions>, {}, {}, "", {}, any> | null;
142
130
  $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions>, {}, {}, "", {}, any> | null;
143
- /** @type {[typeof WPager, typeof WPager, ]} */ $host: Element | null;
131
+ $host: Element | null;
144
132
  $emit: (event: string, ...args: any[]) => void;
145
133
  $el: any;
146
134
  $options: import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> & {
@@ -1,15 +1,15 @@
1
1
  type __VLS_Props = {
2
- title: string;
3
- index?: string | number;
4
- required?: boolean;
2
+ collapseButtons?: boolean;
5
3
  };
6
- declare var __VLS_6: {}, __VLS_8: {};
4
+ declare var __VLS_6: {}, __VLS_44: {};
7
5
  type __VLS_Slots = {} & {
8
- title?: (props: typeof __VLS_6) => any;
6
+ prefix?: (props: typeof __VLS_6) => any;
9
7
  } & {
10
- right?: (props: typeof __VLS_8) => any;
8
+ default?: (props: typeof __VLS_44) => any;
11
9
  };
12
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, __VLS_Slots>;
10
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ collapseButtons: boolean;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, __VLS_Slots>;
13
13
  export default _default;
14
14
  type __VLS_WithSlots<T, S> = T & {
15
15
  new (): {
@@ -7,8 +7,17 @@ import type { Slot } from 'vue';
7
7
  */
8
8
  export interface WToolbarProps extends Omit<VxeToolbarProps, 'id'> {
9
9
  toolid?: string;
10
- /** @deprecated 请改用 WTable 顶层的 `showToolbar` */
11
- hideToolbar?: boolean;
10
+ /**
11
+ * `#toolbar-buttons` 中 `w-button` 超过 4 个时折叠进「更多」
12
+ * @default true
13
+ */
14
+ collapseButtons?: boolean;
15
+ /**
16
+ * 是否在工具栏展示「已选择 x 项 / 共 y 项」
17
+ * 仅在 `showCheckbox` 为 true 时生效
18
+ * @default true
19
+ */
20
+ showSelectionSummary?: boolean;
12
21
  }
13
22
  /** 多子组件共享,平铺在 WTable 顶层 */
14
23
  export type WTableSharedPropKeys = 'loading' | 'size' | 'perfect' | 'border' | 'align';
@@ -26,20 +35,13 @@ export interface WTableProps<Row = any> extends WTableOnlyProps<Row>, Partial<Pi
26
35
  /** 是否显示序号列 @default true */
27
36
  showSeq?: boolean;
28
37
  /**
29
- * 是否显示工具栏,优先级高于 `toolbar.hideToolbar`。
30
- * 若存在 `#toolbar-buttons` / `#toolbar-tools`(或旧 `#buttons` / `#tools`),则以 slot 为准强制显示。
38
+ * 是否显示工具栏。
39
+ * 若存在 `#toolbar-buttons` / `#toolbar-tools`,则以 slot 为准强制显示。
31
40
  */
32
41
  showToolbar?: boolean;
33
42
  toolbar?: Partial<WToolbarOnlyProps>;
34
43
  pager?: Partial<WPagerOnlyProps>;
35
44
  }
36
- /**
37
- * w-table 弃用平铺属性(仍可通过 attrs 传入,请迁移至 toolbar / pager 嵌套对象)
38
- */
39
- export interface WTableDeprecatedProps extends Partial<WToolbarOnlyProps>, Partial<Omit<WPagerOnlyProps, keyof WToolbarOnlyProps>> {
40
- /** @deprecated 请改用 `data` */
41
- dataSource?: unknown[];
42
- }
43
45
  /**
44
46
  * w-table 插槽
45
47
  */
@@ -70,13 +72,97 @@ export type PagerState = {
70
72
  pageSize: number;
71
73
  };
72
74
  /**
73
- * w-table组件示例
75
+ * w-table 组件实例
76
+ *
77
+ * 说明:vxe-table 的 `VxeTableInstance<D>` 未把 `D` 透传到 `TableMethods`,
78
+ * 因此需在此显式覆盖常用返回行数据的方法,使 `Row` 生效。
74
79
  */
75
- export interface WTableInstance extends VxeTableInstance {
80
+ export interface WTableInstance<Row = any> extends VxeTableInstance<Row> {
81
+ /**
82
+ * 获取数据,和 data 的行为一致;也可指定索引获取单行
83
+ */
84
+ getData: {
85
+ (): Row[];
86
+ (rowIndex: number): Row;
87
+ };
88
+ /**
89
+ * 获取当前表格数据
90
+ * - fullData:完整全量表体数据
91
+ * - visibleData:处理条件后的全量表体数据
92
+ * - tableData:当前渲染中的表体数据
93
+ * - footerData:当前渲染中的表尾数据
94
+ */
95
+ getTableData: () => {
96
+ fullData: Row[];
97
+ visibleData: Row[];
98
+ tableData: Row[];
99
+ footerData: Row[][];
100
+ };
101
+ /**
102
+ * 获取表格全量数据;开启 tree-config 时返回带层级的树结构
103
+ */
104
+ getFullData: () => Row[];
105
+ /**
106
+ * 根据行唯一主键获取行
107
+ * @param rowid 行主键
108
+ */
109
+ getRowById: (rowid: string | number | null) => Row | null;
110
+ /**
111
+ * 用于 type=checkbox,获取已选中的行数据
112
+ * @param isFull 为 true 时包含被筛选掉的已选数据
113
+ */
114
+ getCheckboxRecords: (isFull?: boolean) => Row[];
115
+ /**
116
+ * 用于 checkbox-config.reserve,获取已保留选中的行数据(不含当前页已选)
117
+ * @param isFull 为 true 时包含被筛选掉的保留选中数据
118
+ */
119
+ getCheckboxReserveRecords: (isFull?: boolean) => Row[];
120
+ /**
121
+ * 用于 type=checkbox,获取半选状态的行数据
122
+ * @param isFull 为 true 时获取完整半选数据
123
+ */
124
+ getCheckboxIndeterminateRecords: (isFull?: boolean) => Row[];
125
+ /**
126
+ * 用于 type=radio,获取当前已选中的行数据
127
+ * @param isFull 为 true 时获取完整选中数据
128
+ */
129
+ getRadioRecord: (isFull?: boolean) => Row | null;
130
+ /**
131
+ * 用于 radio-config.reserve,获取已保留选中的行数据
132
+ * @param isFull 为 true 时获取完整保留选中数据
133
+ */
134
+ getRadioReserveRecord: (isFull?: boolean) => Row[];
135
+ /**
136
+ * 用于 row-config.isCurrent,获取当前高亮行数据
137
+ */
138
+ getCurrentRecord: () => Row | null;
139
+ /**
140
+ * 获取待删除(pending)状态的行数据
141
+ */
142
+ getPendingRecords: () => Row[];
143
+ /**
144
+ * 用于 expand-config,获取已展开的行数据
145
+ */
146
+ getRowExpandRecords: () => Row[];
147
+ /**
148
+ * 用于 tree-config,获取已展开的树节点
149
+ * 注意:即使父节点被收起,只要该节点仍处于展开状态也能获取到
150
+ */
151
+ getTreeExpandRecords: () => Row[];
152
+ /**
153
+ * 只对 tree-config 有效,获取指定行的子级
154
+ * @param rowOrRowid 行对象或行主键
155
+ */
156
+ getTreeRowChildren: (rowOrRowid: any) => Row[];
157
+ /**
158
+ * 只对 tree-config 有效,获取指定行的父级
159
+ * @param rowOrRowid 行对象或行主键
160
+ */
161
+ getTreeParentRow: (rowOrRowid: any) => Row | null;
76
162
  /**
77
- * 获取表格实例
163
+ * 获取内部 VxeTable 实例
78
164
  */
79
- getTableInstance: () => VxeTableInstance | undefined;
165
+ getTableInstance: () => VxeTableInstance<Row> | undefined;
80
166
  /**
81
167
  * 获取表格工具栏实例
82
168
  */
@@ -2,7 +2,6 @@ import { type ComputedRef, type Slots } from 'vue';
2
2
  import type { WPagerOnlyProps, WTableProps, WToolbarOnlyProps } from './type';
3
3
  export type WTableResolvedConfig = {
4
4
  toolbar: Partial<WToolbarOnlyProps> & {
5
- hideToolbar?: boolean;
6
5
  toolid?: string;
7
6
  };
8
7
  pager: Partial<WPagerOnlyProps>;
@@ -1,6 +1,4 @@
1
- export declare function warnDeprecated(oldKey: string, newPath: string): void;
2
- export declare function warnDeprecatedSlot(oldName: string, newName: string): void;
3
- export declare function warnPropConflict(key: string, namespace: 'toolbar' | 'pager'): void;
4
- export declare function warnShowToolbarConflict(): void;
5
1
  /** toolbar slot 与显式关闭工具栏冲突时,以 slot 为准 */
6
- export declare function warnToolbarSlotConflict(source: 'showToolbar' | 'toolbar.hideToolbar'): void;
2
+ export declare function warnToolbarSlotConflict(): void;
3
+ /** 默认单元格渲染依赖 field 取值,缺失时仅开发环境报错,不阻塞运行 */
4
+ export declare function warnMissingFieldForDefaultCell(title?: string): void;
@@ -14,7 +14,7 @@ export type RenderCellFormatByType = {
14
14
  type: 'datetime';
15
15
  } & TemporalExtra) | ({
16
16
  type: 'number';
17
- } & Pick<FormatCellNumberOptions, 'precision'>) | ({
17
+ } & Pick<FormatCellNumberOptions, 'precision' | 'useGrouping'>) | ({
18
18
  type: 'percent';
19
19
  } & Pick<FormatCellPercentOptions, 'valueScale'>) | ({
20
20
  type: 'boolean';
@@ -26,10 +26,10 @@ export type RenderCellFormatByType = {
26
26
  }) | ({
27
27
  type: 'i18n';
28
28
  } & Pick<FormatCellI18nOptions, 'values'>)
29
- /** @deprecated 请改用 `type: 'number'` 且 `precision: 2` */
30
- | {
29
+ /** 金额:等价于 `number` + 默认 `precision: 2` + 千分位;有 `precision` 时以传入为准 */
30
+ | ({
31
31
  type: 'amount';
32
- };
32
+ } & Pick<FormatCellNumberOptions, 'precision'>);
33
33
  /** @deprecated 旧版平铺 props,由 {@link toFormatCellOptions} 自动映射 */
34
34
  export type RenderCellLegacyProps = {
35
35
  /** @deprecated 请改用 `format` */
@@ -51,6 +51,8 @@ export type RenderCellLegacyProps = {
51
51
  export type RenderCellFormatType = NonNullable<RenderCellFormatByType['type']>;
52
52
  export type RenderCellProps = {
53
53
  field?: FieldPath;
54
+ /** 空值占位符,默认由 {@link formatCellValue} 处理为 `-` */
55
+ emptyPlaceholder?: string;
54
56
  } & RenderCellFormatByType & Partial<RenderCellLegacyProps>;
55
57
  export declare function resolveLegacyEnumMap(props: RenderCellProps, context: {
56
58
  translate: (key: string) => string;
@@ -1,17 +1,14 @@
1
1
  export { default as useCatchPreloadError } from './src/useCatchPreloadError';
2
2
  export { default as useCookie } from './src/useCookie';
3
+ export { default as useDate, type DateInput, type DateRange, type UseDateOptions, type RecentRangeOptions } from './src/useDate';
3
4
  export { default as useEnum } from './src/useEnum';
4
5
  export { default as useExport } from './src/useExport';
5
6
  export * from './src/useI18n';
6
7
  export { default as useFormItemProps } from './src/useFormItemProps';
7
8
  export { default as useFormStorage } from './src/useFormStorage';
8
- export { default as useListConfig } from './src/useListConfig';
9
9
  export { default as useLocale } from './src/useLocale';
10
10
  export { default as useNProgress } from './src/useNProgress';
11
- export { default as usePageForm } from './src/usePageForm';
12
- export { default as usePrefixTitle } from './src/usePrefixTitle';
13
11
  export { default as useTabsNav } from './src/useTabsNav';
14
- export { default as useUpload } from './src/useUpload';
15
12
  export { default as useWatchForm, type UseWatchFormType } from './src/useWatchForm';
16
13
  export { default as useWindowSize } from './src/useWindowSize';
17
14
  export { default as useEmitBack } from './src/useEmitBack';
@@ -0,0 +1,65 @@
1
+ import dayjs, { type ConfigType, type Dayjs, type ManipulateType, type OpUnitType, type QUnitType } from 'dayjs';
2
+ export type DateInput = ConfigType;
3
+ export type DateRange = [Dayjs, Dayjs];
4
+ export type UseDateOptions = {
5
+ /** 默认格式 */
6
+ format?: string;
7
+ /** 相对范围是否包含当前日,默认 true */
8
+ includeCurrent?: boolean;
9
+ };
10
+ export type RecentRangeOptions = {
11
+ includeCurrent?: boolean;
12
+ base?: DateInput;
13
+ };
14
+ export declare const DEFAULT_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
15
+ export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD";
16
+ /**
17
+ * 日期工具 hook
18
+ * - 近 N 天:默认包含今天,共 N 天(如近 7 天 = today-(7-1) ~ today)
19
+ * - 近 N 月 / 近 N 年:往前推 N 个单位,含当前日时再 +1 day(对齐表单预设语义)
20
+ */
21
+ export default function useDate(options?: UseDateOptions): {
22
+ dayjs: typeof dayjs;
23
+ DEFAULT_DATETIME_FORMAT: string;
24
+ DEFAULT_DATE_FORMAT: string;
25
+ toDayjs: (value?: DateInput) => Dayjs;
26
+ format: (value?: DateInput, pattern?: string) => string;
27
+ parse: (value: DateInput, pattern?: string) => Dayjs;
28
+ startOf: (value?: DateInput, unit?: OpUnitType) => Dayjs;
29
+ endOf: (value?: DateInput, unit?: OpUnitType) => Dayjs;
30
+ toTimestamp: (value?: DateInput) => number;
31
+ fromTimestamp: (ms: number) => Dayjs;
32
+ recentRange: (n: number, unit?: ManipulateType, opts?: RecentRangeOptions) => DateRange;
33
+ recentDays: (n: number, opts?: RecentRangeOptions) => DateRange;
34
+ recentMonths: (n: number, opts?: RecentRangeOptions) => DateRange;
35
+ recentYears: (n: number, opts?: RecentRangeOptions) => DateRange;
36
+ presets: {
37
+ last3Days: () => DateRange;
38
+ last7Days: () => DateRange;
39
+ last1Month: () => DateRange;
40
+ last3Months: () => DateRange;
41
+ last6Months: () => DateRange;
42
+ last1Year: () => DateRange;
43
+ last2Years: () => DateRange;
44
+ last3Years: () => DateRange;
45
+ last5Years: () => DateRange;
46
+ last10Years: () => DateRange;
47
+ };
48
+ today: () => DateRange;
49
+ yesterday: () => DateRange;
50
+ thisWeek: () => DateRange;
51
+ lastWeek: () => DateRange;
52
+ thisMonth: () => DateRange;
53
+ lastMonth: () => DateRange;
54
+ thisYear: () => DateRange;
55
+ lastYear: () => DateRange;
56
+ add: (value: DateInput, n: number, unit: ManipulateType) => Dayjs;
57
+ subtract: (value: DateInput, n: number, unit: ManipulateType) => Dayjs;
58
+ diff: (a: DateInput, b: DateInput, unit?: QUnitType | OpUnitType, float?: boolean) => number;
59
+ isBefore: (a: DateInput, b: DateInput, unit?: OpUnitType) => boolean;
60
+ isAfter: (a: DateInput, b: DateInput, unit?: OpUnitType) => boolean;
61
+ isSame: (a: DateInput, b: DateInput, unit?: OpUnitType) => boolean;
62
+ isBetween: (value: DateInput, start: DateInput, end: DateInput, unit?: OpUnitType | null, inclusivity?: '()' | '[]' | '[)' | '(]') => boolean;
63
+ toTimestampRange: (range: DateRange) => [number, number];
64
+ toFormatRange: (range: DateRange, pattern?: string) => [string, string];
65
+ };
@@ -4,3 +4,6 @@ import type { WIconProp } from '../components/icon/type';
4
4
  export declare const WHeaderForm: InjectionKey<ModelRef<Partial<FormProps>>>;
5
5
  /** w-column type="action" 内 w-icon 的默认 size */
6
6
  export declare const WIconSizeKey: InjectionKey<NonNullable<WIconProp['size']>>;
7
+ /** WListSearch 重置时回调注册(如 DateRange 回写 defaultValue;可异步) */
8
+ export type WListSearchRegisterReset = (fn: () => void | Promise<void>) => () => void;
9
+ export declare const WListSearchRegisterResetKey: InjectionKey<WListSearchRegisterReset>;
@@ -20,6 +20,8 @@ export interface FormatCellNumberOptions {
20
20
  type: 'number';
21
21
  /** 小数位数:0 为整数,1 为一位小数,以此类推 */
22
22
  precision?: number;
23
+ /** 是否使用千分位分组;未传则跟随 `Intl.NumberFormat` 默认(通常为 true) */
24
+ useGrouping?: boolean;
23
25
  }
24
26
  export interface FormatCellPercentOptions {
25
27
  type: 'percent';
@@ -78,5 +80,7 @@ export declare function formatCellValueCore(value: unknown, options: FormatCellO
78
80
  /**
79
81
  * 表格/描述列表等场景的单元格格式化:按 `options.type` 输出字符串;
80
82
  * 无法识别为日期/数字等时 **原样字符串化**,不使用 `Invalid Date`。
83
+ *
84
+ * @param emptyPlaceholder 空值占位符,默认 `-`;日期/时间类型额外将 `0` / `'0'` 视为空
81
85
  */
82
- export declare function formatCellValue(value: unknown, options: FormatCellOptions): string;
86
+ export declare function formatCellValue(value: unknown, options: FormatCellOptions, emptyPlaceholder?: string): string;
@@ -1,5 +1,6 @@
1
1
  import type { PickMultipleResult, TargetsType } from './type';
2
- export type { PickMultipleFn } from './type';
2
+ export type { PickMultipleFn, MaybePromise, DefaultValueType } from './type';
3
+ export { resolveDefaultValue, isEmptyFormValue } from './resolveDefaultValue';
3
4
  export { createRefInstanceProxy, type CreateRefInstanceProxyOptions } from './createRefInstanceProxy';
4
5
  export { getTitle } from './getPrefixTitle';
5
6
  export { formatCellValue, formatCellValueCore, normalizeEnumMap, preserveRawCellValue, type FormatCellOptions, type FormatCellEnumMap, type FormatCellEnumEntry, type FormatCellEnumOptionsExtension, type FormatCellTemporalOptions, type FormatCellDateOnlyOptions, type FormatCellTimeOnlyOptions, type FormatCellDateTimeOptions, type FormatCellRawOptions, type FormatCellNumberOptions, type FormatCellPercentOptions, type FormatCellBooleanOptions, type FormatCellEnumOptions, type FormatCellI18nOptions } from './formatCellValue';
@@ -0,0 +1,7 @@
1
+ import type { DefaultValueType } from './type';
2
+ /**
3
+ * 解析 defaultValue:支持静态值、Promise、同步/异步函数
4
+ */
5
+ export declare function resolveDefaultValue<T>(value: DefaultValueType<T> | undefined): Promise<T | undefined>;
6
+ /** 表单字段是否视为空(用于判断是否写入 defaultValue) */
7
+ export declare function isEmptyFormValue(val: unknown): boolean;
@@ -4,3 +4,10 @@ export type PickMultipleResult<T extends object, K extends string> = {
4
4
  [key in ResultKeysType<K>]: Partial<T>;
5
5
  };
6
6
  export type PickMultipleFn = <T extends object, K extends string>(obj: T, targets: TargetsType<T, K>) => PickMultipleResult<T, K>;
7
+ /** T 或 Promise<T> */
8
+ export type MaybePromise<T> = T | Promise<T>;
9
+ /**
10
+ * 表单字段默认值:静态值 | Promise | 同步/异步工厂函数
11
+ * 解析后的结果类型为 T
12
+ */
13
+ export type DefaultValueType<T> = MaybePromise<T> | (() => MaybePromise<T>);