@creekjs/web-components 1.0.17 → 1.0.18

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 (63) hide show
  1. package/.turbo/turbo-father$colon$build.log +25 -25
  2. package/dist/creek-keep-alive/index.js +8 -6
  3. package/dist/creek-keep-alive/index.js.map +2 -2
  4. package/dist/creek-layout/ActionRender/UserInfo.js +2 -2
  5. package/dist/creek-layout/ActionRender/UserInfo.js.map +2 -2
  6. package/dist/creek-layout/ActionRender/index.d.ts +1 -1
  7. package/dist/creek-layout/ActionRender/index.js.map +2 -2
  8. package/dist/creek-layout/index.d.ts +11 -2
  9. package/dist/creek-layout/index.js +12 -1
  10. package/dist/creek-layout/index.js.map +3 -3
  11. package/dist/creek-table/hooks/useTableScrollHeight.js +22 -1
  12. package/dist/creek-table/hooks/useTableScrollHeight.js.map +2 -2
  13. package/package.json +1 -1
  14. package/src/creek-keep-alive/index.tsx +11 -6
  15. package/src/creek-layout/ActionRender/UserInfo.tsx +3 -3
  16. package/src/creek-layout/ActionRender/index.tsx +1 -1
  17. package/src/creek-layout/index.tsx +21 -3
  18. package/src/creek-table/hooks/useTableScrollHeight.tsx +30 -1
  19. package/dist/creek-config-provider/CreekConfigContext.d.ts.map +0 -1
  20. package/dist/creek-config-provider/CreekI18nProvider.d.ts.map +0 -1
  21. package/dist/creek-config-provider/index.d.ts.map +0 -1
  22. package/dist/creek-hooks/index.d.ts.map +0 -1
  23. package/dist/creek-hooks/useApp/DrawerHelper.d.ts.map +0 -1
  24. package/dist/creek-hooks/useApp/ModalHelper.d.ts.map +0 -1
  25. package/dist/creek-hooks/useApp/index.d.ts.map +0 -1
  26. package/dist/creek-hooks/useApp/types.d.ts.map +0 -1
  27. package/dist/creek-hooks/useViewportHeight.d.ts.map +0 -1
  28. package/dist/creek-icon/index.d.ts.map +0 -1
  29. package/dist/creek-keep-alive/index.d.ts.map +0 -1
  30. package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +0 -1
  31. package/dist/creek-layout/ActionRender/LayoutSettings.d.ts.map +0 -1
  32. package/dist/creek-layout/ActionRender/UserInfo.d.ts.map +0 -1
  33. package/dist/creek-layout/ActionRender/index.d.ts.map +0 -1
  34. package/dist/creek-layout/CollapseButton.d.ts.map +0 -1
  35. package/dist/creek-layout/Exception/NotFound.d.ts.map +0 -1
  36. package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +0 -1
  37. package/dist/creek-layout/Exception/index.d.ts.map +0 -1
  38. package/dist/creek-layout/index.d.ts.map +0 -1
  39. package/dist/creek-layout/useLayoutSettingsStore.d.ts.map +0 -1
  40. package/dist/creek-loading/index.d.ts.map +0 -1
  41. package/dist/creek-locale-button/index.d.ts.map +0 -1
  42. package/dist/creek-page-container/index.d.ts.map +0 -1
  43. package/dist/creek-style/index.d.ts.map +0 -1
  44. package/dist/creek-style/scrollbar.d.ts.map +0 -1
  45. package/dist/creek-table/SearchTable.d.ts.map +0 -1
  46. package/dist/creek-table/components/DensityIcon.d.ts.map +0 -1
  47. package/dist/creek-table/components/EllipsisTooltip.d.ts.map +0 -1
  48. package/dist/creek-table/components/index.d.ts.map +0 -1
  49. package/dist/creek-table/hooks/index.d.ts.map +0 -1
  50. package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +0 -1
  51. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +0 -1
  52. package/dist/creek-table/hooks/useElementDistance.d.ts.map +0 -1
  53. package/dist/creek-table/hooks/useEllipsisColumns.d.ts.map +0 -1
  54. package/dist/creek-table/hooks/useIndexColumn.d.ts.map +0 -1
  55. package/dist/creek-table/hooks/useResizableColumns.d.ts.map +0 -1
  56. package/dist/creek-table/hooks/useStatusColumns.d.ts.map +0 -1
  57. package/dist/creek-table/hooks/useTableOptions.d.ts.map +0 -1
  58. package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +0 -1
  59. package/dist/creek-table/index.d.ts.map +0 -1
  60. package/dist/creek-table/type.d.ts.map +0 -1
  61. package/dist/index.d.ts.map +0 -1
  62. package/dist/locales/en_US.d.ts.map +0 -1
  63. package/dist/locales/zh_CN.d.ts.map +0 -1
@@ -1,54 +1,54 @@
1
1
 
2
2
  
3
- > @creekjs/web-components@1.0.15 father:build /Users/ernestwang/Documents/code-resoorce/creek/packages/web-components
3
+ > @creekjs/web-components@1.0.17 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 index.tsx to dist/creek-config-provider/index.js (with declaration)
9
+ event - Bundless CreekI18nProvider.tsx to dist/creek-config-provider/CreekI18nProvider.js (with declaration)
10
10
  event - Bundless ModalHelper.tsx to dist/creek-hooks/useApp/ModalHelper.js (with declaration)
11
- event - Bundless index.ts to dist/creek-hooks/index.js (with declaration)
11
+ event - Bundless index.tsx to dist/creek-config-provider/index.js (with declaration)
12
12
  event - Bundless index.tsx to dist/creek-hooks/useApp/index.js (with declaration)
13
13
  event - Bundless index.tsx to dist/creek-icon/index.js (with declaration)
14
- event - Bundless types.ts to dist/creek-hooks/useApp/types.js (with declaration)
15
- event - Bundless DrawerHelper.tsx to dist/creek-hooks/useApp/DrawerHelper.js (with declaration)
16
14
  event - Bundless useViewportHeight.tsx to dist/creek-hooks/useViewportHeight.js (with declaration)
15
+ event - Bundless index.ts to dist/creek-hooks/index.js (with declaration)
17
16
  event - Bundless FullScreen.tsx to dist/creek-layout/ActionRender/FullScreen.js (with declaration)
18
- event - Bundless CreekI18nProvider.tsx to dist/creek-config-provider/CreekI18nProvider.js (with declaration)
19
- event - Bundless index.tsx to dist/creek-layout/ActionRender/index.js (with declaration)
20
- event - Bundless UserInfo.tsx to dist/creek-layout/ActionRender/UserInfo.js (with declaration)
17
+ event - Bundless LayoutSettings.tsx to dist/creek-layout/ActionRender/LayoutSettings.js (with declaration)
18
+ event - Bundless types.ts to dist/creek-hooks/useApp/types.js (with declaration)
19
+ event - Bundless DrawerHelper.tsx to dist/creek-hooks/useApp/DrawerHelper.js (with declaration)
21
20
  event - Bundless NotFound.tsx to dist/creek-layout/Exception/NotFound.js (with declaration)
22
- event - Bundless index.tsx to dist/creek-layout/Exception/index.js (with declaration)
23
21
  event - Bundless NotFoundPage.tsx to dist/creek-layout/Exception/NotFoundPage.js (with declaration)
24
- event - Bundless index.ts to dist/creek-style/index.js (with declaration)
25
- event - Bundless LayoutSettings.tsx to dist/creek-layout/ActionRender/LayoutSettings.js (with declaration)
26
- event - Bundless index.tsx to dist/creek-layout/index.js (with declaration)
22
+ event - Bundless UserInfo.tsx to dist/creek-layout/ActionRender/UserInfo.js (with declaration)
23
+ event - Bundless CollapseButton.tsx to dist/creek-layout/CollapseButton.js (with declaration)
24
+ event - Bundless index.tsx to dist/creek-layout/Exception/index.js (with declaration)
27
25
  event - Bundless index.tsx to dist/creek-page-container/index.js (with declaration)
26
+ event - Bundless index.tsx to dist/creek-loading/index.js (with declaration)
28
27
  event - Bundless useLayoutSettingsStore.ts to dist/creek-layout/useLayoutSettingsStore.js (with declaration)
28
+ event - Bundless index.tsx to dist/creek-locale-button/index.js (with declaration)
29
29
  event - Bundless scrollbar.ts to dist/creek-style/scrollbar.js (with declaration)
30
30
  event - Bundless DensityIcon.tsx to dist/creek-table/components/DensityIcon.js (with declaration)
31
- event - Bundless index.tsx to dist/creek-loading/index.js (with declaration)
32
- event - Bundless index.tsx to dist/creek-locale-button/index.js (with declaration)
33
- event - Bundless index.tsx to dist/creek-table/components/index.js (with declaration)
34
- event - Bundless useElementDistance.tsx to dist/creek-table/hooks/useElementDistance.js (with declaration)
35
31
  event - Bundless useAdaptiveToolBar.tsx to dist/creek-table/hooks/useAdaptiveToolBar.js (with declaration)
32
+ event - Bundless index.ts to dist/creek-style/index.js (with declaration)
33
+ event - Bundless useElementDistance.tsx to dist/creek-table/hooks/useElementDistance.js (with declaration)
36
34
  event - Bundless useIndexColumn.tsx to dist/creek-table/hooks/useIndexColumn.js (with declaration)
37
35
  event - Bundless EllipsisTooltip.tsx to dist/creek-table/components/EllipsisTooltip.js (with declaration)
38
36
  event - Bundless useAutoWidthColumns.tsx to dist/creek-table/hooks/useAutoWidthColumns.js (with declaration)
39
- event - Bundless useEllipsisColumns.tsx to dist/creek-table/hooks/useEllipsisColumns.js (with declaration)
40
- event - Bundless useTableOptions.tsx to dist/creek-table/hooks/useTableOptions.js (with declaration)
41
37
  event - Bundless index.ts to dist/creek-table/hooks/index.js (with declaration)
42
- event - Bundless index.tsx to dist/creek-table/index.js (with declaration)
38
+ event - Bundless index.tsx to dist/creek-table/components/index.js (with declaration)
39
+ event - Bundless useResizableColumns.tsx to dist/creek-table/hooks/useResizableColumns.js (with declaration)
40
+ event - Bundless useTableOptions.tsx to dist/creek-table/hooks/useTableOptions.js (with declaration)
41
+ event - Bundless useEllipsisColumns.tsx to dist/creek-table/hooks/useEllipsisColumns.js (with declaration)
43
42
  event - Bundless useTableScrollHeight.tsx to dist/creek-table/hooks/useTableScrollHeight.js (with declaration)
43
+ event - Bundless useStatusColumns.tsx to dist/creek-table/hooks/useStatusColumns.js (with declaration)
44
44
  event - Bundless type.ts to dist/creek-table/type.js (with declaration)
45
45
  event - Bundless index.tsx to dist/index.js (with declaration)
46
- event - Bundless SearchTable.tsx to dist/creek-table/SearchTable.js (with declaration)
47
- event - Bundless zh_CN.ts to dist/locales/zh_CN.js (with declaration)
48
46
  event - Bundless en_US.ts to dist/locales/en_US.js (with declaration)
