@chlp-tech/rpa-ui 0.0.10 → 0.0.11-beta.2

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.
@@ -1,39 +1,7 @@
1
- import React, { FC } from "react";
2
- interface AccountSelectListProps {
3
- accounts: {
4
- key: string;
5
- icon: string | React.ReactNode;
6
- disabledIcon: string | React.ReactNode;
7
- list: AccountSelectProps['list'];
8
- placeholder: string;
9
- isValid: 'img' | 'video' | 'insVideo' | undefined;
10
- multiple?: boolean;
11
- disabled?: boolean;
12
- }[];
13
- onChange?: (selected: {
14
- [key: string]: string[];
15
- }) => void;
16
- value?: {
17
- [key: string]: string[];
18
- };
1
+ import React from "react";
2
+ import { IAccountListProps, IAccountSelectProps } from "./type";
3
+ interface AccountSelectComponent extends React.FC<IAccountSelectProps> {
4
+ Group: React.FC<IAccountListProps>;
19
5
  }
20
- interface AccountSelectProps {
21
- keys: string;
22
- placeholder: string;
23
- icon: string | React.ReactNode;
24
- disabledIcon: string | React.ReactNode;
25
- list: {
26
- label: string;
27
- desc: string;
28
- isValid: boolean;
29
- value: string;
30
- isPersonTk: boolean;
31
- }[];
32
- isValid: 'img' | 'video' | 'insImg' | 'insVideo' | undefined;
33
- multiple: boolean;
34
- disabled?: boolean;
35
- onSelectionChange: (keys: string[], accountKey: string) => void;
36
- selectedValues?: string[];
37
- }
38
- declare const AccountSelectList: FC<AccountSelectListProps>;
39
- export default AccountSelectList;
6
+ declare const _default: AccountSelectComponent;
7
+ export default _default;
@@ -1,4 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -14,208 +15,217 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
14
15
  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; }
15
16
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import React, { useState, useMemo, useEffect } from "react";
18
- import { Dropdown, Row, Col, Popover, message } from "antd";
19
- import styles from "./index.module.less";
18
+ import React from "react";
20
19
  import DownIcon from "./imgs/down.svg";
21
20
  import UpIcon from "./imgs/up.svg";
