@chlp-tech/rpa-ui 0.0.9 → 0.0.11-beta.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.
@@ -1,39 +1,9 @@
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
+ declare namespace AccountSelectComponent {
4
+ interface StaticComponents {
5
+ Group: React.FC<IAccountListProps>;
6
+ }
19
7
  }
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;
8
+ declare const AccountSelect: React.FC<IAccountSelectProps> & AccountSelectComponent.StaticComponents;
9
+ export default AccountSelect;
@@ -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,224 @@ 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, { useEffect } 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";
26
+
27
+ // eslint-disable-next-line @typescript-eslint/no-namespace
28
+
22
29
  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
- }
30
+ var _props$placeholder = props.placeholder,
31
+ placeholder = _props$placeholder === void 0 ? '请选择账号' : _props$placeholder,
32
+ _props$multiple = props.multiple,
33
+ multiple = _props$multiple === void 0 ? false : _props$multiple;
34
+ var _React$useState = React.useState(false),
35
+ _React$useState2 = _slicedToArray(_React$useState, 2),
36
+ open = _React$useState2[0],
37
+ setOpen = _React$useState2[1];
38
+ var _React$useState3 = React.useState(props.options || []),
39
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
40
+ optionList = _React$useState4[0],
41
+ setOptionList = _React$useState4[1];
42
+ var _React$useState5 = React.useState(props.defaultSelectList || []),
43
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
44
+ selectedKeys = _React$useState6[0],
45
+ setSelectedKeys = _React$useState6[1];
46
+ var handleClearAll = function handleClearAll() {
47
+ var _props$onChange;
48
+ setSelectedKeys([]);
49
+ setOpen(false);
50
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, []);
38
51
  };
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;
52
+ var renderSelectInfo = function renderSelectInfo() {
53
+ var _props$options;
54
+ if (selectedKeys.length <= 0) {
55
+ return null;
46
56
  }
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
- });
57
+ if (props.multiple) {
58
+ return /*#__PURE__*/React.createElement("div", null, "\u5DF2\u9009\u62E9$", selectedKeys.length, "\u4E2A");
60
59
  }
60
+ var info = (_props$options = props.options) === null || _props$options === void 0 || (_props$options = _props$options.filter(function (item) {
61
+ return item.id === selectedKeys[0];
62
+ })) === null || _props$options === void 0 ? void 0 : _props$options[0];
63
+ return /*#__PURE__*/React.createElement("div", {
64
+ className: styles.selectInfoBox
65
+ }, /*#__PURE__*/React.createElement("div", {
66
+ className: styles.accountName
67
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
68
+ lines: 1,
69
+ showTooltip: false
70
+ }, info === null || info === void 0 ? void 0 : info.accountName)), /*#__PURE__*/React.createElement("div", {
71
+ className: styles.languageText
72
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
73
+ lines: 1,
74
+ showTooltip: false
75
+ }, (info === null || info === void 0 ? void 0 : info.remark) || '--')));
61
76
  };
