@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.
Files changed (162) hide show
  1. package/.turbo/turbo-father$colon$build.log +32 -16
  2. package/README.md +117 -66
  3. package/dist/creek-config-provider/CreekConfigContext.d.ts +4 -0
  4. package/dist/creek-config-provider/CreekConfigContext.js.map +2 -2
  5. package/dist/creek-config-provider/CreekI18nProvider.d.ts +22 -0
  6. package/dist/creek-config-provider/CreekI18nProvider.js +92 -0
  7. package/dist/creek-config-provider/CreekI18nProvider.js.map +7 -0
  8. package/dist/creek-config-provider/index.d.ts +5 -3
  9. package/dist/creek-config-provider/index.js +47 -4
  10. package/dist/creek-config-provider/index.js.map +3 -3
  11. package/dist/creek-hooks/useApp/index.d.ts +3 -3
  12. package/dist/creek-keep-alive/index.d.ts +24 -1
  13. package/dist/creek-keep-alive/index.js +141 -4
  14. package/dist/creek-keep-alive/index.js.map +2 -2
  15. package/dist/creek-layout/ActionRender/FullScreen.js +3 -1
  16. package/dist/creek-layout/ActionRender/FullScreen.js.map +2 -2
  17. package/dist/creek-layout/ActionRender/LayoutSettings.d.ts +5 -0
  18. package/dist/creek-layout/ActionRender/LayoutSettings.js +73 -0
  19. package/dist/creek-layout/ActionRender/LayoutSettings.js.map +7 -0
  20. package/dist/creek-layout/ActionRender/UserInfo.js.map +2 -2
  21. package/dist/creek-layout/ActionRender/index.d.ts +1 -0
  22. package/dist/creek-layout/ActionRender/index.js +3 -0
  23. package/dist/creek-layout/ActionRender/index.js.map +2 -2
  24. package/dist/creek-layout/index.d.ts +5 -5
  25. package/dist/creek-layout/index.js +79 -16
  26. package/dist/creek-layout/index.js.map +3 -3
  27. package/dist/creek-layout/useLayoutSettingsStore.d.ts +20 -0
  28. package/dist/creek-layout/useLayoutSettingsStore.js +45 -0
  29. package/dist/creek-layout/useLayoutSettingsStore.js.map +7 -0
  30. package/dist/creek-locale-button/index.d.ts +1 -0
  31. package/dist/creek-locale-button/index.js +66 -0
  32. package/dist/creek-locale-button/index.js.map +7 -0
  33. package/dist/creek-page-container/index.d.ts +4 -0
  34. package/dist/creek-page-container/index.js +68 -0
  35. package/dist/creek-page-container/index.js.map +7 -0
  36. package/dist/creek-style/index.d.ts +1 -0
  37. package/dist/creek-style/index.js +24 -0
  38. package/dist/creek-style/index.js.map +7 -0
  39. package/dist/creek-style/scrollbar.d.ts +2 -0
  40. package/dist/creek-style/scrollbar.js +55 -0
  41. package/dist/creek-style/scrollbar.js.map +7 -0
  42. package/dist/creek-table/SearchTable.d.ts +9 -0
  43. package/dist/creek-table/SearchTable.js +109 -72
  44. package/dist/creek-table/SearchTable.js.map +3 -3
  45. package/dist/creek-table/components/DensityIcon.d.ts +9 -0
  46. package/dist/creek-table/components/DensityIcon.js +77 -0
  47. package/dist/creek-table/components/DensityIcon.js.map +7 -0
  48. package/dist/creek-table/components/EllipsisTooltip.d.ts +9 -0
  49. package/dist/creek-table/components/EllipsisTooltip.js +122 -0
  50. package/dist/creek-table/components/EllipsisTooltip.js.map +7 -0
  51. package/dist/creek-table/components/index.d.ts +2 -0
  52. package/dist/creek-table/components/index.js +26 -0
  53. package/dist/creek-table/components/index.js.map +7 -0
  54. package/dist/creek-table/hooks/index.d.ts +5 -0
  55. package/dist/creek-table/hooks/index.js +10 -0
  56. package/dist/creek-table/hooks/index.js.map +2 -2
  57. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +1 -1
  58. package/dist/creek-table/hooks/useAutoWidthColumns.js +76 -17
  59. package/dist/creek-table/hooks/useAutoWidthColumns.js.map +2 -2
  60. package/dist/creek-table/hooks/useEllipsisColumns.d.ts +8 -0
  61. package/dist/creek-table/hooks/useEllipsisColumns.js +58 -0
  62. package/dist/creek-table/hooks/useEllipsisColumns.js.map +7 -0
  63. package/dist/creek-table/hooks/useIndexColumn.d.ts +2 -0
  64. package/dist/creek-table/hooks/useIndexColumn.js +52 -0
  65. package/dist/creek-table/hooks/useIndexColumn.js.map +7 -0
  66. package/dist/creek-table/hooks/useResizableColumns.d.ts +20 -0
  67. package/dist/creek-table/hooks/useResizableColumns.js +279 -0
  68. package/dist/creek-table/hooks/useResizableColumns.js.map +7 -0
  69. package/dist/creek-table/hooks/useStatusColumns.d.ts +2 -0
  70. package/dist/creek-table/hooks/useStatusColumns.js +215 -0
  71. package/dist/creek-table/hooks/useStatusColumns.js.map +7 -0
  72. package/dist/creek-table/hooks/useTableOptions.d.ts +15 -0
  73. package/dist/creek-table/hooks/useTableOptions.js +78 -0
  74. package/dist/creek-table/hooks/useTableOptions.js.map +7 -0
  75. package/dist/creek-table/hooks/useTableScrollHeight.d.ts +6 -1
  76. package/dist/creek-table/hooks/useTableScrollHeight.js +44 -5
  77. package/dist/creek-table/hooks/useTableScrollHeight.js.map +2 -2
  78. package/dist/creek-table/type.d.ts +4 -6
  79. package/dist/creek-table/type.js.map +1 -1
  80. package/dist/index.d.ts +4 -0
  81. package/dist/index.js +8 -0
  82. package/dist/index.js.map +2 -2
  83. package/dist/locales/en-US.d.ts +25 -0
  84. package/dist/locales/en-US.js +49 -0
  85. package/dist/locales/en-US.js.map +7 -0
  86. package/dist/locales/zh-CN.d.ts +25 -0
  87. package/dist/locales/zh-CN.js +49 -0
  88. package/dist/locales/zh-CN.js.map +7 -0
  89. package/dist/utils/i18n.d.ts +2 -0
  90. package/dist/utils/i18n.js +34 -0
  91. package/dist/utils/i18n.js.map +7 -0
  92. package/i18n.config.ts +27 -0
  93. package/package.json +22 -8
  94. package/src/creek-config-provider/CreekConfigContext.tsx +5 -1
  95. package/src/creek-config-provider/CreekI18nProvider.tsx +87 -0
  96. package/src/creek-config-provider/index.tsx +53 -4
  97. package/src/creek-keep-alive/index.tsx +225 -6
  98. package/src/creek-layout/ActionRender/FullScreen.tsx +10 -6
  99. package/src/creek-layout/ActionRender/LayoutSettings.tsx +67 -0
  100. package/src/creek-layout/ActionRender/UserInfo.tsx +1 -1
  101. package/src/creek-layout/ActionRender/index.tsx +1 -0
  102. package/src/creek-layout/index.tsx +89 -22
  103. package/src/creek-layout/useLayoutSettingsStore.ts +25 -0
  104. package/src/creek-locale-button/index.tsx +42 -0
  105. package/src/creek-page-container/index.tsx +32 -0
  106. package/src/creek-style/index.ts +1 -0
  107. package/src/creek-style/scrollbar.ts +29 -0
  108. package/src/creek-table/SearchTable.tsx +125 -72
  109. package/src/creek-table/components/DensityIcon.tsx +63 -0
  110. package/src/creek-table/components/EllipsisTooltip.tsx +116 -0
  111. package/src/creek-table/components/index.tsx +3 -0
  112. package/src/creek-table/hooks/index.ts +5 -1
  113. package/src/creek-table/hooks/useAutoWidthColumns.tsx +93 -19
  114. package/src/creek-table/hooks/useEllipsisColumns.tsx +47 -0
  115. package/src/creek-table/hooks/useIndexColumn.tsx +27 -0
  116. package/src/creek-table/hooks/useResizableColumns.tsx +323 -0
  117. package/src/creek-table/hooks/useStatusColumns.tsx +252 -0
  118. package/src/creek-table/hooks/useTableOptions.tsx +81 -0
  119. package/src/creek-table/hooks/useTableScrollHeight.tsx +61 -6
  120. package/src/creek-table/type.ts +5 -7
  121. package/src/index.tsx +4 -0
  122. package/src/locales/en-US.ts +24 -0
  123. package/src/locales/zh-CN.ts +24 -0
  124. package/src/utils/i18n.ts +4 -0
  125. package/dist/creek-config-provider/CreekConfigContext.d.ts.map +0 -1
  126. package/dist/creek-config-provider/index.d.ts.map +0 -1
  127. package/dist/creek-hooks/index.d.ts.map +0 -1
  128. package/dist/creek-hooks/useApp/DrawerHelper.d.ts.map +0 -1
  129. package/dist/creek-hooks/useApp/ModalHelper.d.ts.map +0 -1
  130. package/dist/creek-hooks/useApp/index.d.ts.map +0 -1
  131. package/dist/creek-hooks/useApp/types.d.ts.map +0 -1
  132. package/dist/creek-hooks/useViewportHeight.d.ts.map +0 -1
  133. package/dist/creek-icon/index.d.ts.map +0 -1
  134. package/dist/creek-keep-alive/index.d.ts.map +0 -1
  135. package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +0 -1
  136. package/dist/creek-layout/ActionRender/UserInfo.d.ts.map +0 -1
  137. package/dist/creek-layout/ActionRender/index.d.ts.map +0 -1
  138. package/dist/creek-layout/CollapseButton.d.ts.map +0 -1
  139. package/dist/creek-layout/Exception/NotFound.d.ts.map +0 -1
  140. package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +0 -1
  141. package/dist/creek-layout/Exception/index.d.ts.map +0 -1
  142. package/dist/creek-layout/index.d.ts.map +0 -1
  143. package/dist/creek-loading/index.d.ts.map +0 -1
  144. package/dist/creek-table/SearchTable.d.ts.map +0 -1
  145. package/dist/creek-table/TableOptionRender.d.ts +0 -9
  146. package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
  147. package/dist/creek-table/TableOptionRender.js +0 -74
  148. package/dist/creek-table/TableOptionRender.js.map +0 -7
  149. package/dist/creek-table/hooks/index.d.ts.map +0 -1
  150. package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +0 -1
  151. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +0 -1
  152. package/dist/creek-table/hooks/useElementDistance.d.ts.map +0 -1
  153. package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +0 -1
  154. package/dist/creek-table/index.d.ts.map +0 -1
  155. package/dist/creek-table/toolBarRender.d.ts +0 -5
  156. package/dist/creek-table/toolBarRender.d.ts.map +0 -1
  157. package/dist/creek-table/toolBarRender.js +0 -58
  158. package/dist/creek-table/toolBarRender.js.map +0 -7
  159. package/dist/creek-table/type.d.ts.map +0 -1
  160. package/dist/index.d.ts.map +0 -1
  161. package/src/creek-table/TableOptionRender.tsx +0 -57
  162. package/src/creek-table/toolBarRender.tsx +0 -28