21
+ import { Col, Empty, Input, Popover, Row, Tooltip } from "antd";
22
+ import { TextEllipsis } from "../index";
23
+ import { SearchOutlined } from "@ant-design/icons";
24
+ import classNames from "classnames";
25
+ import styles from "./index.module.less";
22
26
  var AccountSelect = function AccountSelect(props) {
23
- var _useState = useState(false),
24
- _useState2 = _slicedToArray(_useState, 2),
25
- open = _useState2[0],
26
- setOpen = _useState2[1];
27
- var _useState3 = useState(props.selectedValues || []),
28
- _useState4 = _slicedToArray(_useState3, 2),
29
- selectedKeys = _useState4[0],
30
- setSelectedKeys = _useState4[1];
31
- useEffect(function () {
32
- setSelectedKeys(props.selectedValues || []);
33
- }, [props.selectedValues]);
34
- var handleOpenChange = function handleOpenChange(nextOpen, info) {
35
- if (!props.disabled && (info.source === 'trigger' || nextOpen)) {
36
- setOpen(nextOpen);
37
- }
27
+ var _props$placeholder = props.placeholder,
28
+ placeholder = _props$placeholder === void 0 ? '请选择账号' : _props$placeholder,
29
+ _props$multiple = props.multiple,
30
+ multiple = _props$multiple === void 0 ? false : _props$multiple;
31
+ var _React$useState = React.useState(false),
32
+ _React$useState2 = _slicedToArray(_React$useState, 2),
33
+ open = _React$useState2[0],
34
+ setOpen = _React$useState2[1];
35
+ var _React$useState3 = React.useState(props.options || []),
36
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
37
+ optionList = _React$useState4[0],
38
+ setOptionList = _React$useState4[1];
39
+ var _React$useState5 = React.useState(props.defaultSelectList || []),
40
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
41
+ selectedKeys = _React$useState6[0],
42
+ setSelectedKeys = _React$useState6[1];
43
+ var handleClearAll = function handleClearAll() {
44
+ var _props$onChange;
45
+ setSelectedKeys([]);
46
+ setOpen(false);
47
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, []);
38
48
  };
39
- var handleChange = function handleChange(value) {
40
- var _props$list;
41
- if ((_props$list = props.list) !== null && _props$list !== void 0 && (_props$list = _props$list.find(function (item) {
42
- return item.value === value.key;
43
- })) !== null && _props$list !== void 0 && _props$list.isPersonTk) {
44
- message.error('旧版TK账号无法发布,请前往社媒管理重新绑定账号');
45
- return;
49
+ var renderSelectInfo = function renderSelectInfo() {
50
+ var _props$options;
51
+ if (selectedKeys.length <= 0) {
52
+ return null;
46
53
  }
47
- if (!props.disabled) {
48
- setSelectedKeys(function (prevState) {
49
- var newSelectedKeys;
50
- if (prevState.includes(value.key)) {
51
- newSelectedKeys = prevState.filter(function (item) {
52
- return item !== value.key;
53
- });
54
- } else {
55
- newSelectedKeys = props.multiple ? [].concat(_toConsumableArray(prevState), [value.key]) : [value.key];
56
- }
57
- props.onSelectionChange(newSelectedKeys, props.keys);
58
- return newSelectedKeys;
59
- });
54
+ if (props.multiple) {
55
+ return /*#__PURE__*/React.createElement("div", null, "\u5DF2\u9009\u62E9$", selectedKeys.length, "\u4E2A");
60
56
  }
57
+ var info = (_props$options = props.options) === null || _props$options === void 0 || (_props$options = _props$options.filter(function (item) {
58
+ return item.id === selectedKeys[0];
59
+ })) === null || _props$options === void 0 ? void 0 : _props$options[0];
60
+ return /*#__PURE__*/React.createElement("div", {
61
+ className: styles.selectInfoBox
62
+ }, /*#__PURE__*/React.createElement("div", {
63
+ className: styles.accountName
64
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
65
+ lines: 1,
66
+ showTooltip: false
67
+ }, info === null || info === void 0 ? void 0 : info.accountName)), /*#__PURE__*/React.createElement("div", {
68
+ className: styles.languageText
69
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
70
+ lines: 1,
71
+ showTooltip: false
72
+ }, (info === null || info === void 0 ? void 0 : info.remark) || '--')));
61
73
  };
62
- var handleClearAll = function handleClearAll() {
63
- setSelectedKeys([]);
64
- setOpen(false);
65
- props.onSelectionChange([], props.keys);
74
+ var renderAccountView = function renderAccountView() {
75
+ return /*#__PURE__*/React.createElement("div", {
76
+ className: styles.box
77
+ }, props.disabled && typeof props.disabledIcon === "string" || !props.disabled && typeof props.icon === 'string' ? /*#__PURE__*/React.createElement("img", {
78
+ width: 48,
79
+ height: 48,
80
+ alt: "",
81
+ src: props.disabled ? props.disabledIcon : props.icon
82
+ }) : /*#__PURE__*/React.createElement("div", null, props.disabled ? props.disabledIcon : props.icon), /*#__PURE__*/React.createElement("div", {
83
+ className: styles.centerContentBox
84
+ }, selectedKeys.length <= 0 && /*#__PURE__*/React.createElement("div", {
85
+ className: styles.placeHolderText
86
+ }, placeholder), selectedKeys.length > 0 && (props.renderSelectStatus ? props.renderSelectStatus(selectedKeys) : renderSelectInfo())), /*#__PURE__*/React.createElement("img", {
87
+ src: (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.length) > 0 ? UpIcon : DownIcon,
88
+ alt: "",
89
+ onClick: function onClick() {
90
+ if ((selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.length) > 0) {
91
+ handleClearAll === null || handleClearAll === void 0 || handleClearAll();
92
+ }
93
+ }
94
+ }));
95
+ };
96
+ var onClickItem = function onClickItem(item) {
97
+ // const newList = [];
98
+ if (multiple) {
99
+ var _props$onChange2;
100
+ var newList = _toConsumableArray(selectedKeys);
101
+ if (newList.includes(item.id)) {
102
+ newList.unshift(item.id);
103
+ } else {
104
+ newList.push(item.id);
105
+ }
106
+ setSelectedKeys(newList);
107
+ (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, newList);
108
+ } else {
109
+ var _props$onChange3;
110
+ var _newList = [item.id];
111
+ setSelectedKeys(_newList);
112
+ (_props$onChange3 = props.onChange) === null || _props$onChange3 === void 0 || _props$onChange3.call(props, _newList);
113
+ setOpen(false);
114
+ }
66
115
  };
67
- var list = props.list;
68
- var isValid = useMemo(function () {
69
- return list.every(function (item) {
70
- return item.isValid;
116
+ var onSearchChange = function onSearchChange(e) {
117
+ var _props$options2;
118
+ console.log(e.target.value);
119
+ var searchValue = (e.target.value || '').toString().toLowerCase();
120
+ var list = (_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _props$options2.filter(function (item) {
121
+ var accountName = (item.accountName || '').toString().toLowerCase();
122
+ var ownerName = (item.ownerName || '').toString().toLowerCase();
123
+ return accountName.includes(searchValue) || ownerName.includes(searchValue);
71
124
  });
72
- }, [list]);
73
- var content = useMemo(function () {
74
- switch (props.isValid) {
75
- case 'img':
76
- return ['大小不超过8M', '尺寸需大于4:5,小于1.91:1'];
77
- case 'insImg':
78
- return ['Instagram 视频宽不能超过 1920像素'];
79
- case 'insVideo':
80
- return ['视频宽高需小于1080*1920'];
81
- case 'video':
82
- return ['视频宽和高需大于360px,小于4096px', '视频帧率需要大于23fps,小于60fps'];
83
- default:
84
- return [];
125
+ setOptionList(list || []);
126
+ };
127
+ var getLanguageAndCountryList = function getLanguageAndCountryList(item) {
128
+ var list = [];
129
+ if (item.country) {
130
+ list.push(item.country);
85
131
  }
86
- }, [props.isValid]);
132
+ if (item.language) {
133
+ list.push(item.language);
134
+ }
135
+ return list;
136
+ };
87
137
  return /*#__PURE__*/React.createElement(Popover, {
88
- content: /*#__PURE__*/React.createElement("div", {
89
- className: styles['popover_title']
90
- }, content.map(function (item, index) {
91
- return /*#__PURE__*/React.createElement("div", {
92
- key: index,
93
- className: styles['popover_item']
94
- }, item);
95
- })),
96
- open: !!content.length
97
- }, /*#__PURE__*/React.createElement(Dropdown, {
98
138
  trigger: ['click'],
99
- onOpenChange: handleOpenChange,
100
- open: open,
101
- disabled: props.disabled,
102
- overlayStyle: {
103
- width: 296,
104
- boxShadow: "0px 9px 28px 8px rgba(0,0,0,0.05), 0px 6px 16px 0px rgba(0,0,0,0.08), 0px 3px 6px -4px rgba(0,0,0,0.12)",
105
- borderRadius: 8
139
+ classNames: {
140
+ root: styles.popBox
141
+ },
142
+ onOpenChange: function onOpenChange(open) {
143
+ return setOpen(open);
106
144
  },
107
- menu: {
108
- selectedKeys: selectedKeys,
109
- onClick: handleChange,
110
- items: props.isValid ? [] : list.map(function (item) {
111
- return {
112
- key: item.value,
145
+ arrow: false,
146
+ placement: "bottomLeft",
147
+ open: open,
148
+ content: function content() {
149
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
150
+ style: {
151
+ height: '36px',
152
+ color: '#142A51'
153
+ },
154
+ prefix: /*#__PURE__*/React.createElement(SearchOutlined, {
113
155
  style: {
114
- background: !item.isValid ? '#FEECEC' : selectedKeys.includes(item.value) ? '#E9F1FF' : '#FFFFFF'
115
- },
116
- label: /*#__PURE__*/React.createElement("div", {
117
- style: {
118
- display: 'flex',
119
- justifyContent: 'space-between',
120
- alignItems: 'center'
121
- }
122
- }, /*#__PURE__*/React.createElement("div", {
123
- className: styles['wrap_title'],
124
- style: {
125
- maxWidth: 110,
126
- overflow: 'hidden',
127
- textOverflow: 'ellipsis',
128
- whiteSpace: 'nowrap'
129
- }
130
- }, item.label), item !== null && item !== void 0 && item.isPersonTk ? /*#__PURE__*/React.createElement("div", {
131
- style: {
132
- padding: '2px 8px',
133
- background: 'rgba(254, 236, 236, 1)',
134
- color: '#FA4441',
135
- border: '1px solid rgba(250, 68, 65, 1)',
136
- borderRadius: 4,
137
- whiteSpace: 'nowrap'
138
- }
139
- }, "\u65E7\u7248\u8D26\u53F7") : null, /*#__PURE__*/React.createElement("div", {
140
- className: styles['wrap_right_desc'],
141
- style: {
142
- width: 77,
143
- overflow: 'hidden',
144
- textOverflow: 'ellipsis',
145
- whiteSpace: 'nowrap'
146
- }
147
- }, item.desc)),
148
- disabled: !item.isValid
149
- };
150
- })
156
+ color: '#9EA7B5'
157
+ }
158
+ }),
159
+ placeholder: "\u641C\u7D22\u6210\u5458\u6216\u8D26\u53F7\u540D",
160
+ onChange: onSearchChange
161
+ }), /*#__PURE__*/React.createElement("div", {
162
+ className: styles.scrollBox
163
+ }, optionList.map(function (item) {
164
+ var _item$ownerName, _item$ownerName2, _item$ownerName3;
165
+ var languageAndCountryList = getLanguageAndCountryList(item);
166
+ return /*#__PURE__*/React.createElement("div", {
167
+ key: item.id,
168
+ className: classNames(styles.rowBox, _defineProperty(_defineProperty(_defineProperty({}, styles.rowBoxClick, true), styles.rowBoxSelect, selectedKeys.includes(item.id)), styles.rowBoxDisable, item.disabled)),
169
+ onClick: function onClick() {
170
+ return onClickItem(item);
171
+ }
172
+ }, /*#__PURE__*/React.createElement("div", {
173
+ className: styles.name
174
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
175
+ lines: 1,
176
+ showTooltip: false
177
+ }, item.accountName || '--')), /*#__PURE__*/React.createElement("div", {
178
+ className: styles.remark
179
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
180
+ lines: 1,
181
+ showTooltip: false
182
+ }, item.remark || '无描述')), /*#__PURE__*/React.createElement("div", {
183
+ className: styles.countryAndLanguage
184
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
185
+ lines: 1,
186
+ showTooltip: false
187
+ }, languageAndCountryList.join('/'))), /*#__PURE__*/React.createElement("div", {
188
+ className: styles.userWrap
189
+ }, /*#__PURE__*/React.createElement(Tooltip, {
190
+ title: item.ownerName && ((_item$ownerName = item.ownerName) === null || _item$ownerName === void 0 ? void 0 : _item$ownerName.length) > 4 ? item.ownerName : ''
191
+ }, /*#__PURE__*/React.createElement("div", {
192
+ className: styles.userBox
193
+ }, item.ownerName && ((_item$ownerName2 = item.ownerName) === null || _item$ownerName2 === void 0 ? void 0 : _item$ownerName2.length) > 4 ? "".concat((_item$ownerName3 = item.ownerName) === null || _item$ownerName3 === void 0 ? void 0 : _item$ownerName3.slice(0, 4), "...") : item.ownerName))));
194
+ }), optionList.length <= 0 && /*#__PURE__*/React.createElement(Empty, {
195
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
196
+ description: "\u6682\u65E0\u6570\u636E"
197
+ })));
151
198
  }
152
- }, /*#__PURE__*/React.createElement("div", {
153
- className: "".concat(styles['wrap'], " ").concat(props.disabled ? styles['wrap_disabled'] : ''),
154
- style: {
155
- border: !isValid ? '2px solid #FA4441' : selectedKeys.length > 0 ? '2px solid #004FD3' : '1px solid #D4DBE7'
156
- }
157
- }, typeof props.icon === 'string' && typeof props.disabledIcon === 'string' ? /*#__PURE__*/React.createElement("img", {
158
- width: 48,
159
- height: 48,
160
- src: list.length && !props.disabled ? props.icon : props.disabledIcon,
161
- alt: ""
162
- }) : /*#__PURE__*/React.createElement("div", {
163
- style: {
164
- width: 48,
165
- height: 48
166
- }
167
- }, list.length && !props.disabled ? props.icon : props.disabledIcon), /*#__PURE__*/React.createElement("div", {
168
- className: styles['wrap_desc'],
169
- style: {
170
- color: selectedKeys.length > 0 ? '#142A51' : '#9EA7B5',
171
- fontWeight: selectedKeys.length > 0 ? 500 : 400
172
- }
173
- }, list.length < 1 ? "\u6682\u65E0\u7ED1\u5B9A".concat(props.placeholder) : selectedKeys.length > 0 ? "\u5DF2\u9009\u62E9".concat(selectedKeys.length, "\u4E2A").concat(props.placeholder) : "\u8BF7\u9009\u62E9".concat(props.placeholder)), selectedKeys.length > 0 ? /*#__PURE__*/React.createElement("img", {
174
- src: UpIcon,
175
- alt: "",
176
- onClick: handleClearAll
177
- }) : /*#__PURE__*/React.createElement("img", {
178
- src: DownIcon,
179
- alt: ""
180
- }))));
199
+ }, renderAccountView());
181
200
  };
