@teamix/pro 1.5.0 → 1.5.1

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 (69) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +1103 -123
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/index.d.ts +4 -0
  6. package/es/actions/index.js +34 -9
  7. package/es/actions/index.scss +5 -0
  8. package/es/card/index.scss +7 -0
  9. package/es/index.d.ts +1 -1
  10. package/es/index.js +1 -1
  11. package/es/sidebar/components/tree-node/components/IconSwitch/index.d.ts +2 -2
  12. package/es/sidebar/components/tree-node/components/IconSwitch/index.scss +1 -1
  13. package/es/sidebar/index.d.ts +2 -0
  14. package/es/sidebar/index.js +3 -1
  15. package/es/table/components/CardView/index.d.ts +5 -0
  16. package/es/table/components/CardView/index.js +446 -0
  17. package/es/table/components/CardView/index.scss +46 -0
  18. package/es/table/components/Filter/index.d.ts +1 -0
  19. package/es/table/components/Filter/index.js +21 -14
  20. package/es/table/components/Layout/index.js +4 -2
  21. package/es/table/components/LoadMore/index.d.ts +20 -0
  22. package/es/table/components/LoadMore/index.js +107 -0
  23. package/es/table/components/LoadMore/index.scss +19 -0
  24. package/es/table/components/QuickAction/index.d.ts +1 -0
  25. package/es/table/components/ToolBar/CardSwitch.d.ts +8 -0
  26. package/es/table/components/ToolBar/CardSwitch.js +63 -0
  27. package/es/table/components/ToolBar/FilterColumnIcon.js +13 -2
  28. package/es/table/components/ToolBar/Fullscreen.js +15 -2
  29. package/es/table/components/ToolBar/index.js +64 -33
  30. package/es/table/components/ToolBar/index.scss +10 -1
  31. package/es/table/index.js +132 -34
  32. package/es/table/typing.d.ts +69 -0
  33. package/es/table/utils/columnRender.d.ts +1 -1
  34. package/es/table/utils/columnRender.js +4 -2
  35. package/es/table/utils/genProColumnToColumn.d.ts +1 -1
  36. package/es/table/utils/genProColumnToColumn.js +3 -1
  37. package/lib/actions/index.d.ts +4 -0
  38. package/lib/actions/index.js +33 -9
  39. package/lib/actions/index.scss +5 -0
  40. package/lib/card/index.scss +7 -0
  41. package/lib/index.d.ts +1 -1
  42. package/lib/index.js +1 -1
  43. package/lib/sidebar/components/tree-node/components/IconSwitch/index.d.ts +2 -2
  44. package/lib/sidebar/components/tree-node/components/IconSwitch/index.scss +1 -1
  45. package/lib/sidebar/index.d.ts +2 -0
  46. package/lib/sidebar/index.js +12 -1
  47. package/lib/table/components/CardView/index.d.ts +5 -0
  48. package/lib/table/components/CardView/index.js +468 -0
  49. package/lib/table/components/CardView/index.scss +46 -0
  50. package/lib/table/components/Filter/index.d.ts +1 -0
  51. package/lib/table/components/Filter/index.js +21 -14
  52. package/lib/table/components/Layout/index.js +4 -2
  53. package/lib/table/components/LoadMore/index.d.ts +20 -0
  54. package/lib/table/components/LoadMore/index.js +128 -0
  55. package/lib/table/components/LoadMore/index.scss +19 -0
  56. package/lib/table/components/QuickAction/index.d.ts +1 -0
  57. package/lib/table/components/ToolBar/CardSwitch.d.ts +8 -0
  58. package/lib/table/components/ToolBar/CardSwitch.js +82 -0
  59. package/lib/table/components/ToolBar/FilterColumnIcon.js +13 -2
  60. package/lib/table/components/ToolBar/Fullscreen.js +15 -2
  61. package/lib/table/components/ToolBar/index.js +65 -32
  62. package/lib/table/components/ToolBar/index.scss +10 -1
  63. package/lib/table/index.js +134 -34
  64. package/lib/table/typing.d.ts +69 -0
  65. package/lib/table/utils/columnRender.d.ts +1 -1
  66. package/lib/table/utils/columnRender.js +4 -2
  67. package/lib/table/utils/genProColumnToColumn.d.ts +1 -1
  68. package/lib/table/utils/genProColumnToColumn.js +3 -1
  69. package/package.json +1 -1
