@creekjs/web-components 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-father$colon$build.log +35 -19
- package/README.md +97 -18
- package/dist/creek-config-provider/CreekConfigContext.d.ts +4 -0
- package/dist/creek-config-provider/CreekConfigContext.d.ts.map +1 -1
- package/dist/creek-config-provider/CreekConfigContext.js.map +2 -2
- package/dist/creek-config-provider/CreekI18nProvider.d.ts +22 -0
- package/dist/creek-config-provider/CreekI18nProvider.d.ts.map +1 -0
- package/dist/creek-config-provider/CreekI18nProvider.js +92 -0
- package/dist/creek-config-provider/CreekI18nProvider.js.map +7 -0
- package/dist/creek-config-provider/index.d.ts +5 -3
- package/dist/creek-config-provider/index.d.ts.map +1 -1
- package/dist/creek-config-provider/index.js +47 -4
- package/dist/creek-config-provider/index.js.map +3 -3
- package/dist/creek-hooks/useApp/index.d.ts +3 -3
- package/dist/creek-keep-alive/index.d.ts +24 -1
- package/dist/creek-keep-alive/index.d.ts.map +1 -1
- package/dist/creek-keep-alive/index.js +141 -4
- package/dist/creek-keep-alive/index.js.map +2 -2
- package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +1 -1
- package/dist/creek-layout/ActionRender/FullScreen.js +3 -1
- package/dist/creek-layout/ActionRender/FullScreen.js.map +2 -2
- package/dist/creek-layout/ActionRender/LayoutSettings.d.ts +5 -0
- package/dist/creek-layout/ActionRender/LayoutSettings.d.ts.map +1 -0
- package/dist/creek-layout/ActionRender/LayoutSettings.js +73 -0
- package/dist/creek-layout/ActionRender/LayoutSettings.js.map +7 -0
- package/dist/creek-layout/ActionRender/UserInfo.js.map +2 -2
- package/dist/creek-layout/ActionRender/index.d.ts +1 -0
- package/dist/creek-layout/ActionRender/index.d.ts.map +1 -1
- package/dist/creek-layout/ActionRender/index.js +3 -0
- package/dist/creek-layout/ActionRender/index.js.map +2 -2
- package/dist/creek-layout/index.d.ts +5 -5
- package/dist/creek-layout/index.d.ts.map +1 -1
- package/dist/creek-layout/index.js +79 -16
- package/dist/creek-layout/index.js.map +3 -3
- package/dist/creek-layout/useLayoutSettingsStore.d.ts +20 -0
- package/dist/creek-layout/useLayoutSettingsStore.d.ts.map +1 -0
- package/dist/creek-layout/useLayoutSettingsStore.js +45 -0
- package/dist/creek-layout/useLayoutSettingsStore.js.map +7 -0
- package/dist/creek-locale-button/index.d.ts +1 -0
- package/dist/creek-locale-button/index.d.ts.map +1 -0
- package/dist/creek-locale-button/index.js +66 -0
- package/dist/creek-locale-button/index.js.map +7 -0
- package/dist/creek-page-container/index.d.ts +4 -0
- package/dist/creek-page-container/index.d.ts.map +1 -0
- package/dist/creek-page-container/index.js +68 -0
- package/dist/creek-page-container/index.js.map +7 -0
- package/dist/creek-style/index.d.ts +1 -0
- package/dist/creek-style/index.d.ts.map +1 -0
- package/dist/creek-style/index.js +24 -0
- package/dist/creek-style/index.js.map +7 -0
- package/dist/creek-style/scrollbar.d.ts +2 -0
- package/dist/creek-style/scrollbar.d.ts.map +1 -0
- package/dist/creek-style/scrollbar.js +55 -0
- package/dist/creek-style/scrollbar.js.map +7 -0
- package/dist/creek-table/SearchTable.d.ts +9 -0
- package/dist/creek-table/SearchTable.d.ts.map +1 -1
- package/dist/creek-table/SearchTable.js +109 -72
- package/dist/creek-table/SearchTable.js.map +3 -3
- package/dist/creek-table/components/DensityIcon.d.ts +9 -0
- package/dist/creek-table/components/DensityIcon.d.ts.map +1 -0
- package/dist/creek-table/components/DensityIcon.js +77 -0
- package/dist/creek-table/components/DensityIcon.js.map +7 -0
- package/dist/creek-table/components/EllipsisTooltip.d.ts +9 -0
- package/dist/creek-table/components/EllipsisTooltip.d.ts.map +1 -0
- package/dist/creek-table/components/EllipsisTooltip.js +122 -0
- package/dist/creek-table/components/EllipsisTooltip.js.map +7 -0
- package/dist/creek-table/components/index.d.ts +2 -0
- package/dist/creek-table/components/index.d.ts.map +1 -0
- package/dist/creek-table/components/index.js +26 -0
- package/dist/creek-table/components/index.js.map +7 -0
- package/dist/creek-table/hooks/index.d.ts +5 -0
- package/dist/creek-table/hooks/index.d.ts.map +1 -1
- package/dist/creek-table/hooks/index.js +10 -0
- package/dist/creek-table/hooks/index.js.map +2 -2
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +1 -1
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +1 -1
- package/dist/creek-table/hooks/useAutoWidthColumns.js +76 -17
- package/dist/creek-table/hooks/useAutoWidthColumns.js.map +2 -2
- package/dist/creek-table/hooks/useEllipsisColumns.d.ts +8 -0
- package/dist/creek-table/hooks/useEllipsisColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useEllipsisColumns.js +58 -0
- package/dist/creek-table/hooks/useEllipsisColumns.js.map +7 -0
- package/dist/creek-table/hooks/useIndexColumn.d.ts +2 -0
- package/dist/creek-table/hooks/useIndexColumn.d.ts.map +1 -0
- package/dist/creek-table/hooks/useIndexColumn.js +52 -0
- package/dist/creek-table/hooks/useIndexColumn.js.map +7 -0
- package/dist/creek-table/hooks/useResizableColumns.d.ts +20 -0
- package/dist/creek-table/hooks/useResizableColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useResizableColumns.js +279 -0
- package/dist/creek-table/hooks/useResizableColumns.js.map +7 -0
- package/dist/creek-table/hooks/useStatusColumns.d.ts +2 -0
- package/dist/creek-table/hooks/useStatusColumns.d.ts.map +1 -0
- package/dist/creek-table/hooks/useStatusColumns.js +215 -0
- package/dist/creek-table/hooks/useStatusColumns.js.map +7 -0
- package/dist/creek-table/hooks/useTableOptions.d.ts +15 -0
- package/dist/creek-table/hooks/useTableOptions.d.ts.map +1 -0
- package/dist/creek-table/hooks/useTableOptions.js +78 -0
- package/dist/creek-table/hooks/useTableOptions.js.map +7 -0
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts +6 -1
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +1 -1
- package/dist/creek-table/hooks/useTableScrollHeight.js +44 -5
- package/dist/creek-table/hooks/useTableScrollHeight.js.map +2 -2
- package/dist/creek-table/type.d.ts +4 -6
- package/dist/creek-table/type.d.ts.map +1 -1
- package/dist/creek-table/type.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +2 -2
- package/dist/locales/en-US.d.ts +25 -0
- package/dist/locales/en-US.d.ts.map +1 -0
- package/dist/locales/en-US.js +49 -0
- package/dist/locales/en-US.js.map +7 -0
- package/dist/locales/zh-CN.d.ts +25 -0
- package/dist/locales/zh-CN.d.ts.map +1 -0
- package/dist/locales/zh-CN.js +49 -0
- package/dist/locales/zh-CN.js.map +7 -0
- package/dist/utils/i18n.d.ts +2 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +34 -0
- package/dist/utils/i18n.js.map +7 -0
- package/i18n.config.ts +27 -0
- package/package.json +17 -3
- package/src/creek-config-provider/CreekConfigContext.tsx +5 -1
- package/src/creek-config-provider/CreekI18nProvider.tsx +87 -0
- package/src/creek-config-provider/index.tsx +53 -4
- package/src/creek-keep-alive/index.tsx +225 -6
- package/src/creek-layout/ActionRender/FullScreen.tsx +10 -6
- package/src/creek-layout/ActionRender/LayoutSettings.tsx +67 -0
- package/src/creek-layout/ActionRender/UserInfo.tsx +1 -1
- package/src/creek-layout/ActionRender/index.tsx +1 -0
- package/src/creek-layout/index.tsx +89 -22
- package/src/creek-layout/useLayoutSettingsStore.ts +25 -0
- package/src/creek-locale-button/index.tsx +42 -0
- package/src/creek-page-container/index.tsx +32 -0
- package/src/creek-style/index.ts +1 -0
- package/src/creek-style/scrollbar.ts +29 -0
- package/src/creek-table/SearchTable.tsx +125 -72
- package/src/creek-table/components/DensityIcon.tsx +63 -0
- package/src/creek-table/components/EllipsisTooltip.tsx +116 -0
- package/src/creek-table/components/index.tsx +3 -0
- package/src/creek-table/hooks/index.ts +5 -1
- package/src/creek-table/hooks/useAutoWidthColumns.tsx +93 -19
- package/src/creek-table/hooks/useEllipsisColumns.tsx +47 -0
- package/src/creek-table/hooks/useIndexColumn.tsx +27 -0
- package/src/creek-table/hooks/useResizableColumns.tsx +323 -0
- package/src/creek-table/hooks/useStatusColumns.tsx +252 -0
- package/src/creek-table/hooks/useTableOptions.tsx +81 -0
- package/src/creek-table/hooks/useTableScrollHeight.tsx +61 -6
- package/src/creek-table/type.ts +5 -7
- package/src/index.tsx +4 -0
- package/src/locales/en-US.ts +24 -0
- package/src/locales/zh-CN.ts +24 -0
- package/src/utils/i18n.ts +4 -0
- package/dist/creek-table/TableOptionRender.d.ts +0 -9
- package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
- package/dist/creek-table/TableOptionRender.js +0 -74
- package/dist/creek-table/TableOptionRender.js.map +0 -7
- package/dist/creek-table/toolBarRender.d.ts +0 -5
- package/dist/creek-table/toolBarRender.d.ts.map +0 -1
- package/dist/creek-table/toolBarRender.js +0 -58
- package/dist/creek-table/toolBarRender.js.map +0 -7
- package/src/creek-table/TableOptionRender.tsx +0 -57
- package/src/creek-table/toolBarRender.tsx +0 -28
|
@@ -1,39 +1,55 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @creekjs/web-components@1.0.
|
|
3
|
+
> @creekjs/web-components@1.0.5 father:build /Users/ernestwang/Documents/code-resoorce/creek/packages/web-components
|
|
4
4
|
> father build
|
|
5
5
|
|
|
6
6
|
[36minfo[39m - Clean output directories
|
|
7
7
|
[36minfo[39m - Bundless for [33msrc[39m directory to [33mcjs[39m format
|
|
8
8
|
[35mevent[39m - Bundless [90mCreekConfigContext.tsx[39m to [90mdist/creek-config-provider/CreekConfigContext.js[39m (with declaration)
|
|
9
|
+
[35mevent[39m - Bundless [90mModalHelper.tsx[39m to [90mdist/creek-hooks/useApp/ModalHelper.js[39m (with declaration)
|
|
10
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-config-provider/index.js[39m (with declaration)
|
|
9
11
|
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-hooks/index.js[39m (with declaration)
|
|
12
|
+
[35mevent[39m - Bundless [90mtypes.ts[39m to [90mdist/creek-hooks/useApp/types.js[39m (with declaration)
|
|
10
13
|
[35mevent[39m - Bundless [90mDrawerHelper.tsx[39m to [90mdist/creek-hooks/useApp/DrawerHelper.js[39m (with declaration)
|
|
14
|
+
[35mevent[39m - Bundless [90mCreekI18nProvider.tsx[39m to [90mdist/creek-config-provider/CreekI18nProvider.js[39m (with declaration)
|
|
15
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-keep-alive/index.js[39m (with declaration)
|
|
11
16
|
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-hooks/useApp/index.js[39m (with declaration)
|
|
12
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-config-provider/index.js[39m (with declaration)
|
|
13
17
|
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-icon/index.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 [90mModalHelper.tsx[39m to [90mdist/creek-hooks/useApp/ModalHelper.js[39m (with declaration)
|
|
16
|
-
[35mevent[39m - Bundless [90museViewportHeight.tsx[39m to [90mdist/creek-hooks/useViewportHeight.js[39m (with declaration)
|
|
17
|
-
[35mevent[39m - Bundless [90mFullScreen.tsx[39m to [90mdist/creek-layout/ActionRender/FullScreen.js[39m (with declaration)
|
|
18
|
-
[35mevent[39m - Bundless [90mCollapseButton.tsx[39m to [90mdist/creek-layout/CollapseButton.js[39m (with declaration)
|
|
19
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/Exception/index.js[39m (with declaration)
|
|
20
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-keep-alive/index.js[39m (with declaration)
|
|
21
18
|
[35mevent[39m - Bundless [90mUserInfo.tsx[39m to [90mdist/creek-layout/ActionRender/UserInfo.js[39m (with declaration)
|
|
22
|
-
[35mevent[39m - Bundless [
|
|
19
|
+
[35mevent[39m - Bundless [90museViewportHeight.tsx[39m to [90mdist/creek-hooks/useViewportHeight.js[39m (with declaration)
|
|
23
20
|
[35mevent[39m - Bundless [90mNotFound.tsx[39m to [90mdist/creek-layout/Exception/NotFound.js[39m (with declaration)
|
|
21
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/Exception/index.js[39m (with declaration)
|
|
24
22
|
[35mevent[39m - Bundless [90mNotFoundPage.tsx[39m to [90mdist/creek-layout/Exception/NotFoundPage.js[39m (with declaration)
|
|
25
|
-
[35mevent[39m - Bundless [
|
|
23
|
+
[35mevent[39m - Bundless [90mFullScreen.tsx[39m to [90mdist/creek-layout/ActionRender/FullScreen.js[39m (with declaration)
|
|
26
24
|
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/index.js[39m (with declaration)
|
|
27
|
-
[35mevent[39m - Bundless [
|
|
28
|
-
[35mevent[39m - Bundless [
|
|
25
|
+
[35mevent[39m - Bundless [90museLayoutSettingsStore.ts[39m to [90mdist/creek-layout/useLayoutSettingsStore.js[39m (with declaration)
|
|
26
|
+
[35mevent[39m - Bundless [90mLayoutSettings.tsx[39m to [90mdist/creek-layout/ActionRender/LayoutSettings.js[39m (with declaration)
|
|
27
|
+
[35mevent[39m - Bundless [90mCollapseButton.tsx[39m to [90mdist/creek-layout/CollapseButton.js[39m (with declaration)
|
|
28
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-page-container/index.js[39m (with declaration)
|
|
29
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-locale-button/index.js[39m (with declaration)
|
|
30
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-style/index.js[39m (with declaration)
|
|
31
|
+
[35mevent[39m - Bundless [90mscrollbar.ts[39m to [90mdist/creek-style/scrollbar.js[39m (with declaration)
|
|
32
|
+
[35mevent[39m - Bundless [90mEllipsisTooltip.tsx[39m to [90mdist/creek-table/components/EllipsisTooltip.js[39m (with declaration)
|
|
29
33
|
[35mevent[39m - Bundless [90museAdaptiveToolBar.tsx[39m to [90mdist/creek-table/hooks/useAdaptiveToolBar.js[39m (with declaration)
|
|
34
|
+
[35mevent[39m - Bundless [90mDensityIcon.tsx[39m to [90mdist/creek-table/components/DensityIcon.js[39m (with declaration)
|
|
35
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/components/index.js[39m (with declaration)
|
|
36
|
+
[35mevent[39m - Bundless [90museIndexColumn.tsx[39m to [90mdist/creek-table/hooks/useIndexColumn.js[39m (with declaration)
|
|
37
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-table/hooks/index.js[39m (with declaration)
|
|
38
|
+
[35mevent[39m - Bundless [90museEllipsisColumns.tsx[39m to [90mdist/creek-table/hooks/useEllipsisColumns.js[39m (with declaration)
|
|
30
39
|
[35mevent[39m - Bundless [90museElementDistance.tsx[39m to [90mdist/creek-table/hooks/useElementDistance.js[39m (with declaration)
|
|
40
|
+
[35mevent[39m - Bundless [90museAutoWidthColumns.tsx[39m to [90mdist/creek-table/hooks/useAutoWidthColumns.js[39m (with declaration)
|
|
41
|
+
[35mevent[39m - Bundless [90museResizableColumns.tsx[39m to [90mdist/creek-table/hooks/useResizableColumns.js[39m (with declaration)
|
|
42
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/index.js[39m (with declaration)
|
|
43
|
+
[35mevent[39m - Bundless [90museStatusColumns.tsx[39m to [90mdist/creek-table/hooks/useStatusColumns.js[39m (with declaration)
|
|
44
|
+
[35mevent[39m - Bundless [90museTableScrollHeight.tsx[39m to [90mdist/creek-table/hooks/useTableScrollHeight.js[39m (with declaration)
|
|
45
|
+
[35mevent[39m - Bundless [90mtype.ts[39m to [90mdist/creek-table/type.js[39m (with declaration)
|
|
31
46
|
[35mevent[39m - Bundless [90mSearchTable.tsx[39m to [90mdist/creek-table/SearchTable.js[39m (with declaration)
|
|
32
|
-
[35mevent[39m - Bundless [
|
|
47
|
+
[35mevent[39m - Bundless [90mzh-CN.ts[39m to [90mdist/locales/zh-CN.js[39m (with declaration)
|
|
48
|
+
[35mevent[39m - Bundless [90museTableOptions.tsx[39m to [90mdist/creek-table/hooks/useTableOptions.js[39m (with declaration)
|
|
49
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/ActionRender/index.js[39m (with declaration)
|
|
50
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-loading/index.js[39m (with declaration)
|
|
51
|
+
[35mevent[39m - Bundless [90mi18n.ts[39m to [90mdist/utils/i18n.js[39m (with declaration)
|
|
52
|
+
[35mevent[39m - Bundless [90men-US.ts[39m to [90mdist/locales/en-US.js[39m (with declaration)
|
|
33
53
|
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/index.js[39m (with declaration)
|
|
34
|
-
[35mevent[39m - Bundless [90mtype.ts[39m to [90mdist/creek-table/type.js[39m (with declaration)
|
|
35
|
-
[35mevent[39m - Bundless [90museTableScrollHeight.tsx[39m to [90mdist/creek-table/hooks/useTableScrollHeight.js[39m (with declaration)
|
|
36
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/index.js[39m (with declaration)
|
|
37
|
-
[35mevent[39m - Bundless [90mtoolBarRender.tsx[39m to [90mdist/creek-table/toolBarRender.js[39m (with declaration)
|
|
38
54
|
[35mevent[39m - Generate declaration files...
|
|
39
|
-
[35mevent[39m - Transformed successfully in
|
|
55
|
+
[35mevent[39m - Transformed successfully in 5249 ms (46 files)
|
package/README.md
CHANGED
|
@@ -31,7 +31,12 @@ import { CreekLayout } from '@creekjs/web-components';
|
|
|
31
31
|
|
|
32
32
|
function App() {
|
|
33
33
|
return (
|
|
34
|
-
<CreekLayout
|
|
34
|
+
<CreekLayout
|
|
35
|
+
showFullScreen={true}
|
|
36
|
+
showLocaleButton={true}
|
|
37
|
+
showSettingsButton={true}
|
|
38
|
+
keepAlive={true}
|
|
39
|
+
>
|
|
35
40
|
{/* 你的页面内容 */}
|
|
36
41
|
</CreekLayout>
|
|
37
42
|
);
|
|
@@ -39,11 +44,11 @@ function App() {
|
|
|
39
44
|
```
|
|
40
45
|
|
|
41
46
|
**特性**:
|
|
42
|
-
- 响应式布局
|
|
43
|
-
-
|
|
44
|
-
- 面包屑导航
|
|
47
|
+
- 响应式布局 & 侧边栏折叠
|
|
48
|
+
- 面包屑导航与页面保活 (`CreekKeepAlive`)
|
|
45
49
|
- 异常页面处理
|
|
46
|
-
-
|
|
50
|
+
- 内置全屏、国际化、以及**主题配置抽屉 (LayoutSettings)**
|
|
51
|
+
- 支持动态修改主题色并同步影响所有链接和组件 (`colorPrimary` / `colorLink`)
|
|
47
52
|
|
|
48
53
|
#### BgCenter
|
|
49
54
|
背景居中组件,用于页面背景处理。
|
|
@@ -106,26 +111,29 @@ function SearchDemo() {
|
|
|
106
111
|
|
|
107
112
|
### 📊 表格组件
|
|
108
113
|
|
|
109
|
-
#### CreekTable
|
|
110
|
-
|
|
114
|
+
#### SearchTable (原 CreekTable)
|
|
115
|
+
基于 Ant Design ProTable 的增强型业务表格组件。它在 `ProTable` 的基础上解决了高度计算、列宽自适应、表头溢出、列宽拖拽等常见痛点,真正做到开箱即用。
|
|
111
116
|
|
|
112
117
|
```tsx
|
|
113
|
-
import {
|
|
118
|
+
import { SearchTable } from '@creekjs/web-components';
|
|
114
119
|
|
|
115
120
|
const columns = [
|
|
116
121
|
{
|
|
117
122
|
title: '姓名',
|
|
118
123
|
dataIndex: 'name',
|
|
119
124
|
key: 'name',
|
|
125
|
+
width: 120,
|
|
120
126
|
},
|
|
121
127
|
{
|
|
122
128
|
title: '年龄',
|
|
123
129
|
dataIndex: 'age',
|
|
124
130
|
key: 'age',
|
|
131
|
+
width: 80,
|
|
125
132
|
},
|
|
126
133
|
{
|
|
127
134
|
title: '操作',
|
|
128
135
|
key: 'action',
|
|
136
|
+
// 开启自动宽度测量后,无需硬编码固定宽度,系统会自动测量其内部元素宽度
|
|
129
137
|
render: (_, record) => (
|
|
130
138
|
<a onClick={() => handleEdit(record)}>编辑</a>
|
|
131
139
|
),
|
|
@@ -134,7 +142,7 @@ const columns = [
|
|
|
134
142
|
|
|
135
143
|
function TableDemo() {
|
|
136
144
|
return (
|
|
137
|
-
<
|
|
145
|
+
<SearchTable
|
|
138
146
|
columns={columns}
|
|
139
147
|
request={async (params) => {
|
|
140
148
|
// 请求数据
|
|
@@ -146,22 +154,27 @@ function TableDemo() {
|
|
|
146
154
|
};
|
|
147
155
|
}}
|
|
148
156
|
rowKey="id"
|
|
157
|
+
// 增强特性配置:
|
|
158
|
+
pageFixedBottom={true} // 分页器是否始终固定在底部
|
|
159
|
+
showIndex={true} // 是否自动展示序号列 (支持翻页连续计算)
|
|
160
|
+
resizable={true} // 是否支持拖拽调整列宽
|
|
149
161
|
/>
|
|
150
162
|
);
|
|
151
163
|
}
|
|
152
164
|
```
|
|
153
165
|
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
166
|
+
**增强特性**:
|
|
167
|
+
- **自动高度计算 (`useTableScrollHeight`)**:根据页面剩余空间自动计算表格内容区域高度 (`scroll.y`),确保分页器固定在底部 (`pageFixedBottom: true`),页面不会出现双滚动条。
|
|
168
|
+
- **自动列宽计算 (`useAutoWidthColumns`)**:智能测量并分配操作列或动态内容列的宽度,防止内容被截断或挤压。
|
|
169
|
+
- **内置拖拽列宽 (`useResizableColumns`)**:开箱即用的列宽拖拽调整能力 (`resizable: true`)。
|
|
170
|
+
- **自动序号列 (`useIndexColumn`)**:一行配置 (`showIndex: true`) 即可生成全局连续的序号列(自动处理翻页逻辑)。
|
|
171
|
+
- **默认截断省略 (`useEllipsisColumns`)**:默认开启所有文本列的溢出省略 (`ellipsis: true`)。
|
|
172
|
+
- **布局优化 (`useTableOptions`)**:自带默认紧凑型布局,没有 HeaderTitle 时操作栏自动左对齐。
|
|
160
173
|
|
|
161
174
|
### ⚙️ 配置组件
|
|
162
175
|
|
|
163
176
|
#### CreekConfigProvider
|
|
164
|
-
|
|
177
|
+
全局配置提供者,整合了 `antd` 的 `ConfigProvider` 和全局上下文,自动接收并应用 `useLayoutSettingsStore` 中持久化的主题设置。
|
|
165
178
|
|
|
166
179
|
```tsx
|
|
167
180
|
import { CreekConfigProvider } from '@creekjs/web-components';
|
|
@@ -170,8 +183,9 @@ function App() {
|
|
|
170
183
|
return (
|
|
171
184
|
<CreekConfigProvider
|
|
172
185
|
theme={{
|
|
173
|
-
|
|
174
|
-
|
|
186
|
+
token: {
|
|
187
|
+
colorPrimary: '#00c07f', // 默认主色调
|
|
188
|
+
}
|
|
175
189
|
}}
|
|
176
190
|
>
|
|
177
191
|
<YourApp />
|
|
@@ -180,6 +194,71 @@ function App() {
|
|
|
180
194
|
}
|
|
181
195
|
```
|
|
182
196
|
|
|
197
|
+
**特性**:
|
|
198
|
+
- 内置 `useApp` 机制,提供命令式弹窗/抽屉(`drawer.open` / `modal.open`)
|
|
199
|
+
- 内置 `CreekI18nProvider` 处理多语言
|
|
200
|
+
- 自动合并用户在设置抽屉中修改的 `colorPrimary`(并将其同步为 `colorLink` 的颜色)
|
|
201
|
+
|
|
202
|
+
### 🛠️ Hook 扩展
|
|
203
|
+
|
|
204
|
+
#### useApp (弹窗/抽屉快捷调用)
|
|
205
|
+
提供了一套基于上下文的快捷方法,用于在应用任何地方命令式地调起 `Modal` 或 `Drawer`,并特别支持了针对 `@ant-design/pro-components` 的 `ModalForm` 和 `DrawerForm` 的无缝集成。
|
|
206
|
+
|
|
207
|
+
**核心优势**:
|
|
208
|
+
- **告别 `visible` / `open` state**:不再需要在父组件中维护一堆开关状态和冗长的 JSX 标签。
|
|
209
|
+
- **自动上下文继承**:基于 `CreekConfigProvider` 内部包裹的 `AppProvider`,弹出的弹窗/抽屉天然继承 Redux/Zustand、React Router、以及 i18n 等所有上下文(不像传统的 `Modal.confirm` 会丢失上下文)。
|
|
210
|
+
- **原生支持 ProForm**:提供了 `openForm` 方法,专门用于挂载 `ModalForm` / `DrawerForm`,表单的 `onFinish` 等逻辑均可正常运作。
|
|
211
|
+
|
|
212
|
+
**使用示例:**
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import { useApp } from '@creekjs/web-components';
|
|
216
|
+
import { Button, Form, Input } from 'antd';
|
|
217
|
+
import { ModalForm, ProFormText } from '@ant-design/pro-components';
|
|
218
|
+
|
|
219
|
+
export default function Demo() {
|
|
220
|
+
const { modal, drawer } = useApp();
|
|
221
|
+
|
|
222
|
+
// 1. 打开普通弹窗
|
|
223
|
+
const handleOpenNormalModal = () => {
|
|
224
|
+
modal.open({
|
|
225
|
+
title: '普通弹窗',
|
|
226
|
+
content: <div>这里是弹窗内容</div>,
|
|
227
|
+
onOk: () => {
|
|
228
|
+
console.log('点击了确定');
|
|
229
|
+
modal.close();
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// 2. 打开表单抽屉 (DrawerForm)
|
|
235
|
+
const handleOpenFormDrawer = () => {
|
|
236
|
+
drawer.openForm({
|
|
237
|
+
title: '新建用户',
|
|
238
|
+
width: 400,
|
|
239
|
+
content: (
|
|
240
|
+
<>
|
|
241
|
+
<ProFormText name="username" label="用户名" rules={[{ required: true }]} />
|
|
242
|
+
<ProFormText name="email" label="邮箱" />
|
|
243
|
+
</>
|
|
244
|
+
),
|
|
245
|
+
onFinish: async (values) => {
|
|
246
|
+
console.log('表单提交:', values);
|
|
247
|
+
// 返回 true 会自动关闭抽屉
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<div style={{ display: 'flex', gap: 16 }}>
|
|
255
|
+
<Button onClick={handleOpenNormalModal}>打开弹窗</Button>
|
|
256
|
+
<Button type="primary" onClick={handleOpenFormDrawer}>打开表单抽屉</Button>
|
|
257
|
+
</div>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
183
262
|
### 🎯 工具组件
|
|
184
263
|
|
|
185
264
|
#### CreekIcon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreekConfigContext.d.ts","sourceRoot":"","sources":["../../src/creek-config-provider/CreekConfigContext.tsx"],"names":[],"mappings":";AAEA,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"CreekConfigContext.d.ts","sourceRoot":"","sources":["../../src/creek-config-provider/CreekConfigContext.tsx"],"names":[],"mappings":";AAEA,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,kDAA6C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/creek-config-provider/CreekConfigContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react';\n\nexport type CreekConfigContextProps = {\n iconFontCNs?: string[]
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\n\nexport type CreekConfigContextProps = {\n iconFontCNs?: string[];\n /**\n * 国际化语言包\n */\n locale?: Record<string, string>;\n};\n\nexport const CreekConfigContext = createContext<CreekConfigContextProps>({});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAUvB,IAAM,yBAAqB,4BAAuC,CAAC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface CreekI18nProviderProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* 语言标识
|
|
6
|
+
* @default 'zh-CN'
|
|
7
|
+
*/
|
|
8
|
+
locale?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 国际化语言包,透传给 react-intl
|
|
11
|
+
*/
|
|
12
|
+
messages?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export declare const LocaleContext: import("react").Context<{
|
|
15
|
+
locale: string;
|
|
16
|
+
changeLocale: (lang: string) => void;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const useAppLocale: () => {
|
|
19
|
+
locale: string;
|
|
20
|
+
changeLocale: (lang: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare const CreekI18nProvider: (props: CreekI18nProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreekI18nProvider.d.ts","sourceRoot":"","sources":["../../src/creek-config-provider/CreekI18nProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAOD,eAAO,MAAM,aAAa;;yBAEH,MAAM;EAC3B,CAAC;AAEH,eAAO,MAAM,YAAY;;yBAHF,MAAM;CAG8B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,UAAW,sBAAsB,4CAmD9D,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/creek-config-provider/CreekI18nProvider.tsx
|
|
30
|
+
var CreekI18nProvider_exports = {};
|
|
31
|
+
__export(CreekI18nProvider_exports, {
|
|
32
|
+
CreekI18nProvider: () => CreekI18nProvider,
|
|
33
|
+
LocaleContext: () => LocaleContext,
|
|
34
|
+
useAppLocale: () => useAppLocale
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(CreekI18nProvider_exports);
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_react2 = require("@creekjs/i18n/react");
|
|
39
|
+
var import_en_US = __toESM(require("../locales/en-US"));
|
|
40
|
+
var import_zh_CN = __toESM(require("../locales/zh-CN"));
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var DEFAULT_LOCALE = "zh-CN";
|
|
43
|
+
var MESSAGES_MAP = {
|
|
44
|
+
[DEFAULT_LOCALE]: import_zh_CN.default,
|
|
45
|
+
"en-US": import_en_US.default
|
|
46
|
+
};
|
|
47
|
+
var LocaleContext = (0, import_react.createContext)({
|
|
48
|
+
locale: (0, import_react2.getLocale)() || DEFAULT_LOCALE,
|
|
49
|
+
changeLocale: (lang) => {
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var useAppLocale = () => (0, import_react.useContext)(LocaleContext);
|
|
53
|
+
var CreekI18nProvider = (props) => {
|
|
54
|
+
var _a;
|
|
55
|
+
const { children, locale, messages } = props;
|
|
56
|
+
const parentIntl = (0, import_react.useContext)(import_react2.IntlContext);
|
|
57
|
+
const [intl, setIntl] = (0, import_react.useState)(() => (0, import_react2.getIntl)());
|
|
58
|
+
const changeLocale = (0, import_react.useCallback)((lang) => {
|
|
59
|
+
(0, import_react2.setLocale)(lang, false);
|
|
60
|
+
setIntl((0, import_react2.getIntl)());
|
|
61
|
+
}, []);
|
|
62
|
+
const currentLocale = (intl == null ? void 0 : intl.locale) || locale || (parentIntl == null ? void 0 : parentIntl.locale) || DEFAULT_LOCALE;
|
|
63
|
+
const intlConfig = parentIntl || intl || {};
|
|
64
|
+
const safeConfig = {
|
|
65
|
+
formats: intlConfig.formats,
|
|
66
|
+
defaultLocale: intlConfig.defaultLocale,
|
|
67
|
+
defaultFormats: intlConfig.defaultFormats,
|
|
68
|
+
onError: intlConfig.onError
|
|
69
|
+
};
|
|
70
|
+
let baseMessages = {};
|
|
71
|
+
if (parentIntl && parentIntl.locale === currentLocale) {
|
|
72
|
+
baseMessages = parentIntl.messages;
|
|
73
|
+
} else {
|
|
74
|
+
baseMessages = ((_a = (0, import_react2.getIntl)()) == null ? void 0 : _a.messages) || {};
|
|
75
|
+
}
|
|
76
|
+
const finalMessages = {
|
|
77
|
+
...baseMessages,
|
|
78
|
+
...MESSAGES_MAP[currentLocale] || import_zh_CN.default,
|
|
79
|
+
...messages || {}
|
|
80
|
+
};
|
|
81
|
+
(0, import_react.useEffect)(() => {
|
|
82
|
+
(0, import_react2.setLocaleMessages)(currentLocale, finalMessages);
|
|
83
|
+
}, [currentLocale, finalMessages]);
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.IntlProvider, { ...safeConfig, locale: currentLocale, messages: finalMessages, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LocaleContext.Provider, { value: { locale: currentLocale, changeLocale }, children }) });
|
|
85
|
+
};
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
CreekI18nProvider,
|
|
89
|
+
LocaleContext,
|
|
90
|
+
useAppLocale
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=CreekI18nProvider.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/creek-config-provider/CreekI18nProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useState } from 'react';\n\nimport { IntlContext, IntlProvider, getIntl, getLocale, setLocale, setLocaleMessages } from '@creekjs/i18n/react';\n\nimport enUS from '../locales/en-US';\nimport zhCN from '../locales/zh-CN';\n\nconst DEFAULT_LOCALE = 'zh-CN';\n\nexport interface CreekI18nProviderProps {\n children?: ReactNode;\n /**\n * 语言标识\n * @default 'zh-CN'\n */\n locale?: string;\n /**\n * 国际化语言包,透传给 react-intl\n */\n messages?: Record<string, string>;\n}\n\nconst MESSAGES_MAP: Record<string, Record<string, string>> = {\n [DEFAULT_LOCALE]: zhCN,\n 'en-US': enUS,\n};\n\nexport const LocaleContext = createContext({\n locale: getLocale() || DEFAULT_LOCALE,\n changeLocale: (lang: string) => {},\n});\n\nexport const useAppLocale = () => useContext(LocaleContext);\n\nexport const CreekI18nProvider = (props: CreekI18nProviderProps) => {\n const { children, locale, messages } = props;\n\n // Try to get parent intl context\n const parentIntl = useContext(IntlContext);\n\n const [intl, setIntl] = useState(() => getIntl());\n\n const changeLocale = useCallback((lang: string) => {\n setLocale(lang, false);\n setIntl(getIntl());\n }, []);\n\n // 1. 确定最终生效的 locale\n // 优先级:当前组件内部的 state > props.locale > parentIntl.locale > 全局默认\n const currentLocale = intl?.locale || locale || parentIntl?.locale || DEFAULT_LOCALE;\n\n // 2. 提取父级上下文的安全配置 (避免将 IntlShape 的内部方法直接传给 IntlProvider)\n const intlConfig = parentIntl || intl || {};\n const safeConfig = {\n formats: intlConfig.formats,\n defaultLocale: intlConfig.defaultLocale,\n defaultFormats: intlConfig.defaultFormats,\n onError: intlConfig.onError,\n };\n\n // 3. 确定最终的 messages\n // 避免使用 stale 的 parentIntl.messages\n let baseMessages = {};\n if (parentIntl && parentIntl.locale === currentLocale) {\n baseMessages = parentIntl.messages;\n } else {\n baseMessages = getIntl()?.messages || {};\n }\n\n const finalMessages = {\n ...baseMessages,\n ...(MESSAGES_MAP[currentLocale] || zhCN),\n ...(messages || {}),\n };\n\n // 4. 同步给全局 globalIntl,确保非 React 组件能够拿到\n useEffect(() => {\n setLocaleMessages(currentLocale, finalMessages);\n }, [currentLocale, finalMessages]);\n\n return (\n <IntlProvider {...safeConfig} locale={currentLocale} messages={finalMessages}>\n <LocaleContext.Provider value={{ locale: currentLocale, changeLocale }}>{children}</LocaleContext.Provider>\n </IntlProvider>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4E;AAE5E,IAAAA,gBAA4F;AAE5F,mBAAiB;AACjB,mBAAiB;AA6EX;AA3EN,IAAM,iBAAiB;AAevB,IAAM,eAAuD;AAAA,EAC3D,CAAC,cAAc,GAAG,aAAAC;AAAA,EAClB,SAAS,aAAAC;AACX;AAEO,IAAM,oBAAgB,4BAAc;AAAA,EACzC,YAAQ,yBAAU,KAAK;AAAA,EACvB,cAAc,CAAC,SAAiB;AAAA,EAAC;AACnC,CAAC;AAEM,IAAM,eAAe,UAAM,yBAAW,aAAa;AAEnD,IAAM,oBAAoB,CAAC,UAAkC;AAnCpE;AAoCE,QAAM,EAAE,UAAU,QAAQ,SAAS,IAAI;AAGvC,QAAM,iBAAa,yBAAW,yBAAW;AAEzC,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,UAAM,uBAAQ,CAAC;AAEhD,QAAM,mBAAe,0BAAY,CAAC,SAAiB;AACjD,iCAAU,MAAM,KAAK;AACrB,gBAAQ,uBAAQ,CAAC;AAAA,EACnB,GAAG,CAAC,CAAC;AAIL,QAAM,iBAAgB,6BAAM,WAAU,WAAU,yCAAY,WAAU;AAGtE,QAAM,aAAa,cAAc,QAAQ,CAAC;AAC1C,QAAM,aAAa;AAAA,IACjB,SAAS,WAAW;AAAA,IACpB,eAAe,WAAW;AAAA,IAC1B,gBAAgB,WAAW;AAAA,IAC3B,SAAS,WAAW;AAAA,EACtB;AAIA,MAAI,eAAe,CAAC;AACpB,MAAI,cAAc,WAAW,WAAW,eAAe;AACrD,mBAAe,WAAW;AAAA,EAC5B,OAAO;AACL,qBAAe,gCAAQ,MAAR,mBAAW,aAAY,CAAC;AAAA,EACzC;AAEA,QAAM,gBAAgB;AAAA,IACpB,GAAG;AAAA,IACH,GAAI,aAAa,aAAa,KAAK,aAAAD;AAAA,IACnC,GAAI,YAAY,CAAC;AAAA,EACnB;AAGA,8BAAU,MAAM;AACd,yCAAkB,eAAe,aAAa;AAAA,EAChD,GAAG,CAAC,eAAe,aAAa,CAAC;AAEjC,SACE,4CAAC,8BAAc,GAAG,YAAY,QAAQ,eAAe,UAAU,eAC7D,sDAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,QAAQ,eAAe,aAAa,GAAI,UAAS,GACpF;AAEJ;",
|
|
6
|
+
"names": ["import_react", "zhCN", "enUS"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { ConfigProviderProps } from 'antd';
|
|
2
3
|
import { CreekConfigContextProps } from './CreekConfigContext';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
4
|
+
import { CreekI18nProvider, CreekI18nProviderProps, LocaleContext, useAppLocale } from './CreekI18nProvider';
|
|
5
|
+
export type CreekConfigProviderProps = CreekConfigContextProps & Omit<ConfigProviderProps, 'locale'> & CreekI18nProviderProps;
|
|
6
|
+
export { CreekI18nProvider, LocaleContext, useAppLocale };
|
|
7
|
+
export type { CreekI18nProviderProps };
|
|
6
8
|
export declare const CreekConfigProvider: {
|
|
7
9
|
(props: CreekConfigProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
CreekConfigContext: import("react").Context<CreekConfigContextProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-config-provider/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-config-provider/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAQhD,OAAO,EAAsB,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7G,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,GAAG,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG,sBAAsB,CAAC;AAE9H,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AAC1D,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAoCvC,eAAO,MAAM,mBAAmB;YAAW,wBAAwB;;CAQlE,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,23 +16,64 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/creek-config-provider/index.tsx
|
|
20
30
|
var creek_config_provider_exports = {};
|
|
21
31
|
__export(creek_config_provider_exports, {
|
|
22
|
-
CreekConfigProvider: () => CreekConfigProvider
|
|
32
|
+
CreekConfigProvider: () => CreekConfigProvider,
|
|
33
|
+
CreekI18nProvider: () => import_CreekI18nProvider.CreekI18nProvider,
|
|
34
|
+
LocaleContext: () => import_CreekI18nProvider.LocaleContext,
|
|
35
|
+
useAppLocale: () => import_CreekI18nProvider.useAppLocale
|
|
23
36
|
});
|
|
24
37
|
module.exports = __toCommonJS(creek_config_provider_exports);
|
|
38
|
+
var import_antd = require("antd");
|
|
39
|
+
var import_en_US = __toESM(require("antd/locale/en_US"));
|
|
40
|
+
var import_zh_CN = __toESM(require("antd/locale/zh_CN"));
|
|
41
|
+
var import_merge = __toESM(require("lodash/merge"));
|
|
42
|
+
var import_creek_hooks = require("../creek-hooks");
|
|
43
|
+
var import_useLayoutSettingsStore = require("../creek-layout/useLayoutSettingsStore");
|
|
25
44
|
var import_CreekConfigContext = require("./CreekConfigContext");
|
|
45
|
+
var import_CreekI18nProvider = require("./CreekI18nProvider");
|
|
26
46
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
+
var InnerConfigProvider = (props) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const { children, theme, ...more } = props;
|
|
50
|
+
const { locale } = (0, import_CreekI18nProvider.useAppLocale)();
|
|
51
|
+
const settingsStore = (0, import_useLayoutSettingsStore.useLayoutSettingsStore)();
|
|
52
|
+
const activeColorPrimary = settingsStore.colorPrimary || ((_a = theme == null ? void 0 : theme.token) == null ? void 0 : _a.colorPrimary);
|
|
53
|
+
let finalTheme = (0, import_merge.default)(
|
|
54
|
+
{},
|
|
55
|
+
theme,
|
|
56
|
+
activeColorPrimary ? {
|
|
57
|
+
token: {
|
|
58
|
+
colorPrimary: activeColorPrimary,
|
|
59
|
+
colorLink: activeColorPrimary,
|
|
60
|
+
colorLinkHover: activeColorPrimary,
|
|
61
|
+
colorLinkActive: activeColorPrimary
|
|
62
|
+
}
|
|
63
|
+
} : {}
|
|
64
|
+
);
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, { locale: locale === "en-US" ? import_en_US.default : import_zh_CN.default, theme: finalTheme, ...more, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CreekConfigContext.CreekConfigContext.Provider, { value: more, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.App, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_creek_hooks.AppProvider, { children }) }) }) });
|
|
66
|
+
};
|
|
27
67
|
var CreekConfigProvider = (props) => {
|
|
28
|
-
const { children, ...more } = props;
|
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
const { children, locale, messages, ...more } = props;
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CreekI18nProvider.CreekI18nProvider, { locale, messages, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InnerConfigProvider, { ...more, children }) });
|
|
30
70
|
};
|
|
31
71
|
CreekConfigProvider.CreekConfigContext = import_CreekConfigContext.CreekConfigContext;
|
|
32
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
73
|
0 && (module.exports = {
|
|
34
|
-
CreekConfigProvider
|
|
74
|
+
CreekConfigProvider,
|
|
75
|
+
CreekI18nProvider,
|
|
76
|
+
LocaleContext,
|
|
77
|
+
useAppLocale
|
|
35
78
|
});
|
|
36
79
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/creek-config-provider/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { CreekConfigContext, CreekConfigContextProps } from './CreekConfigContext';\n\nexport type CreekConfigProviderProps = CreekConfigContextProps & {\n children
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import type { ConfigProviderProps } from 'antd';\nimport { App, ConfigProvider } from 'antd';\nimport enUS_antd from 'antd/locale/en_US';\nimport zhCN_antd from 'antd/locale/zh_CN';\nimport merge from 'lodash/merge';\n\nimport { AppProvider } from '../creek-hooks';\nimport { useLayoutSettingsStore } from '../creek-layout/useLayoutSettingsStore';\nimport { CreekConfigContext, CreekConfigContextProps } from './CreekConfigContext';\nimport { CreekI18nProvider, CreekI18nProviderProps, LocaleContext, useAppLocale } from './CreekI18nProvider';\n\nexport type CreekConfigProviderProps = CreekConfigContextProps & Omit<ConfigProviderProps, 'locale'> & CreekI18nProviderProps;\n\nexport { CreekI18nProvider, LocaleContext, useAppLocale };\nexport type { CreekI18nProviderProps };\n\nconst InnerConfigProvider = (props: Omit<CreekConfigProviderProps, 'locale' | 'messages'>) => {\n const { children, theme, ...more } = props;\n const { locale } = useAppLocale();\n const settingsStore = useLayoutSettingsStore();\n\n const activeColorPrimary = settingsStore.colorPrimary || theme?.token?.colorPrimary;\n\n let finalTheme = merge(\n {},\n theme,\n activeColorPrimary\n ? {\n token: {\n colorPrimary: activeColorPrimary,\n colorLink: activeColorPrimary,\n colorLinkHover: activeColorPrimary,\n colorLinkActive: activeColorPrimary,\n },\n }\n : {}\n );\n\n\n return (\n <ConfigProvider locale={locale === 'en-US' ? enUS_antd : zhCN_antd} theme={finalTheme} {...more}>\n <CreekConfigContext.Provider value={more as any}>\n <App>\n <AppProvider>{children}</AppProvider>\n </App>\n </CreekConfigContext.Provider>\n </ConfigProvider>\n );\n};\n\nexport const CreekConfigProvider = (props: CreekConfigProviderProps) => {\n const { children, locale, messages, ...more } = props;\n\n return (\n <CreekI18nProvider locale={locale} messages={messages}>\n <InnerConfigProvider {...more}>{children}</InnerConfigProvider>\n </CreekI18nProvider>\n );\n};\n\nCreekConfigProvider.CreekConfigContext = CreekConfigContext;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;AACpC,mBAAsB;AACtB,mBAAsB;AACtB,mBAAkB;AAElB,yBAA4B;AAC5B,oCAAuC;AACvC,gCAA4D;AAC5D,+BAAuF;AAkC7E;AA3BV,IAAM,sBAAsB,CAAC,UAAiE;AAhB9F;AAiBE,QAAM,EAAE,UAAU,OAAO,GAAG,KAAK,IAAI;AACrC,QAAM,EAAE,OAAO,QAAI,uCAAa;AAChC,QAAM,oBAAgB,sDAAuB;AAE7C,QAAM,qBAAqB,cAAc,kBAAgB,oCAAO,UAAP,mBAAc;AAEvE,MAAI,iBAAa,aAAAA;AAAA,IACf,CAAC;AAAA,IACD;AAAA,IACA,qBACI;AAAA,MACE,OAAO;AAAA,QACL,cAAc;AAAA,QACd,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,MACnB;AAAA,IACF,IACA,CAAC;AAAA,EACP;AAGA,SACE,4CAAC,8BAAe,QAAQ,WAAW,UAAU,aAAAC,UAAY,aAAAC,SAAW,OAAO,YAAa,GAAG,MACzF,sDAAC,6CAAmB,UAAnB,EAA4B,OAAO,MAClC,sDAAC,mBACC,sDAAC,kCAAa,UAAS,GACzB,GACF,GACF;AAEJ;AAEO,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,QAAQ,UAAU,GAAG,KAAK,IAAI;AAEhD,SACE,4CAAC,8CAAkB,QAAgB,UACjC,sDAAC,uBAAqB,GAAG,MAAO,UAAS,GAC3C;AAEJ;AAEA,oBAAoB,qBAAqB;",
|
|
6
|
+
"names": ["merge", "enUS_antd", "zhCN_antd"]
|
|
7
7
|
}
|
|
@@ -13,10 +13,10 @@ export declare const useApp: () => {
|
|
|
13
13
|
open: (config: NormalModalConfig) => void;
|
|
14
14
|
openForm: (config: Omit<FormModalConfig, "type">) => void;
|
|
15
15
|
close: () => void;
|
|
16
|
-
info: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
17
|
-
success: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
18
|
-
error: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
19
16
|
warning: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
17
|
+
error: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
18
|
+
success: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
19
|
+
info: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
20
20
|
confirm: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
21
21
|
};
|
|
22
22
|
message: import("antd/es/message/interface").MessageInstance;
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CreekKeepAliveProps {
|
|
3
|
+
/**
|
|
4
|
+
* 不需要缓存的路径
|
|
5
|
+
*/
|
|
6
|
+
exclude?: (string | RegExp)[];
|
|
7
|
+
/**
|
|
8
|
+
* 自定义Tab标题获取方法
|
|
9
|
+
*/
|
|
10
|
+
getTabTitle?: (pathname: string) => React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* 默认首页路径
|
|
13
|
+
*/
|
|
14
|
+
homePath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Tabs的样式
|
|
17
|
+
*/
|
|
18
|
+
tabBarStyle?: React.CSSProperties;
|
|
19
|
+
/**
|
|
20
|
+
* 最大缓存数量,默认为 20
|
|
21
|
+
*/
|
|
22
|
+
maxTabCount?: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const CreekKeepAlive: React.FC<CreekKeepAliveProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-keep-alive/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-keep-alive/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACpD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAQD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgMxD,CAAC"}
|