@jetlinks-web/components 2.0.2-2 → 2.0.2-4

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 (225) hide show
  1. package/es/AMap/Map.js +124 -0
  2. package/es/AMap/index.js +2 -0
  3. package/es/AMap/util.js +56 -0
  4. package/es/BadgeStatus/Badge.js +54 -0
  5. package/es/BadgeStatus/color.js +21 -0
  6. package/es/BadgeStatus/index.js +3 -0
  7. package/es/CardSelect/CardSelect.js +123 -0
  8. package/es/CardSelect/index.js +2 -0
  9. package/es/CheckButton/CheckButton.js +121 -0
  10. package/es/CheckButton/index.js +2 -0
  11. package/es/ConfigProvider/context.js +12 -0
  12. package/es/ConfigProvider/index.js +31 -0
  13. package/es/Echarts/Echarts.js +47 -0
  14. package/es/Echarts/index.js +2 -0
  15. package/es/Ellipsis/Ellipsis.js +189 -0
  16. package/es/Ellipsis/index.js +2 -0
  17. package/es/Empty/Empty.js +56 -0
  18. package/es/Empty/image.js +2 -0
  19. package/es/Empty/index.js +2 -0
  20. package/es/FullPage/FullPage.js +31 -0
  21. package/es/FullPage/index.js +2 -0
  22. package/es/Icon/icon.js +43 -0
  23. package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
  24. package/es/MonacoEditor/Monaco.js +238 -0
  25. package/es/MonacoEditor/index.js +2 -0
  26. package/es/PermissionButton/index.js +117 -0
  27. package/es/ProLayout/Basic/BasicLayout.js +255 -0
  28. package/es/ProLayout/Basic/Header.js +93 -0
  29. package/es/ProLayout/PageContainer/index.js +318 -0
  30. package/es/ProLayout/PageContainer/typings.js +1 -0
  31. package/es/ProLayout/RouteContext.js +22 -0
  32. package/es/ProLayout/SiderMenu/BaseMenu.js +262 -0
  33. package/es/ProLayout/SiderMenu/SiderMenu.js +258 -0
  34. package/es/ProLayout/SiderMenu/index.js +2 -0
  35. package/es/ProLayout/SiderMenu/typings.js +1 -0
  36. package/es/ProLayout/TopHeader/index.js +155 -0
  37. package/es/ProLayout/defaultSettings.js +66 -0
  38. package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
  39. package/{src → es}/ProLayout/style/default.less +4 -4
  40. package/es/ProLayout/style/index.js +1 -0
  41. package/es/ProLayout/typings.js +1 -0
  42. package/es/ProLayout/util.js +61 -0
  43. package/es/ProTable/index.js +406 -0
  44. package/es/ProTable/proTableTypes.js +11 -0
  45. package/es/ProTable/style/index.css +65 -0
  46. package/es/ProTable/style/index.js +1 -0
  47. package/es/Scrollbar/Bar.js +114 -0
  48. package/es/Scrollbar/Scrollbar.js +100 -0
  49. package/es/Scrollbar/Thumb.js +10 -0
  50. package/es/Scrollbar/constants.js +1 -0
  51. package/es/Scrollbar/index.js +2 -0
  52. package/es/Scrollbar/util.js +30 -0
  53. package/es/Search/Advanced/History.js +183 -0
  54. package/es/Search/Advanced/SaveHistory.js +153 -0
  55. package/es/Search/Advanced/index.js +520 -0
  56. package/es/Search/Item.js +497 -0
  57. package/es/Search/Search.js +249 -0
  58. package/es/Search/hooks/index.js +1 -0
  59. package/es/Search/hooks/useSearchItems.js +40 -0
  60. package/es/Search/index.js +4 -0
  61. package/es/Search/setting.js +91 -0
  62. package/es/Search/typing.js +1 -0
  63. package/es/Search/util.js +234 -0
  64. package/es/ValueItem/ValueItem.js +233 -0
  65. package/es/ValueItem/index.js +2 -0
  66. package/es/ValueItem/util.js +16 -0
  67. package/es/index.js +24 -0
  68. package/es/style/index.js +3 -0
  69. package/es/style/variable.css +0 -0
  70. package/{src → es}/style/variable.less +0 -2
  71. package/lib/AMap/Map.js +124 -0
  72. package/lib/AMap/index.js +9 -0
  73. package/lib/AMap/util.js +62 -0
  74. package/lib/BadgeStatus/Badge.js +54 -0
  75. package/lib/BadgeStatus/color.js +27 -0
  76. package/lib/BadgeStatus/index.js +22 -0
  77. package/lib/CardSelect/CardSelect.js +123 -0
  78. package/lib/CardSelect/index.js +9 -0
  79. package/lib/CheckButton/CheckButton.js +121 -0
  80. package/lib/CheckButton/index.js +9 -0
  81. package/lib/ConfigProvider/context.js +19 -0
  82. package/lib/ConfigProvider/index.js +37 -0
  83. package/lib/Echarts/Echarts.js +47 -0
  84. package/lib/Echarts/index.js +9 -0
  85. package/lib/Ellipsis/Ellipsis.js +189 -0
  86. package/lib/Ellipsis/index.js +9 -0
  87. package/lib/Empty/Empty.js +56 -0
  88. package/lib/Empty/image.js +8 -0
  89. package/lib/Empty/index.js +9 -0
  90. package/lib/FullPage/FullPage.js +31 -0
  91. package/lib/FullPage/index.js +9 -0
  92. package/lib/Icon/icon.js +52 -0
  93. package/lib/Icon/index.js +9 -0
  94. package/lib/MonacoEditor/Monaco.js +238 -0
  95. package/lib/MonacoEditor/index.js +9 -0
  96. package/lib/PermissionButton/index.js +124 -0
  97. package/lib/ProLayout/Basic/BasicLayout.js +264 -0
  98. package/lib/ProLayout/Basic/BasicLayout.less +66 -0
  99. package/lib/ProLayout/Basic/Header.js +99 -0
  100. package/lib/ProLayout/Basic/Header.less +8 -0
  101. package/lib/ProLayout/PageContainer/index.js +323 -0
  102. package/lib/ProLayout/PageContainer/index.less +103 -0
  103. package/lib/ProLayout/PageContainer/typings.js +5 -0
  104. package/lib/ProLayout/RouteContext.js +28 -0
  105. package/lib/ProLayout/SiderMenu/BaseMenu.js +268 -0
  106. package/lib/ProLayout/SiderMenu/SiderMenu.js +267 -0
  107. package/lib/ProLayout/SiderMenu/index.js +20 -0
  108. package/lib/ProLayout/SiderMenu/index.less +212 -0
  109. package/lib/ProLayout/SiderMenu/typings.js +5 -0
  110. package/lib/ProLayout/TopHeader/index.js +161 -0
  111. package/lib/ProLayout/TopHeader/index.less +174 -0
  112. package/lib/ProLayout/defaultSettings.js +72 -0
  113. package/lib/ProLayout/index.js +16 -0
  114. package/lib/ProLayout/style/default.less +4 -0
  115. package/lib/ProLayout/style/index.js +3 -0
  116. package/lib/ProLayout/style/style.less +7 -0
  117. package/lib/ProLayout/typings.js +5 -0
  118. package/lib/ProLayout/util.js +72 -0
  119. package/lib/ProTable/index.js +412 -0
  120. package/lib/ProTable/proTableTypes.js +17 -0
  121. package/lib/ProTable/style/index.css +65 -0
  122. package/lib/ProTable/style/index.js +3 -0
  123. package/lib/ProTable/style/index.less +92 -0
  124. package/lib/Scrollbar/Bar.js +114 -0
  125. package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/Scrollbar.js} +106 -108
  126. package/lib/Scrollbar/Thumb.js +16 -0
  127. package/lib/Scrollbar/constants.js +7 -0
  128. package/lib/Scrollbar/index.js +9 -0
  129. package/lib/Scrollbar/util.js +37 -0
  130. package/lib/Search/Advanced/History.js +183 -0
  131. package/lib/Search/Advanced/SaveHistory.js +153 -0
  132. package/lib/Search/Advanced/index.js +520 -0
  133. package/lib/Search/Item.js +497 -0
  134. package/lib/Search/Search.js +249 -0
  135. package/lib/Search/hooks/index.js +16 -0
  136. package/lib/Search/hooks/useSearchItems.js +47 -0
  137. package/lib/Search/index.js +16 -0
  138. package/lib/Search/setting.js +97 -0
  139. package/lib/Search/typing.js +5 -0
  140. package/lib/Search/util.js +241 -0
  141. package/lib/ValueItem/ValueItem.js +233 -0
  142. package/lib/ValueItem/index.js +9 -0
  143. package/lib/ValueItem/util.js +22 -0
  144. package/lib/index.js +158 -0
  145. package/lib/style/components.less +1 -0
  146. package/lib/style/index.js +4 -0
  147. package/lib/style/variable.css +0 -0
  148. package/lib/style/variable.less +2 -0
  149. package/package.json +121 -12
  150. package/index.ts +0 -64
  151. package/src/AMap/Map.vue +0 -110
  152. package/src/AMap/index.ts +0 -1
  153. package/src/AMap/util.ts +0 -56
  154. package/src/BadgeStatus/Badge.vue +0 -41
  155. package/src/BadgeStatus/color.ts +0 -25
  156. package/src/BadgeStatus/index.ts +0 -4
  157. package/src/CardSelect/CardSelect.vue +0 -136
  158. package/src/CardSelect/index.ts +0 -3
  159. package/src/CheckButton/CheckButton.vue +0 -146
  160. package/src/CheckButton/index.md +0 -27
  161. package/src/CheckButton/index.ts +0 -3
  162. package/src/ConfigProvider/context.ts +0 -17
  163. package/src/ConfigProvider/index.tsx +0 -40
  164. package/src/Echarts/Echarts.vue +0 -43
  165. package/src/Echarts/index.ts +0 -3
  166. package/src/Ellipsis/Ellipsis.vue +0 -182
  167. package/src/Ellipsis/index.ts +0 -3
  168. package/src/Empty/Empty.vue +0 -43
  169. package/src/Empty/image.ts +0 -3
  170. package/src/Empty/index.ts +0 -2
  171. package/src/FullPage/FullPage.vue +0 -30
  172. package/src/FullPage/index.ts +0 -3
  173. package/src/Icon/icon.tsx +0 -40
  174. package/src/MonacoEditor/Monaco.vue +0 -242
  175. package/src/MonacoEditor/index.md +0 -26
  176. package/src/MonacoEditor/index.ts +0 -2
  177. package/src/PermissionButton/index.tsx +0 -110
  178. package/src/ProLayout/Basic/BasicLayout.tsx +0 -395
  179. package/src/ProLayout/Basic/Header.tsx +0 -115
  180. package/src/ProLayout/PageContainer/index.tsx +0 -441
  181. package/src/ProLayout/PageContainer/typings.ts +0 -56
  182. package/src/ProLayout/RouteContext.ts +0 -87
  183. package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
  184. package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
  185. package/src/ProLayout/SiderMenu/index.ts +0 -2
  186. package/src/ProLayout/SiderMenu/typings.ts +0 -49
  187. package/src/ProLayout/TopHeader/index.tsx +0 -210
  188. package/src/ProLayout/defaultSettings.ts +0 -106
  189. package/src/ProLayout/style/index.ts +0 -1
  190. package/src/ProLayout/typings.ts +0 -87
  191. package/src/ProLayout/util.ts +0 -64
  192. package/src/ProTable/index.md +0 -53
  193. package/src/ProTable/index.tsx +0 -551
  194. package/src/ProTable/proTableTypes.ts +0 -70
  195. package/src/ProTable/style/index.ts +0 -1
  196. package/src/Scrollbar/Bar.vue +0 -75
  197. package/src/Scrollbar/Scrollbar.vue +0 -260
  198. package/src/Scrollbar/Thumb.vue +0 -163
  199. package/src/Scrollbar/constants.ts +0 -10
  200. package/src/Scrollbar/index.ts +0 -4
  201. package/src/Scrollbar/thumb.ts +0 -16
  202. package/src/Scrollbar/util.ts +0 -38
  203. package/src/Search/Advanced/History.vue +0 -140
  204. package/src/Search/Advanced/SaveHistory.vue +0 -108
  205. package/src/Search/Advanced/index.vue +0 -435
  206. package/src/Search/Item.vue +0 -525
  207. package/src/Search/Search.vue +0 -398
  208. package/src/Search/hooks/index.ts +0 -1
  209. package/src/Search/hooks/useSearchItems.ts +0 -68
  210. package/src/Search/index.md +0 -57
  211. package/src/Search/index.ts +0 -5
  212. package/src/Search/setting.ts +0 -55
  213. package/src/Search/typing.ts +0 -76
  214. package/src/Search/util.ts +0 -263
  215. package/src/ValueItem/ValueItem.vue +0 -192
  216. package/src/ValueItem/index.ts +0 -3
  217. package/src/ValueItem/util.ts +0 -16
  218. package/src/style/index.ts +0 -3
  219. /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
  220. /package/{src → es}/ProLayout/Basic/Header.less +0 -0
  221. /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
  222. /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
  223. /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
  224. /package/{src → es}/ProLayout/style/style.less +0 -0
  225. /package/{src → es}/ProTable/style/index.less +0 -0
