@jetlinks-web/components 3.0.1-rc → 3.1.0

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 (294) hide show
  1. package/es/AutoComplete/AutoComplete.js +13 -9
  2. package/es/BadgeStatus/Badge.js +1 -2
  3. package/es/BadgeStatus/color.js +3 -3
  4. package/es/CardSelect/CardSelect.js +23 -13
  5. package/es/CardSelect/style/index.js +25 -1
  6. package/es/CheckButton/CheckButton.js +12 -4
  7. package/es/CheckButton/style/index.js +41 -1
  8. package/es/DragModal/DragModal.js +14 -8
  9. package/es/DragModal/style/index.js +64 -1
  10. package/es/EditTable/Body.js +10 -3
  11. package/es/EditTable/EditTable.js +13 -7
  12. package/es/EditTable/FormItem.js +18 -19
  13. package/es/EditTable/Header.js +16 -6
  14. package/es/EditTable/components/ContextMenu/Menu.js +11 -5
  15. package/es/EditTable/components/Search/search.js +1 -2
  16. package/es/EditTable/components/Search/sort.js +1 -3
  17. package/es/EditTable/group.js +23 -18
  18. package/es/EditTable/hooks/useValidate.js +1 -1
  19. package/es/EditTable/style/body.js +53 -0
  20. package/es/EditTable/style/form.js +24 -0
  21. package/es/EditTable/style/group.js +25 -0
  22. package/es/EditTable/style/header.js +58 -0
  23. package/es/EditTable/style/index.js +42 -1
  24. package/es/EditTable/style/menu.js +27 -0
  25. package/es/EditTable/style/table.js +46 -0
  26. package/es/EditTable/utils.js +30 -3
  27. package/es/Ellipsis/Ellipsis.js +10 -2
  28. package/es/Ellipsis/style/index.js +24 -1
  29. package/es/FullPage/FullPage.js +1 -2
  30. package/es/LocaleProvider/index.js +1 -2
  31. package/es/PermissionButton/index.js +6 -7
  32. package/es/ProLayout/Basic/BasicLayout.js +45 -41
  33. package/es/ProLayout/Basic/BasicLayoutStyle.js +39 -0
  34. package/es/ProLayout/Basic/Header.js +3 -7
  35. package/es/ProLayout/Basic/HeaderStyle.js +10 -0
  36. package/es/ProLayout/PageContainer/index.js +21 -17
  37. package/es/ProLayout/PageContainer/style.js +46 -0
  38. package/es/ProLayout/SiderMenu/BaseMenu.js +18 -42
  39. package/es/ProLayout/SiderMenu/SiderMenu.js +24 -36
  40. package/es/ProLayout/SiderMenu/style.js +166 -0
  41. package/es/ProLayout/TopHeader/index.js +13 -12
  42. package/es/ProLayout/TopHeader/style.js +126 -0
  43. package/es/ProLayout/style/index.js +7 -1
  44. package/es/ProLayout/util.js +5 -5
  45. package/es/ProTable/Alert.js +12 -4
  46. package/es/ProTable/Content.js +166 -45
  47. package/es/ProTable/Header.js +21 -11
  48. package/es/ProTable/Pagination.js +28 -11
  49. package/es/ProTable/ProTable.js +104 -46
  50. package/es/ProTable/hooks/index.js +2 -0
  51. package/es/ProTable/hooks/useTableInject.js +5 -0
  52. package/es/ProTable/hooks/useTableSelection.js +95 -0
  53. package/es/ProTable/setting.js +24 -1
  54. package/es/ProTable/style/index.js +109 -1
  55. package/es/RadioButton/RadioButton.js +10 -4
  56. package/es/RadioButton/style/index.js +23 -1
  57. package/es/Scrollbar/Scrollbar.js +10 -3
  58. package/es/Scrollbar/Thumb.js +36 -25
  59. package/es/Scrollbar/style/index.js +63 -1
  60. package/es/Search/Advanced/History.js +23 -16
  61. package/es/Search/Advanced/SaveHistory.js +1 -2
  62. package/es/Search/Advanced/index.js +212 -292
  63. package/es/Search/Item.js +175 -415
  64. package/es/Search/Search.js +78 -172
  65. package/es/Search/hooks/index.js +108 -1
  66. package/es/Search/hooks/useRouteQuery.js +57 -0
  67. package/es/Search/setting.js +132 -14
  68. package/es/Search/style/index.js +4 -2
  69. package/es/Search/style/item.js +28 -0
  70. package/es/Search/style/search.js +133 -0
  71. package/es/Search/util.js +116 -124
  72. package/es/Skeleton/components/DashBoardCard.js +19 -12
  73. package/es/Skeleton/components/DashBoardChart.js +48 -45
  74. package/es/Skeleton/components/Detail.js +27 -21
  75. package/es/Skeleton/components/Drawer.js +23 -14
  76. package/es/Skeleton/components/Item.js +9 -1
  77. package/es/Skeleton/components/List.js +0 -1
  78. package/es/Skeleton/components/ListCard.js +20 -13
  79. package/es/Skeleton/components/ListCardItem.js +12 -13
  80. package/es/Skeleton/components/ListTable.js +19 -10
  81. package/es/Skeleton/components/Page.js +0 -1
  82. package/es/Skeleton/components/Tree.js +21 -14
  83. package/es/Skeleton/skeleton.js +17 -8
  84. package/es/Skeleton/style/index.js +132 -1
  85. package/es/Title/style/index.js +29 -1
  86. package/es/Title/title.js +13 -5
  87. package/es/ValueItem/ValueItem.js +44 -39
  88. package/es/VirtualTable/VirtualTable.js +398 -0
  89. package/es/VirtualTable/data.js +36 -0
  90. package/es/VirtualTable/index.js +5 -0
  91. package/es/VirtualTable/style/index.js +32 -0
  92. package/es/components.js +1 -4
  93. package/es/locale/en-US.js +6 -8
  94. package/es/locale/zh-CN.js +6 -8
  95. package/es/style/index.js +0 -3
  96. package/es/style/styleRegister.js +21 -0
  97. package/es/style/variable.js +4 -0
  98. package/es/style.js +0 -13
  99. package/lib/AutoComplete/AutoComplete.js +13 -9
  100. package/lib/BadgeStatus/Badge.js +1 -2
  101. package/lib/BadgeStatus/color.js +3 -3
  102. package/lib/CardSelect/CardSelect.js +23 -13
  103. package/lib/CardSelect/style/index.js +30 -1
  104. package/lib/CheckButton/CheckButton.js +12 -4
  105. package/lib/CheckButton/style/index.js +46 -1
  106. package/lib/DragModal/DragModal.js +14 -8
  107. package/lib/DragModal/style/index.js +69 -1
  108. package/lib/EditTable/Body.js +10 -3
  109. package/lib/EditTable/EditTable.js +13 -7
  110. package/lib/EditTable/FormItem.js +18 -19
  111. package/lib/EditTable/Header.js +16 -6
  112. package/lib/EditTable/components/ContextMenu/Menu.js +11 -5
  113. package/lib/EditTable/components/Search/search.js +1 -2
  114. package/lib/EditTable/components/Search/sort.js +1 -3
  115. package/lib/EditTable/group.js +23 -18
  116. package/lib/EditTable/hooks/useValidate.js +1 -1
  117. package/lib/EditTable/style/body.js +60 -0
  118. package/lib/EditTable/style/form.js +31 -0
  119. package/lib/EditTable/style/group.js +32 -0
  120. package/lib/EditTable/style/header.js +65 -0
  121. package/lib/EditTable/style/index.js +47 -1
  122. package/lib/EditTable/style/menu.js +33 -0
  123. package/lib/EditTable/style/table.js +52 -0
  124. package/lib/EditTable/utils.js +31 -3
  125. package/lib/Ellipsis/Ellipsis.js +10 -2
  126. package/lib/Ellipsis/style/index.js +29 -1
  127. package/lib/FullPage/FullPage.js +1 -2
  128. package/lib/Icon/icon.js +1 -2
  129. package/lib/LocaleProvider/index.js +1 -2
  130. package/lib/PermissionButton/index.js +6 -7
  131. package/lib/ProLayout/Basic/BasicLayout.js +45 -42
  132. package/lib/ProLayout/Basic/BasicLayoutStyle.js +46 -0
  133. package/lib/ProLayout/Basic/Header.js +2 -6
  134. package/lib/ProLayout/Basic/HeaderStyle.js +17 -0
  135. package/lib/ProLayout/PageContainer/index.js +19 -15
  136. package/lib/ProLayout/PageContainer/style.js +53 -0
  137. package/lib/ProLayout/SiderMenu/BaseMenu.js +19 -42
  138. package/lib/ProLayout/SiderMenu/SiderMenu.js +24 -37
  139. package/lib/ProLayout/SiderMenu/style.js +173 -0
  140. package/lib/ProLayout/TopHeader/index.js +14 -12
  141. package/lib/ProLayout/TopHeader/style.js +133 -0
  142. package/lib/ProLayout/style/index.js +12 -1
  143. package/lib/ProLayout/util.js +5 -5
  144. package/lib/ProTable/Alert.js +12 -4
  145. package/lib/ProTable/Content.js +166 -45
  146. package/lib/ProTable/Header.js +21 -11
  147. package/lib/ProTable/Pagination.js +28 -11
  148. package/lib/ProTable/ProTable.js +104 -46
  149. package/lib/ProTable/hooks/index.js +27 -0
  150. package/lib/ProTable/hooks/useTableInject.js +11 -0
  151. package/lib/ProTable/hooks/useTableSelection.js +102 -0
  152. package/lib/ProTable/setting.js +24 -1
  153. package/lib/ProTable/style/index.js +114 -1
  154. package/lib/RadioButton/RadioButton.js +10 -4
  155. package/lib/RadioButton/style/index.js +28 -1
  156. package/lib/Scrollbar/Scrollbar.js +10 -3
  157. package/lib/Scrollbar/Thumb.js +36 -25
  158. package/lib/Scrollbar/style/index.js +68 -1
  159. package/lib/Search/Advanced/History.js +23 -16
  160. package/lib/Search/Advanced/SaveHistory.js +1 -2
  161. package/lib/Search/Advanced/index.js +212 -292
  162. package/lib/Search/Item.js +175 -415
  163. package/lib/Search/Search.js +78 -172
  164. package/lib/Search/hooks/index.js +130 -1
  165. package/lib/Search/hooks/useRouteQuery.js +64 -0
  166. package/lib/Search/setting.js +133 -15
  167. package/lib/Search/style/index.js +9 -2
  168. package/lib/Search/style/item.js +35 -0
  169. package/lib/Search/style/search.js +140 -0
  170. package/lib/Search/util.js +116 -124
  171. package/lib/Skeleton/components/DashBoardCard.js +19 -12
  172. package/lib/Skeleton/components/DashBoardChart.js +48 -45
  173. package/lib/Skeleton/components/Detail.js +27 -21
  174. package/lib/Skeleton/components/Drawer.js +23 -14
  175. package/lib/Skeleton/components/Item.js +9 -1
  176. package/lib/Skeleton/components/List.js +0 -1
  177. package/lib/Skeleton/components/ListCard.js +20 -13
  178. package/lib/Skeleton/components/ListCardItem.js +12 -13
  179. package/lib/Skeleton/components/ListTable.js +19 -10
  180. package/lib/Skeleton/components/Page.js +0 -1
  181. package/lib/Skeleton/components/Tree.js +21 -14
  182. package/lib/Skeleton/skeleton.js +17 -8
  183. package/lib/Skeleton/style/index.js +137 -1
  184. package/lib/Title/style/index.js +34 -1
  185. package/lib/Title/title.js +13 -5
  186. package/lib/ValueItem/ValueItem.js +44 -39
  187. package/lib/VirtualTable/VirtualTable.js +398 -0
  188. package/lib/VirtualTable/data.js +43 -0
  189. package/lib/VirtualTable/index.js +12 -0
  190. package/lib/VirtualTable/style/index.js +39 -0
  191. package/lib/components.js +8 -30
  192. package/lib/index.js +1 -2
  193. package/lib/locale/en-US.js +6 -8
  194. package/lib/locale/zh-CN.js +6 -8
  195. package/lib/style/components.less +0 -1
  196. package/lib/style/index.js +1 -4
  197. package/lib/style/styleRegister.js +28 -0
  198. package/lib/style/variable.js +10 -0
  199. package/lib/style.js +1 -15
  200. package/package.json +170 -173
  201. package/es/AMap/Map.js +0 -133
  202. package/es/AMap/index.js +0 -5
  203. package/es/AMap/util.js +0 -56
  204. package/es/CardSelect/style/index.css +0 -24
  205. package/es/CardSelect/style/index.less +0 -26
  206. package/es/CheckButton/style/index.css +0 -37
  207. package/es/CheckButton/style/index.less +0 -40
  208. package/es/DragModal/style/index.css +0 -82
  209. package/es/DragModal/style/index.less +0 -97
  210. package/es/Echarts/Echarts.js +0 -48
  211. package/es/Echarts/index.js +0 -5
  212. package/es/EditTable/style/body.less +0 -66
  213. package/es/EditTable/style/form.less +0 -33
  214. package/es/EditTable/style/group.less +0 -32
  215. package/es/EditTable/style/header.less +0 -77
  216. package/es/EditTable/style/index.css +0 -267
  217. package/es/EditTable/style/index.less +0 -41
  218. package/es/EditTable/style/menu.less +0 -25
  219. package/es/EditTable/style/table.less +0 -47
  220. package/es/Ellipsis/style/index.css +0 -17
  221. package/es/Ellipsis/style/index.less +0 -20
  222. package/es/FlameGraph/FlameGraph.js +0 -136
  223. package/es/FlameGraph/index.js +0 -5
  224. package/es/FlameGraph/style/index.css +0 -43
  225. package/es/FlameGraph/style/index.js +0 -1
  226. package/es/FlameGraph/style/index.less +0 -52
  227. package/es/ProLayout/Basic/BasicLayout.less +0 -66
  228. package/es/ProLayout/Basic/Header.less +0 -8
  229. package/es/ProLayout/PageContainer/index.less +0 -103
  230. package/es/ProLayout/SiderMenu/index.less +0 -231
  231. package/es/ProLayout/TopHeader/index.less +0 -174
  232. package/es/ProLayout/style/default.less +0 -4
  233. package/es/ProLayout/style/style.less +0 -7
  234. package/es/ProTable/style/ProTable.less +0 -139
  235. package/es/RadioButton/style/index.css +0 -20
  236. package/es/RadioButton/style/index.less +0 -19
  237. package/es/Scrollbar/style/index.css +0 -65
  238. package/es/Scrollbar/style/index.less +0 -83
  239. package/es/Search/style/Item.less +0 -33
  240. package/es/Search/style/Search.less +0 -179
  241. package/es/Skeleton/style/Skeleton.less +0 -166
  242. package/es/Title/style/index.css +0 -27
  243. package/es/Title/style/index.less +0 -27
  244. package/es/style/index.css +0 -5375
  245. package/es/style/index.less +0 -14
  246. package/es/style/variable.css +0 -4
  247. package/es/style/variable.less +0 -4
  248. package/lib/AMap/Map.js +0 -133
  249. package/lib/AMap/index.js +0 -12
  250. package/lib/AMap/util.js +0 -62
  251. package/lib/CardSelect/style/index.css +0 -24
  252. package/lib/CardSelect/style/index.less +0 -26
  253. package/lib/CheckButton/style/index.css +0 -37
  254. package/lib/CheckButton/style/index.less +0 -40
  255. package/lib/DragModal/style/index.css +0 -82
  256. package/lib/DragModal/style/index.less +0 -97
  257. package/lib/Echarts/Echarts.js +0 -48
  258. package/lib/Echarts/index.js +0 -12
  259. package/lib/EditTable/style/body.less +0 -66
  260. package/lib/EditTable/style/form.less +0 -33
  261. package/lib/EditTable/style/group.less +0 -32
  262. package/lib/EditTable/style/header.less +0 -77
  263. package/lib/EditTable/style/index.css +0 -267
  264. package/lib/EditTable/style/index.less +0 -41
  265. package/lib/EditTable/style/menu.less +0 -25
  266. package/lib/EditTable/style/table.less +0 -47
  267. package/lib/Ellipsis/style/index.css +0 -17
  268. package/lib/Ellipsis/style/index.less +0 -20
  269. package/lib/FlameGraph/FlameGraph.js +0 -136
  270. package/lib/FlameGraph/index.js +0 -12
  271. package/lib/FlameGraph/style/index.css +0 -43
  272. package/lib/FlameGraph/style/index.js +0 -3
  273. package/lib/FlameGraph/style/index.less +0 -52
  274. package/lib/ProLayout/Basic/BasicLayout.less +0 -66
  275. package/lib/ProLayout/Basic/Header.less +0 -8
  276. package/lib/ProLayout/PageContainer/index.less +0 -103
  277. package/lib/ProLayout/SiderMenu/index.less +0 -231
  278. package/lib/ProLayout/TopHeader/index.less +0 -174
  279. package/lib/ProLayout/style/default.less +0 -4
  280. package/lib/ProLayout/style/style.less +0 -7
  281. package/lib/ProTable/style/ProTable.less +0 -139
  282. package/lib/RadioButton/style/index.css +0 -20
  283. package/lib/RadioButton/style/index.less +0 -19
  284. package/lib/Scrollbar/style/index.css +0 -65
  285. package/lib/Scrollbar/style/index.less +0 -83
  286. package/lib/Search/style/Item.less +0 -33
  287. package/lib/Search/style/Search.less +0 -179
  288. package/lib/Skeleton/style/Skeleton.less +0 -166
  289. package/lib/Title/style/index.css +0 -27
  290. package/lib/Title/style/index.less +0 -27
  291. package/lib/style/index.css +0 -5375
  292. package/lib/style/index.less +0 -14
  293. package/lib/style/variable.css +0 -4
  294. package/lib/style/variable.less +0 -4
