@creekjs/web-components 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/.turbo/turbo-father$colon$build.log +35 -19
  2. package/README.md +97 -18
  3. package/dist/creek-config-provider/CreekConfigContext.d.ts +4 -0
  4. package/dist/creek-config-provider/CreekConfigContext.d.ts.map +1 -1
  5. package/dist/creek-config-provider/CreekConfigContext.js.map +2 -2
  6. package/dist/creek-config-provider/CreekI18nProvider.d.ts +22 -0
  7. package/dist/creek-config-provider/CreekI18nProvider.d.ts.map +1 -0
  8. package/dist/creek-config-provider/CreekI18nProvider.js +92 -0
  9. package/dist/creek-config-provider/CreekI18nProvider.js.map +7 -0
  10. package/dist/creek-config-provider/index.d.ts +5 -3
  11. package/dist/creek-config-provider/index.d.ts.map +1 -1
  12. package/dist/creek-config-provider/index.js +47 -4
  13. package/dist/creek-config-provider/index.js.map +3 -3
  14. package/dist/creek-hooks/useApp/index.d.ts +3 -3
  15. package/dist/creek-keep-alive/index.d.ts +24 -1
  16. package/dist/creek-keep-alive/index.d.ts.map +1 -1
  17. package/dist/creek-keep-alive/index.js +141 -4
  18. package/dist/creek-keep-alive/index.js.map +2 -2
  19. package/dist/creek-layout/ActionRender/FullScreen.d.ts.map +1 -1
  20. package/dist/creek-layout/ActionRender/FullScreen.js +3 -1
  21. package/dist/creek-layout/ActionRender/FullScreen.js.map +2 -2
  22. package/dist/creek-layout/ActionRender/LayoutSettings.d.ts +5 -0
  23. package/dist/creek-layout/ActionRender/LayoutSettings.d.ts.map +1 -0
  24. package/dist/creek-layout/ActionRender/LayoutSettings.js +73 -0
  25. package/dist/creek-layout/ActionRender/LayoutSettings.js.map +7 -0
  26. package/dist/creek-layout/ActionRender/UserInfo.js.map +2 -2
  27. package/dist/creek-layout/ActionRender/index.d.ts +1 -0
  28. package/dist/creek-layout/ActionRender/index.d.ts.map +1 -1
  29. package/dist/creek-layout/ActionRender/index.js +3 -0
  30. package/dist/creek-layout/ActionRender/index.js.map +2 -2
  31. package/dist/creek-layout/index.d.ts +5 -5
  32. package/dist/creek-layout/index.d.ts.map +1 -1
  33. package/dist/creek-layout/index.js +79 -16
  34. package/dist/creek-layout/index.js.map +3 -3
  35. package/dist/creek-layout/useLayoutSettingsStore.d.ts +20 -0
  36. package/dist/creek-layout/useLayoutSettingsStore.d.ts.map +1 -0
  37. package/dist/creek-layout/useLayoutSettingsStore.js +45 -0
  38. package/dist/creek-layout/useLayoutSettingsStore.js.map +7 -0
  39. package/dist/creek-locale-button/index.d.ts +1 -0
  40. package/dist/creek-locale-button/index.d.ts.map +1 -0
  41. package/dist/creek-locale-button/index.js +66 -0
  42. package/dist/creek-locale-button/index.js.map +7 -0
  43. package/dist/creek-page-container/index.d.ts +4 -0
  44. package/dist/creek-page-container/index.d.ts.map +1 -0
  45. package/dist/creek-page-container/index.js +68 -0
  46. package/dist/creek-page-container/index.js.map +7 -0
  47. package/dist/creek-style/index.d.ts +1 -0
  48. package/dist/creek-style/index.d.ts.map +1 -0
  49. package/dist/creek-style/index.js +24 -0
  50. package/dist/creek-style/index.js.map +7 -0
  51. package/dist/creek-style/scrollbar.d.ts +2 -0
  52. package/dist/creek-style/scrollbar.d.ts.map +1 -0
  53. package/dist/creek-style/scrollbar.js +55 -0
  54. package/dist/creek-style/scrollbar.js.map +7 -0
  55. package/dist/creek-table/SearchTable.d.ts +9 -0
  56. package/dist/creek-table/SearchTable.d.ts.map +1 -1
  57. package/dist/creek-table/SearchTable.js +109 -72
  58. package/dist/creek-table/SearchTable.js.map +3 -3
  59. package/dist/creek-table/components/DensityIcon.d.ts +9 -0
  60. package/dist/creek-table/components/DensityIcon.d.ts.map +1 -0
  61. package/dist/creek-table/components/DensityIcon.js +77 -0
  62. package/dist/creek-table/components/DensityIcon.js.map +7 -0
  63. package/dist/creek-table/components/EllipsisTooltip.d.ts +9 -0
  64. package/dist/creek-table/components/EllipsisTooltip.d.ts.map +1 -0
  65. package/dist/creek-table/components/EllipsisTooltip.js +122 -0
  66. package/dist/creek-table/components/EllipsisTooltip.js.map +7 -0
  67. package/dist/creek-table/components/index.d.ts +2 -0
  68. package/dist/creek-table/components/index.d.ts.map +1 -0
  69. package/dist/creek-table/components/index.js +26 -0
  70. package/dist/creek-table/components/index.js.map +7 -0
  71. package/dist/creek-table/hooks/index.d.ts +5 -0
  72. package/dist/creek-table/hooks/index.d.ts.map +1 -1
  73. package/dist/creek-table/hooks/index.js +10 -0
  74. package/dist/creek-table/hooks/index.js.map +2 -2
  75. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +1 -1
  76. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts.map +1 -1
  77. package/dist/creek-table/hooks/useAutoWidthColumns.js +76 -17
  78. package/dist/creek-table/hooks/useAutoWidthColumns.js.map +2 -2
  79. package/dist/creek-table/hooks/useEllipsisColumns.d.ts +8 -0
  80. package/dist/creek-table/hooks/useEllipsisColumns.d.ts.map +1 -0
  81. package/dist/creek-table/hooks/useEllipsisColumns.js +58 -0
  82. package/dist/creek-table/hooks/useEllipsisColumns.js.map +7 -0
  83. package/dist/creek-table/hooks/useIndexColumn.d.ts +2 -0
  84. package/dist/creek-table/hooks/useIndexColumn.d.ts.map +1 -0
  85. package/dist/creek-table/hooks/useIndexColumn.js +52 -0
  86. package/dist/creek-table/hooks/useIndexColumn.js.map +7 -0
  87. package/dist/creek-table/hooks/useResizableColumns.d.ts +20 -0
  88. package/dist/creek-table/hooks/useResizableColumns.d.ts.map +1 -0
  89. package/dist/creek-table/hooks/useResizableColumns.js +279 -0
  90. package/dist/creek-table/hooks/useResizableColumns.js.map +7 -0
  91. package/dist/creek-table/hooks/useStatusColumns.d.ts +2 -0
  92. package/dist/creek-table/hooks/useStatusColumns.d.ts.map +1 -0
  93. package/dist/creek-table/hooks/useStatusColumns.js +215 -0
  94. package/dist/creek-table/hooks/useStatusColumns.js.map +7 -0
  95. package/dist/creek-table/hooks/useTableOptions.d.ts +15 -0
  96. package/dist/creek-table/hooks/useTableOptions.d.ts.map +1 -0
  97. package/dist/creek-table/hooks/useTableOptions.js +78 -0
  98. package/dist/creek-table/hooks/useTableOptions.js.map +7 -0
  99. package/dist/creek-table/hooks/useTableScrollHeight.d.ts +6 -1
  100. package/dist/creek-table/hooks/useTableScrollHeight.d.ts.map +1 -1
  101. package/dist/creek-table/hooks/useTableScrollHeight.js +44 -5
  102. package/dist/creek-table/hooks/useTableScrollHeight.js.map +2 -2
  103. package/dist/creek-table/type.d.ts +4 -6
  104. package/dist/creek-table/type.d.ts.map +1 -1
  105. package/dist/creek-table/type.js.map +1 -1
  106. package/dist/index.d.ts +4 -0
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +8 -0
  109. package/dist/index.js.map +2 -2
  110. package/dist/locales/en-US.d.ts +25 -0
  111. package/dist/locales/en-US.d.ts.map +1 -0
  112. package/dist/locales/en-US.js +49 -0
  113. package/dist/locales/en-US.js.map +7 -0
  114. package/dist/locales/zh-CN.d.ts +25 -0
  115. package/dist/locales/zh-CN.d.ts.map +1 -0
  116. package/dist/locales/zh-CN.js +49 -0
  117. package/dist/locales/zh-CN.js.map +7 -0
  118. package/dist/utils/i18n.d.ts +2 -0
  119. package/dist/utils/i18n.d.ts.map +1 -0
  120. package/dist/utils/i18n.js +34 -0
  121. package/dist/utils/i18n.js.map +7 -0
  122. package/i18n.config.ts +27 -0
  123. package/package.json +17 -3
  124. package/src/creek-config-provider/CreekConfigContext.tsx +5 -1
  125. package/src/creek-config-provider/CreekI18nProvider.tsx +87 -0
  126. package/src/creek-config-provider/index.tsx +53 -4
  127. package/src/creek-keep-alive/index.tsx +225 -6
  128. package/src/creek-layout/ActionRender/FullScreen.tsx +10 -6
  129. package/src/creek-layout/ActionRender/LayoutSettings.tsx +67 -0
  130. package/src/creek-layout/ActionRender/UserInfo.tsx +1 -1
  131. package/src/creek-layout/ActionRender/index.tsx +1 -0
  132. package/src/creek-layout/index.tsx +89 -22
  133. package/src/creek-layout/useLayoutSettingsStore.ts +25 -0
  134. package/src/creek-locale-button/index.tsx +42 -0
  135. package/src/creek-page-container/index.tsx +32 -0
  136. package/src/creek-style/index.ts +1 -0
  137. package/src/creek-style/scrollbar.ts +29 -0
  138. package/src/creek-table/SearchTable.tsx +125 -72
  139. package/src/creek-table/components/DensityIcon.tsx +63 -0
  140. package/src/creek-table/components/EllipsisTooltip.tsx +116 -0
  141. package/src/creek-table/components/index.tsx +3 -0
  142. package/src/creek-table/hooks/index.ts +5 -1
  143. package/src/creek-table/hooks/useAutoWidthColumns.tsx +93 -19
  144. package/src/creek-table/hooks/useEllipsisColumns.tsx +47 -0
  145. package/src/creek-table/hooks/useIndexColumn.tsx +27 -0
  146. package/src/creek-table/hooks/useResizableColumns.tsx +323 -0
  147. package/src/creek-table/hooks/useStatusColumns.tsx +252 -0
  148. package/src/creek-table/hooks/useTableOptions.tsx +81 -0
  149. package/src/creek-table/hooks/useTableScrollHeight.tsx +61 -6
  150. package/src/creek-table/type.ts +5 -7
  151. package/src/index.tsx +4 -0
  152. package/src/locales/en-US.ts +24 -0
  153. package/src/locales/zh-CN.ts +24 -0
  154. package/src/utils/i18n.ts +4 -0
  155. package/dist/creek-table/TableOptionRender.d.ts +0 -9
  156. package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
  157. package/dist/creek-table/TableOptionRender.js +0 -74
  158. package/dist/creek-table/TableOptionRender.js.map +0 -7
  159. package/dist/creek-table/toolBarRender.d.ts +0 -5
  160. package/dist/creek-table/toolBarRender.d.ts.map +0 -1
  161. package/dist/creek-table/toolBarRender.js +0 -58
  162. package/dist/creek-table/toolBarRender.js.map +0 -7
  163. package/src/creek-table/TableOptionRender.tsx +0 -57
  164. package/src/creek-table/toolBarRender.tsx +0 -28
