@gx-design-vue/pro-table 0.2.0-alpha.7 → 0.2.0-alpha.9

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 (133) hide show
  1. package/dist/ProTable.d.ts +14 -492
  2. package/dist/ProTable.js +818 -518
  3. package/dist/components/ScrollBar/Bar.d.ts +81 -0
  4. package/dist/components/ScrollBar/Bar.js +84 -0
  5. package/dist/components/ScrollBar/Thumb.d.ts +52 -0
  6. package/dist/components/ScrollBar/{Thumb/index.js → Thumb.js} +67 -55
  7. package/dist/components/ScrollBar/context.d.ts +3 -4
  8. package/dist/components/ScrollBar/context.js +3 -3
  9. package/dist/components/ScrollBar/util.d.ts +6 -5
  10. package/dist/components/ScrollBar/util.js +1 -12
  11. package/dist/components/SearchForm/CollapseToggle.d.ts +55 -0
  12. package/dist/components/SearchForm/CollapseToggle.js +47 -0
  13. package/dist/components/SearchForm/FormItemContainer.d.ts +75 -0
  14. package/dist/components/SearchForm/FormItemContainer.js +225 -0
  15. package/dist/components/SearchForm/FormItemWrapper.d.ts +82 -0
  16. package/dist/components/SearchForm/FormItemWrapper.js +62 -0
  17. package/dist/components/SearchForm/SearchForm.d.ts +130 -0
  18. package/dist/components/SearchForm/SearchForm.js +319 -0
  19. package/dist/components/SearchForm/index.d.ts +2 -0
  20. package/dist/components/SearchForm/index.js +2 -0
  21. package/dist/components/Toolbar/FullscreenIcon.d.ts +26 -0
  22. package/dist/components/Toolbar/FullscreenIcon.js +22 -0
  23. package/dist/components/Toolbar/ListToolBar.d.ts +111 -0
  24. package/dist/components/Toolbar/ListToolBar.js +101 -0
  25. package/dist/components/Toolbar/index.d.ts +103 -0
  26. package/dist/components/Toolbar/index.js +101 -0
  27. package/dist/components/Toolbar/style.d.ts +8 -0
  28. package/dist/components/{ListToolBar → Toolbar}/style.js +32 -27
  29. package/dist/context/TableContext.d.ts +15 -27
  30. package/dist/context/TableContext.js +3 -3
  31. package/dist/hooks/index.d.ts +16 -0
  32. package/dist/hooks/index.js +16 -0
  33. package/dist/hooks/useBreakpoints.d.ts +13 -0
  34. package/dist/hooks/useBreakpoints.js +57 -0
  35. package/dist/hooks/useCellRender.d.ts +13 -0
  36. package/dist/hooks/useCellRender.js +28 -0
  37. package/dist/hooks/useColumnResize.d.ts +30 -0
  38. package/dist/hooks/useColumnResize.js +110 -0
  39. package/dist/hooks/useColumns.d.ts +35 -24
  40. package/dist/hooks/useColumns.js +89 -56
  41. package/dist/hooks/useFetchData.d.ts +40 -65
  42. package/dist/hooks/useFetchData.js +157 -172
  43. package/dist/hooks/useFitPage.d.ts +19 -0
  44. package/dist/hooks/useFitPage.js +90 -0
  45. package/dist/hooks/useKeepAliveReload.d.ts +21 -0
  46. package/dist/hooks/useKeepAliveReload.js +24 -0
  47. package/dist/hooks/useLoading.d.ts +18 -7
  48. package/dist/hooks/useLoading.js +26 -8
  49. package/dist/hooks/usePagination.d.ts +10 -7
  50. package/dist/hooks/usePagination.js +37 -26
  51. package/dist/hooks/useRequestOptions.d.ts +18 -0
  52. package/dist/hooks/useRequestOptions.js +39 -0
  53. package/dist/hooks/useRowSelection.d.ts +27 -15
  54. package/dist/hooks/useRowSelection.js +92 -77
  55. package/dist/hooks/useTable.d.ts +19 -77
  56. package/dist/hooks/useTable.js +66 -54
  57. package/dist/hooks/useTableForm.d.ts +15 -83
  58. package/dist/hooks/useTableForm.js +93 -56
  59. package/dist/hooks/useTableScroll.d.ts +33 -31
  60. package/dist/hooks/useTableScroll.js +71 -26
  61. package/dist/hooks/useTableSize.d.ts +17 -7
  62. package/dist/hooks/useTableSize.js +20 -6
  63. package/dist/index.d.ts +10 -7
  64. package/dist/index.js +9 -3
  65. package/dist/interface.d.ts +492 -0
  66. package/dist/pro-table.esm.js +3483 -3913
  67. package/dist/pro-table.js +1 -1
  68. package/dist/style/fit-page.d.ts +4 -2
  69. package/dist/style/fit-page.js +9 -3
  70. package/dist/style/index.d.ts +4 -6
  71. package/dist/style/index.js +24 -74
  72. package/dist/style/list.d.ts +4 -2
  73. package/dist/style/list.js +1 -10
  74. package/dist/style/resizable.d.ts +8 -0
  75. package/dist/style/resizable.js +18 -0
  76. package/dist/style/scroll.d.ts +4 -2
  77. package/dist/style/scroll.js +8 -6
  78. package/dist/style/search.d.ts +8 -0
  79. package/dist/{components/Form/style.js → style/search.js} +22 -8
  80. package/dist/theme/augment.d.ts +8 -0
  81. package/dist/theme/interface/components.d.ts +8 -0
  82. package/dist/utils/dateFormat.d.ts +9 -0
  83. package/dist/utils/dateFormat.js +29 -0
  84. package/dist/utils/formConstants.d.ts +9 -0
  85. package/dist/utils/formConstants.js +29 -0
  86. package/dist/utils/valueFormat.d.ts +9 -0
  87. package/dist/utils/valueFormat.js +27 -0
  88. package/package.json +10 -9
  89. package/dist/components/Form/components/RequestSelect.d.ts +0 -50
  90. package/dist/components/Form/components/RequestSelect.js +0 -56
  91. package/dist/components/Form/hooks/useForm.d.ts +0 -11
  92. package/dist/components/Form/hooks/useForm.js +0 -30
  93. package/dist/components/Form/index.d.ts +0 -32
  94. package/dist/components/Form/index.js +0 -476
  95. package/dist/components/Form/style.d.ts +0 -6
  96. package/dist/components/Form/utils/config.d.ts +0 -9
  97. package/dist/components/Form/utils/config.js +0 -29
  98. package/dist/components/Form/utils/dateFormat.d.ts +0 -22
  99. package/dist/components/Form/utils/dateFormat.js +0 -43
  100. package/dist/components/ListToolBar/index.d.ts +0 -59
  101. package/dist/components/ListToolBar/index.js +0 -123
  102. package/dist/components/ListToolBar/style.d.ts +0 -6
  103. package/dist/components/ScrollBar/Bar/index.d.ts +0 -49
  104. package/dist/components/ScrollBar/Bar/index.js +0 -68
  105. package/dist/components/ScrollBar/Bar/props.d.ts +0 -25
  106. package/dist/components/ScrollBar/Bar/props.js +0 -17
  107. package/dist/components/ScrollBar/Thumb/index.d.ts +0 -40
  108. package/dist/components/ScrollBar/Thumb/props.d.ts +0 -20
  109. package/dist/components/ScrollBar/Thumb/props.js +0 -17
  110. package/dist/components/TableCell/index.d.ts +0 -37
  111. package/dist/components/TableCell/index.js +0 -69
  112. package/dist/components/ToolBar/FullscreenIcon.d.ts +0 -7
  113. package/dist/components/ToolBar/FullscreenIcon.js +0 -11
  114. package/dist/components/ToolBar/index.d.ts +0 -34
  115. package/dist/components/ToolBar/index.js +0 -97
  116. package/dist/hooks/tryOnActivated.d.ts +0 -6
  117. package/dist/hooks/tryOnActivated.js +0 -12
  118. package/dist/hooks/useDebounceFn.d.ts +0 -8
  119. package/dist/hooks/useDebounceFn.js +0 -31
  120. package/dist/hooks/useScrollArea.d.ts +0 -24
  121. package/dist/hooks/useScrollArea.js +0 -102
  122. package/dist/props.d.ts +0 -340
  123. package/dist/props.js +0 -247
  124. package/dist/types/ColumnTypings.d.ts +0 -130
  125. package/dist/types/SlotsTypings.d.ts +0 -63
  126. package/dist/types/SlotsTypings.js +0 -12
  127. package/dist/types/TableTypings.d.ts +0 -359
  128. package/dist/types/index.d.ts +0 -9
  129. package/dist/utils/utils.d.ts +0 -10
  130. package/dist/utils/utils.js +0 -89
  131. /package/dist/{types/ColumnTypings.js → interface.js} +0 -0
  132. /package/dist/{types/TableTypings.js → theme/augment.js} +0 -0
  133. /package/dist/{types/index.js → theme/interface/components.js} +0 -0
