@gx-design-vue/pro-table 0.2.0-alpha.2 → 0.2.0-alpha.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/dist/ProTable.d.ts +14 -493
- package/dist/ProTable.js +902 -511
- package/dist/components/Drag/Handle.d.ts +90 -0
- package/dist/components/Drag/Handle.js +64 -0
- package/dist/components/Drag/Tbody.d.ts +17 -0
- package/dist/components/Drag/Tbody.js +27 -0
- package/dist/components/EllipsisText/index.d.ts +50 -0
- package/dist/components/EllipsisText/index.js +65 -0
- package/dist/components/ScrollBar/Bar.d.ts +79 -0
- package/dist/components/ScrollBar/Bar.js +84 -0
- package/dist/components/ScrollBar/Thumb.d.ts +50 -0
- package/dist/components/ScrollBar/{Thumb/index.js → Thumb.js} +67 -58
- package/dist/components/ScrollBar/context.d.ts +3 -4
- package/dist/components/ScrollBar/context.js +3 -5
- package/dist/components/ScrollBar/util.d.ts +6 -5
- package/dist/components/ScrollBar/util.js +1 -14
- package/dist/components/SearchForm/CollapseToggle.d.ts +53 -0
- package/dist/components/SearchForm/CollapseToggle.js +47 -0
- package/dist/components/SearchForm/FormItemContainer.d.ts +73 -0
- package/dist/components/SearchForm/FormItemContainer.js +225 -0
- package/dist/components/SearchForm/FormItemWrapper.d.ts +80 -0
- package/dist/components/SearchForm/FormItemWrapper.js +62 -0
- package/dist/components/SearchForm/SearchForm.d.ts +128 -0
- package/dist/components/SearchForm/SearchForm.js +319 -0
- package/dist/components/SearchForm/index.d.ts +2 -0
- package/dist/components/SearchForm/index.js +2 -0
- package/dist/components/Toolbar/FullscreenIcon.d.ts +24 -0
- package/dist/components/Toolbar/FullscreenIcon.js +22 -0
- package/dist/components/Toolbar/ListToolBar.d.ts +109 -0
- package/dist/components/Toolbar/ListToolBar.js +101 -0
- package/dist/components/Toolbar/index.d.ts +101 -0
- package/dist/components/Toolbar/index.js +101 -0
- package/dist/components/Toolbar/style.d.ts +8 -0
- package/dist/components/{ListToolBar → Toolbar}/style.js +32 -27
- package/dist/context/TableContext.d.ts +15 -27
- package/dist/context/TableContext.js +3 -5
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/useAutoScroll.d.ts +32 -0
- package/dist/hooks/useAutoScroll.js +127 -0
- package/dist/hooks/useBreakpoints.d.ts +13 -0
- package/dist/hooks/useBreakpoints.js +65 -0
- package/dist/hooks/useCellRender.d.ts +13 -0
- package/dist/hooks/useCellRender.js +40 -0
- package/dist/hooks/useColumnResize.d.ts +29 -0
- package/dist/hooks/useColumnResize.js +112 -0
- package/dist/hooks/useColumns.d.ts +35 -24
- package/dist/hooks/useColumns.js +89 -58
- package/dist/hooks/useDragHandleColumn.d.ts +26 -0
- package/dist/hooks/useDragHandleColumn.js +52 -0
- package/dist/hooks/useEllipsis.d.ts +20 -0
- package/dist/hooks/useEllipsis.js +51 -0
- package/dist/hooks/useFetchData.d.ts +42 -65
- package/dist/hooks/useFetchData.js +160 -176
- package/dist/hooks/useFitPage.d.ts +19 -0
- package/dist/hooks/useFitPage.js +90 -0
- package/dist/hooks/useKeepAliveReload.d.ts +21 -0
- package/dist/hooks/useKeepAliveReload.js +24 -0
- package/dist/hooks/useLoading.d.ts +18 -7
- package/dist/hooks/useLoading.js +27 -11
- package/dist/hooks/usePagination.d.ts +10 -7
- package/dist/hooks/usePagination.js +38 -29
- package/dist/hooks/useRequestOptions.d.ts +18 -0
- package/dist/hooks/useRequestOptions.js +39 -0
- package/dist/hooks/useRowDrag.d.ts +42 -0
- package/dist/hooks/useRowDrag.js +268 -0
- package/dist/hooks/useRowSelection.d.ts +27 -15
- package/dist/hooks/useRowSelection.js +93 -80
- package/dist/hooks/useTable.d.ts +35 -77
- package/dist/hooks/useTable.js +76 -49
- package/dist/hooks/useTableForm.d.ts +17 -82
- package/dist/hooks/useTableForm.js +137 -52
- package/dist/hooks/useTableScroll.d.ts +33 -31
- package/dist/hooks/useTableScroll.js +71 -28
- package/dist/hooks/useTableSize.d.ts +17 -7
- package/dist/hooks/useTableSize.js +21 -9
- package/dist/index.d.ts +11 -7
- package/dist/index.js +10 -4
- package/dist/interface.d.ts +537 -0
- package/dist/interface.js +1 -0
- package/dist/pro-table.esm.js +8897 -4012
- package/dist/pro-table.js +4 -1
- package/dist/style/ellipsis.d.ts +13 -0
- package/dist/style/ellipsis.js +16 -0
- package/dist/style/fit-page.d.ts +4 -2
- package/dist/style/fit-page.js +10 -5
- package/dist/style/index.d.ts +3 -7
- package/dist/style/index.js +38 -76
- package/dist/style/list.d.ts +4 -2
- package/dist/style/list.js +2 -12
- package/dist/style/resizable.d.ts +8 -0
- package/dist/style/resizable.js +18 -0
- package/dist/style/row-drag.d.ts +8 -0
- package/dist/style/row-drag.js +44 -0
- package/dist/style/scroll.d.ts +4 -2
- package/dist/style/scroll.js +9 -9
- package/dist/style/search.d.ts +8 -0
- package/dist/{components/Form/style.js → style/search.js} +22 -9
- package/dist/theme/augment.d.ts +8 -0
- package/dist/theme/augment.js +1 -0
- package/dist/theme/interface/components.d.ts +8 -0
- package/dist/theme/interface/components.js +1 -0
- package/dist/utils/arrayMove.d.ts +9 -0
- package/dist/utils/arrayMove.js +15 -0
- package/dist/utils/dateFormat.d.ts +9 -0
- package/dist/utils/dateFormat.js +29 -0
- package/dist/utils/ellipsis.d.ts +19 -0
- package/dist/utils/ellipsis.js +30 -0
- package/dist/utils/flipAnimate.d.ts +25 -0
- package/dist/utils/flipAnimate.js +40 -0
- package/dist/utils/formConstants.d.ts +9 -0
- package/dist/utils/formConstants.js +29 -0
- package/dist/utils/valueFormat.d.ts +9 -0
- package/dist/utils/valueFormat.js +27 -0
- package/package.json +23 -11
- package/dist/components/Form/components/RequestSelect.d.ts +0 -50
- package/dist/components/Form/components/RequestSelect.js +0 -58
- package/dist/components/Form/hooks/useForm.d.ts +0 -11
- package/dist/components/Form/hooks/useForm.js +0 -32
- package/dist/components/Form/index.d.ts +0 -33
- package/dist/components/Form/index.js +0 -479
- package/dist/components/Form/style.d.ts +0 -6
- package/dist/components/Form/utils/config.d.ts +0 -9
- package/dist/components/Form/utils/config.js +0 -30
- package/dist/components/Form/utils/dateFormat.d.ts +0 -22
- package/dist/components/Form/utils/dateFormat.js +0 -45
- package/dist/components/ListToolBar/index.d.ts +0 -60
- package/dist/components/ListToolBar/index.js +0 -123
- package/dist/components/ListToolBar/style.d.ts +0 -6
- package/dist/components/ScrollBar/Bar/index.d.ts +0 -49
- package/dist/components/ScrollBar/Bar/index.js +0 -71
- package/dist/components/ScrollBar/Bar/props.d.ts +0 -25
- package/dist/components/ScrollBar/Bar/props.js +0 -18
- package/dist/components/ScrollBar/Thumb/index.d.ts +0 -40
- package/dist/components/ScrollBar/Thumb/props.d.ts +0 -20
- package/dist/components/ScrollBar/Thumb/props.js +0 -18
- package/dist/components/TableCell/index.d.ts +0 -37
- package/dist/components/TableCell/index.js +0 -72
- package/dist/components/ToolBar/FullscreenIcon.d.ts +0 -7
- package/dist/components/ToolBar/FullscreenIcon.js +0 -14
- package/dist/components/ToolBar/index.d.ts +0 -34
- package/dist/components/ToolBar/index.js +0 -100
- package/dist/hooks/tryOnActivated.d.ts +0 -6
- package/dist/hooks/tryOnActivated.js +0 -14
- package/dist/hooks/useDebounceFn.d.ts +0 -8
- package/dist/hooks/useDebounceFn.js +0 -34
- package/dist/hooks/useScrollArea.d.ts +0 -24
- package/dist/hooks/useScrollArea.js +0 -104
- package/dist/props.d.ts +0 -340
- package/dist/props.js +0 -251
- package/dist/types/ColumnTypings.d.ts +0 -129
- package/dist/types/ColumnTypings.js +0 -1
- package/dist/types/SlotsTypings.d.ts +0 -63
- package/dist/types/SlotsTypings.js +0 -13
- package/dist/types/TableTypings.d.ts +0 -359
- package/dist/types/TableTypings.js +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.js +0 -1
- package/dist/utils/utils.d.ts +0 -10
- package/dist/utils/utils.js +0 -91
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ToolbarPlacement } from "../../interface.js";
|
|
2
|
+
import { PropType, VNode } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Toolbar/ListToolBar.d.ts
|
|
5
|
+
interface ListToolBarSetting {
|
|
6
|
+
icon: VNode;
|
|
7
|
+
tooltip?: string;
|
|
8
|
+
key?: string;
|
|
9
|
+
onClick?: (key?: string) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const ListToolBar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
prefixCls: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
headerTitle: {
|
|
17
|
+
type: any;
|
|
18
|
+
default: any;
|
|
19
|
+
};
|
|
20
|
+
headerTitleTip: {
|
|
21
|
+
type: any;
|
|
22
|
+
default: any;
|
|
23
|
+
};
|
|
24
|
+
titleTipText: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: any;
|
|
27
|
+
};
|
|
28
|
+
settings: {
|
|
29
|
+
type: PropType<VNode[]>;
|
|
30
|
+
default: () => any[];
|
|
31
|
+
};
|
|
32
|
+
actions: {
|
|
33
|
+
type: PropType<VNode[]>;
|
|
34
|
+
default: () => any[];
|
|
35
|
+
};
|
|
36
|
+
actionsPlacement: {
|
|
37
|
+
type: PropType<ToolbarPlacement>;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
listToolAfter: {
|
|
41
|
+
type: any;
|
|
42
|
+
default: any;
|
|
43
|
+
};
|
|
44
|
+
proClasses: {
|
|
45
|
+
type: ObjectConstructor;
|
|
46
|
+
default: () => {};
|
|
47
|
+
};
|
|
48
|
+
proStyles: {
|
|
49
|
+
type: ObjectConstructor;
|
|
50
|
+
default: () => {};
|
|
51
|
+
};
|
|
52
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
prefixCls: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
headerTitle: {
|
|
58
|
+
type: any;
|
|
59
|
+
default: any;
|
|
60
|
+
};
|
|
61
|
+
headerTitleTip: {
|
|
62
|
+
type: any;
|
|
63
|
+
default: any;
|
|
64
|
+
};
|
|
65
|
+
titleTipText: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
default: any;
|
|
68
|
+
};
|
|
69
|
+
settings: {
|
|
70
|
+
type: PropType<VNode[]>;
|
|
71
|
+
default: () => any[];
|
|
72
|
+
};
|
|
73
|
+
actions: {
|
|
74
|
+
type: PropType<VNode[]>;
|
|
75
|
+
default: () => any[];
|
|
76
|
+
};
|
|
77
|
+
actionsPlacement: {
|
|
78
|
+
type: PropType<ToolbarPlacement>;
|
|
79
|
+
default: string;
|
|
80
|
+
};
|
|
81
|
+
listToolAfter: {
|
|
82
|
+
type: any;
|
|
83
|
+
default: any;
|
|
84
|
+
};
|
|
85
|
+
proClasses: {
|
|
86
|
+
type: ObjectConstructor;
|
|
87
|
+
default: () => {};
|
|
88
|
+
};
|
|
89
|
+
proStyles: {
|
|
90
|
+
type: ObjectConstructor;
|
|
91
|
+
default: () => {};
|
|
92
|
+
};
|
|
93
|
+
}>> & Readonly<{}>, {
|
|
94
|
+
titleTipText: string;
|
|
95
|
+
actionsPlacement: ToolbarPlacement;
|
|
96
|
+
actions: VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
}>[];
|
|
99
|
+
headerTitle: any;
|
|
100
|
+
listToolAfter: any;
|
|
101
|
+
headerTitleTip: any;
|
|
102
|
+
proClasses: Record<string, any>;
|
|
103
|
+
proStyles: Record<string, any>;
|
|
104
|
+
settings: VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
105
|
+
[key: string]: any;
|
|
106
|
+
}>[];
|
|
107
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
108
|
+
//#endregion
|
|
109
|
+
export { ListToolBar, ListToolBarSetting };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { computed, createVNode, defineComponent, isVNode } from "vue";
|
|
2
|
+
import { Tooltip } from "antdv-next";
|
|
3
|
+
import { GIcon } from "@gx-design-vue/icon";
|
|
4
|
+
//#region src/components/Toolbar/ListToolBar.tsx
|
|
5
|
+
function renderSettingItem(setting) {
|
|
6
|
+
if (isVNode(setting)) return setting;
|
|
7
|
+
if (!setting) return null;
|
|
8
|
+
const { icon, tooltip, onClick, key } = setting;
|
|
9
|
+
if (icon && tooltip) return createVNode(Tooltip, {
|
|
10
|
+
"title": tooltip,
|
|
11
|
+
"key": key
|
|
12
|
+
}, { default: () => [createVNode("span", {
|
|
13
|
+
"key": key,
|
|
14
|
+
"onClick": () => {
|
|
15
|
+
if (onClick) onClick(key);
|
|
16
|
+
}
|
|
17
|
+
}, [icon])] });
|
|
18
|
+
return icon;
|
|
19
|
+
}
|
|
20
|
+
const ListToolBar = /* @__PURE__ */ defineComponent({
|
|
21
|
+
name: "ProTableListToolBar",
|
|
22
|
+
props: {
|
|
23
|
+
prefixCls: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
headerTitle: {
|
|
28
|
+
type: null,
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
headerTitleTip: {
|
|
32
|
+
type: null,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
titleTipText: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: void 0
|
|
38
|
+
},
|
|
39
|
+
settings: {
|
|
40
|
+
type: Array,
|
|
41
|
+
default: () => []
|
|
42
|
+
},
|
|
43
|
+
actions: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => []
|
|
46
|
+
},
|
|
47
|
+
actionsPlacement: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "right"
|
|
50
|
+
},
|
|
51
|
+
listToolAfter: {
|
|
52
|
+
type: null,
|
|
53
|
+
default: void 0
|
|
54
|
+
},
|
|
55
|
+
proClasses: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: () => ({})
|
|
58
|
+
},
|
|
59
|
+
proStyles: {
|
|
60
|
+
type: Object,
|
|
61
|
+
default: () => ({})
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setup(props) {
|
|
65
|
+
const hasTitle = computed(() => !!(props.headerTitleTip || props.headerTitle));
|
|
66
|
+
const leftActions = computed(() => props.actionsPlacement === "left" ? props.actions : []);
|
|
67
|
+
const rightActions = computed(() => props.actionsPlacement === "right" ? props.actions : []);
|
|
68
|
+
const hasLeft = computed(() => hasTitle.value || leftActions.value.length > 0);
|
|
69
|
+
const hasRight = computed(() => props.settings.length > 0 || rightActions.value.length > 0);
|
|
70
|
+
return () => {
|
|
71
|
+
if (!hasLeft.value && !hasRight.value && !props.listToolAfter) return null;
|
|
72
|
+
const prefix = props.prefixCls;
|
|
73
|
+
const leftNode = hasLeft.value || hasRight.value ? createVNode("div", {
|
|
74
|
+
"class": `${prefix}-list-toolbar-left`,
|
|
75
|
+
"style": props.proStyles.toolbarLeft
|
|
76
|
+
}, [hasTitle.value && createVNode("div", {
|
|
77
|
+
"class": [`${prefix}-list-toolbar-title`, props.proClasses.toolbarTitle],
|
|
78
|
+
"style": props.proStyles.toolbarTitle
|
|
79
|
+
}, [props.headerTitle, props.headerTitleTip && createVNode(Tooltip, { "title": props.titleTipText }, { default: () => [typeof props.headerTitleTip === "boolean" ? createVNode(GIcon, { "type": "InfoCircleOutlined" }, null) : props.headerTitleTip] })]), leftActions.value.length > 0 && createVNode("div", { "class": `${prefix}-list-toolbar-actions` }, [leftActions.value])]) : hasRight.value ? createVNode("div", {
|
|
80
|
+
"class": `${prefix}-list-toolbar-left`,
|
|
81
|
+
"style": props.proStyles.toolbarLeft
|
|
82
|
+
}, null) : null;
|
|
83
|
+
const rightNode = hasRight.value ? createVNode("div", {
|
|
84
|
+
"class": [`${prefix}-list-toolbar-right`, props.proClasses.toolbarRight],
|
|
85
|
+
"style": props.proStyles.toolbarRight
|
|
86
|
+
}, [rightActions.value.length > 0 && createVNode("div", { "class": `${prefix}-list-toolbar-actions` }, [rightActions.value]), props.settings.length > 0 && createVNode("div", { "class": `${prefix}-list-toolbar-setting-items` }, [props.settings.map((setting, index) => createVNode("div", {
|
|
87
|
+
"key": index,
|
|
88
|
+
"class": `${prefix}-list-toolbar-setting-item`
|
|
89
|
+
}, [renderSettingItem(setting)]))])]) : null;
|
|
90
|
+
return createVNode("div", {
|
|
91
|
+
"class": [`${prefix}-list-toolbar`, props.proClasses.toolbar],
|
|
92
|
+
"style": props.proStyles.toolbar
|
|
93
|
+
}, [(leftNode || rightNode) && createVNode("div", { "class": `${prefix}-list-toolbar-container` }, [leftNode, rightNode]), props.listToolAfter && createVNode("div", {
|
|
94
|
+
"class": [`${prefix}-list-toolbar-after`, props.proClasses.toolbarAfter],
|
|
95
|
+
"style": props.proStyles.toolbarAfter
|
|
96
|
+
}, [props.listToolAfter])]);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
//#endregion
|
|
101
|
+
export { ListToolBar };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ToolbarPlacement } from "../../interface.js";
|
|
2
|
+
import { PropType, VNode } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Toolbar/index.d.ts
|
|
5
|
+
declare const Toolbar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
+
prefixCls: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
options: {
|
|
11
|
+
type: any;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
titleTipText: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: any;
|
|
17
|
+
};
|
|
18
|
+
actionsPlacement: {
|
|
19
|
+
type: PropType<ToolbarPlacement>;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
actions: {
|
|
23
|
+
type: PropType<VNode[]>;
|
|
24
|
+
default: () => any[];
|
|
25
|
+
};
|
|
26
|
+
headerTitle: {
|
|
27
|
+
type: any;
|
|
28
|
+
default: any;
|
|
29
|
+
};
|
|
30
|
+
listToolAfter: {
|
|
31
|
+
type: any;
|
|
32
|
+
default: any;
|
|
33
|
+
};
|
|
34
|
+
headerTitleTip: {
|
|
35
|
+
type: any;
|
|
36
|
+
default: any;
|
|
37
|
+
};
|
|
38
|
+
proClasses: {
|
|
39
|
+
type: ObjectConstructor;
|
|
40
|
+
default: () => {};
|
|
41
|
+
};
|
|
42
|
+
proStyles: {
|
|
43
|
+
type: ObjectConstructor;
|
|
44
|
+
default: () => {};
|
|
45
|
+
};
|
|
46
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
47
|
+
prefixCls: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
options: {
|
|
52
|
+
type: any;
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
titleTipText: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: any;
|
|
58
|
+
};
|
|
59
|
+
actionsPlacement: {
|
|
60
|
+
type: PropType<ToolbarPlacement>;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
actions: {
|
|
64
|
+
type: PropType<VNode[]>;
|
|
65
|
+
default: () => any[];
|
|
66
|
+
};
|
|
67
|
+
headerTitle: {
|
|
68
|
+
type: any;
|
|
69
|
+
default: any;
|
|
70
|
+
};
|
|
71
|
+
listToolAfter: {
|
|
72
|
+
type: any;
|
|
73
|
+
default: any;
|
|
74
|
+
};
|
|
75
|
+
headerTitleTip: {
|
|
76
|
+
type: any;
|
|
77
|
+
default: any;
|
|
78
|
+
};
|
|
79
|
+
proClasses: {
|
|
80
|
+
type: ObjectConstructor;
|
|
81
|
+
default: () => {};
|
|
82
|
+
};
|
|
83
|
+
proStyles: {
|
|
84
|
+
type: ObjectConstructor;
|
|
85
|
+
default: () => {};
|
|
86
|
+
};
|
|
87
|
+
}>> & Readonly<{}>, {
|
|
88
|
+
options: any;
|
|
89
|
+
titleTipText: string;
|
|
90
|
+
actionsPlacement: ToolbarPlacement;
|
|
91
|
+
actions: VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}>[];
|
|
94
|
+
headerTitle: any;
|
|
95
|
+
listToolAfter: any;
|
|
96
|
+
headerTitleTip: any;
|
|
97
|
+
proClasses: Record<string, any>;
|
|
98
|
+
proStyles: Record<string, any>;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
100
|
+
//#endregion
|
|
101
|
+
export { Toolbar, Toolbar as default };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useInjectTableContext } from "../../context/TableContext.js";
|
|
2
|
+
import { FullscreenIcon } from "./FullscreenIcon.js";
|
|
3
|
+
import { ListToolBar } from "./ListToolBar.js";
|
|
4
|
+
import { computed, createVNode, defineComponent, unref } from "vue";
|
|
5
|
+
import { Tooltip } from "antdv-next";
|
|
6
|
+
import { GIcon } from "@gx-design-vue/icon";
|
|
7
|
+
//#region src/components/Toolbar/index.tsx
|
|
8
|
+
function isObject(val) {
|
|
9
|
+
return val !== null && typeof val === "object";
|
|
10
|
+
}
|
|
11
|
+
const Toolbar = /* @__PURE__ */ defineComponent({
|
|
12
|
+
name: "ProTableToolbar",
|
|
13
|
+
props: {
|
|
14
|
+
prefixCls: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
options: {
|
|
19
|
+
type: [Object, Boolean],
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
titleTipText: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
actionsPlacement: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "right"
|
|
29
|
+
},
|
|
30
|
+
actions: {
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
headerTitle: {
|
|
35
|
+
type: null,
|
|
36
|
+
default: void 0
|
|
37
|
+
},
|
|
38
|
+
listToolAfter: {
|
|
39
|
+
type: null,
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
headerTitleTip: {
|
|
43
|
+
type: null,
|
|
44
|
+
default: void 0
|
|
45
|
+
},
|
|
46
|
+
proClasses: {
|
|
47
|
+
type: Object,
|
|
48
|
+
default: () => ({})
|
|
49
|
+
},
|
|
50
|
+
proStyles: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => ({})
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
setup(props) {
|
|
56
|
+
const ctx = useInjectTableContext();
|
|
57
|
+
const settings = computed(() => {
|
|
58
|
+
if (props.options === false) return [];
|
|
59
|
+
const options = isObject(props.options) ? props.options : {};
|
|
60
|
+
const result = [];
|
|
61
|
+
if (options.reload !== false) {
|
|
62
|
+
const reloadAction = () => ctx?.reload?.();
|
|
63
|
+
if (typeof options.reload === "function") {
|
|
64
|
+
const vnode = options.reload(reloadAction);
|
|
65
|
+
if (vnode) result.push(vnode);
|
|
66
|
+
} else result.push(createVNode(Tooltip, {
|
|
67
|
+
"title": "刷新",
|
|
68
|
+
"key": "reload"
|
|
69
|
+
}, { default: () => [createVNode("span", { "onClick": reloadAction }, [createVNode(GIcon, { "type": "ReloadOutlined" }, null)])] }));
|
|
70
|
+
}
|
|
71
|
+
if (options.fullScreen !== false) {
|
|
72
|
+
const toggleAction = () => ctx?.toggleFullscreen?.();
|
|
73
|
+
if (typeof options.fullScreen === "function") result.push(createVNode(FullscreenIcon, {
|
|
74
|
+
"key": "fullscreen",
|
|
75
|
+
"isFullscreen": !!ctx?.isFullscreen?.value,
|
|
76
|
+
"onToggle": options.fullScreen
|
|
77
|
+
}, null));
|
|
78
|
+
else result.push(createVNode(FullscreenIcon, {
|
|
79
|
+
"key": "fullscreen",
|
|
80
|
+
"isFullscreen": !!ctx?.isFullscreen?.value,
|
|
81
|
+
"onToggle": toggleAction
|
|
82
|
+
}, null));
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
});
|
|
86
|
+
return () => createVNode(ListToolBar, {
|
|
87
|
+
"prefixCls": props.prefixCls,
|
|
88
|
+
"actions": props.actions,
|
|
89
|
+
"actionsPlacement": props.actionsPlacement,
|
|
90
|
+
"settings": unref(settings),
|
|
91
|
+
"headerTitle": props.headerTitle,
|
|
92
|
+
"listToolAfter": props.listToolAfter,
|
|
93
|
+
"headerTitleTip": props.headerTitleTip,
|
|
94
|
+
"titleTipText": props.titleTipText,
|
|
95
|
+
"proClasses": props.proClasses,
|
|
96
|
+
"proStyles": props.proStyles
|
|
97
|
+
}, null);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
//#endregion
|
|
101
|
+
export { Toolbar, Toolbar as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProFullToken } from "@gx-design-vue/pro-provider";
|
|
2
|
+
import { CSSObject } from "@antdv-next/cssinjs";
|
|
3
|
+
import { GenerateStyle } from "antdv-next/dist/theme/internal";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toolbar/style.d.ts
|
|
6
|
+
declare const genToolbarStyle: GenerateStyle<ProFullToken<'ProTable'>, CSSObject>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { genToolbarStyle };
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
//#region src/components/
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
//#region src/components/Toolbar/style.ts
|
|
2
|
+
const genToolbarStyle = (token) => {
|
|
3
|
+
const prefixCls = token.componentCls;
|
|
4
|
+
return { [prefixCls]: { [`${prefixCls}-list-toolbar`]: {
|
|
4
5
|
lineHeight: 1,
|
|
5
|
-
"&-with-after": { paddingBottom: token.margin },
|
|
6
6
|
"&-container": {
|
|
7
7
|
display: "flex",
|
|
8
8
|
alignItems: "center",
|
|
9
9
|
justifyContent: "space-between",
|
|
10
10
|
gap: token.padding,
|
|
11
|
-
paddingBottom: token.padding
|
|
12
|
-
"&-mobile": {
|
|
13
|
-
flexDirection: "column",
|
|
14
|
-
flexWrap: "wrap",
|
|
15
|
-
alignItems: "flex-start",
|
|
16
|
-
[`${token.componentCls}-left`]: {
|
|
17
|
-
flexWrap: "wrap",
|
|
18
|
-
maxWidth: "100%"
|
|
19
|
-
},
|
|
20
|
-
[`${token.componentCls}-right`]: { width: "100%" }
|
|
21
|
-
}
|
|
11
|
+
paddingBottom: token.padding
|
|
22
12
|
},
|
|
23
13
|
"&-title": {
|
|
24
14
|
display: "flex",
|
|
@@ -26,7 +16,10 @@ const genListToolBarStyle = (token) => {
|
|
|
26
16
|
justifyContent: "flex-start",
|
|
27
17
|
color: token.colorTextHeading,
|
|
28
18
|
fontWeight: "500",
|
|
29
|
-
fontSize: token.fontSizeLG
|
|
19
|
+
fontSize: token.fontSizeLG,
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
textOverflow: "ellipsis",
|
|
22
|
+
whiteSpace: "nowrap"
|
|
30
23
|
},
|
|
31
24
|
"&-left": {
|
|
32
25
|
display: "flex",
|
|
@@ -34,20 +27,19 @@ const genListToolBarStyle = (token) => {
|
|
|
34
27
|
alignItems: "center",
|
|
35
28
|
gap: token.marginXS,
|
|
36
29
|
justifyContent: "flex-start",
|
|
37
|
-
|
|
38
|
-
"&-has-tabs": { overflow: "hidden" }
|
|
30
|
+
flexShrink: 0
|
|
39
31
|
},
|
|
40
32
|
"&-right": {
|
|
41
33
|
flex: 1,
|
|
42
34
|
display: "flex",
|
|
43
35
|
flexWrap: "wrap",
|
|
44
36
|
justifyContent: "flex-end",
|
|
45
|
-
gap: token.marginSM
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
gap: token.marginSM
|
|
38
|
+
},
|
|
39
|
+
"&-actions": {
|
|
40
|
+
display: "flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
gap: token.marginXS
|
|
51
43
|
},
|
|
52
44
|
"&-setting-items": {
|
|
53
45
|
display: "flex",
|
|
@@ -66,9 +58,22 @@ const genListToolBarStyle = (token) => {
|
|
|
66
58
|
height: "100%"
|
|
67
59
|
},
|
|
68
60
|
"&:hover": { color: token.colorPrimary }
|
|
61
|
+
},
|
|
62
|
+
"&-after": { paddingBottom: token.margin },
|
|
63
|
+
[`@media (max-width: ${token.screenLGMax}px)`]: {
|
|
64
|
+
[`${prefixCls}-list-toolbar-container`]: {
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
flexWrap: "wrap",
|
|
67
|
+
alignItems: "flex-start"
|
|
68
|
+
},
|
|
69
|
+
[`${prefixCls}-list-toolbar-left`]: {
|
|
70
|
+
flexWrap: "wrap",
|
|
71
|
+
maxWidth: "100%",
|
|
72
|
+
overflow: "visible"
|
|
73
|
+
},
|
|
74
|
+
[`${prefixCls}-list-toolbar-right`]: { width: "100%" }
|
|
69
75
|
}
|
|
70
|
-
} };
|
|
76
|
+
} } };
|
|
71
77
|
};
|
|
72
|
-
|
|
73
78
|
//#endregion
|
|
74
|
-
export {
|
|
79
|
+
export { genToolbarStyle };
|
|
@@ -1,32 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormConfig, TableClassNamesType, TableScroll, TableStylesType } from "../types/TableTypings.js";
|
|
1
|
+
import { FormConfig, ProTableSizeType } from "../interface.js";
|
|
3
2
|
import { ComputedRef, Ref } from "vue";
|
|
4
|
-
import { SizeType } from "@gx-design-vue/pro-utils";
|
|
5
|
-
import { PaginationProps } from "ant-design-vue/es/pagination";
|
|
6
3
|
|
|
7
4
|
//#region src/context/TableContext.d.ts
|
|
8
|
-
interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
formAutoRequest
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
screenWidth
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
hashId: Ref<string>;
|
|
21
|
-
prefixCls: string;
|
|
22
|
-
tableListToolsHeight: Ref<number>;
|
|
23
|
-
action: {
|
|
24
|
-
/** @name 刷新 */reload: (info?: any) => void;
|
|
25
|
-
toggle: () => Promise<void>;
|
|
26
|
-
setTableSize: (size: SizeType) => void;
|
|
27
|
-
};
|
|
28
|
-
setPagination: (info: Partial<PaginationProps>) => void;
|
|
5
|
+
interface TableContextProps {
|
|
6
|
+
reload: (info?: any) => void;
|
|
7
|
+
setPagination: (info: any) => void;
|
|
8
|
+
tableSize?: ComputedRef<ProTableSizeType>;
|
|
9
|
+
setTableSize?: (size: ProTableSizeType) => void;
|
|
10
|
+
formAutoRequest?: ComputedRef<boolean>;
|
|
11
|
+
formConfig?: ComputedRef<FormConfig | undefined>;
|
|
12
|
+
formActions?: ComputedRef<FormConfig['actions'] | undefined>;
|
|
13
|
+
isMobile?: ComputedRef<boolean>;
|
|
14
|
+
screenWidth?: ComputedRef<number>;
|
|
15
|
+
toggleFullscreen?: () => Promise<void>;
|
|
16
|
+
isFullscreen?: Ref<boolean>;
|
|
29
17
|
}
|
|
30
|
-
declare const
|
|
18
|
+
declare const useProvideTableContext: (args_0: TableContextProps) => TableContextProps, useInjectTableContext: () => TableContextProps;
|
|
31
19
|
//#endregion
|
|
32
|
-
export {
|
|
20
|
+
export { TableContextProps, useInjectTableContext, useProvideTableContext };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { createInjectionState } from "@vueuse/core";
|
|
3
2
|
//#region src/context/TableContext.ts
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
const [useProvideTableContext, useInjectTableContext] = createInjectionState((props) => props);
|
|
6
4
|
//#endregion
|
|
7
|
-
export {
|
|
5
|
+
export { useInjectTableContext, useProvideTableContext };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseProBreakpointsReturn, useProBreakpoints } from "./useBreakpoints.js";
|
|
2
|
+
import { UseCellRenderOptions, useCellRender } from "./useCellRender.js";
|
|
3
|
+
import { UseColumnResizeOptions, UseColumnResizeReturn, useColumnResize } from "./useColumnResize.js";
|
|
4
|
+
import { UseColumnsOptions, UseColumnsReturn, useColumns } from "./useColumns.js";
|
|
5
|
+
import { UseDragHandleColumnOptions, UseDragHandleColumnReturn, applyDragHandleColumn, useDragHandleColumn } from "./useDragHandleColumn.js";
|
|
6
|
+
import { UseEllipsisReturn, useEllipsis } from "./useEllipsis.js";
|
|
7
|
+
import { FetchDataAction, FetchDataConfig, useFetchData } from "./useFetchData.js";
|
|
8
|
+
import { UseFitPageOptions, UseFitPageReturn, useFitPage } from "./useFitPage.js";
|
|
9
|
+
import { UseKeepAliveReloadOptions, UseKeepAliveReloadReturn, useKeepAliveReload } from "./useKeepAliveReload.js";
|
|
10
|
+
import { UseLoadingOptions, UseLoadingReturn, useLoading } from "./useLoading.js";
|
|
11
|
+
import { usePagination } from "./usePagination.js";
|
|
12
|
+
import { UseRequestOptionsParams, UseRequestOptionsReturn, useRequestOptions } from "./useRequestOptions.js";
|
|
13
|
+
import { UseRowDragOptions, UseRowDragReturn, useRowDrag } from "./useRowDrag.js";
|
|
14
|
+
import { UseRowSelectionOptions, UseRowSelectionReturn, useRowSelection } from "./useRowSelection.js";
|
|
15
|
+
import { UseTableOptions, UseTableReturn, useTable } from "./useTable.js";
|
|
16
|
+
import { UseTableFormOptions, UseTableFormReturn, useTableForm } from "./useTableForm.js";
|
|
17
|
+
import { NormalizedTableScrollPolicy, UseTableScrollOptions, UseTableScrollReturn, useTableScroll } from "./useTableScroll.js";
|
|
18
|
+
import { UseTableSizeOptions, UseTableSizeReturn, useTableSize } from "./useTableSize.js";
|
|
19
|
+
export { type FetchDataAction, type FetchDataConfig, type NormalizedTableScrollPolicy, type UseCellRenderOptions, type UseColumnResizeOptions, type UseColumnResizeReturn, type UseColumnsOptions, type UseColumnsReturn, type UseDragHandleColumnOptions, type UseDragHandleColumnReturn, type UseEllipsisReturn, type UseFitPageOptions, type UseFitPageReturn, type UseKeepAliveReloadOptions, type UseKeepAliveReloadReturn, type UseLoadingOptions, type UseLoadingReturn, type UseProBreakpointsReturn, type UseRequestOptionsParams, type UseRequestOptionsReturn, type UseRowDragOptions, type UseRowDragReturn, type UseRowSelectionOptions, type UseRowSelectionReturn, type UseTableFormOptions, type UseTableFormReturn, type UseTableOptions, type UseTableReturn, type UseTableScrollOptions, type UseTableScrollReturn, type UseTableSizeOptions, type UseTableSizeReturn, applyDragHandleColumn, useCellRender, useColumnResize, useColumns, useDragHandleColumn, useEllipsis, useFetchData, useFitPage, useKeepAliveReload, useLoading, usePagination, useProBreakpoints, useRequestOptions, useRowDrag, useRowSelection, useTable, useTableForm, useTableScroll, useTableSize };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useProBreakpoints } from "./useBreakpoints.js";
|
|
2
|
+
import { useRequestOptions } from "./useRequestOptions.js";
|
|
3
|
+
import { useEllipsis } from "./useEllipsis.js";
|
|
4
|
+
import { useCellRender } from "./useCellRender.js";
|
|
5
|
+
import { useColumns } from "./useColumns.js";
|
|
6
|
+
import { applyDragHandleColumn, useDragHandleColumn } from "./useDragHandleColumn.js";
|
|
7
|
+
import { useColumnResize } from "./useColumnResize.js";
|
|
8
|
+
import { useFetchData } from "./useFetchData.js";
|
|
9
|
+
import { useFitPage } from "./useFitPage.js";
|
|
10
|
+
import { useKeepAliveReload } from "./useKeepAliveReload.js";
|
|
11
|
+
import { useLoading } from "./useLoading.js";
|
|
12
|
+
import { usePagination } from "./usePagination.js";
|
|
13
|
+
import { useRowDrag } from "./useRowDrag.js";
|
|
14
|
+
import { useRowSelection } from "./useRowSelection.js";
|
|
15
|
+
import { useTable } from "./useTable.js";
|
|
16
|
+
import { useTableForm } from "./useTableForm.js";
|
|
17
|
+
import { useTableScroll } from "./useTableScroll.js";
|
|
18
|
+
import { useTableSize } from "./useTableSize.js";
|
|
19
|
+
export { applyDragHandleColumn, useCellRender, useColumnResize, useColumns, useDragHandleColumn, useEllipsis, useFetchData, useFitPage, useKeepAliveReload, useLoading, usePagination, useProBreakpoints, useRequestOptions, useRowDrag, useRowSelection, useTable, useTableForm, useTableScroll, useTableSize };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/useAutoScroll.d.ts
|
|
4
|
+
interface UseAutoScrollOptions {
|
|
5
|
+
/** 边缘激活区域占容器高度比例,默认 0.2(对齐 dnd-kit detectScrollIntent threshold) */
|
|
6
|
+
threshold?: number;
|
|
7
|
+
/** 滚动加速度(基础速度),默认 18 */
|
|
8
|
+
acceleration?: number;
|
|
9
|
+
/** 指针超出边缘的容差(px),默认 10 */
|
|
10
|
+
tolerance?: number;
|
|
11
|
+
/** 滚动后回调,用于同步拖拽元素和让位元素位置 */
|
|
12
|
+
onScroll?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 纵向自动滚动 —— 精简复刻 `@dnd-kit/dom` 的 `detectScrollIntent` + `Scroller` 思路,
|
|
16
|
+
* 与 pro-layout Tabs 的横向 `useAutoScroll` 同构(仅轴向不同)。
|
|
17
|
+
*
|
|
18
|
+
* 指针进入 `scrollEl` 上/下边缘 threshold 区域时,按距边缘的比例计算速度
|
|
19
|
+
* (越靠边越快)。滚动方向必须先被用户同向移动解锁;如果当前方向已经到达边界,
|
|
20
|
+
* 则不产生滚动 intent,避免触底后因为鼠标还在边缘区被反复重新激活。
|
|
21
|
+
*
|
|
22
|
+
* 关键:`maxScrollTop` 在 `start()` 时快照一次(`??` 仅在 undefined 时 fallback 到实时值),
|
|
23
|
+
* 拖拽全程都用快照值判定能否滚动。这样即使拖拽中 `transform` 撑大了 `scrollHeight`,
|
|
24
|
+
* 也不会污染滚动判定,避免死循环。
|
|
25
|
+
*/
|
|
26
|
+
declare function useAutoScroll(scrollEl: Ref<HTMLElement | undefined> | ComputedRef<HTMLElement | undefined>, getPointerY: () => number | null, options?: UseAutoScrollOptions): {
|
|
27
|
+
scroll: () => boolean;
|
|
28
|
+
start: () => void;
|
|
29
|
+
stop: () => void;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { UseAutoScrollOptions, useAutoScroll };
|