@@ -1,39 +1,55 @@
1
1
 
2
2
  
3
- > @creekjs/web-components@1.0.4 father:build /Users/ernestwang/Documents/code-resoorce/creek/packages/web-components
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
  info - Clean output directories
7
7
  info - Bundless for src directory to cjs format
8
8
  event - Bundless CreekConfigContext.tsx to dist/creek-config-provider/CreekConfigContext.js (with declaration)
9
+ event - Bundless ModalHelper.tsx to dist/creek-hooks/useApp/ModalHelper.js (with declaration)
10
+ event - Bundless index.tsx to dist/creek-config-provider/index.js (with declaration)
9
11
  event - Bundless index.ts to dist/creek-hooks/index.js (with declaration)
10
- event - Bundless DrawerHelper.tsx to dist/creek-hooks/useApp/DrawerHelper.js (with declaration)
11
12
  event - Bundless index.tsx to dist/creek-hooks/useApp/index.js (with declaration)
12
- event - Bundless index.tsx to dist/creek-config-provider/index.js (with declaration)
13
- event - Bundless index.tsx to dist/creek-icon/index.js (with declaration)
14
13
  event - Bundless types.ts to dist/creek-hooks/useApp/types.js (with declaration)
15
- event - Bundless ModalHelper.tsx to dist/creek-hooks/useApp/ModalHelper.js (with declaration)
14
+ event - Bundless DrawerHelper.tsx to dist/creek-hooks/useApp/DrawerHelper.js (with declaration)
16
15
  event - Bundless useViewportHeight.tsx to dist/creek-hooks/useViewportHeight.js (with declaration)