182
- var AccountSelectList = function AccountSelectList(_ref) {
183
- var accounts = _ref.accounts,
184
- onChange = _ref.onChange,
185
- _ref$value = _ref.value,
186
- value = _ref$value === void 0 ? {} : _ref$value;
187
- var _useState5 = useState(value),
188
- _useState6 = _slicedToArray(_useState5, 2),
189
- selectedAccounts = _useState6[0],
190
- setSelectedAccounts = _useState6[1];
191
- useEffect(function () {
192
- setSelectedAccounts(value);
193
- }, [value]);
194
- var handleSelectionChange = function handleSelectionChange(keys, accountKey) {
195
- setSelectedAccounts(function (prevState) {
196
- var newState = _objectSpread(_objectSpread({}, prevState), {}, _defineProperty({}, accountKey, keys));
197
- onChange === null || onChange === void 0 || onChange(newState);
198
- return newState;
199
- });
200
- };
201
+ var AccountSelectList = function AccountSelectList(props) {
202
+ var _props$accounts;
203
+ var _React$useState7 = React.useState({}),
204
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
205
+ selectValues = _React$useState8[0],
206
+ setSelectValues = _React$useState8[1];
201
207
  return /*#__PURE__*/React.createElement(Row, {
202
208
  gutter: [32, 32]
203
- }, accounts === null || accounts === void 0 ? void 0 : accounts.map(function (account, index) {
209
+ }, (_props$accounts = props.accounts) === null || _props$accounts === void 0 ? void 0 : _props$accounts.map(function (account, index) {
204
210
  return /*#__PURE__*/React.createElement(Col, {
205
211
  span: 8,
206
212
  key: index
207
- }, /*#__PURE__*/React.createElement(AccountSelect, {
208
- keys: account.key,
209
- list: account.list,
210
- placeholder: account.placeholder,
211
- icon: account.icon,
212
- disabledIcon: account.disabledIcon,
213
- isValid: account.isValid,
214
- multiple: account.multiple || false,
215
- disabled: account.disabled || false,
216
- onSelectionChange: handleSelectionChange,
217
- selectedValues: selectedAccounts[account.key]
218
- }));
213
+ }, /*#__PURE__*/React.createElement(AccountSelect, _extends({}, account, {
214
+ onChange: function onChange(values) {
215
+ var _props$onChange4;
216
+ var tValues = _objectSpread({}, selectValues);
217
+ tValues[account.key] = values;
218
+ setSelectValues(tValues);
219
+ (_props$onChange4 = props.onChange) === null || _props$onChange4 === void 0 || _props$onChange4.call(props, tValues);
220
+ }
221
+ })));
219
222
  }));
220
223
  };
