@creekjs/web-components 1.0.3 → 1.0.4
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 +34 -0
- package/dist/creek-hooks/useApp/DrawerHelper.js +2 -2
- package/dist/creek-hooks/useApp/DrawerHelper.js.map +2 -2
- package/dist/creek-hooks/useApp/ModalHelper.js +2 -2
- package/dist/creek-hooks/useApp/ModalHelper.js.map +2 -2
- package/dist/creek-layout/index.js +2 -2
- package/dist/creek-layout/index.js.map +2 -2
- package/dist/creek-table/SearchTable.js +50 -37
- package/dist/creek-table/SearchTable.js.map +3 -3
- package/dist/creek-table/hooks/index.d.ts +1 -0
- package/dist/creek-table/hooks/index.js +3 -1
- package/dist/creek-table/hooks/index.js.map +2 -2
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts +1 -0
- package/dist/creek-table/hooks/useTableScrollHeight.js +72 -0
- package/dist/creek-table/hooks/useTableScrollHeight.js.map +7 -0
- package/dist/creek-table/index.js +1 -1
- package/dist/creek-table/index.js.map +2 -2
- package/dist/creek-table/toolBarRender.d.ts +1 -0
- package/dist/creek-table/toolBarRender.js +2 -2
- package/dist/creek-table/toolBarRender.js.map +2 -2
- package/package.json +1 -1
- package/src/creek-hooks/useApp/DrawerHelper.tsx +2 -2
- package/src/creek-hooks/useApp/ModalHelper.tsx +2 -2
- package/src/creek-layout/index.tsx +2 -2
- package/src/creek-table/SearchTable.tsx +54 -41
- package/src/creek-table/hooks/index.ts +2 -0
- package/src/creek-table/hooks/useTableScrollHeight.tsx +63 -0
- package/src/creek-table/index.tsx +1 -1
- package/src/creek-table/toolBarRender.tsx +3 -3
- package/dist/creek-table/TableViewContent.d.ts +0 -4
- package/dist/creek-table/TableViewContent.js +0 -66
- package/dist/creek-table/TableViewContent.js.map +0 -7
- package/src/creek-table/TableViewContent.tsx +0 -53
|
@@ -3,3 +3,37 @@
|
|
|
3
3
|
> @creekjs/web-components@1.0.3 father:build /Users/ernestwang/Documents/code-resoorce/creek/packages/web-components
|
|
4
4
|
> father build
|
|
5
5
|
|
|
6
|
+
[36minfo[39m - Clean output directories
|
|
7
|
+
[36minfo[39m - Bundless for [33msrc[39m directory to [33mcjs[39m format
|
|
8
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-config-provider/index.js[39m (with declaration)
|
|
9
|
+
[35mevent[39m - Bundless [90mCreekConfigContext.tsx[39m to [90mdist/creek-config-provider/CreekConfigContext.js[39m (with declaration)
|
|
10
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-hooks/index.js[39m (with declaration)
|
|
11
|
+
[35mevent[39m - Bundless [90mDrawerHelper.tsx[39m to [90mdist/creek-hooks/useApp/DrawerHelper.js[39m (with declaration)
|
|
12
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-hooks/useApp/index.js[39m (with declaration)
|
|
13
|
+
[35mevent[39m - Bundless [90mModalHelper.tsx[39m to [90mdist/creek-hooks/useApp/ModalHelper.js[39m (with declaration)
|
|
14
|
+
[35mevent[39m - Bundless [90mtypes.ts[39m to [90mdist/creek-hooks/useApp/types.js[39m (with declaration)
|
|
15
|
+
[35mevent[39m - Bundless [90museViewportHeight.tsx[39m to [90mdist/creek-hooks/useViewportHeight.js[39m (with declaration)
|
|
16
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-icon/index.js[39m (with declaration)
|
|
17
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-keep-alive/index.js[39m (with declaration)
|
|
18
|
+
[35mevent[39m - Bundless [90mCollapseButton.tsx[39m to [90mdist/creek-layout/CollapseButton.js[39m (with declaration)
|
|
19
|
+
[35mevent[39m - Bundless [90mNotFound.tsx[39m to [90mdist/creek-layout/Exception/NotFound.js[39m (with declaration)
|
|
20
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/Exception/index.js[39m (with declaration)
|
|
21
|
+
[35mevent[39m - Bundless [90mNotFoundPage.tsx[39m to [90mdist/creek-layout/Exception/NotFoundPage.js[39m (with declaration)
|
|
22
|
+
[35mevent[39m - Bundless [90mFullScreen.tsx[39m to [90mdist/creek-layout/HeaderContent/FullScreen.js[39m (with declaration)
|
|
23
|
+
[35mevent[39m - Bundless [90mUserInfo.tsx[39m to [90mdist/creek-layout/HeaderContent/UserInfo.js[39m (with declaration)
|
|
24
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/HeaderContent/index.js[39m (with declaration)
|
|
25
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/index.js[39m (with declaration)
|
|
26
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-loading/index.js[39m (with declaration)
|
|
27
|
+
[35mevent[39m - Bundless [90museAdaptiveToolBar.tsx[39m to [90mdist/creek-table/hooks/useAdaptiveToolBar.js[39m (with declaration)
|
|
28
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-table/hooks/index.js[39m (with declaration)
|
|
29
|
+
[35mevent[39m - Bundless [90museAutoWidthColumns.tsx[39m to [90mdist/creek-table/hooks/useAutoWidthColumns.js[39m (with declaration)
|
|
30
|
+
[35mevent[39m - Bundless [90museTableScrollHeight.tsx[39m to [90mdist/creek-table/hooks/useTableScrollHeight.js[39m (with declaration)
|
|
31
|
+
[35mevent[39m - Bundless [90mTableOptionRender.tsx[39m to [90mdist/creek-table/TableOptionRender.js[39m (with declaration)
|
|
32
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/index.js[39m (with declaration)
|
|
33
|
+
[35mevent[39m - Bundless [90museElementDistance.tsx[39m to [90mdist/creek-table/hooks/useElementDistance.js[39m (with declaration)
|
|
34
|
+
[35mevent[39m - Bundless [90mtype.ts[39m to [90mdist/creek-table/type.js[39m (with declaration)
|
|
35
|
+
[35mevent[39m - Bundless [90mtoolBarRender.tsx[39m to [90mdist/creek-table/toolBarRender.js[39m (with declaration)
|
|
36
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/index.js[39m (with declaration)
|
|
37
|
+
[35mevent[39m - Bundless [90mSearchTable.tsx[39m to [90mdist/creek-table/SearchTable.js[39m (with declaration)
|
|
38
|
+
[35mevent[39m - Generate declaration files...
|
|
39
|
+
[35mevent[39m - Transformed successfully in 13711 ms (30 files)
|
|
@@ -35,7 +35,7 @@ var DrawerHelper = ({ open, config, onClose }) => {
|
|
|
35
35
|
open,
|
|
36
36
|
onOpenChange: (visible) => !visible && onClose(),
|
|
37
37
|
drawerProps: {
|
|
38
|
-
|
|
38
|
+
destroyOnHidden: true,
|
|
39
39
|
onClose,
|
|
40
40
|
...config.drawerProps || {}
|
|
41
41
|
},
|
|
@@ -49,7 +49,7 @@ var DrawerHelper = ({ open, config, onClose }) => {
|
|
|
49
49
|
{
|
|
50
50
|
open,
|
|
51
51
|
onClose,
|
|
52
|
-
|
|
52
|
+
destroyOnHidden: true,
|
|
53
53
|
...restConfig,
|
|
54
54
|
children: content
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/creek-hooks/useApp/DrawerHelper.tsx"],
|
|
4
|
-
"sourcesContent": ["import { DrawerForm } from '@ant-design/pro-components';\nimport { Drawer } from 'antd';\nimport { omit } from 'lodash';\nimport React from 'react';\nimport { DrawerConfig, FormDrawerConfig, NormalDrawerConfig } from './types';\n\ninterface DrawerHelperProps {\n open: boolean;\n config: DrawerConfig;\n onClose: () => void;\n}\n\nexport const DrawerHelper: React.FC<DrawerHelperProps> = ({ open, config, onClose }) => {\n const { content, type, ...restConfig } = config;\n\n if (type === 'form') {\n return (\n <DrawerForm\n open={open}\n onOpenChange={(visible) => !visible && onClose()}\n drawerProps={{\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,kBAAuB;AACvB,oBAAqB;AAef;AALC,IAAM,eAA4C,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAM;AACtF,QAAM,EAAE,SAAS,MAAM,GAAG,WAAW,IAAI;AAEzC,MAAI,SAAS,QAAQ;AACnB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAA,QAC/C,aAAa;AAAA,UACX,
|
|
4
|
+
"sourcesContent": ["import { DrawerForm } from '@ant-design/pro-components';\nimport { Drawer } from 'antd';\nimport { omit } from 'lodash';\nimport React from 'react';\nimport { DrawerConfig, FormDrawerConfig, NormalDrawerConfig } from './types';\n\ninterface DrawerHelperProps {\n open: boolean;\n config: DrawerConfig;\n onClose: () => void;\n}\n\nexport const DrawerHelper: React.FC<DrawerHelperProps> = ({ open, config, onClose }) => {\n const { content, type, ...restConfig } = config;\n\n if (type === 'form') {\n return (\n <DrawerForm\n open={open}\n onOpenChange={(visible) => !visible && onClose()}\n drawerProps={{\n destroyOnHidden: true,\n onClose,\n ...((config as FormDrawerConfig).drawerProps || {}),\n }}\n {...(omit(restConfig, 'drawerProps') as any)}\n >\n {content}\n </DrawerForm>\n );\n }\n\n return (\n <Drawer\n open={open}\n onClose={onClose}\n destroyOnHidden\n {...(restConfig as NormalDrawerConfig)}\n >\n {content}\n </Drawer>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,kBAAuB;AACvB,oBAAqB;AAef;AALC,IAAM,eAA4C,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAM;AACtF,QAAM,EAAE,SAAS,MAAM,GAAG,WAAW,IAAI;AAEzC,MAAI,SAAS,QAAQ;AACnB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAA,QAC/C,aAAa;AAAA,UACX,iBAAiB;AAAA,UACjB;AAAA,UACA,GAAK,OAA4B,eAAe,CAAC;AAAA,QACnD;AAAA,QACC,OAAI,oBAAK,YAAY,aAAa;AAAA,QAElC;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,iBAAe;AAAA,MACd,GAAI;AAAA,MAEJ;AAAA;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,7 +35,7 @@ var ModalHelper = ({ open, config, onClose }) => {
|
|
|
35
35
|
open,
|
|
36
36
|
onOpenChange: (visible) => !visible && onClose(),
|
|
37
37
|
modalProps: {
|
|
38
|
-
|
|
38
|
+
destroyOnHidden: true,
|
|
39
39
|
onCancel: onClose,
|
|
40
40
|
...config.modalProps || {}
|
|
41
41
|
},
|
|
@@ -49,7 +49,7 @@ var ModalHelper = ({ open, config, onClose }) => {
|
|
|
49
49
|
{
|
|
50
50
|
open,
|
|
51
51
|
onCancel: onClose,
|
|
52
|
-
|
|
52
|
+
destroyOnHidden: true,
|
|
53
53
|
...restConfig,
|
|
54
54
|
children: content
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/creek-hooks/useApp/ModalHelper.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ModalForm } from '@ant-design/pro-components';\nimport { Modal } from 'antd';\nimport { omit } from 'lodash';\nimport React from 'react';\nimport { FormModalConfig, ModalConfig, NormalModalConfig } from './types';\n\ninterface ModalHelperProps {\n open: boolean;\n config: ModalConfig;\n onClose: () => void;\n}\n\nexport const ModalHelper: React.FC<ModalHelperProps> = ({ open, config, onClose }) => {\n const { content, type, ...restConfig } = config;\n\n if (type === 'form') {\n return (\n <ModalForm\n open={open}\n onOpenChange={(visible) => !visible && onClose()}\n modalProps={{\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0B;AAC1B,kBAAsB;AACtB,oBAAqB;AAef;AALC,IAAM,cAA0C,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAM;AACpF,QAAM,EAAE,SAAS,MAAM,GAAG,WAAW,IAAI;AAEzC,MAAI,SAAS,QAAQ;AACnB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAA,QAC/C,YAAY;AAAA,UACV,
|
|
4
|
+
"sourcesContent": ["import { ModalForm } from '@ant-design/pro-components';\nimport { Modal } from 'antd';\nimport { omit } from 'lodash';\nimport React from 'react';\nimport { FormModalConfig, ModalConfig, NormalModalConfig } from './types';\n\ninterface ModalHelperProps {\n open: boolean;\n config: ModalConfig;\n onClose: () => void;\n}\n\nexport const ModalHelper: React.FC<ModalHelperProps> = ({ open, config, onClose }) => {\n const { content, type, ...restConfig } = config;\n\n if (type === 'form') {\n return (\n <ModalForm\n open={open}\n onOpenChange={(visible) => !visible && onClose()}\n modalProps={{\n destroyOnHidden: true,\n onCancel: onClose,\n ...((config as FormModalConfig).modalProps || {}),\n }}\n {...(omit(restConfig, 'modalProps') as any)}\n >\n {content}\n </ModalForm>\n );\n }\n\n return (\n <Modal\n open={open}\n onCancel={onClose}\n destroyOnHidden\n {...(restConfig as NormalModalConfig)}\n >\n {content}\n </Modal>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0B;AAC1B,kBAAsB;AACtB,oBAAqB;AAef;AALC,IAAM,cAA0C,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAM;AACpF,QAAM,EAAE,SAAS,MAAM,GAAG,WAAW,IAAI;AAEzC,MAAI,SAAS,QAAQ;AACnB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAA,QAC/C,YAAY;AAAA,UACV,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,GAAK,OAA2B,cAAc,CAAC;AAAA,QACjD;AAAA,QACC,OAAI,oBAAK,YAAY,YAAY;AAAA,QAEjC;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,UAAU;AAAA,MACV,iBAAe;AAAA,MACd,GAAI;AAAA,MAEJ;AAAA;AAAA,EACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -99,8 +99,8 @@ var CreekLayout = (props) => {
|
|
|
99
99
|
colorTextMenu: "#333"
|
|
100
100
|
},
|
|
101
101
|
pageContainer: {
|
|
102
|
-
paddingBlockPageContainerContent:
|
|
103
|
-
paddingInlinePageContainerContent:
|
|
102
|
+
paddingBlockPageContainerContent: token.padding,
|
|
103
|
+
paddingInlinePageContainerContent: token.padding,
|
|
104
104
|
colorBgPageContainer: "linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);"
|
|
105
105
|
}
|
|
106
106
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/creek-layout/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ProLayout, ProLayoutProps } from \"@ant-design/pro-components\";\nimport { useMemoizedFn } from \"ahooks\";\nimport { theme } from \"antd\";\nimport classnames from \"classnames\";\n\nimport { CollapsedButton, useCollapsedStore } from \"./CollapseButton\";\nimport { Exception } from \"./Exception\";\nimport { HeaderContent } from \"./HeaderContent\";\n\nexport type LayoutProps = ProLayoutProps & {\n runtimeConfig: ProLayoutProps;\n userConfig?: ProLayoutProps;\n navigate?: (path?: string | number) => void;\n initialInfo?: {\n initialState: any;\n loading: boolean;\n setInitialState: () => void;\n };\n};\n\nexport const CreekLayout = (props: LayoutProps) => {\n const {\n route,\n userConfig,\n runtimeConfig,\n children,\n location,\n navigate,\n ...more\n } = props;\n\n const { useToken } = theme;\n const { token } = useToken();\n\n const { collapsed } = useCollapsedStore();\n\n const menuItemRender: ProLayoutProps[\"menuItemRender\"] = useMemoizedFn(\n (itemProps, defaultDom) => {\n return (\n <span\n onClick={() => {\n if (navigate) {\n navigate(itemProps.path);\n }\n }}\n >\n {defaultDom}\n </span>\n );\n }\n );\n\n return (\n <ProLayout\n className={classnames(\"creek-layout-container\", userConfig?.className)}\n layout=\"mix\"\n route={route}\n title={userConfig?.title}\n siderWidth={212}\n location={location}\n menuItemRender={menuItemRender}\n headerContentRender={() => {\n return <HeaderContent />;\n }}\n token={{\n header: {\n colorBgHeader: \"#fff\",\n colorHeaderTitle: \"rgba(0, 0, 0, 0.80);\",\n colorTextMenuSelected: token.colorPrimary,\n heightLayoutHeader: 48,\n },\n sider: {\n colorMenuBackground: \"#f7f8fa\",\n colorBgMenuItemSelected: \"transparent\",\n colorTextMenuActive: token.colorPrimary,\n colorTextMenuSelected: token.colorPrimary,\n colorTextMenuItemHover: token.colorPrimary,\n colorTextMenu: \"#333\",\n },\n pageContainer: {\n paddingBlockPageContainerContent:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0C;AAC1C,oBAA8B;AAC9B,kBAAsB;AACtB,wBAAuB;AAEvB,4BAAmD;AACnD,uBAA0B;AAC1B,2BAA8B;AA2F9B,iCAAc,wBAlGd;AAuCQ;AAnBD,IAAM,cAAc,CAAC,UAAuB;AACjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,EAAE,UAAU,QAAI,yCAAkB;AAExC,QAAM,qBAAmD;AAAA,IACvD,CAAC,WAAW,eAAe;AACzB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,MAAM;AACb,gBAAI,UAAU;AACZ,uBAAS,UAAU,IAAI;AAAA,YACzB;AAAA,UACF;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,IAEJ;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,kBAAAA,SAAW,0BAA0B,yCAAY,SAAS;AAAA,MACrE,QAAO;AAAA,MACP;AAAA,MACA,OAAO,yCAAY;AAAA,MACnB,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,qBAAqB,MAAM;AACzB,eAAO,4CAAC,sCAAc;AAAA,MACxB;AAAA,MACA,OAAO;AAAA,QACL,QAAQ;AAAA,UACN,eAAe;AAAA,UACf,kBAAkB;AAAA,UAClB,uBAAuB,MAAM;AAAA,UAC7B,oBAAoB;AAAA,QACtB;AAAA,QACA,OAAO;AAAA,UACL,qBAAqB;AAAA,UACrB,yBAAyB;AAAA,UACzB,qBAAqB,MAAM;AAAA,UAC3B,uBAAuB,MAAM;AAAA,UAC7B,wBAAwB,MAAM;AAAA,UAC9B,eAAe;AAAA,QACjB;AAAA,QACA,eAAe;AAAA,UACb,kCAAkC;AAAA,
|
|
4
|
+
"sourcesContent": ["import { ProLayout, ProLayoutProps } from \"@ant-design/pro-components\";\nimport { useMemoizedFn } from \"ahooks\";\nimport { theme } from \"antd\";\nimport classnames from \"classnames\";\n\nimport { CollapsedButton, useCollapsedStore } from \"./CollapseButton\";\nimport { Exception } from \"./Exception\";\nimport { HeaderContent } from \"./HeaderContent\";\n\nexport type LayoutProps = ProLayoutProps & {\n runtimeConfig: ProLayoutProps;\n userConfig?: ProLayoutProps;\n navigate?: (path?: string | number) => void;\n initialInfo?: {\n initialState: any;\n loading: boolean;\n setInitialState: () => void;\n };\n};\n\nexport const CreekLayout = (props: LayoutProps) => {\n const {\n route,\n userConfig,\n runtimeConfig,\n children,\n location,\n navigate,\n ...more\n } = props;\n\n const { useToken } = theme;\n const { token } = useToken();\n\n const { collapsed } = useCollapsedStore();\n\n const menuItemRender: ProLayoutProps[\"menuItemRender\"] = useMemoizedFn(\n (itemProps, defaultDom) => {\n return (\n <span\n onClick={() => {\n if (navigate) {\n navigate(itemProps.path);\n }\n }}\n >\n {defaultDom}\n </span>\n );\n }\n );\n\n return (\n <ProLayout\n className={classnames(\"creek-layout-container\", userConfig?.className)}\n layout=\"mix\"\n route={route}\n title={userConfig?.title}\n siderWidth={212}\n location={location}\n menuItemRender={menuItemRender}\n headerContentRender={() => {\n return <HeaderContent />;\n }}\n token={{\n header: {\n colorBgHeader: \"#fff\",\n colorHeaderTitle: \"rgba(0, 0, 0, 0.80);\",\n colorTextMenuSelected: token.colorPrimary,\n heightLayoutHeader: 48,\n },\n sider: {\n colorMenuBackground: \"#f7f8fa\",\n colorBgMenuItemSelected: \"transparent\",\n colorTextMenuActive: token.colorPrimary,\n colorTextMenuSelected: token.colorPrimary,\n colorTextMenuItemHover: token.colorPrimary,\n colorTextMenu: \"#333\",\n },\n pageContainer: {\n paddingBlockPageContainerContent: token.padding,\n paddingInlinePageContainerContent: token.padding,\n colorBgPageContainer: 'linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);'\n },\n }}\n fixSiderbar\n fixedHeader\n collapsed={collapsed}\n collapsedButtonRender={(collapsed) => {\n return <CollapsedButton collapsed={collapsed} />;\n }}\n {...more}\n >\n <Exception>{children}</Exception>\n </ProLayout>\n );\n};\n\nexport * from \"./Exception\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0C;AAC1C,oBAA8B;AAC9B,kBAAsB;AACtB,wBAAuB;AAEvB,4BAAmD;AACnD,uBAA0B;AAC1B,2BAA8B;AA2F9B,iCAAc,wBAlGd;AAuCQ;AAnBD,IAAM,cAAc,CAAC,UAAuB;AACjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,EAAE,UAAU,QAAI,yCAAkB;AAExC,QAAM,qBAAmD;AAAA,IACvD,CAAC,WAAW,eAAe;AACzB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,MAAM;AACb,gBAAI,UAAU;AACZ,uBAAS,UAAU,IAAI;AAAA,YACzB;AAAA,UACF;AAAA,UAEC;AAAA;AAAA,MACH;AAAA,IAEJ;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,kBAAAA,SAAW,0BAA0B,yCAAY,SAAS;AAAA,MACrE,QAAO;AAAA,MACP;AAAA,MACA,OAAO,yCAAY;AAAA,MACnB,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,qBAAqB,MAAM;AACzB,eAAO,4CAAC,sCAAc;AAAA,MACxB;AAAA,MACA,OAAO;AAAA,QACL,QAAQ;AAAA,UACN,eAAe;AAAA,UACf,kBAAkB;AAAA,UAClB,uBAAuB,MAAM;AAAA,UAC7B,oBAAoB;AAAA,QACtB;AAAA,QACA,OAAO;AAAA,UACL,qBAAqB;AAAA,UACrB,yBAAyB;AAAA,UACzB,qBAAqB,MAAM;AAAA,UAC3B,uBAAuB,MAAM;AAAA,UAC7B,wBAAwB,MAAM;AAAA,UAC9B,eAAe;AAAA,QACjB;AAAA,QACA,eAAe;AAAA,UACb,kCAAkC,MAAM;AAAA,UACxC,mCAAmC,MAAM;AAAA,UACzC,sBAAsB;AAAA,QACxB;AAAA,MACF;AAAA,MACA,aAAW;AAAA,MACX,aAAW;AAAA,MACX;AAAA,MACA,uBAAuB,CAACC,eAAc;AACpC,eAAO,4CAAC,yCAAgB,WAAWA,YAAW;AAAA,MAChD;AAAA,MACC,GAAG;AAAA,MAEJ,sDAAC,8BAAW,UAAS;AAAA;AAAA,EACvB;AAEJ;",
|
|
6
6
|
"names": ["classnames", "collapsed"]
|
|
7
7
|
}
|
|
@@ -33,74 +33,87 @@ __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 import_antd = require("antd");
|
|
36
37
|
var import_antd_style = require("antd-style");
|
|
37
38
|
var import_classnames = __toESM(require("classnames"));
|
|
38
39
|
var import_lodash = __toESM(require("lodash"));
|
|
39
40
|
var import_react = require("react");
|
|
40
41
|
var import_hooks = require("./hooks");
|
|
41
42
|
var import_TableOptionRender = require("./TableOptionRender");
|
|
42
|
-
var import_TableViewContent = require("./TableViewContent");
|
|
43
43
|
var import_toolBarRender = require("./toolBarRender");
|
|
44
44
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var useStyles = (0, import_antd_style.createStyles)(({ prefixCls }) => {
|
|
45
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, token }, { scrollY, prefixCls }) => {
|
|
46
46
|
return {
|
|
47
|
-
"creek-table-container":
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
"creek-table-container": css`
|
|
48
|
+
.${prefixCls}-table-body {
|
|
49
|
+
overflow-y: auto !important;
|
|
50
|
+
min-height: ${typeof scrollY === "number" ? `${scrollY}px` : scrollY ?? "auto"};
|
|
51
|
+
|
|
52
|
+
/* Firefox 滚动条样式 */
|
|
53
|
+
scrollbar-width: thin;
|
|
54
|
+
scrollbar-color: ${token.colorFillSecondary} transparent;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Webkit (Chrome, Safari, Edge) 滚动条样式 */
|
|
58
|
+
& *::-webkit-scrollbar {
|
|
59
|
+
width: 6px !important;
|
|
60
|
+
height: 6px !important;
|
|
61
|
+
background-color: transparent !important;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
& *::-webkit-scrollbar-thumb {
|
|
65
|
+
background-color: ${token.colorFillSecondary} !important;
|
|
66
|
+
border-radius: 3px !important;
|
|
67
|
+
transition: all 0.3s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
& *::-webkit-scrollbar-thumb:hover {
|
|
71
|
+
background-color: ${token.colorFill} !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
& *::-webkit-scrollbar-track {
|
|
75
|
+
background-color: transparent !important;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.${prefixCls}-pagination {
|
|
79
|
+
.${prefixCls}-pagination-total-text {
|
|
80
|
+
flex: 1;
|
|
51
81
|
}
|
|
52
82
|
}
|
|
53
|
-
|
|
83
|
+
`
|
|
54
84
|
};
|
|
55
85
|
});
|
|
56
86
|
var SearchProTable = (props) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
params,
|
|
60
|
-
prefixCls = "ant",
|
|
61
|
-
autoAddFilterForColumn = true,
|
|
62
|
-
className,
|
|
63
|
-
optionsRender,
|
|
64
|
-
tableViewRender,
|
|
65
|
-
pagination,
|
|
66
|
-
pageFixedBottom = true,
|
|
67
|
-
pageFixedBottomConfig,
|
|
68
|
-
...restProps
|
|
69
|
-
} = props;
|
|
87
|
+
var _a;
|
|
88
|
+
const { columns, prefixCls = "ant", autoAddFilterForColumn = true, className, optionsRender, tableViewRender, pagination, pageFixedBottom = true, pageFixedBottomConfig, ...restProps } = props;
|
|
70
89
|
const proTableRef = (0, import_react.useRef)(null);
|
|
90
|
+
const { token } = import_antd.theme.useToken();
|
|
71
91
|
const { columns: adaptiveColumns, totalWidth } = (0, import_hooks.useAutoWidthColumns)(columns, proTableRef);
|
|
72
|
-
const
|
|
92
|
+
const scrollY = (0, import_hooks.useTableScrollHeight)(prefixCls, proTableRef, pageFixedBottom, token.paddingContentVerticalLG, (pageFixedBottomConfig == null ? void 0 : pageFixedBottomConfig.bottomFix) || token.padding);
|
|
93
|
+
const { styles } = useStyles({ scrollY, prefixCls });
|
|
94
|
+
console.log("scrollY", scrollY);
|
|
73
95
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: proTableRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
96
|
import_pro_components.ProTable,
|
|
75
97
|
{
|
|
76
|
-
...
|
|
98
|
+
...props,
|
|
77
99
|
className: (0, import_classnames.default)(styles["creek-table-container"], className),
|
|
78
100
|
columns: adaptiveColumns,
|
|
79
101
|
scroll: {
|
|
80
102
|
x: totalWidth,
|
|
81
|
-
|
|
103
|
+
y: scrollY ?? ((_a = restProps.scroll) == null ? void 0 : _a.y)
|
|
82
104
|
},
|
|
83
105
|
toolbar: {
|
|
84
106
|
...restProps.toolbar
|
|
85
107
|
},
|
|
86
|
-
pagination: {
|
|
87
|
-
showTotal: (total) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
88
|
-
"共 ",
|
|
89
|
-
total,
|
|
90
|
-
" 条"
|
|
91
|
-
] }),
|
|
92
|
-
showSizeChanger: true,
|
|
93
|
-
...pagination
|
|
94
|
-
},
|
|
95
108
|
optionsRender: (defaultProps, dom) => {
|
|
96
|
-
var
|
|
97
|
-
return import_lodash.default.isFunction(optionsRender) ? optionsRender(defaultProps, dom) : (restProps == null ? void 0 : restProps.options) ? [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TableOptionRender.TableOptionRender, { defaultDom: dom, importConfig: (
|
|
109
|
+
var _a2, _b;
|
|
110
|
+
return import_lodash.default.isFunction(optionsRender) ? optionsRender(defaultProps, dom) : (restProps == null ? void 0 : restProps.options) ? [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TableOptionRender.TableOptionRender, { defaultDom: dom, importConfig: (_a2 = restProps == null ? void 0 : restProps.options) == null ? void 0 : _a2.importConfig, exportConfig: (_b = restProps == null ? void 0 : restProps.options) == null ? void 0 : _b.exportConfig }, "option")] : [];
|
|
98
111
|
},
|
|
99
|
-
toolBarRender: () => {
|
|
100
|
-
return (0, import_toolBarRender.toolBarRender)({ shouldCollapse: false, restProps });
|
|
112
|
+
toolBarRender: (...args) => {
|
|
113
|
+
return (0, import_toolBarRender.toolBarRender)({ shouldCollapse: false, restProps, args });
|
|
101
114
|
},
|
|
102
115
|
tableViewRender: (defaultProps, defaultDom) => {
|
|
103
|
-
return import_lodash.default.isFunction(tableViewRender) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: tableViewRender(defaultProps, defaultDom) }) :
|
|
116
|
+
return import_lodash.default.isFunction(tableViewRender) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: tableViewRender(defaultProps, defaultDom) }) : defaultDom;
|
|
104
117
|
}
|
|
105
118
|
}
|
|
106
119
|
) });
|
|
@@ -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 { createStyles } from 'antd-style';\nimport classnames from 'classnames';\nimport _ from 'lodash';\nimport { useRef } from 'react';\n\nimport { useAutoWidthColumns } from './hooks';\nimport { TableOptionRender } from './TableOptionRender';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAqC;AACrC,wBAA6B;AAC7B,wBAAuB;AACvB,oBAAc;AACd,mBAAuB;AAEvB,
|
|
6
|
-
"names": ["classnames", "_"]
|
|
4
|
+
"sourcesContent": ["import { ParamsType, ProTable } from '@ant-design/pro-components';\nimport { theme } from 'antd';\nimport { createStyles } from 'antd-style';\nimport classnames from 'classnames';\nimport _ from 'lodash';\nimport { useRef } from 'react';\n\nimport { useAutoWidthColumns, useTableScrollHeight } from './hooks';\nimport { TableOptionRender } from './TableOptionRender';\nimport { toolBarRender } from './toolBarRender';\nimport { CreekTableProps } from './type';\n\nconst useStyles = createStyles(({ css, token }, { scrollY, prefixCls }: { scrollY?: number | string; prefixCls: string }) => {\n return {\n 'creek-table-container': css`\n .${prefixCls}-table-body {\n overflow-y: auto !important;\n min-height: ${typeof scrollY === 'number' ? `${scrollY}px` : (scrollY ?? 'auto')};\n\n /* Firefox 滚动条样式 */\n scrollbar-width: thin;\n scrollbar-color: ${token.colorFillSecondary} transparent;\n }\n\n /* Webkit (Chrome, Safari, Edge) 滚动条样式 */\n & *::-webkit-scrollbar {\n width: 6px !important;\n height: 6px !important;\n background-color: transparent !important;\n }\n\n & *::-webkit-scrollbar-thumb {\n background-color: ${token.colorFillSecondary} !important;\n border-radius: 3px !important;\n transition: all 0.3s;\n }\n\n & *::-webkit-scrollbar-thumb:hover {\n background-color: ${token.colorFill} !important;\n }\n\n & *::-webkit-scrollbar-track {\n background-color: transparent !important;\n }\n\n .${prefixCls}-pagination {\n .${prefixCls}-pagination-total-text {\n flex: 1;\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 { columns, prefixCls = 'ant', autoAddFilterForColumn = true, className, optionsRender, tableViewRender, pagination, pageFixedBottom = true, pageFixedBottomConfig, ...restProps } = props;\n\n const proTableRef = useRef<HTMLDivElement>(null);\n\n const { token } = theme.useToken();\n\n // // 使用自定义 hook 处理工具栏的自适应功能\n // const { shouldCollapse } = useAdaptiveToolBar({\n // containerRef: proTableRef,\n // prefixCls,\n // });ƒ\n\n const { columns: adaptiveColumns, totalWidth } = useAutoWidthColumns(columns, proTableRef);\n\n const scrollY = useTableScrollHeight(prefixCls, proTableRef, pageFixedBottom, token.paddingContentVerticalLG, pageFixedBottomConfig?.bottomFix || token.padding);\n\n const { styles } = useStyles({ scrollY, prefixCls });\n\n console.log('scrollY', scrollY);\n\n return (\n <div ref={proTableRef}>\n <ProTable<T, U, ValueType>\n {...props}\n className={classnames(styles['creek-table-container'], className)}\n columns={adaptiveColumns}\n scroll={{\n x: totalWidth,\n y: scrollY ?? restProps.scroll?.y,\n }}\n toolbar={{\n ...restProps.toolbar,\n }}\n optionsRender={(defaultProps, dom) => {\n return _.isFunction(optionsRender)\n ? optionsRender(defaultProps, dom)\n : restProps?.options\n ? [<TableOptionRender key=\"option\" defaultDom={dom} importConfig={restProps?.options?.importConfig} exportConfig={restProps?.options?.exportConfig} />]\n : [];\n }}\n toolBarRender={(...args) => {\n return toolBarRender({ shouldCollapse: false, restProps, args });\n }}\n // 在表格内容区上方显示筛选条件\n tableViewRender={(defaultProps, defaultDom) => {\n return _.isFunction(tableViewRender) ? <>{tableViewRender(defaultProps, defaultDom)}</> : defaultDom;\n }}\n />\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAqC;AACrC,kBAAsB;AACtB,wBAA6B;AAC7B,wBAAuB;AACvB,oBAAc;AACd,mBAAuB;AAEvB,mBAA0D;AAC1D,+BAAkC;AAClC,2BAA8B;AAoFb;AAjFjB,IAAM,gBAAY,gCAAa,CAAC,EAAE,KAAK,MAAM,GAAG,EAAE,SAAS,UAAU,MAAwD;AAC3H,SAAO;AAAA,IACL,yBAAyB;AAAA,SACpB;AAAA;AAAA,sBAEa,OAAO,YAAY,WAAW,GAAG,cAAe,WAAW;AAAA;AAAA;AAAA;AAAA,2BAItD,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAWL,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAMN,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAOzB;AAAA,WACE;AAAA;AAAA;AAAA;AAAA;AAAA,EAKT;AACF,CAAC;AAGM,IAAM,iBAAiB,CAAiE,UAA4C;AAvD3I;AAwDE,QAAM,EAAE,SAAS,YAAY,OAAO,yBAAyB,MAAM,WAAW,eAAe,iBAAiB,YAAY,kBAAkB,MAAM,uBAAuB,GAAG,UAAU,IAAI;AAE1L,QAAM,kBAAc,qBAAuB,IAAI;AAE/C,QAAM,EAAE,MAAM,IAAI,kBAAM,SAAS;AAQjC,QAAM,EAAE,SAAS,iBAAiB,WAAW,QAAI,kCAAoB,SAAS,WAAW;AAEzF,QAAM,cAAU,mCAAqB,WAAW,aAAa,iBAAiB,MAAM,2BAA0B,+DAAuB,cAAa,MAAM,OAAO;AAE/J,QAAM,EAAE,OAAO,IAAI,UAAU,EAAE,SAAS,UAAU,CAAC;AAEnD,UAAQ,IAAI,WAAW,OAAO;AAE9B,SACE,4CAAC,SAAI,KAAK,aACR;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,kBAAAA,SAAW,OAAO,uBAAuB,GAAG,SAAS;AAAA,MAChE,SAAS;AAAA,MACT,QAAQ;AAAA,QACN,GAAG;AAAA,QACH,GAAG,aAAW,eAAU,WAAV,mBAAkB;AAAA,MAClC;AAAA,MACA,SAAS;AAAA,QACP,GAAG,UAAU;AAAA,MACf;AAAA,MACA,eAAe,CAAC,cAAc,QAAQ;AAzF9C,YAAAC,KAAA;AA0FU,eAAO,cAAAC,QAAE,WAAW,aAAa,IAC7B,cAAc,cAAc,GAAG,KAC/B,uCAAW,WACT,CAAC,4CAAC,8CAA+B,YAAY,KAAK,eAAcD,MAAA,uCAAW,YAAX,gBAAAA,IAAoB,cAAc,eAAc,4CAAW,YAAX,mBAAoB,gBAA5G,QAA0H,CAAE,IACpJ,CAAC;AAAA,MACT;AAAA,MACA,eAAe,IAAI,SAAS;AAC1B,mBAAO,oCAAc,EAAE,gBAAgB,OAAO,WAAW,KAAK,CAAC;AAAA,MACjE;AAAA,MAEA,iBAAiB,CAAC,cAAc,eAAe;AAC7C,eAAO,cAAAC,QAAE,WAAW,eAAe,IAAI,2EAAG,0BAAgB,cAAc,UAAU,GAAE,IAAM;AAAA,MAC5F;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
6
|
+
"names": ["classnames", "_a", "_"]
|
|
7
7
|
}
|
|
@@ -19,10 +19,12 @@ 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("./useTableScrollHeight"), module.exports);
|
|
22
23
|
// Annotate the CommonJS export names for ESM import in node:
|
|
23
24
|
0 && (module.exports = {
|
|
24
25
|
...require("./useAdaptiveToolBar"),
|
|
25
26
|
...require("./useAutoWidthColumns"),
|
|
26
|
-
...require("./useElementDistance")
|
|
27
|
+
...require("./useElementDistance"),
|
|
28
|
+
...require("./useTableScrollHeight")
|
|
27
29
|
});
|
|
28
30
|
//# 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';\n\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,iCAAd;AACA,0BAAc,kCADd;AAEA,0BAAc,iCAFd;",
|
|
4
|
+
"sourcesContent": ["export * from './useAdaptiveToolBar';\nexport * from './useAutoWidthColumns';\nexport * from './useElementDistance';\nexport * from './useTableScrollHeight';\n\n\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,iCAAd;AACA,0BAAc,kCADd;AAEA,0BAAc,iCAFd;AAGA,0BAAc,mCAHd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useTableScrollHeight: (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom?: boolean, contentPadding?: number, offsetBottom?: number) => number | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
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/hooks/useTableScrollHeight.tsx
|
|
20
|
+
var useTableScrollHeight_exports = {};
|
|
21
|
+
__export(useTableScrollHeight_exports, {
|
|
22
|
+
useTableScrollHeight: () => useTableScrollHeight
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useTableScrollHeight_exports);
|
|
25
|
+
var import_ahooks = require("ahooks");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var useTableScrollHeight = (prefixCls, tableRef, pageFixedBottom = true, contentPadding = 16, offsetBottom = 16) => {
|
|
28
|
+
const [scrollY, setScrollY] = (0, import_react.useState)(void 0);
|
|
29
|
+
const { run: calcHeight } = (0, import_ahooks.useDebounceFn)(
|
|
30
|
+
() => {
|
|
31
|
+
if (!pageFixedBottom || !tableRef.current)
|
|
32
|
+
return;
|
|
33
|
+
const tableEl = tableRef.current;
|
|
34
|
+
const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);
|
|
35
|
+
const tableBody = tableEl.querySelector(`.${prefixCls}-table-body`);
|
|
36
|
+
let top = 0;
|
|
37
|
+
if (tableHeader) {
|
|
38
|
+
top = tableHeader.getBoundingClientRect().bottom;
|
|
39
|
+
} else if (tableBody) {
|
|
40
|
+
top = tableBody.getBoundingClientRect().top;
|
|
41
|
+
}
|
|
42
|
+
const windowHeight = window.innerHeight;
|
|
43
|
+
let height = windowHeight - top - contentPadding - offsetBottom;
|
|
44
|
+
const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);
|
|
45
|
+
if (pagination) {
|
|
46
|
+
const paginationHeight = pagination.clientHeight;
|
|
47
|
+
const styles = window.getComputedStyle(pagination);
|
|
48
|
+
const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
49
|
+
height = height - paginationHeight - totalPaginationMargin;
|
|
50
|
+
} else {
|
|
51
|
+
height = height - 40;
|
|
52
|
+
}
|
|
53
|
+
setScrollY(height);
|
|
54
|
+
},
|
|
55
|
+
{ wait: 100 }
|
|
56
|
+
);
|
|
57
|
+
(0, import_react.useEffect)(() => {
|
|
58
|
+
calcHeight();
|
|
59
|
+
const observer = new MutationObserver(calcHeight);
|
|
60
|
+
if (tableRef.current) {
|
|
61
|
+
observer.observe(tableRef.current, { childList: true, subtree: true });
|
|
62
|
+
}
|
|
63
|
+
return () => observer.disconnect();
|
|
64
|
+
}, [tableRef, pageFixedBottom, prefixCls]);
|
|
65
|
+
(0, import_ahooks.useEventListener)("resize", calcHeight);
|
|
66
|
+
return scrollY;
|
|
67
|
+
};
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
useTableScrollHeight
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=useTableScrollHeight.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-table/hooks/useTableScrollHeight.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useDebounceFn, useEventListener } from 'ahooks';\nimport { useEffect, useState } from 'react';\n\nexport const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, contentPadding: number = 16, offsetBottom: number = 16) => {\n const [scrollY, setScrollY] = useState<number | undefined>(undefined);\n\n const { run: calcHeight } = useDebounceFn(\n () => {\n if (!pageFixedBottom || !tableRef.current) return;\n\n const tableEl = tableRef.current;\n\n const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);\n const tableBody = tableEl.querySelector(`.${prefixCls}-table-body`);\n\n let top = 0;\n if (tableHeader) {\n top = tableHeader.getBoundingClientRect().bottom;\n } else if (tableBody) {\n top = tableBody.getBoundingClientRect().top;\n }\n\n const windowHeight = window.innerHeight;\n \n let height = windowHeight - top - contentPadding - offsetBottom;\n\n const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);\n\n if (pagination) {\n const paginationHeight = pagination.clientHeight;\n\n const styles = window.getComputedStyle(pagination);\n const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);\n\n height = height - paginationHeight - totalPaginationMargin;\n } else {\n // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)\n // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小\n height = height - 40;\n }\n\n // Minimum height to avoid crashes or ugly rendering\n setScrollY(height);\n },\n { wait: 100 },\n );\n\n useEffect(() => {\n // Initial calculation\n calcHeight();\n\n // Observer for DOM changes that might affect position\n const observer = new MutationObserver(calcHeight);\n if (tableRef.current) {\n observer.observe(tableRef.current, { childList: true, subtree: true });\n }\n return () => observer.disconnect();\n }, [tableRef, pageFixedBottom, prefixCls]);\n\n useEventListener('resize', calcHeight);\n\n return scrollY;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,mBAAoC;AAE7B,IAAM,uBAAuB,CAAC,WAAmB,UAA2C,kBAA2B,MAAM,iBAAyB,IAAI,eAAuB,OAAO;AAC7L,QAAM,CAAC,SAAS,UAAU,QAAI,uBAA6B,MAAS;AAEpE,QAAM,EAAE,KAAK,WAAW,QAAI;AAAA,IAC1B,MAAM;AACJ,UAAI,CAAC,mBAAmB,CAAC,SAAS;AAAS;AAE3C,YAAM,UAAU,SAAS;AAEzB,YAAM,cAAc,QAAQ,cAAc,IAAI,uBAAuB;AACrE,YAAM,YAAY,QAAQ,cAAc,IAAI,sBAAsB;AAElE,UAAI,MAAM;AACV,UAAI,aAAa;AACf,cAAM,YAAY,sBAAsB,EAAE;AAAA,MAC5C,WAAW,WAAW;AACpB,cAAM,UAAU,sBAAsB,EAAE;AAAA,MAC1C;AAEA,YAAM,eAAe,OAAO;AAE5B,UAAI,SAAS,eAAe,MAAO,iBAAiB;AAEpD,YAAM,aAAa,QAAQ,cAAc,IAAI,sBAAsB;AAEnE,UAAI,YAAY;AACd,cAAM,mBAAmB,WAAW;AAEpC,cAAM,SAAS,OAAO,iBAAiB,UAAU;AACjD,cAAM,wBAAwB,WAAW,OAAO,SAAS,IAAI,WAAW,OAAO,YAAY;AAE3F,iBAAS,SAAS,mBAAmB;AAAA,MACvC,OAAO;AAGL,iBAAS,SAAS;AAAA,MACpB;AAGA,iBAAW,MAAM;AAAA,IACnB;AAAA,IACA,EAAE,MAAM,IAAI;AAAA,EACd;AAEA,8BAAU,MAAM;AAEd,eAAW;AAGX,UAAM,WAAW,IAAI,iBAAiB,UAAU;AAChD,QAAI,SAAS,SAAS;AACpB,eAAS,QAAQ,SAAS,SAAS,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAAA,IACvE;AACA,WAAO,MAAM,SAAS,WAAW;AAAA,EACnC,GAAG,CAAC,UAAU,iBAAiB,SAAS,CAAC;AAEzC,sCAAiB,UAAU,UAAU;AAErC,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -25,7 +25,7 @@ module.exports = __toCommonJS(creek_table_exports);
|
|
|
25
25
|
var import_SearchTable = require("./SearchTable");
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
27
|
var CreekTable = (props) => {
|
|
28
|
-
const { columns = [],
|
|
28
|
+
const { columns = [], ...restProps } = props;
|
|
29
29
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SearchTable.SearchProTable, { columns, ...restProps });
|
|
30
30
|
};
|
|
31
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/creek-table/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { ParamsType } from '@ant-design/pro-components';\n\nimport { SearchProTable } from './SearchTable';\nimport { CreekTableProps } from './type';\n\nexport const CreekTable = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {\n const { columns = [],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA+B;AAO1B;AAJE,IAAM,aAAa,CAAiE,UAA4C;AACrI,QAAM,EAAE,UAAU,CAAC,GAAI,
|
|
4
|
+
"sourcesContent": ["import { ParamsType } from '@ant-design/pro-components';\n\nimport { SearchProTable } from './SearchTable';\nimport { CreekTableProps } from './type';\n\nexport const CreekTable = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {\n const { columns = [], ...restProps } = props;\n\n return (\n <SearchProTable columns={columns} {...restProps} />\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA+B;AAO1B;AAJE,IAAM,aAAa,CAAiE,UAA4C;AACrI,QAAM,EAAE,UAAU,CAAC,GAAI,GAAG,UAAU,IAAI;AAExC,SACG,4CAAC,qCAAe,SAAmB,GAAG,WAAW;AAEtD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,8 +27,8 @@ var import_antd = require("antd");
|
|
|
27
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
28
|
var toolBarRender = (options) => {
|
|
29
29
|
var _a;
|
|
30
|
-
const { shouldCollapse, restProps } = options;
|
|
31
|
-
const baseActions = ((_a = restProps.toolBarRender) == null ? void 0 : _a.call(restProps)) || [];
|
|
30
|
+
const { shouldCollapse, restProps, args = [] } = options;
|
|
31
|
+
const baseActions = ((_a = restProps.toolBarRender) == null ? void 0 : _a.call(restProps, ...args)) || [];
|
|
32
32
|
if (!shouldCollapse || baseActions.length <= 1) {
|
|
33
33
|
return baseActions;
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/creek-table/toolBarRender.tsx"],
|
|
4
|
-
"sourcesContent": ["import { DownOutlined } from '@ant-design/icons';\nimport { Button, Dropdown } from 'antd';\n\nexport const toolBarRender = (options: { shouldCollapse: boolean; restProps: any }) => {\n const { shouldCollapse, restProps } = options;\n\n const baseActions = restProps.toolBarRender?.() || [];\n if (!shouldCollapse || baseActions.length <= 1) {\n return baseActions;\n }\n\n const [first, ...rest] = baseActions;\n\n return [\n first,\n <Dropdown\n key=\"more\"\n menu={{\n items: rest.map((item: React.ReactDOM, index: number) => ({ key: index, label: item })),\n }}\n trigger={['click']}\n >\n <Button>\n 更多 <DownOutlined />\n </Button>\n </Dropdown>,\n ];\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAC7B,kBAAiC;AAqB3B;AAnBC,IAAM,gBAAgB,CAAC,
|
|
4
|
+
"sourcesContent": ["import { DownOutlined } from '@ant-design/icons';\nimport { Button, Dropdown } from 'antd';\n\nexport const toolBarRender = (options: { shouldCollapse: boolean; restProps: any; args?: any[] }) => {\n const { shouldCollapse, restProps, args = [] } = options;\n\n const baseActions = restProps.toolBarRender?.(...args) || [];\n if (!shouldCollapse || baseActions.length <= 1) {\n return baseActions;\n }\n\n const [first, ...rest] = baseActions;\n\n return [\n first,\n <Dropdown\n key=\"more\"\n menu={{\n items: rest.map((item: React.ReactDOM, index: number) => ({ key: index, label: item })),\n }}\n trigger={['click']}\n >\n <Button>\n 更多 <DownOutlined />\n </Button>\n </Dropdown>,\n ];\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAC7B,kBAAiC;AAqB3B;AAnBC,IAAM,gBAAgB,CAAC,YAAuE;AAHrG;AAIE,QAAM,EAAE,gBAAgB,WAAW,OAAO,CAAC,EAAE,IAAI;AAEjD,QAAM,gBAAc,eAAU,kBAAV,mCAA0B,GAAG,UAAS,CAAC;AAC3D,MAAI,CAAC,kBAAkB,YAAY,UAAU,GAAG;AAC9C,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AAEzB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QAEC,MAAM;AAAA,UACJ,OAAO,KAAK,IAAI,CAAC,MAAsB,WAAmB,EAAE,KAAK,OAAO,OAAO,KAAK,EAAE;AAAA,QACxF;AAAA,QACA,SAAS,CAAC,OAAO;AAAA,QAEjB,uDAAC,sBAAO;AAAA;AAAA,UACH,4CAAC,6BAAa;AAAA,WACnB;AAAA;AAAA,MARI;AAAA,IASN;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ export const DrawerHelper: React.FC<DrawerHelperProps> = ({ open, config, onClos
|
|
|
19
19
|
open={open}
|
|
20
20
|
onOpenChange={(visible) => !visible && onClose()}
|
|
21
21
|
drawerProps={{
|
|
22
|
-
|
|
22
|
+
destroyOnHidden: true,
|
|
23
23
|
onClose,
|
|
24
24
|
...((config as FormDrawerConfig).drawerProps || {}),
|
|
25
25
|
}}
|
|
@@ -34,7 +34,7 @@ export const DrawerHelper: React.FC<DrawerHelperProps> = ({ open, config, onClos
|
|
|
34
34
|
<Drawer
|
|
35
35
|
open={open}
|
|
36
36
|
onClose={onClose}
|
|
37
|
-
|
|
37
|
+
destroyOnHidden
|
|
38
38
|
{...(restConfig as NormalDrawerConfig)}
|
|
39
39
|
>
|
|
40
40
|
{content}
|
|
@@ -19,7 +19,7 @@ export const ModalHelper: React.FC<ModalHelperProps> = ({ open, config, onClose
|
|
|
19
19
|
open={open}
|
|
20
20
|
onOpenChange={(visible) => !visible && onClose()}
|
|
21
21
|
modalProps={{
|
|
22
|
-
|
|
22
|
+
destroyOnHidden: true,
|
|
23
23
|
onCancel: onClose,
|
|
24
24
|
...((config as FormModalConfig).modalProps || {}),
|
|
25
25
|
}}
|
|
@@ -34,7 +34,7 @@ export const ModalHelper: React.FC<ModalHelperProps> = ({ open, config, onClose
|
|
|
34
34
|
<Modal
|
|
35
35
|
open={open}
|
|
36
36
|
onCancel={onClose}
|
|
37
|
-
|
|
37
|
+
destroyOnHidden
|
|
38
38
|
{...(restConfig as NormalModalConfig)}
|
|
39
39
|
>
|
|
40
40
|
{content}
|
|
@@ -78,8 +78,8 @@ export const CreekLayout = (props: LayoutProps) => {
|
|
|
78
78
|
colorTextMenu: "#333",
|
|
79
79
|
},
|
|
80
80
|
pageContainer: {
|
|
81
|
-
paddingBlockPageContainerContent:
|
|
82
|
-
paddingInlinePageContainerContent:
|
|
81
|
+
paddingBlockPageContainerContent: token.padding,
|
|
82
|
+
paddingInlinePageContainerContent: token.padding,
|
|
83
83
|
colorBgPageContainer: 'linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);'
|
|
84
84
|
},
|
|
85
85
|
}}
|
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
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
|
-
{...
|
|
80
|
+
{...props}
|
|
57
81
|
className={classnames(styles['creek-table-container'], className)}
|
|
58
82
|
columns={adaptiveColumns}
|
|
59
83
|
scroll={{
|
|
60
84
|
x: totalWidth,
|
|
61
|
-
|
|
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({
|
|
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>
|
|
@@ -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 = [],
|
|
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,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,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
|
-
};
|