@chlp-tech/rpa-ui 0.0.16 → 0.0.17-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.
@@ -24,11 +24,14 @@ import MediaAccountPreview from "../MediaAccountPreview";
24
24
  import { SearchOutlined } from "@ant-design/icons";
25
25
  import classNames from "classnames";
26
26
  import styles from "./index.module.less";
27
+ import { useTranslation } from 'react-i18next';
27
28
  var AccountSelect = function AccountSelect(props) {
28
29
  var _props$placeholder = props.placeholder,
29
30
  placeholder = _props$placeholder === void 0 ? '请选择账号' : _props$placeholder,
30
31
  _props$multiple = props.multiple,
31
32
  multiple = _props$multiple === void 0 ? false : _props$multiple;
33
+ var _useTranslation = useTranslation(),
34
+ t = _useTranslation.t;
32
35
  var _React$useState = React.useState(false),
33
36
  _React$useState2 = _slicedToArray(_React$useState, 2),
34
37
  open = _React$useState2[0],
@@ -189,7 +192,7 @@ var AccountSelect = function AccountSelect(props) {
189
192
  color: '#9EA7B5'
190
193
  }
191
194
  }),
192
- placeholder: "\u641C\u7D22\u6210\u5458\u6216\u8D26\u53F7\u540D",
195
+ placeholder: props.searchPlaceholder,
193
196
  onChange: onSearchChange
194
197
  }), /*#__PURE__*/React.createElement("div", {
195
198
  className: styles.scrollBox
@@ -199,7 +202,9 @@ var AccountSelect = function AccountSelect(props) {
199
202
  var getTipsText = function getTipsText() {
200
203
  switch (item.disabledState) {
201
204
  case 1:
202
- return '请勿选择语言不统一的账号';
205
+ return t('请勿选择语言不统一的账号', {
206
+ ns: 'common'
207
+ });
203
208
  case 2:
204
209
  return '账号Token失效,请重新授权该账号,恢复账号绑定状态';
205
210
  case 3:
@@ -39,6 +39,7 @@ export interface IAccountSelectProps {
39
39
  * @param values
40
40
  */
41
41
  renderSelectStatus?: (values: (string | number)[]) => ReactElement;
42
+ searchPlaceholder?: string;
42
43
  }
43
44
  export interface IAccountOptionModel {
44
45
  /**
@@ -4,6 +4,11 @@ interface LinkedFilterProps {
4
4
  multipleIcon: React.ReactNode;
5
5
  config: ConfigItem[];
6
6
  isShow?: string[];
7
+ moreFilterText?: string;
8
+ moreModalConfig?: {
9
+ cancelNode?: string | React.ReactNode;
10
+ confirmNode?: string | React.ReactNode;
11
+ };
7
12
  }
8
13
  interface ConfigItem {
9
14
  key: string;
@@ -13,13 +13,13 @@ import { Form, Input, Select, Button, Modal, Badge, DatePicker, Space } from "an
13
13
  import styles from "./index.module.less";
14
14
  var Option = Select.Option;
15
15
  var RangePicker = DatePicker.RangePicker;
16
- var LinkedFilter = function LinkedFilter(_ref) {
17
- var _config$find;
18
- var _onChange = _ref.onChange,
19
- config = _ref.config,
20
- multipleIcon = _ref.multipleIcon,
21
- _ref$isShow = _ref.isShow,
22
- isShow = _ref$isShow === void 0 ? [] : _ref$isShow;
16
+ var LinkedFilter = function LinkedFilter(props) {
17
+ var _config$find, _props$moreModalConfi, _props$moreModalConfi2;
18
+ var _onChange = props.onChange,
19
+ config = props.config,
20
+ multipleIcon = props.multipleIcon,
21
+ _props$isShow = props.isShow,
22
+ isShow = _props$isShow === void 0 ? [] : _props$isShow;
23
23
  var initialSelectValue = ((_config$find = config.find(function (item) {
24
24
  return !isShow.includes(item.key);
25
25
  })) === null || _config$find === void 0 ? void 0 : _config$find.key) || null;
@@ -43,7 +43,7 @@ var LinkedFilter = function LinkedFilter(_ref) {
43
43
  multilineForm = _Form$useForm4[0];
44
44
  useEffect(function () {
45
45
  config.forEach( /*#__PURE__*/function () {
46
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item) {
46
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item) {
47
47
  var _response;
48
48
  return _regeneratorRuntime().wrap(function _callee$(_context) {
49
49
  while (1) switch (_context.prev = _context.next) {
@@ -64,12 +64,12 @@ var LinkedFilter = function LinkedFilter(_ref) {
64
64
  }, _callee);
65
65
  }));
66
66
  return function (_x) {
67
- return _ref2.apply(this, arguments);
67
+ return _ref.apply(this, arguments);
68
68
  };
69
69
  }());
70
70
  }, [config]);
71
71
  var handleSingleSelectChange = /*#__PURE__*/function () {
72
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
72
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
73
73
  var values;
74
74
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
75
75
  while (1) switch (_context2.prev = _context2.next) {
@@ -88,11 +88,11 @@ var LinkedFilter = function LinkedFilter(_ref) {
88
88
  }, _callee2);
89
89
  }));
