yc-pro-components 0.0.42 → 0.0.44

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 (207) hide show
  1. package/es/component.mjs +2 -0
  2. package/es/components/check-card/index.d.ts +61 -61
  3. package/es/components/check-card/src/index.vue.d.ts +4 -4
  4. package/es/components/check-card-group/index.d.ts +43 -43
  5. package/es/components/check-card-group/src/index.vue.d.ts +3 -3
  6. package/es/components/date-picker/index.d.ts +20 -20
  7. package/es/components/date-picker/src/index.vue.d.ts +12 -12
  8. package/es/components/dialog/index.d.ts +26 -26
  9. package/es/components/dialog/src/index.vue.d.ts +2 -2
  10. package/es/components/dialog-form/index.d.ts +31 -31
  11. package/es/components/dialog-form/src/index.vue.d.ts +9 -9
  12. package/es/components/display-item/index.d.ts +41 -41
  13. package/es/components/display-item/src/index.vue.d.ts +22 -22
  14. package/es/components/drawer-form/index.d.ts +65 -65
  15. package/es/components/drawer-form/src/index.vue.d.ts +15 -15
  16. package/es/components/form/index.d.ts +45 -45
  17. package/es/components/form/src/form-content.vue.d.ts +20 -20
  18. package/es/components/form/src/index.vue.d.ts +17 -17
  19. package/es/components/form-item/index.d.ts +48 -48
  20. package/es/components/form-item/src/index.vue.d.ts +14 -14
  21. package/es/components/header/index.d.ts +19 -19
  22. package/es/components/header/src/index.vue.d.ts +1 -1
  23. package/es/components/index.d.ts +1 -0
  24. package/es/components/index.mjs +4 -0
  25. package/es/components/input-tag/index.d.ts +15 -15
  26. package/es/components/input-tag/src/index.vue.d.ts +3 -3
  27. package/es/components/layout/index.d.ts +50 -50
  28. package/es/components/layout/src/index.vue.d.ts +11 -11
  29. package/es/components/page/index.d.ts +4166 -2538
  30. package/es/components/page/src/index.vue.d.ts +712 -137
  31. package/es/components/page/src/index.vue2.mjs +120 -31
  32. package/es/components/pagination/index.d.ts +42 -42
  33. package/es/components/pagination/src/index.vue.d.ts +3 -3
  34. package/es/components/radio/index.d.ts +35 -35
  35. package/es/components/radio/src/index.vue.d.ts +27 -27
  36. package/es/components/render/index.d.ts +3 -3
  37. package/es/components/render/src/index.vue.d.ts +1 -1
  38. package/es/components/search/index.d.ts +154 -154
  39. package/es/components/search/src/index.vue.d.ts +50 -50
  40. package/es/components/sidebar/index.d.ts +15 -15
  41. package/es/components/sidebar/src/index.vue.d.ts +5 -5
  42. package/es/components/steps-form/index.d.ts +23 -23
  43. package/es/components/steps-form/src/index.vue.d.ts +2 -2
  44. package/es/components/table/src/table-column.vue.d.ts +37 -37
  45. package/es/components/utils/index.d.ts +2 -2
  46. package/es/components/virtual-table/index.d.ts +646 -0
  47. package/es/components/virtual-table/index.mjs +8 -0
  48. package/es/components/virtual-table/src/index.vue.d.ts +139 -0
  49. package/es/components/virtual-table/src/index.vue.mjs +6 -0
  50. package/es/components/virtual-table/src/index.vue2.mjs +327 -0
  51. package/es/components/virtual-table/src/type.d.ts +295 -0
  52. package/es/components/virtual-table/src/type.mjs +1 -0
  53. package/es/components/virtual-table/src/use-column-adapter.d.ts +40 -0
  54. package/es/components/virtual-table/src/use-column-adapter.mjs +137 -0
  55. package/es/components/virtual-table/src/use-virtual-scroll.d.ts +35 -0
  56. package/es/components/virtual-table/src/use-virtual-scroll.mjs +71 -0
  57. package/es/components/virtual-table/src/use-virtual-selection.d.ts +40 -0
  58. package/es/components/virtual-table/src/use-virtual-selection.mjs +112 -0
  59. package/es/components/virtual-table/src/virtual-table-action-bar.d.ts +11 -0
  60. package/es/components/virtual-table/src/virtual-table-action-bar.mjs +121 -0
  61. package/es/components/virtual-table/src/virtual-table-cell-renderer.d.ts +16 -0
  62. package/es/components/virtual-table/src/virtual-table-cell-renderer.mjs +170 -0
  63. package/es/components/virtual-table/src/virtual-table-header-renderer.d.ts +10 -0
  64. package/es/components/virtual-table/src/virtual-table-header-renderer.mjs +51 -0
  65. package/es/components/virtual-table/style/css.d.ts +3 -0
  66. package/es/components/virtual-table/style/css.mjs +1 -0
  67. package/es/components/virtual-table/style/index.d.ts +12 -0
  68. package/es/components/virtual-table/style/index.mjs +1 -0
  69. package/es/components/yc-dialog/index.d.ts +24 -24
  70. package/es/components/yc-download-dialog/index.d.ts +19 -19
  71. package/es/components/yc-download-dialog/src/index.vue.d.ts +1 -1
  72. package/es/components/yc-form-container-header/index.d.ts +12 -12
  73. package/es/components/yc-more-actions/index.d.ts +46 -46
  74. package/es/components/yc-more-actions/src/index.vue.d.ts +3 -3
  75. package/es/components/yc-plus-page/src/index.vue.d.ts +2445 -1430
  76. package/es/components/yc-plus-page/src/index.vue.mjs +1 -1
  77. package/es/components/yc-plus-page/src/type.d.ts +8 -2
  78. package/es/components/yc-segmented/index.d.ts +2 -2
  79. package/es/components/yc-segmented/src/index.d.ts +2 -2
  80. package/es/components/yc-select-v2/src/index.vue.d.ts +3 -3
  81. package/es/components/yc-status-dialog/src/index.vue.d.ts +1 -1
  82. package/es/components/yc-tabs-with-filter/index.d.ts +16 -16
  83. package/es/components/yc-text/src/index.vue.d.ts +2 -2
  84. package/es/hooks/usePlusFormReset.d.ts +238 -238
  85. package/es/index.css +20 -1
  86. package/es/index.d.ts +1 -0
  87. package/es/index.mjs +4 -0
  88. package/es/yc-components/index.d.ts +1 -0
  89. package/index.css +111 -6
  90. package/index.js +1141 -149
  91. package/index.min.css +2 -1
  92. package/index.min.js +13 -10
  93. package/index.min.mjs +13 -10
  94. package/index.mjs +1139 -151
  95. package/lib/component.js +42 -40
  96. package/lib/components/check-card/index.d.ts +61 -61
  97. package/lib/components/check-card/src/index.vue.d.ts +4 -4
  98. package/lib/components/check-card-group/index.d.ts +43 -43
  99. package/lib/components/check-card-group/src/index.vue.d.ts +3 -3
  100. package/lib/components/date-picker/index.d.ts +20 -20
  101. package/lib/components/date-picker/src/index.vue.d.ts +12 -12
  102. package/lib/components/dialog/index.d.ts +26 -26
  103. package/lib/components/dialog/src/index.vue.d.ts +2 -2
  104. package/lib/components/dialog-form/index.d.ts +31 -31
  105. package/lib/components/dialog-form/src/index.vue.d.ts +9 -9
  106. package/lib/components/display-item/index.d.ts +41 -41
  107. package/lib/components/display-item/src/index.vue.d.ts +22 -22
  108. package/lib/components/drawer-form/index.d.ts +65 -65
  109. package/lib/components/drawer-form/src/index.vue.d.ts +15 -15
  110. package/lib/components/form/index.d.ts +45 -45
  111. package/lib/components/form/src/form-content.vue.d.ts +20 -20
  112. package/lib/components/form/src/index.vue.d.ts +17 -17
  113. package/lib/components/form-item/index.d.ts +48 -48
  114. package/lib/components/form-item/src/index.vue.d.ts +14 -14
  115. package/lib/components/header/index.d.ts +19 -19
  116. package/lib/components/header/src/index.vue.d.ts +1 -1
  117. package/lib/components/index.d.ts +1 -0
  118. package/lib/components/index.js +98 -90
  119. package/lib/components/input-tag/index.d.ts +15 -15
  120. package/lib/components/input-tag/src/index.vue.d.ts +3 -3
  121. package/lib/components/layout/index.d.ts +50 -50
  122. package/lib/components/layout/src/index.vue.d.ts +11 -11
  123. package/lib/components/page/index.d.ts +4166 -2538
  124. package/lib/components/page/src/index.vue.d.ts +712 -137
  125. package/lib/components/page/src/index.vue2.js +125 -36
  126. package/lib/components/pagination/index.d.ts +42 -42
  127. package/lib/components/pagination/src/index.vue.d.ts +3 -3
  128. package/lib/components/radio/index.d.ts +35 -35
  129. package/lib/components/radio/src/index.vue.d.ts +27 -27
  130. package/lib/components/render/index.d.ts +3 -3
  131. package/lib/components/render/src/index.vue.d.ts +1 -1
  132. package/lib/components/search/index.d.ts +154 -154
  133. package/lib/components/search/src/index.vue.d.ts +50 -50
  134. package/lib/components/sidebar/index.d.ts +15 -15
  135. package/lib/components/sidebar/src/index.vue.d.ts +5 -5
  136. package/lib/components/steps-form/index.d.ts +23 -23
  137. package/lib/components/steps-form/src/index.vue.d.ts +2 -2
  138. package/lib/components/table/src/table-column.vue.d.ts +37 -37
  139. package/lib/components/utils/index.d.ts +2 -2
  140. package/lib/components/virtual-table/index.d.ts +646 -0
  141. package/lib/components/virtual-table/index.js +13 -0
  142. package/lib/components/virtual-table/src/index.vue.d.ts +139 -0
  143. package/lib/components/virtual-table/src/index.vue.js +10 -0
  144. package/lib/components/virtual-table/src/index.vue2.js +331 -0
  145. package/lib/components/virtual-table/src/type.d.ts +295 -0
  146. package/lib/components/virtual-table/src/type.js +2 -0
  147. package/lib/components/virtual-table/src/use-column-adapter.d.ts +40 -0
  148. package/lib/components/virtual-table/src/use-column-adapter.js +139 -0
  149. package/lib/components/virtual-table/src/use-virtual-scroll.d.ts +35 -0
  150. package/lib/components/virtual-table/src/use-virtual-scroll.js +73 -0
  151. package/lib/components/virtual-table/src/use-virtual-selection.d.ts +40 -0
  152. package/lib/components/virtual-table/src/use-virtual-selection.js +114 -0
  153. package/lib/components/virtual-table/src/virtual-table-action-bar.d.ts +11 -0
  154. package/lib/components/virtual-table/src/virtual-table-action-bar.js +123 -0
  155. package/lib/components/virtual-table/src/virtual-table-cell-renderer.d.ts +16 -0
  156. package/lib/components/virtual-table/src/virtual-table-cell-renderer.js +172 -0
  157. package/lib/components/virtual-table/src/virtual-table-header-renderer.d.ts +10 -0
  158. package/lib/components/virtual-table/src/virtual-table-header-renderer.js +53 -0
  159. package/lib/components/virtual-table/style/css.d.ts +3 -0
  160. package/lib/components/virtual-table/style/css.js +2 -0
  161. package/lib/components/virtual-table/style/index.d.ts +12 -0
  162. package/lib/components/virtual-table/style/index.js +2 -0
  163. package/lib/components/yc-dialog/index.d.ts +24 -24
  164. package/lib/components/yc-download-dialog/index.d.ts +19 -19
  165. package/lib/components/yc-download-dialog/src/index.vue.d.ts +1 -1
  166. package/lib/components/yc-form-container-header/index.d.ts +12 -12
  167. package/lib/components/yc-more-actions/index.d.ts +46 -46
  168. package/lib/components/yc-more-actions/src/index.vue.d.ts +3 -3
  169. package/lib/components/yc-plus-page/src/index.vue.d.ts +2445 -1430
  170. package/lib/components/yc-plus-page/src/index.vue.js +1 -1
  171. package/lib/components/yc-plus-page/src/type.d.ts +8 -2
  172. package/lib/components/yc-segmented/index.d.ts +2 -2
  173. package/lib/components/yc-segmented/src/index.d.ts +2 -2
  174. package/lib/components/yc-select-v2/src/index.vue.d.ts +3 -3
  175. package/lib/components/yc-status-dialog/src/index.vue.d.ts +1 -1
  176. package/lib/components/yc-tabs-with-filter/index.d.ts +16 -16
  177. package/lib/components/yc-text/src/index.vue.d.ts +2 -2
  178. package/lib/hooks/usePlusFormReset.d.ts +238 -238
  179. package/lib/index.css +20 -1
  180. package/lib/index.d.ts +1 -0
  181. package/lib/index.js +143 -135
  182. package/lib/yc-components/index.d.ts +1 -0
  183. package/locale/en.js +1 -1
  184. package/locale/en.min.js +1 -1
  185. package/locale/en.min.mjs +1 -1
  186. package/locale/en.mjs +1 -1
  187. package/locale/ja.js +1 -1
  188. package/locale/ja.min.js +1 -1
  189. package/locale/ja.min.mjs +1 -1
  190. package/locale/ja.mjs +1 -1
  191. package/locale/ko.js +1 -1
  192. package/locale/ko.min.js +1 -1
  193. package/locale/ko.min.mjs +1 -1
  194. package/locale/ko.mjs +1 -1
  195. package/locale/zh-cn.js +1 -1
  196. package/locale/zh-cn.min.js +1 -1
  197. package/locale/zh-cn.min.mjs +1 -1
  198. package/locale/zh-cn.mjs +1 -1
  199. package/locale/zh-tw.js +1 -1
  200. package/locale/zh-tw.min.js +1 -1
  201. package/locale/zh-tw.min.mjs +1 -1
  202. package/locale/zh-tw.mjs +1 -1
  203. package/package.json +1 -1
  204. package/theme-chalk/index.css +1 -1
  205. package/theme-chalk/plus-virtual-table.css +1 -0
  206. package/theme-chalk/src/index.scss +3 -0
  207. package/theme-chalk/src/virtual-table.scss +128 -0
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var elementPlus = require('element-plus');
5
+
6
+ function useVirtualSelection(options) {
7
+ const selectedKeys = vue.ref(/* @__PURE__ */ new Set());
8
+ const getRowKey = (row) => {
9
+ const key = options.rowKey();
10
+ return row[key];
11
+ };
12
+ const dataLength = vue.computed(() => options.data().length);
13
+ const isAllSelected = vue.computed(() => {
14
+ if (dataLength.value === 0) return false;
15
+ return selectedKeys.value.size === dataLength.value;
16
+ });
17
+ const isIndeterminate = vue.computed(() => {
18
+ const size = selectedKeys.value.size;
19
+ return size > 0 && size < dataLength.value;
20
+ });
21
+ const getSelectionRows = () => {
22
+ const data = options.data();
23
+ const keys = selectedKeys.value;
24
+ if (keys.size === 0) return [];
25
+ return data.filter((row) => keys.has(getRowKey(row)));
26
+ };
27
+ const clearSelection = () => {
28
+ var _a;
29
+ selectedKeys.value = /* @__PURE__ */ new Set();
30
+ (_a = options.onSelectionChange) == null ? void 0 : _a.call(options, []);
31
+ };
32
+ const toggleRowSelection = (row, selected) => {
33
+ var _a, _b;
34
+ const key = getRowKey(row);
35
+ const newSet = new Set(selectedKeys.value);
36
+ const shouldSelect = selected != null ? selected : !newSet.has(key);
37
+ if (shouldSelect) {
38
+ newSet.add(key);
39
+ } else {
40
+ newSet.delete(key);
41
+ }
42
+ selectedKeys.value = newSet;
43
+ const selection = getSelectionRows();
44
+ (_a = options.onSelect) == null ? void 0 : _a.call(options, selection, row);
45
+ (_b = options.onSelectionChange) == null ? void 0 : _b.call(options, selection);
46
+ };
47
+ const toggleAllSelection = (selected) => {
48
+ var _a, _b;
49
+ const shouldSelectAll = selected != null ? selected : !isAllSelected.value;
50
+ if (shouldSelectAll) {
51
+ const data = options.data();
52
+ selectedKeys.value = new Set(data.map((row) => getRowKey(row)));
53
+ } else {
54
+ selectedKeys.value = /* @__PURE__ */ new Set();
55
+ }
56
+ const selection = getSelectionRows();
57
+ (_a = options.onSelectAll) == null ? void 0 : _a.call(options, selection);
58
+ (_b = options.onSelectionChange) == null ? void 0 : _b.call(options, selection);
59
+ };
60
+ vue.watch(
61
+ () => options.data(),
62
+ (newData) => {
63
+ var _a;
64
+ if (selectedKeys.value.size === 0) return;
65
+ const currentKeys = new Set(newData.map((row) => getRowKey(row)));
66
+ const filtered = /* @__PURE__ */ new Set();
67
+ for (const key of selectedKeys.value) {
68
+ if (currentKeys.has(key)) {
69
+ filtered.add(key);
70
+ }
71
+ }
72
+ if (filtered.size !== selectedKeys.value.size) {
73
+ selectedKeys.value = filtered;
74
+ (_a = options.onSelectionChange) == null ? void 0 : _a.call(options, getSelectionRows());
75
+ }
76
+ }
77
+ );
78
+ const selectionCellRenderer = (params) => {
79
+ const row = params.rowData;
80
+ const key = getRowKey(row);
81
+ const checked = selectedKeys.value.has(key);
82
+ return vue.h(elementPlus.ElCheckbox, {
83
+ modelValue: checked,
84
+ onChange: (value) => {
85
+ toggleRowSelection(row, !!value);
86
+ },
87
+ onClick: (e) => {
88
+ e.stopPropagation();
89
+ }
90
+ });
91
+ };
92
+ const selectionHeaderRenderer = (_params) => {
93
+ return vue.h(elementPlus.ElCheckbox, {
94
+ modelValue: isAllSelected.value,
95
+ indeterminate: isIndeterminate.value,
96
+ onChange: (value) => {
97
+ toggleAllSelection(!!value);
98
+ }
99
+ });
100
+ };
101
+ return {
102
+ selectedKeys,
103
+ isAllSelected,
104
+ isIndeterminate,
105
+ getSelectionRows,
106
+ clearSelection,
107
+ toggleRowSelection,
108
+ toggleAllSelection,
109
+ selectionCellRenderer,
110
+ selectionHeaderRenderer
111
+ };
112
+ }
113
+
114
+ exports.useVirtualSelection = useVirtualSelection;
@@ -0,0 +1,11 @@
1
+ import { VirtualTableColumn } from './type';
2
+ import { ActionBarProps, ButtonsCallBackParams } from 'yc-pro-components/es/components/table';
3
+
4
+ /**
5
+ * 创建操作栏列配置
6
+ *
7
+ * @param actionBar - 操作栏配置
8
+ * @param onClickAction - 按钮点击回调(冒泡到父组件)
9
+ * @returns VirtualTableColumn 配置
10
+ */
11
+ export declare function createActionBarColumn(actionBar: Partial<ActionBarProps>, onClickAction?: (params: ButtonsCallBackParams) => void): VirtualTableColumn;
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var elementPlus = require('element-plus');
5
+
6
+ function resolveButtonText(button, row, index) {
7
+ var _a, _b;
8
+ const {
9
+ text
10
+ } = button;
11
+ if (typeof text === "function") {
12
+ return String((_a = vue.unref(text(row, index, button))) != null ? _a : "");
13
+ }
14
+ return String((_b = vue.unref(text)) != null ? _b : "");
15
+ }
16
+ function resolveButtonShow(button, row, index) {
17
+ const {
18
+ show
19
+ } = button;
20
+ if (show === void 0) return true;
21
+ if (typeof show === "function") {
22
+ return !!vue.unref(show(row, index, button));
23
+ }
24
+ return !!vue.unref(show);
25
+ }
26
+ function resolveButtonProps(button, row, index) {
27
+ const {
28
+ props
29
+ } = button;
30
+ if (!props) return {};
31
+ if (typeof props === "function") {
32
+ return props(row, index, button) || {};
33
+ }
34
+ return vue.unref(props) || {};
35
+ }
36
+ function createActionBarColumn(actionBar, onClickAction) {
37
+ const label = typeof actionBar.label === "string" ? actionBar.label : vue.unref(actionBar.label) || "\u64CD\u4F5C\u680F";
38
+ const width = typeof actionBar.width === "number" ? actionBar.width : parseInt(String(actionBar.width || "200"), 10) || 200;
39
+ const showNumber = typeof actionBar.showNumber === "number" ? actionBar.showNumber : 3;
40
+ const buttons = actionBar.buttons || [];
41
+ return {
42
+ key: "__action__",
43
+ dataKey: "__action__",
44
+ title: label,
45
+ width,
46
+ fixed: actionBar.fixed === "right" || actionBar.fixed === void 0 ? elementPlus.TableV2FixedDir.RIGHT : void 0,
47
+ align: "center",
48
+ cellRenderer: (params) => {
49
+ const {
50
+ rowData,
51
+ rowIndex
52
+ } = params;
53
+ const visibleButtons = buttons.filter((btn) => resolveButtonShow(btn, rowData, rowIndex));
54
+ if (visibleButtons.length === 0) return "";
55
+ const currentShowNumber = typeof actionBar.showNumber === "function" ? actionBar.showNumber(rowData, rowIndex) : showNumber;
56
+ const directButtons = visibleButtons.slice(0, currentShowNumber);
57
+ const moreButtons = visibleButtons.slice(currentShowNumber);
58
+ const handleClick = (button, e) => {
59
+ var _a;
60
+ const callbackParams = {
61
+ row: rowData,
62
+ index: rowIndex,
63
+ rowIndex,
64
+ buttonRow: button,
65
+ text: resolveButtonText(button, rowData, rowIndex),
66
+ e,
67
+ column: {},
68
+ cellIndex: 0,
69
+ store: {},
70
+ expanded: false,
71
+ _self: {}
72
+ };
73
+ (_a = button.onClick) == null ? void 0 : _a.call(button, callbackParams);
74
+ onClickAction == null ? void 0 : onClickAction(callbackParams);
75
+ };
76
+ const renderButton = (button, idx) => {
77
+ var _a;
78
+ const text = resolveButtonText(button, rowData, rowIndex);
79
+ const btnProps = resolveButtonProps(button, rowData, rowIndex);
80
+ return vue.h(elementPlus.ElButton, {
81
+ key: (_a = button.code) != null ? _a : idx,
82
+ link: true,
83
+ type: "primary",
84
+ size: "small",
85
+ ...btnProps,
86
+ onClick: (e) => handleClick(button, e)
87
+ }, () => text);
88
+ };
89
+ const nodes = directButtons.map(renderButton);
90
+ if (moreButtons.length > 0) {
91
+ const dropdownNode = vue.h(elementPlus.ElDropdown, {
92
+ trigger: "hover"
93
+ }, {
94
+ default: () => vue.h(elementPlus.ElButton, {
95
+ link: true,
96
+ type: "primary",
97
+ size: "small"
98
+ }, () => "\u66F4\u591A"),
99
+ dropdown: () => vue.h(elementPlus.ElDropdownMenu, null, () => moreButtons.map((btn, idx) => {
100
+ var _a;
101
+ const text = resolveButtonText(btn, rowData, rowIndex);
102
+ return vue.h(elementPlus.ElDropdownItem, {
103
+ key: (_a = btn.code) != null ? _a : `more-${idx}`,
104
+ onClick: (e) => handleClick(btn, e)
105
+ }, () => text);
106
+ }))
107
+ });
108
+ nodes.push(dropdownNode);
109
+ }
110
+ return vue.h("div", {
111
+ class: "plus-virtual-table-action-bar",
112
+ style: {
113
+ display: "flex",
114
+ alignItems: "center",
115
+ justifyContent: "center",
116
+ gap: "4px"
117
+ }
118
+ }, nodes);
119
+ }
120
+ };
121
+ }
122
+
123
+ exports.createActionBarColumn = createActionBarColumn;
@@ -0,0 +1,16 @@
1
+ import { VirtualTableColumn } from './type';
2
+ import { PlusColumn } from 'yc-pro-components/es/types';
3
+
4
+ /**
5
+ * 创建单元格渲染器
6
+ *
7
+ * 将 PlusColumn 的渲染配置适配为 el-table-v2 的 cellRenderer。
8
+ * 参数差异对照:
9
+ * - PlusColumn.render(value, { row, column, index })
10
+ * - el-table-v2.cellRenderer({ cellData, rowData, column, rowIndex, columnIndex, columns })
11
+ *
12
+ * @param plusColumn - 原始 PlusColumn 配置
13
+ * @param globalEmptyText - 全局空值文本
14
+ * @returns el-table-v2 兼容的 cellRenderer 函数
15
+ */
16
+ export declare function createCellRenderer(plusColumn: PlusColumn, globalEmptyText?: string): VirtualTableColumn['cellRenderer'];
@@ -0,0 +1,172 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var elementPlus = require('element-plus');
5
+
6
+ function _isSlot(s) {
7
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
8
+ }
9
+ function isEmpty(value) {
10
+ return value === null || value === void 0 || value === "";
11
+ }
12
+ function findOptionByValue(options, value) {
13
+ const arr = vue.unref(options);
14
+ if (!Array.isArray(arr)) return void 0;
15
+ return arr.find((opt) => opt.value === value);
16
+ }
17
+ function renderOptionStatus(option) {
18
+ const {
19
+ label,
20
+ color,
21
+ type: statusType
22
+ } = option;
23
+ const colorMap = {
24
+ success: "#67c23a",
25
+ warning: "#e6a23c",
26
+ info: "#909399",
27
+ primary: "#409eff",
28
+ danger: "#f56c6c"
29
+ };
30
+ const dotColor = color || (statusType ? colorMap[statusType] : void 0);
31
+ if (dotColor) {
32
+ return vue.createVNode("span", {
33
+ "class": "plus-table-column-status"
34
+ }, [vue.createVNode("span", {
35
+ "class": "plus-table-column-status__dot",
36
+ "style": {
37
+ backgroundColor: dotColor
38
+ }
39
+ }, null), vue.createVNode("span", {
40
+ "class": "plus-table-column-status__text"
41
+ }, [label != null ? label : ""])]);
42
+ }
43
+ return vue.createVNode("span", null, [label != null ? label : ""]);
44
+ }
45
+ function renderByValueType(valueType, value, column, _row) {
46
+ switch (valueType) {
47
+ case "img": {
48
+ const imgProps = {
49
+ src: value,
50
+ "preview-src-list": [value],
51
+ fit: "cover",
52
+ class: "plus-display-item__image",
53
+ style: {
54
+ width: "40px",
55
+ height: "40px"
56
+ }
57
+ };
58
+ return vue.createVNode(elementPlus.ElImage, imgProps, null);
59
+ }
60
+ case "link": {
61
+ const linkProps = {
62
+ href: value,
63
+ type: "primary",
64
+ class: "plus-display-item__link"
65
+ };
66
+ return vue.createVNode(elementPlus.ElLink, linkProps, {
67
+ default: () => [column.linkText || value]
68
+ });
69
+ }
70
+ case "tag": {
71
+ let _slot;
72
+ const tagOption = findOptionByValue(column.options, value);
73
+ if (tagOption) {
74
+ const tagProps = {
75
+ type: tagOption.type || ""
76
+ };
77
+ return vue.createVNode(elementPlus.ElTag, tagProps, {
78
+ default: () => {
79
+ var _a;
80
+ return [(_a = tagOption.label) != null ? _a : value];
81
+ }
82
+ });
83
+ }
84
+ return vue.createVNode(elementPlus.ElTag, null, _isSlot(_slot = String(value != null ? value : "")) ? _slot : {
85
+ default: () => [_slot]
86
+ });
87
+ }
88
+ case "money":
89
+ return vue.createVNode("span", null, [formatMoney(value)]);
90
+ case "progress": {
91
+ const progressProps = {
92
+ percentage: Number(value) || 0
93
+ };
94
+ return vue.createVNode(elementPlus.ElProgress, progressProps, null);
95
+ }
96
+ case "avatar": {
97
+ const avatarProps = {
98
+ src: value
99
+ };
100
+ return vue.createVNode(elementPlus.ElAvatar, avatarProps, null);
101
+ }
102
+ case "code":
103
+ return vue.createVNode("span", {
104
+ "class": "plus-display-item__pre"
105
+ }, [String(value != null ? value : "")]);
106
+ default:
107
+ return String(value != null ? value : "");
108
+ }
109
+ }
110
+ function formatMoney(value) {
111
+ if (isEmpty(value)) return "";
112
+ const num = Number(value);
113
+ if (isNaN(num)) return String(value);
114
+ return num.toLocaleString("zh-CN", {
115
+ minimumFractionDigits: 2,
116
+ maximumFractionDigits: 2
117
+ });
118
+ }
119
+ function createCellRenderer(plusColumn, globalEmptyText = "-") {
120
+ var _a;
121
+ const emptyText = (_a = plusColumn.emptyText) != null ? _a : globalEmptyText;
122
+ return (params) => {
123
+ const {
124
+ rowData,
125
+ rowIndex
126
+ } = params;
127
+ const value = rowData[plusColumn.prop];
128
+ if (plusColumn.render && typeof plusColumn.render === "function") {
129
+ return plusColumn.render(value, {
130
+ row: rowData,
131
+ column: plusColumn,
132
+ index: rowIndex
133
+ });
134
+ }
135
+ if (plusColumn.renderHTML && typeof plusColumn.renderHTML === "function") {
136
+ const html = plusColumn.renderHTML(value, {
137
+ row: rowData,
138
+ column: plusColumn,
139
+ index: rowIndex
140
+ });
141
+ return vue.createVNode("span", {
142
+ "innerHTML": html
143
+ }, null);
144
+ }
145
+ if (plusColumn.formatter && typeof plusColumn.formatter === "function") {
146
+ const formatted = plusColumn.formatter(value, {
147
+ row: rowData,
148
+ column: plusColumn,
149
+ index: rowIndex
150
+ });
151
+ return vue.createVNode("span", null, [isEmpty(formatted) ? emptyText : formatted]);
152
+ }
153
+ if (plusColumn.valueType) {
154
+ if (isEmpty(value)) return vue.createVNode("span", null, [emptyText]);
155
+ return renderByValueType(plusColumn.valueType, value, plusColumn);
156
+ }
157
+ if (plusColumn.options) {
158
+ const option = findOptionByValue(plusColumn.options, value);
159
+ if (option) {
160
+ return renderOptionStatus(option);
161
+ }
162
+ }
163
+ if (isEmpty(value)) {
164
+ return vue.createVNode("span", {
165
+ "class": "plus-table-column-empty"
166
+ }, [emptyText]);
167
+ }
168
+ return vue.createVNode("span", null, [String(value)]);
169
+ };
170
+ }
171
+
172
+ exports.createCellRenderer = createCellRenderer;
@@ -0,0 +1,10 @@
1
+ import { VirtualTableColumn } from './type';
2
+ import { PlusColumn } from 'yc-pro-components/es/types';
3
+
4
+ /**
5
+ * 创建表头渲染器
6
+ *
7
+ * @param plusColumn - 原始 PlusColumn 配置
8
+ * @returns el-table-v2 兼容的 headerCellRenderer 函数
9
+ */
10
+ export declare function createHeaderRenderer(plusColumn: PlusColumn): VirtualTableColumn['headerCellRenderer'];
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var elementPlus = require('element-plus');
5
+ var ElementPlusIconsVue = require('@element-plus/icons-vue');
6
+
7
+ function resolveTooltip(tooltip) {
8
+ if (!tooltip) return null;
9
+ const resolved = vue.unref(tooltip);
10
+ if (typeof resolved === "string") {
11
+ return {
12
+ content: resolved
13
+ };
14
+ }
15
+ if (typeof resolved === "object" && resolved !== null) {
16
+ return resolved;
17
+ }
18
+ return null;
19
+ }
20
+ function getLabel(label) {
21
+ var _a;
22
+ if (typeof label === "string") return label;
23
+ return String((_a = vue.unref(label)) != null ? _a : "");
24
+ }
25
+ function createHeaderRenderer(plusColumn) {
26
+ return (_params) => {
27
+ const label = getLabel(plusColumn.label);
28
+ if (plusColumn.renderHeader && typeof plusColumn.renderHeader === "function") {
29
+ return plusColumn.renderHeader(label, plusColumn);
30
+ }
31
+ const tooltipConfig = resolveTooltip(plusColumn.tooltip);
32
+ if (tooltipConfig) {
33
+ const tooltipProps = {
34
+ placement: "top",
35
+ ...tooltipConfig
36
+ };
37
+ const iconProps = {
38
+ class: "plus-table-column__header__icon",
39
+ size: 16
40
+ };
41
+ return vue.createVNode("span", {
42
+ "class": "plus-table-column__header"
43
+ }, [vue.createVNode("span", null, [label]), vue.createVNode(elementPlus.ElTooltip, tooltipProps, {
44
+ default: () => [vue.createVNode(elementPlus.ElIcon, iconProps, {
45
+ default: () => [vue.createVNode(ElementPlusIconsVue.QuestionFilled, null, null)]
46
+ })]
47
+ })]);
48
+ }
49
+ return vue.createVNode("span", null, [label]);
50
+ };
51
+ }
52
+
53
+ exports.createHeaderRenderer = createHeaderRenderer;
@@ -0,0 +1,3 @@
1
+ import "element-plus/es/components/table-v2/style/css";
2
+ import "element-plus/es/components/checkbox/style/css";
3
+ import "element-plus/es/components/loading/style/css";
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,12 @@
1
+ import "element-plus/es/components/table-v2/style/css";
2
+ import "element-plus/es/components/checkbox/style/css";
3
+ import "element-plus/es/components/loading/style/css";
4
+ import "element-plus/es/components/icon/style/css";
5
+ import "element-plus/es/components/button/style/css";
6
+ import "element-plus/es/components/dropdown/style/css";
7
+ import "element-plus/es/components/tag/style/css";
8
+ import "element-plus/es/components/tooltip/style/css";
9
+ import "element-plus/es/components/image/style/css";
10
+ import "element-plus/es/components/link/style/css";
11
+ import "element-plus/es/components/progress/style/css";
12
+ import "element-plus/es/components/avatar/style/css";
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -6,12 +6,12 @@ export * from './src/type';
6
6
  export type YcDialogInstance = InstanceType<typeof YcDialogComponent>;
