@wufengteam/wform
Version:
@wufengteam/wform
84 lines • 3.11 kB
JavaScript
import React from 'react';
import { Skeleton, List, Checkbox, Tooltip } from 'antd';
import InfiniteScroll from 'react-infinite-scroll-component';
var MemberList = function MemberList(props) {
var _props$data = props.data,
data = _props$data === void 0 ? [] : _props$data,
loadMoreFun = props.loadMoreFun,
total = props.total,
_props$value = props.value,
value = _props$value === void 0 ? [] : _props$value,
onChange = props.onChange,
_props$height = props.height,
height = _props$height === void 0 ? 350 : _props$height;
var orgNameStyle = {
display: '-webkit-box',
color: 'rgba(28, 36, 46, 0.25)',
lineHeight: '20px',
overflow: 'hidden',
'text-overflow': 'ellipsis',
'-webkit-line-clamp': '1',
'-webkit-box-orient': 'vertical'
};
var checkChange = function checkChange(checked, vals) {
var sets = new Set(value);
if (checked) {
sets.add(vals);
} else {
sets.delete(vals);
}
onChange(Array.from(sets));
};
return /*#__PURE__*/React.createElement("div", {
id: "scrollSetId",
style: {
height: height,
overflow: 'auto'
}
}, /*#__PURE__*/React.createElement(InfiniteScroll, {
dataLength: data.length,
next: loadMoreFun,
hasMore: data.length < total,
loader: /*#__PURE__*/React.createElement(Skeleton, {
paragraph: {
rows: 1
},
active: true
}),
scrollableTarget: "scrollSetId",
key: JSON.stringify(data)
}, /*#__PURE__*/React.createElement(List, {
dataSource: data,
renderItem: function renderItem(item) {
return /*#__PURE__*/React.createElement(List.Item, {
style: {
borderBottom: 'none',
paddingTop: '0px'
}
}, /*#__PURE__*/React.createElement(Checkbox, {
key: item.staffId,
onChange: function onChange(e) {
return checkChange(e.target.checked, item === null || item === void 0 ? void 0 : item.staffId);
},
checked: value.includes(item === null || item === void 0 ? void 0 : item.staffId),
style: {
alignItems: 'center'
}
}, /*#__PURE__*/React.createElement("div", {
style: {
paddingTop: (item === null || item === void 0 ? void 0 : item.orgPathName) || (item === null || item === void 0 ? void 0 : item.orgName) ? '0' : '4px'
}
}, item === null || item === void 0 ? void 0 : item.staffName, /*#__PURE__*/React.createElement("span", {
style: {
color: 'rgba(28, 36, 46, 0.55)'
}
}, "(", item === null || item === void 0 ? void 0 : item.staffCode, ")"), /*#__PURE__*/React.createElement(Tooltip, {
title: (item === null || item === void 0 ? void 0 : item.orgPathName) || (item === null || item === void 0 ? void 0 : item.orgName),
placement: "topLeft"
}, /*#__PURE__*/React.createElement("div", {
style: orgNameStyle
}, (item === null || item === void 0 ? void 0 : item.orgPathName) || (item === null || item === void 0 ? void 0 : item.orgName))))));
}
})));
};
export default MemberList;