@@ -1,8 +1,11 @@
1
1
  import { useDebounceFn, useEventListener } from 'ahooks';
2
2
  import { useEffect, useState } from 'react';
3
3
 
4
- export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, contentPadding: number = 16, offsetBottom: number = 16) => {
4
+ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, offsetBottom: number = 0) => {
5
5
  const [scrollY, setScrollY] = useState<number | undefined>(undefined);
6
+ const [tableHeight, setTableHeight] = useState<number | undefined>(undefined);
7
+ const [tableContainerHeight, setTableContainerHeight] = useState<number | undefined>(0);
8
+ const [hasScroll, setHasScroll] = useState<boolean>(false);
6
9
 
7
10
  const { run: calcHeight } = useDebounceFn(
8
11
  () => {
@@ -10,8 +13,41 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
10
13
 
11
14
  const tableEl = tableRef.current;
12
15
 
16
+ // 如果元素不可见(例如在 display: none 的 tab 中),不进行计算,防止计算出错误的高度
17
+ if (tableEl.offsetParent === null) return;
18
+
13
19
  const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);
14
- const tableBody = tableEl.querySelector(`.${prefixCls}-table-body`);
20
+ const tableBody = tableEl.querySelector(`.${prefixCls}-table-tbody`);
21
+
22
+ // 尝试动态获取 layout content padding
23
+ // Ant Design Pro Layout 的 content 容器通常有 class 包含 'pro-layout-content'
24
+ // 例如:ant-pro-layout-content, my-prefix-pro-layout-content
25
+ let currentContentPadding = 0; // 默认使用传入的
26
+
27
+ const layoutContentEl = tableEl.closest(`div[class*="pro-layout-content"]`);
28
+ if (layoutContentEl) {
29
+ const style = window.getComputedStyle(layoutContentEl);
30
+ // 我们主要关心底部的 padding,因为它影响到底部留白
31
+ const paddingBottom = parseFloat(style.paddingBottom);
32
+ if (!isNaN(paddingBottom)) {
33
+ currentContentPadding = paddingBottom;
34
+ }
35
+ }
36
+
37
+ // 尝试动态获取 layout content padding
38
+ // Ant Design Pro Layout 的 content 容器通常有 class 包含 'pro-layout-content'
39
+ // 例如:ant-pro-layout-content, my-prefix-pro-layout-content
40
+ let currentCardContentPadding = 0; // 默认使用传入的
41
+
42
+ const cardContentEl = tableEl.querySelector(`.${prefixCls}-pro-card-body`);
43
+ if (cardContentEl) {
44
+ const style = window.getComputedStyle(cardContentEl);
45
+ // 我们主要关心底部的 padding,因为它影响到底部留白
46
+ const paddingBottom = parseFloat(style.paddingBottom);
47
+ if (!isNaN(paddingBottom)) {
48
+ currentCardContentPadding = paddingBottom;
49
+ }
50
+ }
15
51
 
16
52
  let top = 0;
17
53
  if (tableHeader) {
@@ -21,8 +57,9 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
21
57
  }
22
58
 
23
59
  const windowHeight = window.innerHeight;
24
-
25
- let height = windowHeight - top - contentPadding - offsetBottom;
60
+
61
+ let height = windowHeight - top - currentContentPadding - currentCardContentPadding - offsetBottom;
62
+ let currentTableHeight = windowHeight - tableEl.getBoundingClientRect().top;
26
63
 
27
64
  const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);
28
65
 
@@ -33,16 +70,29 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
33
70
  const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
34
71
 
35
72
  height = height - paginationHeight - totalPaginationMargin;
73
+ setTableHeight(0);
36
74
  } else {
37
75
  // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)
38
76
  // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小
39
77
  height = height - 40;
78
+
79
+ setTableHeight(currentTableHeight);
80
+ }
81
+
82
+ let currentHasScroll = false;
83
+ if (tableBody) {
84
+ currentHasScroll = tableBody.scrollHeight > height;
40
85
  }