49
- event - Bundless CollapseButton.tsx to dist/creek-layout/CollapseButton.js (with declaration)
50
- event - Bundless useStatusColumns.tsx to dist/creek-table/hooks/useStatusColumns.js (with declaration)
51
- event - Bundless useResizableColumns.tsx to dist/creek-table/hooks/useResizableColumns.js (with declaration)
47
+ event - Bundless zh_CN.ts to dist/locales/zh_CN.js (with declaration)
48
+ event - Bundless SearchTable.tsx to dist/creek-table/SearchTable.js (with declaration)
49
+ event - Bundless index.tsx to dist/creek-table/index.js (with declaration)
50
+ event - Bundless index.tsx to dist/creek-layout/ActionRender/index.js (with declaration)
52
51
  event - Bundless index.tsx to dist/creek-keep-alive/index.js (with declaration)
52
+ event - Bundless index.tsx to dist/creek-layout/index.js (with declaration)
53
53
  event - Generate declaration files...
54
- event - Transformed successfully in 3562 ms (45 files)
54
+ event - Transformed successfully in 6590 ms (45 files)
@@ -58,13 +58,15 @@ var CreekKeepAlive = (props) => {
58
58
  };
59
59
  (0, import_react.useEffect)(() => {
60
60
  const currentPath = location.pathname;
61
- setActiveKey(currentPath);
62
- if (!cachedElements[currentPath] && !isPathExcluded(currentPath)) {
63
- const element = resolveElement(currentPath);
64
- if (element) {
65
- setCachedElements((prev) => ({ ...prev, [currentPath]: element }));
66
- }
61
+ if (isPathExcluded(currentPath))
62
+ return;
63
+ const element = resolveElement(currentPath);
64
+ if (!element)
65
+ return;
66
+ if (!cachedElements[currentPath]) {
67
+ setCachedElements((prev) => ({ ...prev, [currentPath]: element }));
67
68
  }
69
+ setActiveKey(currentPath);
68
70
  setTabItems((prev) => {
69
71
  if (prev.find((i) => i.key === currentPath)) {
70
72
  return prev.map((i) => ({ ...i, closable: prev.length > 1 }));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/creek-keep-alive/index.tsx"],
4
- "sourcesContent": ["import { useMemoizedFn } from 'ahooks';\nimport { Dropdown, MenuProps, Tabs } from 'antd';\nimport { isRegExp, isString } from 'lodash';\nimport React, { useEffect, useState } from 'react';\nimport { matchRoutes, useLocation, useNavigate } from 'react-router-dom';\n\nimport { useT } from '@creekjs/i18n/react';\n\nexport interface CreekKeepAliveProps {\n /**\n * 不需要缓存的路径\n */\n exclude?: (string | RegExp)[];\n /**\n * 自定义Tab标题获取方法\n */\n getTabTitle?: (pathname: string) => React.ReactNode;\n /**\n * Tabs的样式\n */\n tabBarStyle?: React.CSSProperties;\n /**\n * 最大缓存数量,默认为 20\n */\n maxTabCount?: number;\n /**\n * 路由配置(含 element),用于解析每个路径对应的页面组件\n */\n routes?: any[];\n}\n\ninterface TabItem {\n key: string;\n label: React.ReactNode;\n closable?: boolean;\n}\n\nexport const CreekKeepAlive: React.FC<CreekKeepAliveProps> = (props) => {\n const { exclude = [], getTabTitle, tabBarStyle, maxTabCount = 20, routes = [] } = props;\n\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n\n const [tabItems, setTabItems] = useState<TabItem[]>([]);\n const [activeKey, setActiveKey] = useState<string>('');\n\n // 缓存每个路径对应的 React element,保证同一页面始终复用同一个 element 引用\n // 这样 React reconciler 不会卸载/重新挂载组件,从而实现 keep-alive\n // 使用 state 以便缓存变化时触发重新渲染\n const [cachedElements, setCachedElements] = useState<Record<string, React.ReactNode>>({});\n\n // 根据路由配置,解析指定路径对应的叶子路由 element\n const resolveElement = (path: string): React.ReactNode | null => {\n if (!routes?.length) return null;\n const matches = matchRoutes(routes, path);\n if (!matches?.length) return null;\n // 取最后一个 match(叶子路由),即实际页面组件\n return matches[matches.length - 1].route.element ?? null;\n };\n\n // 判断是否不需要缓存\n const isPathExcluded = (path: string) => {\n return exclude.some((item) => {\n if (isString(item)) {\n return item === path;\n }\n if (isRegExp(item)) {\n return item.test(path);\n }\n return false;\n });\n };\n\n // 初始化或路由变化时更新\n useEffect(() => {\n const currentPath = location.pathname;\n setActiveKey(currentPath);\n\n // 缓存当前路径的 element(仅首次缓存,后续复用同一个 element 引用)\n if (!cachedElements[currentPath] && !isPathExcluded(currentPath)) {\n const element = resolveElement(currentPath);\n if (element) {\n setCachedElements((prev) => ({ ...prev, [currentPath]: element }));\n }\n }\n\n // 更新 Tab 列表\n setTabItems((prev) => {\n if (prev.find((i) => i.key === currentPath)) {\n // 更新现有 tab 的 closable 状态(只有最后一个 tab 时不可关闭)\n return prev.map((i) => ({ ...i, closable: prev.length > 1 }));\n }\n const title = getTabTitle?.(currentPath) || currentPath;\n const newItems = [...prev, { key: currentPath, label: title, closable: prev.length > 0 }];\n\n // 只有1个 tab 时不可关闭\n if (newItems.length === 1) {\n newItems[0].closable = false;\n }\n\n // 超过最大数量限制,移除最早的可关闭 tab\n if (newItems.length > maxTabCount) {\n const indexToRemove = newItems.findIndex((item) => item.closable && item.key !== currentPath);\n if (indexToRemove !== -1) {\n const itemToRemove = newItems[indexToRemove];\n setCachedElements((prev) => {\n const next = { ...prev };\n delete next[itemToRemove.key];\n return next;\n });\n newItems.splice(indexToRemove, 1);\n }\n }\n return newItems;\n });\n }, [location.pathname, getTabTitle, maxTabCount, cachedElements]);\n\n const closeTab = useMemoizedFn((targetKey: string) => {\n const targetIndex = tabItems.findIndex((item) => item.key === targetKey);\n const newTabItems = tabItems.filter((item) => item.key !== targetKey);\n\n // 移除缓存,组件将卸载\n setCachedElements((prev) => {\n const next = { ...prev };\n delete next[targetKey];\n return next;\n });\n setTabItems(newTabItems);\n\n // 如果关闭的是当前页,跳转到临近页\n if (targetKey === activeKey) {\n if (newTabItems.length > 0) {\n const nextIndex = targetIndex >= newTabItems.length ? newTabItems.length - 1 : targetIndex;\n const nextKey = newTabItems[nextIndex].key;\n navigate(nextKey);\n }\n }\n });\n\n const closeOtherTabs = useMemoizedFn((currentKey: string) => {\n const currentTab = tabItems.find((item) => item.key === currentKey);\n if (!currentTab) return;\n const newTabItems = [{ ...currentTab, closable: false }];\n setTabItems(newTabItems);\n\n // 仅保留当前 tab 的缓存\n const keepKeys = new Set(newTabItems.map((i) => i.key));\n setCachedElements((prev) => {\n const next: Record<string, React.ReactNode> = {};\n keepKeys.forEach((k) => {\n if (prev[k]) next[k] = prev[k];\n });\n return next;\n });\n\n if (activeKey !== currentKey) {\n navigate(currentKey);\n }\n });\n\n const closeRightTabs = useMemoizedFn((currentKey: string) => {\n const currentIndex = tabItems.findIndex((i) => i.key === currentKey);\n const rightItems = tabItems.slice(currentIndex + 1);\n const rightKeys = new Set(rightItems.map((i) => i.key));\n\n const newTabItems = tabItems.filter((i) => !rightKeys.has(i.key));\n setTabItems(newTabItems);\n\n // 移除右侧 tab 的缓存\n setCachedElements((prev) => {\n const next = { ...prev };\n rightKeys.forEach((key) => { delete next[key]; });\n return next;\n });\n\n if (rightKeys.has(activeKey)) {\n navigate(currentKey);\n }\n });\n\n const handleTabEdit = (targetKey: React.MouseEvent | React.KeyboardEvent | string, action: 'add' | 'remove') => {\n if (action === 'remove' && isString(targetKey)) {\n closeTab(targetKey);\n }\n };\n\n const handleTabClick = (key: string) => {\n navigate(key);\n };\n\n const renderTabLabel = (item: TabItem) => {\n const menuItems: MenuProps['items'] = [\n {\n key: 'close',\n label: t('creek-keep-alive.index.guanBiDangQian', '关闭当前'),\n disabled: tabItems.length <= 1,\n onClick: () => closeTab(item.key),\n },\n {\n key: 'closeOthers',\n label: t('creek-keep-alive.index.guanBiQiTa', '关闭其他'),\n onClick: () => closeOtherTabs(item.key),\n },\n {\n key: 'closeRight',\n label: t('creek-keep-alive.index.guanBiYouCe', '关闭右侧'),\n onClick: () => closeRightTabs(item.key),\n },\n ];\n\n return (\n <Dropdown menu={{ items: menuItems }} trigger={['contextMenu']}>\n <span>{item.label}</span>\n </Dropdown>\n );\n };\n\n return (\n <div className=\"creek-keep-alive\">\n <Tabs\n activeKey={activeKey}\n type=\"editable-card\"\n hideAdd\n onChange={handleTabClick}\n onEdit={handleTabEdit}\n tabBarStyle={{ margin: 0, ...tabBarStyle }}\n items={tabItems.map((item) => ({\n ...item,\n label: renderTabLabel(item),\n children: (\n <div key={item.key} style={{ height: '100%', display: activeKey === item.key ? 'block' : 'none' }}>\n {cachedElements[item.key] ?? null}\n </div>\n ),\n }))}\n />\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAC9B,kBAA0C;AAC1C,oBAAmC;AACnC,mBAA2C;AAC3C,8BAAsD;AAEtD,IAAAA,gBAAqB;AA+Mb;AAhLD,IAAM,iBAAgD,CAAC,UAAU;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,EACd;AAEA,QAAM,iBAAiB,CAAC,SAAkB;AACxC,UAAM,YAAgC;AAAA,MACpC;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,yCAAyC,MAAM;AAAA,QACxD,UAAU,SAAS,UAAU;AAAA,QAC7B,SAAS,MAAM,SAAS,KAAK,GAAG;AAAA,MAClC;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,qCAAqC,MAAM;AAAA,QACpD,SAAS,MAAM,eAAe,KAAK,GAAG;AAAA,MACxC;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,sCAAsC,MAAM;AAAA,QACrD,SAAS,MAAM,eAAe,KAAK,GAAG;AAAA,MACxC;AAAA,IACF;AAEA,WACE,4CAAC,wBAAS,MAAM,EAAE,OAAO,UAAU,GAAG,SAAS,CAAC,aAAa,GAC3D,sDAAC,UAAM,eAAK,OAAM,GACpB;AAAA,EAEJ;AAEA,SACE,4CAAC,SAAI,WAAU,oBACb;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,SAAO;AAAA,MACP,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,aAAa,EAAE,QAAQ,GAAG,GAAG,YAAY;AAAA,MACzC,OAAO,SAAS,IAAI,CAAC,UAAU;AAAA,QAC7B,GAAG;AAAA,QACH,OAAO,eAAe,IAAI;AAAA,QAC1B,UACE,4CAAC,SAAmB,OAAO,EAAE,QAAQ,QAAQ,SAAS,cAAc,KAAK,MAAM,UAAU,OAAO,GAC7F,yBAAe,KAAK,GAAG,KAAK,QADrB,KAAK,GAEf;AAAA,MAEJ,EAAE;AAAA;AAAA,EACJ,GACF;AAEJ;",
4
+ "sourcesContent": ["import { useMemoizedFn } from 'ahooks';\nimport { Dropdown, MenuProps, Tabs } from 'antd';\nimport { isRegExp, isString } from 'lodash';\nimport React, { useEffect, useState } from 'react';\nimport { matchRoutes, useLocation, useNavigate } from 'react-router-dom';\n\nimport { useT } from '@creekjs/i18n/react';\n\nexport interface CreekKeepAliveProps {\n /**\n * 不需要缓存的路径\n */\n exclude?: (string | RegExp)[];\n /**\n * 自定义Tab标题获取方法\n */\n getTabTitle?: (pathname: string) => React.ReactNode;\n /**\n * Tabs的样式\n */\n tabBarStyle?: React.CSSProperties;\n /**\n * 最大缓存数量,默认为 20\n */\n maxTabCount?: number;\n /**\n * 路由配置(含 element),用于解析每个路径对应的页面组件\n */\n routes?: any[];\n}\n\ninterface TabItem {\n key: string;\n label: React.ReactNode;\n closable?: boolean;\n}\n\nexport const CreekKeepAlive: React.FC<CreekKeepAliveProps> = (props) => {\n const { exclude = [], getTabTitle, tabBarStyle, maxTabCount = 20, routes = [] } = props;\n\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n\n const [tabItems, setTabItems] = useState<TabItem[]>([]);\n const [activeKey, setActiveKey] = useState<string>('');\n\n // 缓存每个路径对应的 React element,保证同一页面始终复用同一个 element 引用\n // 这样 React reconciler 不会卸载/重新挂载组件,从而实现 keep-alive\n // 使用 state 以便缓存变化时触发重新渲染\n const [cachedElements, setCachedElements] = useState<Record<string, React.ReactNode>>({});\n\n // 根据路由配置,解析指定路径对应的叶子路由 element\n const resolveElement = (path: string): React.ReactNode | null => {\n if (!routes?.length) return null;\n const matches = matchRoutes(routes, path);\n if (!matches?.length) return null;\n // 取最后一个 match(叶子路由),即实际页面组件\n return matches[matches.length - 1].route.element ?? null;\n };\n\n // 判断是否不需要缓存\n const isPathExcluded = (path: string) => {\n return exclude.some((item) => {\n if (isString(item)) {\n return item === path;\n }\n if (isRegExp(item)) {\n return item.test(path);\n }\n return false;\n });\n };\n\n // 初始化或路由变化时更新\n useEffect(() => {\n const currentPath = location.pathname;\n\n // 不需要缓存的路径,不创建 tab\n if (isPathExcluded(currentPath)) return;\n\n // 如果路由配置中没有对应的 element(如纯 redirect 路由),不创建 tab\n const element = resolveElement(currentPath);\n if (!element) return;\n\n // 缓存当前路径的 element(仅首次缓存,后续复用同一个 element 引用)\n if (!cachedElements[currentPath]) {\n setCachedElements((prev) => ({ ...prev, [currentPath]: element }));\n }\n\n setActiveKey(currentPath);\n\n // 更新 Tab 列表\n setTabItems((prev) => {\n if (prev.find((i) => i.key === currentPath)) {\n // 更新现有 tab 的 closable 状态(只有最后一个 tab 时不可关闭)\n return prev.map((i) => ({ ...i, closable: prev.length > 1 }));\n }\n const title = getTabTitle?.(currentPath) || currentPath;\n const newItems = [...prev, { key: currentPath, label: title, closable: prev.length > 0 }];\n\n // 只有1个 tab 时不可关闭\n if (newItems.length === 1) {\n newItems[0].closable = false;\n }\n\n // 超过最大数量限制,移除最早的可关闭 tab\n if (newItems.length > maxTabCount) {\n const indexToRemove = newItems.findIndex((item) => item.closable && item.key !== currentPath);\n if (indexToRemove !== -1) {\n const itemToRemove = newItems[indexToRemove];\n setCachedElements((prev) => {\n const next = { ...prev };\n delete next[itemToRemove.key];\n return next;\n });\n newItems.splice(indexToRemove, 1);\n }\n }\n return newItems;\n });\n }, [location.pathname, getTabTitle, maxTabCount, cachedElements]);\n\n const closeTab = useMemoizedFn((targetKey: string) => {\n const targetIndex = tabItems.findIndex((item) => item.key === targetKey);\n const newTabItems = tabItems.filter((item) => item.key !== targetKey);\n\n // 移除缓存,组件将卸载\n setCachedElements((prev) => {\n const next = { ...prev };\n delete next[targetKey];\n return next;\n });\n setTabItems(newTabItems);\n\n // 如果关闭的是当前页,跳转到临近页\n if (targetKey === activeKey) {\n if (newTabItems.length > 0) {\n const nextIndex = targetIndex >= newTabItems.length ? newTabItems.length - 1 : targetIndex;\n const nextKey = newTabItems[nextIndex].key;\n navigate(nextKey);\n }\n }\n });\n\n const closeOtherTabs = useMemoizedFn((currentKey: string) => {\n const currentTab = tabItems.find((item) => item.key === currentKey);\n if (!currentTab) return;\n const newTabItems = [{ ...currentTab, closable: false }];\n setTabItems(newTabItems);\n\n // 仅保留当前 tab 的缓存\n const keepKeys = new Set(newTabItems.map((i) => i.key));\n setCachedElements((prev) => {\n const next: Record<string, React.ReactNode> = {};\n keepKeys.forEach((k) => {\n if (prev[k]) next[k] = prev[k];\n });\n return next;\n });\n\n if (activeKey !== currentKey) {\n navigate(currentKey);\n }\n });\n\n const closeRightTabs = useMemoizedFn((currentKey: string) => {\n const currentIndex = tabItems.findIndex((i) => i.key === currentKey);\n const rightItems = tabItems.slice(currentIndex + 1);\n const rightKeys = new Set(rightItems.map((i) => i.key));\n\n const newTabItems = tabItems.filter((i) => !rightKeys.has(i.key));\n setTabItems(newTabItems);\n\n // 移除右侧 tab 的缓存\n setCachedElements((prev) => {\n const next = { ...prev };\n rightKeys.forEach((key) => { delete next[key]; });\n return next;\n });\n\n if (rightKeys.has(activeKey)) {\n navigate(currentKey);\n }\n });\n\n const handleTabEdit = (targetKey: React.MouseEvent | React.KeyboardEvent | string, action: 'add' | 'remove') => {\n if (action === 'remove' && isString(targetKey)) {\n closeTab(targetKey);\n }\n };\n\n const handleTabClick = (key: string) => {\n navigate(key);\n };\n\n const renderTabLabel = (item: TabItem) => {\n const menuItems: MenuProps['items'] = [\n {\n key: 'close',\n label: t('creek-keep-alive.index.guanBiDangQian', '关闭当前'),\n disabled: tabItems.length <= 1,\n onClick: () => closeTab(item.key),\n },\n {\n key: 'closeOthers',\n label: t('creek-keep-alive.index.guanBiQiTa', '关闭其他'),\n onClick: () => closeOtherTabs(item.key),\n },\n {\n key: 'closeRight',\n label: t('creek-keep-alive.index.guanBiYouCe', '关闭右侧'),\n onClick: () => closeRightTabs(item.key),\n },\n ];\n\n return (\n <Dropdown menu={{ items: menuItems }} trigger={['contextMenu']}>\n <span>{item.label}</span>\n </Dropdown>\n );\n };\n\n return (\n <div className=\"creek-keep-alive\">\n <Tabs\n activeKey={activeKey}\n type=\"editable-card\"\n hideAdd\n onChange={handleTabClick}\n onEdit={handleTabEdit}\n tabBarStyle={{ margin: 0, ...tabBarStyle }}\n items={tabItems.map((item) => ({\n ...item,\n label: renderTabLabel(item),\n children: (\n <div key={item.key} style={{ height: '100%', display: activeKey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AU,OAAO,GAC7F,yBAAe,KAAK,GAAG,KAAK,QADrB,KAAK,GAEf;AAAA,MAEJ,EAAE;AAAA;AAAA,EACJ,GACF;AAEJ;",
6
6
  "names": ["import_react", "prev"]
7
7
  }
@@ -47,8 +47,8 @@ var UserInfo = (props) => {
47
47
  const { styles } = useStyles();
48
48
  const { name, avatar, menu } = props;
49
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Dropdown, { arrow: true, placement: "bottom", overlayClassName: styles.userInfoDropdownOverlay, menu, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Space, { size: 4, align: "center", children: [
50
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Avatar, { className: styles.avatarContainer, src: avatar, children: name }),
51
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: name })
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Avatar, { className: styles.avatarContainer, src: avatar, children: typeof name === "string" ? name.charAt(0).toUpperCase() : name }),
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, { strong: true, children: name })
52
52
  ] }) });
53
53
  };
