@creekjs/web-components 1.0.3 → 1.0.5

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.
Files changed (82) hide show
  1. package/.turbo/turbo-father$colon$build.log +35 -1
  2. package/dist/creek-config-provider/CreekConfigContext.d.ts.map +1 -0
  3. package/dist/creek-config-provider/index.d.ts.map +1 -0
  4. package/dist/creek-hooks/index.d.ts.map +1 -0
  5. package/dist/creek-hooks/useApp/DrawerHelper.d.ts.map +1 -0
  6. package/dist/creek-hooks/useApp/DrawerHelper.js +2 -2
  7. package/dist/creek-hooks/useApp/DrawerHelper.js.map +2 -2
  8. package/dist/creek-hooks/useApp/ModalHelper.d.ts.map +1 -0
  9. package/dist/creek-hooks/useApp/ModalHelper.js +2 -2
  10. package/dist/creek-hooks/useApp/ModalHelper.js.map +2 -2
  11. package/dist/creek-hooks/useApp/index.d.ts.map +1 -0
  12. package/dist/creek-hooks/useApp/types.d.ts.map +1 -0
  13. package/dist/creek-hooks/useViewportHeight.d.ts.map +1 -0
  14. package/dist/creek-icon/index.d.ts.map +1 -0
  15. package/dist/creek-keep-alive/index.d.ts.map +1 -0
  16. package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +1 -0
  17. package/dist/creek-layout/{HeaderContent → ActionRender}/FullScreen.js +1 -1
  18. package/dist/creek-layout/{HeaderContent → ActionRender}/FullScreen.js.map +1 -1
  19. package/dist/creek-layout/ActionRender/UserInfo.d.ts +8 -0
  20. package/dist/creek-layout/ActionRender/UserInfo.d.ts.map +1 -0
  21. package/dist/creek-layout/{HeaderContent → ActionRender}/UserInfo.js +7 -29
  22. package/dist/creek-layout/ActionRender/UserInfo.js.map +7 -0
  23. package/dist/creek-layout/ActionRender/index.d.ts +2 -0
  24. package/dist/creek-layout/ActionRender/index.d.ts.map +1 -0
  25. package/dist/creek-layout/ActionRender/index.js +33 -0
  26. package/dist/creek-layout/ActionRender/index.js.map +7 -0
  27. package/dist/creek-layout/CollapseButton.d.ts.map +1 -0
  28. package/dist/creek-layout/Exception/NotFound.d.ts.map +1 -0
  29. package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +1 -0
  30. package/dist/creek-layout/Exception/index.d.ts.map +1 -0
  31. package/dist/creek-layout/index.d.ts +9 -2
  32. package/dist/creek-layout/index.d.ts.map +1 -0
  33. package/dist/creek-layout/index.js +25 -31
  34. package/dist/creek-layout/index.js.map +2 -2
  35. package/dist/creek-loading/index.d.ts.map +1 -0
  36. package/dist/creek-table/SearchTable.d.ts.map +1 -0
  37. package/dist/creek-table/SearchTable.js +50 -37
  38. package/dist/creek-table/SearchTable.js.map +3 -3
  39. package/dist/creek-table/TableOptionRender.d.ts.map +1 -0
  40. package/dist/creek-table/hooks/index.d.ts +1 -0
  41. package/dist/creek-table/hooks/index.d.ts.map +1 -0
  42. package/dist/creek-table/hooks/index.js +3 -1
  43. package/dist/creek-table/hooks/index.js.map +2 -2
  44. package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +1 -0
  45. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +1 -0
  46. package/dist/creek-table/hooks/useElementDistance.d.ts.map +1 -0
  47. package/dist/creek-table/hooks/useTableScrollHeight.d.ts +1 -0
  48. package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +1 -0
  49. package/dist/creek-table/hooks/useTableScrollHeight.js +72 -0
  50. package/dist/creek-table/hooks/useTableScrollHeight.js.map +7 -0
  51. package/dist/creek-table/index.d.ts.map +1 -0
  52. package/dist/creek-table/index.js +1 -1
  53. package/dist/creek-table/index.js.map +2 -2
  54. package/dist/creek-table/toolBarRender.d.ts +1 -0
  55. package/dist/creek-table/toolBarRender.d.ts.map +1 -0
  56. package/dist/creek-table/toolBarRender.js +2 -2
  57. package/dist/creek-table/toolBarRender.js.map +2 -2
  58. package/dist/creek-table/type.d.ts.map +1 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/package.json +1 -1
  61. package/src/creek-hooks/useApp/DrawerHelper.tsx +2 -2
  62. package/src/creek-hooks/useApp/ModalHelper.tsx +2 -2
  63. package/src/creek-layout/{HeaderContent → ActionRender}/UserInfo.tsx +13 -24
  64. package/src/creek-layout/ActionRender/index.tsx +3 -0
  65. package/src/creek-layout/index.tsx +46 -45
  66. package/src/creek-table/SearchTable.tsx +54 -41
  67. package/src/creek-table/hooks/index.ts +2 -0
  68. package/src/creek-table/hooks/useTableScrollHeight.tsx +63 -0
  69. package/src/creek-table/index.tsx +1 -1
  70. package/src/creek-table/toolBarRender.tsx +3 -3
  71. package/dist/creek-layout/HeaderContent/UserInfo.d.ts +0 -1
  72. package/dist/creek-layout/HeaderContent/UserInfo.js.map +0 -7
  73. package/dist/creek-layout/HeaderContent/index.d.ts +0 -1
  74. package/dist/creek-layout/HeaderContent/index.js +0 -49
  75. package/dist/creek-layout/HeaderContent/index.js.map +0 -7
  76. package/dist/creek-table/TableViewContent.d.ts +0 -4
  77. package/dist/creek-table/TableViewContent.js +0 -66
  78. package/dist/creek-table/TableViewContent.js.map +0 -7
  79. package/src/creek-layout/HeaderContent/index.tsx +0 -24
  80. package/src/creek-table/TableViewContent.tsx +0 -53
  81. /package/dist/creek-layout/{HeaderContent → ActionRender}/FullScreen.d.ts +0 -0
  82. /package/src/creek-layout/{HeaderContent → ActionRender}/FullScreen.tsx +0 -0