86
+ setHasScroll(currentHasScroll);
41
87
 
42
88
  // Minimum height to avoid crashes or ugly rendering
43
89
  setScrollY(height);
90
+
91
+ if (tableHeader) {
92
+ setTableContainerHeight(height + tableHeader?.clientHeight);
93
+ }
44
94
  },
45
- { wait: 100 },
95
+ { wait: 16,leading: true },
46
96
  );
47
97
 
48
98
  useEffect(() => {
@@ -59,5 +109,10 @@ export const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObjec
59
109
 
60
110
  useEventListener('resize', calcHeight);
61
111
 
62
- return scrollY;
112
+ return {
113
+ scrollY,
114
+ tableHeight,
115
+ tableContainerHeight,
116
+ hasScroll,
117
+ };
63
118
  };
@@ -6,16 +6,14 @@ export type OptionRenderCustom = {
6
6
  onClick?: () => void;
7
7
  };
8
8
 
9
- export type CreekTableProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = Omit<ProTableProps<T, U, ValueType>, 'options'> & {
9
+ export type CreekTableProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = ProTableProps<T, U, ValueType> & {
10
10
  pageFixedBottom?: boolean; // 是否固定分页在底部
11
11
  pageFixedBottomConfig?: {
12
12
  /** 底部保留空间(如固定在底部的元素高度),默认 0 */
13
13
  bottomFix?: number;
14
14
  };
15
- options?: ProTableProps<T, U, ValueType>['options'] & {
16
- importConfig?: OptionRenderCustom;
17
- exportConfig?: OptionRenderCustom;
18
- };
19
- // 是否自动为列添加筛选功能,默认 true
20
- autoAddFilterForColumn?: boolean;
15
+ // 是否显示序号列,默认 true
16
+ showIndex?: boolean;
17
+ /** 是否可拖动列宽,默认 true */
18
+ resizable?: boolean;
21
19
  };
package/src/index.tsx CHANGED
@@ -2,7 +2,11 @@
2
2
  export * from './creek-config-provider';
3
3
  export * from './creek-hooks';
4
4
  export * from './creek-icon';
5
+ export * from './creek-keep-alive';
5
6
  export * from './creek-layout';
6
7
  export * from './creek-loading';
8
+ export * from './creek-locale-button';
9
+ export * from './creek-page-container';
10
+ export * from './creek-style';
7
11
  export * from './creek-table';
8
12
 
@@ -0,0 +1,24 @@
1
+ export default {
2
+ 'creek-keep-alive.index.guanBiDangQian': 'Close Current',
3
+ 'creek-keep-alive.index.guanBiQiTa': 'Close Others',
4
+ 'creek-keep-alive.index.guanBiYouCe': 'Close Right',
5
+ 'creek-layout.ActionRender.FullScreen.tuiChuQuanPing': 'Exit Full Screen',
6
+ 'creek-layout.ActionRender.FullScreen.quanPing': 'Full Screen',
7
+ 'creek-table.components.DensityIcon.kuanSong': 'Loose',
8
+ 'creek-table.components.DensityIcon.zhongDeng': 'Medium',
9
+ 'creek-table.components.DensityIcon.jinCou': 'Compact',
10
+ 'creek-table.components.DensityIcon.biaoGeMiDu(KuanSong)': 'Table Density (Loose)',
11
+ 'creek-table.components.DensityIcon.biaoGeMiDu(ZhongDeng)': 'Table Density (Medium)',
12
+ 'creek-table.components.DensityIcon.biaoGeMiDu(JinCou)': 'Table Density (Compact)',
13
+ 'creek-table.components.DensityIcon.biaoGeMiDu': 'Table Density',
14
+ 'creek-table.components.EllipsisTooltip.fuZhiChengGong': 'Copied Successfully',
15
+ 'creek-table.components.EllipsisTooltip.fuZhiShiBai': 'Copy Failed',
16
+ 'creek-table.components.EllipsisTooltip.fuZhi': 'Copy',
17
+ 'creek-table.hooks.useIndexColumn.xuHao': 'No.',
18
+ 'creek-layout.ActionRender.LayoutSettings.title': 'System Settings',
19
+ 'creek-layout.ActionRender.LayoutSettings.themeColor': 'Theme Color',
20
+ 'creek-layout.ActionRender.LayoutSettings.showFullScreen': 'Show Full Screen Button',
21
+ 'creek-layout.ActionRender.LayoutSettings.showLocaleButton': 'Show Locale Button',
22
+ 'creek-locale-button.index.jianTiZhongWen': 'Simplified Chinese',
23
+ 'creek-layout.ActionRender.LayoutSettings.keepAlive': 'Enable Page Cache (Keep Alive)',
24
+ };
@@ -0,0 +1,24 @@
1
+ export default {
2
+ "creek-keep-alive.index.guanBiDangQian": "关闭当前",
3
+ "creek-keep-alive.index.guanBiQiTa": "关闭其他",
4
+ "creek-keep-alive.index.guanBiYouCe": "关闭右侧",
5
+ "creek-layout.ActionRender.FullScreen.tuiChuQuanPing": "退出全屏",
6
+ "creek-layout.ActionRender.FullScreen.quanPing": "全屏",
7
+ "creek-table.components.DensityIcon.kuanSong": "宽松",
8
+ "creek-table.components.DensityIcon.zhongDeng": "中等",
9
+ "creek-table.components.DensityIcon.jinCou": "紧凑",
10
+ "creek-table.components.DensityIcon.biaoGeMiDu(KuanSong)": "表格密度 (宽松)",
11
+ "creek-table.components.DensityIcon.biaoGeMiDu(ZhongDeng)": "表格密度 (中等)",
12
+ "creek-table.components.DensityIcon.biaoGeMiDu(JinCou)": "表格密度 (紧凑)",
13
+ "creek-table.components.DensityIcon.biaoGeMiDu": "表格密度",
14
+ "creek-table.components.EllipsisTooltip.fuZhiChengGong": "复制成功",
15
+ "creek-table.components.EllipsisTooltip.fuZhiShiBai": "复制失败",
16
+ "creek-table.components.EllipsisTooltip.fuZhi": "复制",
17
+ "creek-table.hooks.useIndexColumn.xuHao": "序号",
18
+ "creek-layout.ActionRender.LayoutSettings.title": "系统设置",
19
+ "creek-layout.ActionRender.LayoutSettings.themeColor": "主题色",
20
+ "creek-layout.ActionRender.LayoutSettings.showFullScreen": "展示全屏按钮",
21
+ "creek-layout.ActionRender.LayoutSettings.showLocaleButton": "展示国际化按钮",
22
+ "creek-locale-button.index.jianTiZhongWen": "简体中文",
23
+ "creek-layout.ActionRender.LayoutSettings.keepAlive": "开启页面缓存 (Keep Alive)"
24
+ };
@@ -0,0 +1,4 @@
1
+ import { setLocaleMessages, t, useT } from '@creekjs/i18n/react';
2
+
3
+ export { setLocaleMessages, t, useT };
4
+
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { ParamsType } from '@ant-design/pro-components';
3
- import { OptionRenderCustom } from './type';
4
- export type TableOptionRenderProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = {
5
- defaultDom?: React.ReactNode[];
6
- importConfig?: OptionRenderCustom;
7
- exportConfig?: OptionRenderCustom;
8
- };
9
- export declare const TableOptionRender: <T extends ParamsType, U extends ParamsType, ValueType = "text">(props: TableOptionRenderProps<T, U, ValueType>) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableOptionRender.d.ts","sourceRoot":"","sources":["../../src/creek-table/TableOptionRender.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAa5C,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,SAAS,GAAG,MAAM,IAAI;IACnG,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,0EAA2E,uBAAuB,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,4CAgC/I,CAAC"}
@@ -1,74 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/creek-table/TableOptionRender.tsx
20
- var TableOptionRender_exports = {};
21
- __export(TableOptionRender_exports, {
22
- TableOptionRender: () => TableOptionRender
23
- });
24
- module.exports = __toCommonJS(TableOptionRender_exports);
25
- var import_icons = require("@ant-design/icons");
26
- var import_antd = require("antd");
27
- var import_antd_style = require("antd-style");
28
- var import_jsx_runtime = require("react/jsx-runtime");
29
- var useStyles = (0, import_antd_style.createStyles)(({ prefixCls, token }) => {
30
- return {
31
- "table-option-render-item": {
32
- border: `1px solid ${token.colorBorder}`,
33
- borderRadius: token.borderRadius,
34
- padding: "8px",
35
- cursor: "pointer"
36
- }
37
- };
38
- });
39
- var TableOptionRender = (props) => {
40
- const { defaultDom, importConfig, exportConfig } = props;
41
- const { styles } = useStyles();
42
- const [reload, dis, setting] = defaultDom || [];
43
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Space, { size: 8, children: [
44
- importConfig && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
- "span",
46
- {
47
- className: styles["table-option-render-item"],
48
- onClick: () => {
49
- var _a;
50
- (_a = importConfig.onClick) == null ? void 0 : _a.call(importConfig);
51
- },
52
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Tooltip, { title: importConfig.text || "导入", children: importConfig.icon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ImportOutlined, {}) })
53
- }
54
- ),
55
- exportConfig && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
- "span",
57
- {
58
- className: styles["table-option-render-item"],
59
- onClick: () => {
60
- var _a;
61
- (_a = exportConfig.onClick) == null ? void 0 : _a.call(exportConfig);
62
- },
63
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Tooltip, { title: exportConfig.text || "导出", children: exportConfig.icon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ExportOutlined, {}) })
64
- }
65
- ),
66
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles["table-option-render-item"], children: reload }),
67
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles["table-option-render-item"], children: setting })
68
- ] });
69
- };
70
- // Annotate the CommonJS export names for ESM import in node:
71
- 0 && (module.exports = {
72
- TableOptionRender
73
- });
74
- //# sourceMappingURL=TableOptionRender.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/creek-table/TableOptionRender.tsx"],
4
- "sourcesContent": ["import { ExportOutlined, ImportOutlined } from '@ant-design/icons';\nimport { ParamsType } from '@ant-design/pro-components';\nimport { Space, Tooltip } from 'antd';\nimport { createStyles } from 'antd-style';\n\nimport { OptionRenderCustom } from './type';\n\nconst useStyles = createStyles(({ prefixCls, token }) => {\n return {\n 'table-option-render-item': {\n border: `1px solid ${token.colorBorder}`,\n borderRadius: token.borderRadius,\n padding: '8px',\n cursor: 'pointer',\n },\n };\n});\n\nexport type TableOptionRenderProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = {\n defaultDom?: React.ReactNode[];\n importConfig?: OptionRenderCustom;\n exportConfig?: OptionRenderCustom;\n};\n\nexport const TableOptionRender = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: TableOptionRenderProps<T, U, ValueType>) => {\n const { defaultDom, importConfig, exportConfig } = props;\n\n const { styles } = useStyles();\n\n const [reload, dis, setting] = defaultDom || [];\n return (\n <Space size={8}>\n {importConfig && (\n <span\n className={styles['table-option-render-item']}\n onClick={() => {\n importConfig.onClick?.();\n }}\n >\n <Tooltip title={importConfig.text || '导入'}>{importConfig.icon || <ImportOutlined />}</Tooltip>\n </span>\n )}\n {exportConfig && (\n <span\n className={styles['table-option-render-item']}\n onClick={() => {\n exportConfig.onClick?.();\n }}\n >\n <Tooltip title={exportConfig.text || '导出'}>{exportConfig.icon || <ExportOutlined />}</Tooltip>\n </span>\n )}\n <span className={styles['table-option-render-item']}>{reload}</span>\n <span className={styles['table-option-render-item']}>{setting}</span>\n </Space>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+C;AAE/C,kBAA+B;AAC/B,wBAA6B;AA4BzB;AAxBJ,IAAM,gBAAY,gCAAa,CAAC,EAAE,WAAW,MAAM,MAAM;AACvD,SAAO;AAAA,IACL,4BAA4B;AAAA,MAC1B,QAAQ,aAAa,MAAM;AAAA,MAC3B,cAAc,MAAM;AAAA,MACpB,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;AAQM,IAAM,oBAAoB,CAAiE,UAAmD;AACnJ,QAAM,EAAE,YAAY,cAAc,aAAa,IAAI;AAEnD,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,cAAc,CAAC;AAC9C,SACE,6CAAC,qBAAM,MAAM,GACV;AAAA,oBACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,OAAO,0BAA0B;AAAA,QAC5C,SAAS,MAAM;AAnCzB;AAoCY,6BAAa,YAAb;AAAA,QACF;AAAA,QAEA,sDAAC,uBAAQ,OAAO,aAAa,QAAQ,MAAO,uBAAa,QAAQ,4CAAC,+BAAe,GAAG;AAAA;AAAA,IACtF;AAAA,IAED,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,OAAO,0BAA0B;AAAA,QAC5C,SAAS,MAAM;AA7CzB;AA8CY,6BAAa,YAAb;AAAA,QACF;AAAA,QAEA,sDAAC,uBAAQ,OAAO,aAAa,QAAQ,MAAO,uBAAa,QAAQ,4CAAC,+BAAe,GAAG;AAAA;AAAA,IACtF;AAAA,IAEF,4CAAC,UAAK,WAAW,OAAO,0BAA0B,GAAI,kBAAO;AAAA,IAC7D,4CAAC,UAAK,WAAW,OAAO,0BAA0B,GAAI,mBAAQ;AAAA,KAChE;AAEJ;",
6
- "names": []
7
- }
@@ -1,5 +0,0 @@
1
- export declare const toolBarRender: (options: {
2
- shouldCollapse: boolean;
3
- restProps: any;
4
- args?: any[];
5
- }) => any;
@@ -1 +0,0 @@
1
- {"version":3,"file":"toolBarRender.d.ts","sourceRoot":"","sources":["../../src/creek-table/toolBarRender.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,YAAa;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,QAwB/F,CAAC"}
@@ -1,58 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/creek-table/toolBarRender.tsx
20
- var toolBarRender_exports = {};
21
- __export(toolBarRender_exports, {
22
- toolBarRender: () => toolBarRender
23
- });
24
- module.exports = __toCommonJS(toolBarRender_exports);
25
- var import_icons = require("@ant-design/icons");
26
- var import_antd = require("antd");
27
- var import_jsx_runtime = require("react/jsx-runtime");
28
- var toolBarRender = (options) => {
29
- var _a;
30
- const { shouldCollapse, restProps, args = [] } = options;
31
- const baseActions = ((_a = restProps.toolBarRender) == null ? void 0 : _a.call(restProps, ...args)) || [];
32
- if (!shouldCollapse || baseActions.length <= 1) {
33
- return baseActions;
34
- }
35
- const [first, ...rest] = baseActions;
36
- return [
37
- first,
38
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
- import_antd.Dropdown,
40
- {
41
- menu: {
42
- items: rest.map((item, index) => ({ key: index, label: item }))
43
- },
44
- trigger: ["click"],
45
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Button, { children: [
46
- "更多 ",
47
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DownOutlined, {})
48
- ] })
49
- },
50
- "more"
51
- )
52
- ];
53
- };
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- toolBarRender
57
- });
58
- //# sourceMappingURL=toolBarRender.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/creek-table/toolBarRender.tsx"],
4
- "sourcesContent": ["import { DownOutlined } from '@ant-design/icons';\nimport { Button, Dropdown } from 'antd';\n\nexport const toolBarRender = (options: { shouldCollapse: boolean; restProps: any; args?: any[] }) => {\n const { shouldCollapse, restProps, args = [] } = options;\n\n const baseActions = restProps.toolBarRender?.(...args) || [];\n if (!shouldCollapse || baseActions.length <= 1) {\n return baseActions;\n }\n\n const [first, ...rest] = baseActions;\n\n return [\n first,\n <Dropdown\n key=\"more\"\n menu={{\n items: rest.map((item: React.ReactDOM, index: number) => ({ key: index, label: item })),\n }}\n trigger={['click']}\n >\n <Button>\n 更多 <DownOutlined />\n </Button>\n </Dropdown>,\n ];\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAC7B,kBAAiC;AAqB3B;AAnBC,IAAM,gBAAgB,CAAC,YAAuE;AAHrG;AAIE,QAAM,EAAE,gBAAgB,WAAW,OAAO,CAAC,EAAE,IAAI;AAEjD,QAAM,gBAAc,eAAU,kBAAV,mCAA0B,GAAG,UAAS,CAAC;AAC3D,MAAI,CAAC,kBAAkB,YAAY,UAAU,GAAG;AAC9C,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AAEzB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QAEC,MAAM;AAAA,UACJ,OAAO,KAAK,IAAI,CAAC,MAAsB,WAAmB,EAAE,KAAK,OAAO,OAAO,KAAK,EAAE;AAAA,QACxF;AAAA,QACA,SAAS,CAAC,OAAO;AAAA,QAEjB,uDAAC,sBAAO;AAAA;AAAA,UACH,4CAAC,6BAAa;AAAA,WACnB;AAAA;AAAA,MARI;AAAA,IASN;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,57 +0,0 @@
1
- import { ExportOutlined, ImportOutlined } from '@ant-design/icons';
2
- import { ParamsType } from '@ant-design/pro-components';
3
- import { Space, Tooltip } from 'antd';
4
- import { createStyles } from 'antd-style';
5
-
6
- import { OptionRenderCustom } from './type';
7
-
8
- const useStyles = createStyles(({ prefixCls, token }) => {
9
- return {
10
- 'table-option-render-item': {
11
- border: `1px solid ${token.colorBorder}`,
12
- borderRadius: token.borderRadius,
13
- padding: '8px',
14
- cursor: 'pointer',
15
- },
16
- };
17
- });
18
-
19
- export type TableOptionRenderProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = {
20
- defaultDom?: React.ReactNode[];
21
- importConfig?: OptionRenderCustom;
22
- exportConfig?: OptionRenderCustom;
23
- };
24
-
25
- export const TableOptionRender = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: TableOptionRenderProps<T, U, ValueType>) => {
26
- const { defaultDom, importConfig, exportConfig } = props;
27
-
28
- const { styles } = useStyles();
29
-
30
- const [reload, dis, setting] = defaultDom || [];
31
- return (
32
- <Space size={8}>
33
- {importConfig && (
34
- <span
35
- className={styles['table-option-render-item']}
36
- onClick={() => {
37
- importConfig.onClick?.();
38
- }}
39
- >
40
- <Tooltip title={importConfig.text || '导入'}>{importConfig.icon || <ImportOutlined />}</Tooltip>
41
- </span>
42
- )}
43
- {exportConfig && (
44
- <span
45
- className={styles['table-option-render-item']}
46
- onClick={() => {
47
- exportConfig.onClick?.();
48
- }}
49
- >
50
- <Tooltip title={exportConfig.text || '导出'}>{exportConfig.icon || <ExportOutlined />}</Tooltip>
51
- </span>
52
- )}
53
- <span className={styles['table-option-render-item']}>{reload}</span>
54
- <span className={styles['table-option-render-item']}>{setting}</span>
55
- </Space>
56
- );
57
- };
@@ -1,28 +0,0 @@
1
- import { DownOutlined } from '@ant-design/icons';
2
- import { Button, Dropdown } from 'antd';
3
-
4
- export const toolBarRender = (options: { shouldCollapse: boolean; restProps: any; args?: any[] }) => {
5
- const { shouldCollapse, restProps, args = [] } = options;
6
-
7
- const baseActions = restProps.toolBarRender?.(...args) || [];
8
- if (!shouldCollapse || baseActions.length <= 1) {
9
- return baseActions;
10
- }
11
-
12
- const [first, ...rest] = baseActions;
13
-
14
- return [
15
- first,
16
- <Dropdown
17
- key="more"
18
- menu={{
19
- items: rest.map((item: React.ReactDOM, index: number) => ({ key: index, label: item })),
20
- }}
21
- trigger={['click']}
22
- >
23
- <Button>
24
- 更多 <DownOutlined />
25
- </Button>
26
- </Dropdown>,
27
- ];
28
- };