221
- export default AccountSelectList;
224
+
225
+ // 类型扩展 - 声明 AccountSelect 包含 Group 属性
226
+
227
+ // 将 AccountSelectList 附加为 AccountSelect 的静态属性
228
+ AccountSelect.Group = AccountSelectList;
229
+
230
+ // 导出带有 Group 属性的 AccountSelect
231
+ export default AccountSelect;
@@ -1,58 +1,133 @@
1
- .wrap {
2
- padding: 2px 17px 2px 2px;
3
- border-radius: 25px;
1
+ .box {
4
2
  display: flex;
5
- justify-content: space-between;
3
+ flex-direction: row;
6
4
  align-items: center;
5
+ justify-content: space-between;
6
+
7
+ padding: 2px 17px 2px 2px;
8
+ border-radius: 999px;
7
9
  cursor: pointer;
8
10
 
9
- &_desc {
10
- font-family: PingFangSC, PingFang SC;
11
- font-weight: 400;
11
+ border: 1px solid #D4DBE7;
12
+
13
+ .placeHolderText {
12
14
  font-size: 14px;
13
15
  color: #9EA7B5;
14
16
  }
15
17
 
16
- &active_desc {
17
- font-family: PingFangSC, PingFang SC;
18
- font-weight: 500;
19
- font-size: 14px;
20
- color: #142A51;
18
+ .centerContentBox {
19
+ flex: 1;
20
+ overflow: hidden;
21
+ margin: 0 12px;
22
+
23
+ .selectInfoBox {
24
+ display: flex;
25
+ flex-direction: row;
26
+ align-items: center;
27
+ .accountName {
28
+ color: #142A51;
29
+ font-size: 14px;
30
+ max-width: 66%;
31
+ flex: 2;
32
+ }
33
+
34
+ .languageText {
35
+ font-size: 12px;
36
+ color: #9EA7B5;
37
+ flex: 1;
38
+ max-width: 33%;
39
+ }
40
+ }
21
41
  }
42
+ }
22
43
 
23
- &_title {
24
- font-family: PingFangSC, PingFang SC;
25
- font-weight: 400;
26
- font-size: 14px;
27
- color: #142A51;
44
+ .popBox {
45
+ width: 481px;
46
+ background: #FFFFFF;
47
+ box-shadow: 0 9px 28px 8px rgba(0,0,0,0.05), 0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12);
48
+ border-radius: 8px;
49
+
50
+ :global {
51
+ .ant-popover-inner {
52
+ padding: 4px;
53
+ }
28
54
  }
29
55
 
30
- &_right_desc {
31
- font-family: PingFangSC, PingFang SC;
32
- font-weight: 400;
33
- font-size: 12px;
34
- color: #9EA7B5;
56
+ .scrollBox {
57
+ display: flex;
58
+ flex-direction: column;
59
+ max-height: 50vh;
60
+ overflow: auto;
61
+ margin-top: 4px;
62
+ gap: 2px;
35
63
  }
36
- }
37
64
 
38
- .wrap_no_active {
39
- background: #F5F7FA;
40
- border-radius: 25px;
41
- border: 1px solid #D4DBE7;
42
- padding: 2px 17px 2px 2px;
43
- display: flex;
44
- justify-content: space-between;
45
- align-items: center;
46
- cursor: pointer;
47
- }
65
+ .rowBox {
66
+ display: flex;
67
+ flex-direction: row;
68
+ align-items: center;
69
+ padding: 12px 12px;
70
+ gap: 12px;
71
+
72
+ &:hover {
73
+ background-color: #F5F7FA;
74
+ border-radius: 4px;
75
+ }
48
76
 
77
+ .name {
78
+ font-size: 14px;
79
+ color: #142A51;
80
+ width: 130px;
81
+ }
49
82
 
50
- .popover_title {
51
- font-family: PingFangSC, PingFang SC;
52
- font-weight: 400;
53
- font-size: 14px;
54
- color: #FA4441;
55
- line-height: 20px;
56
- text-align: left;
57
- font-style: normal;
83
+ .remark {
84
+ font-size: 12px;
85
+ color: #9EA7B5;
86
+ flex: 1;
87
+ }
88
+
89
+ .countryAndLanguage {
90
+ font-size: 12px;
91
+ color: #9EA7B5;
92
+ width: 80px;
93
+ }
94
+
95
+ .userWrap {
96
+ width: 80px;
97
+ display: flex;
98
+ flex-direction: row;
99
+ justify-content: flex-end;
100
+ }
101
+ .userBox {
102
+ width: max-content;
103
+ background: #E9F1FF;
104
+ border-radius: 4px;
105
+ border: 1px solid #004FD3;
106
+ padding: 4px 8px;
107
+
108
+ font-size: 12px;
109
+ color: #004FD3;
110
+ }
111
+ }
112
+
113
+ .rowBoxClick {
114
+ cursor: pointer;
115
+ }
116
+
117
+ .rowBoxSelect {
118
+ background-color: #e6f3ff;
119
+ border-radius: 4px;
120
+ &:hover {
121
+ background-color: #e6f3ff;
122
+ }
123
+ }
124
+
125
+ .rowBoxDisable {
126
+ cursor: not-allowed;
127
+
128
+ &:hover {
129
+ background-color: #fff;
130
+ }
131
+ }
58
132
  }
133
+
@@ -0,0 +1,82 @@
1
+ import React, { ReactElement } from "react";
2
+ export interface IAccountSelectProps {
3
+ /**
4
+ * 普通状态下的icon
5
+ */
6
+ icon?: string | React.ReactElement;
7
+ /**
8
+ * 禁用状态下的icon
9
+ */
10
+ disabledIcon?: string | React.ReactElement;
11
+ /**
12
+ * 默认选中的条数
13
+ */
14
+ defaultSelectList?: (number | string)[];
15
+ /**
16
+ * 没有选择文件的时候默认提示文案
17
+ */
18
+ placeholder?: string | React.ReactElement;
19
+ /**
20
+ * 是否禁用
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * 是否多选
25
+ */
26
+ multiple?: boolean;
27
+ /**
28
+ * 选项发生变化触发
29
+ * @param values
30
+ */
31
+ onChange?: (values: (string | number)[]) => void;
32
+ /**
33
+ * 下拉选项列表
34
+ */
35
+ options?: IAccountOptionModel[];
36
+ /**
37
+ * 自定义渲染选择之后的视图
38
+ * @param values
39
+ */
40
+ renderSelectStatus: (values: (string | number)[]) => ReactElement;
41
+ }
42
+ export interface IAccountOptionModel {
43
+ /**
44
+ * 选项唯一值
45
+ */
46
+ id: string | number;
47
+ /**
48
+ * 账号名
49
+ */
50
+ accountName?: string;
51
+ /**
52
+ * 备注
53
+ */
54
+ remark?: string;
55
+ /**
56
+ * 国家
57
+ */
58
+ country?: string;
59
+ /**
60
+ * 语言
61
+ */
62
+ language?: string;
63
+ /**
64
+ * 所属人员
65
+ */
66
+ ownerName?: string;
67
+ /**
68
+ * 不可操作
69
+ */
70
+ disabled?: boolean;
71
+ }
72
+ export interface IAccountListProps {
73
+ accounts: (IAccountSelectProps & {
74
+ key: string;
75
+ })[];
76
+ onChange?: (selected: {
77
+ [key: string]: string[];
78
+ }) => void;
79
+ value?: {
80
+ [key: string]: string[];
81
+ };
82
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -194,7 +194,7 @@ var ReleaseVideoCard = function ReleaseVideoCard(props) {
194
194
  marginRight: 12,
195
195
  cursor: 'pointer'
196
196
  }
197
- }, [0, 1].includes(props.status) ? /*#__PURE__*/React.createElement(React.Fragment, null, (_props$editComponent = props.editComponent) !== null && _props$editComponent !== void 0 ? _props$editComponent : /*#__PURE__*/React.createElement("span", null, "\u7F16\u8F91")) : [2, 3].includes(props.status) ? /*#__PURE__*/React.createElement(React.Fragment, null, (_props$detailComponen = props.detailComponent) !== null && _props$detailComponen !== void 0 ? _props$detailComponen : /*#__PURE__*/React.createElement("span", null, "\u8BE6\u60C5")) : null), /*#__PURE__*/React.createElement(Dropdown, {
197
+ }, [0, 1].includes(props.status) ? /*#__PURE__*/React.createElement(React.Fragment, null, (_props$editComponent = props.editComponent) !== null && _props$editComponent !== void 0 ? _props$editComponent : /*#__PURE__*/React.createElement("span", null, "\u7F16\u8F91")) : [2, 3].includes(props.status) ? /*#__PURE__*/React.createElement(React.Fragment, null, (_props$detailComponen = props.detailComponent) !== null && _props$detailComponen !== void 0 ? _props$detailComponen : /*#__PURE__*/React.createElement("span", null, "\u8BE6\u60C5")) : null), [0, 1].includes(props.status) ? /*#__PURE__*/React.createElement(Dropdown, {
198
198
  trigger: ['click'],
199
199
  menu: {
200
200
  items: [{
@@ -212,7 +212,7 @@ var ReleaseVideoCard = function ReleaseVideoCard(props) {
212
212
  }, /*#__PURE__*/React.createElement(Image, {
213
213
  src: More,
214
214
  preview: false
215
- }))))), props.isNew && /*#__PURE__*/React.createElement("div", {
215
+ }))) : null)), props.isNew && /*#__PURE__*/React.createElement("div", {
216
216
  className: styles['new-position']
217
217
  }, /*#__PURE__*/React.createElement(Image, {
218
218
  src: New,
@@ -27,7 +27,7 @@ var TextEllipsis = function TextEllipsis(_ref) {
27
27
  var parentElement = parentRef.current;
28
28
  var parentWidth = parentElement.clientWidth;
29
29
  var textWidth = textElement.scrollWidth;
30
- setIsTruncated(textWidth > parentWidth);
30
+ setIsTruncated(textWidth >= parentWidth);
31
31
  }
32
32
  };
33
33
  checkTruncation();
@@ -41,17 +41,21 @@ var TextEllipsis = function TextEllipsis(_ref) {
41
41
  }, /*#__PURE__*/React.createElement("div", {
42
42
  className: styles['text-ellipsis'],
43
43
  ref: parentRef,
44
+ style: {
45
+ width: '100%'
46
+ }
47
+ }, /*#__PURE__*/React.createElement("div", {
48
+ ref: textRef,
44
49
  style: {
45
50
  display: '-webkit-box',
51
+ width: 'max-content',
52
+ maxWidth: '100%',
46
53
  WebkitBoxOrient: 'vertical',
47
54
  WebkitLineClamp: lines,
48
55
  overflow: 'hidden',
49
56
  textOverflow: 'ellipsis',
50
- width: '100%',
51
57
  wordBreak: 'break-all'
52
58
  }
53
- }, /*#__PURE__*/React.createElement("div", {
54
- ref: textRef
55
59
  }, children)));
56
60
  };
57
61
  export default TextEllipsis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chlp-tech/rpa-ui",
3
- "version": "0.0.10",
3
+ "version": "0.0.11-beta.2",
4
4
  "description": "rpa-ui",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@ant-design/icons": ">=4.18.0",
39
- "antd": ">=4.18.0",
39
+ "antd": ">=5.25.0",
40
40
  "react": ">=16.9.0",
41
41
  "react-dom": ">=16.9.0"
42
42
  },
@@ -62,6 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@webav/av-cliper": "^1.0.11",
65
+ "classnames": "^2.5.1",
65
66
  "dayjs": "^1.11.13",
66
67
  "js-md5": "^0.8.3",
67
68
  "styled-components": "^6.1.12"