@@ -0,0 +1,468 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _components = require("@alicloudfe/components");
11
+
12
+ var _ = require("../../../");
13
+
14
+ var _skeleton = require("../../../skeleton");
15
+
16
+ var _utils = require("@teamix/utils");
17
+
18
+ require("./index.scss");
19
+
20
+ var _columnRender = require("../../utils/columnRender");
21
+
22
+ var _LoadMore = _interopRequireDefault(require("../LoadMore"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
+
28
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
+
30
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
31
+
32
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33
+
34
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
35
+
36
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
+
38
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
39
+
40
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
41
+
42
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
43
+
44
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
+
46
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
47
+
48
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
+
50
+ var Row = _components.Grid.Row,
51
+ Col = _components.Grid.Col;
52
+ var cls = (0, _utils.usePrefixCls)('teamix-pro-table-card-view');
53
+
54
+ var CardView = function CardView(props) {
55
+ var _cardViewProps$scroll;
56
+
57
+ var dataSource = props.dataSource,
58
+ _props$columns = props.columns,
59
+ columns = _props$columns === void 0 ? [] : _props$columns,
60
+ _props$loading = props.loading,
61
+ loading = _props$loading === void 0 ? false : _props$loading,
62
+ originColumns = props.originColumns,
63
+ _props$cardViewProps = props.cardViewProps,
64
+ cardViewProps = _props$cardViewProps === void 0 ? {} : _props$cardViewProps,
65
+ actionRef = props.actionRef,
66
+ context = props.context,
67
+ scrollHeight = props.scrollHeight,
68
+ _props$showSkeleton = props.showSkeleton,
69
+ showSkeleton = _props$showSkeleton === void 0 ? false : _props$showSkeleton; // 加载状态
70
+
71
+ var _useState = (0, _react.useState)('none'),
72
+ _useState2 = _slicedToArray(_useState, 2),
73
+ loadState = _useState2[0],
74
+ setLoadState = _useState2[1]; // 骨架屏状态
75
+
76
+
77
+ var _useState3 = (0, _react.useState)(true),
78
+ _useState4 = _slicedToArray(_useState3, 2),
79
+ skeletonVisible = _useState4[0],
80
+ setSkeletonVisible = _useState4[1]; // 加载状态变化回调
81
+
82
+
83
+ (0, _react.useEffect)(function () {
84
+ setLoadState(loading ? 'loading' : 'loadMore');
85
+ setSkeletonVisible(showSkeleton);
86
+
87
+ if (showSkeleton) {
88
+ setLoadState('none');
89
+ }
90
+ }, [loading, skeletonVisible, showSkeleton]);
91
+
92
+ var getDataIndexValue = function getDataIndexValue(dataIndex, dataSource) {
93
+ if (Array.isArray(dataIndex)) {
94
+ return dataIndex.map(function (item) {
95
+ return (0, _.getDeepValue)(item !== null && item !== void 0 ? item : '', dataSource);
96
+ });
97
+ }
98
+
99
+ return (0, _.getDeepValue)(dataIndex !== null && dataIndex !== void 0 ? dataIndex : '', dataSource);
100
+ }; // 获取卡片 columns
101
+
102
+
103
+ var cardColumns = (0, _react.useMemo)(function () {
104
+ return columns.map(function (column) {
105
+ var _originColumn$title;
106
+
107
+ var originColumn = originColumns === null || originColumns === void 0 ? void 0 : originColumns.find(function (item) {
108
+ return item.dataIndex === column.dataIndex;
109
+ });
110
+ var render = column === null || column === void 0 ? void 0 : column.render;
111
+
112
+ if (typeof (column === null || column === void 0 ? void 0 : column.render) === 'function') {
113
+ render = function render(value, record) {
114
+ var _column$render;
115
+
116
+ return column === null || column === void 0 ? void 0 : (_column$render = column.render) === null || _column$render === void 0 ? void 0 : _column$render.call(column, value, undefined, record);
117
+ };
118
+ } else {
119
+ var _Object$entries$map, _Object$entries, _Object$entries$map2, _column$render2;
120
+
121
+ render = Object.fromEntries((_Object$entries$map = (_Object$entries = Object.entries((_column$render2 = column === null || column === void 0 ? void 0 : column.render) !== null && _column$render2 !== void 0 ? _column$render2 : {})) === null || _Object$entries === void 0 ? void 0 : (_Object$entries$map2 = _Object$entries.map) === null || _Object$entries$map2 === void 0 ? void 0 : _Object$entries$map2.call(_Object$entries, function (_ref) {
122
+ var _ref2 = _slicedToArray(_ref, 2),
123
+ k = _ref2[0],
124
+ v = _ref2[1];
125
+
126
+ if (typeof v === 'function') {
127
+ return [k, function (value, record) {
128
+ return v === null || v === void 0 ? void 0 : v(value, undefined, record);
129
+ }];
130
+ }
131
+
132
+ return [k, v];
133
+ })) !== null && _Object$entries$map !== void 0 ? _Object$entries$map : []);
134
+ }
135
+
136
+ return _objectSpread(_objectSpread({}, column), {}, {
137
+ title: (_originColumn$title = originColumn === null || originColumn === void 0 ? void 0 : originColumn.title) !== null && _originColumn$title !== void 0 ? _originColumn$title : column.title,
138
+ render: render
139
+ });
140
+ }).filter(function (item) {
141
+ return !(item === null || item === void 0 ? void 0 : item.actionSchema);
142
+ });
143
+ }, [columns, originColumns]); // 获取单个渲染数据
144
+
145
+ var renderCardInfoItem = function renderCardInfoItem(itemProps, record, index) {
146
+ if (itemProps) {
147
+ if (typeof itemProps === 'string' || Array.isArray(itemProps)) {
148
+ var _titleColumn$cell, _titleColumn$cell2;
149
+
150
+ var titleColumn = cardColumns.find(function (item) {
151
+ return item.dataIndex === itemProps;
152
+ });
153
+ return (_titleColumn$cell = titleColumn === null || titleColumn === void 0 ? void 0 : (_titleColumn$cell2 = titleColumn.cell) === null || _titleColumn$cell2 === void 0 ? void 0 : _titleColumn$cell2.call(titleColumn, getDataIndexValue(itemProps, record), index, record)) !== null && _titleColumn$cell !== void 0 ? _titleColumn$cell : '';
154
+ }
155
+
156
+ return (0, _columnRender.renderCell)(getDataIndexValue(itemProps.dataIndex, record), itemProps, index, record, actionRef, context);
157
+ }
158
+ }; // 渲染卡片title
159
+
160
+
161
+ var renderCardTitle = function renderCardTitle(record, index) {
162
+ var _cardColumns$, _cardColumns$$render, _cardColumns$2, _cardColumns$2$cell, _cardColumns$3;
163
+
164
+ var titleProp = cardViewProps.title;
165
+ var title = titleProp;
166
+
167
+ if (typeof titleProp === 'function') {
168
+ title = titleProp === null || titleProp === void 0 ? void 0 : titleProp(index, record);
169
+ }
170
+
171
+ if (titleProp) {
172
+ return renderCardInfoItem(title, record, index);
173
+ } // 【默认情况】看看第一列有没有 description,有的话,只取 title
174
+
175
+
176
+ if (cardColumns === null || cardColumns === void 0 ? void 0 : (_cardColumns$ = cardColumns[0]) === null || _cardColumns$ === void 0 ? void 0 : (_cardColumns$$render = _cardColumns$.render) === null || _cardColumns$$render === void 0 ? void 0 : _cardColumns$$render.description) {
177
+ var _originColumn$render;
178
+
179
+ var column = cardColumns === null || cardColumns === void 0 ? void 0 : cardColumns[0];
180
+ var originColumn = originColumns === null || originColumns === void 0 ? void 0 : originColumns[0]; // 转化为新的 table columns
181
+
182
+ var _columns = _objectSpread(_objectSpread({}, originColumn), {}, {
183
+ render: _objectSpread(_objectSpread({}, originColumn === null || originColumn === void 0 ? void 0 : originColumn.render), {}, {
184
+ value: originColumn === null || originColumn === void 0 ? void 0 : (_originColumn$render = originColumn.render) === null || _originColumn$render === void 0 ? void 0 : _originColumn$render.value,
185
+ description: undefined,
186
+ descriptionCopy: undefined
187
+ })
188
+ });
189
+
190
+ return (0, _columnRender.renderCell)(getDataIndexValue(column === null || column === void 0 ? void 0 : column.dataIndex, record), _columns, index, record, actionRef, context);
191
+ } // 【默认情况】直接拿第一列的 cell
192
+
193
+
194
+ return cardColumns === null || cardColumns === void 0 ? void 0 : (_cardColumns$2 = cardColumns[0]) === null || _cardColumns$2 === void 0 ? void 0 : (_cardColumns$2$cell = _cardColumns$2.cell) === null || _cardColumns$2$cell === void 0 ? void 0 : _cardColumns$2$cell.call(_cardColumns$2, getDataIndexValue(cardColumns === null || cardColumns === void 0 ? void 0 : (_cardColumns$3 = cardColumns[0]) === null || _cardColumns$3 === void 0 ? void 0 : _cardColumns$3.dataIndex, record), index, record);
195
+ }; // 渲染卡片subTitle
196
+
197
+
198
+ var renderCardSubTitle = function renderCardSubTitle(record, index) {
199
+ var _cardColumns$4, _cardColumns$4$render;
200
+
201
+ var subTitleProp = cardViewProps.subTitle;
202
+ var subTitle = subTitleProp;
203
+
204
+ if (typeof subTitleProp === 'function') {
205
+ subTitle = subTitleProp === null || subTitleProp === void 0 ? void 0 : subTitleProp(index, record);
206
+ }
207
+
208
+ if (subTitle) {
209
+ return renderCardInfoItem(subTitle, record, index);
210
+ } // 【默认情况】看看第一列有没有 description,有的话,只取 title
211
+
212
+
213
+ if (cardColumns === null || cardColumns === void 0 ? void 0 : (_cardColumns$4 = cardColumns[0]) === null || _cardColumns$4 === void 0 ? void 0 : (_cardColumns$4$render = _cardColumns$4.render) === null || _cardColumns$4$render === void 0 ? void 0 : _cardColumns$4$render.description) {
214
+ var _originColumn$render2, _column$render3;
215
+
216
+ var column = cardColumns === null || cardColumns === void 0 ? void 0 : cardColumns[0];
217
+ var originColumn = originColumns === null || originColumns === void 0 ? void 0 : originColumns[0]; // 转化为新的 table columns
218
+
219
+ var _columns2 = _objectSpread(_objectSpread({}, originColumn), {}, {
220
+ render: {
221
+ value: originColumn === null || originColumn === void 0 ? void 0 : (_originColumn$render2 = originColumn.render) === null || _originColumn$render2 === void 0 ? void 0 : _originColumn$render2.description,
222
+ description: undefined,
223
+ descriptionCopy: undefined
224
+ }
225
+ });
226
+
227
+ return (0, _columnRender.renderCell)(getDataIndexValue(column === null || column === void 0 ? void 0 : (_column$render3 = column.render) === null || _column$render3 === void 0 ? void 0 : _column$render3.value, record), _columns2, index, record, actionRef, context);
228
+ }
229
+ }; // 获取ProInfoColumns
230
+
231
+
232
+ var getPropInfoColumns = function getPropInfoColumns(record, index) {
233
+ var contentProp = cardViewProps.content;
234
+ var content = contentProp;
235
+
236
+ if (typeof contentProp === 'function') {
237
+ content = contentProp === null || contentProp === void 0 ? void 0 : contentProp(index, record);
238
+ }
239
+
240
+ if (content) {
241
+ return content.map(function (item) {
242
+ if (typeof item === 'string') {
243
+ return cardColumns.find(function (column) {
244
+ return column.dataIndex === item;
245
+ });
246
+ }
247
+
248
+ return content;
249
+ });
250
+ } // 默认取4条数据
251
+
252
+
253
+ return cardColumns.filter(function (item, index) {
254
+ return index > 0 && index < 5;
255
+ });
256
+ }; // 从表格columns获取Action配置
257
+
258
+
259
+ var getActionGroupFromColumn = function getActionGroupFromColumn(dataIndex, record, index) {
260
+ var actionColumn;
261
+
262
+ if (dataIndex) {
263
+ actionColumn = columns === null || columns === void 0 ? void 0 : columns.find(function (item) {
264
+ return item.dataIndex.toString() === dataIndex.toString();
265
+ });
266
+ } else {
267
+ // 默认继承表格操作列
268
+ // 获取操作列,只能获取最后一列
269
+ actionColumn = columns === null || columns === void 0 ? void 0 : columns[(columns === null || columns === void 0 ? void 0 : columns.length) - 1];
270
+ }
271
+
272
+ if (actionColumn.actionSchema) {
273
+ var _actionColumn, _actionColumn$actionS;
274
+
275
+ var newActionColumn = _objectSpread(_objectSpread({}, actionColumn), {}, {
276
+ actionSchema: {
277
+ actions: (_actionColumn = actionColumn) === null || _actionColumn === void 0 ? void 0 : (_actionColumn$actionS = _actionColumn.actionSchema) === null || _actionColumn$actionS === void 0 ? void 0 : _actionColumn$actionS.actions,
278
+ max: 1
279
+ }
280
+ });
281
+
282
+ return (0, _columnRender.renderCell)(null, newActionColumn, index, record, actionRef, context);
283
+ }
284
+
285
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
286
+ }; // 获取Card操作列配置
287
+
288
+
289
+ var getProCardExtra = function getProCardExtra(record, index) {
290
+ var extraProp = cardViewProps.extra;
291
+ var extra = extraProp;
292
+
293
+ if (typeof extraProp === 'function') {
294
+ extra = extraProp === null || extraProp === void 0 ? void 0 : extraProp(index, record);
295
+ }
296
+
297
+ if (Array.isArray(extra)) {
298
+ return /*#__PURE__*/_react.default.createElement("div", {
299
+ className: cls('extra')
300
+ }, extra.map(function (item) {
301
+ if (typeof item === 'string') {
302
+ return /*#__PURE__*/_react.default.createElement("div", {
303
+ className: cls('extra-item')
304
+ }, getActionGroupFromColumn(item, record, index));
305
+ }
306
+
307
+ if ( /*#__PURE__*/(0, _react.isValidElement)(item)) {
308
+ return /*#__PURE__*/_react.default.createElement("div", {
309
+ className: cls('extra-item')
310
+ }, item);
311
+ }
312
+
313
+ return /*#__PURE__*/_react.default.createElement("div", {
314
+ className: cls('extra-item')
315
+ }, (0, _columnRender.renderCell)(null, item, index, record, actionRef, context));
316
+ }));
317
+ }
318
+
319
+ return getActionGroupFromColumn(undefined, record, index);
320
+ }; // 渲染Tag
321
+
322
+
323
+ var getTags = function getTags(record, index) {
324
+ var tagProp = cardViewProps.tags;
325
+ var tags = tagProp !== null && tagProp !== void 0 ? tagProp : [];
326
+
327
+ if (typeof tagProp === 'function') {
328
+ var _tagProp;
329
+
330
+ tags = (_tagProp = tagProp === null || tagProp === void 0 ? void 0 : tagProp(index, record)) !== null && _tagProp !== void 0 ? _tagProp : [];
331
+ }
332
+
333
+ var getTagFromColumns = function getTagFromColumns(columns, dataIndex) {
334
+ var _columns$render, _columns$render2, _columns$render4, _columns$render5, _columns$render7, _columns$render8;
335
+
336
+ var text = getDataIndexValue(dataIndex, record);
337
+
338
+ if ((columns === null || columns === void 0 ? void 0 : (_columns$render = columns.render) === null || _columns$render === void 0 ? void 0 : _columns$render.value) && typeof (columns === null || columns === void 0 ? void 0 : (_columns$render2 = columns.render) === null || _columns$render2 === void 0 ? void 0 : _columns$render2.value) === 'string') {
339
+ var _columns$render3;
340
+
341
+ text = columns === null || columns === void 0 ? void 0 : (_columns$render3 = columns.render) === null || _columns$render3 === void 0 ? void 0 : _columns$render3.value;
342
+ }
343
+
344
+ if ((columns === null || columns === void 0 ? void 0 : (_columns$render4 = columns.render) === null || _columns$render4 === void 0 ? void 0 : _columns$render4.value) && typeof (columns === null || columns === void 0 ? void 0 : (_columns$render5 = columns.render) === null || _columns$render5 === void 0 ? void 0 : _columns$render5.value) === 'function') {
345
+ var _columns$render6;
346
+
347
+ text = columns === null || columns === void 0 ? void 0 : (_columns$render6 = columns.render) === null || _columns$render6 === void 0 ? void 0 : _columns$render6.value(getDataIndexValue(dataIndex, record), index, record);
348
+ }
349
+
350
+ var color = columns === null || columns === void 0 ? void 0 : (_columns$render7 = columns.render) === null || _columns$render7 === void 0 ? void 0 : _columns$render7.color;
351
+
352
+ if (typeof (columns === null || columns === void 0 ? void 0 : (_columns$render8 = columns.render) === null || _columns$render8 === void 0 ? void 0 : _columns$render8.color) === 'function') {
353
+ var _columns$render9;
354
+
355
+ color = columns === null || columns === void 0 ? void 0 : (_columns$render9 = columns.render) === null || _columns$render9 === void 0 ? void 0 : _columns$render9.color(getDataIndexValue(dataIndex, record), index, record);
356
+ }
357
+
358
+ return {
359
+ children: text,
360
+ color: color
361
+ };
362
+ };
363
+
364
+ return tags.map(function (tagItem) {
365
+ if (typeof tagItem === 'string') {
366
+ var tagColumns = columns.find(function (item) {
367
+ return item.dataIndex === tagItem;
368
+ });
369
+ return getTagFromColumns(tagColumns, tagItem);
370
+ }
371
+
372
+ if (_typeof(tagItem) === 'object') {
373
+ return getTagFromColumns(tagItem, tagItem === null || tagItem === void 0 ? void 0 : tagItem.dataIndex);
374
+ }
375
+ });
376
+ }; // 加载下一页回调
377
+
378
+
379
+ var onLoadMore = function onLoadMore() {
380
+ var _actionRef$current, _actionRef$current$ne;
381
+
382
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ne = _actionRef$current.nextPage) === null || _actionRef$current$ne === void 0 ? void 0 : _actionRef$current$ne.call(_actionRef$current);
383
+ }; // 触底回调
384
+
385
+
386
+ var onScrollBottom = function onScrollBottom() {
387
+ if (cardViewProps.autoLoadNextPage !== false) {
388
+ var _cardViewProps$onScro;
389
+
390
+ onLoadMore();
391
+ cardViewProps === null || cardViewProps === void 0 ? void 0 : (_cardViewProps$onScro = cardViewProps.onScrollBottom) === null || _cardViewProps$onScro === void 0 ? void 0 : _cardViewProps$onScro.call(cardViewProps);
392
+ }
393
+ }; // 获取ProCard配置
394
+
395
+
396
+ var getProCardProps = function getProCardProps(record, index) {
397
+ var _cardViewProps$cardPr;
398
+
399
+ var external = ['onCollapse', 'onSelect', 'onClick'];
400
+ return Object.fromEntries(Object.entries((_cardViewProps$cardPr = cardViewProps.cardProps) !== null && _cardViewProps$cardPr !== void 0 ? _cardViewProps$cardPr : {}).map(function (_ref3) {
401
+ var _ref4 = _slicedToArray(_ref3, 2),
402
+ key = _ref4[0],
403
+ value = _ref4[1];
404
+
405
+ if (typeof value === 'function' && !external.includes(key)) {
406
+ return [key, value === null || value === void 0 ? void 0 : value(index, record)];
407
+ }
408
+
409
+ if (typeof value === 'function' && external.includes(key)) {
410
+ return [key, function () {
411
+ for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
412
+ others[_key] = arguments[_key];
413
+ }
414
+
415
+ return value === null || value === void 0 ? void 0 : value.apply(void 0, [index, record].concat(others));
416
+ }];
417
+ }
418
+
419
+ return [key, value];
420
+ }));
421
+ }; // 渲染单个卡片
422
+
423
+
424
+ var renderCard = function renderCard(record, index) {
425
+ return /*#__PURE__*/_react.default.createElement(Col, {
426
+ xxs: 24,
427
+ xs: 12,
428
+ s: 8,
429
+ m: 8,
430
+ l: 6,
431
+ xl: 6,
432
+ key: index,
433
+ className: cls('card-item')
434
+ }, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread({
435
+ title: renderCardTitle(record, index),
436
+ subTitle: renderCardSubTitle(record, index),
437
+ extra: getProCardExtra(record, index),
438
+ tags: getTags(record, index)
439
+ }, getProCardProps(record, index)), /*#__PURE__*/_react.default.createElement(_.ProInfo, {
440
+ columns: getPropInfoColumns(record, index),
441
+ dataSource: record,
442
+ context: {
443
+ record: record,
444
+ index: index
445
+ }
446
+ })));
447
+ };
448
+
449
+ return /*#__PURE__*/_react.default.createElement("div", {
450
+ className: cls()
451
+ }, /*#__PURE__*/_react.default.createElement(_LoadMore.default, {
452
+ onScrollBottom: onScrollBottom,
453
+ onLoadMore: onLoadMore,
454
+ loadState: loadState,
455
+ scrollHeight: (_cardViewProps$scroll = cardViewProps.scrollHeight) !== null && _cardViewProps$scroll !== void 0 ? _cardViewProps$scroll : scrollHeight
456
+ }, skeletonVisible && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Content, null), !skeletonVisible && /*#__PURE__*/_react.default.createElement(Row, {
457
+ gutter: 16,
458
+ wrap: true,
459
+ style: {
460
+ marginTop: '-16px'
461
+ }
462
+ }, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item, index) {
463
+ return renderCard(item, index);
464
+ }))));
465
+ };
466
+
467
+ var _default = CardView;
468
+ exports.default = _default;
@@ -0,0 +1,46 @@
1
+ .teamix-pro-table-card-view {
2
+ &-card-item {
3
+ margin-top: 16px;
4
+ }
5
+
6
+ // 样式覆盖
7
+ .teamix-pro-card-title-name.teamix-pro-card-title-name {
8
+
9
+ .teamix-pro-field.teamix-pro-field.teamix-pro-field {
10
+ font-weight: var(--font-weight-medium);
11
+ font-size: var(--card-title-font-size, 14px);
12
+ }
13
+
14
+ .next-form-preview.next-form-preview.next-form-preview {
15
+ font-weight: var(--font-weight-medium);
16
+ font-size: var(--card-title-font-size, 14px);
17
+ }
18
+
19
+
20
+ }
21
+
22
+ .next-card-header-subtitle.next-card-header-subtitle {
23
+
24
+ .teamix-pro-field.teamix-pro-field.teamix-pro-field {
25
+ font-size: var(--card-sub-title-font-size, 12px);
26
+ color: var(--card-sub-title-color, #5a5a5a);
27
+ }
28
+
29
+ .next-form-preview.next-form-preview.next-form-preview {
30
+ font-size: var(--card-sub-title-font-size, 12px);
31
+ color: var(--card-sub-title-color, #5a5a5a);
32
+ }
33
+
34
+
35
+ }
36
+
37
+ &-extra {
38
+ display: flex;
39
+ align-items: center;
40
+
41
+ &-item {
42
+ display: inline-block;
43
+ margin-left: 8px;
44
+ }
45
+ }
46
+ }
@@ -4,6 +4,7 @@ import { ProTableColumnProps, ProTableActionType } from '../../typing';
4
4
  declare type ProTableFilterProps = {
5
5
  column: ProTableColumnProps;
6
6
  actionRef: React.MutableRefObject<ProTableActionType | undefined>;
7
+ switchCardView?: 'table' | 'card';
7
8
  };
8
9
  declare const Filter: React.FC<ProTableFilterProps>;
9
10
  export default Filter;
@@ -55,7 +55,8 @@ var RadioItem = _components.Menu.RadioItem;
55
55
 
56
56
  var Filter = function Filter(props) {
57
57
  var column = props.column,
58
- actionRef = props.actionRef;
58
+ actionRef = props.actionRef,
59
+ switchCardView = props.switchCardView;
59
60
  var _column$filtersWidth = column.filtersWidth,
60
61
  filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth; // 选中过滤项
61
62
 
@@ -191,7 +192,7 @@ var Filter = function Filter(props) {
191
192
  btn: true
192
193
  }),
193
194
  onClick: function onClick() {
194
- var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
195
+ var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$r, _actionRef$current9, _actionRef$current9$c;
195
196
 
196
197
  (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
197
198
 
@@ -217,13 +218,19 @@ var Filter = function Filter(props) {
217
218
 
218
219
  if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
219
220
  targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
221
+ }
222
+
223
+ if (switchCardView === 'card') {
224
+ var _actionRef$current6, _actionRef$current6$s;
225
+
226
+ (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$s = _actionRef$current6.setData) === null || _actionRef$current6$s === void 0 ? void 0 : _actionRef$current6$s.call(_actionRef$current6, []);
220
227
  } // 发送请求
221
228
 
222
229
 
223
- (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _defineProperty({}, targetPageKey, 1));
224
- (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
230
+ (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.request) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7, _defineProperty({}, targetPageKey, 1));
231
+ (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$r = _actionRef$current8.resetPage) === null || _actionRef$current8$r === void 0 ? void 0 : _actionRef$current8$r.call(_actionRef$current8); // 清空表格选择
225
232
 
226
- (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
233
+ (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
227
234
  setVisible(false);
228
235
  }
229
236
  }, (0, _utils.getMessage)('ok')), /*#__PURE__*/_react.default.createElement(_components.Button, {
@@ -233,31 +240,31 @@ var Filter = function Filter(props) {
233
240
  btn: true
234
241
  }),
235
242
  onClick: function onClick() {
236
- var _actionRef$current$ge7, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
243
+ var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
237
244
 
238
245
  setSelected([]);
239
- var rules = (_actionRef$current$ge7 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
240
- (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
246
+ var rules = (_actionRef$current$ge7 = (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.getState) === null || _actionRef$current10$ === void 0 ? void 0 : (_actionRef$current10$2 = _actionRef$current10$.call(_actionRef$current10)) === null || _actionRef$current10$2 === void 0 ? void 0 : _actionRef$current10$2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
247
+ (_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.setFilterRules) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
241
248
  rules: [],
242
249
  params: ''
243
250
  })));
244
- (_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex);
251
+ (_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : (_actionRef$current12$ = _actionRef$current12.filterDataSource) === null || _actionRef$current12$ === void 0 ? void 0 : _actionRef$current12$.call(_actionRef$current12, column.dataIndex);
245
252
 
246
253
  if (selected.length > 0) {
247
- var _actionRef$current12, _actionRef$current13, _actionRef$current13$, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$;
254
+ var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
248
255
 
249
256
  var targetPageKey = 'currentPage';
250
- var pageInfo = (_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : _actionRef$current12.pageInfo;
257
+ var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
251
258
 
252
259
  if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
253
260
  targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
254
261
  } // 发送请求
255
262
 
256
263
 
257
- (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : (_actionRef$current13$ = _actionRef$current13.request) === null || _actionRef$current13$ === void 0 ? void 0 : _actionRef$current13$.call(_actionRef$current13, _defineProperty({}, targetPageKey, 1));
258
- (_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.resetPage) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14); // 清空表格选择
264
+ (_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.request) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14, _defineProperty({}, targetPageKey, 1));
265
+ (_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.resetPage) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15); // 清空表格选择
259
266
 
260
- (_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.clearRowSelection) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
267
+ (_actionRef$current16 = actionRef.current) === null || _actionRef$current16 === void 0 ? void 0 : (_actionRef$current16$ = _actionRef$current16.clearRowSelection) === null || _actionRef$current16$ === void 0 ? void 0 : _actionRef$current16$.call(_actionRef$current16);
261
268
  } // setVisible(!visible);
262
269
 
263
270
  }
@@ -21,7 +21,7 @@ var _QuickAction = _interopRequireDefault(require("../QuickAction"));
21
21
 
22
22
  require("./index.scss");
23
23
 
24
- var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar"];
24
+ var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm"];
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
@@ -53,6 +53,7 @@ var Layout = function Layout(props) {
53
53
  afterDataFilter = props.afterDataFilter,
54
54
  rowSelection = props.rowSelection,
55
55
  toolBar = props.toolBar,
56
+ dataTeamixSpm = props.dataTeamixSpm,
56
57
  otherProps = _objectWithoutProperties(props, _excluded); // 渲染主操作区
57
58
 
58
59
 
@@ -77,7 +78,8 @@ var Layout = function Layout(props) {
77
78
  return /*#__PURE__*/_react.default.createElement("div", {
78
79
  className: cls('main-action')
79
80
  }, /*#__PURE__*/_react.default.createElement(_actions.ProActionGroup, _objectSpread(_objectSpread({}, mainAction), {}, {
80
- context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context)
81
+ context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context),
82
+ "data-teamix-spm": dataTeamixSpm ? "".concat(dataTeamixSpm, "-mainAction") : undefined
81
83
  })));
82
84
  } else return mainAction;
83
85
  }; // 渲染 addonAfter
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import './index.scss';
3
+ export declare type LoadMoreProps = {
4
+ /** 内容 **/
5
+ children?: React.ReactNode;
6
+ /** 加载状态 受控 **/
7
+ loadState?: 'loading' | 'loadMore' | 'noMore' | 'none';
8
+ /** 滚动条滚动到底部触发事件 **/
9
+ onScrollBottom?: () => void;
10
+ /** 加载状态改变回调 **/
11
+ onChangeLoadState?: (state: LoadMoreProps['loadState']) => void;
12
+ /** 点击加载更多回调 **/
13
+ onLoadMore?: () => void;
14
+ /** 滚动区域高度 **/
15
+ scrollHeight?: number | string;
16
+ /** 当前滚动区域位置 **/
17
+ scrollPosition?: number;
18
+ };
19
+ declare const LoadMore: React.FC<LoadMoreProps>;
20
+ export default LoadMore;