@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.
- package/.turbo/turbo-father$colon$build.log +35 -1
- package/dist/creek-config-provider/CreekConfigContext.d.ts.map +1 -0
- package/dist/creek-config-provider/index.d.ts.map +1 -0
- package/dist/creek-hooks/index.d.ts.map +1 -0
- package/dist/creek-hooks/useApp/DrawerHelper.d.ts.map +1 -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.d.ts.map +1 -0
- package/dist/creek-hooks/useApp/ModalHelper.js +2 -2
- package/dist/creek-hooks/useApp/ModalHelper.js.map +2 -2
- package/dist/creek-hooks/useApp/index.d.ts.map +1 -0
- package/dist/creek-hooks/useApp/types.d.ts.map +1 -0
- package/dist/creek-hooks/useViewportHeight.d.ts.map +1 -0
- package/dist/creek-icon/index.d.ts.map +1 -0
- package/dist/creek-keep-alive/index.d.ts.map +1 -0
- package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +1 -0
- package/dist/creek-layout/{HeaderContent → ActionRender}/FullScreen.js +1 -1
- package/dist/creek-layout/{HeaderContent → ActionRender}/FullScreen.js.map +1 -1
- package/dist/creek-layout/ActionRender/UserInfo.d.ts +8 -0
- package/dist/creek-layout/ActionRender/UserInfo.d.ts.map +1 -0
- package/dist/creek-layout/{HeaderContent → ActionRender}/UserInfo.js +7 -29
- package/dist/creek-layout/ActionRender/UserInfo.js.map +7 -0
- package/dist/creek-layout/ActionRender/index.d.ts +2 -0
- package/dist/creek-layout/ActionRender/index.d.ts.map +1 -0
- package/dist/creek-layout/ActionRender/index.js +33 -0
- package/dist/creek-layout/ActionRender/index.js.map +7 -0
- package/dist/creek-layout/CollapseButton.d.ts.map +1 -0
- package/dist/creek-layout/Exception/NotFound.d.ts.map +1 -0
- package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +1 -0
- package/dist/creek-layout/Exception/index.d.ts.map +1 -0
- package/dist/creek-layout/index.d.ts +9 -2
- package/dist/creek-layout/index.d.ts.map +1 -0
- package/dist/creek-layout/index.js +25 -31
- package/dist/creek-layout/index.js.map +2 -2
- package/dist/creek-loading/index.d.ts.map +1 -0
- package/dist/creek-table/SearchTable.d.ts.map +1 -0
- package/dist/creek-table/SearchTable.js +50 -37
- package/dist/creek-table/SearchTable.js.map +3 -3
- package/dist/creek-table/TableOptionRender.d.ts.map +1 -0
- package/dist/creek-table/hooks/index.d.ts +1 -0
- package/dist/creek-table/hooks/index.d.ts.map +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/useAdaptiveToolBar.d.ts.map +1 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useElementDistance.d.ts.map +1 -0
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts +1 -0
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +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.d.ts.map +1 -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.d.ts.map +1 -0
- package/dist/creek-table/toolBarRender.js +2 -2
- package/dist/creek-table/toolBarRender.js.map +2 -2
- package/dist/creek-table/type.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- 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/{HeaderContent → ActionRender}/UserInfo.tsx +13 -24
- package/src/creek-layout/ActionRender/index.tsx +3 -0
- package/src/creek-layout/index.tsx +46 -45
- 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-layout/HeaderContent/UserInfo.d.ts +0 -1
- package/dist/creek-layout/HeaderContent/UserInfo.js.map +0 -7
- package/dist/creek-layout/HeaderContent/index.d.ts +0 -1
- package/dist/creek-layout/HeaderContent/index.js +0 -49
- package/dist/creek-layout/HeaderContent/index.js.map +0 -7
- 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-layout/HeaderContent/index.tsx +0 -24
- package/src/creek-table/TableViewContent.tsx +0 -53
- /package/dist/creek-layout/{HeaderContent → ActionRender}/FullScreen.d.ts +0 -0
- /package/src/creek-layout/{HeaderContent → ActionRender}/FullScreen.tsx +0 -0
|
@@ -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;A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A,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
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableOptionRender.d.ts","sourceRoot":"","sources":["../../src/creek-table/TableOptionRender.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAa5C,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,SAAS,GAAG,MAAM,IAAI;IACnG,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,0EAA2E,uBAAuB,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,4CAgC/I,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
@@ -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
|
+
{"version":3,"file":"useAdaptiveToolBar.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useAdaptiveToolBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA+B,MAAM,OAAO,CAAC;AAGtE,eAAO,MAAM,kBAAkB,YAAa;IAC1C,YAAY,EAAE,iBAAiB,WAAW,GAAG,IAAI,CAAC,CAAC;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;;CAoCA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoWidthColumns.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useAutoWidthColumns.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAC;AA4ExE,eAAO,MAAM,mBAAmB,0BACrB,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,YACrC,UAAU,cAAc,CAAC;aACvB,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS;gBAAc,MAAM,GAAG,SAAS;CAiInF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElementDistance.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useElementDistance.tsx"],"names":[],"mappings":";AAGA,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AAO/C,UAAU,QAAQ;IAChB,CAAC,EAAE,MAAM,CAAC;CACX;AAeD,eAAO,MAAM,kBAAkB,wDAAuD,QAAQ,GAAG,IAoChG,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"useTableScrollHeight.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useTableScrollHeight.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,cAAe,MAAM,YAAY,MAAM,SAAS,CAAC,cAAc,CAAC,oBAAmB,OAAO,mBAAyB,MAAM,iBAAqB,MAAM,uBA2DpL,CAAC"}
|
|
@@ -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,kB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":"index.d.ts","sourceRoot":"","sources":["../../src/creek-table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,eAAO,MAAM,UAAU,0EAA2E,gBAAgB,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,4CAMjI,CAAC"}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolBarRender.d.ts","sourceRoot":"","sources":["../../src/creek-table/toolBarRender.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,YAAa;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,QAwB/F,CAAC"}
|
|
@@ -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;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AC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
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}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LogoutOutlined } from "@ant-design/icons";
|
|
2
1
|
import { Avatar, Dropdown, DropDownProps, Space } from "antd";
|
|
3
2
|
import { createStyles } from "antd-style";
|
|
4
3
|
|
|
@@ -21,33 +20,23 @@ const useStyles = createStyles(({ token }) => ({
|
|
|
21
20
|
},
|
|
22
21
|
}));
|
|
23
22
|
|
|
24
|
-
export
|
|
23
|
+
export interface UserInfoProps {
|
|
24
|
+
name?: React.ReactNode;
|
|
25
|
+
avatar?: string;
|
|
26
|
+
menu?: DropDownProps['menu'];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const UserInfo = (props: UserInfoProps) => {
|
|
25
30
|
const { styles } = useStyles();
|
|
31
|
+
const { name, avatar, menu } = props;
|
|
26
32
|
|
|
27
|
-
const userInfoMenu: DropDownProps["menu"] = {
|
|
28
|
-
items: [
|
|
29
|
-
{
|
|
30
|
-
key: "logout",
|
|
31
|
-
label: (
|
|
32
|
-
<Space size={8}>
|
|
33
|
-
<LogoutOutlined />
|
|
34
|
-
<span>退出登录</span>
|
|
35
|
-
</Space>
|
|
36
|
-
),
|
|
37
|
-
onClick: () => {},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
33
|
return (
|
|
42
|
-
<Dropdown
|
|
43
|
-
arrow
|
|
44
|
-
placement="bottom"
|
|
45
|
-
overlayClassName={styles.userInfoDropdownOverlay}
|
|
46
|
-
menu={userInfoMenu}
|
|
47
|
-
>
|
|
34
|
+
<Dropdown arrow placement="bottom" overlayClassName={styles.userInfoDropdownOverlay} menu={menu}>
|
|
48
35
|
<Space size={4} align="center">
|
|
49
|
-
<Avatar className={styles.avatarContainer}>
|
|
50
|
-
|
|
36
|
+
<Avatar className={styles.avatarContainer} src={avatar}>
|
|
37
|
+
{name}
|
|
38
|
+
</Avatar>
|
|
39
|
+
<span>{name}</span>
|
|
51
40
|
</Space>
|
|
52
41
|
</Dropdown>
|
|
53
42
|
);
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { ProLayout, ProLayoutProps } from
|
|
2
|
-
import { useMemoizedFn } from
|
|
3
|
-
import { theme } from
|
|
4
|
-
import classnames from
|
|
1
|
+
import { ProLayout, ProLayoutProps } from '@ant-design/pro-components';
|
|
2
|
+
import { useMemoizedFn } from 'ahooks';
|
|
3
|
+
import { theme } from 'antd';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { FullScreen, UserInfo } from './ActionRender';
|
|
7
|
+
import { CollapsedButton, useCollapsedStore } from './CollapseButton';
|
|
8
|
+
import { Exception } from './Exception';
|
|
9
9
|
|
|
10
10
|
export type LayoutProps = ProLayoutProps & {
|
|
11
11
|
runtimeConfig: ProLayoutProps;
|
|
12
12
|
userConfig?: ProLayoutProps;
|
|
13
13
|
navigate?: (path?: string | number) => void;
|
|
14
|
+
showFullScreen?: boolean;
|
|
15
|
+
userInfo?: {
|
|
16
|
+
name?: React.ReactNode;
|
|
17
|
+
avatar?: string;
|
|
18
|
+
menu?: any;
|
|
19
|
+
};
|
|
14
20
|
initialInfo?: {
|
|
15
21
|
initialState: any;
|
|
16
22
|
loading: boolean;
|
|
@@ -19,68 +25,63 @@ export type LayoutProps = ProLayoutProps & {
|
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
export const CreekLayout = (props: LayoutProps) => {
|
|
22
|
-
const {
|
|
23
|
-
route,
|
|
24
|
-
userConfig,
|
|
25
|
-
runtimeConfig,
|
|
26
|
-
children,
|
|
27
|
-
location,
|
|
28
|
-
navigate,
|
|
29
|
-
...more
|
|
30
|
-
} = props;
|
|
28
|
+
const { route, userConfig, runtimeConfig, children, location, navigate, showFullScreen, userInfo, ...more } = props;
|
|
31
29
|
|
|
32
30
|
const { useToken } = theme;
|
|
33
31
|
const { token } = useToken();
|
|
34
32
|
|
|
35
33
|
const { collapsed } = useCollapsedStore();
|
|
36
34
|
|
|
37
|
-
const menuItemRender: ProLayoutProps[
|
|
38
|
-
(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
const menuItemRender: ProLayoutProps['menuItemRender'] = useMemoizedFn((itemProps, defaultDom) => {
|
|
36
|
+
return (
|
|
37
|
+
<span
|
|
38
|
+
onClick={() => {
|
|
39
|
+
if (navigate) {
|
|
40
|
+
navigate(itemProps.path);
|
|
41
|
+
}
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
{defaultDom}
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const actions: React.ReactNode[] = [];
|
|
50
|
+
if (showFullScreen) {
|
|
51
|
+
actions.push(<FullScreen key="full-screen" />);
|
|
52
|
+
}
|
|
53
|
+
if (userInfo) {
|
|
54
|
+
actions.push(<UserInfo key="user-info" {...userInfo} />);
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
return (
|
|
54
58
|
<ProLayout
|
|
55
|
-
className={classnames(
|
|
56
|
-
layout="mix"
|
|
59
|
+
className={classnames('creek-layout-container', userConfig?.className)}
|
|
57
60
|
route={route}
|
|
58
61
|
title={userConfig?.title}
|
|
59
62
|
siderWidth={212}
|
|
60
63
|
location={location}
|
|
61
64
|
menuItemRender={menuItemRender}
|
|
62
|
-
|
|
63
|
-
return <HeaderContent />;
|
|
64
|
-
}}
|
|
65
|
+
actionsRender={() => actions}
|
|
65
66
|
token={{
|
|
66
67
|
header: {
|
|
67
|
-
colorBgHeader:
|
|
68
|
-
colorHeaderTitle:
|
|
68
|
+
colorBgHeader: '#fff',
|
|
69
|
+
colorHeaderTitle: 'rgba(0, 0, 0, 0.80);',
|
|
69
70
|
colorTextMenuSelected: token.colorPrimary,
|
|
70
71
|
heightLayoutHeader: 48,
|
|
71
72
|
},
|
|
72
73
|
sider: {
|
|
73
|
-
colorMenuBackground:
|
|
74
|
-
colorBgMenuItemSelected:
|
|
74
|
+
colorMenuBackground: '#f7f8fa',
|
|
75
|
+
colorBgMenuItemSelected: 'transparent',
|
|
75
76
|
colorTextMenuActive: token.colorPrimary,
|
|
76
77
|
colorTextMenuSelected: token.colorPrimary,
|
|
77
78
|
colorTextMenuItemHover: token.colorPrimary,
|
|
78
|
-
colorTextMenu:
|
|
79
|
+
colorTextMenu: '#333',
|
|
79
80
|
},
|
|
80
81
|
pageContainer: {
|
|
81
|
-
paddingBlockPageContainerContent:
|
|
82
|
-
paddingInlinePageContainerContent:
|
|
83
|
-
colorBgPageContainer: 'linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);'
|
|
82
|
+
paddingBlockPageContainerContent: token.padding,
|
|
83
|
+
paddingInlinePageContainerContent: token.padding,
|
|
84
|
+
colorBgPageContainer: 'linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);',
|
|
84
85
|
},
|
|
85
86
|
}}
|
|
86
87
|
fixSiderbar
|
|
@@ -96,4 +97,4 @@ export const CreekLayout = (props: LayoutProps) => {
|
|
|
96
97
|
);
|
|
97
98
|
};
|
|
98
99
|
|
|
99
|
-
export * from
|
|
100
|
+
export * from './Exception';
|