90
90
  return function handleSingleSelectChange() {
91
- return _ref3.apply(this, arguments);
91
+ return _ref2.apply(this, arguments);
92
92
  };
93
93
  }();
94
94
  var handleModalOk = /*#__PURE__*/function () {
95
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
95
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
96
96
  var values;
97
97
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
98
98
  while (1) switch (_context3.prev = _context3.next) {
@@ -112,7 +112,7 @@ var LinkedFilter = function LinkedFilter(_ref) {
112
112
  }, _callee3);
113
113
  }));
114
114
  return function handleModalOk() {
115
- return _ref4.apply(this, arguments);
115
+ return _ref3.apply(this, arguments);
116
116
  };
117
117
  }();
118
118
  var handleModalCancel = function handleModalCancel() {
@@ -223,13 +223,13 @@ var LinkedFilter = function LinkedFilter(_ref) {
223
223
  }, /*#__PURE__*/React.createElement(Button, {
224
224
  onClick: showMultiSelectModal,
225
225
  icon: multipleIcon
226
- }, "\u66F4\u591A\u7B5B\u9009"))), /*#__PURE__*/React.createElement(Modal, {
227
- title: "\u66F4\u591A\u7B5B\u9009",
226
+ }, props.moreFilterText || '更多筛选'))), /*#__PURE__*/React.createElement(Modal, {
227
+ title: props.moreFilterText || '更多筛选',
228
228
  open: isModalVisible,
229
229
  onOk: handleModalOk,
230
230
  onCancel: handleModalCancel,
231
- cancelText: '取消',
232
- okText: '确定'
231
+ cancelText: ((_props$moreModalConfi = props.moreModalConfig) === null || _props$moreModalConfi === void 0 ? void 0 : _props$moreModalConfi.cancelNode) || '取消',
232
+ okText: ((_props$moreModalConfi2 = props.moreModalConfig) === null || _props$moreModalConfi2 === void 0 ? void 0 : _props$moreModalConfi2.confirmNode) || '确定'
233
233
  }, /*#__PURE__*/React.createElement(Form, {
234
234
  form: multilineForm,
235
235
  labelCol: {
@@ -72,10 +72,13 @@ var VideoPlay = function VideoPlay(_ref) {
72
72
  var handleOverlayClick = function handleOverlayClick() {
73
73
  setIsPreviewVisible(true);
74
74
  };
75
- var handlePlayClick = function handlePlayClick() {
75
+ var handlePlayClick = function handlePlayClick(e) {
76
+ var _e$preventDefault, _e$stopPropagation;
76
77
  if (onPlayClick) {
77
78
  return onPlayClick();
78
79
  }
80
+ e === null || e === void 0 || (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 || _e$preventDefault.call(e);
81
+ e === null || e === void 0 || (_e$stopPropagation = e.stopPropagation) === null || _e$stopPropagation === void 0 || _e$stopPropagation.call(e);
79
82
  setIsPlaying(true);
80
83
  };
81
84
  var handleClose = function handleClose() {
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useMemo } from "react";
2
2
  import styles from "./index.module.less";
3
3
  import Process from "./imgs/process.svg";
4
4
  import Wait from "./imgs/wait.svg";
@@ -7,66 +7,96 @@ import Fail from "./imgs/fail.svg";
7
7
  import Publish from "./imgs/publish.svg";
8
8
  import Pause from "./imgs/pause.svg";
9
9
  import Delete from "./imgs/delete.svg";
10
- var statusTag = {
11
- 0: {
12
- bgColor: '#ECEFF4',
13
- textColor: '#3F5270',
14
- text: '草稿',
15
- icon: Process
16
- },
17
- 1: {
18
- bgColor: '#FFF5E9',
19
- textColor: '#FF8800',
20
- text: '待发布',
21
- icon: Wait
22
- },
23
- 2: {
24
- bgColor: '#E0FFDD',
25
- textColor: '#3BC92B',
26
- text: '发布成功',
27
- icon: Success
28
- },
29
- 3: {
30
- bgColor: '#FEECEC',
31
- textColor: '#FA4441',
32
- text: '发布异常',
33
- icon: Fail
34
- },
35
- 4: {
36
- bgColor: '#E9F1FF',
37
- textColor: '#004FD3',
38
- text: '发布中',
39
- icon: Publish
40
- },
41
- 5: {
42
- bgColor: '#E9F1FF',
43
- textColor: '#004FD3',
44
- text: '排队中',
45
- icon: Publish
46
- },
47
- 6: {
48
- bgColor: '#ECEFF4',
49
- textColor: '#3F5270',
50
- text: '已暂停',
51
- icon: Pause
52
- },
53
- 7: {
54
- bgColor: '#E9F1FF',
55
- textColor: '#004FD3',
56
- text: '审核中',
57
- icon: Publish
58
- },
59
- 8: {
60
- bgColor: '#ECEFF4',
61
- textColor: '#3F5270',
62
- text: '已删除',
63
- icon: Delete
64
- }
10
+ import { useTranslation } from "react-i18next";
11
+ var useStatusHelper = function useStatusHelper() {
12
+ var _useTranslation = useTranslation(),
13
+ t = _useTranslation.t;
14
+ var statusTag = useMemo(function () {
15
+ return {
16
+ 0: {
17
+ bgColor: '#ECEFF4',
18
+ textColor: '#3F5270',
19
+ text: t('草稿', {
20
+ ns: 'publish'
21
+ }),
22
+ icon: Process
23
+ },
24
+ 1: {
25
+ bgColor: '#FFF5E9',
26
+ textColor: '#FF8800',
27
+ text: t('待发布', {
28
+ ns: 'publish'
29
+ }),
30
+ icon: Wait
31
+ },
32
+ 2: {
33
+ bgColor: '#E0FFDD',
34
+ textColor: '#3BC92B',
35
+ text: t('发布成功', {
36
+ ns: 'publish'
37
+ }),
38
+ icon: Success
39
+ },
40
+ 3: {
41
+ bgColor: '#FEECEC',
42
+ textColor: '#FA4441',
43
+ text: t('发布异常', {
44
+ ns: 'publish'
45
+ }),
46
+ icon: Fail
47
+ },
48
+ 4: {
49
+ bgColor: '#E9F1FF',
50
+ textColor: '#004FD3',
51
+ text: t('发布中', {
52
+ ns: 'publish'
53
+ }),
54
+ icon: Publish
55
+ },
56
+ 5: {
57
+ bgColor: '#E9F1FF',
58
+ textColor: '#004FD3',
59
+ text: t('排队中', {
60
+ ns: 'publish'
61
+ }),
62
+ icon: Publish
63
+ },
64
+ 6: {
65
+ bgColor: '#ECEFF4',
66
+ textColor: '#3F5270',
67
+ text: t('已暂停', {
68
+ ns: 'publish'
69
+ }),
70
+ icon: Pause
71
+ },
72
+ 7: {
73
+ bgColor: '#E9F1FF',
74
+ textColor: '#004FD3',
75
+ text: t('审核中', {
76
+ ns: 'publish'
77
+ }),
78
+ icon: Publish
79
+ },
80
+ 8: {
81
+ bgColor: '#ECEFF4',
82
+ textColor: '#3F5270',
83
+ text: t('已删除', {
84
+ ns: 'publish'
85
+ }),
86
+ icon: Delete
87
+ }
88
+ };
89
+ }, []);
90
+ return {
91
+ statusTag: statusTag
92
+ };
65
93
  };
66
94
  var StatusTag = function StatusTag(_ref) {
67
95
  var _statusTag$status, _statusTag$status2, _statusTag$status3, _statusTag$status4;
68
96
  var _ref$status = _ref.status,
69
97
  status = _ref$status === void 0 ? 0 : _ref$status;
98
+ var _useStatusHelper = useStatusHelper(),
99
+ statusTag = _useStatusHelper.statusTag;
70
100
  return /*#__PURE__*/React.createElement("div", {
71
101
  className: styles['status-tag'],
72
102
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chlp-tech/rpa-ui",
3
- "version": "0.0.16",
3
+ "version": "0.0.17-beta-2",
4
4
  "description": "rpa-ui",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,7 +38,9 @@
38
38
  "@ant-design/icons": ">=4.18.0",
39
39
  "antd": ">=5.25.0",
40
40
  "react": ">=16.9.0",
41
- "react-dom": ">=16.9.0"
41
+ "react-dom": ">=16.9.0",
42
+ "i18next": "^23.7.8",
43
+ "react-i18next": "^13.5.0"
42
44
  },
43
45
  "devDependencies": {
44
46
  "@ant-design/icons": "^5.5.2",
@@ -58,7 +60,9 @@
58
60
  "react": "^18.0.0",
59
61
  "react-dom": "^18.0.0",
60
62
  "stylelint": "^14.9.1",
61
- "terser": "^5.33.0"
63
+ "terser": "^5.33.0",
64
+ "i18next": "^23.7.8",
65
+ "react-i18next": "^13.5.0"
62
66
  },
63
67
  "dependencies": {
64
68
  "@webav/av-cliper": "^1.0.11",