@@ -1,9 +1,17 @@
1
+ import { genToolbarStyle } from "../components/Toolbar/style.js";
1
2
  import { genProTableFitPage } from "./fit-page.js";
2
3
  import { genProTableList } from "./list.js";
4
+ import { genProTableResizable } from "./resizable.js";
3
5
  import { genProTableScroll } from "./scroll.js";
6
+ import { genProTableSearch } from "./search.js";
7
+ import { proGenStyleHooks } from "@gx-design-vue/pro-provider";
4
8
  //#region src/style/index.ts
5
9
  const genProTableStyle = (token) => {
6
10
  return { [token.componentCls]: {
11
+ [`${token.componentCls}-content`]: {
12
+ display: "flex",
13
+ flexDirection: "column"
14
+ },
7
15
  [`${token.componentCls}-card`]: { [`${token.antCls}-table-pagination${token.antCls}-pagination`]: {
8
16
  margin: 0,
9
17
  marginTop: token.margin
@@ -19,35 +27,16 @@ const genProTableStyle = (token) => {
19
27
  justifyContent: "center",
20
28
  marginBlock: token.marginXL
21
29
  },
22
- "&-table-tree": { [`${token.antCls}-table-row-cell-ellipsis`]: {
23
- overflow: "hidden",
24
- textOverflow: "ellipsis",
25
- whiteSpace: "nowrap",
26
- [`${token.antCls}-table-column-title`]: {
27
- overflow: "hidden",
28
- textOverflow: "ellipsis",
29
- whiteSpace: "nowrap"
30
- }
31
- } },
32
30
  "&-full-screen": { [`${token.componentCls}-content`]: {
33
31
  height: "100% !important",
34
32
  padding: 24,
35
33
  backgroundColor: token.colorWhite,
36
34
  boxShadow: "0 4px 8px #0003, 0 6px 20px #00000030 !important"
37
35
  } },
38
- "&-no-scroll": {
39
- [`${token.antCls}-table`]: { table: {
40
- width: "100% !important",
41
- minWidth: "unset"
42
- } },
43
- [`${token.antCls}-table-ping-right:not(${token.antCls}-table-has-fix-right)`]: { [`${token.antCls}-table-container::after`]: { boxShadow: "none" } },
44
- [`${token.antCls}-table-bordered ${token.antCls}-table-fixed-left ${token.antCls}-table-thead > tr > th`]: { "&:last-child": { borderRight: 0 } },
45
- [`${token.antCls}-table-bordered ${token.antCls}-table-fixed-left ${token.antCls}-table-tbody > tr > td`]: { "&:last-child": { borderRight: 0 } }
46
- },
47
36
  [`&-card-border`]: {
48
37
  paddingInline: token.paddingMD,
49
38
  paddingBlock: token.paddingMD,
50
- border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
39
+ border: `${token.lineWidth} ${token.lineType} ${token.colorSplit}`,
51
40
  borderRadius: token.borderRadiusLG,
52
41
  backgroundColor: token.colorBgContainer,
53
42
  [`${token.antCls}-table-wrapper ${token.antCls}-table-pagination${token.antCls}-pagination`]: { marginBottom: 0 }
@@ -61,61 +50,22 @@ const genProTableStyle = (token) => {
61
50
  cursor: "pointer"
62
51
  }
63
52
  },
64
- [`${token.componentCls}-ellipsis`]: {
65
- overflow: "hidden",
66
- textOverflow: "ellipsis",
67
- display: "-webkit-box",
68
- "-webkit-box-orient": "vertical",
69
- "word-break": "break-word"
70
- },
71
53
  [`${token.componentCls}-action-size`]: { display: "inline-block" },
72
- [`${token.componentCls}-action-columns`]: {
73
- display: "inline-block",
74
- [`${token.antCls}-popover-inner-content`]: { padding: "8px 0 8px 16px" },
75
- [`${token.antCls}-tree ${token.antCls}-tree-switcher-noop`]: { display: "none" },
76
- [`${token.antCls}-tree > ${token.antCls}-tree-treenode`]: {
77
- width: "100%",
78
- alignItems: "center",
79
- "&:first-child": { paddingTop: 0 },
80
- "&:last-child": { paddingBottom: 4 },
81
- "&:hover": {
82
- backgroundColor: "#e6f7ff",
83
- [`${token.componentCls}-action-columns-list-item-actions`]: { display: "block" }
84
- }
85
- },
86
- [`${token.antCls}-tree ${token.antCls}-tree-node-content-wrapper`]: {
87
- flex: "1",
88
- "&:hover": { backgroundColor: "transparent" }
89
- },
90
- "&-popover-title": {
91
- display: "flex",
92
- alignItems: "center",
93
- justifyContent: "space-between",
94
- "&-check": { marginRight: 8 },
95
- [`${token.antCls}-btn-sm`]: { padding: 0 }
96
- },
97
- "&-list-group": {
98
- marginTop: 6,
99
- marginBottom: 6,
100
- fontSize: 12,
101
- color: "rgba(0, 0, 0, 0.45)"
102
- },
103
- "$-list-item": {
104
- display: "flex",
105
- alignItems: "center",
106
- justifyContent: "space-between",
107
- "&-actions": {
108
- display: "block",
109
- float: "right",
110
- cursor: "pointer",
111
- "> span + span": { marginLeft: 8 },
112
- "&-disabled": { "action": { color: "rgba(0, 0, 0, 0.25)" } },
113
- "anticon": { color: token.colorPrimary }
114
- }
115
- }
116
- },
117
- [`${token.antCls}-tooltip-inner`]: { a: { color: token.colorWhite } }
54
+ [`${token.componentCls}-a`]: {
55
+ color: token.colorPrimary,
56
+ cursor: "pointer",
57
+ "&:hover": { color: token.colorPrimaryHover }
58
+ }
118
59
  } };
119
60
  };
61
+ var style_default = proGenStyleHooks("ProTable", (token) => [
62
+ genProTableStyle(token),
63
+ genProTableList(token),
64
+ genProTableScroll(token),
65
+ genProTableFitPage(token),
66
+ genProTableResizable(token),
67
+ genProTableSearch(token),
68
+ genToolbarStyle(token)
69
+ ]);
120
70
  //#endregion
121
- export { genProTableFitPage, genProTableList, genProTableScroll, genProTableStyle };
71
+ export { style_default as default };
@@ -1,6 +1,8 @@
1
- import { GenerateStyle } from "@gx-design-vue/pro-provider";
1
+ import { ProFullToken } from "@gx-design-vue/pro-provider";
2
+ import { CSSObject } from "@antdv-next/cssinjs";
3
+ import { GenerateStyle } from "antdv-next/dist/theme/internal";
2
4
 
3
5
  //#region src/style/list.d.ts
4
- declare const genProTableList: GenerateStyle;
6
+ declare const genProTableList: GenerateStyle<ProFullToken<'ProTable'>, CSSObject>;
5
7
  //#endregion
6
8
  export { genProTableList };
@@ -3,16 +3,7 @@ const genProTableList = (token) => {
3
3
  return { [token.componentCls]: { [`${token.componentCls}-list`]: {
4
4
  clear: "both",
5
5
  maxWidth: "100%",
6
- [`${token.componentCls}-pagination${token.antCls}-pagination`]: { marginTop: token.margin },
7
- [`${token.componentCls}-pagination`]: {
8
- display: "flex",
9
- flexWrap: "wrap",
10
- rowGap: token.paddingXS,
11
- "> *": { flex: "none" },
12
- "&-left": { justifyContent: "flex-start" },
13
- "&-center": { justifyContent: "center" },
14
- "&-right": { justifyContent: "flex-end" }
15
- }
6
+ [`${token.componentCls}-pagination${token.antCls}-pagination`]: { marginTop: token.margin }
16
7
  } } };
17
8
  };
18
9
  //#endregion
@@ -0,0 +1,8 @@
1
+ import { ProFullToken } from "@gx-design-vue/pro-provider";
2
+ import { CSSObject } from "@antdv-next/cssinjs";
3
+ import { GenerateStyle } from "antdv-next/dist/theme/internal";
4
+
5
+ //#region src/style/resizable.d.ts
6
+ declare const genProTableResizable: GenerateStyle<ProFullToken<'ProTable'>, CSSObject>;
7
+ //#endregion
8
+ export { genProTableResizable };
@@ -0,0 +1,18 @@
1
+ //#region src/style/resizable.ts
2
+ const genProTableResizable = (token) => {
3
+ return { [token.componentCls]: {
4
+ ".resizable-title": { position: "relative" },
5
+ ".resizable-handle": {
6
+ position: "absolute",
7
+ top: 0,
8
+ right: -5,
9
+ width: 10,
10
+ height: "100%",
11
+ cursor: "col-resize",
12
+ userSelect: "none",
13
+ zIndex: 1
14
+ }
15
+ } };
16
+ };
17
+ //#endregion
18
+ export { genProTableResizable };
@@ -1,6 +1,8 @@
1
- import { GenerateStyle } from "@gx-design-vue/pro-provider";
1
+ import { ProFullToken } from "@gx-design-vue/pro-provider";
2
+ import { CSSObject } from "@antdv-next/cssinjs";
3
+ import { GenerateStyle } from "antdv-next/dist/theme/internal";
2
4
 
3
5
  //#region src/style/scroll.d.ts
4
- declare const genProTableScroll: GenerateStyle;
6
+ declare const genProTableScroll: GenerateStyle<ProFullToken<'ProTable'>, CSSObject>;
5
7
  //#endregion
6
8
  export { genProTableScroll };
@@ -1,5 +1,8 @@
1
- import { TinyColor } from "@ctrl/tinycolor";
1
+ import { unit } from "@gx-design-vue/pro-provider";
2
2
  //#region src/style/scroll.ts
3
+ function withAlpha(color, alpha) {
4
+ return `color-mix(in srgb, ${color} ${alpha * 100}%, transparent)`;
5
+ }
3
6
  function scrollBarStyle() {
4
7
  return {
5
8
  scrollbarWidth: "none",
@@ -10,8 +13,8 @@ function scrollBarStyle() {
10
13
  };
11
14
  }
12
15
  const genProTableScroll = (token) => {
13
- const color = new TinyColor(token.colorText).setAlpha(.2).toRgbString();
14
- const colorHover = new TinyColor(token.colorText).setAlpha(.4).toRgbString();
16
+ const color = withAlpha(token.colorText, .2);
17
+ const colorHover = withAlpha(token.colorText, .4);
15
18
  return { [token.componentCls]: {
16
19
  [`${token.antCls}-table-container`]: { position: "relative" },
17
20
  [`${token.componentCls}-scroll`]: {
@@ -20,7 +23,7 @@ const genProTableScroll = (token) => {
20
23
  right: 2,
21
24
  bottom: 2,
22
25
  zIndex: 100,
23
- borderRadius: token.borderRadius - 2,
26
+ borderRadius: `calc(${unit(token.borderRadius)} - 2px)`,
24
27
  "&.is-vertical": {
25
28
  top: 2,
26
29
  width: 6,
@@ -48,9 +51,8 @@ const genProTableScroll = (token) => {
48
51
  }
49
52
  }
50
53
  },
51
- [`${token.antCls}-table-content`]: scrollBarStyle(),
52
54
  [`${token.antCls}-table-body`]: scrollBarStyle(),
53
- [`${token.antCls}-table-empty`]: { [`${token.antCls}-table-content`]: scrollBarStyle() }
55
+ [`${token.antCls}-table-container`]: scrollBarStyle()
54
56
  } };
55
57
  };
56
58
  //#endregion
@@ -0,0 +1,8 @@
1
+ import { ProFullToken } from "@gx-design-vue/pro-provider";
2
+ import { CSSObject } from "@antdv-next/cssinjs";
3
+ import { GenerateStyle } from "antdv-next/dist/theme/internal";
4
+
5
+ //#region src/style/search.d.ts
6
+ declare const genProTableSearch: GenerateStyle<ProFullToken<'ProTable'>, CSSObject>;
7
+ //#endregion
8
+ export { genProTableSearch };
@@ -1,6 +1,7 @@
1
- //#region src/components/Form/style.ts
2
- const genTableFormStyle = (token) => {
3
- return {
1
+ import { unit } from "@gx-design-vue/pro-provider";
2
+ //#region src/style/search.ts
3
+ const genProTableSearch = (token) => {
4
+ return { [token.componentCls]: {
4
5
  [`${token.componentCls}-search`]: {
5
6
  position: "relative",
6
7
  display: "flex",
@@ -9,8 +10,8 @@ const genTableFormStyle = (token) => {
9
10
  "&-border": {
10
11
  paddingInline: token.paddingMD,
11
12
  paddingBlock: token.paddingMD,
12
- paddingBlockEnd: token.paddingMD - 16,
13
- border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
13
+ paddingBlockEnd: `calc(${unit(token.paddingMD)} - 16px)`,
14
+ border: `${token.lineWidth} ${token.lineType} ${token.colorSplit}`,
14
15
  borderRadius: token.borderRadiusLG,
15
16
  marginBottom: token.marginLG,
16
17
  backgroundColor: token.colorBgContainer
@@ -64,6 +65,19 @@ const genTableFormStyle = (token) => {
64
65
  borderRightWidth: 0,
65
66
  backgroundColor: "transparent",
66
67
  cursor: "default"
68
+ },
69
+ [`${token.antCls}-input${token.componentCls}-number-range-separator`]: {
70
+ textAlign: "center",
71
+ borderInlineStartWidth: 0,
72
+ borderInlineEndWidth: 0,
73
+ backgroundColor: "transparent",
74
+ color: token.colorTextTertiary,
75
+ cursor: "default",
76
+ [`&:disabled, &${token.antCls}-input-disabled`]: {
77
+ backgroundColor: "transparent",
78
+ color: token.colorTextTertiary,
79
+ cursor: "default"
80
+ }
67
81
  }
68
82
  },
69
83
  "&-label": {
@@ -72,7 +86,7 @@ const genTableFormStyle = (token) => {
72
86
  content: "\":\"",
73
87
  position: "relative",
74
88
  marginBlock: 0,
75
- marginInlineStart: token.marginXXS / 2,
89
+ marginInlineStart: `calc(${unit(token.marginXXS)} / 2)`,
76
90
  marginInlineEnd: token.marginXS
77
91
  },
78
92
  [`&${token.componentCls}-search-item-label-no-colon::after`]: { content: "\" \"" },
@@ -89,7 +103,7 @@ const genTableFormStyle = (token) => {
89
103
  justifyContent: "center",
90
104
  alignItems: "center"
91
105
  }
92
- };
106
+ } };
93
107
  };
94
108
  //#endregion
95
- export { genTableFormStyle };
109
+ export { genProTableSearch };
@@ -0,0 +1,8 @@
1
+ import { ComponentToken } from "../style/index.js";
2
+
3
+ //#region src/theme/augment.d.ts
4
+ declare module 'antdv-next/dist/theme/interface/components' {
5
+ interface ComponentTokenMap {
6
+ ProTable?: ComponentToken;
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ComponentToken } from "../../style/index.js";
2
+
3
+ //#region src/theme/interface/components.d.ts
4
+ interface ComponentTokenMap {
5
+ ProTable: ComponentToken;
6
+ }
7
+ //#endregion
8
+ export { ComponentTokenMap };
@@ -0,0 +1,9 @@
1
+ import dayjs from "dayjs";
2
+
3
+ //#region src/utils/dateFormat.d.ts
4
+ type DateFormatType = ((day: dayjs.Dayjs) => string) | string | undefined;
5
+ declare function formatStringValue(value: any, format: DateFormatType): string;
6
+ declare function resolveValueFormat(valueFormat?: string, showTime?: boolean | Record<string, any>): string;
7
+ declare function formatDateRangeArray(values: any[], format: DateFormatType | DateFormatType[], type?: 'dayjs' | 'string'): any[] | undefined;
8
+ //#endregion
9
+ export { formatDateRangeArray, formatStringValue, resolveValueFormat };
@@ -0,0 +1,29 @@
1
+ import dayjs from "dayjs";
2
+ //#region src/utils/dateFormat.ts
3
+ function formatStringValue(value, format) {
4
+ if (typeof format === "function") return format(dayjs(value));
5
+ return dayjs(value).format(format);
6
+ }
7
+ function resolveValueFormat(valueFormat, showTime) {
8
+ return showTime ? "YYYY-MM-DD HH:mm:ss" : valueFormat ?? "YYYY-MM-DD";
9
+ }
10
+ function formatDateRangeArray(values, format, type = "string") {
11
+ if (!Array.isArray(values) || values.length !== 2) return;
12
+ const [startText, endText] = values;
13
+ let formatFirst;
14
+ let formatEnd;
15
+ if (Array.isArray(format)) {
16
+ formatFirst = format[0];
17
+ formatEnd = format[1];
18
+ } else if (typeof format === "object" && format !== void 0) {
19
+ formatFirst = format.format;
20
+ formatEnd = format.format;
21
+ } else {
22
+ formatFirst = format;
23
+ formatEnd = format;
24
+ }
25
+ if (type === "dayjs") return [dayjs(startText), dayjs(endText)];
26
+ return [startText ? formatStringValue(startText, formatFirst) : "", endText ? formatStringValue(endText, formatEnd) : ""];
27
+ }
28
+ //#endregion
29
+ export { formatDateRangeArray, formatStringValue, resolveValueFormat };
@@ -0,0 +1,9 @@
1
+ import { Breakpoint } from "@gx-design-vue/pro-utils";
2
+
3
+ //#region src/utils/formConstants.d.ts
4
+ declare const DEFAULT_BREAKPOINT_SPANS: {
5
+ breakpoint: Breakpoint;
6
+ span: number;
7
+ }[];
8
+ //#endregion
9
+ export { DEFAULT_BREAKPOINT_SPANS };
@@ -0,0 +1,29 @@
1
+ //#region src/utils/formConstants.ts
2
+ const DEFAULT_BREAKPOINT_SPANS = [
3
+ {
4
+ breakpoint: "xxl",
5
+ span: 4
6
+ },
7
+ {
8
+ breakpoint: "xl",
9
+ span: 3
10
+ },
11
+ {
12
+ breakpoint: "lg",
13
+ span: 2
14
+ },
15
+ {
16
+ breakpoint: "md",
17
+ span: 2
18
+ },
19
+ {
20
+ breakpoint: "sm",
21
+ span: 2
22
+ },
23
+ {
24
+ breakpoint: "xs",
25
+ span: 1
26
+ }
27
+ ];
28
+ //#endregion
29
+ export { DEFAULT_BREAKPOINT_SPANS };
@@ -0,0 +1,9 @@
1
+ import { ProColumnsValueType } from "../interface.js";
2
+
3
+ //#region src/utils/valueFormat.d.ts
4
+ interface ValueFormatOptions {
5
+ className?: string;
6
+ }
7
+ declare function valueFormat(value: any, valueType: ProColumnsValueType | undefined, options?: ValueFormatOptions): any;
8
+ //#endregion
9
+ export { ValueFormatOptions, valueFormat };
@@ -0,0 +1,27 @@
1
+ import { h } from "vue";
2
+ import { isNil, isObject } from "@gx-design-vue/pro-utils";
3
+ import dayjs from "dayjs";
4
+ //#region src/utils/valueFormat.ts
5
+ function valueFormat(value, valueType, options = {}) {
6
+ if (isNil(value) || value === "") return value;
7
+ if (!valueType || valueType === "text") return value;
8
+ if (isObject(valueType) && !Array.isArray(valueType)) {
9
+ const config = valueType;
10
+ const tagName = config.node ?? "span";
11
+ return h(tagName === "a" ? "span" : tagName, {
12
+ class: config.class,
13
+ ...config.attr ?? {},
14
+ ...config.click ? { onClick: config.click } : {}
15
+ }, value);
16
+ }
17
+ switch (valueType) {
18
+ case "link": return h("span", { class: [`${options.className}-a`] }, value);
19
+ case "time": return dayjs(value).format("HH:mm:ss");
20
+ case "dateMonth": return `${dayjs(value).month() + 1}月`;
21
+ case "date": return dayjs(value).format("YYYY-MM-DD");
22
+ case "dateTime": return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
23
+ default: return value;
24
+ }
25
+ }
26
+ //#endregion
27
+ export { valueFormat };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-table",
3
3
  "type": "module",
4
- "version": "0.2.0-alpha.7",
4
+ "version": "0.2.0-alpha.9",
5
5
  "description": "Gx Design Pro Table",
6
6
  "author": {
7
7
  "name": "gx12358",
@@ -40,17 +40,18 @@
40
40
  "vue": ">=3.2.0"
41
41
  },
42
42
  "dependencies": {
43
- "@ant-design/icons-vue": "^7.0.1",
43
+ "@antdv-next/cssinjs": "^1.0.6",
44
+ "@antdv-next/icons": "^1.0.6",
44
45
  "@ctrl/tinycolor": "^3.5.0",
45
- "@vueuse/core": "^14.2.0",
46
- "ant-design-vue": "^4.2.6",
46
+ "@vueuse/core": "^14.3.0",
47
+ "antdv-next": "^1.3.3",
47
48
  "dayjs": "^1.11.19",
48
49
  "es-toolkit": "^1.43.0",
49
- "@gx-design-vue/pro-utils": "^0.2.0-alpha.2",
50
- "@gx-design-vue/pro-app": "^0.1.0-alpha.1",
51
- "@gx-design-vue/context": "^0.0.5-alpha.2",
52
- "@gx-design-vue/pro-provider": "^0.1.0-alpha.4",
53
- "@gx-design-vue/pro-hooks": "^0.2.0-alpha.2"
50
+ "@gx-design-vue/context": "^0.0.5-alpha.3",
51
+ "@gx-design-vue/pro-hooks": "^0.2.0-alpha.3",
52
+ "@gx-design-vue/pro-utils": "^0.2.0-alpha.3",
53
+ "@gx-design-vue/pro-provider": "^0.1.0-alpha.5",
54
+ "@gx-design-vue/pro-app": "^0.1.0-alpha.2"
54
55
  },
55
56
  "browserslist": [
56
57
  "> 1%",
@@ -1,50 +0,0 @@
1
- import { ProSchemaValueEnumType } from "../../../types/ColumnTypings.js";
2
- import * as vue from "vue";
3
- import { PropType } from "vue";
4
-
5
- //#region src/components/Form/components/RequestSelect.d.ts
6
- declare const _default: vue.DefineComponent<vue.ExtractPropTypes<{
7
- fetch: PropType<() => Promise<ProSchemaValueEnumType[]>>;
8
- loading: {
9
- type: PropType<boolean>;
10
- default: boolean;
11
- };
12
- debounceTime: PropType<number>;
13
- manual: {
14
- type: PropType<boolean>;
15
- default: any;
16
- };
17
- fieldName: {
18
- type: PropType<string>;
19
- default: string;
20
- };
21
- notFoundContent: {
22
- type: PropType<(loading: boolean) => any>;
23
- };
24
- }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
25
- [key: string]: any;
26
- }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
27
- fetch: PropType<() => Promise<ProSchemaValueEnumType[]>>;
28
- loading: {
29
- type: PropType<boolean>;
30
- default: boolean;
31
- };
32
- debounceTime: PropType<number>;
33
- manual: {
34
- type: PropType<boolean>;
35
- default: any;
36
- };
37
- fieldName: {
38
- type: PropType<string>;
39
- default: string;
40
- };
41
- notFoundContent: {
42
- type: PropType<(loading: boolean) => any>;
43
- };
44
- }>> & Readonly<{}>, {
45
- loading: boolean;
46
- manual: boolean;
47
- fieldName: string;
48
- }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
49
- //#endregion
50
- export { _default as default };
@@ -1,56 +0,0 @@
1
- import { cloneVNode, defineComponent, ref, watch } from "vue";
2
- import { isArray } from "@gx-design-vue/pro-utils";
3
- import { useDebounceFn } from "@vueuse/core";
4
- import { cloneDeep as cloneDeep$1 } from "es-toolkit";
5
- //#region src/components/Form/components/RequestSelect.tsx
6
- var RequestSelect_default = /* @__PURE__ */ defineComponent({
7
- name: "RequestSelect",
8
- props: {
9
- fetch: Function,
10
- loading: {
11
- type: Boolean,
12
- default: false
13
- },
14
- debounceTime: Number,
15
- manual: {
16
- type: Boolean,
17
- default: void 0
18
- },
19
- fieldName: {
20
- type: String,
21
- default: "options"
22
- },
23
- notFoundContent: { type: Function }
24
- },
25
- setup(props, { slots }) {
26
- const options = ref([]);
27
- const loading = ref(props.loading);
28
- const status = ref("init");
29
- const debouncedFn = useDebounceFn(props.fetch, props.debounceTime || 10);
30
- watch([() => props.fetch, () => props.manual], () => {
31
- if (status.value !== "init" && loading.value) return;
32
- const manual = props.manual ?? false;
33
- if (props.fetch && !manual) {
34
- loading.value = true;
35
- debouncedFn().then((result) => {
36
- options.value = cloneDeep$1(result);
37
- status.value = "success";
38
- }).catch((e) => {
39
- console.error(e);
40
- status.value = "error";
41
- }).finally(() => {
42
- loading.value = false;
43
- });
44
- }
45
- }, { immediate: true });
46
- return () => {
47
- const children = slots.default?.();
48
- return cloneVNode(isArray(children) ? children[0] : children, {
49
- options: options.value,
50
- notFoundContent: props.notFoundContent?.(loading.value)
51
- });
52
- };
53
- }
54
- });
55
- //#endregion
56
- export { RequestSelect_default as default };
@@ -1,11 +0,0 @@
1
- import { ProSearchMap } from "../../../types/ColumnTypings.js";
2
- import { Ref } from "vue";
3
-
4
- //#region src/components/Form/hooks/useForm.d.ts
5
- declare function useForm(defaultState: Ref<any>, searchMap: Ref<ProSearchMap[]>): {
6
- formState: any;
7
- resetFormState: () => void;
8
- changeFormState: (key: string, value: any) => void;
9
- };
10
- //#endregion
11
- export { useForm };
@@ -1,30 +0,0 @@
1
- import { reactive, toRaw, watch } from "vue";
2
- import { cloneDeep } from "@gx-design-vue/pro-utils";
3
- //#region src/components/Form/hooks/useForm.ts
4
- function useForm(defaultState, searchMap) {
5
- const formState = reactive({});
6
- function resetFormState() {
7
- Object.assign(formState, cloneDeep(toRaw(defaultState.value)));
8
- const dateRangeRecord = searchMap.value.find((item) => item.valueType === "dateRange");
9
- if (dateRangeRecord && dateRangeRecord.name) {
10
- const value = dateRangeRecord.rangeStartName || dateRangeRecord.rangeEndName ? defaultState.value[dateRangeRecord.rangeStartName || "start"] ? [defaultState.value[dateRangeRecord.rangeStartName || "start"], defaultState.value[dateRangeRecord.rangeEndName || "end"]] : void 0 : defaultState.value[dateRangeRecord.name];
11
- changeFormState(dateRangeRecord.name, value);
12
- }
13
- }
14
- watch(() => defaultState.value, () => {
15
- resetFormState();
16
- }, {
17
- deep: true,
18
- immediate: true
19
- });
20
- function changeFormState(key, value) {
21
- if (key) formState[key] = value;
22
- }
23
- return {
24
- formState,
25
- resetFormState,
26
- changeFormState
27
- };
28
- }
29
- //#endregion
30
- export { useForm };