@@ -0,0 +1,398 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "dataSource": "props",
19
+ "columns": "props",
20
+ "expandedRowKeys": "props",
21
+ "rowSelection": "props",
22
+ "rowKey": "props",
23
+ "height": "props",
24
+ "findAllChildren": "setup-maybe-ref",
25
+ "flattenTree": "setup-maybe-ref",
26
+ "isNumber": "setup-maybe-ref",
27
+ "map": "setup-maybe-ref",
28
+ "omit": "setup-maybe-ref",
29
+ "h": "setup-const",
30
+ "computed": "setup-const",
31
+ "ref": "setup-const",
32
+ "watch": "setup-const",
33
+ "onMounted": "setup-const",
34
+ "nextTick": "setup-const",
35
+ "Table": "setup-maybe-ref",
36
+ "Checkbox": "setup-maybe-ref",
37
+ "AIcon": "setup-maybe-ref",
38
+ "useVirtualTableStyle": "setup-maybe-ref",
39
+ "useLocaleReceiver": "setup-maybe-ref",
40
+ "props": "setup-reactive-const",
41
+ "emits": "setup-const",
42
+ "prefixCls": "setup-ref",
43
+ "wrapSSR": "setup-maybe-ref",
44
+ "hashId": "setup-maybe-ref",
45
+ "contextLocale": "setup-maybe-ref",
46
+ "container": "setup-ref",
47
+ "rowHeights": "setup-ref",
48
+ "prefixSum": "setup-ref",
49
+ "start": "setup-ref",
50
+ "end": "setup-ref",
51
+ "offsetY": "setup-ref",
52
+ "buffer": "literal-const",
53
+ "selectedAll": "setup-ref",
54
+ "visibleNodes": "setup-ref",
55
+ "flattenData": "setup-ref",
56
+ "firstColumn": "setup-ref",
57
+ "totalHeight": "setup-ref",
58
+ "visibleRows": "setup-ref",
59
+ "_indeterminate": "setup-ref",
60
+ "viewportHeight": "setup-ref",
61
+ "_columns": "setup-ref",
62
+ "_rowSelection": "setup-ref",
63
+ "onSelectedAllChange": "setup-const",
64
+ "onScroll": "setup-const",
65
+ "toggleExpand": "setup-const",
66
+ "updatePrefixSum": "setup-const",
67
+ "updateVisibleNodes": "setup-const"
68
+ } */
69
+ import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createElementBlock as _createElementBlock, renderSlot as _renderSlot, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeStyle as _normalizeStyle, Fragment as _Fragment, normalizeClass as _normalizeClass } from "vue";
70
+ const _hoisted_1 = { class: "virtual-table-header" };
71
+ const _hoisted_2 = {
72
+ key: 0,
73
+ class: "virtual-table-all-selected"
74
+ };
75
+ const _hoisted_3 = ["onClick"];
76
+ import { findAllChildren, flattenTree } from "./data";
77
+ import { isNumber, map, omit } from "lodash-es";
78
+ import { h, computed, ref, watch, onMounted, nextTick } from 'vue';
79
+ import { Table, Checkbox } from 'ant-design-vue';
80
+ import AIcon from '../Icon';
81
+ import useVirtualTableStyle from './style';
82
+ import { useLocaleReceiver } from "../LocaleReciver";
83
+ const buffer = 5;
84
+ const __sfc_main__ = Object.assign({
85
+ name: 'JVirtualTable'
86
+ }, {
87
+ props: {
88
+ dataSource: {
89
+ type: Array,
90
+ default: () => []
91
+ },
92
+ columns: {
93
+ type: Array,
94
+ default: () => []
95
+ },
96
+ expandedRowKeys: {
97
+ type: Array,
98
+ default: () => []
99
+ },
100
+ rowSelection: {
101
+ type: Object
102
+ },
103
+ rowKey: {
104
+ type: [String, Function],
105
+ default: 'id',
106
+ },
107
+ height: {
108
+ type: Number,
109
+ default: 500
110
+ }
111
+ },
112
+ emits: ['update:expandedRowKeys'],
113
+ setup(__props, { emit: __emit }) {
114
+ const props = __props;
115
+ const emits = __emit;
116
+ const prefixCls = computed(() => 'virtual-table');
117
+ const [wrapSSR, hashId] = useVirtualTableStyle(prefixCls);
118
+ const [contextLocale] = useLocaleReceiver('ProTable');
119
+ const container = ref(null);
120
+ const rowHeights = ref([]);
121
+ const prefixSum = ref([]);
122
+ const start = ref(0);
123
+ const end = ref(15);
124
+ const offsetY = ref(0);
125
+ const selectedAll = ref(false);
126
+ // 被展开的所有数据
127
+ const visibleNodes = ref([]);
128
+ const flattenData = ref([]);
129
+ const firstColumn = computed(() => props.columns[0]);
130
+ const totalHeight = computed(() => prefixSum.value.length ? prefixSum.value[prefixSum.value.length - 1] : 0);
131
+ const visibleRows = computed(() => visibleNodes.value.slice(start.value, end.value));
132
+ const _indeterminate = computed(() => !selectedAll.value && _optionalChain([props, 'access', _2 => _2.rowSelection, 'optionalAccess', _3 => _3.selectedRowKeys, 'optionalAccess', _4 => _4.length]) > 0);
133
+ const viewportHeight = computed(() => props.height || 500);
134
+ const _columns = computed(() => {
135
+ const arr = [];
136
+ if (props.rowSelection) {
137
+ const _width = props.rowSelection.columnWidth || 32;
138
+ arr.push({
139
+ key: '__selection__',
140
+ title: contextLocale.value.select.all,
141
+ dataIndex: '__selection__',
142
+ width: isNumber(_width) ? `${_width}px` : _width,
143
+ customHeaderCell: (props) => {
144
+ return {
145
+ class: 'ant-table-selection-column',
146
+ };
147
+ }
148
+ }); //
149
+ }
150
+ arr.push(...props.columns);
151
+ return arr;
152
+ });
153
+ const _rowSelection = computed(() => {
154
+ return props.rowSelection ? {
155
+ ...props.rowSelection,
156
+ onSelect: (record, selected, selectedRows, nativeEvent) => {
157
+ const _selectedRowKeys = props.rowSelection.selectedRowKeys || [];
158
+ const _set = new Set([..._selectedRowKeys]);
159
+ if (props.rowSelection.type === 'radio') {
160
+ _set.clear();
161
+ _set.add(record[props.rowKey]);
162
+ }
163
+ else {
164
+ const _checkStrictly = props.rowSelection.checkStrictly !== undefined ? props.rowSelection.checkStrictly : true;
165
+ let __arr = [];
166
+ if (_checkStrictly) { // 需要获取子
167
+ __arr = [record[props.rowKey]];
168
+ }
169
+ else {
170
+ __arr = map(findAllChildren(flattenData.value, record[props.rowKey]), props.rowKey);
171
+ __arr.push(record[props.rowKey]);
172
+ }
173
+ if (selected) {
174
+ __arr.forEach(i => _set.add(i));
175
+ }
176
+ else {
177
+ __arr.forEach(i => _set.delete(i));
178
+ }
179
+ }
180
+ const _selectedRows = flattenData.value.filter(i => _set.has(i[props.rowKey])).map(item => omit(item, ['expanded', 'hasChildren', 'visible']));
181
+ if (props.rowSelection.onSelect) {
182
+ props.rowSelection.onSelect(record, selected, _selectedRows, nativeEvent);
183
+ }
184
+ if (props.rowSelection.onChange) {
185
+ props.rowSelection.onChange([..._set], _selectedRows);
186
+ }
187
+ },
188
+ onChange: () => {
189
+ },
190
+ onSelectAll: () => {
191
+ },
192
+ onSelectNone: () => {
193
+ if (props.rowSelection.onSelectNone) {
194
+ props.rowSelection.onSelectNone();
195
+ }
196
+ }
197
+ } : undefined;
198
+ });
199
+ const onSelectedAllChange = (e) => {
200
+ const selected = e.target.checked;
201
+ const arr = flattenData.value.map(i => omit(i, ['expanded', 'hasChildren', 'visible']));
202
+ const _checked = selected;
203
+ const _selectedRowKeys = _checked ? map(arr, props.rowKey) : [];
204
+ if (props.rowSelection.onSelectAll) {
205
+ props.rowSelection.onSelectAll(_checked, _checked ? arr : []);
206
+ }
207
+ if (props.rowSelection.onChange) {
208
+ props.rowSelection.onChange(_selectedRowKeys, _checked ? arr : []);
209
+ }
210
+ };
211
+ const onScroll = (e) => {
212
+ const scrollTop = e.target.scrollTop;
213
+ const vh = viewportHeight.value || 500;
214
+ // 二分查找
215
+ let low = 0, high = prefixSum.value.length - 1;
216
+ while (low < high) {
217
+ let mid = Math.floor((low + high) / 2);
218
+ if (prefixSum.value[mid] <= scrollTop)
219
+ low = mid + 1;
220
+ else
221
+ high = mid;
222
+ }
223
+ start.value = Math.max(0, low - 1);
224
+ // 计算 end
225
+ let y = prefixSum.value[start.value] || 0;
226
+ let i = start.value;
227
+ while (i < visibleNodes.value.length && y < scrollTop + vh) {
228
+ y += rowHeights.value[i] || 40;
229
+ i++;
230
+ }
231
+ end.value = Math.min(i + buffer, visibleNodes.value.length);
232
+ offsetY.value = prefixSum.value[start.value - 1] || 0;
233
+ };
234
+ const toggleExpand = (row) => {
235
+ row.expanded = !row.expanded;
236
+ const stack = [...flattenData.value.filter(n => n.parentId === row[props.rowKey])];
237
+ while (stack.length) {
238
+ const child = stack.pop();
239
+ child.visible = row.expanded;
240
+ if (!child.visible) {
241
+ child.expanded = false;
242
+ }
243
+ if (!row.expanded && child.hasChildren) {
244
+ stack.push(...flattenData.value.filter(n => n.parentId === child[props.rowKey]));
245
+ }
246
+ }
247
+ updateVisibleNodes();
248
+ };
249
+ const updatePrefixSum = () => {
250
+ rowHeights.value = visibleNodes.value.map(() => 40); // 默认行高
251
+ prefixSum.value = [];
252
+ let sum = 0;
253
+ for (let h of rowHeights.value) {
254
+ sum += h;
255
+ prefixSum.value.push(sum);
256
+ }
257
+ };
258
+ const updateVisibleNodes = () => {
259
+ visibleNodes.value = flattenData.value.filter(i => i.visible);
260
+ updatePrefixSum();
261
+ nextTick(() => onScroll({ target: container.value }));
262
+ };
263
+ watch(() => [JSON.stringify(props.dataSource), JSON.stringify(props.expandedRowKeys)], () => {
264
+ flattenData.value = flattenTree(props.dataSource, 0, null);
265
+ flattenData.value.forEach(i => {
266
+ if (props.expandedRowKeys.includes(i[props.rowKey])) {
267
+ toggleExpand(i);
268
+ // i.expanded = true
269
+ }
270
+ });
271
+ updateVisibleNodes();
272
+ }, {
273
+ immediate: true
274
+ });
275
+ // watch(() => props.expandedRowKeys, () => {
276
+ // flattenData.value.forEach(i => {
277
+ // if (props.expandedRowKeys.includes(i[props.rowKey])) {
278
+ // toggleExpand(i)
279
+ // // i.expanded = true
280
+ // }
281
+ // })
282
+ // updateVisibleNodes()
283
+ // }, {
284
+ // immediate: true
285
+ // })
286
+ watch(() => _optionalChain([props, 'access', _5 => _5.rowSelection, 'optionalAccess', _6 => _6.selectedRowKeys]), (val) => {
287
+ if (val) {
288
+ selectedAll.value = val.length > 0 && flattenData.value.length === val.length;
289
+ }
290
+ }, {
291
+ immediate: true
292
+ });
293
+ onMounted(() => {
294
+ updateVisibleNodes();
295
+ });
296
+ return (_ctx, _cache) => {
297
+ return (_openBlock(), _createElementBlock("div", {
298
+ class: _normalizeClass(['virtual-table-wrapper', _unref(hashId)])
299
+ }, [
300
+ _createElementVNode("div", _hoisted_1, [
301
+ _createVNode(_unref(Table), {
302
+ columns: _columns.value,
303
+ pagination: false,
304
+ rowKey: __props.rowKey,
305
+ "data-source": [],
306
+ components: {
307
+ body: {
308
+ wrapper: () => h('div')
309
+ },
310
+ }
311
+ }, {
312
+ headerCell: _withCtx(({ column, title }) => [
313
+ (column.key === '__selection__')
314
+ ? (_openBlock(), _createElementBlock("span", _hoisted_2, [
315
+ (__props.rowSelection.type !== 'radio' && !__props.rowSelection.hideSelectAll)
316
+ ? (_openBlock(), _createBlock(_unref(Checkbox), {
317
+ key: 0,
318
+ checked: selectedAll.value,
319
+ "onUpdate:checked": _cache[0] || (_cache[0] = $event => ((selectedAll).value = $event)),
320
+ onChange: onSelectedAllChange,
321
+ indeterminate: _indeterminate.value,
322
+ disabled: visibleRows.value.length === 0
323
+ }, null, 8 /* PROPS */, ["checked", "indeterminate", "disabled"]))
324
+ : _createCommentVNode("v-if", true),
325
+ _createElementVNode("span", null, _toDisplayString(_optionalChain([__props, 'access', _7 => _7.rowSelection, 'optionalAccess', _8 => _8.columnTitle])), 1 /* TEXT */)
326
+ ]))
327
+ : _renderSlot(_ctx.$slots, "headerCell", {
328
+ key: 1,
329
+ title: title,
330
+ column: column
331
+ }, () => [
332
+ _createTextVNode(_toDisplayString(title), 1 /* TEXT */)
333
+ ])
334
+ ]),
335
+ _: 3 /* FORWARDED */
336
+ }, 8 /* PROPS */, ["columns", "rowKey", "components"])
337
+ ]),
338
+ _createElementVNode("div", {
339
+ class: "virtual-table-body",
340
+ ref_key: "container",
341
+ ref: container,
342
+ onScroll: onScroll,
343
+ style: _normalizeStyle({ height: `${viewportHeight.value}px` })
344
+ }, [
345
+ _createElementVNode("div", {
346
+ class: "virtual-table-height",
347
+ style: _normalizeStyle({ height: totalHeight.value + 'px' })
348
+ }, null, 4 /* STYLE */),
349
+ _createElementVNode("div", {
350
+ class: "virtual-table-visible-box",
351
+ style: _normalizeStyle({ transform: `translateY(${offsetY.value}px)`, position: 'absolute', top: 0, left: 0, right: 0 })
352
+ }, [
353
+ _createVNode(_unref(Table), {
354
+ columns: __props.columns,
355
+ rowKey: __props.rowKey,
356
+ "data-source": visibleRows.value,
357
+ showHeader: false,
358
+ pagination: false,
359
+ rowSelection: _rowSelection.value
360
+ }, {
361
+ bodyCell: _withCtx(({ text, record, index, column }) => [
362
+ (column.dataIndex === firstColumn.value.dataIndex || column.key === firstColumn.value.key)
363
+ ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
364
+ _createElementVNode("span", {
365
+ class: "ant-table-row-indent indent-level-3",
366
+ style: _normalizeStyle({ paddingLeft: `${record.level * 15}px` })
367
+ }, null, 4 /* STYLE */),
368
+ _createElementVNode("span", {
369
+ class: "virtual-table-row-expand-icon",
370
+ onClick: $event => (toggleExpand(record))
371
+ }, [
372
+ (record.hasChildren)
373
+ ? (_openBlock(), _createBlock(_unref(AIcon), {
374
+ key: 0,
375
+ type: !record.expanded ? 'PlusSquareOutlined' : 'MinusSquareOutlined'
376
+ }, null, 8 /* PROPS */, ["type"]))
377
+ : _createCommentVNode("v-if", true)
378
+ ], 8 /* PROPS */, _hoisted_3)
379
+ ], 64 /* STABLE_FRAGMENT */))
380
+ : _createCommentVNode("v-if", true),
381
+ _renderSlot(_ctx.$slots, "bodyCell", {
382
+ text: text,
383
+ record: record,
384
+ index: index,
385
+ column: column
386
+ }, () => [
387
+ _createTextVNode(_toDisplayString(text || '--'), 1 /* TEXT */)
388
+ ])
389
+ ]),
390
+ _: 3 /* FORWARDED */
391
+ }, 8 /* PROPS */, ["columns", "rowKey", "data-source", "rowSelection"])
392
+ ], 4 /* STYLE */)
393
+ ], 36 /* STYLE, NEED_HYDRATION */)
394
+ ], 2 /* CLASS */));
395
+ };
396
+ }
397
+ });
398
+ export default __sfc_main__;
@@ -0,0 +1,36 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ // 扁平化数据
4
+ import { omit } from "lodash-es";
5
+ var _flattenTree = function flattenTree(tree) {
6
+ var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
7
+ var parentId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
8
+ return tree.flatMap(function (item) {
9
+ var _item$children;
10
+ var flatNode = _objectSpread(_objectSpread({}, omit(item, 'children')), {}, {
11
+ level: level,
12
+ parentId: parentId,
13
+ expanded: false,
14
+ hasChildren: ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0,
15
+ visible: level === 0
16
+ });
17
+ var children = item.children ? _flattenTree(item.children, level + 1, item.id) : [];
18
+ return [flatNode].concat(_toConsumableArray(children));
19
+ });
20
+ };
21
+ export { _flattenTree as flattenTree };
22
+ export var findAllChildren = function findAllChildren() {
23
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
24
+ var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
25
+ var result = [];
26
+ function recursive(pid) {
27
+ data.forEach(function (item) {
28
+ if (item.parentId === pid) {
29
+ result.push(item);
30
+ recursive(item.id); // 递归查找这个子节点的孩子
31
+ }
32
+ });
33
+ }
34
+ recursive(parentId);
35
+ return result;
36
+ };
@@ -0,0 +1,5 @@
1
+ import VirtualTable from './VirtualTable.js';
2
+ VirtualTable.install = function (app) {
3
+ app.component(VirtualTable.name, VirtualTable);
4
+ };
5
+ export default VirtualTable;
@@ -0,0 +1,32 @@
1
+ import genCompoentStyle from "../../style/styleRegister";
2
+ var genVirtualTableStyle = function genVirtualTableStyle() {
3
+ return {
4
+ '.virtual-table-wrapper': {
5
+ display: 'flex',
6
+ 'flex-direction': 'column',
7
+ '.virtual-table-header': {
8
+ '.ant-table': {
9
+ '.ant-table-container': {
10
+ '.ant-table-content': {
11
+ '.ant-table-tbody': {
12
+ display: 'none'
13
+ }
14
+ }
15
+ }
16
+ }
17
+ },
18
+ '.virtual-table-body': {
19
+ 'overflow-y': 'auto',
20
+ position: 'relative',
21
+ 'min-height': '100px'
22
+ },
23
+ '.virtual-table-row-expand-icon': {
24
+ 'margin-right': '8px',
25
+ 'font-size': 'relative',
26
+ width: '16px',
27
+ display: 'inline-block'
28
+ }
29
+ }
30
+ };
31
+ };
32
+ export default genCompoentStyle([genVirtualTableStyle]);
package/es/components.js CHANGED
@@ -1,9 +1,7 @@
1
- export { default as Map } from './AMap';
2
1
  export { default as BadgeStatus } from './BadgeStatus';
