@creekjs/web-components 1.0.5 → 1.0.7
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 +32 -16
- package/README.md +117 -66
- package/dist/creek-config-provider/CreekConfigContext.d.ts +4 -0
- 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.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.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.js +141 -4
- package/dist/creek-keep-alive/index.js.map +2 -2
- 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.js.map +1 -1
- package/dist/index.d.ts +4 -0
- 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.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.js +49 -0
- package/dist/locales/zh-CN.js.map +7 -0
- package/dist/utils/i18n.d.ts +2 -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 +22 -8
- 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-config-provider/CreekConfigContext.d.ts.map +0 -1
- package/dist/creek-config-provider/index.d.ts.map +0 -1
- package/dist/creek-hooks/index.d.ts.map +0 -1
- package/dist/creek-hooks/useApp/DrawerHelper.d.ts.map +0 -1
- package/dist/creek-hooks/useApp/ModalHelper.d.ts.map +0 -1
- package/dist/creek-hooks/useApp/index.d.ts.map +0 -1
- package/dist/creek-hooks/useApp/types.d.ts.map +0 -1
- package/dist/creek-hooks/useViewportHeight.d.ts.map +0 -1
- package/dist/creek-icon/index.d.ts.map +0 -1
- package/dist/creek-keep-alive/index.d.ts.map +0 -1
- package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +0 -1
- package/dist/creek-layout/ActionRender/UserInfo.d.ts.map +0 -1
- package/dist/creek-layout/ActionRender/index.d.ts.map +0 -1
- package/dist/creek-layout/CollapseButton.d.ts.map +0 -1
- package/dist/creek-layout/Exception/NotFound.d.ts.map +0 -1
- package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +0 -1
- package/dist/creek-layout/Exception/index.d.ts.map +0 -1
- package/dist/creek-layout/index.d.ts.map +0 -1
- package/dist/creek-loading/index.d.ts.map +0 -1
- package/dist/creek-table/SearchTable.d.ts.map +0 -1
- 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/hooks/index.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +0 -1
- package/dist/creek-table/hooks/useElementDistance.d.ts.map +0 -1
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +0 -1
- package/dist/creek-table/index.d.ts.map +0 -1
- 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/dist/creek-table/type.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- 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.7 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)
|
|
10
|
-
[35mevent[39m - Bundless [90mDrawerHelper.tsx[39m to [90mdist/creek-hooks/useApp/DrawerHelper.js[39m (with declaration)
|
|
11
12
|
[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
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-icon/index.js[39m (with declaration)
|
|
14
13
|
[35mevent[39m - Bundless [90mtypes.ts[39m to [90mdist/creek-hooks/useApp/types.js[39m (with declaration)
|
|
15
|
-
[35mevent[39m - Bundless [
|
|
14
|
+
[35mevent[39m - Bundless [90mDrawerHelper.tsx[39m to [90mdist/creek-hooks/useApp/DrawerHelper.js[39m (with declaration)
|
|
16
15
|
[35mevent[39m - Bundless [90museViewportHeight.tsx[39m to [90mdist/creek-hooks/useViewportHeight.js[39m (with declaration)
|
|
16
|
+
[35mevent[39m - Bundless [90mCreekI18nProvider.tsx[39m to [90mdist/creek-config-provider/CreekI18nProvider.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 [90mindex.tsx[39m to [90mdist/creek-icon/index.js[39m (with declaration)
|
|
17
19
|
[35mevent[39m - Bundless [90mFullScreen.tsx[39m to [90mdist/creek-layout/ActionRender/FullScreen.js[39m (with declaration)
|
|
18
20
|
[35mevent[39m - Bundless [90mCollapseButton.tsx[39m to [90mdist/creek-layout/CollapseButton.js[39m (with declaration)
|
|
21
|
+
[35mevent[39m - Bundless [90mNotFoundPage.tsx[39m to [90mdist/creek-layout/Exception/NotFoundPage.js[39m (with declaration)
|
|
19
22
|
[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
|
-
[35mevent[39m - Bundless [90mUserInfo.tsx[39m to [90mdist/creek-layout/ActionRender/UserInfo.js[39m (with declaration)
|
|
22
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/ActionRender/index.js[39m (with declaration)
|
|
23
23
|
[35mevent[39m - Bundless [90mNotFound.tsx[39m to [90mdist/creek-layout/Exception/NotFound.js[39m (with declaration)
|
|
24
|
-
[35mevent[39m - Bundless [
|
|
24
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/ActionRender/index.js[39m (with declaration)
|
|
25
|
+
[35mevent[39m - Bundless [90mLayoutSettings.tsx[39m to [90mdist/creek-layout/ActionRender/LayoutSettings.js[39m (with declaration)
|
|
26
|
+
[35mevent[39m - Bundless [90mUserInfo.tsx[39m to [90mdist/creek-layout/ActionRender/UserInfo.js[39m (with declaration)
|
|
25
27
|
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-loading/index.js[39m (with declaration)
|
|
28
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-locale-button/index.js[39m (with declaration)
|
|
29
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-style/index.js[39m (with declaration)
|
|
26
30
|
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/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 [90museLayoutSettingsStore.ts[39m to [90mdist/creek-layout/useLayoutSettingsStore.js[39m (with declaration)
|
|
33
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/components/index.js[39m (with declaration)
|
|
34
|
+
[35mevent[39m - Bundless [90mEllipsisTooltip.tsx[39m to [90mdist/creek-table/components/EllipsisTooltip.js[39m (with declaration)
|
|
27
35
|
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-table/hooks/index.js[39m (with declaration)
|
|
28
|
-
[35mevent[39m - Bundless [90museAutoWidthColumns.tsx[39m to [90mdist/creek-table/hooks/useAutoWidthColumns.js[39m (with declaration)
|
|
29
36
|
[35mevent[39m - Bundless [90museAdaptiveToolBar.tsx[39m to [90mdist/creek-table/hooks/useAdaptiveToolBar.js[39m (with declaration)
|
|
37
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-page-container/index.js[39m (with declaration)
|
|
38
|
+
[35mevent[39m - Bundless [90museStatusColumns.tsx[39m to [90mdist/creek-table/hooks/useStatusColumns.js[39m (with declaration)
|
|
39
|
+
[35mevent[39m - Bundless [90museEllipsisColumns.tsx[39m to [90mdist/creek-table/hooks/useEllipsisColumns.js[39m (with declaration)
|
|
40
|
+
[35mevent[39m - Bundless [90museIndexColumn.tsx[39m to [90mdist/creek-table/hooks/useIndexColumn.js[39m (with declaration)
|
|
41
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/index.js[39m (with declaration)
|
|
42
|
+
[35mevent[39m - Bundless [90museAutoWidthColumns.tsx[39m to [90mdist/creek-table/hooks/useAutoWidthColumns.js[39m (with declaration)
|
|
30
43
|
[35mevent[39m - Bundless [90museElementDistance.tsx[39m to [90mdist/creek-table/hooks/useElementDistance.js[39m (with declaration)
|
|
44
|
+
[35mevent[39m - Bundless [90mDensityIcon.tsx[39m to [90mdist/creek-table/components/DensityIcon.js[39m (with declaration)
|
|
45
|
+
[35mevent[39m - Bundless [90museResizableColumns.tsx[39m to [90mdist/creek-table/hooks/useResizableColumns.js[39m (with declaration)
|
|
46
|
+
[35mevent[39m - Bundless [90museTableScrollHeight.tsx[39m to [90mdist/creek-table/hooks/useTableScrollHeight.js[39m (with declaration)
|
|
47
|
+
[35mevent[39m - Bundless [90museTableOptions.tsx[39m to [90mdist/creek-table/hooks/useTableOptions.js[39m (with declaration)
|
|
31
48
|
[35mevent[39m - Bundless [90mSearchTable.tsx[39m to [90mdist/creek-table/SearchTable.js[39m (with declaration)
|
|
32
|
-
[35mevent[39m - Bundless [90mTableOptionRender.tsx[39m to [90mdist/creek-table/TableOptionRender.js[39m (with declaration)
|
|
33
|
-
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/index.js[39m (with declaration)
|
|
34
49
|
[35mevent[39m - Bundless [90mtype.ts[39m to [90mdist/creek-table/type.js[39m (with declaration)
|
|
35
|
-
[35mevent[39m - Bundless [
|
|
36
|
-
[35mevent[39m - Bundless [
|
|
37
|
-
[35mevent[39m - Bundless [
|
|
50
|
+
[35mevent[39m - Bundless [90mi18n.ts[39m to [90mdist/utils/i18n.js[39m (with declaration)
|
|
51
|
+
[35mevent[39m - Bundless [90men-US.ts[39m to [90mdist/locales/en-US.js[39m (with declaration)
|
|
52
|
+
[35mevent[39m - Bundless [90mzh-CN.ts[39m to [90mdist/locales/zh-CN.js[39m (with declaration)
|
|
53
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/index.js[39m (with declaration)
|
|
38
54
|
[35mevent[39m - Generate declaration files...
|
|
39
|
-
[35mevent[39m - Transformed successfully in
|
|
55
|
+
[35mevent[39m - Transformed successfully in 3814 ms (46 files)
|
package/README.md
CHANGED
|
@@ -31,19 +31,37 @@ 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
|
);
|
|
38
43
|
}
|
|
39
44
|
```
|
|
40
45
|
|
|
46
|
+
**新增 API 属性**:
|
|
47
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
48
|
+
| --- | --- | --- | --- |
|
|
49
|
+
| `runtimeConfig` | 运行时布局配置 | `ProLayoutProps` | 必填 |
|
|
50
|
+
| `userConfig` | 用户自定义布局配置 | `ProLayoutProps` | - |
|
|
51
|
+
| `navigate` | 路由跳转方法 | `(path?: string \| number) => void` | - |
|
|
52
|
+
| `showFullScreen` | 是否展示顶部全屏切换按钮 | `boolean` | `false` |
|
|
53
|
+
| `showLocaleButton` | 是否展示顶部国际化切换按钮 | `boolean` | `true` |
|
|
54
|
+
| `showSettingsButton` | 是否展示顶部系统设置按钮 | `boolean` | `true` |
|
|
55
|
+
| `keepAlive` | 是否开启多标签页缓存能力 | `boolean \| CreekKeepAliveProps` | `true` |
|
|
56
|
+
| `initialInfo` | 初始化信息 (如 Umi 的 initialState) | `{ initialState: any; loading: boolean; setInitialState: () => void }` | - |
|
|
57
|
+
| `extraActions` | 顶部右侧额外注入的操作区域节点 | `React.ReactNode[]` | `[]` |
|
|
58
|
+
|
|
41
59
|
**特性**:
|
|
42
|
-
- 响应式布局
|
|
43
|
-
-
|
|
44
|
-
- 面包屑导航
|
|
60
|
+
- 响应式布局 & 侧边栏折叠
|
|
61
|
+
- 面包屑导航与页面保活 (`CreekKeepAlive`)
|
|
45
62
|
- 异常页面处理
|
|
46
|
-
-
|
|
63
|
+
- 内置全屏、国际化、以及**主题配置抽屉 (LayoutSettings)**
|
|
64
|
+
- 支持动态修改主题色并同步影响所有链接和组件 (`colorPrimary` / `colorLink`)
|
|
47
65
|
|
|
48
66
|
#### BgCenter
|
|
49
67
|
背景居中组件,用于页面背景处理。
|
|
@@ -56,58 +74,10 @@ import { BgCenter } from '@creekjs/web-components';
|
|
|
56
74
|
</BgCenter>
|
|
57
75
|
```
|
|
58
76
|
|
|
59
|
-
### 🔍 搜索组件
|
|
60
|
-
|
|
61
|
-
#### CreekSearch
|
|
62
|
-
高级搜索组件,支持多种搜索条件和筛选器。
|
|
63
|
-
|
|
64
|
-
```tsx
|
|
65
|
-
import { CreekSearch } from '@creekjs/web-components';
|
|
66
|
-
|
|
67
|
-
const searchConfig = {
|
|
68
|
-
fields: [
|
|
69
|
-
{
|
|
70
|
-
name: 'keyword',
|
|
71
|
-
label: '关键词',
|
|
72
|
-
type: 'input'
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'status',
|
|
76
|
-
label: '状态',
|
|
77
|
-
type: 'select',
|
|
78
|
-
options: [
|
|
79
|
-
{ label: '启用', value: 'active' },
|
|
80
|
-
{ label: '禁用', value: 'inactive' }
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
function SearchDemo() {
|
|
87
|
-
const handleSearch = (values) => {
|
|
88
|
-
console.log('搜索条件:', values);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<CreekSearch
|
|
93
|
-
config={searchConfig}
|
|
94
|
-
onSearch={handleSearch}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**特性**:
|
|
101
|
-
- 多种搜索字段类型
|
|
102
|
-
- 搜索条件显示
|
|
103
|
-
- 值选择器
|
|
104
|
-
- 搜索输入框
|
|
105
|
-
- 筛选器显示
|
|
106
|
-
|
|
107
77
|
### 📊 表格组件
|
|
108
78
|
|
|
109
79
|
#### CreekTable
|
|
110
|
-
|
|
80
|
+
基于 Ant Design ProTable 的增强型业务表格组件。它在 `ProTable` 的基础上解决了高度计算、列宽自适应、表头溢出、列宽拖拽等常见痛点,真正做到开箱即用。
|
|
111
81
|
|
|
112
82
|
```tsx
|
|
113
83
|
import { CreekTable } from '@creekjs/web-components';
|
|
@@ -117,15 +87,18 @@ const columns = [
|
|
|
117
87
|
title: '姓名',
|
|
118
88
|
dataIndex: 'name',
|
|
119
89
|
key: 'name',
|
|
90
|
+
width: 120,
|
|
120
91
|
},
|
|
121
92
|
{
|
|
122
93
|
title: '年龄',
|
|
123
94
|
dataIndex: 'age',
|
|
124
95
|
key: 'age',
|
|
96
|
+
width: 80,
|
|
125
97
|
},
|
|
126
98
|
{
|
|
127
99
|
title: '操作',
|
|
128
100
|
key: 'action',
|
|
101
|
+
// 开启自动宽度测量后,无需硬编码固定宽度,系统会自动测量其内部元素宽度
|
|
129
102
|
render: (_, record) => (
|
|
130
103
|
<a onClick={() => handleEdit(record)}>编辑</a>
|
|
131
104
|
),
|
|
@@ -146,22 +119,36 @@ function TableDemo() {
|
|
|
146
119
|
};
|
|
147
120
|
}}
|
|
148
121
|
rowKey="id"
|
|
122
|
+
// 增强特性配置:
|
|
123
|
+
pageFixedBottom={true} // 分页器是否始终固定在底部
|
|
124
|
+
showIndex={true} // 是否自动展示序号列 (支持翻页连续计算)
|
|
125
|
+
resizable={true} // 是否支持拖拽调整列宽
|
|
149
126
|
/>
|
|
150
127
|
);
|
|
151
128
|
}
|
|
152
129
|
```
|
|
153
130
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
|
|
131
|
+
**新增 API 属性**:
|
|
132
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
133
|
+
| --- | --- | --- | --- |
|
|
134
|
+
| `pageFixedBottom` | 是否自动计算高度并将分页器固定在底部 | `boolean` | `true` |
|
|
135
|
+
| `pageFixedBottomConfig` | 固定在底部时的细粒度配置(如额外保留底部空间) | `{ bottomFix?: number }` | - |
|
|
136
|
+
| `showIndex` | 是否自动生成全局连续的序号列 | `boolean` | `true` |
|
|
137
|
+
| `resizable` | 是否支持拖拽调整列宽(需在 column 配置 width) | `boolean` | `true` |
|
|
138
|
+
| `scrollbarColumn` | 是否自动追加一个滚动条占位列,防止滚动条遮挡内容 | `boolean \| number` | `true` (宽度 17px) |
|
|
139
|
+
|
|
140
|
+
**增强特性**:
|
|
141
|
+
- **自动高度计算 (`useTableScrollHeight`)**:根据页面剩余空间自动计算表格内容区域高度 (`scroll.y`),确保分页器固定在底部 (`pageFixedBottom: true`),页面不会出现双滚动条。
|
|
142
|
+
- **自动列宽计算 (`useAutoWidthColumns`)**:智能测量并分配操作列或动态内容列的宽度,防止内容被截断或挤压。
|
|
143
|
+
- **内置拖拽列宽 (`useResizableColumns`)**:开箱即用的列宽拖拽调整能力 (`resizable: true`)。
|
|
144
|
+
- **自动序号列 (`useIndexColumn`)**:一行配置 (`showIndex: true`) 即可生成全局连续的序号列(自动处理翻页逻辑)。
|
|
145
|
+
- **默认截断省略 (`useEllipsisColumns`)**:默认开启所有文本列的溢出省略 (`ellipsis: true`)。
|
|
146
|
+
- **布局优化 (`useTableOptions`)**:自带默认紧凑型布局,没有 HeaderTitle 时操作栏自动左对齐。
|
|
160
147
|
|
|
161
148
|
### ⚙️ 配置组件
|
|
162
149
|
|
|
163
150
|
#### CreekConfigProvider
|
|
164
|
-
|
|
151
|
+
全局配置提供者,整合了 `antd` 的 `ConfigProvider` 和全局上下文,自动接收并应用 `useLayoutSettingsStore` 中持久化的主题设置。
|
|
165
152
|
|
|
166
153
|
```tsx
|
|
167
154
|
import { CreekConfigProvider } from '@creekjs/web-components';
|
|
@@ -170,8 +157,9 @@ function App() {
|
|
|
170
157
|
return (
|
|
171
158
|
<CreekConfigProvider
|
|
172
159
|
theme={{
|
|
173
|
-
|
|
174
|
-
|
|
160
|
+
token: {
|
|
161
|
+
colorPrimary: '#00c07f', // 默认主色调
|
|
162
|
+
}
|
|
175
163
|
}}
|
|
176
164
|
>
|
|
177
165
|
<YourApp />
|
|
@@ -180,6 +168,71 @@ function App() {
|
|
|
180
168
|
}
|
|
181
169
|
```
|
|
182
170
|
|
|
171
|
+
**特性**:
|
|
172
|
+
- 内置 `useApp` 机制,提供命令式弹窗/抽屉(`drawer.open` / `modal.open`)
|
|
173
|
+
- 内置 `CreekI18nProvider` 处理多语言
|
|
174
|
+
- 自动合并用户在设置抽屉中修改的 `colorPrimary`(并将其同步为 `colorLink` 的颜色)
|
|
175
|
+
|
|
176
|
+
### 🛠️ Hook 扩展
|
|
177
|
+
|
|
178
|
+
#### useApp (弹窗/抽屉快捷调用)
|
|
179
|
+
提供了一套基于上下文的快捷方法,用于在应用任何地方命令式地调起 `Modal` 或 `Drawer`,并特别支持了针对 `@ant-design/pro-components` 的 `ModalForm` 和 `DrawerForm` 的无缝集成。
|
|
180
|
+
|
|
181
|
+
**核心优势**:
|
|
182
|
+
- **告别 `visible` / `open` state**:不再需要在父组件中维护一堆开关状态和冗长的 JSX 标签。
|
|
183
|
+
- **自动上下文继承**:基于 `CreekConfigProvider` 内部包裹的 `AppProvider`,弹出的弹窗/抽屉天然继承 Redux/Zustand、React Router、以及 i18n 等所有上下文(不像传统的 `Modal.confirm` 会丢失上下文)。
|
|
184
|
+
- **原生支持 ProForm**:提供了 `openForm` 方法,专门用于挂载 `ModalForm` / `DrawerForm`,表单的 `onFinish` 等逻辑均可正常运作。
|
|
185
|
+
|
|
186
|
+
**使用示例:**
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { useApp } from '@creekjs/web-components';
|
|
190
|
+
import { Button, Form, Input } from 'antd';
|
|
191
|
+
import { ModalForm, ProFormText } from '@ant-design/pro-components';
|
|
192
|
+
|
|
193
|
+
export default function Demo() {
|
|
194
|
+
const { modal, drawer } = useApp();
|
|
195
|
+
|
|
196
|
+
// 1. 打开普通弹窗
|
|
197
|
+
const handleOpenNormalModal = () => {
|
|
198
|
+
modal.open({
|
|
199
|
+
title: '普通弹窗',
|
|
200
|
+
content: <div>这里是弹窗内容</div>,
|
|
201
|
+
onOk: () => {
|
|
202
|
+
console.log('点击了确定');
|
|
203
|
+
modal.close();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// 2. 打开表单抽屉 (DrawerForm)
|
|
209
|
+
const handleOpenFormDrawer = () => {
|
|
210
|
+
drawer.openForm({
|
|
211
|
+
title: '新建用户',
|
|
212
|
+
width: 400,
|
|
213
|
+
content: (
|
|
214
|
+
<>
|
|
215
|
+
<ProFormText name="username" label="用户名" rules={[{ required: true }]} />
|
|
216
|
+
<ProFormText name="email" label="邮箱" />
|
|
217
|
+
</>
|
|
218
|
+
),
|
|
219
|
+
onFinish: async (values) => {
|
|
220
|
+
console.log('表单提交:', values);
|
|
221
|
+
// 返回 true 会自动关闭抽屉
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<div style={{ display: 'flex', gap: 16 }}>
|
|
229
|
+
<Button onClick={handleOpenNormalModal}>打开弹窗</Button>
|
|
230
|
+
<Button type="primary" onClick={handleOpenFormDrawer}>打开表单抽屉</Button>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
183
236
|
### 🎯 工具组件
|
|
184
237
|
|
|
185
238
|
#### CreekIcon
|
|
@@ -289,6 +342,4 @@ pnpm run father:build
|
|
|
289
342
|
2. **文件结构**:每个组件一个文件夹
|
|
290
343
|
3. **类型定义**:使用 TypeScript 严格模式
|
|
291
344
|
4. **样式方案**:使用 `antd-style`
|
|
292
|
-
5. **状态管理**:使用 `zustand`
|
|
293
|
-
|
|
294
|
-
### 组件结构示例
|
|
345
|
+
5. **状态管理**:使用 `zustand`
|
|
@@ -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,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,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>;
|