feat: 产物更新,表格列支持冻结(fixed)

- funjiaui.es.js / cjs / umd 重新构建,包含列冻结能力
- UmTable/types.d.ts 新增 TFixed,IFieldMetaValue / IOperateItem 增加 fixed
- UmTable/core/columns.d.ts 新增 hasLeftFixedColumn 等导出
- UmTable/UmTableColumn.vue.d.ts 增加 fixed 属性

用法:数据列 fixed: "left" | "right" | true;
操作列在配置类上写 operateFixed = "right"。默认为不冻结,既有调用方行为不变。
This commit is contained in:
2026-09-23 23:33:54 +08:00
parent f26bd3f377
commit e6c195e6fa
6 changed files with 154 additions and 28 deletions
+8
View File
@@ -27,6 +27,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
type: (NumberConstructor | StringConstructor)[];
required: false;
};
fixed: {
type: null;
required: false;
};
showOverflowTooltip: {
type: BooleanConstructor;
required: false;
@@ -306,6 +310,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
type: (NumberConstructor | StringConstructor)[];
required: false;
};
fixed: {
type: null;
required: false;
};
showOverflowTooltip: {
type: BooleanConstructor;
required: false;
+38 -1
View File
@@ -1,5 +1,5 @@
import type { VNode } from "vue";
import type { IToolbar, TDecoratorKey, TEvent, TOperateType } from "../types";
import type { IToolbar, TDecoratorKey, TEvent, TFixed, TOperateType } from "../types";
import { type IEventTask, type TFireHook } from "./events";
/**
* 列 / 操作列 / 工具栏的装配逻辑。
@@ -10,6 +10,27 @@ import { type IEventTask, type TFireHook } from "./events";
*/
/** 收集数据列 VNode(按 sort 升序) */
export declare const collectDataColumns: (target: any) => VNode[];
/**
* 把配置里写的冻结值规范化成 el-table 认识的形式。
*
* - `true` / `"left"` -> `"left"`(`true` 是历史写法,语义就是左侧)
* - `"right"` -> `"right"`
* - `false` / 其他非法值 -> `undefined`(不冻结,交给诊断模块报出来)
*/
export declare const normalizeFixed: (value: TFixed | undefined) => "left" | "right" | undefined;
/** `fixed` 的合法取值(供诊断模块判断"写错的值") */
export declare const FIXED_VALUES: TFixed[];
/**
* 数据列里是否存在左侧冻结列。
*
* 序号 / 选择 / 展开列是组件自动插到最前面的,它们不在配置类里声明。
* 一旦有数据列冻结到左侧,这三列如果不跟着冻结,就会夹在边缘与冻结列之间,
* 导致后面的冻结列失效(el-table 要求冻结列从边缘起连续)。
* 所以组件用这个函数决定"要不要把前置列一起冻结"。
*/
export declare const hasLeftFixedColumn: (target: any) => boolean;
/** 数据列里是否存在右侧冻结列(用于判断操作列是否该并入右侧冻结组) */
export declare const hasRightFixedColumn: (target: any) => boolean;
/** 操作列分组:同一 id(缺省用 type)的多个方法会聚合到同一个按钮上 */
export interface IOperateGroup {
type: TOperateType;
@@ -37,11 +58,27 @@ export declare const collectOperateGroups: (target: any) => IOperateGroup[];
export declare const resolveShowOperate: (target: any, hasOperate: boolean) => boolean;
/** 解析操作列宽度(支持实例属性与类静态属性两种写法) */
export declare const resolveOperateWidth: (target: any, fallback?: number | string) => number | string;
/**
* 解析操作列的冻结方向。
*
* 与 `operateWidth` 一样,在配置类上声明一个**普通属性**即可(不加装饰器):
* ```ts
* export class Employee {
* operateWidth = 190;
* operateFixed = "right"; // 操作列冻结在右侧
* }
* ```
*
* 默认不冻结 —— 这是新能力,不改变既有表格的行为。
*/
export declare const resolveOperateFixed: (target: any) => "left" | "right" | undefined;
export interface IBuildOperateColumnOptions {
fire: TFireHook;
/** 透传给操作事件的行数据集合 */
tableData?: any[];
width?: number | string;
/** 冻结方向,见 resolveOperateFixed */
fixed?: "left" | "right";
/** 需要延后执行 onAfter 的按钮类型,见 IDeferOptions */
deferAfterTypes?: string[];
}
+17
View File
@@ -15,6 +15,16 @@ import type { Component, VNode } from "vue";
export type TColumnType = "selection" | "index" | "expand" | "operate";
/** 兼容历史命名 */
export type columnType = TColumnType;
/**
* 列的冻结(固定列)方向。
*
* `true` 等价于 `"left"`,`false` / 不传表示不冻结。
*
* 注意冻结列必须**从表格边缘开始连续排列**:`"left"` 的列要排在最前面,
* `"right"` 的列要排在最后面,中间夹一个不冻结的列,后面的冻结列就不会生效。
* 组件会把序号 / 选择 / 展开列自动并入左侧冻结组,但数据列之间的顺序由 `sort` 决定。
*/
export type TFixed = boolean | "left" | "right";
/** 操作列按钮类型 */
export type TOperateType = "edit" | "del" | "copy" | "customOperateEvent";
/**
@@ -79,6 +89,13 @@ export interface IFieldMetaValue {
fieldName?: string;
width?: number;
minWidth?: number;
/**
* 列的冻结方向(固定列)。
*
* 只在数据列(`@TableColumnPropertyDecorator`)上生效;
* 冻结列必须从表格边缘起连续排列,见 `TFixed` 的说明。
*/
fixed?: TFixed;
/** 用于初始化组件数据(级联数据的来源) */
getData?: (currentData?: any) => MaybePromise<any>;
/** 查询表单中所需要的组件类型 */