@@ -1,73 +1,92 @@
1
1
  import { ParamsType, ProTable } from '@ant-design/pro-components';
2
+ import { theme } from 'antd';
2
3
  import { createStyles } from 'antd-style';
3
4
  import classnames from 'classnames';
4
5
  import _ from 'lodash';
5
6
  import { useRef } from 'react';
6
7
 
7
- import { useAutoWidthColumns } from './hooks';
8
+ import { useAutoWidthColumns, useTableScrollHeight } from './hooks';
8
9
  import { TableOptionRender } from './TableOptionRender';
9
- import { TableViewContent } from './TableViewContent';
10
10
  import { toolBarRender } from './toolBarRender';
11
11
  import { CreekTableProps } from './type';
12
12
 
13
- const useStyles = createStyles(({ prefixCls }) => {
13
+ const useStyles = createStyles(({ css, token }, { scrollY, prefixCls }: { scrollY?: number | string; prefixCls: string }) => {
14
14
  return {
15
- 'creek-table-container': {
16
- [`.${prefixCls}-pagination`]: {
17
- [`.${prefixCls}-pagination-total-text`]: {
18
- flex: `1`,
19
- },
20
- },
21
- },
15
+ 'creek-table-container': css`
16
+ .${prefixCls}-table-body {
17
+ overflow-y: auto !important;
18
+ min-height: ${typeof scrollY === 'number' ? `${scrollY}px` : (scrollY ?? 'auto')};
19
+
20
+ /* Firefox 滚动条样式 */
21
+ scrollbar-width: thin;
22
+ scrollbar-color: ${token.colorFillSecondary} transparent;
23
+ }
24
+
25
+ /* Webkit (Chrome, Safari, Edge) 滚动条样式 */
26
+ & *::-webkit-scrollbar {
27
+ width: 6px !important;
28
+ height: 6px !important;
29
+ background-color: transparent !important;
30
+ }
31
+
32
+ & *::-webkit-scrollbar-thumb {
33
+ background-color: ${token.colorFillSecondary} !important;
34
+ border-radius: 3px !important;
35
+ transition: all 0.3s;
36
+ }
37
+
38
+ & *::-webkit-scrollbar-thumb:hover {
39
+ background-color: ${token.colorFill} !important;
40
+ }
41
+
42
+ & *::-webkit-scrollbar-track {
43
+ background-color: transparent !important;
44
+ }
45
+
46
+ .${prefixCls}-pagination {
47
+ .${prefixCls}-pagination-total-text {
48
+ flex: 1;
49
+ }
50
+ }
51
+ `,
22
52
  };
23
53
  });
24
54
 
25
55
  // 独立的 ProTable 组件
26
56
  export const SearchProTable = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {
27
- const {
28
- columns,
29
- params,
30
- prefixCls = 'ant',
31
- autoAddFilterForColumn = true,
32
- className,
33
- optionsRender,
34
- tableViewRender,
35
- pagination,
36
- pageFixedBottom = true,
37
- pageFixedBottomConfig,
38
- ...restProps
39
- } = props;
57
+ const { columns, prefixCls = 'ant', autoAddFilterForColumn = true, className, optionsRender, tableViewRender, pagination, pageFixedBottom = true, pageFixedBottomConfig, ...restProps } = props;
40
58
 
41
59
  const proTableRef = useRef<HTMLDivElement>(null);
42
60
 
61
+ const { token } = theme.useToken();
62
+
43
63
  // // 使用自定义 hook 处理工具栏的自适应功能
44
64
  // const { shouldCollapse } = useAdaptiveToolBar({
45
65
  // containerRef: proTableRef,
46
66
  // prefixCls,
47
- // });
67
+ // })
48
68
 
49
69
  const { columns: adaptiveColumns, totalWidth } = useAutoWidthColumns(columns, proTableRef);
50
70
 
51
- const { styles } = useStyles();
71
+ const scrollY = useTableScrollHeight(prefixCls, proTableRef, pageFixedBottom, token.paddingContentVerticalLG, pageFixedBottomConfig?.bottomFix || token.padding);
72
+
73
+ const { styles } = useStyles({ scrollY, prefixCls });
74
+
75
+ console.log('scrollY', scrollY);
52
76
 
53
77
  return (
54
78
  <div ref={proTableRef}>
55
79
  <ProTable<T, U, ValueType>
56
- {...restProps}
80
+ {...props}
57
81
  className={classnames(styles['creek-table-container'], className)}
58
82
  columns={adaptiveColumns}
59
83
  scroll={{
60
84
  x: totalWidth,
61
- ...restProps.scroll,
85
+ y: scrollY ?? restProps.scroll?.y,
62
86
  }}
63
87
  toolbar={{
64
88
  ...restProps.toolbar,
65
89
  }}
66
- pagination={{
67
- showTotal: (total) => <span>共 {total} 条</span>,
68
- showSizeChanger: true,
69
- ...pagination,
70
- }}
71
90
  optionsRender={(defaultProps, dom) => {
72
91
  return _.isFunction(optionsRender)
73
92
  ? optionsRender(defaultProps, dom)
@@ -75,18 +94,12 @@ export const SearchProTable = <T extends ParamsType, U extends ParamsType, Value
75
94
  ? [<TableOptionRender key="option" defaultDom={dom} importConfig={restProps?.options?.importConfig} exportConfig={restProps?.options?.exportConfig} />]
76
95
  : [];
77
96
  }}
78
- toolBarRender={() => {
79
- return toolBarRender({  shouldCollapse: false, restProps });
97
+ toolBarRender={(...args) => {
98
+ return toolBarRender({ shouldCollapse: false, restProps, args });
80
99
  }}
81
100
  // 在表格内容区上方显示筛选条件
82
101
  tableViewRender={(defaultProps, defaultDom) => {
83
- return _.isFunction(tableViewRender) ? (
84
- <>{tableViewRender(defaultProps, defaultDom)}</>
85
- ) : (
86
- <TableViewContent<T, U, ValueType> pageFixedBottom={pageFixedBottom} pageFixedBottomConfig={pageFixedBottomConfig} prefixCls={prefixCls}>
87
- {defaultDom}
88
- </TableViewContent>
89
- );
102
+ return _.isFunction(tableViewRender) ? <>{tableViewRender(defaultProps, defaultDom)}</> : defaultDom;
90
103
  }}
91
104
  />
92
105
  </div>
@@ -1,4 +1,6 @@
1
1
  export * from './useAdaptiveToolBar';
2
2
  export * from './useAutoWidthColumns';
3
3
  export * from './useElementDistance';
4
+ export * from './useTableScrollHeight';
5
+
4
6
 
@@ -0,0 +1,63 @@
1
+ import { useDebounceFn, useEventListener } from 'ahooks';
2
+ import { useEffect, useState } from 'react';
3
+
4
+ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, contentPadding: number = 16, offsetBottom: number = 16) => {
5
+ const [scrollY, setScrollY] = useState<number | undefined>(undefined);
6
+
7
+ const { run: calcHeight } = useDebounceFn(
8
+ () => {
9
+ if (!pageFixedBottom || !tableRef.current) return;
10
+
11
+ const tableEl = tableRef.current;
12
+
13
+ const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);
14
+ const tableBody = tableEl.querySelector(`.${prefixCls}-table-body`);
15
+
16
+ let top = 0;
17
+ if (tableHeader) {
18
+ top = tableHeader.getBoundingClientRect().bottom;
19
+ } else if (tableBody) {
20
+ top = tableBody.getBoundingClientRect().top;
21
+ }
22
+
23
+ const windowHeight = window.innerHeight;
24
+
25
+ let height = windowHeight - top - contentPadding - offsetBottom;
26
+
27
+ const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);
28
+
29
+ if (pagination) {
30
+ const paginationHeight = pagination.clientHeight;
31
+
32
+ const styles = window.getComputedStyle(pagination);
33
+ const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
34
+
35
+ height = height - paginationHeight - totalPaginationMargin;
36
+ } else {
37
+ // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)
38
+ // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小
39
+ height = height - 40;
40
+ }
41
+
42
+ // Minimum height to avoid crashes or ugly rendering
43
+ setScrollY(height);
44
+ },
45
+ { wait: 100 },
46
+ );
47
+
48
+ useEffect(() => {
49
+ // Initial calculation
50
+ calcHeight();
51
+
52
+ // Observer for DOM changes that might affect position
53
+ const observer = new MutationObserver(calcHeight);
54
+ if (tableRef.current) {
55
+ observer.observe(tableRef.current, { childList: true, subtree: true });
56
+ }
57
+ return () => observer.disconnect();
58
+ }, [tableRef, pageFixedBottom, prefixCls]);
59
+
60
+ useEventListener('resize', calcHeight);
61
+
62
+ return scrollY;
63
+ };
@@ -4,7 +4,7 @@ import { SearchProTable } from './SearchTable';
4
4
  import { CreekTableProps } from './type';
5
5
 
6
6
  export const CreekTable = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {
7
- const { columns = [], onSubmit, ...restProps } = props;
7
+ const { columns = [], ...restProps } = props;
8
8
 
9
9
  return (
10
10
  <SearchProTable columns={columns} {...restProps} />
@@ -1,10 +1,10 @@
1
1
  import { DownOutlined } from '@ant-design/icons';
2
2
  import { Button, Dropdown } from 'antd';
3
3
 
4
- export const toolBarRender = (options: { shouldCollapse: boolean; restProps: any }) => {
5
- const { shouldCollapse, restProps } = options;
4
+ export const toolBarRender = (options: { shouldCollapse: boolean; restProps: any; args?: any[] }) => {
5
+ const { shouldCollapse, restProps, args = [] } = options;
6
6
 
7
- const baseActions = restProps.toolBarRender?.() || [];
7
+ const baseActions = restProps.toolBarRender?.(...args) || [];
8
8
  if (!shouldCollapse || baseActions.length <= 1) {
9
9
  return baseActions;
10
10
  }
@@ -1 +0,0 @@
1
- export declare const UserInfo: () => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/creek-layout/HeaderContent/UserInfo.tsx"],
4
- "sourcesContent": ["import { LogoutOutlined } from \"@ant-design/icons\";\nimport { Avatar, Dropdown, DropDownProps, Space } from \"antd\";\nimport { createStyles } from \"antd-style\";\n\nconst useStyles = createStyles(({ token }) => ({\n avatarContainer: {\n backgroundColor: token.colorPrimary,\n width: 24,\n height: 24,\n },\n userInfoDropdownOverlay: {\n \".ant-dropdown-menu\": {\n padding: \"8px 0\",\n },\n \".ant-dropdown-menu-item\": {\n \".ant-dropdown-menu-item-icon\": {\n fontSize: \"18px\",\n marginRight: \"8px\",\n },\n },\n },\n}));\n\nexport const UserInfo = () => {\n const { styles } = useStyles();\n\n const userInfoMenu: DropDownProps[\"menu\"] = {\n items: [\n {\n key: \"logout\",\n label: (\n <Space size={8}>\n <LogoutOutlined />\n <span>退出登录</span>\n </Space>\n ),\n onClick: () => {},\n },\n ],\n };\n return (\n <Dropdown\n arrow\n placement=\"bottom\"\n overlayClassName={styles.userInfoDropdownOverlay}\n menu={userInfoMenu}\n >\n <Space size={4} align=\"center\">\n <Avatar className={styles.avatarContainer}>C</Avatar>\n <span>Creek</span>\n </Space>\n </Dropdown>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,kBAAuD;AACvD,wBAA6B;AA6BnB;AA3BV,IAAM,gBAAY,gCAAa,CAAC,EAAE,MAAM,OAAO;AAAA,EAC7C,iBAAiB;AAAA,IACf,iBAAiB,MAAM;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,yBAAyB;AAAA,IACvB,sBAAsB;AAAA,MACpB,SAAS;AAAA,IACX;AAAA,IACA,2BAA2B;AAAA,MACzB,gCAAgC;AAAA,QAC9B,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF,EAAE;AAEK,IAAM,WAAW,MAAM;AAC5B,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,eAAsC;AAAA,IAC1C,OAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,OACE,6CAAC,qBAAM,MAAM,GACX;AAAA,sDAAC,+BAAe;AAAA,UAChB,4CAAC,UAAK,kBAAI;AAAA,WACZ;AAAA,QAEF,SAAS,MAAM;AAAA,QAAC;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAK;AAAA,MACL,WAAU;AAAA,MACV,kBAAkB,OAAO;AAAA,MACzB,MAAM;AAAA,MAEN,uDAAC,qBAAM,MAAM,GAAG,OAAM,UACpB;AAAA,oDAAC,sBAAO,WAAW,OAAO,iBAAiB,eAAC;AAAA,QAC5C,4CAAC,UAAK,mBAAK;AAAA,SACb;AAAA;AAAA,EACF;AAEJ;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- export declare const HeaderContent: () => import("react/jsx-runtime").JSX.Element;
@@ -1,49 +0,0 @@
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-layout/HeaderContent/index.tsx
20
- var HeaderContent_exports = {};
21
- __export(HeaderContent_exports, {
22
- HeaderContent: () => HeaderContent
23
- });
24
- module.exports = __toCommonJS(HeaderContent_exports);
25
- var import_antd = require("antd");
26
- var import_antd_style = require("antd-style");
27
- var import_FullScreen = require("./FullScreen");
28
- var import_UserInfo = require("./UserInfo");
29
- var import_jsx_runtime = require("react/jsx-runtime");
30
- var useStyles = (0, import_antd_style.createStyles)(({}) => ({
31
- dividerContainer: {
32
- backgroundColor: "#9b9999"
33
- }
34
- }));
35
- var HeaderContent = () => {
36
- const { styles } = useStyles();
37
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Flex, { justify: "space-between", children: [
38
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {}),
39
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Space, { split: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Divider, { type: "vertical", className: styles.dividerContainer }), children: [
40
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FullScreen.FullScreen, {}),
41
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_UserInfo.UserInfo, {})
42
- ] })
43
- ] });
44
- };
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- HeaderContent
48
- });
49
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/creek-layout/HeaderContent/index.tsx"],
4
- "sourcesContent": ["import { Divider, Flex, Space } from 'antd';\nimport { createStyles } from 'antd-style';\n\nimport { FullScreen } from './FullScreen';\nimport { UserInfo } from './UserInfo';\n\nconst useStyles = createStyles(({}) => ({\n dividerContainer: {\n backgroundColor: '#9b9999',\n },\n}));\n\nexport const HeaderContent = () => {\n const { styles } = useStyles();\n return (\n <Flex justify=\"space-between\">\n <span />\n <Space split={<Divider type=\"vertical\" className={styles.dividerContainer} />}>\n <FullScreen />\n <UserInfo />\n </Space>\n </Flex>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqC;AACrC,wBAA6B;AAE7B,wBAA2B;AAC3B,sBAAyB;AAYnB;AAVN,IAAM,gBAAY,gCAAa,CAAC,CAAC,OAAO;AAAA,EACtC,kBAAkB;AAAA,IAChB,iBAAiB;AAAA,EACnB;AACF,EAAE;AAEK,IAAM,gBAAgB,MAAM;AACjC,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,SACE,6CAAC,oBAAK,SAAQ,iBACZ;AAAA,gDAAC,UAAK;AAAA,IACN,6CAAC,qBAAM,OAAO,4CAAC,uBAAQ,MAAK,YAAW,WAAW,OAAO,kBAAkB,GACzE;AAAA,kDAAC,gCAAW;AAAA,MACZ,4CAAC,4BAAS;AAAA,OACZ;AAAA,KACF;AAEJ;",
6
- "names": []
7
- }
@@ -1,4 +0,0 @@
1
- import { ParamsType } from '@ant-design/pro-components';
2
- import { CreekTableProps } from './type';
3
- export type CreekTableViewRender<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = CreekTableProps<T, U, ValueType>['tableViewRender'];
4
- export declare const TableViewContent: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: CreekTableProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
@@ -1,66 +0,0 @@
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/TableViewContent.tsx
20
- var TableViewContent_exports = {};
21
- __export(TableViewContent_exports, {
22
- TableViewContent: () => TableViewContent
23
- });
24
- module.exports = __toCommonJS(TableViewContent_exports);
25
- var import_ahooks = require("ahooks");
26
- var import_creek_hooks = require("../creek-hooks");
27
- var import_jsx_runtime = require("react/jsx-runtime");
28
- var TableViewContent = (props) => {
29
- const { prefixCls, pageFixedBottomConfig, pageFixedBottom, children } = props;
30
- const { containerRef, viewPortHeight } = (0, import_creek_hooks.useViewportHeight)({
31
- isObserverParent: true
32
- });
33
- const { run: setAntdTableContentHeight } = (0, import_ahooks.useDebounceFn)(
34
- (mainHeight) => {
35
- var _a, _b, _c;
36
- const antdTableContentElement = (_a = containerRef.current) == null ? void 0 : _a.querySelector(`.${prefixCls}-table`);
37
- const antdPaginationElement = (_b = containerRef.current) == null ? void 0 : _b.querySelector(`.${prefixCls}-pagination`);
38
- if (antdTableContentElement) {
39
- const paginationHeight = (antdPaginationElement == null ? void 0 : antdPaginationElement.clientHeight) || 0;
40
- const bottomFix = (pageFixedBottomConfig == null ? void 0 : pageFixedBottomConfig.bottomFix) || 20;
41
- const parentElement = (_c = containerRef.current) == null ? void 0 : _c.parentElement;
42
- let parentPaddingBottom = 0;
43
- if (parentElement) {
44
- const style = window.getComputedStyle(parentElement);
45
- parentPaddingBottom = parseFloat(style.paddingBottom) || 0;
46
- }
47
- const tableContentHeight = mainHeight - paginationHeight - parentPaddingBottom - bottomFix - parentPaddingBottom;
48
- antdTableContentElement.setAttribute("style", `height: ${tableContentHeight}px`);
49
- }
50
- },
51
- {
52
- wait: 16
53
- }
54
- );
55
- (0, import_ahooks.useDeepCompareEffect)(() => {
56
- if (pageFixedBottom) {
57
- setAntdTableContentHeight(viewPortHeight ?? 0);
58
- }
59
- }, [viewPortHeight, pageFixedBottom, setAntdTableContentHeight]);
60
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: containerRef, children }) });
61
- };
62
- // Annotate the CommonJS export names for ESM import in node:
63
- 0 && (module.exports = {
64
- TableViewContent
65
- });
66
- //# sourceMappingURL=TableViewContent.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/creek-table/TableViewContent.tsx"],
4
- "sourcesContent": ["import { ParamsType } from '@ant-design/pro-components';\n\nimport { useDebounceFn, useDeepCompareEffect } from 'ahooks';\n\nimport { useViewportHeight } from '../creek-hooks';\nimport { CreekTableProps } from './type';\n\nexport type CreekTableViewRender<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = CreekTableProps<T, U, ValueType>['tableViewRender'];\n\n// 独立的 TableViewWrapper 组件 - 包含所有表格视图相关逻辑\nexport const TableViewContent = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {\n const { prefixCls, pageFixedBottomConfig, pageFixedBottom, children } = props;\n\n const { containerRef, viewPortHeight } = useViewportHeight({\n isObserverParent: true,\n });\n\n // 设置antd内容区的高度,使得分页永远在底部\n const { run: setAntdTableContentHeight } = useDebounceFn(\n (mainHeight: number) => {\n const antdTableContentElement = containerRef.current?.querySelector(`.${prefixCls}-table`);\n const antdPaginationElement = containerRef.current?.querySelector(`.${prefixCls}-pagination`);\n if (antdTableContentElement) {\n const paginationHeight = antdPaginationElement?.clientHeight || 0;\n const bottomFix = pageFixedBottomConfig?.bottomFix || 20;\n const parentElement = containerRef.current?.parentElement;\n let parentPaddingBottom = 0;\n if (parentElement) {\n const style = window.getComputedStyle(parentElement);\n parentPaddingBottom = parseFloat(style.paddingBottom) || 0;\n }\n const tableContentHeight = mainHeight - paginationHeight - parentPaddingBottom - bottomFix - parentPaddingBottom;\n antdTableContentElement.setAttribute('style', `height: ${tableContentHeight}px`);\n }\n },\n {\n wait: 16,\n },\n );\n\n useDeepCompareEffect(() => {\n if (pageFixedBottom) {\n setAntdTableContentHeight(viewPortHeight ?? 0);\n }\n }, [viewPortHeight, pageFixedBottom, setAntdTableContentHeight]);\n\n // 默认渲染逻辑\n return (\n <>\n <div ref={containerRef}>{children}</div>\n </>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAoD;AAEpD,yBAAkC;AA4C9B;AAtCG,IAAM,mBAAmB,CAAiE,UAA4C;AAC3I,QAAM,EAAE,WAAW,uBAAuB,iBAAiB,SAAS,IAAI;AAExE,QAAM,EAAE,cAAc,eAAe,QAAI,sCAAkB;AAAA,IACzD,kBAAkB;AAAA,EACpB,CAAC;AAGD,QAAM,EAAE,KAAK,0BAA0B,QAAI;AAAA,IACzC,CAAC,eAAuB;AAnB5B;AAoBM,YAAM,2BAA0B,kBAAa,YAAb,mBAAsB,cAAc,IAAI;AACxE,YAAM,yBAAwB,kBAAa,YAAb,mBAAsB,cAAc,IAAI;AACtE,UAAI,yBAAyB;AAC3B,cAAM,oBAAmB,+DAAuB,iBAAgB;AAChE,cAAM,aAAY,+DAAuB,cAAa;AACtD,cAAM,iBAAgB,kBAAa,YAAb,mBAAsB;AAC5C,YAAI,sBAAsB;AAC1B,YAAI,eAAe;AACjB,gBAAM,QAAQ,OAAO,iBAAiB,aAAa;AACnD,gCAAsB,WAAW,MAAM,aAAa,KAAK;AAAA,QAC3D;AACA,cAAM,qBAAqB,aAAa,mBAAmB,sBAAsB,YAAY;AAC7F,gCAAwB,aAAa,SAAS,WAAW,sBAAsB;AAAA,MACjF;AAAA,IACF;AAAA,IACA;AAAA,MACE,MAAM;AAAA,IACR;AAAA,EACF;AAEA,0CAAqB,MAAM;AACzB,QAAI,iBAAiB;AACnB,gCAA0B,kBAAkB,CAAC;AAAA,IAC/C;AAAA,EACF,GAAG,CAAC,gBAAgB,iBAAiB,yBAAyB,CAAC;AAG/D,SACE,2EACE,sDAAC,SAAI,KAAK,cAAe,UAAS,GACpC;AAEJ;",
6
- "names": []
7
- }
@@ -1,24 +0,0 @@
1
- import { Divider, Flex, Space } from 'antd';
2
- import { createStyles } from 'antd-style';
3
-
4
- import { FullScreen } from './FullScreen';
5
- import { UserInfo } from './UserInfo';
6
-
7
- const useStyles = createStyles(({}) => ({
8
- dividerContainer: {
9
- backgroundColor: '#9b9999',
10
- },
11
- }));
12
-
13
- export const HeaderContent = () => {
14
- const { styles } = useStyles();
15
- return (
16
- <Flex justify="space-between">
17
- <span />
18
- <Space split={<Divider type="vertical" className={styles.dividerContainer} />}>
19
- <FullScreen />
20
- <UserInfo />
21
- </Space>
22
- </Flex>
23
- );
24
- };
@@ -1,53 +0,0 @@
1
- import { ParamsType } from '@ant-design/pro-components';
2
-
3
- import { useDebounceFn, useDeepCompareEffect } from 'ahooks';
4
-
5
- import { useViewportHeight } from '../creek-hooks';
6
- import { CreekTableProps } from './type';
7
-
8
- export type CreekTableViewRender<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = CreekTableProps<T, U, ValueType>['tableViewRender'];
9
-
10
- // 独立的 TableViewWrapper 组件 - 包含所有表格视图相关逻辑
11
- export const TableViewContent = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {
12
- const { prefixCls, pageFixedBottomConfig, pageFixedBottom, children } = props;
13
-
14
- const { containerRef, viewPortHeight } = useViewportHeight({
15
- isObserverParent: true,
16
- });
17
-
18
- // 设置antd内容区的高度,使得分页永远在底部
19
- const { run: setAntdTableContentHeight } = useDebounceFn(
20
- (mainHeight: number) => {
21
- const antdTableContentElement = containerRef.current?.querySelector(`.${prefixCls}-table`);
22
- const antdPaginationElement = containerRef.current?.querySelector(`.${prefixCls}-pagination`);
23
- if (antdTableContentElement) {
24
- const paginationHeight = antdPaginationElement?.clientHeight || 0;
25
- const bottomFix = pageFixedBottomConfig?.bottomFix || 20;
26
- const parentElement = containerRef.current?.parentElement;
27
- let parentPaddingBottom = 0;
28
- if (parentElement) {
29
- const style = window.getComputedStyle(parentElement);
30
- parentPaddingBottom = parseFloat(style.paddingBottom) || 0;
31
- }
32
- const tableContentHeight = mainHeight - paginationHeight - parentPaddingBottom - bottomFix - parentPaddingBottom;
33
- antdTableContentElement.setAttribute('style', `height: ${tableContentHeight}px`);
34
- }
35
- },
36
- {
37
- wait: 16,
38
- },
39
- );
40
-
41
- useDeepCompareEffect(() => {
42
- if (pageFixedBottom) {
43
- setAntdTableContentHeight(viewPortHeight ?? 0);
44
- }
45
- }, [viewPortHeight, pageFixedBottom, setAntdTableContentHeight]);
46
-
47
- // 默认渲染逻辑
48
- return (
49
- <>
50
- <div ref={containerRef}>{children}</div>
51
- </>
52
- );
53
- };