62
- var handleClearAll = function handleClearAll() {
63
- setSelectedKeys([]);
64
- setOpen(false);
65
- props.onSelectionChange([], props.keys);
77
+ var renderAccountView = function renderAccountView() {
78
+ return /*#__PURE__*/React.createElement("div", {
79
+ className: styles.box
80
+ }, props.disabled && typeof props.disabledIcon === "string" || !props.disabled && typeof props.icon === 'string' ? /*#__PURE__*/React.createElement("img", {
81
+ width: 48,
82
+ height: 48,
83
+ alt: "",
84
+ src: props.disabled ? props.disabledIcon : props.icon
85
+ }) : /*#__PURE__*/React.createElement("div", null, props.disabled ? props.disabledIcon : props.icon), /*#__PURE__*/React.createElement("div", {
86
+ className: styles.centerContentBox
87
+ }, selectedKeys.length <= 0 && /*#__PURE__*/React.createElement("div", {
88
+ className: styles.placeHolderText
89
+ }, placeholder), selectedKeys.length > 0 && (props.renderSelectStatus ? props.renderSelectStatus(selectedKeys) : renderSelectInfo())), /*#__PURE__*/React.createElement("img", {
90
+ src: (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.length) > 0 ? UpIcon : DownIcon,
91
+ alt: "",
92
+ onClick: function onClick() {
93
+ if ((selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.length) > 0) {
94
+ handleClearAll === null || handleClearAll === void 0 || handleClearAll();
95
+ }
96
+ }
97
+ }));
98
+ };
99
+ var onClickItem = function onClickItem(item) {
100
+ // const newList = [];
101
+ if (multiple) {
102
+ var _props$onChange2;
103
+ var newList = _toConsumableArray(selectedKeys);
104
+ if (newList.includes(item.id)) {
105
+ newList.unshift(item.id);
106
+ } else {
107
+ newList.push(item.id);
108
+ }
109
+ setSelectedKeys(newList);
110
+ (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, newList);
111
+ } else {
112
+ var _props$onChange3;
113
+ var _newList = [item.id];
114
+ setSelectedKeys(_newList);
115
+ (_props$onChange3 = props.onChange) === null || _props$onChange3 === void 0 || _props$onChange3.call(props, _newList);
116
+ setOpen(false);
117
+ }
66
118
  };
67
- var list = props.list;
68
- var isValid = useMemo(function () {
69
- return list.every(function (item) {
70
- return item.isValid;
119
+ var onSearchChange = function onSearchChange(e) {
120
+ var _props$options2;
121
+ console.log(e.target.value);
122
+ var searchValue = (e.target.value || '').toString().toLowerCase();
123
+ var list = (_props$options2 = props.options) === null || _props$options2 === void 0 ? void 0 : _props$options2.filter(function (item) {
124
+ var accountName = (item.accountName || '').toString().toLowerCase();
125
+ var ownerName = (item.ownerName || '').toString().toLowerCase();
126
+ return accountName.includes(searchValue) || ownerName.includes(searchValue);
71
127
  });
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 [];
128
+ setOptionList(list || []);
129
+ };
130
+ var getLanguageAndCountryList = function getLanguageAndCountryList(item) {
131
+ var list = [];
132
+ if (item.country) {
133
+ list.push(item.country);
134
+ }
135
+ if (item.language) {
136
+ list.push(item.language);
85
137
  }
86
- }, [props.isValid]);
138
+ return list;
139
+ };
87
140
  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
141
  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
142
+ classNames: {
143
+ root: styles.popBox
144
+ },
145
+ onOpenChange: function onOpenChange(open) {
146
+ return setOpen(open);
106
147
  },
107
- menu: {
108
- selectedKeys: selectedKeys,
109
- onClick: handleChange,
110
- items: props.isValid ? [] : list.map(function (item) {
111
- return {
112
- key: item.value,
148
+ arrow: false,
149
+ placement: "bottomLeft",
150
+ open: open,
151
+ content: function content() {
152
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
153
+ style: {
154
+ height: '36px',
155
+ color: '#142A51'
156
+ },
157
+ prefix: /*#__PURE__*/React.createElement(SearchOutlined, {
113
158
  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
- })
151
- }
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'
159
+ color: '#9EA7B5'
160
+ }
161
+ }),
162
+ placeholder: "\u641C\u7D22\u6210\u5458\u6216\u8D26\u53F7\u540D",
163
+ onChange: onSearchChange
164
+ }), /*#__PURE__*/React.createElement("div", {
165
+ className: styles.scrollBox
166
+ }, optionList.map(function (item) {
167
+ var _item$ownerName, _item$ownerName2, _item$ownerName3;
168
+ var languageAndCountryList = getLanguageAndCountryList(item);
169
+ return /*#__PURE__*/React.createElement("div", {
170
+ key: item.id,
171
+ className: classNames(styles.rowBox, _defineProperty(_defineProperty(_defineProperty({}, styles.rowBoxClick, true), styles.rowBoxSelect, selectedKeys.includes(item.id)), styles.rowBoxDisable, item.disabled)),
172
+ onClick: function onClick() {
173
+ return onClickItem(item);
174
+ }
175
+ }, /*#__PURE__*/React.createElement("div", {
176
+ className: styles.name
177
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
178
+ lines: 1,
179
+ showTooltip: false
180
+ }, item.accountName || '--')), /*#__PURE__*/React.createElement("div", {
181
+ className: styles.remark
182
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
183
+ lines: 1,
184
+ showTooltip: false
185
+ }, item.remark || '无描述')), /*#__PURE__*/React.createElement("div", {
186
+ className: styles.countryAndLanguage
187
+ }, /*#__PURE__*/React.createElement(TextEllipsis, {
188
+ lines: 1,
189
+ showTooltip: false
190
+ }, languageAndCountryList.join('/'))), /*#__PURE__*/React.createElement("div", {
191
+ className: styles.userWrap
192
+ }, /*#__PURE__*/React.createElement(Tooltip, {
193
+ title: item.ownerName && ((_item$ownerName = item.ownerName) === null || _item$ownerName === void 0 ? void 0 : _item$ownerName.length) > 4 ? item.ownerName : ''
194
+ }, /*#__PURE__*/React.createElement("div", {
195
+ className: styles.userBox
196
+ }, 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))));
197
+ }), optionList.length <= 0 && /*#__PURE__*/React.createElement(Empty, {
198
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
199
+ description: "\u6682\u65E0\u6570\u636E"
200
+ })));
156
201
  }
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
- }))));
202
+ }, renderAccountView());
181
203
  };
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];
204
+ var AccountSelectList = function AccountSelectList(props) {
205
+ var _React$useState7 = React.useState([]),
206
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
207
+ accounts = _React$useState8[0],
208
+ setAccounts = _React$useState8[1];
209
+ var _React$useState9 = React.useState({}),
210
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
211
+ selectValues = _React$useState10[0],
212
+ setSelectValues = _React$useState10[1];
191
213
  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
- };
214
+ setAccounts(props.accounts.map(function (item, index) {
215
+ return _objectSpread({
216
+ key: index
217
+ }, item);
218
+ }));
219
+ }, [props.accounts]);
201
220
  return /*#__PURE__*/React.createElement(Row, {
202
221
  gutter: [32, 32]
203
222
  }, accounts === null || accounts === void 0 ? void 0 : accounts.map(function (account, index) {
204
223
  return /*#__PURE__*/React.createElement(Col, {
205
224
  span: 8,
206
225
  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
- }));
226
+ }, /*#__PURE__*/React.createElement(AccountSelect, _extends({}, account, {
227
+ onChange: function onChange(values) {
228
+ var _props$onChange4;
229
+ var tValues = _objectSpread({}, selectValues);
230
+ tValues[account.key] = values;
231
+ setSelectValues(tValues);
232
+ (_props$onChange4 = props.onChange) === null || _props$onChange4 === void 0 || _props$onChange4.call(props, tValues);
233
+ }
234
+ })));
219
235
  }));