54
54
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/creek-layout/ActionRender/UserInfo.tsx"],
4
- "sourcesContent": ["import { Avatar, Dropdown, DropDownProps, Space } from \"antd\";\nimport { createStyles } from \"antd-style\";\n\nconst useStyles = createStyles(({ token}) => ({\n avatarContainer: {\n backgroundColor: token.colorPrimary,\n width: 24,\n height: 24,\n },\n userInfoDropdownOverlay: {\n \".ant-dropdown-menu\": {\n padding: \"8px 0\",\n },\n \".ant-dropdown-menu-item\": {\n \".ant-dropdown-menu-item-icon\": {\n fontSize: \"18px\",\n marginRight: \"8px\",\n },\n },\n },\n}));\n\nexport interface UserInfoProps {\n name?: React.ReactNode;\n avatar?: string;\n menu?: DropDownProps['menu'];\n}\n\nexport const UserInfo = (props: UserInfoProps) => {\n const { styles } = useStyles();\n const { name, avatar, menu } = props;\n\n return (\n <Dropdown arrow placement=\"bottom\" overlayClassName={styles.userInfoDropdownOverlay} menu={menu}>\n <Space size={4} align=\"center\">\n <Avatar className={styles.avatarContainer} src={avatar}>\n {name}\n </Avatar>\n <span>{name}</span>\n </Space>\n </Dropdown>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuD;AACvD,wBAA6B;AAiCvB;AA/BN,IAAM,gBAAY,gCAAa,CAAC,EAAE,MAAK,OAAO;AAAA,EAC5C,iBAAiB;AAAA,IACf,iBAAiB,MAAM;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,yBAAyB;AAAA,IACvB,sBAAsB;AAAA,MACpB,SAAS;AAAA,IACX;AAAA,IACA,2BAA2B;AAAA,MACzB,gCAAgC;AAAA,QAC9B,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF,EAAE;AAQK,IAAM,WAAW,CAAC,UAAyB;AAChD,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,MAAM,QAAQ,KAAK,IAAI;AAE/B,SACE,4CAAC,wBAAS,OAAK,MAAC,WAAU,UAAS,kBAAkB,OAAO,yBAAyB,MACnF,uDAAC,qBAAM,MAAM,GAAG,OAAM,UACpB;AAAA,gDAAC,sBAAO,WAAW,OAAO,iBAAiB,KAAK,QAC7C,gBACH;AAAA,IACA,4CAAC,UAAM,gBAAK;AAAA,KACd,GACF;AAEJ;",
4
+ "sourcesContent": ["import { Avatar, Dropdown, DropDownProps, Space, Typography } from \"antd\";\nimport { createStyles } from \"antd-style\";\n\nconst useStyles = createStyles(({ token}) => ({\n avatarContainer: {\n backgroundColor: token.colorPrimary,\n width: 24,\n height: 24,\n },\n userInfoDropdownOverlay: {\n \".ant-dropdown-menu\": {\n padding: \"8px 0\",\n },\n \".ant-dropdown-menu-item\": {\n \".ant-dropdown-menu-item-icon\": {\n fontSize: \"18px\",\n marginRight: \"8px\",\n },\n },\n },\n}));\n\nexport interface UserInfoProps {\n name?: React.ReactNode;\n avatar?: string;\n menu?: DropDownProps['menu'];\n}\n\nexport const UserInfo = (props: UserInfoProps) => {\n const { styles } = useStyles();\n const { name, avatar, menu } = props;\n\n return (\n <Dropdown arrow placement=\"bottom\" overlayClassName={styles.userInfoDropdownOverlay} menu={menu}>\n <Space size={4} align=\"center\">\n <Avatar className={styles.avatarContainer} src={avatar}>\n {typeof name === 'string' ? name.charAt(0).toUpperCase() : name}\n </Avatar>\n <Typography.Text strong>{name}</Typography.Text>\n </Space>\n </Dropdown>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmE;AACnE,wBAA6B;AAiCvB;AA/BN,IAAM,gBAAY,gCAAa,CAAC,EAAE,MAAK,OAAO;AAAA,EAC5C,iBAAiB;AAAA,IACf,iBAAiB,MAAM;AAAA,IACvB,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,yBAAyB;AAAA,IACvB,sBAAsB;AAAA,MACpB,SAAS;AAAA,IACX;AAAA,IACA,2BAA2B;AAAA,MACzB,gCAAgC;AAAA,QAC9B,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF,EAAE;AAQK,IAAM,WAAW,CAAC,UAAyB;AAChD,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,MAAM,QAAQ,KAAK,IAAI;AAE/B,SACE,4CAAC,wBAAS,OAAK,MAAC,WAAU,UAAS,kBAAkB,OAAO,yBAAyB,MACnF,uDAAC,qBAAM,MAAM,GAAG,OAAM,UACpB;AAAA,gDAAC,sBAAO,WAAW,OAAO,iBAAiB,KAAK,QAC7C,iBAAO,SAAS,WAAW,KAAK,OAAO,CAAC,EAAE,YAAY,IAAI,MAC7D;AAAA,IACA,4CAAC,uBAAW,MAAX,EAAgB,QAAM,MAAE,gBAAK;AAAA,KAChC,GACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,3 @@
1
1
  export { FullScreen } from './FullScreen';
2
- export { UserInfo } from './UserInfo';
2
+ export { UserInfo, type UserInfoProps } from './UserInfo';
3
3
  export { LayoutSettings } from './LayoutSettings';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/creek-layout/ActionRender/index.tsx"],
4
- "sourcesContent": ["export { FullScreen } from './FullScreen';\nexport { UserInfo } from './UserInfo';\nexport { LayoutSettings } from './LayoutSettings';\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAC3B,sBAAyB;AACzB,4BAA+B;",
4
+ "sourcesContent": ["export { FullScreen } from './FullScreen';\nexport { UserInfo, type UserInfoProps } from './UserInfo';\nexport { LayoutSettings } from './LayoutSettings';\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAC3B,sBAA6C;AAC7C,4BAA+B;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { ProLayoutProps } from '@ant-design/pro-components';
3
3
  import { CreekKeepAliveProps } from '../creek-keep-alive';
4
- export type LayoutProps = ProLayoutProps & {
4
+ import { UserInfoProps } from './ActionRender';
5
+ export type CreekLayoutProps = ProLayoutProps & {
5
6
  runtimeConfig: ProLayoutProps;
6
7
  userConfig?: ProLayoutProps;
7
8
  navigate?: (path?: string | number) => void;
@@ -17,6 +18,14 @@ export type LayoutProps = ProLayoutProps & {
17
18
  keepAlive?: boolean | CreekKeepAliveProps;
18
19
  extraActions?: React.ReactNode[];
19
20
  clientRoutes?: any[];
21
+ iconFontCNs?: string[];
22
+ /**
23
+ * 用户信息区域,支持传入配置对象(名称、头像、下拉菜单)或自定义渲染函数
24
+ * - 传对象:自动使用 UserInfo 组件渲染
25
+ * - 传函数:返回 ReactNode 直接渲染,返回 UserInfoProps 对象则使用 UserInfo 组件渲染
26
+ */
27
+ renderUser?: UserInfoProps | (() => React.ReactNode | UserInfoProps);
20
28
  };
21
- export declare const CreekLayout: (props: LayoutProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const CreekLayout: (props: CreekLayoutProps) => import("react/jsx-runtime").JSX.Element;
22
30
  export * from './Exception';
31
+ export { UserInfo, type UserInfoProps } from './ActionRender';
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/creek-layout/index.tsx
31
31
  var creek_layout_exports = {};
32
32
  __export(creek_layout_exports, {
33
- CreekLayout: () => CreekLayout
33
+ CreekLayout: () => CreekLayout,
34
+ UserInfo: () => import_ActionRender2.UserInfo
34
35
  });
35
36
  module.exports = __toCommonJS(creek_layout_exports);
36
37
  var import_pro_components = require("@ant-design/pro-components");
@@ -48,6 +49,7 @@ var import_CollapseButton = require("./CollapseButton");
48
49
  var import_Exception = require("./Exception");
49
50
  var import_useLayoutSettingsStore = require("./useLayoutSettingsStore");
50
51
  __reExport(creek_layout_exports, require("./Exception"), module.exports);
52
+ var import_ActionRender2 = require("./ActionRender");
51
53
  var import_jsx_runtime = require("react/jsx-runtime");
52
54
  var MenuName = ({ name, path }) => {
53
55
  const t = (0, import_react2.useT)();
@@ -69,6 +71,8 @@ var CreekLayout = (props) => {
69
71
  keepAlive = false,
70
72
  extraActions = [],
71
73
  clientRoutes,
74
+ iconFontCNs,
75
+ renderUser,
72
76
  ...more
73
77
  } = props;
74
78
  const { useToken } = import_antd.theme;
@@ -125,6 +129,12 @@ var CreekLayout = (props) => {
125
129
  return hasI18n ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuName, { name: title, path: pathname }) : title;
126
130
  });
127
131
  const actions = [...extraActions];
132
+ if (renderUser) {
133
+ let result = typeof renderUser === "function" ? renderUser() : renderUser;
134
+ const isUserInfoProps = (val) => val !== null && typeof val === "object" && ("name" in val || "avatar" in val || "menu" in val);
135
+ const userInfoNode = isUserInfoProps(result) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ActionRender.UserInfo, { ...result }) : result;
136
+ actions.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: userInfoNode }, "user-info"));
137
+ }
128
138
  if (actualShowFullScreen) {
129
139
  actions.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ActionRender.FullScreen, {}, "full-screen"));
130
140
  }