@@ -0,0 +1,406 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import { resolveDirective as _resolveDirective, createTextVNode as _createTextVNode, createVNode as _createVNode } from "vue";
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ import { Empty, AIcon } from '../index';
7
+ import { Table, Pagination, Button, Alert, Spin, RadioGroup, RadioButton } from 'ant-design-vue';
8
+ import { tableProps as _tableProps } from 'ant-design-vue/es/table';
9
+ import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';
10
+ import { ModelEnum } from './proTableTypes';
11
+ import { get, debounce, isArray } from 'lodash-es';
12
+ var tableProps = function tableProps() {
13
+ return _objectSpread(_objectSpread({}, _tableProps()), {}, {
14
+ loading: {
15
+ type: Boolean,
16
+ default: undefined
17
+ },
18
+ request: {
19
+ type: Function,
20
+ default: undefined
21
+ },
22
+ cardBodyClass: {
23
+ type: String,
24
+ default: ''
25
+ },
26
+ bodyStyle: {
27
+ type: Object,
28
+ default: {}
29
+ },
30
+ columns: {
31
+ type: Array,
32
+ default: function _default() {
33
+ return [];
34
+ }
35
+ },
36
+ model: {
37
+ type: [String, undefined],
38
+ default: undefined
39
+ },
40
+ modelValue: {
41
+ type: String,
42
+ default: undefined
43
+ },
44
+ noPagination: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ rowSelection: {
49
+ type: Object,
50
+ default: function _default() {
51
+ return undefined;
52
+ }
53
+ },
54
+ dataSource: {
55
+ type: Array,
56
+ default: function _default() {
57
+ return [];
58
+ }
59
+ },
60
+ gridColumns: {
61
+ type: Array,
62
+ default: function _default() {
63
+ return [];
64
+ }
65
+ },
66
+ gridColumn: {
67
+ type: Number,
68
+ default: 4
69
+ },
70
+ alertRender: {
71
+ type: Boolean,
72
+ default: true
73
+ },
74
+ params: {
75
+ type: Object,
76
+ default: function _default() {}
77
+ },
78
+ type: {
79
+ type: String,
80
+ default: 'PAGE'
81
+ },
82
+ scroll: {
83
+ type: Object,
84
+ default: function _default() {
85
+ x: 1366;
86
+ }
87
+ },
88
+ defaultParams: {
89
+ type: Object,
90
+ default: function _default() {}
91
+ },
92
+ rowKey: {
93
+ type: [String, Function],
94
+ default: 'id'
95
+ },
96
+ pagination: {
97
+ type: Object,
98
+ default: function _default() {
99
+ return {
100
+ showSizeChanger: true,
101
+ showQuickJumper: false,
102
+ size: 'size',
103
+ pageSizeOptions: ['12', '24', '48', '96']
104
+ };
105
+ }
106
+ }
107
+ });
108
+ };
109
+ var ProTable = defineComponent({
110
+ name: 'ProTable',
111
+ slots: ['headerTitle', 'card', 'rightExtraRender', 'paginationRender' // 分页
112
+ ],
113
+ props: tableProps(),
114
+ emits: ['update:modelValue', 'modelChange'],
115
+ setup: function setup(props, _ref) {
116
+ var _props$pagination;
117
+ var slots = _ref.slots,
118
+ expose = _ref.expose,
119
+ emit = _ref.emit;
120
+ var _model = ref(props.model ? props.model : ModelEnum.CARD); // 模式切换
121
+ var _dataSource = ref([]);
122
+ var pageIndex = ref(0);
123
+ var pageSize = ref(12);
124
+ var total = ref(0);
125
+ var _loading = ref(false);
126
+ var column = ref(props.gridColumn || 4);
127
+ if (!props.noPagination && props.pagination && isArray((_props$pagination = props.pagination) === null || _props$pagination === void 0 ? void 0 : _props$pagination.pageSizeOptions)) {
128
+ pageSize.value = props.pagination.pageSizeOptions[0];
129
+ }
130
+ /**
131
+ * 监听宽度,计算显示卡片个数
132
+ */
133
+ var windowChange = function windowChange() {
134
+ if (window.innerWidth <= 1440) {
135
+ var _props$gridColumns;
136
+ var _column = props.gridColumn && props.gridColumn < 2 ? props.gridColumn : 2;
137
+ column.value = (_props$gridColumns = props.gridColumns) !== null && _props$gridColumns !== void 0 && _props$gridColumns[0] ? props.gridColumns[0] : _column;
138
+ } else if (window.innerWidth > 1440 && window.innerWidth <= 1600) {
139
+ var _props$gridColumns2;
140
+ var _column2 = props.gridColumn && props.gridColumn < 3 ? props.gridColumn : 3;
141
+ column.value = (_props$gridColumns2 = props.gridColumns) !== null && _props$gridColumns2 !== void 0 && _props$gridColumns2[1] ? props.gridColumns[1] : _column2;
142
+ } else if (window.innerWidth > 1600) {
143
+ var _props$gridColumns3;
144
+ var _column3 = props.gridColumn && props.gridColumn < 4 ? props.gridColumn : 4;
145
+ column.value = (_props$gridColumns3 = props.gridColumns) !== null && _props$gridColumns3 !== void 0 && _props$gridColumns3[2] ? props.gridColumns[2] : _column3;
146
+ }
147
+ };
148
+ var handleSearch = /*#__PURE__*/function () {
149
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_params) {
150
+ var _props$defaultParams, resp, _resp$result, _resp$result2, _resp$result3, _resp$result4, _resp$result4$data, _resp$result5, _resp$result6, _resp$result7, _resp$result8;
151
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
152
+ while (1) switch (_context.prev = _context.next) {
153
+ case 0:
154
+ _loading.value = props.loading !== undefined ? props.loading : true;
155
+ if (!props.request) {
156
+ _context.next = 9;
157
+ break;
158
+ }
159
+ console.log(_params);
160
+ _context.next = 5;
161
+ return props.request(_objectSpread(_objectSpread(_objectSpread({
162
+ pageIndex: 0,
163
+ pageSize: Number(pageSize.value)
164
+ }, props.defaultParams), _params), {}, {
165
+ terms: [].concat(_toConsumableArray(((_props$defaultParams = props.defaultParams) === null || _props$defaultParams === void 0 ? void 0 : _props$defaultParams.terms) || []), _toConsumableArray((_params === null || _params === void 0 ? void 0 : _params.terms) || []))
166
+ })).catch(function () {
167
+ _loading.value = props.loading !== undefined ? props.loading : false;
168
+ });
169
+ case 5:
170
+ resp = _context.sent;
171
+ if (resp.status === 200) {
172
+ if (props.type === 'PAGE') {
173
+ // 判断如果是最后一页且最后一页为空,就跳转到前一页
174
+ if (resp !== null && resp !== void 0 && (_resp$result = resp.result) !== null && _resp$result !== void 0 && _resp$result.total && resp !== null && resp !== void 0 && (_resp$result2 = resp.result) !== null && _resp$result2 !== void 0 && _resp$result2.pageSize && resp !== null && resp !== void 0 && (_resp$result3 = resp.result) !== null && _resp$result3 !== void 0 && _resp$result3.pageIndex && (resp === null || resp === void 0 ? void 0 : (_resp$result4 = resp.result) === null || _resp$result4 === void 0 ? void 0 : (_resp$result4$data = _resp$result4.data) === null || _resp$result4$data === void 0 ? void 0 : _resp$result4$data.length) === 0) {
175
+ pageIndex.value = pageIndex.value > 0 ? pageIndex.value - 1 : 0;
176
+ handleSearch(_objectSpread(_objectSpread({}, _params), {}, {
177
+ pageSize: pageSize.value,
178
+ pageIndex: pageIndex.value
179
+ }));
180
+ } else {
181
+ _dataSource.value = (resp === null || resp === void 0 ? void 0 : (_resp$result5 = resp.result) === null || _resp$result5 === void 0 ? void 0 : _resp$result5.data) || [];
182
+ pageIndex.value = (resp === null || resp === void 0 ? void 0 : (_resp$result6 = resp.result) === null || _resp$result6 === void 0 ? void 0 : _resp$result6.pageIndex) || 0;
183
+ pageSize.value = (resp === null || resp === void 0 ? void 0 : (_resp$result7 = resp.result) === null || _resp$result7 === void 0 ? void 0 : _resp$result7.pageSize) || 12;
184
+ total.value = (resp === null || resp === void 0 ? void 0 : (_resp$result8 = resp.result) === null || _resp$result8 === void 0 ? void 0 : _resp$result8.total) || 0;
185
+ }
186
+ } else {
187
+ _dataSource.value = (resp === null || resp === void 0 ? void 0 : resp.result) || [];
188
+ }
189
+ } else {
190
+ _dataSource.value = [];
191
+ }
192
+ _context.next = 10;
193
+ break;
194
+ case 9:
195
+ _dataSource.value = (props === null || props === void 0 ? void 0 : props.dataSource) || [];
196
+ case 10:
197
+ _loading.value = props.loading !== undefined ? props.loading : false;
198
+ case 11:
199
+ case "end":
200
+ return _context.stop();
201
+ }
202
+ }, _callee);
203
+ }));
204
+ return function handleSearch(_x) {
205
+ return _ref2.apply(this, arguments);
206
+ };
207
+ }();
208
+ var _debounceFn = debounce(handleSearch, 300);
209
+ watch(function () {
210
+ return props.params;
211
+ }, function (newValue) {
212
+ _debounceFn(newValue || {});
213
+ }, {
214
+ deep: true,
215
+ immediate: true
216
+ });
217
+ watch(function () {
218
+ return props.dataSource;
219
+ }, function (newVal) {
220
+ if (newVal && !props.request) {
221
+ handleSearch(props.params);
222
+ }
223
+ }, {
224
+ deep: true,
225
+ immediate: true
226
+ });
227
+ watch(function () {
228
+ return props.modelValue;
229
+ }, function () {
230
+ if (props.modelValue) {
231
+ _model.value = props.modelValue;
232
+ }
233
+ }, {
234
+ immediate: true
235
+ });
236
+ /**
237
+ * 刷新数据
238
+ * @param _params
239
+ */
240
+ var reload = function reload(_params) {
241
+ handleSearch(_objectSpread(_objectSpread(_objectSpread({}, props.params), _params), {}, {
242
+ pageSize: pageSize.value || 12,
243
+ pageIndex: pageIndex.value || 0
244
+ }));
245
+ };
246
+ onMounted(function () {
247
+ windowChange(); // 初始化
248
+ window.onresize = function () {
249
+ windowChange();
250
+ };
251
+ });
252
+ onUnmounted(function () {
253
+ window.onresize = null;
254
+ });
255
+ /**
256
+ * 导出方法
257
+ */
258
+ expose({
259
+ reload: reload,
260
+ _dataSource: _dataSource
261
+ });
262
+ return function () {
263
+ var _props$rowSelection, _props$rowSelection$s, _props$rowSelection2, _props$rowSelection2$;
264
+ return _createVNode("div", {
265
+ "class": "jtable-body-spin",
266
+ "style": _objectSpread({}, props.bodyStyle)
267
+ }, [_createVNode(Spin, {
268
+ "spinning": _loading.value
269
+ }, {
270
+ default: function _default() {
271
+ return [_createVNode("div", {
272
+ "class": 'jtable-body'
273
+ }, [_createVNode("div", {
274
+ "class": 'jtable-body-header'
275
+ }, [_createVNode("div", {
276
+ "class": 'jtable-body-header-left'
277
+ }, [slots.headerTitle && slots.headerTitle()]), _createVNode("div", {
278
+ "class": 'jtable-body-header-right'
279
+ }, [slots.rightExtraRender && slots.rightExtraRender(), !props.model && _createVNode("div", {
280
+ "class": 'jtable-body-header-right-button'
281
+ }, [_createVNode(RadioGroup, {
282
+ "class": "jtable-body-header-right-button",
283
+ "value": _model.value,
284
+ "onChange": function onChange(e) {
285
+ _model.value = e.target.value;
286
+ emit('update:modelValue', e.target.value);
287
+ emit('modelChange', e.target.value);
288
+ }
289
+ }, {
290
+ default: function _default() {
291
+ return [_createVNode(RadioButton, {
292
+ "value": ModelEnum.TABLE
293
+ }, {
294
+ default: function _default() {
295
+ return [_createVNode(AIcon, {
296
+ "class": 'right-button-icon',
297
+ "type": "UnorderedListOutlined"
298
+ }, null)];
299
+ }
300
+ }), _createVNode(RadioButton, {
301
+ "value": ModelEnum.CARD
302
+ }, {
303
+ default: function _default() {
304
+ return [_createVNode(AIcon, {
305
+ "class": 'right-button-icon',
306
+ "type": "AppstoreOutlined"
307
+ }, null)];
308
+ }
309
+ })];
310
+ }
311
+ })])])]), _createVNode("div", {
312
+ "class": 'jtable-content'
313
+ }, [props.alertRender && props !== null && props !== void 0 && props.rowSelection && props !== null && props !== void 0 && (_props$rowSelection = props.rowSelection) !== null && _props$rowSelection !== void 0 && _props$rowSelection.selectedRowKeys && (_props$rowSelection$s = props.rowSelection.selectedRowKeys) !== null && _props$rowSelection$s !== void 0 && _props$rowSelection$s.length ? _createVNode("div", {
314
+ "class": 'jtable-alert'
315
+ }, [_createVNode(Alert, {
316
+ "message": '已选择' + (props === null || props === void 0 ? void 0 : (_props$rowSelection2 = props.rowSelection) === null || _props$rowSelection2 === void 0 ? void 0 : (_props$rowSelection2$ = _props$rowSelection2.selectedRowKeys) === null || _props$rowSelection2$ === void 0 ? void 0 : _props$rowSelection2$.length) + '项',
317
+ "type": "info",
318
+ "onClose": function onClose() {
319
+ var _props$rowSelection3, _props$rowSelection3$, _props$rowSelection4, _props$rowSelection4$;
320
+ // if (props.rowSelection?.onSelectNone) {
321
+ // // 取消选择清空被选数据
322
+ // }
323
+ (_props$rowSelection3 = props.rowSelection) === null || _props$rowSelection3 === void 0 ? void 0 : (_props$rowSelection3$ = _props$rowSelection3.onChange) === null || _props$rowSelection3$ === void 0 ? void 0 : _props$rowSelection3$.call(_props$rowSelection3, [], []);
324
+ (_props$rowSelection4 = props.rowSelection) === null || _props$rowSelection4 === void 0 ? void 0 : (_props$rowSelection4$ = _props$rowSelection4.onSelectNone) === null || _props$rowSelection4$ === void 0 ? void 0 : _props$rowSelection4$.call(_props$rowSelection4);
325
+ },
326
+ "closeText": _createVNode(Button, {
327
+ "type": "link"
328
+ }, {
329
+ default: function _default() {
330
+ return [_createTextVNode("\u53D6\u6D88\u9009\u62E9")];
331
+ }
332
+ })
333
+ }, null)]) : null, _model.value === ModelEnum.CARD ? _createVNode("div", {
334
+ "class": 'jtable-card',
335
+ "style": props.scroll && props.scroll.y ? {
336
+ maxHeight: props.scroll.y + 'px',
337
+ overflow: 'auto'
338
+ } : undefined
339
+ }, [_dataSource.value.length ? _createVNode("div", {
340
+ "class": 'jtable-card-items',
341
+ "style": {
342
+ gridTemplateColumns: "repeat(".concat(column.value, ", 1fr)")
343
+ }
344
+ }, [_dataSource.value.map(function (item) {
345
+ return slots.card ? _createVNode("div", {
346
+ "class": ['jtable-card-item', props.cardBodyClass]
347
+ }, [slots.card(item)]) : null;
348
+ })]) : _createVNode("div", {
349
+ "class": "j-table-empty"
350
+ }, [_createVNode(Empty, null, null)])]) : _createVNode("div", null, [_createVNode(Table, _objectSpread(_objectSpread({}, props), {}, {
351
+ "dataSource": _dataSource.value,
352
+ "columns": props.columns.filter(function (i) {
353
+ return !(i !== null && i !== void 0 && i.hideInTable);
354
+ }),
355
+ "pagination": false,
356
+ "rowSelection": props.rowSelection,
357
+ "scroll": props.scroll
358
+ }), {
359
+ headerCell: function headerCell(dt) {
360
+ var column = dt.column,
361
+ title = dt.title;
362
+ if (column !== null && column !== void 0 && column.headerCell) {
363
+ return slots === null || slots === void 0 ? void 0 : slots[column === null || column === void 0 ? void 0 : column.headerCell](column.title);
364
+ } else {
365
+ return title || '';
366
+ }
367
+ },
368
+ bodyCell: function bodyCell(dt) {
369
+ var column = dt.column,
370
+ record = dt.record;
371
+ if ((column !== null && column !== void 0 && column.key || column !== null && column !== void 0 && column.dataIndex) && column !== null && column !== void 0 && column.scopedSlots && (slots !== null && slots !== void 0 && slots[column === null || column === void 0 ? void 0 : column.dataIndex] || slots !== null && slots !== void 0 && slots[column === null || column === void 0 ? void 0 : column.key])) {
372
+ var _key = (column === null || column === void 0 ? void 0 : column.key) || (column === null || column === void 0 ? void 0 : column.dataIndex);
373
+ return slots === null || slots === void 0 ? void 0 : slots[_key](record);
374
+ } else {
375
+ var _value = get(record, column === null || column === void 0 ? void 0 : column.dataIndex);
376
+ // 获取数据
377
+ return _value;
378
+ }
379
+ },
380
+ emptyText: function emptyText() {
381
+ return _createVNode(Empty, null, null);
382
+ }
383
+ })])]), !!_dataSource.value.length && !props.noPagination && props.type === 'PAGE' && _createVNode("div", {
384
+ "class": 'jtable-pagination'
385
+ }, [slots !== null && slots !== void 0 && slots.paginationRender ? slots.paginationRender() : _createVNode(Pagination, _objectSpread(_objectSpread({}, props.pagination), {}, {
386
+ "total": total.value,
387
+ "current": pageIndex.value + 1,
388
+ "pageSize": pageSize.value,
389
+ "showTotal": function showTotal(num) {
390
+ var minSize = pageIndex.value * pageSize.value + 1;
391
+ var MaxSize = (pageIndex.value + 1) * pageSize.value;
392
+ return "\u7B2C ".concat(minSize, " - ").concat(MaxSize > num ? num : MaxSize, " \u6761/\u603B\u5171 ").concat(num, " \u6761");
393
+ },
394
+ "onChange": function onChange(page, size) {
395
+ handleSearch(_objectSpread(_objectSpread({}, props.params), {}, {
396
+ pageSize: size,
397
+ pageIndex: pageSize.value === size ? page ? page - 1 : 0 : 0
398
+ }));
399
+ }
400
+ }), null)])])];
401
+ }
402
+ })]);
403
+ };
404
+ }
405
+ });
406
+ export default ProTable;
@@ -0,0 +1,11 @@
1
+ import 'vue';
2
+ export var TypeEnum;
3
+ (function (TypeEnum) {
4
+ TypeEnum["TREE"] = "TREE";
5
+ TypeEnum["PAGE"] = "PAGE";
6
+ })(TypeEnum || (TypeEnum = {}));
7
+ export var ModelEnum;
8
+ (function (ModelEnum) {
9
+ ModelEnum["TABLE"] = "TABLE";
10
+ ModelEnum["CARD"] = "CARD";
11
+ })(ModelEnum || (ModelEnum = {}));
@@ -0,0 +1,65 @@
1
+ .jtable-body-spin {
2
+ min-height: 100%;
3
+ width: 100%;
4
+ padding: 16px 24px 24px;
5
+ background-color: #fff;
6
+ }
7
+ .jtable-body-spin .ant-spin-nested-loading {
8
+ height: 100%;
9
+ }
10
+ .jtable-body-spin .ant-spin-nested-loading .ant-spin-container {
11
+ height: 100%;
12
+ }
13
+ .jtable-body-spin .jtable-body {
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ height: 100%;
17
+ display: flex;
18
+ flex-direction: column;
19
+ }
20
+ .jtable-body-spin .jtable-body .jtable-body-header {
21
+ display: flex;
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ }
25
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right {
26
+ display: flex;
27
+ gap: 8px;
28
+ align-items: center;
29
+ }
30
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right .jtable-body-header-right-button .right-button-icon {
31
+ font-size: 16px;
32
+ color: #d9d9d9;
33
+ }
34
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right .jtable-body-header-right-button .ant-radio-button-wrapper {
35
+ padding: 0 8px;
36
+ }
37
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right .jtable-body-header-right-button .ant-radio-button-wrapper-checked .right-button-icon {
38
+ color: #315EFB;
39
+ }
40
+ .jtable-body-spin .jtable-body .jtable-content {
41
+ flex: 1;
42
+ padding: 16px 0;
43
+ }
44
+ .jtable-body-spin .jtable-body .jtable-content .jtable-alert {
45
+ margin-bottom: 16px;
46
+ }
47
+ .jtable-body-spin .jtable-body .jtable-content .jtable-card .jtable-card-items {
48
+ display: grid;
49
+ grid-gap: 26px;
50
+ }
51
+ .jtable-body-spin .jtable-body .jtable-content .jtable-card .jtable-card-items .jtable-card-item {
52
+ display: flex;
53
+ min-width: 0;
54
+ }
55
+ .jtable-body-spin .jtable-body .jtable-pagination {
56
+ width: 100%;
57
+ display: flex;
58
+ justify-content: flex-end;
59
+ }
60
+ .jtable-body-spin .jtable-body .j-table-empty {
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ margin: 10% 0;
65
+ }
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,114 @@
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
+ "always": "props",
19
+ "minSize": "props",
20
+ "inject": "setup-const",
21
+ "ref": "setup-const",
22
+ "GAP": "setup-maybe-ref",
23
+ "Thumb": "setup-const",
24
+ "scrollbarContextKey": "setup-maybe-ref",
25
+ "props": "setup-reactive-const",
26
+ "scrollbar": "setup-maybe-ref",
27
+ "moveX": "setup-ref",
28
+ "moveY": "setup-ref",
29
+ "sizeWidth": "setup-ref",
30
+ "sizeHeight": "setup-ref",
31
+ "ratioY": "setup-ref",
32
+ "ratioX": "setup-ref",
33
+ "handleScroll": "setup-const",
34
+ "update": "setup-const"
35
+ } */
36
+ import { defineComponent as _defineComponent } from 'vue';
37
+ import { createVNode as _createVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
38
+ import { inject, ref } from 'vue';
39
+ import { GAP } from './util';
40
+ import Thumb from './Thumb.js';
41
+ import { scrollbarContextKey } from './constants';
42
+ const __sfc_main__ = _defineComponent({
43
+ props: {
44
+ always: {
45
+ type: Boolean,
46
+ default: true,
47
+ },
48
+ minSize: {
49
+ type: Number,
50
+ required: true,
51
+ }
52
+ },
53
+ setup(__props, { expose: __expose }) {
54
+ const props = __props;
55
+ const scrollbar = inject(scrollbarContextKey);
56
+ const moveX = ref(0);
57
+ const moveY = ref(0);
58
+ const sizeWidth = ref('');
59
+ const sizeHeight = ref('');
60
+ const ratioY = ref(1);
61
+ const ratioX = ref(1);
62
+ const handleScroll = (wrap) => {
63
+ if (wrap) {
64
+ const offsetHeight = wrap.offsetHeight - GAP;
65
+ const offsetWidth = wrap.offsetWidth - GAP;
66
+ moveY.value = ((wrap.scrollTop * 100) / offsetHeight) * ratioY.value;
67
+ moveX.value = ((wrap.scrollLeft * 100) / offsetWidth) * ratioX.value;
68
+ }
69
+ };
70
+ const update = () => {
71
+ const wrap = _optionalChain([scrollbar, 'optionalAccess', _ => _.wrapElement]);
72
+ if (!wrap)
73
+ return;
74
+ const offsetHeight = wrap.offsetHeight - GAP;
75
+ const offsetWidth = wrap.offsetWidth - GAP;
76
+ const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
77
+ const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
78
+ const height = Math.max(originalHeight, props.minSize);
79
+ const width = Math.max(originalWidth, props.minSize);
80
+ ratioY.value =
81
+ originalHeight /
82
+ (offsetHeight - originalHeight) /
83
+ (height / (offsetHeight - height));
84
+ ratioX.value =
85
+ originalWidth /
86
+ (offsetWidth - originalWidth) /
87
+ (width / (offsetWidth - width));
88
+ sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
89
+ sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
90
+ };
91
+ __expose({
92
+ handleScroll,
93
+ update,
94
+ });
95
+ return (_ctx, _cache) => {
96
+ return (_openBlock(), _createElementBlock(_Fragment, null, [
97
+ _createVNode(Thumb, {
98
+ move: moveX.value,
99
+ ratio: ratioX.value,
100
+ size: sizeWidth.value,
101
+ always: __props.always
102
+ }, null, 8 /* PROPS */, ["move", "ratio", "size", "always"]),
103
+ _createVNode(Thumb, {
104
+ move: moveY.value,
105
+ ratio: ratioY.value,
106
+ size: sizeHeight.value,
107
+ vertical: "",
108
+ always: __props.always
109
+ }, null, 8 /* PROPS */, ["move", "ratio", "size", "always"])
110
+ ], 64 /* STABLE_FRAGMENT */));
111
+ };
112
+ }
113
+ });
114
+ export default __sfc_main__;