16
+ event - Bundless CreekI18nProvider.tsx to dist/creek-config-provider/CreekI18nProvider.js (with declaration)
17
+ event - Bundless index.tsx to dist/creek-keep-alive/index.js (with declaration)
18
+ event - Bundless index.tsx to dist/creek-icon/index.js (with declaration)
17
19
  event - Bundless FullScreen.tsx to dist/creek-layout/ActionRender/FullScreen.js (with declaration)
18
20
  event - Bundless CollapseButton.tsx to dist/creek-layout/CollapseButton.js (with declaration)
21
+ event - Bundless NotFoundPage.tsx to dist/creek-layout/Exception/NotFoundPage.js (with declaration)
19
22
  event - Bundless index.tsx to dist/creek-layout/Exception/index.js (with declaration)
20
- event - Bundless index.tsx to dist/creek-keep-alive/index.js (with declaration)
21
- event - Bundless UserInfo.tsx to dist/creek-layout/ActionRender/UserInfo.js (with declaration)
22
- event - Bundless index.tsx to dist/creek-layout/ActionRender/index.js (with declaration)
23
23
  event - Bundless NotFound.tsx to dist/creek-layout/Exception/NotFound.js (with declaration)
24
- event - Bundless NotFoundPage.tsx to dist/creek-layout/Exception/NotFoundPage.js (with declaration)
24
+ event - Bundless index.tsx to dist/creek-layout/ActionRender/index.js (with declaration)
25
+ event - Bundless LayoutSettings.tsx to dist/creek-layout/ActionRender/LayoutSettings.js (with declaration)
26
+ event - Bundless UserInfo.tsx to dist/creek-layout/ActionRender/UserInfo.js (with declaration)
25
27
  event - Bundless index.tsx to dist/creek-loading/index.js (with declaration)