@@ -185,6 +195,7 @@ var CreekLayout = (props) => {
185
195
  // Annotate the CommonJS export names for ESM import in node:
186
196
  0 && (module.exports = {
187
197
  CreekLayout,
198
+ UserInfo,
188
199
  ...require("./Exception")
189
200
  });
190
201
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/creek-layout/index.tsx"],
4
- "sourcesContent": ["import { MenuDataItem, ProLayout, ProLayoutProps } from '@ant-design/pro-components';\nimport { useMemoizedFn } from 'ahooks';\nimport { theme } from 'antd';\nimport _ from 'lodash';\nimport { useContext } from 'react';\n\nimport classnames from 'classnames';\n\nimport { IntlContext, useT } from '@creekjs/i18n/react';\n\nimport { CreekKeepAlive, CreekKeepAliveProps } from '../creek-keep-alive';\nimport { CreekLocaleButton } from '../creek-locale-button';\nimport { GlobalScrollbarStyle } from '../creek-style/scrollbar';\nimport { FullScreen, LayoutSettings } from './ActionRender';\nimport { CollapsedButton, useCollapsedStore } from './CollapseButton';\nimport { Exception } from './Exception';\nimport { useLayoutSettingsStore } from './useLayoutSettingsStore';\n\nexport type LayoutProps = ProLayoutProps & {\n runtimeConfig: ProLayoutProps;\n userConfig?: ProLayoutProps;\n navigate?: (path?: string | number) => void;\n showFullScreen?: boolean;\n showLocaleButton?: boolean;\n showSettingsButton?: boolean;\n showThemeColor?: boolean;\n initialInfo?: {\n initialState: any;\n loading: boolean;\n setInitialState: () => void;\n };\n keepAlive?: boolean | CreekKeepAliveProps;\n extraActions?: React.ReactNode[];\n clientRoutes?: any[];\n};\n\nconst MenuName = ({ name, path }: { name?: string; path?: string }) => {\n const t = useT();\n const key = !path || path === '/' ? 'menu.home' : `menu${path.replace(/\\//g, '.')}`;\n return t(key, name);\n};\n\nexport const CreekLayout = (props: LayoutProps) => {\n const {\n route,\n userConfig,\n runtimeConfig,\n children,\n location,\n navigate,\n showFullScreen = false,\n showLocaleButton = false,\n showSettingsButton = false,\n showThemeColor = true,\n keepAlive = false,\n extraActions = [],\n clientRoutes,\n ...more\n } = props;\n\n const { useToken } = theme;\n const { token } = useToken();\n\n const { collapsed } = useCollapsedStore();\n const settingsStore = useLayoutSettingsStore();\n\n const actualShowFullScreen = showFullScreen && (settingsStore.showFullScreen ?? true);\n const actualShowLocaleButton = showLocaleButton && (settingsStore.showLocaleButton ?? true);\n const colorPrimary = settingsStore.colorPrimary || token.colorPrimary;\n const actualKeepAlive = keepAlive && (settingsStore.keepAlive ?? true);\n\n const _userConfig = { ...userConfig, ...runtimeConfig };\n\n const intlContext = useContext(IntlContext);\n const hasI18n = !!intlContext && actualShowLocaleButton;\n\n const menuDataRender = useMemoizedFn((menuData: MenuDataItem[]) => {\n // 根据当前是否开启了国际化(上下文是否存在)以及用户配置来判断是否包裹菜单翻译\n const isLocaleEnabled = hasI18n;\n\n const mapMenu = (items: MenuDataItem[]): MenuDataItem[] => {\n return items.map((item) => {\n return {\n ...item,\n name: (isLocaleEnabled ? <MenuName name={item.name} path={item.path} /> : item.name) as string,\n children: item.children ? mapMenu(item.children) : undefined,\n };\n });\n };\n return mapMenu(menuData);\n });\n\n const menuItemRender: ProLayoutProps['menuItemRender'] = useMemoizedFn((itemProps, defaultDom) => {\n return (\n <span\n onClick={() => {\n if (navigate) {\n navigate(itemProps.path);\n }\n }}\n >\n {defaultDom}\n </span>\n );\n });\n\n const getTabTitle = useMemoizedFn((pathname: string): string | React.ReactNode => {\n const routes = (route?.routes ?? []) as MenuDataItem[];\n\n const findTitle = (items: MenuDataItem[]): string | undefined => {\n for (const item of items) {\n if (item.path === pathname) return item.name ?? item.title;\n if (item.children) {\n const found = findTitle(item.children);\n if (found) return found;\n }\n }\n };\n\n const title = findTitle(routes) ?? pathname;\n\n return hasI18n ? <MenuName name={title} path={pathname} /> : title;\n });\n\n const actions: React.ReactNode[] = [...extraActions];\n\n if (actualShowFullScreen) {\n actions.push(<FullScreen key=\"full-screen\" />);\n }\n\n if (actualShowLocaleButton) {\n actions.push(<CreekLocaleButton key=\"locale-button\" />);\n }\n\n if (showSettingsButton) {\n actions.push(<LayoutSettings key=\"settings\" defaultShowFullScreen={showFullScreen} defaultShowLocaleButton={showLocaleButton} defaultShowThemeColor={showThemeColor} defaultKeepAlive={_.isBoolean(keepAlive) ? keepAlive : true} />);\n }\n\n const keepAliveProps = _.isBoolean(keepAlive) ? {} : keepAlive;\n\n const layoutContent = (\n <ProLayout\n className={classnames('creek-layout-container', _userConfig?.className)}\n route={route}\n title={_userConfig?.title}\n siderWidth={200}\n location={location}\n menuDataRender={menuDataRender}\n menuItemRender={menuItemRender}\n actionsRender={() => actions}\n token={{\n header: {\n colorBgHeader: '#fff',\n colorHeaderTitle: 'rgba(0, 0, 0, 0.80);',\n colorTextMenuSelected: colorPrimary,\n heightLayoutHeader: 48,\n },\n sider: {\n colorMenuBackground: '#f7f8fa',\n colorBgMenuItemSelected: 'transparent',\n colorTextMenuActive: colorPrimary,\n colorTextMenuSelected: colorPrimary,\n colorTextMenuItemHover: colorPrimary,\n colorTextMenu: '#333',\n },\n pageContainer: {\n paddingBlockPageContainerContent: 0,\n paddingInlinePageContainerContent: 0,\n colorBgPageContainer: 'linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);',\n },\n }}\n fixSiderbar\n fixedHeader\n collapsed={collapsed}\n collapsedButtonRender={(collapsed) => {\n return <CollapsedButton collapsed={collapsed} />;\n }}\n {...more}\n >\n <GlobalScrollbarStyle />\n <Exception>{actualKeepAlive ? <CreekKeepAlive getTabTitle={getTabTitle} routes={clientRoutes ?? route?.routes} {...keepAliveProps} /> : children}</Exception>\n </ProLayout>\n );\n\n return layoutContent;\n};\n\nexport * from './Exception';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAwD;AACxD,oBAA8B;AAC9B,kBAAsB;AACtB,oBAAc;AACd,mBAA2B;AAE3B,wBAAuB;AAEvB,IAAAA,gBAAkC;AAElC,8BAAoD;AACpD,iCAAkC;AAClC,uBAAqC;AACrC,0BAA2C;AAC3C,4BAAmD;AACnD,uBAA0B;AAC1B,oCAAuC;AA2KvC,iCAAc,wBA3Ld;AAoFmC;AAhDnC,IAAM,WAAW,CAAC,EAAE,MAAM,KAAK,MAAwC;AACrE,QAAM,QAAI,oBAAK;AACf,QAAM,MAAM,CAAC,QAAQ,SAAS,MAAM,cAAc,OAAO,KAAK,QAAQ,OAAO,GAAG;AAChF,SAAO,EAAE,KAAK,IAAI;AACpB;AAEO,IAAM,cAAc,CAAC,UAAuB;AACjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,eAAe,CAAC;AAAA,IAChB;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,EAAE,UAAU,QAAI,yCAAkB;AACxC,QAAM,oBAAgB,sDAAuB;AAE7C,QAAM,uBAAuB,mBAAmB,cAAc,kBAAkB;AAChF,QAAM,yBAAyB,qBAAqB,cAAc,o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BAAkB,4CAAC,0CAAe,aAA0B,QAAQ,iBAAgB,+BAAO,SAAS,GAAG,gBAAgB,IAAK,UAAS;AAAA;AAAA;AAAA,EACnJ;AAGF,SAAO;AACT;",
6
- "names": ["import_react", "_", "classnames", "collapsed"]
4
+ "sourcesContent": ["import { MenuDataItem, ProLayout, ProLayoutProps } from '@ant-design/pro-components';\nimport { useMemoizedFn } from 'ahooks';\nimport { theme } from 'antd';\nimport _ from 'lodash';\nimport { useContext } from 'react';\n\nimport classnames from 'classnames';\n\nimport { IntlContext, useT } from '@creekjs/i18n/react';\n\nimport { CreekKeepAlive, CreekKeepAliveProps } from '../creek-keep-alive';\nimport { CreekLocaleButton } from '../creek-locale-button';\nimport { GlobalScrollbarStyle } from '../creek-style/scrollbar';\nimport { FullScreen, LayoutSettings, UserInfo, UserInfoProps } from './ActionRender';\nimport { CollapsedButton, useCollapsedStore } from './CollapseButton';\nimport { Exception } from './Exception';\nimport { useLayoutSettingsStore } from './useLayoutSettingsStore';\n\nexport type CreekLayoutProps = ProLayoutProps & {\n runtimeConfig: ProLayoutProps;\n userConfig?: ProLayoutProps;\n navigate?: (path?: string | number) => void;\n showFullScreen?: boolean;\n showLocaleButton?: boolean;\n showSettingsButton?: boolean;\n showThemeColor?: boolean;\n initialInfo?: {\n initialState: any;\n loading: boolean;\n setInitialState: () => void;\n };\n keepAlive?: boolean | CreekKeepAliveProps;\n extraActions?: React.ReactNode[];\n clientRoutes?: any[];\n iconFontCNs?: string[];\n /**\n * 用户信息区域,支持传入配置对象(名称、头像、下拉菜单)或自定义渲染函数\n * - 传对象:自动使用 UserInfo 组件渲染\n * - 传函数:返回 ReactNode 直接渲染,返回 UserInfoProps 对象则使用 UserInfo 组件渲染\n */\n renderUser?: UserInfoProps | (() => React.ReactNode | UserInfoProps);\n};\n\nconst MenuName = ({ name, path }: { name?: string; path?: string }) => {\n const t = useT();\n const key = !path || path === '/' ? 'menu.home' : `menu${path.replace(/\\//g, '.')}`;\n return t(key, name);\n};\n\nexport const CreekLayout = (props: CreekLayoutProps) => {\n const {\n route,\n userConfig,\n runtimeConfig,\n children,\n location,\n navigate,\n showFullScreen = false,\n showLocaleButton = false,\n showSettingsButton = false,\n showThemeColor = true,\n keepAlive = false,\n extraActions = [],\n clientRoutes,\n iconFontCNs,\n renderUser,\n ...more\n } = props;\n\n const { useToken } = theme;\n const { token } = useToken();\n\n const { collapsed } = useCollapsedStore();\n const settingsStore = useLayoutSettingsStore();\n\n const actualShowFullScreen = showFullScreen && (settingsStore.showFullScreen ?? true);\n const actualShowLocaleButton = showLocaleButton && (settingsStore.showLocaleButton ?? true);\n const colorPrimary = settingsStore.colorPrimary || token.colorPrimary;\n const actualKeepAlive = keepAlive && (settingsStore.keepAlive ?? true);\n\n const _userConfig = { ...userConfig, ...runtimeConfig };\n\n const intlContext = useContext(IntlContext);\n const hasI18n = !!intlContext && actualShowLocaleButton;\n\n const menuDataRender = useMemoizedFn((menuData: MenuDataItem[]) => {\n // 根据当前是否开启了国际化(上下文是否存在)以及用户配置来判断是否包裹菜单翻译\n const isLocaleEnabled = hasI18n;\n\n const mapMenu = (items: MenuDataItem[]): MenuDataItem[] => {\n return items.map((item) => {\n return {\n ...item,\n name: (isLocaleEnabled ? <MenuName name={item.name} path={item.path} /> : item.name) as string,\n children: item.children ? mapMenu(item.children) : undefined,\n };\n });\n };\n return mapMenu(menuData);\n });\n\n const menuItemRender: ProLayoutProps['menuItemRender'] = useMemoizedFn((itemProps, defaultDom) => {\n return (\n <span\n onClick={() => {\n if (navigate) {\n navigate(itemProps.path);\n }\n }}\n >\n {defaultDom}\n </span>\n );\n });\n\n const getTabTitle = useMemoizedFn((pathname: string): string | React.ReactNode => {\n const routes = (route?.routes ?? []) as MenuDataItem[];\n\n const findTitle = (items: MenuDataItem[]): string | undefined => {\n for (const item of items) {\n if (item.path === pathname) return item.name ?? item.title;\n if (item.children) {\n const found = findTitle(item.children);\n if (found) return found;\n }\n }\n };\n\n const title = findTitle(routes) ?? pathname;\n\n return hasI18n ? <MenuName name={title} path={pathname} /> : title;\n });\n\n const actions: React.ReactNode[] = [...extraActions];\n\n if (renderUser) {\n let result = typeof renderUser === 'function' ? renderUser() : renderUser;\n const isUserInfoProps = (val: unknown): val is UserInfoProps =>\n val !== null && typeof val === 'object' && ('name' in val || 'avatar' in val || 'menu' in val);\n const userInfoNode = isUserInfoProps(result) ? <UserInfo {...result} /> : result;\n actions.push(<span key=\"user-info\">{userInfoNode}</span>);\n }\n\n if (actualShowFullScreen) {\n actions.push(<FullScreen key=\"full-screen\" />);\n }\n\n if (actualShowLocaleButton) {\n actions.push(<CreekLocaleButton key=\"locale-button\" />);\n }\n\n if (showSettingsButton) {\n actions.push(<LayoutSettings key=\"settings\" defaultShowFullScreen={showFullScreen} defaultShowLocaleButton={showLocaleButton} defaultShowThemeColor={showThemeColor} defaultKeepAlive={_.isBoolean(keepAlive) ? keepAlive : true} />);\n }\n\n const keepAliveProps = _.isBoolean(keepAlive) ? {} : keepAlive;\n\n const layoutContent = (\n <ProLayout\n className={classnames('creek-layout-container', _userConfig?.className)}\n route={route}\n title={_userConfig?.title}\n siderWidth={200}\n location={location}\n menuDataRender={menuDataRender}\n menuItemRender={menuItemRender}\n actionsRender={() => actions}\n token={{\n header: {\n colorBgHeader: '#fff',\n colorHeaderTitle: 'rgba(0, 0, 0, 0.80);',\n colorTextMenuSelected: colorPrimary,\n heightLayoutHeader: 48,\n },\n sider: {\n colorMenuBackground: '#f7f8fa',\n colorBgMenuItemSelected: 'transparent',\n colorTextMenuActive: colorPrimary,\n colorTextMenuSelected: colorPrimary,\n colorTextMenuItemHover: colorPrimary,\n colorTextMenu: '#333',\n },\n pageContainer: {\n paddingBlockPageContainerContent: 0,\n paddingInlinePageContainerContent: 0,\n colorBgPageContainer: 'linear-gradient(180deg, #F7F9FF 0%, #FFF 45.59%);',\n },\n }}\n fixSiderbar\n fixedHeader\n collapsed={collapsed}\n collapsedButtonRender={(collapsed) => {\n return <CollapsedButton collapsed={collapsed} />;\n }}\n {...more}\n >\n <GlobalScrollbarStyle />\n <Exception>{actualKeepAlive ? <CreekKeepAlive getTabTitle={getTabTitle} routes={clientRoutes ?? route?.routes} {...keepAliveProps} /> : children}</Exception>\n </ProLayout>\n );\n\n return layoutContent;\n};\n\nexport * from './Exception';\nexport { UserInfo, type UserInfoProps } from './ActionRender';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAwD;AACxD,oBAA8B;AAC9B,kBAAsB;AACtB,oBAAc;AACd,mBAA2B;AAE3B,wBAAuB;AAEvB,IAAAA,gBAAkC;AAElC,8BAAoD;AACpD,iCAAkC;AAClC,uBAAqC;AACrC,0BAAoE;AACpE,4BAAmD;AACnD,uBAA0B;AAC1B,oCAAuC;AA4LvC,iCAAc,wBA5Md;AA6MA,IAAAC,uBAA6C;AAhHV;AAlDnC,IAAM,WAAW,CAAC,EAAE,MAAM,KAAK,MAAwC;AACrE,QAAM,QAAI,oBAAK;AACf,QAAM,MAAM,CAAC,QAAQ,SAAS,MAAM,cAAc,OAAO,KAAK,QAAQ,OAAO,GAAG;AAChF,SAAO,EAAE,KAAK,IAAI;AACpB;AAEO,IAAM,cAAc,CAAC,UAA4B;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,eAAe,CAAC;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,EAAE,UAAU,QAAI,yCAAkB;AACxC,QAAM,oBAAgB,sDAAuB;AAE7C,QAAM,uBAAuB,mBAAmB,cAA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ACvB,wBAAwB;AAAA,UACxB,eAAe;AAAA,QACjB;AAAA,QACA,eAAe;AAAA,UACb,kCAAkC;AAAA,UAClC,mCAAmC;AAAA,UACnC,sBAAsB;AAAA,QACxB;AAAA,MACF;AAAA,MACA,aAAW;AAAA,MACX,aAAW;AAAA,MACX;AAAA,MACA,uBAAuB,CAACC,eAAc;AACpC,eAAO,4CAAC,yCAAgB,WAAWA,YAAW;AAAA,MAChD;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,oDAAC,yCAAqB;AAAA,QACtB,4CAAC,8BAAW,4BAAkB,4CAAC,0CAAe,aAA0B,QAAQ,iBAAgB,+BAAO,SAAS,GAAG,gBAAgB,IAAK,UAAS;AAAA;AAAA;AAAA,EACnJ;AAGF,SAAO;AACT;",
6
+ "names": ["import_react", "import_ActionRender", "_", "classnames", "collapsed"]
7
7
  }
@@ -24,6 +24,18 @@ __export(useTableScrollHeight_exports, {
24
24
  module.exports = __toCommonJS(useTableScrollHeight_exports);
25
25
  var import_ahooks = require("ahooks");
26
26
  var import_react = require("react");
27
+ var getScrollParent = (element) => {
28
+ let parent = element.parentElement;
29
+ while (parent) {
30
+ const style = window.getComputedStyle(parent);
31
+ const overflowY = style.overflowY;
32
+ if (overflowY === "auto" || overflowY === "scroll") {
33
+ return parent;
34
+ }
35
+ parent = parent.parentElement;
36
+ }
37
+ return window;
38
+ };
27
39
  var useTableScrollHeight = (prefixCls, tableRef, pageFixedBottom = true, offsetBottom = 0) => {
28
40
  const [scrollY, setScrollY] = (0, import_react.useState)(void 0);
29
41
  const [tableHeight, setTableHeight] = (0, import_react.useState)(void 0);
@@ -64,16 +76,24 @@ var useTableScrollHeight = (prefixCls, tableRef, pageFixedBottom = true, offsetB
64
76
  }
65
77
  const windowHeight = window.innerHeight;
66
78
  let height = windowHeight - top - currentContentPadding - currentCardContentPadding - offsetBottom;
67
- let currentTableHeight = windowHeight - tableEl.getBoundingClientRect().top;
79
+ const scrollParent = getScrollParent(tableEl);
80
+ let parentTop = 0;
81
+ if (scrollParent instanceof HTMLElement) {
82
+ parentTop = scrollParent.getBoundingClientRect().top;
83
+ }
84
+ const tableTopRelativeToParent = tableEl.getBoundingClientRect().top - parentTop;
85
+ let currentTableHeight = windowHeight - tableTopRelativeToParent - offsetBottom;
68
86
  const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);
69
87
  if (pagination) {
70
88
  const paginationHeight = pagination.clientHeight;
71
89
  const styles = window.getComputedStyle(pagination);
72
90
  const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
73
91
  height = height - paginationHeight - totalPaginationMargin;
92
+ currentTableHeight = currentTableHeight - paginationHeight - totalPaginationMargin;
74
93
  setTableHeight(0);
75
94
  } else {
76
95
  height = height - 40;
96
+ currentTableHeight = currentTableHeight - 40;
77
97
  setTableHeight(currentTableHeight);
78
98
  }
79
99
  let currentHasScroll = false;
@@ -97,6 +117,7 @@ var useTableScrollHeight = (prefixCls, tableRef, pageFixedBottom = true, offsetB
97
117
  return () => observer.disconnect();
98
118
  }, [tableRef, pageFixedBottom, prefixCls]);
99
119
  (0, import_ahooks.useEventListener)("resize", calcHeight);
120
+ (0, import_ahooks.useEventListener)("scroll", calcHeight, { target: window });
100
121
  return {
101
122
  scrollY,
102
123
  tableHeight,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/creek-table/hooks/useTableScrollHeight.tsx"],
4
- "sourcesContent": ["import { useDebounceFn, useEventListener } from 'ahooks';\nimport { useEffect, useState } from 'react';\n\nexport const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, offsetBottom: number = 0) => {\n const [scrollY, setScrollY] = useState<number | undefined>(undefined);\n const [tableHeight, setTableHeight] = useState<number | undefined>(undefined);\n const [tableContainerHeight, setTableContainerHeight] = useState<number | undefined>(0);\n const [hasScroll, setHasScroll] = useState<boolean>(false);\n\n const { run: calcHeight } = useDebounceFn(\n () => {\n if (!pageFixedBottom || !tableRef.current) return;\n\n const tableEl = tableRef.current;\n\n // 如果元素不可见(例如在 display: none 的 tab 中),不进行计算,防止计算出错误的高度\n if (tableEl.offsetParent === null) return;\n\n const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);\n const tableBody = tableEl.querySelector(`.${prefixCls}-table-tbody`);\n\n // 尝试动态获取 layout content padding\n // Ant Design Pro Layout 的 content 容器通常有 class 包含 'pro-layout-content'\n // 例如:ant-pro-layout-content, my-prefix-pro-layout-content\n let currentContentPadding = 0; // 默认使用传入的\n\n const layoutContentEl = tableEl.closest(`div[class*=\"pro-layout-content\"]`);\n if (layoutContentEl) {\n const style = window.getComputedStyle(layoutContentEl);\n // 我们主要关心底部的 padding,因为它影响到底部留白\n const paddingBottom = parseFloat(style.paddingBottom);\n if (!isNaN(paddingBottom)) {\n currentContentPadding = paddingBottom;\n }\n }\n\n // 尝试动态获取 layout content padding\n // Ant Design Pro Layout 的 content 容器通常有 class 包含 'pro-layout-content'\n // 例如:ant-pro-layout-content, my-prefix-pro-layout-content\n let currentCardContentPadding = 0; // 默认使用传入的\n\n const cardContentEl = tableEl.querySelector(`.${prefixCls}-pro-card-body`);\n if (cardContentEl) {\n const style = window.getComputedStyle(cardContentEl);\n // 我们主要关心底部的 padding,因为它影响到底部留白\n const paddingBottom = parseFloat(style.paddingBottom);\n if (!isNaN(paddingBottom)) {\n currentCardContentPadding = paddingBottom;\n }\n }\n\n let top = 0;\n if (tableHeader) {\n top = tableHeader.getBoundingClientRect().bottom;\n } else if (tableBody) {\n top = tableBody.getBoundingClientRect().top;\n }\n\n const windowHeight = window.innerHeight;\n\n let height = windowHeight - top - currentContentPadding - currentCardContentPadding - offsetBottom;\n let currentTableHeight = windowHeight - tableEl.getBoundingClientRect().top;\n\n const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);\n\n if (pagination) {\n const paginationHeight = pagination.clientHeight;\n\n const styles = window.getComputedStyle(pagination);\n const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);\n\n height = height - paginationHeight - totalPaginationMargin;\n setTableHeight(0);\n } else {\n // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)\n // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小\n height = height - 40;\n\n setTableHeight(currentTableHeight);\n }\n\n let currentHasScroll = false;\n if (tableBody) {\n currentHasScroll = tableBody.scrollHeight > height;\n }\n setHasScroll(currentHasScroll);\n\n // Minimum height to avoid crashes or ugly rendering\n setScrollY(height);\n\n if (tableHeader) {\n setTableContainerHeight(height + tableHeader?.clientHeight);\n }\n },\n { wait: 16,leading: true },\n );\n\n useEffect(() => {\n // Initial calculation\n calcHeight();\n\n // Observer for DOM changes that might affect position\n const observer = new MutationObserver(calcHeight);\n if (tableRef.current) {\n observer.observe(tableRef.current, { childList: true, subtree: true });\n }\n return () => observer.disconnect();\n }, [tableRef, pageFixedBottom, prefixCls]);\n\n useEventListener('resize', calcHeight);\n\n return {\n scrollY,\n tableHeight,\n tableContainerHeight,\n hasScroll,\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,mBAAoC;AAE7B,IAAM,uBAAuB,CAAC,WAAmB,UAA2C,kBAA2B,MAAM,eAAuB,MAAM;AAC/J,QAAM,CAAC,SAAS,UAAU,QAAI,uBAA6B,MAAS;AACpE,QAAM,CAAC,aAAa,cAAc,QAAI,uBAA6B,MAAS;AAC5E,QAAM,CAAC,sBAAsB,uBAAuB,QAAI,uBAA6B,CAAC;AACtF,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAkB,KAAK;AAEzD,QAAM,EAAE,KAAK,WAAW,QAAI;AAAA,IAC1B,MAAM;AACJ,UAAI,CAAC,mBAAmB,CAAC,SAAS;AAAS;AAE3C,YAAM,UAAU,SAAS;AAGzB,UAAI,QAAQ,iBAAiB;AAAM;AAEnC,YAAM,cAAc,QA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W,MAAM;AAEjB,UAAI,aAAa;AACf,gCAAwB,UAAS,2CAAa,aAAY;AAAA,MAC5D;AAAA,IACF;AAAA,IACA,EAAE,MAAM,IAAG,SAAS,KAAK;AAAA,EAC3B;AAEA,8BAAU,MAAM;AAEd,eAAW;AAGX,UAAM,WAAW,IAAI,iBAAiB,UAAU;AAChD,QAAI,SAAS,SAAS;AACpB,eAAS,QAAQ,SAAS,SAAS,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAAA,IACvE;AACA,WAAO,MAAM,SAAS,WAAW;AAAA,EACnC,GAAG,CAAC,UAAU,iBAAiB,SAAS,CAAC;AAEzC,sCAAiB,UAAU,UAAU;AAErC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { useDebounceFn, useEventListener } from 'ahooks';\nimport { useEffect, useState } from 'react';\n\n/**\n * 获取最近的可滚动父容器\n */\nconst getScrollParent = (element: HTMLElement): HTMLElement | Window => {\n let parent: HTMLElement | null = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n const overflowY = style.overflowY;\n if (overflowY === 'auto' || overflowY === 'scroll') {\n return parent;\n }\n parent = parent.parentElement;\n }\n return window;\n};\n\nexport const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, offsetBottom: number = 0) => {\n const [scrollY, setScrollY] = useState<number | undefined>(undefined);\n const [tableHeight, setTableHeight] = useState<number | undefined>(undefined);\n const [tableContainerHeight, setTableContainerHeight] = useState<number | undefined>(0);\n const [hasScroll, setHasScroll] = useState<boolean>(false);\n\n const { run: calcHeight } = useDebounceFn(\n () => {\n if (!pageFixedBottom || !tableRef.current) return;\n\n const tableEl = tableRef.current;\n\n // 如果元素不可见(例如在 display: none 的 tab 中),不进行计算,防止计算出错误的高度\n if (tableEl.offsetParent === null) return;\n\n const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);\n const tableBody = tableEl.querySelector(`.${prefixCls}-table-tbody`);\n\n // 尝试动态获取 layout content padding\n // Ant Design Pro Layout 的 content 容器通常有 class 包含 'pro-layout-content'\n // 例如:ant-pro-layout-content, my-prefix-pro-layout-content\n let currentContentPadding = 0; // 默认使用传入的\n\n const layoutContentEl = tableEl.closest(`div[class*=\"pro-layout-content\"]`);\n if (layoutContentEl) {\n const style = window.getComputedStyle(layoutContentEl);\n // 我们主要关心底部的 padding,因为它影响到底部留白\n const paddingBottom = parseFloat(style.paddingBottom);\n if (!isNaN(paddingBottom)) {\n currentContentPadding = paddingBottom;\n }\n }\n\n // 尝试动态获取 layout content padding\n // Ant Design Pro Layout 的 content 容器通常有 class 包含 'pro-layout-content'\n // 例如:ant-pro-layout-content, my-prefix-pro-layout-content\n let currentCardContentPadding = 0; // 默认使用传入的\n\n const cardContentEl = tableEl.querySelector(`.${prefixCls}-pro-card-body`);\n if (cardContentEl) {\n const style = window.getComputedStyle(cardContentEl);\n // 我们主要关心底部的 padding,因为它影响到底部留白\n const paddingBottom = parseFloat(style.paddingBottom);\n if (!isNaN(paddingBottom)) {\n currentCardContentPadding = paddingBottom;\n }\n }\n\n let top = 0;\n if (tableHeader) {\n top = tableHeader.getBoundingClientRect().bottom;\n } else if (tableBody) {\n top = tableBody.getBoundingClientRect().top;\n }\n\n const windowHeight = window.innerHeight;\n\n let height = windowHeight - top - currentContentPadding - currentCardContentPadding - offsetBottom;\n\n // 计算表格容器高度:相对于滚动父容器的位置,而非视口位置\n // 这样即使表格上方有其他内容,高度计算也不会受页面滚动影响\n const scrollParent = getScrollParent(tableEl);\n let parentTop = 0;\n if (scrollParent instanceof HTMLElement) {\n parentTop = scrollParent.getBoundingClientRect().top;\n }\n const tableTopRelativeToParent = tableEl.getBoundingClientRect().top - parentTop;\n let currentTableHeight = windowHeight - tableTopRelativeToParent - offsetBottom;\n\n const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);\n\n if (pagination) {\n const paginationHeight = pagination.clientHeight;\n\n const styles = window.getComputedStyle(pagination);\n const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);\n\n height = height - paginationHeight - totalPaginationMargin;\n currentTableHeight = currentTableHeight - paginationHeight - totalPaginationMargin;\n setTableHeight(0);\n } else {\n // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)\n // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小\n height = height - 40;\n currentTableHeight = currentTableHeight - 40;\n\n setTableHeight(currentTableHeight);\n }\n\n let currentHasScroll = false;\n if (tableBody) {\n currentHasScroll = tableBody.scrollHeight > height;\n }\n setHasScroll(currentHasScroll);\n\n // Minimum height to avoid crashes or ugly rendering\n setScrollY(height);\n\n if (tableHeader) {\n setTableContainerHeight(height + tableHeader?.clientHeight);\n }\n },\n { wait: 16,leading: true },\n );\n\n useEffect(() => {\n // Initial calculation\n calcHeight();\n\n // Observer for DOM changes that might affect position\n const observer = new MutationObserver(calcHeight);\n if (tableRef.current) {\n observer.observe(tableRef.current, { childList: true, subtree: true });\n }\n return () => observer.disconnect();\n }, [tableRef, pageFixedBottom, prefixCls]);\n\n useEventListener('resize', calcHeight);\n // 监听滚动事件,确保页面滚动时也能正确计算高度\n useEventListener('scroll', calcHeight, { target: window });\n\n return {\n scrollY,\n tableHeight,\n tableContainerHeight,\n hasScroll,\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,mBAAoC;AAKpC,IAAM,kBAAkB,CAAC,YAA+C;AACtE,MAAI,SAA6B,QAAQ;AACzC,SAAO,QAAQ;AACb,UAAM,QAAQ,OAAO,iBAAiB,MAAM;AAC5C,UAAM,YAAY,MAAM;AACxB,QAAI,cAAc,UAAU,cAAc,UAAU;AAClD,aAAO;AAAA,IACT;AACA,aAAS,OAAO;AAAA,EAClB;AACA,SAAO;AACT;AAEO,IAAM,uBAAuB,CAAC,WAAmB,UAA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 @@
1
1
  {
2
2
  "name": "@creekjs/web-components",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],
@@ -75,16 +75,21 @@ export const CreekKeepAlive: React.FC<CreekKeepAliveProps> = (props) => {
75
75
  // 初始化或路由变化时更新
76
76
  useEffect(() => {
77
77
  const currentPath = location.pathname;
78
- setActiveKey(currentPath);
78
+
79
+ // 不需要缓存的路径,不创建 tab
80
+ if (isPathExcluded(currentPath)) return;
81
+
82
+ // 如果路由配置中没有对应的 element(如纯 redirect 路由),不创建 tab
83
+ const element = resolveElement(currentPath);
84
+ if (!element) return;
79
85
 
80
86
  // 缓存当前路径的 element(仅首次缓存,后续复用同一个 element 引用)
81
- if (!cachedElements[currentPath] && !isPathExcluded(currentPath)) {
82
- const element = resolveElement(currentPath);
83
- if (element) {
84
- setCachedElements((prev) => ({ ...prev, [currentPath]: element }));
85
- }
87
+ if (!cachedElements[currentPath]) {
88
+ setCachedElements((prev) => ({ ...prev, [currentPath]: element }));
86
89
  }
87
90
 
91
+ setActiveKey(currentPath);
92
+
88
93
  // 更新 Tab 列表
89
94
  setTabItems((prev) => {
90
95
  if (prev.find((i) => i.key === currentPath)) {
@@ -1,4 +1,4 @@
1
- import { Avatar, Dropdown, DropDownProps, Space } from "antd";
1
+ import { Avatar, Dropdown, DropDownProps, Space, Typography } from "antd";
2
2
  import { createStyles } from "antd-style";
3
3
 
4
4
  const useStyles = createStyles(({ token}) => ({
@@ -34,9 +34,9 @@ export const UserInfo = (props: UserInfoProps) => {
34
34
  <Dropdown arrow placement="bottom" overlayClassName={styles.userInfoDropdownOverlay} menu={menu}>
35
35
  <Space size={4} align="center">
36
36
  <Avatar className={styles.avatarContainer} src={avatar}>
37
- {name}
37
+ {typeof name === 'string' ? name.charAt(0).toUpperCase() : name}
38
38
  </Avatar>
39
- <span>{name}</span>
39
+ <Typography.Text strong>{name}</Typography.Text>
40
40
  </Space>
41
41
  </Dropdown>
42
42
  );
@@ -1,4 +1,4 @@
1
1
  export { FullScreen } from './FullScreen';
2
- export { UserInfo } from './UserInfo';
2
+ export { UserInfo, type UserInfoProps } from './UserInfo';
3
3
  export { LayoutSettings } from './LayoutSettings';
4
4
 
@@ -11,12 +11,12 @@ import { IntlContext, useT } from '@creekjs/i18n/react';
11
11
  import { CreekKeepAlive, CreekKeepAliveProps } from '../creek-keep-alive';
12
12
  import { CreekLocaleButton } from '../creek-locale-button';
13
13
  import { GlobalScrollbarStyle } from '../creek-style/scrollbar';
14
- import { FullScreen, LayoutSettings } from './ActionRender';
14
+ import { FullScreen, LayoutSettings, UserInfo, UserInfoProps } from './ActionRender';
15
15
  import { CollapsedButton, useCollapsedStore } from './CollapseButton';
16
16
  import { Exception } from './Exception';
17
17
  import { useLayoutSettingsStore } from './useLayoutSettingsStore';
18
18
 
19
- export type LayoutProps = ProLayoutProps & {
19
+ export type CreekLayoutProps = ProLayoutProps & {
20
20
  runtimeConfig: ProLayoutProps;
21
21
  userConfig?: ProLayoutProps;
22
22
  navigate?: (path?: string | number) => void;
@@ -32,6 +32,13 @@ export type LayoutProps = ProLayoutProps & {
32
32
  keepAlive?: boolean | CreekKeepAliveProps;
33
33
  extraActions?: React.ReactNode[];
34
34
  clientRoutes?: any[];
35
+ iconFontCNs?: string[];
36
+ /**
37
+ * 用户信息区域,支持传入配置对象(名称、头像、下拉菜单)或自定义渲染函数
38
+ * - 传对象:自动使用 UserInfo 组件渲染
39
+ * - 传函数:返回 ReactNode 直接渲染,返回 UserInfoProps 对象则使用 UserInfo 组件渲染
40
+ */
41
+ renderUser?: UserInfoProps | (() => React.ReactNode | UserInfoProps);
35
42
  };
36
43
 
37
44
  const MenuName = ({ name, path }: { name?: string; path?: string }) => {
@@ -40,7 +47,7 @@ const MenuName = ({ name, path }: { name?: string; path?: string }) => {
40
47
  return t(key, name);
41
48
  };
42
49
 
43
- export const CreekLayout = (props: LayoutProps) => {
50
+ export const CreekLayout = (props: CreekLayoutProps) => {
44
51
  const {
45
52
  route,
46
53
  userConfig,
@@ -55,6 +62,8 @@ export const CreekLayout = (props: LayoutProps) => {
55
62
  keepAlive = false,
56
63
  extraActions = [],
57
64
  clientRoutes,
65
+ iconFontCNs,
66
+ renderUser,
58
67
  ...more
59
68
  } = props;
60
69
 
@@ -124,6 +133,14 @@ export const CreekLayout = (props: LayoutProps) => {
124
133
 
125
134
  const actions: React.ReactNode[] = [...extraActions];
126
135
 
136
+ if (renderUser) {
137
+ let result = typeof renderUser === 'function' ? renderUser() : renderUser;
138
+ const isUserInfoProps = (val: unknown): val is UserInfoProps =>
139
+ val !== null && typeof val === 'object' && ('name' in val || 'avatar' in val || 'menu' in val);
140
+ const userInfoNode = isUserInfoProps(result) ? <UserInfo {...result} /> : result;
141
+ actions.push(<span key="user-info">{userInfoNode}</span>);
142
+ }
143
+
127
144
  if (actualShowFullScreen) {
128
145
  actions.push(<FullScreen key="full-screen" />);
129
146
  }
@@ -186,3 +203,4 @@ export const CreekLayout = (props: LayoutProps) => {
186
203
  };
187
204
 
188
205
  export * from './Exception';
206
+ export { UserInfo, type UserInfoProps } from './ActionRender';
@@ -1,6 +1,22 @@
1
1
  import { useDebounceFn, useEventListener } from 'ahooks';
2
2
  import { useEffect, useState } from 'react';
3
3
 
4
+ /**
5
+ * 获取最近的可滚动父容器
6
+ */
7
+ const getScrollParent = (element: HTMLElement): HTMLElement | Window => {
8
+ let parent: HTMLElement | null = element.parentElement;
9
+ while (parent) {
10
+ const style = window.getComputedStyle(parent);
11
+ const overflowY = style.overflowY;
12
+ if (overflowY === 'auto' || overflowY === 'scroll') {
13
+ return parent;
14
+ }
15
+ parent = parent.parentElement;
16
+ }
17
+ return window;
18
+ };
19
+
4
20
  export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, offsetBottom: number = 0) => {
5
21
  const [scrollY, setScrollY] = useState<number | undefined>(undefined);
6
22
  const [tableHeight, setTableHeight] = useState<number | undefined>(undefined);
@@ -59,7 +75,16 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
59
75
  const windowHeight = window.innerHeight;
60
76
 
61
77
  let height = windowHeight - top - currentContentPadding - currentCardContentPadding - offsetBottom;
62
- let currentTableHeight = windowHeight - tableEl.getBoundingClientRect().top;
78
+
79
+ // 计算表格容器高度:相对于滚动父容器的位置,而非视口位置
80
+ // 这样即使表格上方有其他内容,高度计算也不会受页面滚动影响
81
+ const scrollParent = getScrollParent(tableEl);
82
+ let parentTop = 0;
83
+ if (scrollParent instanceof HTMLElement) {
84
+ parentTop = scrollParent.getBoundingClientRect().top;
85
+ }
86
+ const tableTopRelativeToParent = tableEl.getBoundingClientRect().top - parentTop;
87
+ let currentTableHeight = windowHeight - tableTopRelativeToParent - offsetBottom;
63
88
 
64
89
  const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);
65
90
 
@@ -70,11 +95,13 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
70
95
  const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
71
96
 
72
97
  height = height - paginationHeight - totalPaginationMargin;
98
+ currentTableHeight = currentTableHeight - paginationHeight - totalPaginationMargin;
73
99
  setTableHeight(0);
74
100
  } else {
75
101
  // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)
76
102
  // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小
77
103
  height = height - 40;
104
+ currentTableHeight = currentTableHeight - 40;
78
105
 
79
106
  setTableHeight(currentTableHeight);
80
107
  }
@@ -108,6 +135,8 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
108
135
  }, [tableRef, pageFixedBottom, prefixCls]);
109
136
 
110
137
  useEventListener('resize', calcHeight);
138
+ // 监听滚动事件,确保页面滚动时也能正确计算高度
139
+ useEventListener('scroll', calcHeight, { target: window });
111
140
 
112
141
  return {
113
142
  scrollY,
@@ -1 +0,0 @@
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;CACxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,kDAA6C,CAAC"}
@@ -1 +0,0 @@
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,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAU3C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;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,4CAqE9D,CAAC"}
@@ -1 +0,0 @@
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;AAOhD,OAAO,EAAsB,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAc,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOzH,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;AAqCvC,eAAO,MAAM,mBAAmB;YAAW,wBAAwB;;CAQlE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DrawerHelper.d.ts","sourceRoot":"","sources":["../../../src/creek-hooks/useApp/DrawerHelper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAwC,MAAM,SAAS,CAAC;AAE7E,UAAU,iBAAiB;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8BpD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModalHelper.d.ts","sourceRoot":"","sources":["../../../src/creek-hooks/useApp/ModalHelper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,WAAW,EAAqB,MAAM,SAAS,CAAC;AAE1E,UAAU,gBAAgB;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8BlD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-hooks/useApp/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAI5E,OAAO,EAGL,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E,CAAC;AAC5G,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useViewportHeight.d.ts","sourceRoot":"","sources":["../../src/creek-hooks/useViewportHeight.tsx"],"names":[],"mappings":";AAGA,UAAU,wBAAwB;IAChC,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC;IAE5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,aAAa,wBAAwB;IAuJ/D,wBAAwB;;IAExB,kBAAkB;;IAElB,kBAAkB;;IAElB,gBAAgB;;CAGnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAA8B,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAIrC,OAAO,EAAuB,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,KAAK,wBAAwB,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,wBAAwB,GAAG;IACtD,WAAW,CAAC,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,wBAAwB,CAAC,WAAW,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,cAAc,mDAkB9C,CAAC"}
@@ -1 +0,0 @@
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,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;CAChB;AAQD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0MxD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FullScreen.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/ActionRender/FullScreen.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,8EAU7B,CAAC;AAEH,eAAO,MAAM,UAAU,+CAwBtB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutSettings.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/ActionRender/LayoutSettings.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,cAAc;;;;;6CA4B1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserInfo.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/ActionRender/UserInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAoB,aAAa,EAAS,MAAM,MAAM,CAAC;AAsB9D,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAc5C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/ActionRender/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CollapseButton.d.ts","sourceRoot":"","sources":["../../src/creek-layout/CollapseButton.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAiBF,eAAO,MAAM,iBAAiB,mFAU5B,CAAC;AAEH,eAAO,MAAM,eAAe,UAAW,oBAAoB,4CAwB1D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotFound.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/Exception/NotFound.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,+CASpB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotFoundPage.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/Exception/NotFoundPage.tsx"],"names":[],"mappings":";AACA,wBAEE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-layout/Exception/index.tsx"],"names":[],"mappings":";AAAA,cAAc,YAAY,CAAC;AAE3B,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,cAAc,4CAG9C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-layout/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA2B,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAUrF,OAAO,EAAkB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAQ1E,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG;IACzC,aAAa,EAAE,cAAc,CAAC;IAC9B,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE;QACZ,YAAY,EAAE,GAAG,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,eAAe,EAAE,MAAM,IAAI,CAAC;KAC7B,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,GAAG,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACjC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;CACtB,CAAC;AAQF,eAAO,MAAM,WAAW,UAAW,WAAW,4CA+I7C,CAAC;AAEF,cAAc,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLayoutSettingsStore.d.ts","sourceRoot":"","sources":["../../src/creek-layout/useLayoutSettingsStore.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAsBlC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-loading/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA+B;IACvD,OAAO,CAAC,MAAM,CAAC,IAAI,CAA8C;IAEjE,OAAO,CAAC,MAAM,CAAC,eAAe;IAS9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC;IAMtD,MAAM,CAAC,KAAK;CAWb"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-locale-button/index.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,+CAkC7B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-page-container/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAEzD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAiBhE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-style/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrollbar.d.ts","sourceRoot":"","sources":["../../src/creek-style/scrollbar.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,oBAAoB,8CA0B/B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchTable.d.ts","sourceRoot":"","sources":["../../src/creek-table/SearchTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,4BAA4B,CAAC;AASlE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAiFF,eAAO,MAAM,cAAc,0EAA2E,gBAAgB,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,4CAgFrI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DensityIcon.d.ts","sourceRoot":"","sources":["../../../src/creek-table/components/DensityIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,UAAU,gBAAgB;IACxB,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAgDlD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EllipsisTooltip.d.ts","sourceRoot":"","sources":["../../../src/creek-table/components/EllipsisTooltip.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAuCvE;;;;GAIG;AACH,eAAO,MAAM,eAAe;cAA8B,MAAM,SAAS;6CAwExE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-table/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAdaptiveToolBar.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useAdaptiveToolBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA+B,MAAM,OAAO,CAAC;AAGtE,eAAO,MAAM,kBAAkB,YAAa;IAC1C,YAAY,EAAE,iBAAiB,WAAW,GAAG,IAAI,CAAC,CAAC;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;;CAoCA,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAutoWidthColumns.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useAutoWidthColumns.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAC;AA4FxE,eAAO,MAAM,mBAAmB,0BACrB,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,YACrC,UAAU,cAAc,CAAC,kBACnB,OAAO,MAAM,EAAE,MAAM,CAAC,aAC3B,OAAO,SACX,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ;aAClC,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS;gBAAc,MAAM,GAAG,SAAS;CAwLnF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useElementDistance.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useElementDistance.tsx"],"names":[],"mappings":";AAGA,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AAO/C,UAAU,QAAQ;IAChB,CAAC,EAAE,MAAM,CAAC;CACX;AAeD,eAAO,MAAM,kBAAkB,wDAAuD,QAAQ,GAAG,IAoChG,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEllipsisColumns.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useEllipsisColumns.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIzE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,sDACpB,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,2CAwChD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useIndexColumn.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useIndexColumn.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAKxD,eAAO,MAAM,cAAc,0CAA0C,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,cAAkB,OAAO,+BAqBvH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useResizableColumns.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useResizableColumns.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,OAAO,KAAgE,MAAM,OAAO,CAAC;AACrF,OAAO,EAAa,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC;IAC9E,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACvE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC5E,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,EAAE,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgLD,eAAO,MAAM,mBAAmB,0BACrB,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,cACpC,OAAO,sBACE,OAAO,MAAM,EAAE,MAAM,CAAC,yBACnB,MAAM,QAAQ,CAAC,MAAM,cAAc,CAAC,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,aACxE,MAAM,SAAS,CAAC,cAAc,CAAC;aAEjC,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS;gBACnC;QAAE,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,aAAa,CAAC,mBAAmB,CAAC,CAAA;SAAE,CAAA;KAAE,GAAG,SAAS;mBACvE,OAAO,MAAM,EAAE,MAAM,CAAC;CA4HtC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStatusColumns.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useStatusColumns.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AA+HxD,eAAO,MAAM,gBAAgB,2BACjB,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,2CA2HrC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTableOptions.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useTableOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAKvE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,4EACjB,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,SAC3C,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,kBAC7B,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,eAAe,CAAC;kBAEjD,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC;eAC5C,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC;kBACnC,MAAM,QAAQ,CAAC,MAAM,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;iBAC7E,OAAO;wBACA,cAAc,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,eAAe,CAAC;CA2DpE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useTableScrollHeight.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useTableScrollHeight.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,cAAe,MAAM,YAAY,MAAM,SAAS,CAAC,cAAc,CAAC,oBAAmB,OAAO,iBAAuB,MAAM;;;;;CAkHvJ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,eAAO,MAAM,UAAU,0EAA2E,gBAAgB,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,4CAMjI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/creek-table/type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,SAAS,GAAG,MAAM,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,GAAG;IAC7H,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE;QACtB,+BAA+B;QAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"en_US.d.ts","sourceRoot":"","sources":["../../src/locales/en_US.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAuBE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zh_CN.d.ts","sourceRoot":"","sources":["../../src/locales/zh_CN.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAuBE"}