@antdv-vue/pro-table 0.0.0-stage → 2.0.3
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/CHANGELOG.md +255 -0
- package/README.md +106 -2
- package/dist/InternalTable.d.ts +360 -0
- package/dist/InternalTable.js +444 -0
- package/dist/RenderTypings.d.ts +33 -0
- package/dist/RenderTypings.js +1 -0
- package/dist/ResizableTableTitle.d.ts +24 -0
- package/dist/ResizableTableTitle.js +89 -0
- package/dist/Store/Provide.d.ts +68 -0
- package/dist/Store/Provide.js +132 -0
- package/dist/Table.d.ts +363 -0
- package/dist/Table.js +151 -0
- package/dist/TableRender.d.ts +54 -0
- package/dist/TableRender.js +295 -0
- package/dist/components/Alert/index.d.ts +45 -0
- package/dist/components/Alert/index.js +94 -0
- package/dist/components/Alert/style/index.d.ts +8 -0
- package/dist/components/Alert/style/index.js +11 -0
- package/dist/components/ColumnSetting/CheckboxList.d.ts +24 -0
- package/dist/components/ColumnSetting/CheckboxList.js +138 -0
- package/dist/components/ColumnSetting/CheckboxListItem.d.ts +17 -0
- package/dist/components/ColumnSetting/CheckboxListItem.js +84 -0
- package/dist/components/ColumnSetting/GroupCheckboxList.d.ts +22 -0
- package/dist/components/ColumnSetting/GroupCheckboxList.js +82 -0
- package/dist/components/ColumnSetting/ToolTipIcon.d.ts +12 -0
- package/dist/components/ColumnSetting/ToolTipIcon.js +47 -0
- package/dist/components/ColumnSetting/index.d.ts +26 -0
- package/dist/components/ColumnSetting/index.js +117 -0
- package/dist/components/ColumnSetting/style/index.d.ts +8 -0
- package/dist/components/ColumnSetting/style/index.js +73 -0
- package/dist/components/DragSortTable/index.d.ts +375 -0
- package/dist/components/DragSortTable/index.js +166 -0
- package/dist/components/DragSortTable/style/index.d.ts +8 -0
- package/dist/components/DragSortTable/style/index.js +25 -0
- package/dist/components/Dropdown/Button.d.ts +20 -0
- package/dist/components/Dropdown/Button.js +155 -0
- package/dist/components/Dropdown/index.d.ts +27 -0
- package/dist/components/Dropdown/index.js +149 -0
- package/dist/components/EditableTable/CellEditorTable.d.ts +63 -0
- package/dist/components/EditableTable/CellEditorTable.js +167 -0
- package/dist/components/EditableTable/EditableTable.d.ts +67 -0
- package/dist/components/EditableTable/EditableTable.js +141 -0
- package/dist/components/EditableTable/InternalEditableTable.d.ts +189 -0
- package/dist/components/EditableTable/InternalEditableTable.js +508 -0
- package/dist/components/EditableTable/RowEditorTable.d.ts +63 -0
- package/dist/components/EditableTable/RowEditorTable.js +147 -0
- package/dist/components/EditableTable/context.d.ts +9 -0
- package/dist/components/EditableTable/context.js +11 -0
- package/dist/components/EditableTable/index.d.ts +5 -0
- package/dist/components/EditableTable/index.js +5 -0
- package/dist/components/Form/FormRender.d.ts +77 -0
- package/dist/components/Form/FormRender.js +198 -0
- package/dist/components/Form/index.d.ts +33 -0
- package/dist/components/Form/index.js +91 -0
- package/dist/components/ToolBar/DensityIcon.d.ts +22 -0
- package/dist/components/ToolBar/DensityIcon.js +71 -0
- package/dist/components/ToolBar/FullScreenIcon.d.ts +6 -0
- package/dist/components/ToolBar/FullScreenIcon.js +30 -0
- package/dist/components/ToolBar/HeaderMenu.d.ts +22 -0
- package/dist/components/ToolBar/HeaderMenu.js +84 -0
- package/dist/components/ToolBar/index.d.ts +102 -0
- package/dist/components/ToolBar/index.js +322 -0
- package/dist/components/ToolBar/style/index.d.ts +8 -0
- package/dist/components/ToolBar/style/index.js +116 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/pro-table.esm.js +3274 -0
- package/dist/style/index.d.ts +11 -0
- package/dist/style/index.js +162 -0
- package/dist/typing.d.ts +409 -0
- package/dist/typing.js +1 -0
- package/dist/useFetchData.d.ts +10 -0
- package/dist/useFetchData.js +243 -0
- package/dist/utils/cellRenderToFromItem.d.ts +52 -0
- package/dist/utils/cellRenderToFromItem.js +163 -0
- package/dist/utils/columnRender.d.ts +54 -0
- package/dist/utils/columnRender.js +148 -0
- package/dist/utils/columnSort.d.ts +7 -0
- package/dist/utils/columnSort.js +17 -0
- package/dist/utils/genProColumnsToColumns.d.ts +69 -0
- package/dist/utils/genProColumnsToColumns.js +197 -0
- package/dist/utils/index.d.ts +122 -0
- package/dist/utils/index.js +227 -0
- package/dist/utils/useDragSort.d.ts +182 -0
- package/dist/utils/useDragSort.js +162 -0
- package/package.json +67 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
import { VueNode } from "@v-c/util";
|
|
3
|
+
import { CustomSlotsType } from "@v-c/util/dist/type";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ColumnSetting/CheckboxListItem.d.ts
|
|
6
|
+
interface CheckboxListItemProps {
|
|
7
|
+
columnKey: string | number;
|
|
8
|
+
title?: VueNode;
|
|
9
|
+
fixed?: boolean | 'start' | 'end';
|
|
10
|
+
showListItemOption?: boolean;
|
|
11
|
+
isLeaf?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const CheckboxListItem: _$vue.DefineSetupFnComponent<CheckboxListItemProps, {}, CustomSlotsType<{
|
|
14
|
+
default?: () => VueNode;
|
|
15
|
+
}>, CheckboxListItemProps & {}, _$vue.PublicProps>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CheckboxListItemProps, CheckboxListItem as default };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import ToolTipIcon from "./ToolTipIcon.js";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
|
+
import { useIntl, useProConfig } from "@antdv-vue/pro-provider";
|
|
4
|
+
import { classNames } from "@v-c/util";
|
|
5
|
+
import { VerticalAlignBottomOutlined, VerticalAlignMiddleOutlined, VerticalAlignTopOutlined } from "@antdv-next/icons";
|
|
6
|
+
//#region src/components/ColumnSetting/CheckboxListItem.tsx
|
|
7
|
+
const CheckboxListItem = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
8
|
+
const intl = useIntl();
|
|
9
|
+
const proProvide = useProConfig();
|
|
10
|
+
return () => {
|
|
11
|
+
const { isLeaf, columnKey, fixed, title, showListItemOption } = props;
|
|
12
|
+
return createVNode("span", {
|
|
13
|
+
"class": classNames(`${attrs.class}-list-item`, proProvide.value.hashId),
|
|
14
|
+
"key": columnKey
|
|
15
|
+
}, [createVNode("span", { "class": classNames(`${attrs.class}-list-item-title`, proProvide.value.hashId) }, [title]), showListItemOption && !isLeaf ? createVNode("span", { "class": classNames(`${attrs.class}-list-item-option`, proProvide.value.hashId) }, [
|
|
16
|
+
createVNode(ToolTipIcon, {
|
|
17
|
+
"columnKey": columnKey,
|
|
18
|
+
"fixed": "start",
|
|
19
|
+
"title": intl.value.getMessage({
|
|
20
|
+
id: "tableToolBar.startPin",
|
|
21
|
+
defaultMessage: "固定在列首"
|
|
22
|
+
}),
|
|
23
|
+
"show": props.fixed !== "start"
|
|
24
|
+
}, { default: () => [createVNode(VerticalAlignTopOutlined, null, null)] }),
|
|
25
|
+
createVNode(ToolTipIcon, {
|
|
26
|
+
"columnKey": columnKey,
|
|
27
|
+
"fixed": void 0,
|
|
28
|
+
"title": intl.value.getMessage({
|
|
29
|
+
id: "tableToolBar.noPin",
|
|
30
|
+
defaultMessage: "不固定"
|
|
31
|
+
}),
|
|
32
|
+
"show": !!fixed
|
|
33
|
+
}, { default: () => [createVNode(VerticalAlignMiddleOutlined, null, null)] }),
|
|
34
|
+
createVNode(ToolTipIcon, {
|
|
35
|
+
"columnKey": columnKey,
|
|
36
|
+
"fixed": "end",
|
|
37
|
+
"title": intl.value.getMessage({
|
|
38
|
+
id: "tableToolBar.endPin",
|
|
39
|
+
defaultMessage: "固定在列尾"
|
|
40
|
+
}),
|
|
41
|
+
"show": fixed !== "end"
|
|
42
|
+
}, { default: () => [createVNode(VerticalAlignBottomOutlined, null, null)] })
|
|
43
|
+
]) : null]);
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
props: {
|
|
47
|
+
columnKey: {
|
|
48
|
+
type: [String, Number],
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
title: {
|
|
52
|
+
type: [
|
|
53
|
+
Object,
|
|
54
|
+
Function,
|
|
55
|
+
String,
|
|
56
|
+
Number,
|
|
57
|
+
null,
|
|
58
|
+
Boolean,
|
|
59
|
+
Array
|
|
60
|
+
],
|
|
61
|
+
required: false,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
fixed: {
|
|
65
|
+
type: [Boolean, String],
|
|
66
|
+
required: false,
|
|
67
|
+
default: void 0
|
|
68
|
+
},
|
|
69
|
+
showListItemOption: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
required: false,
|
|
72
|
+
default: void 0
|
|
73
|
+
},
|
|
74
|
+
isLeaf: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
required: false,
|
|
77
|
+
default: void 0
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
name: "CheckboxListItem",
|
|
81
|
+
inheritAttrs: false
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
export { CheckboxListItem as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProColumns } from "../../typing.js";
|
|
2
|
+
import * as _$vue from "vue";
|
|
3
|
+
import { ProFieldValueObjectType, ProFieldValueType } from "@antdv-vue/pro-utils";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ColumnSetting/GroupCheckboxList.d.ts
|
|
6
|
+
interface GroupCheckboxListProps<T, ValueType> {
|
|
7
|
+
draggable?: boolean;
|
|
8
|
+
checkable?: boolean;
|
|
9
|
+
showListItemOption?: boolean;
|
|
10
|
+
columns?: ProColumns<T, ValueType>[];
|
|
11
|
+
listsHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
declare const GroupCheckboxList: new <T extends Record<string, any>, ValueType extends (ProFieldValueType | ProFieldValueObjectType)>(props: GroupCheckboxListProps<T, ValueType> & {} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps) => _$vue.CreateComponentPublicInstanceWithMixins<GroupCheckboxListProps<T, ValueType> & {}, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, _$vue.PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, _$vue.ComponentProvideOptions, {
|
|
14
|
+
P: {};
|
|
15
|
+
B: {};
|
|
16
|
+
D: {};
|
|
17
|
+
C: {};
|
|
18
|
+
M: {};
|
|
19
|
+
Defaults: {};
|
|
20
|
+
}, GroupCheckboxListProps<T, ValueType> & {}, {}, {}, {}, {}, {}>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { GroupCheckboxListProps, GroupCheckboxList as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import CheckboxList from "./CheckboxList.js";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
|
+
import { useIntl, useProConfig } from "@antdv-vue/pro-provider";
|
|
4
|
+
import { classNames } from "@v-c/util";
|
|
5
|
+
//#region src/components/ColumnSetting/GroupCheckboxList.tsx
|
|
6
|
+
const GroupCheckboxList = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
7
|
+
const proProvide = useProConfig();
|
|
8
|
+
const intl = useIntl();
|
|
9
|
+
return () => {
|
|
10
|
+
const { columns, draggable, checkable, showListItemOption, listsHeight } = props;
|
|
11
|
+
const endList = [];
|
|
12
|
+
const startList = [];
|
|
13
|
+
const list = [];
|
|
14
|
+
columns?.forEach((item) => {
|
|
15
|
+
const { fixed, hideInSetting } = item;
|
|
16
|
+
/** 不在 setting 中展示的 */
|
|
17
|
+
if (hideInSetting) return;
|
|
18
|
+
if (fixed === "start") {
|
|
19
|
+
startList.push(item);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (fixed === "end") {
|
|
23
|
+
endList.push(item);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
list.push(item);
|
|
27
|
+
});
|
|
28
|
+
const showRight = endList && endList.length > 0;
|
|
29
|
+
const showLeft = startList && startList.length > 0;
|
|
30
|
+
return createVNode("div", { "class": classNames(`${attrs.class}-list`, proProvide.value.hashId, { [`${attrs.class}-list-group`]: showRight || showLeft }) }, [
|
|
31
|
+
createVNode(CheckboxList, {
|
|
32
|
+
"title": intl.value.getMessage({
|
|
33
|
+
id: "tableToolBar.startFixedTitle",
|
|
34
|
+
defaultMessage: "固定在左侧"
|
|
35
|
+
}),
|
|
36
|
+
"list": startList,
|
|
37
|
+
"class": attrs.class,
|
|
38
|
+
"draggable": draggable,
|
|
39
|
+
"checkable": checkable,
|
|
40
|
+
"showListItemOption": showListItemOption,
|
|
41
|
+
"listsHeight": listsHeight
|
|
42
|
+
}, null),
|
|
43
|
+
createVNode(CheckboxList, {
|
|
44
|
+
"list": list,
|
|
45
|
+
"draggable": draggable,
|
|
46
|
+
"checkable": checkable,
|
|
47
|
+
"showListItemOption": showListItemOption,
|
|
48
|
+
"title": intl.value.getMessage({
|
|
49
|
+
id: "tableToolBar.noFixedTitle",
|
|
50
|
+
defaultMessage: "不固定"
|
|
51
|
+
}),
|
|
52
|
+
"showTitle": showLeft || showRight,
|
|
53
|
+
"class": attrs.class,
|
|
54
|
+
"listsHeight": listsHeight
|
|
55
|
+
}, null),
|
|
56
|
+
createVNode(CheckboxList, {
|
|
57
|
+
"title": intl.value.getMessage({
|
|
58
|
+
id: "tableToolBar.endFixedTitle",
|
|
59
|
+
defaultMessage: "固定在右侧"
|
|
60
|
+
}),
|
|
61
|
+
"list": endList,
|
|
62
|
+
"draggable": draggable,
|
|
63
|
+
"checkable": checkable,
|
|
64
|
+
"showListItemOption": showListItemOption,
|
|
65
|
+
"class": attrs.class,
|
|
66
|
+
"listsHeight": listsHeight
|
|
67
|
+
}, null)
|
|
68
|
+
]);
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
name: "GroupCheckboxList",
|
|
72
|
+
inheritAttrs: false,
|
|
73
|
+
props: [
|
|
74
|
+
"checkable",
|
|
75
|
+
"columns",
|
|
76
|
+
"draggable",
|
|
77
|
+
"listsHeight",
|
|
78
|
+
"showListItemOption"
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
//#endregion
|
|
82
|
+
export { GroupCheckboxList as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ColumnSetting/ToolTipIcon.d.ts
|
|
4
|
+
interface ToolTipIconProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
columnKey?: string | number;
|
|
7
|
+
show?: boolean;
|
|
8
|
+
fixed?: 'start' | 'end';
|
|
9
|
+
}
|
|
10
|
+
declare const ToolTipIcon: _$vue.DefineSetupFnComponent<ToolTipIconProps, {}, {}, ToolTipIconProps & {}, _$vue.PublicProps>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ToolTipIconProps, ToolTipIcon as default };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useTableContextInject } from "../../Store/Provide.js";
|
|
2
|
+
import { createVNode, defineComponent, reactive } from "vue";
|
|
3
|
+
import { Tooltip } from "antdv-next";
|
|
4
|
+
//#region src/components/ColumnSetting/ToolTipIcon.tsx
|
|
5
|
+
const ToolTipIcon = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
6
|
+
const { columnsMap, setColumnsMap } = useTableContextInject();
|
|
7
|
+
return () => {
|
|
8
|
+
if (!props.show) return null;
|
|
9
|
+
return createVNode(Tooltip, { "title": props.title }, { default: () => [createVNode("span", { "onClick": (e) => {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
const config = columnsMap?.value?.[props.columnKey] || {};
|
|
13
|
+
const columnKeyMap = {
|
|
14
|
+
...columnsMap?.value,
|
|
15
|
+
[props.columnKey]: reactive({
|
|
16
|
+
...config,
|
|
17
|
+
fixed: props.fixed
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
setColumnsMap?.(columnKeyMap);
|
|
21
|
+
} }, [slots.default?.()])] });
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
props: {
|
|
25
|
+
title: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
columnKey: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
show: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
required: false,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
fixed: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: false
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
name: "ToolTipIcon",
|
|
44
|
+
inheritAttrs: false
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { ToolTipIcon as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProColumns } from "../../typing.js";
|
|
2
|
+
import * as _$vue from "vue";
|
|
3
|
+
import { ProFieldValueObjectType, ProFieldValueType, VueNode } from "@antdv-vue/pro-utils";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ColumnSetting/index.d.ts
|
|
6
|
+
interface ColumnSettingProps<T, ValueType> {
|
|
7
|
+
prefixCls?: string;
|
|
8
|
+
draggable?: boolean;
|
|
9
|
+
checkable?: boolean;
|
|
10
|
+
showListItemOption?: boolean;
|
|
11
|
+
checkedReset?: boolean;
|
|
12
|
+
listsHeight?: number;
|
|
13
|
+
extra?: VueNode;
|
|
14
|
+
settingIcon?: VueNode;
|
|
15
|
+
columns?: ProColumns<T, ValueType>[];
|
|
16
|
+
}
|
|
17
|
+
declare const ColumnSetting: new <T extends Record<string, any>, U extends Record<string, any>, ValueType extends (ProFieldValueType | ProFieldValueObjectType) = "text">(props: ColumnSettingProps<T, ValueType> & {} & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps) => _$vue.CreateComponentPublicInstanceWithMixins<ColumnSettingProps<T, ValueType> & {}, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, _$vue.PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, _$vue.ComponentProvideOptions, {
|
|
18
|
+
P: {};
|
|
19
|
+
B: {};
|
|
20
|
+
D: {};
|
|
21
|
+
C: {};
|
|
22
|
+
M: {};
|
|
23
|
+
Defaults: {};
|
|
24
|
+
}, ColumnSettingProps<T, ValueType> & {}, {}, {}, {}, {}, {}>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ColumnSettingProps, ColumnSetting as default };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { genColumnKey } from "../../utils/genProColumnsToColumns.js";
|
|
2
|
+
import { useTableContextInject } from "../../Store/Provide.js";
|
|
3
|
+
import GroupCheckboxList from "./GroupCheckboxList.js";
|
|
4
|
+
import style_default from "./style/index.js";
|
|
5
|
+
import { computed, createVNode, defineComponent, isVNode, shallowRef } from "vue";
|
|
6
|
+
import { useIntl } from "@antdv-vue/pro-provider";
|
|
7
|
+
import { useEffect } from "@antdv-vue/pro-utils";
|
|
8
|
+
import { classNames } from "@v-c/util";
|
|
9
|
+
import { useConfig } from "antdv-next/config-provider/context";
|
|
10
|
+
import { Checkbox, Popover, Space, Tooltip } from "antdv-next";
|
|
11
|
+
import { SettingOutlined } from "@antdv-next/icons";
|
|
12
|
+
//#region src/components/ColumnSetting/index.tsx
|
|
13
|
+
function _isSlot(s) {
|
|
14
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
15
|
+
}
|
|
16
|
+
const ColumnSetting = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
17
|
+
const intl = useIntl();
|
|
18
|
+
const config = useConfig();
|
|
19
|
+
const prefixCls = computed(() => props.prefixCls || config.value.getPrefixCls("pro"));
|
|
20
|
+
const baseClassName = computed(() => `${prefixCls.value}-table-column-setting`);
|
|
21
|
+
const [hashId, cssVarCls] = style_default(baseClassName);
|
|
22
|
+
const counter = useTableContextInject();
|
|
23
|
+
const columnRef = shallowRef(null);
|
|
24
|
+
/**
|
|
25
|
+
* 设置全部选中,或全部未选中
|
|
26
|
+
*
|
|
27
|
+
* @param show
|
|
28
|
+
*/
|
|
29
|
+
const setAllSelectAction = (show = true) => {
|
|
30
|
+
const columnKeyMap = {};
|
|
31
|
+
const loopColumns = (columns) => {
|
|
32
|
+
columns?.forEach(({ key, fixed, index, children, disable }) => {
|
|
33
|
+
const columnKey = genColumnKey(key, index);
|
|
34
|
+
if (columnKey) columnKeyMap[columnKey] = {
|
|
35
|
+
show: disable ? counter.columnsMap?.value?.[columnKey]?.show : show,
|
|
36
|
+
fixed,
|
|
37
|
+
disable,
|
|
38
|
+
order: counter.columnsMap?.value?.[columnKey]?.order
|
|
39
|
+
};
|
|
40
|
+
if (children) loopColumns(children);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
loopColumns(props.columns);
|
|
44
|
+
counter.setColumnsMap?.(columnKeyMap);
|
|
45
|
+
};
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (counter.propsRef?.value?.columnsState?.value) columnRef.value = JSON.parse(JSON.stringify(counter.propsRef.value?.columnsState?.value || {}));
|
|
48
|
+
}, [() => counter.propsRef?.value?.columnsState?.value]);
|
|
49
|
+
/** 重置项目 */
|
|
50
|
+
const clearClick = () => {
|
|
51
|
+
counter.clearPersistenceStorage?.();
|
|
52
|
+
counter.setColumnsMap?.(counter.propsRef?.value?.columnsState?.defaultValue || columnRef.value || counter.defaultColumnKeyMap?.value);
|
|
53
|
+
};
|
|
54
|
+
return () => {
|
|
55
|
+
let _slot;
|
|
56
|
+
const { settingIcon, checkable, draggable, checkedReset = true, extra, listsHeight, showListItemOption, columns = [] } = props;
|
|
57
|
+
const unCheckedKeys = Object.values(counter.columnsMap?.value || {}).filter((value) => !value || value.show === false);
|
|
58
|
+
const indeterminate = unCheckedKeys.length > 0 && unCheckedKeys.length !== columns.length;
|
|
59
|
+
return createVNode(Popover, {
|
|
60
|
+
"arrow": false,
|
|
61
|
+
"trigger": "click",
|
|
62
|
+
"placement": "bottomRight",
|
|
63
|
+
"title": createVNode("div", { "class": classNames(`${baseClassName.value}-title`, hashId.value, cssVarCls.value) }, [
|
|
64
|
+
checkable === false ? null : createVNode(Checkbox, {
|
|
65
|
+
"indeterminate": indeterminate,
|
|
66
|
+
"checked": unCheckedKeys.length === 0 && unCheckedKeys.length !== columns.length,
|
|
67
|
+
"onChange": (e) => {
|
|
68
|
+
if (e.target.checked) setAllSelectAction();
|
|
69
|
+
else setAllSelectAction(false);
|
|
70
|
+
}
|
|
71
|
+
}, _isSlot(_slot = intl.value.getMessage({
|
|
72
|
+
id: "tableToolBar.columnDisplay",
|
|
73
|
+
defaultMessage: "列展示"
|
|
74
|
+
})) ? _slot : { default: () => [_slot] }),
|
|
75
|
+
checkedReset ? createVNode("a", {
|
|
76
|
+
"class": classNames(`${baseClassName.value}-action-rest-button`, hashId.value, cssVarCls.value),
|
|
77
|
+
"onClick": clearClick
|
|
78
|
+
}, [intl.value.getMessage({
|
|
79
|
+
id: "tableToolBar.reset",
|
|
80
|
+
defaultMessage: "重置"
|
|
81
|
+
})]) : null,
|
|
82
|
+
!extra ? null : createVNode(Space, {
|
|
83
|
+
"size": 12,
|
|
84
|
+
"align": "center"
|
|
85
|
+
}, _isSlot(extra) ? extra : { default: () => [extra] })
|
|
86
|
+
]),
|
|
87
|
+
"classes": { root: classNames(`${baseClassName.value}-overlay`, hashId.value, cssVarCls.value) },
|
|
88
|
+
"content": createVNode(GroupCheckboxList, {
|
|
89
|
+
"class": baseClassName.value,
|
|
90
|
+
"checkable": checkable ?? true,
|
|
91
|
+
"draggable": draggable ?? true,
|
|
92
|
+
"showListItemOption": showListItemOption ?? true,
|
|
93
|
+
"columns": columns,
|
|
94
|
+
"listsHeight": listsHeight
|
|
95
|
+
}, null)
|
|
96
|
+
}, { default: () => [slots.default?.() || createVNode(Tooltip, { "title": intl.value.getMessage({
|
|
97
|
+
id: "tableToolBar.columnSetting",
|
|
98
|
+
defaultMessage: "列设置"
|
|
99
|
+
}) }, { default: () => [settingIcon ?? createVNode(SettingOutlined, null, null)] })] });
|
|
100
|
+
};
|
|
101
|
+
}, {
|
|
102
|
+
name: "ColumnSetting",
|
|
103
|
+
inheritAttrs: false,
|
|
104
|
+
props: [
|
|
105
|
+
"checkable",
|
|
106
|
+
"checkedReset",
|
|
107
|
+
"columns",
|
|
108
|
+
"draggable",
|
|
109
|
+
"extra",
|
|
110
|
+
"listsHeight",
|
|
111
|
+
"prefixCls",
|
|
112
|
+
"settingIcon",
|
|
113
|
+
"showListItemOption"
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
//#endregion
|
|
117
|
+
export { ColumnSetting as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _$vue from "vue";
|
|
2
|
+
import { ProAliasCssVarToken } from "@antdv-vue/pro-provider";
|
|
3
|
+
|
|
4
|
+
//#region src/components/ColumnSetting/style/index.d.ts
|
|
5
|
+
interface ProTableColumnSettingToken extends ProAliasCssVarToken {}
|
|
6
|
+
declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ProTableColumnSettingToken, _default as default };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useStyle } from "@antdv-vue/pro-provider";
|
|
2
|
+
import { mergeToken } from "@antdv-next/cssinjs";
|
|
3
|
+
//#region src/components/ColumnSetting/style/index.ts
|
|
4
|
+
const genProTableColumnSettingStyle = (token) => {
|
|
5
|
+
return {
|
|
6
|
+
[token.componentCls]: {
|
|
7
|
+
width: "auto",
|
|
8
|
+
"&-title": {
|
|
9
|
+
display: "flex",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
height: 32
|
|
13
|
+
},
|
|
14
|
+
"&-overlay": {
|
|
15
|
+
[`${token.antCls}-popover-inner-content`]: {
|
|
16
|
+
width: 200,
|
|
17
|
+
paddingBlock: 0,
|
|
18
|
+
paddingInline: 0,
|
|
19
|
+
paddingBlockEnd: 8,
|
|
20
|
+
[`${token.antCls}-tree-node-content-wrapper`]: { "&-normal": { "&:hover": { backgroundColor: "transparent" } } }
|
|
21
|
+
},
|
|
22
|
+
[`${token.antCls}-tree-draggable-icon`]: { cursor: "grab" },
|
|
23
|
+
[`${token.antCls}-tree-treenode`]: {
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
"&:hover": { [`${token.componentCls}-list-item-option`]: { display: "block" } },
|
|
26
|
+
[`${token.antCls}-tree-checkbox`]: { marginInlineEnd: 4 },
|
|
27
|
+
[`${token.antCls}-tree-title`]: { width: "100%" }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[`${token.componentCls}-action-rest-button`]: { color: token.colorPrimary },
|
|
32
|
+
[`${token.componentCls}-list`]: {
|
|
33
|
+
display: "flex",
|
|
34
|
+
flexDirection: "column",
|
|
35
|
+
width: "100%",
|
|
36
|
+
paddingBlockStart: 8,
|
|
37
|
+
[`&${token.componentCls}-list-group`]: { paddingBlockStart: 0 },
|
|
38
|
+
"&-title": {
|
|
39
|
+
marginBlockStart: 6,
|
|
40
|
+
marginBlockEnd: 6,
|
|
41
|
+
paddingInlineStart: 24,
|
|
42
|
+
color: token.colorTextSecondary,
|
|
43
|
+
fontSize: 12
|
|
44
|
+
},
|
|
45
|
+
"&-item": {
|
|
46
|
+
display: "flex",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
maxHeight: 24,
|
|
49
|
+
justifyContent: "space-between",
|
|
50
|
+
"&-title": {
|
|
51
|
+
flex: 1,
|
|
52
|
+
maxWidth: 80,
|
|
53
|
+
textOverflow: "ellipsis",
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
wordBreak: "break-all",
|
|
56
|
+
whiteSpace: "nowrap"
|
|
57
|
+
},
|
|
58
|
+
"&-option": {
|
|
59
|
+
display: "none",
|
|
60
|
+
float: "right",
|
|
61
|
+
cursor: "pointer",
|
|
62
|
+
"> span": { "> span.anticon": { color: token.colorPrimary } },
|
|
63
|
+
"> span + span": { marginInlineStart: 4 }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
var style_default = useStyle("ProTableColumnSetting", (token) => {
|
|
70
|
+
return [genProTableColumnSettingStyle(mergeToken(token, {}))];
|
|
71
|
+
});
|
|
72
|
+
//#endregion
|
|
73
|
+
export { style_default as default };
|