28
+ event - Bundless index.tsx to dist/creek-locale-button/index.js (with declaration)
29
+ event - Bundless index.ts to dist/creek-style/index.js (with declaration)
26
30
  event - Bundless index.tsx to dist/creek-layout/index.js (with declaration)
31
+ event - Bundless scrollbar.ts to dist/creek-style/scrollbar.js (with declaration)
32
+ event - Bundless useLayoutSettingsStore.ts to dist/creek-layout/useLayoutSettingsStore.js (with declaration)
33
+ event - Bundless index.tsx to dist/creek-table/components/index.js (with declaration)
34
+ event - Bundless EllipsisTooltip.tsx to dist/creek-table/components/EllipsisTooltip.js (with declaration)
27
35
  event - Bundless index.ts to dist/creek-table/hooks/index.js (with declaration)
28
- event - Bundless useAutoWidthColumns.tsx to dist/creek-table/hooks/useAutoWidthColumns.js (with declaration)
29
36
  event - Bundless useAdaptiveToolBar.tsx to dist/creek-table/hooks/useAdaptiveToolBar.js (with declaration)
37
+ event - Bundless index.tsx to dist/creek-page-container/index.js (with declaration)
38
+ event - Bundless useStatusColumns.tsx to dist/creek-table/hooks/useStatusColumns.js (with declaration)
39
+ event - Bundless useEllipsisColumns.tsx to dist/creek-table/hooks/useEllipsisColumns.js (with declaration)
40
+ event - Bundless useIndexColumn.tsx to dist/creek-table/hooks/useIndexColumn.js (with declaration)
41
+ event - Bundless index.tsx to dist/creek-table/index.js (with declaration)
42
+ event - Bundless useAutoWidthColumns.tsx to dist/creek-table/hooks/useAutoWidthColumns.js (with declaration)
30
43
  event - Bundless useElementDistance.tsx to dist/creek-table/hooks/useElementDistance.js (with declaration)