3
2
  export { default as CardSelect } from './CardSelect';
4
3
  export { default as CheckButton } from './CheckButton';
5
4
  export { default as ConfigProvider } from './ConfigProvider';
6
- export { default as Echarts } from './Echarts';
7
5
  export { default as Ellipsis } from './Ellipsis';
8
6
  export { default as Empty } from './Empty';
9
7
  export { default as FullPage } from './FullPage';
@@ -20,5 +18,4 @@ export { default as EditTable } from './EditTable';
20
18
  export { default as Markdown } from './Markdown';
21
19
  export { default as AutoComplete } from './AutoComplete';
22
20
  export { default as Title } from './Title';
23
- export { default as FlameGraph } from './FlameGraph';
24
- export { default as Skeleton } from './Skeleton';
21
+ export { default as VirtualTable } from './VirtualTable';
@@ -46,11 +46,16 @@ export default {
46
46
  },
47
47
  ProTable: {
48
48
  pagination: {
49
- total: 'Articles {0} - {1}/Total of {2}'
49
+ page: 'Articles {0} - {1}/Total of',
50
+ total: '',
51
+ lastPage: 'It is already the last page'
50
52
  },
51
53
  alert: {
52
54
  cancelChoose: 'Cancel selection',
53
55
  selectItem: 'Select {0} items'
56
+ },
57
+ select: {
58
+ all: 'Select all'
54
59
  }
55
60
  },