7
7
  export declare const YcDialog: {
8
8
  new (...args: any[]): CreateComponentPublicInstance<Readonly< ExtractPropTypes<{
9
- size: {
10
- type: PropType<DialogSize>;
11
- };
12
9
  width: {
13
10
  type: PropType<string | number>;
14
11
  };
12
+ size: {
13
+ type: PropType<DialogSize>;
14
+ };
15
15
  maxHeight: {
16
16
  type: PropType<string | number | false>;
17
17
  default: string;
@@ -21,12 +21,12 @@ export declare const YcDialog: {
21
21
  default: boolean;
22
22
  };
23
23
  }>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{
24
- size: {
25
- type: PropType<DialogSize>;
26
- };
27
24
  width: {
28
25
  type: PropType<string | number>;
29
26
  };
27
+ size: {
28
+ type: PropType<DialogSize>;
29
+ };
30
30
  maxHeight: {
31
31
  type: PropType<string | number | false>;
32
32
  default: string;
@@ -46,12 +46,12 @@ export declare const YcDialog: {
46
46
  M: {};
47
47
  Defaults: {};
48
48
  }, Readonly< ExtractPropTypes<{
49
- size: {
50
- type: PropType<DialogSize>;
51
- };
52
49
  width: {
53
50
  type: PropType<string | number>;
54
51
  };
52
+ size: {
53
+ type: PropType<DialogSize>;
54
+ };
55
55
  maxHeight: {
56
56
  type: PropType<string | number | false>;
57
57
  default: string;
@@ -68,12 +68,12 @@ export declare const YcDialog: {
68
68
  __isTeleport?: undefined;
69
69
  __isSuspense?: undefined;
70
70
  } & ComponentOptionsBase<Readonly< ExtractPropTypes<{
71
- size: {
72
- type: PropType<DialogSize>;
73
- };
74
71
  width: {
75
72
  type: PropType<string | number>;
76
73
  };
74
+ size: {
75
+ type: PropType<DialogSize>;
76
+ };
77
77
  maxHeight: {
78
78
  type: PropType<string | number | false>;
79
79
  default: string;
@@ -94,12 +94,12 @@ export declare const YcDialog: {
94
94
  });
95
95
  export declare const ReDialog: {
96
96
  new (...args: any[]): CreateComponentPublicInstance<Readonly< ExtractPropTypes<{
97
- size: {
98
- type: PropType<DialogSize>;
99
- };
100
97
  width: {
101
98
  type: PropType<string | number>;
102
99
  };
100
+ size: {
101
+ type: PropType<DialogSize>;
102
+ };
103
103
  maxHeight: {
104
104
  type: PropType<string | number | false>;
105
105
  default: string;
@@ -109,12 +109,12 @@ export declare const ReDialog: {
109
109
  default: boolean;
110
110
  };
111
111
  }>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{
112
- size: {
113
- type: PropType<DialogSize>;
114
- };
115
112
  width: {
116
113
  type: PropType<string | number>;
117
114
  };
115
+ size: {
116
+ type: PropType<DialogSize>;
117
+ };
118
118
  maxHeight: {
119
119
  type: PropType<string | number | false>;
120
120
  default: string;
@@ -134,12 +134,12 @@ export declare const ReDialog: {
134
134
  M: {};
135
135
  Defaults: {};
136
136
  }, Readonly< ExtractPropTypes<{
137
- size: {
138
- type: PropType<DialogSize>;
139
- };
140
137
  width: {
141
138
  type: PropType<string | number>;
142
139
  };
140
+ size: {
141
+ type: PropType<DialogSize>;
142
+ };
143
143
  maxHeight: {
144
144
  type: PropType<string | number | false>;
145
145
  default: string;
@@ -156,12 +156,12 @@ export declare const ReDialog: {
156
156
  __isTeleport?: undefined;
157
157
  __isSuspense?: undefined;
158
158
  } & ComponentOptionsBase<Readonly< ExtractPropTypes<{
159
- size: {
160
- type: PropType<DialogSize>;
161
- };
162
159
  width: {
163
160
  type: PropType<string | number>;
164
161
  };
162
+ size: {
163
+ type: PropType<DialogSize>;
164
+ };
165
165
  maxHeight: {
166
166
  type: PropType<string | number | false>;
167
167
  default: string;