44
+ event - Bundless DensityIcon.tsx to dist/creek-table/components/DensityIcon.js (with declaration)
45
+ event - Bundless useResizableColumns.tsx to dist/creek-table/hooks/useResizableColumns.js (with declaration)
46
+ event - Bundless useTableScrollHeight.tsx to dist/creek-table/hooks/useTableScrollHeight.js (with declaration)
47
+ event - Bundless useTableOptions.tsx to dist/creek-table/hooks/useTableOptions.js (with declaration)
31
48
  event - Bundless SearchTable.tsx to dist/creek-table/SearchTable.js (with declaration)
32
- event - Bundless TableOptionRender.tsx to dist/creek-table/TableOptionRender.js (with declaration)
33
- event - Bundless index.tsx to dist/index.js (with declaration)
34
49
  event - Bundless type.ts to dist/creek-table/type.js (with declaration)
35
- event - Bundless useTableScrollHeight.tsx to dist/creek-table/hooks/useTableScrollHeight.js (with declaration)
36
- event - Bundless index.tsx to dist/creek-table/index.js (with declaration)
37
- event - Bundless toolBarRender.tsx to dist/creek-table/toolBarRender.js (with declaration)
50
+ event - Bundless i18n.ts to dist/utils/i18n.js (with declaration)
51
+ event - Bundless en-US.ts to dist/locales/en-US.js (with declaration)
52
+ event - Bundless zh-CN.ts to dist/locales/zh-CN.js (with declaration)
53
+ event - Bundless index.tsx to dist/index.js (with declaration)
38
54
  event - Generate declaration files...
39
- event - Transformed successfully in 5787 ms (30 files)
55
+ event - 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
- 增强型表格组件,基于 Ant Design Pro Table。
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
- - 自定义 hooks 支持
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
- primaryColor: '#1890ff',
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,5 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  export type CreekConfigContextProps = {
3
3
  iconFontCNs?: string[];
4
+ /**
5
+ * 国际化语言包
6
+ */
7
+ locale?: Record<string, string>;
4
8
  };
5
9
  export declare const CreekConfigContext: import("react").Context<CreekConfigContextProps>;
@@ -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[]\n};\n\nexport const CreekConfigContext = createContext<CreekConfigContextProps>({});\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAMvB,IAAM,yBAAqB,4BAAuC,CAAC,CAAC;",
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
- export type CreekConfigProviderProps = CreekConfigContextProps & {
4
- children?: React.ReactNode;
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)(import_CreekConfigContext.CreekConfigContext.Provider, { value: more, children });
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?: React.ReactNode;\n};\n\nexport const CreekConfigProvider = (props: CreekConfigProviderProps) => {\n const { children, ...more } = props;\n return <CreekConfigContext.Provider value={more}>{children}</CreekConfigContext.Provider>;\n};\n\nCreekConfigProvider.CreekConfigContext = CreekConfigContext;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA4D;AAQnD;AAFF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,SAAO,4CAAC,6CAAmB,UAAnB,EAA4B,OAAO,MAAO,UAAS;AAC7D;AAEA,oBAAoB,qBAAqB;",
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
- export declare const CreekKeepAlive: () => import("react/jsx-runtime").JSX.Element;
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>;