56
61
  ProLayout: {
@@ -58,9 +63,6 @@ export default {
58
63
  back: 'Back'
59
64
  }
60
65
  },
61
- AMap: {
62
- description: 'Please configure the Amap key for Gaode'
63
- },
64
66
  EditTable: {
65
67
  serial: 'Serial',
66
68
  columns: {
@@ -114,9 +116,5 @@ export default {
114
116
  },
115
117
  PermissionButton: {
116
118
  hasPermission: 'No permission, please contact the administrator'
117
- },
118
- FlameGraph: {
119
- placeholder: 'Please input',
120
- revert: 'Revert'
121
119
  }
122
120
  };
@@ -46,11 +46,16 @@ export default {
46
46
  },
47
47
  ProTable: {
48
48
  pagination: {
49
- total: "\u7B2C {0} - {1} \u6761/\u603B\u5171 {2} \u6761"
49
+ page: "\u7B2C {0} - {1} \u6761/\u603B\u5171",
50
+ total: '条',
51
+ lastPage: '已是最后一页'
50
52
  },
51
53
  alert: {
52
54
  cancelChoose: '取消选择',
53
55
  selectItem: '已选择 {0} 项'
56
+ },
57
+ select: {
58
+ all: '全选'
54
59
  }
55
60
  },
56
61
  ProLayout: {
@@ -58,9 +63,6 @@ export default {
58
63
  back: '返回'
59
64
  }
60
65
  },
61
- AMap: {
62
- description: '请配置高德地图key'
63
- },
64
66
  EditTable: {
65
67
  serial: '序号',
66
68
  columns: {
@@ -114,9 +116,5 @@ export default {
114
116
  },
115
117
  PermissionButton: {
116
118
  hasPermission: '暂无权限,请联系管理员'
117
- },
118
- FlameGraph: {
119
- placeholder: '请输入',
120
- revert: '反转'
121
119
  }
122
120
  };
package/es/style/index.js CHANGED
@@ -1,3 +0,0 @@
1
- import '../ProLayout/style';
2
- import '../ProTable/style';
3
- import '../ProLayout/style';
@@ -0,0 +1,21 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import { genComponentStyleHook } from 'ant-design-vue/es/theme/internal';
4
+ import { theme } from 'ant-design-vue';
5
+ import variableToken from './variable';
6
+ var genCompoentStyle = function genCompoentStyle(styleFn) {
7
+ return genComponentStyleHook('jetlinks-components', function (_token) {
8
+ var _theme$useToken = theme.useToken(),
9
+ token = _theme$useToken.token,
10
+ hashId = _theme$useToken.hashId;
11
+ var componentToken = {
12
+ token: _objectSpread(_objectSpread({}, _token), variableToken),
13
+ hashId: hashId.value,
14
+ componentCls: ".".concat(_token.prefixCls)
15
+ };
16
+ return _toConsumableArray(styleFn.map(function (item) {
17
+ return item(componentToken);
18
+ }));
19
+ });
20
+ };
21
+ export default genCompoentStyle;
@@ -0,0 +1,4 @@
1
+ export default {
2
+ textColorTitle: '#000',
3
+ textColorSubtitle: '#263237'
4
+ };
package/es/style.js CHANGED
@@ -1,13 +0,0 @@
1
- import './Ellipsis/style';
2
- import './CheckButton/style';
3
- import './ProLayout/style';
4
- import './ProTable/style';
5
- import './Search/style';
6
- import './CardSelect/style';
7
- import './DragModal/style';
8
- import './EditTable/style';
9
- import './Scrollbar/style';
10
- import './Title/style';
11
- import './RadioButton/style';
12
- import './FlameGraph/style';
13
- import './Skeketon/style';