@guo514360255/antd-lib 1.4.26 → 1.4.28
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.
- package/dist/CustomDetailModal/index.js +3 -2
- package/dist/CustomScroll/index.d.ts +8 -0
- package/dist/CustomScroll/index.js +51 -0
- package/dist/CustomScroll/index.less +8 -0
- package/dist/CustomScroll/item.d.ts +4 -0
- package/dist/CustomScroll/item.js +18 -0
- package/dist/CustomScroll/scroll.d.ts +46 -0
- package/dist/CustomScroll/scrollItem.d.ts +22 -0
- package/dist/CustomTable/index.js +120 -53
- package/dist/CustomTag/index.d.ts +2 -1
- package/dist/CustomTag/index.js +53 -18
- package/dist/CustomTag/tag.d.ts +23 -3
- package/dist/compontent.d.ts +7 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -135,14 +135,15 @@ var CustomModal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
135
135
|
if (Object.keys(valuesEnum).length > 0 && isObject(valuesEnum)) {
|
|
136
136
|
values.forEach(function (item) {
|
|
137
137
|
var _item;
|
|
138
|
-
result.push((_item = valuesEnum[item]) === null || _item === void 0 ? void 0 : _item.text);
|
|
138
|
+
result.push(((_item = valuesEnum[item]) === null || _item === void 0 ? void 0 : _item.text) || value);
|
|
139
139
|
});
|
|
140
140
|
return result.join(',');
|
|
141
141
|
} else if (Array.isArray(options) && options.length > 0) {
|
|
142
142
|
values.forEach(function (item) {
|
|
143
143
|
var _ref3 = findTreeNodeByKey(options, item) || {},
|
|
144
144
|
label = _ref3.label;
|
|
145
|
-
|
|
145
|
+
console.log(label, '...label...');
|
|
146
|
+
result.push(label || value);
|
|
146
147
|
});
|
|
147
148
|
return result.join(',');
|
|
148
149
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CustomScrollProps } from "./scroll";
|
|
3
|
+
import './index.less';
|
|
4
|
+
declare const CustomScroll: {
|
|
5
|
+
(props: CustomScrollProps): JSX.Element;
|
|
6
|
+
Item: (props: import("./scrollItem").CustomScrollItemProps) => JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export default CustomScroll;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
/*
|
|
3
|
+
* @Author: 郭郭
|
|
4
|
+
* @Date: 2026/1/9
|
|
5
|
+
* @Description:
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { useEffect } from 'react';
|
|
9
|
+
import "./index.less";
|
|
10
|
+
import Item from "./item";
|
|
11
|
+
var CustomScroll = function CustomScroll(props) {
|
|
12
|
+
var children = props.children,
|
|
13
|
+
_props$autoplay = props.autoplay,
|
|
14
|
+
autoplay = _props$autoplay === void 0 ? true : _props$autoplay,
|
|
15
|
+
className = props.className,
|
|
16
|
+
_props$duration = props.duration,
|
|
17
|
+
duration = _props$duration === void 0 ? 3000 : _props$duration,
|
|
18
|
+
_props$infinite = props.infinite,
|
|
19
|
+
infinite = _props$infinite === void 0 ? false : _props$infinite,
|
|
20
|
+
_props$direction = props.direction,
|
|
21
|
+
direction = _props$direction === void 0 ? 'vertical' : _props$direction,
|
|
22
|
+
_props$style = props.style,
|
|
23
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
24
|
+
height = props.height;
|
|
25
|
+
var timerRef = React.useRef(null);
|
|
26
|
+
var scrollRef = React.useRef(null);
|
|
27
|
+
var handleScroll = function handleScroll() {
|
|
28
|
+
timerRef.current = setTimeout(function () {
|
|
29
|
+
console.log(true);
|
|
30
|
+
console.log(scrollRef.current);
|
|
31
|
+
handleScroll();
|
|
32
|
+
}, duration);
|
|
33
|
+
};
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
if (autoplay) {
|
|
36
|
+
handleScroll();
|
|
37
|
+
}
|
|
38
|
+
return function () {
|
|
39
|
+
clearTimeout(timerRef.current);
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
ref: scrollRef,
|
|
44
|
+
className: "custom-scroll-container ".concat(direction === 'horizontal' ? 'horizontal' : '', " ").concat(className !== null && className !== void 0 ? className : ''),
|
|
45
|
+
style: _objectSpread({
|
|
46
|
+
height: height
|
|
47
|
+
}, style)
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", null, children));
|
|
49
|
+
};
|
|
50
|
+
CustomScroll.Item = Item;
|
|
51
|
+
export default CustomScroll;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 郭郭
|
|
3
|
+
* @Date: 2026/1/9
|
|
4
|
+
* @Description:
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
var Item = function Item(props) {
|
|
9
|
+
var children = props.children,
|
|
10
|
+
className = props.className,
|
|
11
|
+
_props$style = props.style,
|
|
12
|
+
style = _props$style === void 0 ? {} : _props$style;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: className,
|
|
15
|
+
style: style
|
|
16
|
+
}, children);
|
|
17
|
+
};
|
|
18
|
+
export default Item;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 郭郭
|
|
3
|
+
* @Date: 2026/1/9
|
|
4
|
+
* @Description:
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
export interface CustomScrollProps {
|
|
10
|
+
/**
|
|
11
|
+
* 是否自动滚动
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
autoplay?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 滚动时间间隔(毫秒)
|
|
17
|
+
* @default 3000
|
|
18
|
+
*/
|
|
19
|
+
duration?: number;
|
|
20
|
+
/**
|
|
21
|
+
* 是否无限滚动
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
infinite?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 滚动方向
|
|
27
|
+
* @default vertical
|
|
28
|
+
*/
|
|
29
|
+
direction?: 'horizontal' | 'vertical';
|
|
30
|
+
/**
|
|
31
|
+
* 滚动内容
|
|
32
|
+
*/
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* 样式类
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 滚动内容样式
|
|
40
|
+
*/
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
/**
|
|
43
|
+
* 容器内容高度
|
|
44
|
+
*/
|
|
45
|
+
height?: number | string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 郭郭
|
|
3
|
+
* @Date: 2026/1/9
|
|
4
|
+
* @Description:
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
export interface CustomScrollItemProps {
|
|
10
|
+
/**
|
|
11
|
+
* 滚动内容
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* 滚动内容样式
|
|
16
|
+
*/
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
/**
|
|
19
|
+
* 滚动内容类名
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
@@ -6,7 +6,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
6
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
8
|
var _excluded = ["isIndex", "isDelete", "isUpdateState", "isDetail", "isUpdate", "isCreate", "createText", "columns", "rowKey", "request", "title", "defaultQueryParams", "toolBarRender", "formColumns", "formList", "dataSource", "deleteRequest", "detailRequest", "saveRequest", "updateRequest", "updateStateRequest", "handleModalData", "handleDetailData", "formProps", "detailProps"],
|
|
9
|
-
_excluded2 = ["
|
|
9
|
+
_excluded2 = ["text", "msg", "isConfirm", "onClick", "danger", "isShow", "order"],
|
|
10
|
+
_excluded3 = ["list"];
|
|
10
11
|
/*
|
|
11
12
|
* @Author: 郭郭
|
|
12
13
|
* @Date: 2025/8/11
|
|
@@ -15,9 +16,11 @@ var _excluded = ["isIndex", "isDelete", "isUpdateState", "isDetail", "isUpdate",
|
|
|
15
16
|
|
|
16
17
|
import { ProTable } from '@ant-design/pro-table';
|
|
17
18
|
import CustomFormModal from "../CustomFormModal";
|
|
19
|
+
import { isEmptyValue } from "../utils/util";
|
|
18
20
|
import { Button, message, Popconfirm, Progress } from 'antd';
|
|
19
21
|
import cloneDeep from 'lodash/cloneDeep';
|
|
20
22
|
import debounce from 'lodash/debounce';
|
|
23
|
+
import isFunction from 'lodash/isFunction';
|
|
21
24
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
22
25
|
import CustomDetailModal from "../CustomDetailModal";
|
|
23
26
|
import "./index.less";
|
|
@@ -78,57 +81,59 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
78
81
|
setScrollBar = _useState4[1];
|
|
79
82
|
var tableContainerRef = useRef(null);
|
|
80
83
|
var delEvent = /*#__PURE__*/function () {
|
|
81
|
-
var
|
|
84
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
85
|
+
var id;
|
|
82
86
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
87
|
while (1) switch (_context.prev = _context.next) {
|
|
84
88
|
case 0:
|
|
89
|
+
id = _ref.id;
|
|
85
90
|
setLoading(true);
|
|
86
|
-
_context.prev =
|
|
91
|
+
_context.prev = 2;
|
|
87
92
|
if (!deleteRequest) {
|
|
88
|
-
_context.next =
|
|
93
|
+
_context.next = 10;
|
|
89
94
|
break;
|
|
90
95
|
}
|
|
91
|
-
_context.next =
|
|
96
|
+
_context.next = 6;
|
|
92
97
|
return deleteRequest(id);
|
|
93
|
-
case
|
|
98
|
+
case 6:
|
|
94
99
|
messageApi.success('删除成功');
|
|
95
100
|
setTimeout(function () {
|
|
96
101
|
var _actionRef$current;
|
|
97
102
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 || _actionRef$current.reload();
|
|
98
103
|
}, 0);
|
|
99
|
-
_context.next =
|
|
104
|
+
_context.next = 11;
|
|
100
105
|
break;
|
|
101
|
-
case 9:
|
|
102
|
-
messageApi.error('删除接口未传入');
|
|
103
106
|
case 10:
|
|
104
|
-
|
|
107
|
+
messageApi.error('删除接口未传入');
|
|
108
|
+
case 11:
|
|
109
|
+
_context.next = 17;
|
|
105
110
|
break;
|
|
106
|
-
case
|
|
107
|
-
_context.prev =
|
|
108
|
-
_context.t0 = _context["catch"](
|
|
111
|
+
case 13:
|
|
112
|
+
_context.prev = 13;
|
|
113
|
+
_context.t0 = _context["catch"](2);
|
|
109
114
|
messageApi.error('删除失败');
|
|
110
115
|
console.log(_context.t0);
|
|
111
|
-
case
|
|
112
|
-
_context.prev =
|
|
116
|
+
case 17:
|
|
117
|
+
_context.prev = 17;
|
|
113
118
|
setLoading(false);
|
|
114
|
-
return _context.finish(
|
|
115
|
-
case
|
|
119
|
+
return _context.finish(17);
|
|
120
|
+
case 20:
|
|
116
121
|
case "end":
|
|
117
122
|
return _context.stop();
|
|
118
123
|
}
|
|
119
|
-
}, _callee, null, [[
|
|
124
|
+
}, _callee, null, [[2, 13, 17, 20]]);
|
|
120
125
|
}));
|
|
121
126
|
return function delEvent(_x) {
|
|
122
|
-
return
|
|
127
|
+
return _ref2.apply(this, arguments);
|
|
123
128
|
};
|
|
124
129
|
}();
|
|
125
130
|
var updateState = /*#__PURE__*/function () {
|
|
126
|
-
var
|
|
131
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
127
132
|
var id, isActive, _formRef$current;
|
|
128
133
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
129
134
|
while (1) switch (_context2.prev = _context2.next) {
|
|
130
135
|
case 0:
|
|
131
|
-
id =
|
|
136
|
+
id = _ref3.id, isActive = _ref3.isActive;
|
|
132
137
|
setLoading(true);
|
|
133
138
|
_context2.prev = 2;
|
|
134
139
|
if (!updateStateRequest) {
|
|
@@ -166,7 +171,7 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
166
171
|
}, _callee2, null, [[2, 13, 17, 20]]);
|
|
167
172
|
}));
|
|
168
173
|
return function updateState(_x2) {
|
|
169
|
-
return
|
|
174
|
+
return _ref4.apply(this, arguments);
|
|
170
175
|
};
|
|
171
176
|
}();
|
|
172
177
|
var openModal = function openModal() {
|
|
@@ -186,6 +191,14 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
186
191
|
var _formModalRef$current2;
|
|
187
192
|
// @ts-ignore
|
|
188
193
|
return formModalRef === null || formModalRef === void 0 || (_formModalRef$current2 = formModalRef.current) === null || _formModalRef$current2 === void 0 ? void 0 : _formModalRef$current2.getFormRef();
|
|
194
|
+
},
|
|
195
|
+
// pro components table action ref
|
|
196
|
+
tableActionRef: function tableActionRef() {
|
|
197
|
+
return actionRef.current;
|
|
198
|
+
},
|
|
199
|
+
// pro components form ref
|
|
200
|
+
tableFormRef: function tableFormRef() {
|
|
201
|
+
return formRef.current;
|
|
189
202
|
}
|
|
190
203
|
};
|
|
191
204
|
});
|
|
@@ -233,8 +246,51 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
233
246
|
});
|
|
234
247
|
};
|
|
235
248
|
}
|
|
249
|
+
var getButtons = function getButtons(record) {
|
|
250
|
+
var _detailRef$current;
|
|
251
|
+
var buts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
252
|
+
return [{
|
|
253
|
+
text: '详情',
|
|
254
|
+
type: 'link',
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
onClick: (_detailRef$current = detailRef.current) === null || _detailRef$current === void 0 ? void 0 : _detailRef$current.open,
|
|
257
|
+
isShow: isDetail,
|
|
258
|
+
order: 10
|
|
259
|
+
}, {
|
|
260
|
+
text: '编辑',
|
|
261
|
+
type: 'link',
|
|
262
|
+
onClick: openModal,
|
|
263
|
+
isShow: isUpdate,
|
|
264
|
+
order: 20
|
|
265
|
+
}, {
|
|
266
|
+
text: '删除',
|
|
267
|
+
type: 'link',
|
|
268
|
+
onClick: delEvent,
|
|
269
|
+
isShow: isDelete,
|
|
270
|
+
isConfirm: true,
|
|
271
|
+
danger: true,
|
|
272
|
+
msg: '确定删除当前数据?',
|
|
273
|
+
order: 30
|
|
274
|
+
}, {
|
|
275
|
+
text: record.isActive === 0 ? '禁用' : '启用',
|
|
276
|
+
type: 'link',
|
|
277
|
+
onClick: updateState,
|
|
278
|
+
isShow: isUpdateState,
|
|
279
|
+
danger: record.isActive === 0,
|
|
280
|
+
isConfirm: true,
|
|
281
|
+
msg: "\u786E\u5B9A\u8981".concat(record.isActive === 0 ? '启用' : '禁用', "\u8BE5\u6570\u636E\u5417\uFF1F"),
|
|
282
|
+
order: 40
|
|
283
|
+
}].concat(_toConsumableArray(buts));
|
|
284
|
+
};
|
|
236
285
|
|
|
237
|
-
|
|
286
|
+
/**
|
|
287
|
+
* 操作列
|
|
288
|
+
* 详情:默认显示
|
|
289
|
+
* 编辑:默认显示
|
|
290
|
+
* 删除:默认显示
|
|
291
|
+
* 启用/禁用:默认不显示
|
|
292
|
+
* buttons:为函数
|
|
293
|
+
*/
|
|
238
294
|
var operation = newColumns === null || newColumns === void 0 ? void 0 : newColumns.find(function (item) {
|
|
239
295
|
return item.dataIndex === 'operation' || item.valueType === 'option';
|
|
240
296
|
});
|
|
@@ -245,38 +301,47 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
245
301
|
operation.width = [isDetail, isDelete, isUpdateState, isUpdate].filter(Boolean).length * 65;
|
|
246
302
|
}
|
|
247
303
|
operation.render = function (_, record) {
|
|
304
|
+
var _getButtons;
|
|
305
|
+
var buts = Array.isArray(operation.buttons) ? operation.buttons : [];
|
|
306
|
+
var buttons = (_getButtons = getButtons(record, buts)) === null || _getButtons === void 0 || (_getButtons = _getButtons.filter(function (item) {
|
|
307
|
+
return item.isShow || isEmptyValue(item.isShow);
|
|
308
|
+
})) === null || _getButtons === void 0 ? void 0 : _getButtons.sort(function (prev, next) {
|
|
309
|
+
return (prev === null || prev === void 0 ? void 0 : prev.order) - (next === null || next === void 0 ? void 0 : next.order);
|
|
310
|
+
});
|
|
248
311
|
return /*#__PURE__*/React.createElement("div", {
|
|
249
312
|
style: {
|
|
250
313
|
display: 'flex'
|
|
251
314
|
}
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
danger: true
|
|
273
|
-
}, "\u5220\u9664")), isUpdateState && /*#__PURE__*/React.createElement(Button, {
|
|
274
|
-
type: "link",
|
|
275
|
-
danger: record.isActive === 1,
|
|
276
|
-
onClick: function onClick() {
|
|
277
|
-
return updateState(record);
|
|
315
|
+
}, buttons === null || buttons === void 0 ? void 0 : buttons.map(function (_ref5, index) {
|
|
316
|
+
var text = _ref5.text,
|
|
317
|
+
msg = _ref5.msg,
|
|
318
|
+
isConfirm = _ref5.isConfirm,
|
|
319
|
+
_onClick = _ref5.onClick,
|
|
320
|
+
danger = _ref5.danger,
|
|
321
|
+
isShow = _ref5.isShow,
|
|
322
|
+
order = _ref5.order,
|
|
323
|
+
item = _objectWithoutProperties(_ref5, _excluded2);
|
|
324
|
+
if (isConfirm) {
|
|
325
|
+
return /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
326
|
+
key: index,
|
|
327
|
+
title: msg,
|
|
328
|
+
onConfirm: function onConfirm() {
|
|
329
|
+
return _onClick && _onClick(record);
|
|
330
|
+
}
|
|
331
|
+
}, item || {}), /*#__PURE__*/React.createElement(Button, _extends({
|
|
332
|
+
type: "link",
|
|
333
|
+
danger: danger
|
|
334
|
+
}, item), text));
|
|
278
335
|
}
|
|
279
|
-
|
|
336
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
337
|
+
key: index,
|
|
338
|
+
type: "link",
|
|
339
|
+
onClick: function onClick() {
|
|
340
|
+
return _onClick && _onClick(record);
|
|
341
|
+
},
|
|
342
|
+
danger: danger
|
|
343
|
+
}, item), text);
|
|
344
|
+
}), isFunction(operation.buttons) && operation.buttons(record));
|
|
280
345
|
};
|
|
281
346
|
}
|
|
282
347
|
return newColumns === null || newColumns === void 0 ? void 0 : newColumns.map(function (item) {
|
|
@@ -285,6 +350,8 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
285
350
|
}) : item;
|
|
286
351
|
});
|
|
287
352
|
};
|
|
353
|
+
|
|
354
|
+
// 控制操作列宽度
|
|
288
355
|
var getAntTableContainer = function getAntTableContainer() {
|
|
289
356
|
var tableContainer = tableContainerRef.current;
|
|
290
357
|
var tableBody = tableContainer === null || tableContainer === void 0 ? void 0 : tableContainer.querySelector('.ant-table-body');
|
|
@@ -343,7 +410,7 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
343
410
|
formRef: formRef,
|
|
344
411
|
columns: handleColumns() || [],
|
|
345
412
|
request: ( /*#__PURE__*/function () {
|
|
346
|
-
var
|
|
413
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, sort, filter) {
|
|
347
414
|
var pageNo, _yield$request, list, data;
|
|
348
415
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
349
416
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -363,7 +430,7 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
363
430
|
case 7:
|
|
364
431
|
_yield$request = _context3.sent;
|
|
365
432
|
list = _yield$request.list;
|
|
366
|
-
data = _objectWithoutProperties(_yield$request,
|
|
433
|
+
data = _objectWithoutProperties(_yield$request, _excluded3);
|
|
367
434
|
getAntTableContainer();
|
|
368
435
|
return _context3.abrupt("return", _objectSpread({
|
|
369
436
|
data: list
|
|
@@ -388,7 +455,7 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
388
455
|
}, _callee3, null, [[2, 14, 17, 20]]);
|
|
389
456
|
}));
|
|
390
457
|
return function (_x3, _x4, _x5) {
|
|
391
|
-
return
|
|
458
|
+
return _ref6.apply(this, arguments);
|
|
392
459
|
};
|
|
393
460
|
}()),
|
|
394
461
|
rowKey: rowKey || 'id',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import type { CustomTagProps } from "./tag";
|
|
3
|
+
declare const CustomTag: ({ value, valueEnum, options }: CustomTagProps) => JSX.Element | JSX.Element[];
|
|
3
4
|
export default CustomTag;
|
package/dist/CustomTag/index.js
CHANGED
|
@@ -1,30 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: 郭郭
|
|
3
4
|
* @Date: 2025/11/11
|
|
4
5
|
* @Description:
|
|
5
6
|
*/
|
|
7
|
+
|
|
6
8
|
import { isEmptyValue } from "../utils/util";
|
|
7
9
|
import { Tag } from 'antd';
|
|
10
|
+
import isObject from 'lodash/isObject';
|
|
8
11
|
import React from 'react';
|
|
9
|
-
var CustomTag = function CustomTag(_ref
|
|
12
|
+
var CustomTag = function CustomTag(_ref) {
|
|
13
|
+
var _ref2;
|
|
10
14
|
var value = _ref.value,
|
|
11
|
-
valueEnum = _ref.valueEnum
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, _text);
|
|
15
|
+
valueEnum = _ref.valueEnum,
|
|
16
|
+
options = _ref.options;
|
|
17
|
+
// 判空
|
|
18
|
+
if (isEmptyValue(value)) return /*#__PURE__*/React.createElement(React.Fragment, null, "-");
|
|
19
|
+
|
|
20
|
+
// 判断valueEnum 和 options是否为空
|
|
21
|
+
if (!valueEnum && !options || !isObject(valueEnum) && !options || !Array.isArray(options) && !valueEnum) {
|
|
22
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, value);
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
|
|
25
|
+
// 渲染标签
|
|
26
|
+
var render = function render(color, text, tagProps) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(Tag, _extends({
|
|
28
|
+
color: color
|
|
29
|
+
}, tagProps || {}), text);
|
|
30
|
+
};
|
|
31
|
+
var newValues = (_ref2 = "".concat(value)) === null || _ref2 === void 0 ? void 0 : _ref2.split(',');
|
|
32
|
+
var result = [];
|
|
33
|
+
|
|
34
|
+
// 判断newValues长度
|
|
35
|
+
if (newValues.length === 1) {
|
|
36
|
+
newValues = [value];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 循环value值获取text || label
|
|
40
|
+
newValues.forEach(function (val) {
|
|
41
|
+
if (Array.isArray(options)) {
|
|
42
|
+
var _ref3 = options.filter(function (item) {
|
|
43
|
+
return "".concat(item.value) === "".concat(val);
|
|
44
|
+
}) || {},
|
|
45
|
+
label = _ref3.label,
|
|
46
|
+
color = _ref3.color,
|
|
47
|
+
status = _ref3.status,
|
|
48
|
+
tagProps = _ref3.tagProps;
|
|
49
|
+
result.push(render(color || status, label || val, tagProps));
|
|
50
|
+
} else {
|
|
51
|
+
var _ref4 = valueEnum[val] || {},
|
|
52
|
+
_color = _ref4.color,
|
|
53
|
+
_status = _ref4.status,
|
|
54
|
+
text = _ref4.text,
|
|
55
|
+
_tagProps = _ref4.tagProps;
|
|
56
|
+
result.push(render(_color || _status, text || val, _tagProps));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return result.map(function (item, index) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
61
|
+
key: index
|
|
62
|
+
}, item);
|
|
63
|
+
});
|
|
29
64
|
};
|
|
30
65
|
export default CustomTag;
|
package/dist/CustomTag/tag.d.ts
CHANGED
|
@@ -4,16 +4,36 @@
|
|
|
4
4
|
* @Description:
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type { TagProps } from 'antd';
|
|
8
|
+
|
|
7
9
|
interface CustomTagProps {
|
|
8
10
|
/**
|
|
9
11
|
* 标签名称
|
|
10
12
|
*/
|
|
11
|
-
value: string | number;
|
|
13
|
+
value: string | number | boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 配置数组
|
|
17
|
+
*/
|
|
18
|
+
options?: Array<{
|
|
19
|
+
[key: string | number | boolean]: any;
|
|
20
|
+
tagProps?: TagProps;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 异步数据
|
|
25
|
+
*/
|
|
26
|
+
// request?: (params: any) => Promise<any>;
|
|
12
27
|
|
|
13
28
|
/**
|
|
14
29
|
* 枚举
|
|
15
30
|
*/
|
|
16
|
-
valueEnum
|
|
17
|
-
[key: stirng
|
|
31
|
+
valueEnum?: {
|
|
32
|
+
[key: stirng | number | boolean]: {
|
|
33
|
+
text: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
color?: string;
|
|
36
|
+
tagProps?: TagProps;
|
|
37
|
+
};
|
|
18
38
|
};
|
|
19
39
|
}
|
package/dist/compontent.d.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @Description:
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ProColumns } from '@ant-design/pro-table';
|
|
8
|
-
import { Rules } from '@rc-component/async-validator';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import type { ProColumns } from '@ant-design/pro-table';
|
|
8
|
+
import type { Rules } from '@rc-component/async-validator';
|
|
9
|
+
import type { ButtonProps } from 'antd';
|
|
10
|
+
import type { ImgCropProps } from 'antd-img-crop';
|
|
11
11
|
|
|
12
12
|
interface CustomColumnProps extends ProColumns {
|
|
13
13
|
/**
|
|
@@ -82,5 +82,7 @@ interface CustomColumnProps extends ProColumns {
|
|
|
82
82
|
/**
|
|
83
83
|
* 操作按钮
|
|
84
84
|
*/
|
|
85
|
-
buttons?: (data: {
|
|
85
|
+
buttons?: (data: {
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}) => any | (ButtonProps & { text: string; order: number }[]);
|
|
86
88
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export { default as CustomModal } from './CustomFormModal';
|
|
|
5
5
|
export type { CustomFormModalProps } from './CustomFormModal/formModal';
|
|
6
6
|
export { default as CustomTable } from './CustomTable';
|
|
7
7
|
export type { CustomTableProps } from './CustomTable/table';
|
|
8
|
+
export { default as CustomScroll } from './CustomScroll';
|
|
9
|
+
export type { CustomScrollProps } from './CustomScroll/scroll';
|
|
8
10
|
export { default as CustomTag } from './CustomTag';
|
|
9
11
|
export { default as CustomUpload } from './CustomUpload';
|
|
10
12
|
export { default as DynamicIcon } from './DynamicIcon';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as CustomDetailModal } from "./CustomDetailModal";
|
|
2
2
|
export { default as CustomModal } from "./CustomFormModal";
|
|
3
3
|
export { default as CustomTable } from "./CustomTable";
|
|
4
|
+
export { default as CustomScroll } from "./CustomScroll";
|
|
4
5
|
export { default as CustomTag } from "./CustomTag";
|
|
5
6
|
export { default as CustomUpload } from "./CustomUpload";
|
|
6
7
|
export { default as DynamicIcon } from "./DynamicIcon";
|