@aplus-frontend/ui 0.0.20 → 0.0.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.
- package/es/src/ap-form/hooks/use-watch.d.ts +2 -2
- package/es/src/ap-list/interface.d.ts +67 -0
- package/es/src/ap-list/style/index.css +6 -0
- package/es/src/ap-table/ap-table.vue.mjs +123 -113
- package/es/src/ap-table/interface.d.ts +6 -4
- package/es/src/ap-table/style/ap-table.css +19 -0
- package/es/src/ap-table/utils.d.ts +826 -670
- package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -25
- package/es/src/editable-table/hooks/use-get-columns.mjs +47 -45
- package/es/src/editable-table/interface.d.ts +6 -1
- package/es/src/editable-table/style/index.css +3 -0
- package/es/src/theme/ap-list/index.css +6 -0
- package/es/src/theme/ap-table/ap-table.css +19 -0
- package/es/src/theme/editable-table/index.css +3 -0
- package/lib/src/ap-form/hooks/use-watch.d.ts +2 -2
- package/lib/src/ap-list/interface.d.ts +67 -0
- package/lib/src/ap-list/style/index.css +6 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +6 -4
- package/lib/src/ap-table/style/ap-table.css +19 -0
- package/lib/src/ap-table/utils.d.ts +826 -670
- package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -25
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/interface.d.ts +6 -1
- package/lib/src/editable-table/style/index.css +3 -0
- package/lib/src/theme/ap-list/index.css +6 -0
- package/lib/src/theme/ap-table/ap-table.css +19 -0
- package/lib/src/theme/editable-table/index.css +3 -0
- package/package.json +1 -1
|
@@ -1,28 +1,6 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
1
2
|
import { EditableTableFormItemProps, EditableTableProps } from '../interface';
|
|
2
|
-
import {
|
|
3
|
-
import { TableColumnType } from 'ant-design-vue';
|
|
4
|
-
import { ValueEnum } from '../..';
|
|
3
|
+
import { ColumnType } from 'ant-design-vue/es/table';
|
|
5
4
|
|
|
6
|
-
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<
|
|
7
|
-
children?: (Omit< TableColumnType<any>, "children" | "customRender"> & any) | undefined;
|
|
8
|
-
tooltip?: string | undefined;
|
|
9
|
-
copyable?: boolean | undefined;
|
|
10
|
-
editable?: boolean | ((text: any, record: any, index: number) => boolean) | undefined;
|
|
11
|
-
valueEnum?: ValueEnum | undefined;
|
|
12
|
-
customRenderFormItem?: ((config: Omit< TableColumnType<any>, "children" | "customRender"> & any) => any) | undefined;
|
|
13
|
-
valueType?: any;
|
|
14
|
-
fieldProps?: any;
|
|
15
|
-
customRender?: ((opt: {
|
|
16
|
-
value: any;
|
|
17
|
-
text: any;
|
|
18
|
-
record: any;
|
|
19
|
-
index: number;
|
|
20
|
-
renderIndex: number;
|
|
21
|
-
column: TableColumnType<any>;
|
|
22
|
-
editable?: boolean | undefined;
|
|
23
|
-
originalNode?: VNode<RendererNode, RendererElement, {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
}> | undefined;
|
|
26
|
-
}) => any) | undefined;
|
|
27
|
-
})[]>;
|
|
5
|
+
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<ColumnType<any>[]>;
|
|
28
6
|
export default useGetColumns;
|
|
@@ -1,78 +1,80 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { isFunction as C } from "lodash-unified";
|
|
3
|
-
import { getEditableComponent as
|
|
4
|
-
import { updateFormProps as
|
|
1
|
+
import { computed as y, createVNode as i, mergeProps as x } from "vue";
|
|
2
|
+
import { omit as h, isFunction as C, isBoolean as F } from "lodash-unified";
|
|
3
|
+
import { getEditableComponent as R } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as T, getFieldProps as I, getPlaceholder as N, getTableRenderProps as L } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { apTableRenderItemMap as
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { useLocale as
|
|
9
|
-
const
|
|
6
|
+
import { apTableRenderItemMap as M, noRenderAsFormItemValueList as V } from "../../ap-table/constants.mjs";
|
|
7
|
+
import { Typography as w } from "ant-design-vue";
|
|
8
|
+
import { useLocale as A } from "../../config-provider/hooks/use-locale.mjs";
|
|
9
|
+
const q = (t) => {
|
|
10
10
|
const {
|
|
11
|
-
t:
|
|
12
|
-
} =
|
|
13
|
-
let o =
|
|
11
|
+
t: u
|
|
12
|
+
} = A(), f = y(() => {
|
|
13
|
+
let o = t.columns;
|
|
14
14
|
return o ? (o = o.map((e) => ({
|
|
15
|
-
...e,
|
|
15
|
+
...h(e, ["ellipsis"]),
|
|
16
16
|
customRender({
|
|
17
|
-
value:
|
|
18
|
-
...
|
|
17
|
+
value: n,
|
|
18
|
+
...a
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
value:
|
|
25
|
-
...
|
|
26
|
-
})),
|
|
27
|
-
|
|
20
|
+
const c = C(e.editable) ? e.editable(a.text, a.record, a.index) : !!e.editable;
|
|
21
|
+
let r;
|
|
22
|
+
if (c) {
|
|
23
|
+
const d = R(e.valueType), l = T(e, I(e.fieldProps, {
|
|
24
|
+
value: n,
|
|
25
|
+
...a
|
|
26
|
+
})), s = {};
|
|
27
|
+
t.onFieldChange && (s[`onUpdate:${l.valuePropName || "value"}`] = (g) => {
|
|
28
28
|
var p;
|
|
29
|
-
return (p =
|
|
29
|
+
return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, g);
|
|
30
30
|
});
|
|
31
31
|
const b = {
|
|
32
|
-
name: [
|
|
33
|
-
...
|
|
32
|
+
name: [t.name, a.index, e.dataIndex],
|
|
33
|
+
...l || {},
|
|
34
34
|
// 格式化placeholder
|
|
35
|
-
placeholder:
|
|
35
|
+
placeholder: N(u, e.valueType, l == null ? void 0 : l.placeholder),
|
|
36
36
|
field: {
|
|
37
37
|
style: "width: 100%",
|
|
38
|
-
...(
|
|
39
|
-
...
|
|
38
|
+
...(l == null ? void 0 : l.field) || {},
|
|
39
|
+
...s
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
r = i(d, b, null);
|
|
43
43
|
} else {
|
|
44
|
-
const
|
|
45
|
-
value:
|
|
46
|
-
...
|
|
44
|
+
const d = M[e.valueType], l = L(e, {
|
|
45
|
+
value: n,
|
|
46
|
+
...a
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
r = m(e, n, i(d, x(l, {
|
|
49
49
|
mode: "read"
|
|
50
50
|
}), null));
|
|
51
51
|
}
|
|
52
52
|
return e.customRender ? e.customRender({
|
|
53
|
-
value:
|
|
54
|
-
...
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) : d;
|
|
53
|
+
value: n,
|
|
54
|
+
...a,
|
|
55
|
+
editable: c,
|
|
56
|
+
originalNode: r
|
|
57
|
+
}) : r;
|
|
59
58
|
}
|
|
60
59
|
})), o) : [];
|
|
61
60
|
});
|
|
62
|
-
function m(o, e,
|
|
63
|
-
return
|
|
61
|
+
function m(o, e, n) {
|
|
62
|
+
return V.includes(o.valueType) ? n : o.copyable || o.ellipsis ? i(w.Paragraph, {
|
|
64
63
|
copyable: o.copyable ? {
|
|
65
64
|
text: e,
|
|
66
65
|
tooltip: !1
|
|
67
66
|
} : !1,
|
|
68
|
-
ellipsis: o.ellipsis ? {
|
|
67
|
+
ellipsis: o.ellipsis ? F(o.ellipsis) ? {
|
|
68
|
+
tooltip: e
|
|
69
|
+
} : {
|
|
70
|
+
...o.ellipsis,
|
|
69
71
|
tooltip: e
|
|
70
72
|
} : !1,
|
|
71
|
-
content:
|
|
72
|
-
}, null) :
|
|
73
|
+
content: o.ellipsis ? e : n
|
|
74
|
+
}, null) : n;
|
|
73
75
|
}
|
|
74
76
|
return f;
|
|
75
77
|
};
|
|
76
78
|
export {
|
|
77
|
-
|
|
79
|
+
q as default
|
|
78
80
|
};
|
|
@@ -4,8 +4,9 @@ import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
|
4
4
|
import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
|
|
5
5
|
import { FormItemProps } from 'ant-design-vue';
|
|
6
6
|
import { VNode } from 'vue';
|
|
7
|
+
import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
7
8
|
|
|
8
|
-
export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender'> & {
|
|
9
|
+
export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
9
10
|
children?: EditableColumnType<RecordType, ValueType>;
|
|
10
11
|
/**
|
|
11
12
|
* 在title之后展示一个icon并触发tooltip
|
|
@@ -15,6 +16,10 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
|
|
|
15
16
|
* 是否可以复制(不可编辑模式下可用)
|
|
16
17
|
*/
|
|
17
18
|
copyable?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 是否省略自动溢出,自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等
|
|
21
|
+
*/
|
|
22
|
+
ellipsis?: boolean | EllipsisConfig;
|
|
18
23
|
/**
|
|
19
24
|
* 是否可编辑
|
|
20
25
|
*/
|
|
@@ -85,3 +85,22 @@
|
|
|
85
85
|
.aplus-ap-table .ant-table-small .ant-table-placeholder .ant-table-cell {
|
|
86
86
|
padding: 0 !important;
|
|
87
87
|
}
|
|
88
|
+
.aplus-ap-table .ant-table-column-sorters {
|
|
89
|
+
justify-content: unset;
|
|
90
|
+
}
|
|
91
|
+
.aplus-ap-table .ant-table-column-sorters .ant-table-column-title {
|
|
92
|
+
flex: unset;
|
|
93
|
+
}
|
|
94
|
+
.aplus-ap-table .ant-table-filter-column {
|
|
95
|
+
justify-content: unset;
|
|
96
|
+
}
|
|
97
|
+
.aplus-ap-table .ant-table-filter-column .ant-table-column-title {
|
|
98
|
+
flex: unset;
|
|
99
|
+
}
|
|
100
|
+
.aplus-ap-table .ant-table-filter-column .ant-table-filter-trigger {
|
|
101
|
+
margin-left: 2px;
|
|
102
|
+
padding-left: 2px;
|
|
103
|
+
}
|
|
104
|
+
.aplus-ap-table .ant-table-cell .ant-typography {
|
|
105
|
+
margin-bottom: 0;
|
|
106
|
+
}
|
|
@@ -2,6 +2,6 @@ import { NamePath } from 'ant-design-vue/es/form/interface';
|
|
|
2
2
|
import { ApFormExpose } from '../interface';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
|
|
5
|
-
type ApFormIns = ApFormExpose
|
|
6
|
-
declare const useWatch: <ValueType = any>(name: NamePath, form?: Ref<ApFormIns | undefined>) => Ref<ValueType | undefined>;
|
|
5
|
+
type ApFormIns<T> = ApFormExpose<T>;
|
|
6
|
+
declare const useWatch: <ValueType = any>(name: NamePath, form?: Ref<ApFormIns<ValueType> | undefined> | undefined) => Ref<ValueType | undefined>;
|
|
7
7
|
export default useWatch;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
import { RequestData } from '../ap-table';
|
|
3
|
+
import { Recordable } from '../type';
|
|
4
|
+
|
|
5
|
+
export type ApListProps<RecordType = any, ParamsType = Recordable> = {
|
|
6
|
+
/**
|
|
7
|
+
* 列表数据源,传入后`request`和`defaultData`都将失效
|
|
8
|
+
*/
|
|
9
|
+
dataSource?: RecordType[];
|
|
10
|
+
/**
|
|
11
|
+
* 是否是加载中
|
|
12
|
+
*/
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 当点击列表项时触发
|
|
16
|
+
* @deprecated 暂未实现
|
|
17
|
+
*/
|
|
18
|
+
onItem?: (record: RecordType, index: number) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 依赖的额外的参数(该参数变更不会触发网络请求)
|
|
21
|
+
*/
|
|
22
|
+
params?: ParamsType;
|
|
23
|
+
/**
|
|
24
|
+
* 请求数据
|
|
25
|
+
* @param params
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
request?: (params: Partial<ParamsType> & {
|
|
29
|
+
pageSize?: number;
|
|
30
|
+
current?: number;
|
|
31
|
+
}) => Promise<Partial<RequestData<RecordType>>>;
|
|
32
|
+
/**
|
|
33
|
+
* 表格的默认数据源,这些数据源将会在第一次请求后被替换
|
|
34
|
+
*/
|
|
35
|
+
defaultData?: RecordType[];
|
|
36
|
+
/**
|
|
37
|
+
* 表格loading状态变更后触发
|
|
38
|
+
* @param loading
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
onLoadingChange?: (loading: boolean) => void;
|
|
42
|
+
/**
|
|
43
|
+
* 查询表单提交之前,一般用于自定义对查询数据进行变更
|
|
44
|
+
* @param params
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
beforeSearchSubmit?: (params: Partial<ParamsType>) => any;
|
|
48
|
+
/**
|
|
49
|
+
* 是否显示分页器(特定的分页器)或者指定默认的当前页和pageSize
|
|
50
|
+
*/
|
|
51
|
+
pagination?: false | {
|
|
52
|
+
defaultCurrent?: number;
|
|
53
|
+
defaultPageSize?: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* 是否手动发起第一次网络请求
|
|
57
|
+
*/
|
|
58
|
+
manual?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* List容器的自定义样式
|
|
61
|
+
*/
|
|
62
|
+
containerStyle?: CSSProperties;
|
|
63
|
+
/**
|
|
64
|
+
* 底部分页器容器的样式
|
|
65
|
+
*/
|
|
66
|
+
footerWarpperStyle?: CSSProperties;
|
|
67
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("ant-design-vue"),W=require("ant-design-vue/es/theme/internal"),A=require("../ap-form/index.js"),c=require("./constants.js");require("../config-provider/index.js");const U=require("./hooks/use-table-paging.js"),u=require("lodash-unified");require("./style/ap-table.css");const H=require("@ant-design/icons-vue"),s=require("./utils.js"),K=require("./hooks/use-table-content-height.js"),$=require("../config-provider/hooks/use-locale.js"),G=require("../config-provider/hooks/use-namespace.js"),Q=require("../config-provider/hooks/use-global-config.js"),J={key:0},X=e.defineComponent({name:"ApTable",__name:"ap-table",props:{dropdownPrefixCls:{},loading:{type:[Boolean,Object],default:void 0},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},card:{type:Boolean,default:!1},params:{},searchFormRender:{},request:{},onLoad:{},defaultData:{},dataSource:{},onLoadingChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},manual:{type:Boolean,default:!1},size:{default:"middle"},adaptive:{type:Boolean,default:!1}},setup(R,{expose:T}){const n=R,C=e.useSlots(),[,B]=W.useToken(),{t:P}=$.useLocale(),{e:p,b:d}=G.useNamespace("ap-table"),k=Q.useGlobalConfig("uiMode","aplus"),{height:v,contentRef:I}=K.default(),f=e.computed(()=>{var r;let a=((r=n.columns)==null?void 0:r.filter(t=>!t.hideInTable))||[];return a=a.map(t=>({...u.omit(s.apColumnToColumn(t),["ellipsis"]),customRender({value:o,...l}){const y=s.getTableRenderType(t),w=c.apTableRenderItemMap[y],M=s.getTableRenderProps(t,{value:o,...l});let b=D(t,o,e.createVNode(w,e.mergeProps(M,{mode:"read"}),null));return t.customRender&&(b=t.customRender({value:o,...l,column:t,originalNode:b})),b}})),a}),S=e.computed(()=>{var a,r,t;return((t=(r=(a=n.columns)==null?void 0:a.filter(o=>!o.hideInSearch&&o.dataIndex&&(o.valueType||o.customRenderFormItem)&&!c.noRenderAsFormItemValueList.includes(o.valueType)))==null?void 0:r.sort((o,l)=>{let y=s.getColumnOrder(o.order);return s.getColumnOrder(l.order)-y}))==null?void 0:t.map(o=>{const l=s.updateFormProps(o,s.getFieldProps(o.fieldProps,{}));return{...o,fieldProps:{label:o.title,name:o.dataIndex,...l||{},placeholder:s.getPlaceholder(P,o.valueType,l==null?void 0:l.placeholder)}}}))||[]}),q=e.computed(()=>e.unref(f).filter(a=>a.sorter===!0).map(a=>a.dataIndex)),V=e.computed(()=>e.unref(f).filter(a=>a.filters&&!a.onFilter).map(a=>a.dataIndex)),{formRef:m,submit:F,reset:x,tableProps:i,handleTableChange:N,data:g}=U.useTablePaging({async request(a){var t,o;const r=await((t=n.request)==null?void 0:t.call(n,a));return(o=n.onLoad)==null||o.call(n,(r==null?void 0:r.data)||[]),{data:(r==null?void 0:r.data)||[],total:(r==null?void 0:r.total)||0}},filterFields:e.unref(V),sortFields:e.unref(q),defaultParams:n.params,defaultData:n.defaultData,manual:n.manual,defaultCurrent:n.pagination?n.pagination.defaultCurrent:void 0,defaultPageSize:n.pagination?n.pagination.defaultPageSize:void 0,formatParams:n.beforeSearchSubmit}),E=e.computed(()=>{var a;return n.scroll?n.scroll:n.adaptive&&(g.value.total>0||(a=n.dataSource)!=null&&a.length)?{y:e.unref(v),x:"100%"}:{x:!0}}),L=e.computed(()=>{var a;if(n.tableLayout)return n.tableLayout;if((a=n.columns)!=null&&a.some(r=>r.ellipsis))return"fixed"}),z=e.computed(()=>{const a=e.unref(i),r=u.isUndefined(n.dataSource)?a:{...a,dataSource:n.dataSource,onChange:n.onChange};return{...n,...r,loading:u.isUndefined(n.loading)?e.unref(i).loading:n.loading,pagination:n.pagination===!1?!1:e.unref(i).pagination,scroll:e.unref(E)}}),O=e.computed(()=>[d(),n.card?null:d("wrapper"),n.adaptive?d("adaptive"):null].filter(Boolean));function D(a,r,t){return c.noRenderAsFormItemValueList.includes(a.valueType)?t:a.copyable||a.ellipsis?e.createVNode(h.Typography.Paragraph,{copyable:a.copyable?{text:r,tooltip:!1}:!1,ellipsis:a.ellipsis?u.isBoolean(a.ellipsis)?{tooltip:r}:{...a.ellipsis,tooltip:r}:!1,content:a.ellipsis?r:t},null):t}e.watch(()=>e.unref(g).loading,a=>{var r;(r=n.onLoadingChange)==null||r.call(n,a)});function _(a){var r,t,o;(o=(t=(r=m.value)==null?void 0:r.apForm)==null?void 0:t.setFieldsValue)==null||o.call(t,a)}function j(){var a,r,t;return(t=(r=(a=m.value)==null?void 0:a.apForm)==null?void 0:r.getFieldsValue)==null?void 0:t.call(r,!0)}return T({submit:()=>F(),reset:()=>x(),setSearchFormValues:_,getSearchFormValues:j,dataSource:e.computed(()=>e.unref(g).records)}),(a,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(O.value)},[e.unref(u.isUndefined)(a.dataSource)&&a.searchForm!==!1&&S.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.card?e.unref(p)("search-wrapper"):null),style:e.normalizeStyle(a.searchFormWrapperStyle)},[e.createVNode(e.unref(A.ApForm).SearchForm,e.mergeProps(a.searchForm||{},{ref_key:"formRef",ref:m,"custom-reset":"",onSubmit:e.unref(F),onReset:e.unref(x),"submit-loading":e.unref(i).loading}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,t=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.customRenderFormItem?t.customRenderFormItem(t):e.unref(c.apTableFormItemMap)[t.valueType||"text"]),e.mergeProps({key:t.dataIndex,ref_for:!0},t.fieldProps||{},{span:t.span}),null,16,["span"]))),128))]),_:2},[C.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["onSubmit","onReset","submit-loading"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"contentRef",ref:I,class:e.normalizeClass([e.unref(p)("table-wrapper"),a.card?e.unref(p)("table-wrapper-card"):null]),style:e.normalizeStyle(a.tableWrapperStyle)},[e.renderSlot(a.$slots,"title"),e.createVNode(e.unref(h.Table),e.mergeProps({class:e.unref(k)==="admin"?e.unref(d)("table-admin"):e.unref(d)("table")},z.value,{"table-layout":L.value,onChange:e.unref(N),columns:f.value}),e.createSlots({headerCell:e.withCtx(({column:t,title:o})=>[t.tooltip?(e.openBlock(),e.createElementBlock("span",J,[e.createElementVNode("span",null,e.toDisplayString(o),1),e.createVNode(e.unref(h.Tooltip),{title:t.tooltip,placement:"bottom"},{default:e.withCtx(()=>[e.createVNode(e.unref(H.QuestionCircleOutlined),{style:e.normalizeStyle({paddingLeft:"4px",color:e.unref(B).colorPrimary})},null,8,["style"])]),_:2},1032,["title"])])):e.createCommentVNode("",!0)]),_:2},[e.renderList(e.unref(u.omit)(C,["title","searchFormExtra"]),(t,o)=>({name:o,fn:e.withCtx(l=>[e.renderSlot(a.$slots,o,e.normalizeProps(e.guardReactiveProps(l||{})))])}))]),1040,["class","table-layout","onChange","columns"])],6)],2))}});exports.default=X;
|
|
@@ -6,6 +6,7 @@ import { Recordable } from '../type';
|
|
|
6
6
|
import { ComputedRef, CSSProperties, VNode } from 'vue';
|
|
7
7
|
import { ApActionGroupProps } from '../ap-action';
|
|
8
8
|
import { ApTableIndexProps } from './components/interface';
|
|
9
|
+
import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
9
10
|
|
|
10
11
|
export type ValueEnumType = {
|
|
11
12
|
text: string;
|
|
@@ -56,7 +57,7 @@ export type ApTableValueFields = {
|
|
|
56
57
|
};
|
|
57
58
|
export type ApTableValueTypes = keyof ApTableValueFields;
|
|
58
59
|
export type ValueEnum = Record<string, ValueEnumType>;
|
|
59
|
-
export type ExtraProColumnType<T> = Omit<ColumnType<T>, 'children' | 'filters' | 'customRender'> & {
|
|
60
|
+
export type ExtraProColumnType<T> = Omit<ColumnType<T>, 'children' | 'filters' | 'customRender' | 'ellipsis'> & {
|
|
60
61
|
sorter?: string | boolean | CompareFn<T> | {
|
|
61
62
|
compare?: CompareFn<T>;
|
|
62
63
|
/** Config multiple sorter order priority */
|
|
@@ -77,6 +78,10 @@ export type ApColumnType<RecordType = any, ValueType extends ApTableValueTypes =
|
|
|
77
78
|
* 是否可以复制
|
|
78
79
|
*/
|
|
79
80
|
copyable?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* 是否省略自动溢出,自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等
|
|
83
|
+
*/
|
|
84
|
+
ellipsis?: boolean | EllipsisConfig;
|
|
80
85
|
/**
|
|
81
86
|
* 是否搜索表单中隐藏
|
|
82
87
|
*/
|
|
@@ -248,6 +253,3 @@ export type ApTableExpose<SearchParamsType = Recordable, RecordType = any> = {
|
|
|
248
253
|
*/
|
|
249
254
|
dataSource: ComputedRef<RecordType>;
|
|
250
255
|
};
|
|
251
|
-
export type FixedApColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = Omit<ApColumnType<RecordType, ValueType>, 'filters'> & {
|
|
252
|
-
filters?: ColumnType<RecordType>['filters'];
|
|
253
|
-
};
|
|
@@ -85,3 +85,22 @@
|
|
|
85
85
|
.aplus-ap-table .ant-table-small .ant-table-placeholder .ant-table-cell {
|
|
86
86
|
padding: 0 !important;
|
|
87
87
|
}
|
|
88
|
+
.aplus-ap-table .ant-table-column-sorters {
|
|
89
|
+
justify-content: unset;
|
|
90
|
+
}
|
|
91
|
+
.aplus-ap-table .ant-table-column-sorters .ant-table-column-title {
|
|
92
|
+
flex: unset;
|
|
93
|
+
}
|
|
94
|
+
.aplus-ap-table .ant-table-filter-column {
|
|
95
|
+
justify-content: unset;
|
|
96
|
+
}
|
|
97
|
+
.aplus-ap-table .ant-table-filter-column .ant-table-column-title {
|
|
98
|
+
flex: unset;
|
|
99
|
+
}
|
|
100
|
+
.aplus-ap-table .ant-table-filter-column .ant-table-filter-trigger {
|
|
101
|
+
margin-left: 2px;
|
|
102
|
+
padding-left: 2px;
|
|
103
|
+
}
|
|
104
|
+
.aplus-ap-table .ant-table-cell .ant-typography {
|
|
105
|
+
margin-bottom: 0;
|
|
106
|
+
}
|