220
236
  };
221
- export default AccountSelectList;
237
+ AccountSelect.Group = AccountSelectList;
238
+ 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,80 @@
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
+ onChange?: (selected: {
75
+ [key: string]: string[];
76
+ }) => void;
77
+ value?: {
78
+ [key: string]: string[];
79
+ };
80
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -118,6 +118,7 @@ var ReleaseVideoCard = function ReleaseVideoCard(props) {
118
118
  style: {
119
119
  width: 120,
120
120
  borderRadius: 8,
121
+ height: 160,
121
122
  overflow: "hidden",
122
123
  position: "relative"
123
124
  }
@@ -149,10 +150,7 @@ var ReleaseVideoCard = function ReleaseVideoCard(props) {
149
150
  }, /*#__PURE__*/React.createElement(TextEllipsis, {
150
151
  lines: 1
151
152
  }, "\u6807\u9898\uFF1A", props.title || '- -')), /*#__PURE__*/React.createElement("div", {
152
- className: styles['card_content'],
153
- style: {
154
- height: 55
155
- }
153
+ className: styles['card_content']
156
154
  }, /*#__PURE__*/React.createElement(TextEllipsis, {
157
155
  lines: 2
158
156
  }, "\u63CF\u8FF0\uFF1A", props.desc || '- -')), /*#__PURE__*/React.createElement("div", {
@@ -196,7 +194,7 @@ var ReleaseVideoCard = function ReleaseVideoCard(props) {
196
194
  marginRight: 12,
197
195
  cursor: 'pointer'
198
196
  }
199
- }, [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, {
200
198
  trigger: ['click'],
201
199
  menu: {
202
200
  items: [{
@@ -214,7 +212,7 @@ var ReleaseVideoCard = function ReleaseVideoCard(props) {
214
212
  }, /*#__PURE__*/React.createElement(Image, {
215
213
  src: More,
216
214
  preview: false
217
- }))))), props.isNew && /*#__PURE__*/React.createElement("div", {
215
+ }))) : null)), props.isNew && /*#__PURE__*/React.createElement("div", {
218
216
  className: styles['new-position']
219
217
  }, /*#__PURE__*/React.createElement(Image, {
220
218
  src: New,
@@ -24,6 +24,10 @@
24
24
  text-align: left;
25
25
  font-style: normal;
26
26
  flex: 1;
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content: space-around;
30
+
27
31
  &__desc {
28
32
  font-weight: 400;
29
33
  font-size: 14px;
@@ -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.9",
3
+ "version": "0.0.11-beta.1",
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"