@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,90 @@
|
|
|
1
|
+
import { CustomRender } from "@gx-design-vue/pro-utils";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Drag/Handle.d.ts
|
|
4
|
+
interface DragHandleProps {
|
|
5
|
+
/** 自定义把手渲染(覆盖默认图标) */
|
|
6
|
+
handleRender?: (record: any, index: number) => CustomRender;
|
|
7
|
+
/** 当前行数据 */
|
|
8
|
+
record?: any;
|
|
9
|
+
/** 当前行索引 */
|
|
10
|
+
index?: number;
|
|
11
|
+
/** 是否禁用拖拽 */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** 样式前缀 */
|
|
14
|
+
prefixCls?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 行拖拽把手 —— 默认渲染 HolderOutlined 图标,`handleRender` 可覆盖。
|
|
18
|
+
*
|
|
19
|
+
* 根元素带 `data-drag-handle` 标记,`useRowDrag` 通过它识别拖拽入口;
|
|
20
|
+
* 禁用时 `data-drag-disabled` 标记 + not-allowed 光标。
|
|
21
|
+
*/
|
|
22
|
+
declare const DragHandle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
23
|
+
handleRender: {
|
|
24
|
+
type: FunctionConstructor;
|
|
25
|
+
default: any;
|
|
26
|
+
};
|
|
27
|
+
record: {
|
|
28
|
+
type: ObjectConstructor;
|
|
29
|
+
default: any;
|
|
30
|
+
};
|
|
31
|
+
index: {
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
default: any;
|
|
34
|
+
};
|
|
35
|
+
disabled: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
prefixCls: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
hashId: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: string;
|
|
46
|
+
};
|
|
47
|
+
cssVarCls: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
default: string;
|
|
50
|
+
};
|
|
51
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
52
|
+
handleRender: {
|
|
53
|
+
type: FunctionConstructor;
|
|
54
|
+
default: any;
|
|
55
|
+
};
|
|
56
|
+
record: {
|
|
57
|
+
type: ObjectConstructor;
|
|
58
|
+
default: any;
|
|
59
|
+
};
|
|
60
|
+
index: {
|
|
61
|
+
type: NumberConstructor;
|
|
62
|
+
default: any;
|
|
63
|
+
};
|
|
64
|
+
disabled: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
prefixCls: {
|
|
69
|
+
type: StringConstructor;
|
|
70
|
+
default: string;
|
|
71
|
+
};
|
|
72
|
+
hashId: {
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
default: string;
|
|
75
|
+
};
|
|
76
|
+
cssVarCls: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
80
|
+
}>> & Readonly<{}>, {
|
|
81
|
+
prefixCls: string;
|
|
82
|
+
handleRender: Function;
|
|
83
|
+
record: Record<string, any>;
|
|
84
|
+
index: number;
|
|
85
|
+
disabled: boolean;
|
|
86
|
+
hashId: string;
|
|
87
|
+
cssVarCls: string;
|
|
88
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { DragHandle, DragHandleProps };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
|
+
import { GIcon } from "@gx-design-vue/icon";
|
|
3
|
+
//#region src/components/Drag/Handle.tsx
|
|
4
|
+
/**
|
|
5
|
+
* 行拖拽把手 —— 默认渲染 HolderOutlined 图标,`handleRender` 可覆盖。
|
|
6
|
+
*
|
|
7
|
+
* 根元素带 `data-drag-handle` 标记,`useRowDrag` 通过它识别拖拽入口;
|
|
8
|
+
* 禁用时 `data-drag-disabled` 标记 + not-allowed 光标。
|
|
9
|
+
*/
|
|
10
|
+
const DragHandle = /* @__PURE__ */ defineComponent({
|
|
11
|
+
name: "ProTableDragHandle",
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
handleRender: {
|
|
15
|
+
type: Function,
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
record: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: void 0
|
|
21
|
+
},
|
|
22
|
+
index: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
prefixCls: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ""
|
|
33
|
+
},
|
|
34
|
+
hashId: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
cssVarCls: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ""
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
setup(props) {
|
|
44
|
+
return () => {
|
|
45
|
+
const customNode = props.handleRender?.(props.record, props.index ?? 0);
|
|
46
|
+
if (customNode !== void 0 && customNode !== null && customNode !== false) return createVNode("span", {
|
|
47
|
+
"class": `${props.prefixCls}-drag-handle`,
|
|
48
|
+
"data-drag-handle": "true",
|
|
49
|
+
"data-drag-disabled": props.disabled ? "true" : void 0
|
|
50
|
+
}, [customNode]);
|
|
51
|
+
return createVNode("span", {
|
|
52
|
+
"class": [
|
|
53
|
+
props.cssVarCls,
|
|
54
|
+
`${props.prefixCls}-drag-handle`,
|
|
55
|
+
props.disabled ? `${props.prefixCls}-drag-handle-disabled` : ""
|
|
56
|
+
],
|
|
57
|
+
"data-drag-handle": "true",
|
|
58
|
+
"data-drag-disabled": props.disabled ? "true" : void 0
|
|
59
|
+
}, [createVNode(GIcon, { "type": "HolderOutlined" }, null)]);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export { DragHandle };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/components/Drag/Tbody.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 透传 `<tbody>` 并捕获其 DOM 引用。
|
|
6
|
+
*
|
|
7
|
+
* 用于 `components.body.wrapper` 覆写,让 `useRowDrag` 能拿到 tbody 元素,
|
|
8
|
+
* 从而 `querySelectorAll('tr[data-row-key]')` 获取所有行。
|
|
9
|
+
*
|
|
10
|
+
* 对标 `useColumnResize` 覆写 `components.header.cell` 的手法:
|
|
11
|
+
* attrs 全部透传给 `<tbody>`,slots 原样保留。
|
|
12
|
+
*/
|
|
13
|
+
declare function createDragTbody(tbodyRef: Ref<HTMLElement | undefined>): import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createDragTbody };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
//#region src/components/Drag/Tbody.ts
|
|
3
|
+
/**
|
|
4
|
+
* 透传 `<tbody>` 并捕获其 DOM 引用。
|
|
5
|
+
*
|
|
6
|
+
* 用于 `components.body.wrapper` 覆写,让 `useRowDrag` 能拿到 tbody 元素,
|
|
7
|
+
* 从而 `querySelectorAll('tr[data-row-key]')` 获取所有行。
|
|
8
|
+
*
|
|
9
|
+
* 对标 `useColumnResize` 覆写 `components.header.cell` 的手法:
|
|
10
|
+
* attrs 全部透传给 `<tbody>`,slots 原样保留。
|
|
11
|
+
*/
|
|
12
|
+
function createDragTbody(tbodyRef) {
|
|
13
|
+
return defineComponent({
|
|
14
|
+
name: "ProTableDragTbody",
|
|
15
|
+
inheritAttrs: false,
|
|
16
|
+
setup(_, { attrs, slots }) {
|
|
17
|
+
return () => h("tbody", {
|
|
18
|
+
...attrs,
|
|
19
|
+
ref: (el) => {
|
|
20
|
+
tbodyRef.value = el instanceof HTMLElement ? el : void 0;
|
|
21
|
+
}
|
|
22
|
+
}, slots.default?.());
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createDragTbody };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { NormalizedEllipsis } from "../../utils/ellipsis.js";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/components/EllipsisText/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 单元格文本溢出渲染:
|
|
7
|
+
* - 视觉省略由 CSS `-webkit-line-clamp` 承担;
|
|
8
|
+
* - 是否溢出由 useEllipsis(@chenglou/pretext)判断;
|
|
9
|
+
* - 溢出且未关闭 tooltip 时挂 Tooltip,getPopupContainer 指向表格滚动容器(滚动时跟随)。
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
/** 纯文本:用于 pretext 测量与 tooltip title */text: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
}; /** 归一化后的溢出配置 */
|
|
16
|
+
ellipsis: {
|
|
17
|
+
type: PropType<NormalizedEllipsis>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
prefixCls: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
hashId: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
/** 纯文本:用于 pretext 测量与 tooltip title */text: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
default: string;
|
|
32
|
+
}; /** 归一化后的溢出配置 */
|
|
33
|
+
ellipsis: {
|
|
34
|
+
type: PropType<NormalizedEllipsis>;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
prefixCls: {
|
|
38
|
+
type: StringConstructor;
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
hashId: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{}>, {
|
|
46
|
+
hashId: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { _default as default };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useInjectScrollBarContext } from "../ScrollBar/context.js";
|
|
2
|
+
import { useEllipsis } from "../../hooks/useEllipsis.js";
|
|
3
|
+
import { computed, createVNode, defineComponent, isVNode, mergeProps, ref, toRef } from "vue";
|
|
4
|
+
import { Tooltip } from "antdv-next";
|
|
5
|
+
//#region src/components/EllipsisText/index.tsx
|
|
6
|
+
/**
|
|
7
|
+
* 单元格文本溢出渲染:
|
|
8
|
+
* - 视觉省略由 CSS `-webkit-line-clamp` 承担;
|
|
9
|
+
* - 是否溢出由 useEllipsis(@chenglou/pretext)判断;
|
|
10
|
+
* - 溢出且未关闭 tooltip 时挂 Tooltip,getPopupContainer 指向表格滚动容器(滚动时跟随)。
|
|
11
|
+
*/
|
|
12
|
+
function _isSlot(s) {
|
|
13
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
14
|
+
}
|
|
15
|
+
var EllipsisText_default = /* @__PURE__ */ defineComponent({
|
|
16
|
+
name: "ProTableEllipsisText",
|
|
17
|
+
props: {
|
|
18
|
+
/** 纯文本:用于 pretext 测量与 tooltip title */
|
|
19
|
+
text: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
/** 归一化后的溢出配置 */
|
|
24
|
+
ellipsis: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
prefixCls: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
hashId: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
setup(props, { slots }) {
|
|
38
|
+
const contentRef = ref();
|
|
39
|
+
const { isOverflow } = useEllipsis(toRef(props, "text"), computed(() => props.ellipsis.lines), contentRef);
|
|
40
|
+
const scrollContext = useInjectScrollBarContext();
|
|
41
|
+
const getScrollContainer = () => scrollContext?.wrapElement?.value ?? document.body;
|
|
42
|
+
return () => {
|
|
43
|
+
let _slot;
|
|
44
|
+
const children = slots.default ? slots.default() : props.text;
|
|
45
|
+
const lineClampStyle = {
|
|
46
|
+
WebkitLineClamp: props.ellipsis.lines,
|
|
47
|
+
lineClamp: props.ellipsis.lines
|
|
48
|
+
};
|
|
49
|
+
const renderCell = (extra) => createVNode("div", mergeProps({
|
|
50
|
+
"ref": contentRef,
|
|
51
|
+
"class": [`${props.prefixCls}-cell-ellipsis`, props.hashId],
|
|
52
|
+
"style": lineClampStyle
|
|
53
|
+
}, extra ?? {}), [children]);
|
|
54
|
+
if (props.ellipsis.showTitle) return renderCell({ title: props.text });
|
|
55
|
+
const tooltipConfig = props.ellipsis.tooltip;
|
|
56
|
+
if (tooltipConfig === false || !isOverflow.value) return renderCell();
|
|
57
|
+
return createVNode(Tooltip, mergeProps({ "title": props.text }, tooltipConfig, {
|
|
58
|
+
"getPopupContainer": getScrollContainer,
|
|
59
|
+
"destroyOnHidden": true
|
|
60
|
+
}), _isSlot(_slot = renderCell()) ? _slot : { default: () => [_slot] });
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
//#endregion
|
|
65
|
+
export { EllipsisText_default as default };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ScrollBar/Bar.d.ts
|
|
4
|
+
interface BarExpose {
|
|
5
|
+
handleScroll: (wrap: HTMLElement) => void;
|
|
6
|
+
update: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const barProps: {
|
|
9
|
+
readonly always: {
|
|
10
|
+
readonly type: BooleanConstructor;
|
|
11
|
+
readonly default: true;
|
|
12
|
+
};
|
|
13
|
+
readonly minSize: {
|
|
14
|
+
readonly type: NumberConstructor;
|
|
15
|
+
readonly default: 20;
|
|
16
|
+
};
|
|
17
|
+
readonly barStyle: {
|
|
18
|
+
readonly type: () => {
|
|
19
|
+
x: CSSProperties;
|
|
20
|
+
y: CSSProperties;
|
|
21
|
+
};
|
|
22
|
+
readonly default: () => {};
|
|
23
|
+
};
|
|
24
|
+
readonly hasScrollY: {
|
|
25
|
+
readonly type: BooleanConstructor;
|
|
26
|
+
readonly default: false;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
30
|
+
readonly always: {
|
|
31
|
+
readonly type: BooleanConstructor;
|
|
32
|
+
readonly default: true;
|
|
33
|
+
};
|
|
34
|
+
readonly minSize: {
|
|
35
|
+
readonly type: NumberConstructor;
|
|
36
|
+
readonly default: 20;
|
|
37
|
+
};
|
|
38
|
+
readonly barStyle: {
|
|
39
|
+
readonly type: () => {
|
|
40
|
+
x: CSSProperties;
|
|
41
|
+
y: CSSProperties;
|
|
42
|
+
};
|
|
43
|
+
readonly default: () => {};
|
|
44
|
+
};
|
|
45
|
+
readonly hasScrollY: {
|
|
46
|
+
readonly type: BooleanConstructor;
|
|
47
|
+
readonly default: false;
|
|
48
|
+
};
|
|
49
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
|
+
readonly always: {
|
|
51
|
+
readonly type: BooleanConstructor;
|
|
52
|
+
readonly default: true;
|
|
53
|
+
};
|
|
54
|
+
readonly minSize: {
|
|
55
|
+
readonly type: NumberConstructor;
|
|
56
|
+
readonly default: 20;
|
|
57
|
+
};
|
|
58
|
+
readonly barStyle: {
|
|
59
|
+
readonly type: () => {
|
|
60
|
+
x: CSSProperties;
|
|
61
|
+
y: CSSProperties;
|
|
62
|
+
};
|
|
63
|
+
readonly default: () => {};
|
|
64
|
+
};
|
|
65
|
+
readonly hasScrollY: {
|
|
66
|
+
readonly type: BooleanConstructor;
|
|
67
|
+
readonly default: false;
|
|
68
|
+
};
|
|
69
|
+
}>> & Readonly<{}>, {
|
|
70
|
+
readonly always: boolean;
|
|
71
|
+
readonly minSize: number;
|
|
72
|
+
readonly barStyle: {
|
|
73
|
+
x: CSSProperties;
|
|
74
|
+
y: CSSProperties;
|
|
75
|
+
};
|
|
76
|
+
readonly hasScrollY: boolean;
|
|
77
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
78
|
+
//#endregion
|
|
79
|
+
export { BarExpose, barProps, _default as default };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useInjectScrollBarContext } from "./context.js";
|
|
2
|
+
import "./util.js";
|
|
3
|
+
import Thumb_default from "./Thumb.js";
|
|
4
|
+
import { Fragment, createVNode, defineComponent, nextTick, onMounted, ref } from "vue";
|
|
5
|
+
//#region src/components/ScrollBar/Bar.tsx
|
|
6
|
+
const barProps = {
|
|
7
|
+
always: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: true
|
|
10
|
+
},
|
|
11
|
+
minSize: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 20
|
|
14
|
+
},
|
|
15
|
+
barStyle: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
},
|
|
19
|
+
hasScrollY: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var Bar_default = /* @__PURE__ */ defineComponent({
|
|
25
|
+
name: "ScrollBarBar",
|
|
26
|
+
inheritAttrs: false,
|
|
27
|
+
props: barProps,
|
|
28
|
+
setup(props, { expose }) {
|
|
29
|
+
const scrollbar = useInjectScrollBarContext();
|
|
30
|
+
const moveX = ref(0);
|
|
31
|
+
const moveY = ref(0);
|
|
32
|
+
const sizeWidth = ref("");
|
|
33
|
+
const sizeHeight = ref("");
|
|
34
|
+
const ratioY = ref(1);
|
|
35
|
+
const ratioX = ref(1);
|
|
36
|
+
function handleScroll(wrap) {
|
|
37
|
+
if (!wrap) return;
|
|
38
|
+
const offsetHeight = wrap.offsetHeight - 4;
|
|
39
|
+
const offsetWidth = wrap.offsetWidth - 4;
|
|
40
|
+
moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
41
|
+
moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
42
|
+
}
|
|
43
|
+
function update() {
|
|
44
|
+
const wrap = scrollbar?.wrapElement?.value;
|
|
45
|
+
if (!wrap) return;
|
|
46
|
+
const offsetHeight = wrap.offsetHeight - 4;
|
|
47
|
+
const offsetWidth = wrap.offsetWidth - 4;
|
|
48
|
+
const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
|
|
49
|
+
const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
|
|
50
|
+
const height = Math.max(originalHeight, props.minSize);
|
|
51
|
+
const width = Math.max(originalWidth, props.minSize);
|
|
52
|
+
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
|
|
53
|
+
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
|
|
54
|
+
sizeHeight.value = height + 4 < offsetHeight ? `${height}px` : "";
|
|
55
|
+
sizeWidth.value = width + 4 < offsetWidth ? `${width}px` : "";
|
|
56
|
+
}
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
nextTick(() => update());
|
|
59
|
+
});
|
|
60
|
+
expose({
|
|
61
|
+
update,
|
|
62
|
+
handleScroll
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
if (!scrollbar) return null;
|
|
66
|
+
return createVNode(Fragment, null, [createVNode(Thumb_default, {
|
|
67
|
+
"move": moveX.value,
|
|
68
|
+
"barStyle": props.barStyle.x,
|
|
69
|
+
"ratio": ratioX.value,
|
|
70
|
+
"size": sizeWidth.value,
|
|
71
|
+
"always": props.always
|
|
72
|
+
}, null), props.hasScrollY && createVNode(Thumb_default, {
|
|
73
|
+
"move": moveY.value,
|
|
74
|
+
"barStyle": props.barStyle.y,
|
|
75
|
+
"ratio": ratioY.value,
|
|
76
|
+
"size": sizeHeight.value,
|
|
77
|
+
"vertical": true,
|
|
78
|
+
"always": props.always
|
|
79
|
+
}, null)]);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
export { barProps, Bar_default as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ScrollBar/Thumb.d.ts
|
|
4
|
+
declare const thumbProps: {
|
|
5
|
+
readonly vertical: BooleanConstructor;
|
|
6
|
+
readonly size: StringConstructor;
|
|
7
|
+
readonly move: NumberConstructor;
|
|
8
|
+
readonly ratio: {
|
|
9
|
+
readonly type: NumberConstructor;
|
|
10
|
+
readonly required: true;
|
|
11
|
+
};
|
|
12
|
+
readonly always: BooleanConstructor;
|
|
13
|
+
readonly barStyle: {
|
|
14
|
+
readonly type: () => CSSProperties;
|
|
15
|
+
readonly default: () => {};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
19
|
+
readonly vertical: BooleanConstructor;
|
|
20
|
+
readonly size: StringConstructor;
|
|
21
|
+
readonly move: NumberConstructor;
|
|
22
|
+
readonly ratio: {
|
|
23
|
+
readonly type: NumberConstructor;
|
|
24
|
+
readonly required: true;
|
|
25
|
+
};
|
|
26
|
+
readonly always: BooleanConstructor;
|
|
27
|
+
readonly barStyle: {
|
|
28
|
+
readonly type: () => CSSProperties;
|
|
29
|
+
readonly default: () => {};
|
|
30
|
+
};
|
|
31
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
+
readonly vertical: BooleanConstructor;
|
|
33
|
+
readonly size: StringConstructor;
|
|
34
|
+
readonly move: NumberConstructor;
|
|
35
|
+
readonly ratio: {
|
|
36
|
+
readonly type: NumberConstructor;
|
|
37
|
+
readonly required: true;
|
|
38
|
+
};
|
|
39
|
+
readonly always: BooleanConstructor;
|
|
40
|
+
readonly barStyle: {
|
|
41
|
+
readonly type: () => CSSProperties;
|
|
42
|
+
readonly default: () => {};
|
|
43
|
+
};
|
|
44
|
+
}>> & Readonly<{}>, {
|
|
45
|
+
readonly vertical: boolean;
|
|
46
|
+
readonly always: boolean;
|
|
47
|
+
readonly barStyle: CSSProperties;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { _default as default, thumbProps };
|