@creekjs/web-components 1.0.5 → 1.0.6
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/.turbo/turbo-father$colon$build.log +35 -19
- package/README.md +97 -18
- package/dist/creek-config-provider/CreekConfigContext.d.ts +4 -0
- package/dist/creek-config-provider/CreekConfigContext.d.ts.map +1 -1
- package/dist/creek-config-provider/CreekConfigContext.js.map +2 -2
- package/dist/creek-config-provider/CreekI18nProvider.d.ts +22 -0
- package/dist/creek-config-provider/CreekI18nProvider.d.ts.map +1 -0
- package/dist/creek-config-provider/CreekI18nProvider.js +92 -0
- package/dist/creek-config-provider/CreekI18nProvider.js.map +7 -0
- package/dist/creek-config-provider/index.d.ts +5 -3
- package/dist/creek-config-provider/index.d.ts.map +1 -1
- package/dist/creek-config-provider/index.js +47 -4
- package/dist/creek-config-provider/index.js.map +3 -3
- package/dist/creek-hooks/useApp/index.d.ts +3 -3
- package/dist/creek-keep-alive/index.d.ts +24 -1
- package/dist/creek-keep-alive/index.d.ts.map +1 -1
- package/dist/creek-keep-alive/index.js +141 -4
- package/dist/creek-keep-alive/index.js.map +2 -2
- package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +1 -1
- package/dist/creek-layout/ActionRender/FullScreen.js +3 -1
- package/dist/creek-layout/ActionRender/FullScreen.js.map +2 -2
- package/dist/creek-layout/ActionRender/LayoutSettings.d.ts +5 -0
- package/dist/creek-layout/ActionRender/LayoutSettings.d.ts.map +1 -0
- package/dist/creek-layout/ActionRender/LayoutSettings.js +73 -0
- package/dist/creek-layout/ActionRender/LayoutSettings.js.map +7 -0
- package/dist/creek-layout/ActionRender/UserInfo.js.map +2 -2
- package/dist/creek-layout/ActionRender/index.d.ts +1 -0
- package/dist/creek-layout/ActionRender/index.d.ts.map +1 -1
- package/dist/creek-layout/ActionRender/index.js +3 -0
- package/dist/creek-layout/ActionRender/index.js.map +2 -2
- package/dist/creek-layout/index.d.ts +5 -5
- package/dist/creek-layout/index.d.ts.map +1 -1
- package/dist/creek-layout/index.js +79 -16
- package/dist/creek-layout/index.js.map +3 -3
- package/dist/creek-layout/useLayoutSettingsStore.d.ts +20 -0
- package/dist/creek-layout/useLayoutSettingsStore.d.ts.map +1 -0
- package/dist/creek-layout/useLayoutSettingsStore.js +45 -0
- package/dist/creek-layout/useLayoutSettingsStore.js.map +7 -0
- package/dist/creek-locale-button/index.d.ts +1 -0
- package/dist/creek-locale-button/index.d.ts.map +1 -0
- package/dist/creek-locale-button/index.js +66 -0
- package/dist/creek-locale-button/index.js.map +7 -0
- package/dist/creek-page-container/index.d.ts +4 -0
- package/dist/creek-page-container/index.d.ts.map +1 -0
- package/dist/creek-page-container/index.js +68 -0
- package/dist/creek-page-container/index.js.map +7 -0
- package/dist/creek-style/index.d.ts +1 -0
- package/dist/creek-style/index.d.ts.map +1 -0
- package/dist/creek-style/index.js +24 -0
- package/dist/creek-style/index.js.map +7 -0
- package/dist/creek-style/scrollbar.d.ts +2 -0
- package/dist/creek-style/scrollbar.d.ts.map +1 -0
- package/dist/creek-style/scrollbar.js +55 -0
- package/dist/creek-style/scrollbar.js.map +7 -0
- package/dist/creek-table/SearchTable.d.ts +9 -0
- package/dist/creek-table/SearchTable.d.ts.map +1 -1
- package/dist/creek-table/SearchTable.js +109 -72
- package/dist/creek-table/SearchTable.js.map +3 -3
- package/dist/creek-table/components/DensityIcon.d.ts +9 -0
- package/dist/creek-table/components/DensityIcon.d.ts.map +1 -0
- package/dist/creek-table/components/DensityIcon.js +77 -0
- package/dist/creek-table/components/DensityIcon.js.map +7 -0
- package/dist/creek-table/components/EllipsisTooltip.d.ts +9 -0
- package/dist/creek-table/components/EllipsisTooltip.d.ts.map +1 -0
- package/dist/creek-table/components/EllipsisTooltip.js +122 -0
- package/dist/creek-table/components/EllipsisTooltip.js.map +7 -0
- package/dist/creek-table/components/index.d.ts +2 -0
- package/dist/creek-table/components/index.d.ts.map +1 -0
- package/dist/creek-table/components/index.js +26 -0
- package/dist/creek-table/components/index.js.map +7 -0
- package/dist/creek-table/hooks/index.d.ts +5 -0
- package/dist/creek-table/hooks/index.d.ts.map +1 -1
- package/dist/creek-table/hooks/index.js +10 -0
- package/dist/creek-table/hooks/index.js.map +2 -2
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +1 -1
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +1 -1
- package/dist/creek-table/hooks/useAutoWidthColumns.js +76 -17
- package/dist/creek-table/hooks/useAutoWidthColumns.js.map +2 -2
- package/dist/creek-table/hooks/useEllipsisColumns.d.ts +8 -0
- package/dist/creek-table/hooks/useEllipsisColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useEllipsisColumns.js +58 -0
- package/dist/creek-table/hooks/useEllipsisColumns.js.map +7 -0
- package/dist/creek-table/hooks/useIndexColumn.d.ts +2 -0
- package/dist/creek-table/hooks/useIndexColumn.d.ts.map +1 -0
- package/dist/creek-table/hooks/useIndexColumn.js +52 -0
- package/dist/creek-table/hooks/useIndexColumn.js.map +7 -0
- package/dist/creek-table/hooks/useResizableColumns.d.ts +20 -0
- package/dist/creek-table/hooks/useResizableColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useResizableColumns.js +279 -0
- package/dist/creek-table/hooks/useResizableColumns.js.map +7 -0
- package/dist/creek-table/hooks/useStatusColumns.d.ts +2 -0
- package/dist/creek-table/hooks/useStatusColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useStatusColumns.js +215 -0
- package/dist/creek-table/hooks/useStatusColumns.js.map +7 -0
- package/dist/creek-table/hooks/useTableOptions.d.ts +15 -0
- package/dist/creek-table/hooks/useTableOptions.d.ts.map +1 -0
- package/dist/creek-table/hooks/useTableOptions.js +78 -0
- package/dist/creek-table/hooks/useTableOptions.js.map +7 -0
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts +6 -1
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +1 -1
- package/dist/creek-table/hooks/useTableScrollHeight.js +44 -5
- package/dist/creek-table/hooks/useTableScrollHeight.js.map +2 -2
- package/dist/creek-table/type.d.ts +4 -6
- package/dist/creek-table/type.d.ts.map +1 -1
- package/dist/creek-table/type.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +2 -2
- package/dist/locales/en-US.d.ts +25 -0
- package/dist/locales/en-US.d.ts.map +1 -0
- package/dist/locales/en-US.js +49 -0
- package/dist/locales/en-US.js.map +7 -0
- package/dist/locales/zh-CN.d.ts +25 -0
- package/dist/locales/zh-CN.d.ts.map +1 -0
- package/dist/locales/zh-CN.js +49 -0
- package/dist/locales/zh-CN.js.map +7 -0
- package/dist/utils/i18n.d.ts +2 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +34 -0
- package/dist/utils/i18n.js.map +7 -0
- package/i18n.config.ts +27 -0
- package/package.json +17 -3
- package/src/creek-config-provider/CreekConfigContext.tsx +5 -1
- package/src/creek-config-provider/CreekI18nProvider.tsx +87 -0
- package/src/creek-config-provider/index.tsx +53 -4
- package/src/creek-keep-alive/index.tsx +225 -6
- package/src/creek-layout/ActionRender/FullScreen.tsx +10 -6
- package/src/creek-layout/ActionRender/LayoutSettings.tsx +67 -0
- package/src/creek-layout/ActionRender/UserInfo.tsx +1 -1
- package/src/creek-layout/ActionRender/index.tsx +1 -0
- package/src/creek-layout/index.tsx +89 -22
- package/src/creek-layout/useLayoutSettingsStore.ts +25 -0
- package/src/creek-locale-button/index.tsx +42 -0
- package/src/creek-page-container/index.tsx +32 -0
- package/src/creek-style/index.ts +1 -0
- package/src/creek-style/scrollbar.ts +29 -0
- package/src/creek-table/SearchTable.tsx +125 -72
- package/src/creek-table/components/DensityIcon.tsx +63 -0
- package/src/creek-table/components/EllipsisTooltip.tsx +116 -0
- package/src/creek-table/components/index.tsx +3 -0
- package/src/creek-table/hooks/index.ts +5 -1
- package/src/creek-table/hooks/useAutoWidthColumns.tsx +93 -19
- package/src/creek-table/hooks/useEllipsisColumns.tsx +47 -0
- package/src/creek-table/hooks/useIndexColumn.tsx +27 -0
- package/src/creek-table/hooks/useResizableColumns.tsx +323 -0
- package/src/creek-table/hooks/useStatusColumns.tsx +252 -0
- package/src/creek-table/hooks/useTableOptions.tsx +81 -0
- package/src/creek-table/hooks/useTableScrollHeight.tsx +61 -6
- package/src/creek-table/type.ts +5 -7
- package/src/index.tsx +4 -0
- package/src/locales/en-US.ts +24 -0
- package/src/locales/zh-CN.ts +24 -0
- package/src/utils/i18n.ts +4 -0
- package/dist/creek-table/TableOptionRender.d.ts +0 -9
- package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
- package/dist/creek-table/TableOptionRender.js +0 -74
- package/dist/creek-table/TableOptionRender.js.map +0 -7
- package/dist/creek-table/toolBarRender.d.ts +0 -5
- package/dist/creek-table/toolBarRender.d.ts.map +0 -1
- package/dist/creek-table/toolBarRender.js +0 -58
- package/dist/creek-table/toolBarRender.js.map +0 -7
- package/src/creek-table/TableOptionRender.tsx +0 -57
- package/src/creek-table/toolBarRender.tsx +0 -28
|
@@ -33,90 +33,127 @@ __export(SearchTable_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(SearchTable_exports);
|
|
35
35
|
var import_pro_components = require("@ant-design/pro-components");
|
|
36
|
-
var
|
|
36
|
+
var import_ahooks = require("ahooks");
|
|
37
37
|
var import_antd_style = require("antd-style");
|
|
38
38
|
var import_classnames = __toESM(require("classnames"));
|
|
39
|
-
var import_lodash = __toESM(require("lodash"));
|
|
40
39
|
var import_react = require("react");
|
|
40
|
+
var import_creek_style = require("../creek-style");
|
|
41
41
|
var import_hooks = require("./hooks");
|
|
42
|
-
var import_TableOptionRender = require("./TableOptionRender");
|
|
43
|
-
var import_toolBarRender = require("./toolBarRender");
|
|
44
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var useStyles = (0, import_antd_style.createStyles)(({
|
|
43
|
+
var useStyles = (0, import_antd_style.createStyles)(({ token }, options) => {
|
|
44
|
+
const { prefixCls = "ant", scrollY, tableHeight, bordered, hasHeaderTitle, tableContainerHeight, hasScroll } = options;
|
|
46
45
|
return {
|
|
47
|
-
"creek-table-container":
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
46
|
+
"creek-table-container": {
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
position: "relative",
|
|
49
|
+
height: tableHeight ? `${tableHeight}px` : "auto",
|
|
50
|
+
backgroundColor: token.colorBgContainer,
|
|
51
|
+
[`.${prefixCls}-table`]: {
|
|
52
|
+
minHeight: `${tableContainerHeight}px`
|
|
53
|
+
},
|
|
54
|
+
[`.${prefixCls}-table-container`]: {
|
|
55
|
+
borderBottom: "none",
|
|
56
|
+
overflow: "hidden"
|
|
57
|
+
},
|
|
58
|
+
[`.${prefixCls}-table-header`]: {
|
|
59
|
+
borderRight: bordered && hasScroll ? `1px solid ${token.colorBorderSecondary}` : "none"
|
|
60
|
+
},
|
|
61
|
+
[`.${prefixCls}-table-body`]: {
|
|
62
|
+
overflowY: "auto",
|
|
63
|
+
maxHeight: `${scrollY}px`,
|
|
64
|
+
borderRight: bordered && hasScroll ? `1px solid ${token.colorBorderSecondary}` : "none"
|
|
65
|
+
},
|
|
66
|
+
// 兼容非 scroll.y 模式下的 table 容器
|
|
67
|
+
[`.${prefixCls}-table-content`]: {
|
|
68
|
+
overflowY: "hidden",
|
|
69
|
+
maxHeight: scrollY ? `${scrollY}px` : void 0
|
|
70
|
+
},
|
|
71
|
+
[`.${prefixCls}-table-cell-scrollbar`]: {
|
|
72
|
+
boxShadow: bordered ? "none!important" : "inherit",
|
|
73
|
+
borderInlineEnd: bordered ? `none!important` : "none",
|
|
74
|
+
display: hasScroll ? "table-cell" : "none",
|
|
75
|
+
width: hasScroll ? "initial" : "0px!important",
|
|
76
|
+
minWidth: hasScroll ? "initial" : "0px!important",
|
|
77
|
+
maxWidth: hasScroll ? "initial" : "0px!important",
|
|
78
|
+
padding: hasScroll ? "initial" : "0px!important",
|
|
79
|
+
margin: hasScroll ? "initial" : "0px!important"
|
|
80
|
+
},
|
|
81
|
+
[`.${prefixCls}-pagination`]: {
|
|
82
|
+
[`.${prefixCls}-pagination-total-text`]: {
|
|
83
|
+
flex: 1
|
|
81
84
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
85
|
+
},
|
|
86
|
+
[`.${prefixCls}-pro-table-search`]: {
|
|
87
|
+
marginBlockEnd: 0,
|
|
88
|
+
borderBottom: `1px solid ${token.colorBorderSecondary}`
|
|
89
|
+
},
|
|
90
|
+
[`.${prefixCls}-pro-query-filter-container`]: {
|
|
91
|
+
[`.${prefixCls}-pro-query-filter`]: {
|
|
92
|
+
padding: token.paddingXS
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
// 如果没有 headerTitle,toolbar 展示在 headerTitle 的区域
|
|
96
|
+
[`.${prefixCls}-pro-table-list-toolbar-right`]: !hasHeaderTitle ? {
|
|
97
|
+
flex: 1
|
|
98
|
+
} : {},
|
|
99
|
+
[`.${prefixCls}-pro-table-list-toolbar-setting-items`]: !hasHeaderTitle ? {
|
|
100
|
+
marginLeft: "auto"
|
|
101
|
+
} : {}
|
|
102
|
+
}
|
|
84
103
|
};
|
|
85
104
|
});
|
|
86
105
|
var SearchProTable = (props) => {
|
|
87
|
-
var _a;
|
|
88
|
-
const {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const {
|
|
108
|
+
columns,
|
|
109
|
+
prefixCls = "ant",
|
|
110
|
+
className,
|
|
111
|
+
optionsRender,
|
|
112
|
+
tableViewRender,
|
|
113
|
+
pagination,
|
|
114
|
+
pageFixedBottom = true,
|
|
115
|
+
pageFixedBottomConfig,
|
|
116
|
+
resizable = true,
|
|
117
|
+
bordered = true,
|
|
118
|
+
options,
|
|
119
|
+
size,
|
|
120
|
+
headerTitle,
|
|
121
|
+
showIndex = true,
|
|
122
|
+
...restProps
|
|
123
|
+
} = props;
|
|
89
124
|
const proTableRef = (0, import_react.useRef)(null);
|
|
90
|
-
const
|
|
91
|
-
const {
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
const [resizedWidths, setResizedWidths] = (0, import_ahooks.useSafeState)({});
|
|
126
|
+
const { finalOptions, tableSize, finalOptionsRender } = (0, import_hooks.useTableOptions)(options, size, optionsRender);
|
|
127
|
+
const columnsWithIndex = (0, import_hooks.useIndexColumn)(columns, showIndex);
|
|
128
|
+
const processedColumns = (0, import_hooks.useEllipsisColumns)(columnsWithIndex);
|
|
129
|
+
const { columns: adaptiveColumns, totalWidth } = (0, import_hooks.useAutoWidthColumns)(processedColumns, proTableRef, resizedWidths, bordered, tableSize);
|
|
130
|
+
const { columns: resizableColumns, components } = (0, import_hooks.useResizableColumns)(adaptiveColumns, resizable, resizedWidths, setResizedWidths, proTableRef);
|
|
131
|
+
const { scrollY, tableHeight, tableContainerHeight, hasScroll } = (0, import_hooks.useTableScrollHeight)(prefixCls, proTableRef, pageFixedBottom, pageFixedBottomConfig == null ? void 0 : pageFixedBottomConfig.bottomFix);
|
|
132
|
+
const { styles } = useStyles({ scrollY, tableHeight, prefixCls, bordered, hasHeaderTitle: !!headerTitle, tableContainerHeight, hasScroll });
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: proTableRef, children: [
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_creek_style.GlobalScrollbarStyle, {}),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
+
import_pro_components.ProTable,
|
|
137
|
+
{
|
|
138
|
+
components,
|
|
139
|
+
headerTitle,
|
|
140
|
+
options: finalOptions,
|
|
141
|
+
optionsRender: finalOptionsRender,
|
|
142
|
+
size: tableSize,
|
|
143
|
+
...restProps,
|
|
144
|
+
className: (0, import_classnames.default)(styles["creek-table-container"], className),
|
|
145
|
+
columns: resizableColumns,
|
|
146
|
+
bordered,
|
|
147
|
+
scroll: {
|
|
148
|
+
y: hasScroll ? scrollY || ((_a = restProps.scroll) == null ? void 0 : _a.y) : void 0,
|
|
149
|
+
x: totalWidth ?? ((_b = restProps.scroll) == null ? void 0 : _b.x)
|
|
150
|
+
},
|
|
151
|
+
toolbar: {
|
|
152
|
+
...restProps.toolbar
|
|
153
|
+
}
|
|
117
154
|
}
|
|
118
|
-
|
|
119
|
-
|
|
155
|
+
)
|
|
156
|
+
] });
|
|
120
157
|
};
|
|
121
158
|
// Annotate the CommonJS export names for ESM import in node:
|
|
122
159
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/creek-table/SearchTable.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ParamsType, ProTable } from '@ant-design/pro-components';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAqC;AACrC,
|
|
6
|
-
"names": ["classnames"
|
|
4
|
+
"sourcesContent": ["import { ParamsType, ProTable } from '@ant-design/pro-components';\nimport { useSafeState } from 'ahooks';\nimport { createStyles } from 'antd-style';\nimport classnames from 'classnames';\nimport { useRef } from 'react';\n\nimport { GlobalScrollbarStyle } from '../creek-style';\nimport { useAutoWidthColumns, useEllipsisColumns, useIndexColumn, useResizableColumns, useTableOptions, useTableScrollHeight } from './hooks';\n\nimport { CreekTableProps } from './type';\n\nexport type SearchTableStyleOptions = {\n prefixCls?: string;\n scrollY?: number;\n tableContainerHeight?: number;\n tableHeight?: number;\n bordered?: boolean;\n hasHeaderTitle?: boolean;\n hasScroll?: boolean;\n};\n\nconst useStyles = createStyles(({ token }, options: SearchTableStyleOptions) => {\n const { prefixCls = 'ant', scrollY, tableHeight, bordered, hasHeaderTitle, tableContainerHeight, hasScroll } = options;\n return {\n 'creek-table-container': {\n overflow: 'hidden',\n position: 'relative',\n height: tableHeight ? `${tableHeight}px` : 'auto',\n backgroundColor: token.colorBgContainer,\n [`.${prefixCls}-table`]: {\n minHeight: `${tableContainerHeight}px`,\n },\n [`.${prefixCls}-table-container`]: {\n borderBottom: 'none',\n overflow: 'hidden'\n },\n \n [`.${prefixCls}-table-header`]: {\n borderRight: (bordered && hasScroll) ? `1px solid ${token.colorBorderSecondary}` : 'none',\n },\n [`.${prefixCls}-table-body`]: {\n overflowY: 'auto',\n maxHeight: `${scrollY}px`,\n borderRight: (bordered && hasScroll) ? `1px solid ${token.colorBorderSecondary}` : 'none',\n },\n // 兼容非 scroll.y 模式下的 table 容器\n [`.${prefixCls}-table-content`]: {\n overflowY: 'hidden',\n maxHeight: scrollY ? `${scrollY}px` : undefined,\n },\n\n [`.${prefixCls}-table-cell-scrollbar`]: {\n boxShadow: bordered ? 'none!important' : 'inherit',\n borderInlineEnd: bordered ? `none!important` : 'none',\n display: hasScroll ? 'table-cell' : 'none',\n width: hasScroll ? 'initial' : '0px!important',\n minWidth: hasScroll ? 'initial' : '0px!important',\n maxWidth: hasScroll ? 'initial' : '0px!important',\n padding: hasScroll ? 'initial' : '0px!important',\n margin: hasScroll ? 'initial' : '0px!important',\n },\n\n [`.${prefixCls}-pagination`]: {\n [`.${prefixCls}-pagination-total-text`]: {\n flex: 1,\n },\n },\n [`.${prefixCls}-pro-table-search`]: {\n marginBlockEnd: 0,\n borderBottom: `1px solid ${token.colorBorderSecondary}`,\n },\n\n [`.${prefixCls}-pro-query-filter-container`]: {\n [`.${prefixCls}-pro-query-filter`]: {\n padding: token.paddingXS,\n },\n },\n\n // 如果没有 headerTitle,toolbar 展示在 headerTitle 的区域\n [`.${prefixCls}-pro-table-list-toolbar-right`]: !hasHeaderTitle\n ? {\n flex: 1,\n }\n : {},\n [`.${prefixCls}-pro-table-list-toolbar-setting-items`]: !hasHeaderTitle\n ? {\n marginLeft: 'auto',\n }\n : {},\n },\n };\n});\n\n// 独立的 ProTable 组件\nexport const SearchProTable = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {\n const {\n columns,\n prefixCls = 'ant',\n className,\n optionsRender,\n tableViewRender,\n pagination,\n pageFixedBottom = true,\n pageFixedBottomConfig,\n resizable = true,\n bordered = true,\n options,\n size,\n headerTitle,\n showIndex = true,\n ...restProps\n } = props;\n\n const proTableRef = useRef<HTMLDivElement>(null);\n\n // 状态提升:管理列宽调整状态,以便 useAutoWidthColumns 能感知到\n const [resizedWidths, setResizedWidths] = useSafeState<Record<string, number>>({});\n\n // 使用自定义 Hook 管理 options 和 size\n const { finalOptions, tableSize, finalOptionsRender } = useTableOptions<T, U, ValueType>(options, size, optionsRender);\n\n const columnsWithIndex = useIndexColumn<T, ValueType>(columns, showIndex);\n\n // 处理 columns,默认开启 ellipsis\n const processedColumns = useEllipsisColumns(columnsWithIndex);\n\n const { columns: adaptiveColumns, totalWidth } = useAutoWidthColumns<T, ValueType>(processedColumns, proTableRef, resizedWidths, bordered, tableSize);\n\n const { columns: resizableColumns, components } = useResizableColumns<T, ValueType>(adaptiveColumns, resizable, resizedWidths, setResizedWidths, proTableRef);\n\n const { scrollY, tableHeight, tableContainerHeight, hasScroll } = useTableScrollHeight(prefixCls, proTableRef, pageFixedBottom, pageFixedBottomConfig?.bottomFix);\n\n const { styles } = useStyles({ scrollY, tableHeight, prefixCls, bordered, hasHeaderTitle: !!headerTitle, tableContainerHeight, hasScroll });\n\n\n return (\n <div ref={proTableRef}>\n <GlobalScrollbarStyle />\n {/* 自定义滚动条 */}\n <ProTable<T, U, ValueType>\n components={components}\n headerTitle={headerTitle}\n options={finalOptions}\n optionsRender={finalOptionsRender}\n size={tableSize}\n {...restProps}\n className={classnames(styles['creek-table-container'], className)}\n columns={resizableColumns}\n bordered={bordered}\n scroll={{\n y: hasScroll ? scrollY || restProps.scroll?.y : undefined,\n x: totalWidth ?? restProps.scroll?.x,\n }}\n toolbar={{\n ...restProps.toolbar,\n }}\n />\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAqC;AACrC,oBAA6B;AAC7B,wBAA6B;AAC7B,wBAAuB;AACvB,mBAAuB;AAEvB,yBAAqC;AACrC,mBAAoI;AAiIhI;AAnHJ,IAAM,gBAAY,gCAAa,CAAC,EAAE,MAAM,GAAG,YAAqC;AAC9E,QAAM,EAAE,YAAY,OAAO,SAAS,aAAa,UAAU,gBAAgB,sBAAsB,UAAU,IAAI;AAC/G,SAAO;AAAA,IACL,yBAAyB;AAAA,MACvB,UAAU;AAAA,MACV,UAAU;AAAA,MACV,QAAQ,cAAc,GAAG,kBAAkB;AAAA,MAC3C,iBAAiB,MAAM;AAAA,MACvB,CAAC,IAAI,iBAAiB,GAAG;AAAA,QACvB,WAAW,GAAG;AAAA,MAChB;AAAA,MACA,CAAC,IAAI,2BAA2B,GAAG;AAAA,QACjC,cAAc;AAAA,Q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,eAAU,WAAV,mBAAkB,KAAI;AAAA,UAChD,GAAG,gBAAc,eAAU,WAAV,mBAAkB;AAAA,QACrC;AAAA,QACA,SAAS;AAAA,UACP,GAAG,UAAU;AAAA,QACf;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;",
|
|
6
|
+
"names": ["classnames"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProTableProps } from '@ant-design/pro-components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type SizeType = ProTableProps<any, any>['size'];
|
|
4
|
+
interface DensityIconProps {
|
|
5
|
+
tableSize: SizeType;
|
|
6
|
+
setTableSize: (size: SizeType) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const DensityIcon: React.FC<DensityIconProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DensityIcon.d.ts","sourceRoot":"","sources":["../../../src/creek-table/components/DensityIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,UAAU,gBAAgB;IACxB,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAgDlD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/creek-table/components/DensityIcon.tsx
|
|
20
|
+
var DensityIcon_exports = {};
|
|
21
|
+
__export(DensityIcon_exports, {
|
|
22
|
+
DensityIcon: () => DensityIcon
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(DensityIcon_exports);
|
|
25
|
+
var import_icons = require("@ant-design/icons");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var import_i18n = require("../../utils/i18n");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var DensityIcon = ({ tableSize, setTableSize }) => {
|
|
30
|
+
const t = (0, import_i18n.useT)();
|
|
31
|
+
const items = [
|
|
32
|
+
{
|
|
33
|
+
key: "large",
|
|
34
|
+
label: t("creek-table.components.DensityIcon.kuanSong", "宽松"),
|
|
35
|
+
onClick: () => setTableSize("large")
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "middle",
|
|
39
|
+
label: t("creek-table.components.DensityIcon.zhongDeng", "中等"),
|
|
40
|
+
onClick: () => setTableSize("middle")
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "small",
|
|
44
|
+
label: t("creek-table.components.DensityIcon.jinCou", "紧凑"),
|
|
45
|
+
onClick: () => setTableSize("small")
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
const getTitle = () => {
|
|
49
|
+
switch (tableSize) {
|
|
50
|
+
case "large":
|
|
51
|
+
return t("creek-table.components.DensityIcon.biaoGeMiDu(KuanSong)", "表格密度 (宽松)");
|
|
52
|
+
case "middle":
|
|
53
|
+
return t("creek-table.components.DensityIcon.biaoGeMiDu(ZhongDeng)", "表格密度 (中等)");
|
|
54
|
+
case "small":
|
|
55
|
+
return t("creek-table.components.DensityIcon.biaoGeMiDu(JinCou)", "表格密度 (紧凑)");
|
|
56
|
+
default:
|
|
57
|
+
return t("creek-table.components.DensityIcon.biaoGeMiDu", "表格密度");
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_antd.Dropdown,
|
|
62
|
+
{
|
|
63
|
+
menu: {
|
|
64
|
+
items,
|
|
65
|
+
selectedKeys: [tableSize || "large"],
|
|
66
|
+
selectable: true
|
|
67
|
+
},
|
|
68
|
+
trigger: ["click"],
|
|
69
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Tooltip, { title: getTitle(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ColumnHeightOutlined, { style: { fontSize: 16, cursor: "pointer" } }) })
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
DensityIcon
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=DensityIcon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-table/components/DensityIcon.tsx"],
|
|
4
|
+
"sourcesContent": ["import { ColumnHeightOutlined } from '@ant-design/icons';\nimport { ProTableProps } from '@ant-design/pro-components';\nimport { Dropdown, MenuProps, Tooltip } from 'antd';\nimport React from 'react';\n\nimport { useT } from '@/utils/i18n';\n\nexport type SizeType = ProTableProps<any, any>['size'];\n\ninterface DensityIconProps {\n tableSize: SizeType;\n setTableSize: (size: SizeType) => void;\n}\n\nexport const DensityIcon: React.FC<DensityIconProps> = ({ tableSize, setTableSize }) => {\n const t = useT();\n\n const items: MenuProps['items'] = [\n {\n key: 'large',\n label: t('creek-table.components.DensityIcon.kuanSong', '宽松'),\n onClick: () => setTableSize('large'),\n },\n {\n key: 'middle',\n label: t('creek-table.components.DensityIcon.zhongDeng', '中等'),\n onClick: () => setTableSize('middle'),\n },\n {\n key: 'small',\n label: t('creek-table.components.DensityIcon.jinCou', '紧凑'),\n onClick: () => setTableSize('small'),\n },\n ];\n\n const getTitle = () => {\n switch (tableSize) {\n case 'large':\n return t('creek-table.components.DensityIcon.biaoGeMiDu(KuanSong)', '表格密度 (宽松)');\n case 'middle':\n return t('creek-table.components.DensityIcon.biaoGeMiDu(ZhongDeng)', '表格密度 (中等)');\n case 'small':\n return t('creek-table.components.DensityIcon.biaoGeMiDu(JinCou)', '表格密度 (紧凑)');\n default:\n return t('creek-table.components.DensityIcon.biaoGeMiDu', '表格密度');\n }\n };\n\n return (\n <Dropdown\n menu={{\n items,\n selectedKeys: [tableSize || 'large'],\n selectable: true,\n }}\n trigger={['click']}\n >\n <Tooltip title={getTitle()}>\n <ColumnHeightOutlined style={{ fontSize: 16, cursor: 'pointer' }} />\n </Tooltip>\n </Dropdown>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AAErC,kBAA6C;AAG7C,kBAAqB;AAqDb;AA5CD,IAAM,cAA0C,CAAC,EAAE,WAAW,aAAa,MAAM;AACtF,QAAM,QAAI,kBAAK;AAEf,QAAM,QAA4B;AAAA,IAChC;AAAA,MACE,KAAK;AAAA,MACL,OAAO,EAAE,+CAA+C,IAAI;AAAA,MAC5D,SAAS,MAAM,aAAa,OAAO;AAAA,IACrC;AAAA,IACA;AAAA,MACE,KAAK;AAAA,MACL,OAAO,EAAE,gDAAgD,IAAI;AAAA,MAC7D,SAAS,MAAM,aAAa,QAAQ;AAAA,IACtC;AAAA,IACA;AAAA,MACE,KAAK;AAAA,MACL,OAAO,EAAE,6CAA6C,IAAI;AAAA,MAC1D,SAAS,MAAM,aAAa,OAAO;AAAA,IACrC;AAAA,EACF;AAEA,QAAM,WAAW,MAAM;AACrB,YAAQ,WAAW;AAAA,MACjB,KAAK;AACH,eAAO,EAAE,2DAA2D,WAAW;AAAA,MACjF,KAAK;AACH,eAAO,EAAE,4DAA4D,WAAW;AAAA,MAClF,KAAK;AACH,eAAO,EAAE,yDAAyD,WAAW;AAAA,MAC/E;AACE,eAAO,EAAE,iDAAiD,MAAM;AAAA,IACpE;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,QACJ;AAAA,QACA,cAAc,CAAC,aAAa,OAAO;AAAA,QACnC,YAAY;AAAA,MACd;AAAA,MACA,SAAS,CAAC,OAAO;AAAA,MAEjB,sDAAC,uBAAQ,OAAO,SAAS,GACvB,sDAAC,qCAAqB,OAAO,EAAE,UAAU,IAAI,QAAQ,UAAU,GAAG,GACpE;AAAA;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 使用 Antd Typography 组件实现省略提示
|
|
4
|
+
* 修复了 findDOMNode 警告问题:通过显式使用 Tooltip 包裹 div 容器
|
|
5
|
+
* 实现了智能提示:只有内容实际溢出时才显示 Tooltip
|
|
6
|
+
*/
|
|
7
|
+
export declare const EllipsisTooltip: ({ children }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EllipsisTooltip.d.ts","sourceRoot":"","sources":["../../../src/creek-table/components/EllipsisTooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAmCvE;;;;GAIG;AACH,eAAO,MAAM,eAAe;cAA8B,MAAM,SAAS;6CAwExE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/creek-table/components/EllipsisTooltip.tsx
|
|
30
|
+
var EllipsisTooltip_exports = {};
|
|
31
|
+
__export(EllipsisTooltip_exports, {
|
|
32
|
+
EllipsisTooltip: () => EllipsisTooltip
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(EllipsisTooltip_exports);
|
|
35
|
+
var import_icons = require("@ant-design/icons");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_antd_style = require("antd-style");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_i18n = require("../../utils/i18n");
|
|
40
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, token }) => {
|
|
42
|
+
return {
|
|
43
|
+
text: css`
|
|
44
|
+
width: 100%;
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: 0;
|
|
47
|
+
// Ensure the wrapper behaves like a block/inline-block that can have width
|
|
48
|
+
display: block;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
`,
|
|
51
|
+
tooltipContent: css`
|
|
52
|
+
max-width: 500px;
|
|
53
|
+
max-height: 300px;
|
|
54
|
+
overflow-y: auto;
|
|
55
|
+
`,
|
|
56
|
+
tooltipText: css`
|
|
57
|
+
word-break: break-all;
|
|
58
|
+
white-space: pre-wrap;
|
|
59
|
+
`,
|
|
60
|
+
copyIcon: css`
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
color: inherit;
|
|
63
|
+
transition: color 0.2s;
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
color: ${token.colorPrimary};
|
|
67
|
+
}
|
|
68
|
+
`
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
var EllipsisTooltip = ({ children }) => {
|
|
72
|
+
const t = (0, import_i18n.useT)();
|
|
73
|
+
const { styles } = useStyles();
|
|
74
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
75
|
+
const textRef = (0, import_react.useRef)(null);
|
|
76
|
+
const [isEllipsis, setIsEllipsis] = (0, import_react.useState)(false);
|
|
77
|
+
const isSimpleContent = typeof children === "string" || typeof children === "number";
|
|
78
|
+
(0, import_react.useEffect)(() => {
|
|
79
|
+
const checkEllipsis = () => {
|
|
80
|
+
if (textRef.current) {
|
|
81
|
+
const prefixCls = getPrefixCls("typography");
|
|
82
|
+
const typographyEl = textRef.current.querySelector(`.${prefixCls}`);
|
|
83
|
+
if (typographyEl) {
|
|
84
|
+
setIsEllipsis(typographyEl.scrollWidth > typographyEl.clientWidth + 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
checkEllipsis();
|
|
89
|
+
const observer = new ResizeObserver(checkEllipsis);
|
|
90
|
+
if (textRef.current) {
|
|
91
|
+
observer.observe(textRef.current);
|
|
92
|
+
}
|
|
93
|
+
return () => {
|
|
94
|
+
observer.disconnect();
|
|
95
|
+
};
|
|
96
|
+
}, [children]);
|
|
97
|
+
const text = String(children);
|
|
98
|
+
const handleCopy = (e) => {
|
|
99
|
+
e.stopPropagation();
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
102
|
+
import_antd.message.success(t("creek-table.components.EllipsisTooltip.fuZhiChengGong", "复制成功"));
|
|
103
|
+
}).catch(() => {
|
|
104
|
+
import_antd.message.error(t("creek-table.components.EllipsisTooltip.fuZhiShiBai", "复制失败"));
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const tooltipTitle = import_react.default.useMemo(() => {
|
|
108
|
+
if (!isSimpleContent) {
|
|
109
|
+
return children;
|
|
110
|
+
}
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Flex, { align: "center", gap: 8, className: styles.tooltipContent, children: [
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.tooltipText, children }),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CopyOutlined, { onClick: handleCopy, className: styles.copyIcon, title: t("creek-table.components.EllipsisTooltip.fuZhi", "复制") })
|
|
114
|
+
] });
|
|
115
|
+
}, [children, isSimpleContent]);
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Tooltip, { title: isEllipsis ? tooltipTitle : void 0, placement: "topLeft", mouseLeaveDelay: 0.2, getPopupContainer: () => document.body, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: textRef, className: styles.text, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, { ellipsis: true, children }) }) });
|
|
117
|
+
};
|
|
118
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
+
0 && (module.exports = {
|
|
120
|
+
EllipsisTooltip
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=EllipsisTooltip.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-table/components/EllipsisTooltip.tsx"],
|
|
4
|
+
"sourcesContent": ["import { CopyOutlined } from '@ant-design/icons';\nimport { ConfigProvider, Flex, Tooltip, Typography, message } from 'antd';\nimport { createStyles } from 'antd-style';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport { useT } from '@/utils/i18n';\n\nconst useStyles = createStyles(({ css, token }) => {\n return {\n text: css`\n width: 100%;\n margin: 0;\n padding: 0;\n // Ensure the wrapper behaves like a block/inline-block that can have width\n display: block;\n overflow: hidden;\n `,\n tooltipContent: css`\n max-width: 500px;\n max-height: 300px;\n overflow-y: auto;\n `,\n tooltipText: css`\n word-break: break-all;\n white-space: pre-wrap;\n `,\n copyIcon: css`\n cursor: pointer;\n color: inherit;\n transition: color 0.2s;\n\n &:hover {\n color: ${token.colorPrimary};\n }\n `,\n };\n});\n\n/**\n * 使用 Antd Typography 组件实现省略提示\n * 修复了 findDOMNode 警告问题:通过显式使用 Tooltip 包裹 div 容器\n * 实现了智能提示:只有内容实际溢出时才显示 Tooltip\n */\nexport const EllipsisTooltip = ({ children }: { children: React.ReactNode }) => {\n const t = useT();\n\n const { styles } = useStyles();\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const textRef = useRef<HTMLDivElement>(null);\n const [isEllipsis, setIsEllipsis] = useState(false);\n const isSimpleContent = typeof children === 'string' || typeof children === 'number';\n\n useEffect(() => {\n const checkEllipsis = () => {\n if (textRef.current) {\n const prefixCls = getPrefixCls('typography');\n // Typography.Text renders a span or div with .ant-typography\n const typographyEl = textRef.current.querySelector(`.${prefixCls}`);\n if (typographyEl) {\n // For simple ellipsis={true}, Antd uses CSS ellipsis.\n // We can detect if it's truncated by comparing scrollWidth and clientWidth\n // We add a small buffer (1px) for browser sub-pixel rendering differences\n setIsEllipsis(typographyEl.scrollWidth > typographyEl.clientWidth + 1);\n }\n }\n };\n\n // Initial check\n checkEllipsis();\n // Use ResizeObserver for more robust size change detection\n const observer = new ResizeObserver(checkEllipsis);\n if (textRef.current) {\n observer.observe(textRef.current);\n }\n\n return () => {\n observer.disconnect();\n };\n }, [children]);\n\n const text = String(children);\n\n const handleCopy = (e: React.MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n navigator.clipboard\n .writeText(text)\n .then(() => {\n message.success(t('creek-table.components.EllipsisTooltip.fuZhiChengGong', '复制成功'));\n })\n .catch(() => {\n message.error(t('creek-table.components.EllipsisTooltip.fuZhiShiBai', '复制失败'));\n });\n };\n\n // Memoize tooltip title content\n const tooltipTitle = React.useMemo(() => {\n if (!isSimpleContent) {\n return children;\n }\n return (\n <Flex align=\"center\" gap={8} className={styles.tooltipContent}>\n <span className={styles.tooltipText}>{children}</span>\n <CopyOutlined onClick={handleCopy} className={styles.copyIcon} title={t('creek-table.components.EllipsisTooltip.fuZhi', '复制')} />\n </Flex>\n );\n }, [children, isSimpleContent]);\n\n return (\n <Tooltip title={isEllipsis ? tooltipTitle : undefined} placement=\"topLeft\" mouseLeaveDelay={0.2} getPopupContainer={() => document.body}>\n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EA,WAAO,MAAM;AACX,eAAS,WAAW;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,OAAO,OAAO,QAAQ;AAE5B,QAAM,aAAa,CAAC,MAAwB;AAC1C,MAAE,gBAAgB;AAClB,MAAE,eAAe;AACjB,cAAU,UACP,UAAU,IAAI,EACd,KAAK,MAAM;AACV,0BAAQ,QAAQ,EAAE,yDAAyD,MAAM,CAAC;AAAA,IACpF,CAAC,EACA,MAAM,MAAM;AACX,0BAAQ,MAAM,EAAE,sDAAsD,MAAM,CAAC;AAAA,IAC/E,CAAC;AAAA,EACL;AAGA,QAAM,eAAe,aAAAA,QAAM,QAAQ,MAAM;AACvC,QAAI,CAAC,iBAAiB;AACpB,aAAO;AAAA,IACT;AACA,WACE,6CAAC,oBAAK,OAAM,UAAS,KAAK,GAAG,WAAW,OAAO,gBAC7C;AAAA,kDAAC,UAAK,WAAW,OAAO,aAAc,UAAS;AAAA,MAC/C,4CAAC,6BAAa,SAAS,YAAY,WAAW,OAAO,UAAU,OAAO,EAAE,gDAAgD,IAAI,GAAG;AAAA,OACjI;AAAA,EAEJ,GAAG,CAAC,UAAU,eAAe,CAAC;AAE9B,SACE,4CAAC,uBAAQ,OAAO,aAAa,eAAe,QAAW,WAAU,WAAU,iBAAiB,KAAK,mBAAmB,MAAM,SAAS,MACjI,sDAAC,SAAI,KAAK,SAAS,WAAW,OAAO,MACnC,sDAAC,uBAAW,MAAX,EAAgB,UAAU,MAAO,UAAS,GAC7C,GACF;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-table/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/creek-table/components/index.tsx
|
|
17
|
+
var components_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(components_exports);
|
|
19
|
+
__reExport(components_exports, require("./DensityIcon"), module.exports);
|
|
20
|
+
__reExport(components_exports, require("./EllipsisTooltip"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./DensityIcon"),
|
|
24
|
+
...require("./EllipsisTooltip")
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-table/components/index.tsx"],
|
|
4
|
+
"sourcesContent": ["export * from './DensityIcon';\nexport * from './EllipsisTooltip';\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,0BAAd;AACA,+BAAc,8BADd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from './useAdaptiveToolBar';
|
|
2
2
|
export * from './useAutoWidthColumns';
|
|
3
3
|
export * from './useElementDistance';
|
|
4
|
+
export * from './useEllipsisColumns';
|
|
5
|
+
export * from './useIndexColumn';
|
|
6
|
+
export * from './useResizableColumns';
|
|
7
|
+
export * from './useStatusColumns';
|
|
8
|
+
export * from './useTableOptions';
|
|
4
9
|
export * from './useTableScrollHeight';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
|
@@ -19,12 +19,22 @@ module.exports = __toCommonJS(hooks_exports);
|
|
|
19
19
|
__reExport(hooks_exports, require("./useAdaptiveToolBar"), module.exports);
|
|
20
20
|
__reExport(hooks_exports, require("./useAutoWidthColumns"), module.exports);
|
|
21
21
|
__reExport(hooks_exports, require("./useElementDistance"), module.exports);
|
|
22
|
+
__reExport(hooks_exports, require("./useEllipsisColumns"), module.exports);
|
|
23
|
+
__reExport(hooks_exports, require("./useIndexColumn"), module.exports);
|
|
24
|
+
__reExport(hooks_exports, require("./useResizableColumns"), module.exports);
|
|
25
|
+
__reExport(hooks_exports, require("./useStatusColumns"), module.exports);
|
|
26
|
+
__reExport(hooks_exports, require("./useTableOptions"), module.exports);
|
|
22
27
|
__reExport(hooks_exports, require("./useTableScrollHeight"), module.exports);
|
|
23
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24
29
|
0 && (module.exports = {
|
|
25
30
|
...require("./useAdaptiveToolBar"),
|
|
26
31
|
...require("./useAutoWidthColumns"),
|
|
27
32
|
...require("./useElementDistance"),
|
|
33
|
+
...require("./useEllipsisColumns"),
|
|
34
|
+
...require("./useIndexColumn"),
|
|
35
|
+
...require("./useResizableColumns"),
|
|
36
|
+
...require("./useStatusColumns"),
|
|
37
|
+
...require("./useTableOptions"),
|
|
28
38
|
...require("./useTableScrollHeight")
|
|
29
39
|
});
|
|
30
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/creek-table/hooks/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './useAdaptiveToolBar';\nexport * from './useAutoWidthColumns';\nexport * from './useElementDistance';\nexport * from './useTableScrollHeight';\n\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,iCAAd;AACA,0BAAc,kCADd;AAEA,0BAAc,iCAFd;AAGA,0BAAc,
|
|
4
|
+
"sourcesContent": ["export * from './useAdaptiveToolBar';\nexport * from './useAutoWidthColumns';\nexport * from './useElementDistance';\nexport * from './useEllipsisColumns';\nexport * from './useIndexColumn';\nexport * from './useResizableColumns';\nexport * from './useStatusColumns';\nexport * from './useTableOptions';\nexport * from './useTableScrollHeight';\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,iCAAd;AACA,0BAAc,kCADd;AAEA,0BAAc,iCAFd;AAGA,0BAAc,iCAHd;AAIA,0BAAc,6BAJd;AAKA,0BAAc,kCALd;AAMA,0BAAc,+BANd;AAOA,0BAAc,8BAPd;AAQA,0BAAc,mCARd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|