@para-ui/core 4.0.0-rc.6 → 4.0.0-rc.7
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/AutoTips/index.js +2 -2
- package/Cascader/index.js +2 -2
- package/ComboSelect/index.js +1 -1
- package/DatePicker/util.d.ts +6 -6
- package/DynamicMultiBox/index.js +4 -558
- package/Form/index.js +2 -2
- package/FormItem/index.js +2 -2
- package/FunctionModal/index.js +2 -2
- package/Menu/index.js +1 -1
- package/OperateBtn/index.js +8 -6
- package/Pagination/index.js +1 -1
- package/QuickReply/QuickReplyCode/index.d.ts +10 -0
- package/QuickReply/index.d.ts +87 -0
- package/QuickReply/index.js +550 -0
- package/QuickReply/lang/en_US.d.ts +14 -0
- package/QuickReply/lang/index.d.ts +29 -0
- package/QuickReply/lang/zh_CN.d.ts +14 -0
- package/README.md +1 -0
- package/Select/index.js +4 -3
- package/SelectorPicker/index.js +4 -2
- package/Stepper/index.js +1 -1
- package/Styles/theme.scss +1 -0
- package/Switch/index.js +2 -2
- package/Table/index.js +1 -1
- package/Tabs/index.js +1 -1
- package/Tag/index.js +2 -2
- package/Transfer/index.js +1 -1
- package/Tree/index.js +2 -2
- package/Upload/index.js +2 -2
- package/_verture/index-d6093d1c.js +559 -0
- package/index.d.ts +2 -0
- package/index.js +10 -6
- package/locale/en-US.d.ts +13 -0
- package/locale/index.d.ts +26 -0
- package/locale/index.js +26 -0
- package/locale/zh-CN.d.ts +13 -0
- package/package.json +1 -1
- package/umd/AutoTips.js +1 -1
- package/umd/Breadcrumbs.js +1 -1
- package/umd/Button.js +7 -7
- package/umd/ButtonGroup.js +1 -1
- package/umd/Cascader.js +1 -1
- package/umd/ComboSelect.js +4 -4
- package/umd/CopyText.js +1 -1
- package/umd/DatePicker.js +7 -7
- package/umd/Descriptions.js +1 -1
- package/umd/Desktop.js +1 -1
- package/umd/Drawer.js +1 -1
- package/umd/DynamicMultiBox.js +4 -4
- package/umd/Form.js +4 -4
- package/umd/FormItem.js +4 -4
- package/umd/FunctionModal.js +1 -1
- package/umd/InputLang.js +1 -1
- package/umd/Menu.js +1 -1
- package/umd/Modal.js +1 -1
- package/umd/MultiBox.js +1 -1
- package/umd/OperateBtn.js +2 -2
- package/umd/PageHeader.js +1 -1
- package/umd/Pagination.js +2 -2
- package/umd/PopConfirm.js +1 -1
- package/umd/QuickReply.js +55 -0
- package/umd/Search.js +1 -1
- package/umd/Select.js +2 -2
- package/umd/SelectInput.js +2 -2
- package/umd/Selector.js +1 -1
- package/umd/SelectorPicker.js +2 -2
- package/umd/SingleBox.js +1 -1
- package/umd/Stepper.js +1 -1
- package/umd/Table.js +2 -2
- package/umd/Tabs.js +1 -1
- package/umd/Tag.js +1 -1
- package/umd/TextField.js +1 -1
- package/umd/TimePicker.js +5 -5
- package/umd/Title.js +1 -1
- package/umd/ToggleButton.js +1 -1
- package/umd/Transfer.js +1 -1
- package/umd/Tree.js +4 -4
- package/umd/Upload.js +1 -1
- package/umd/locale.js +1 -1
- /package/_verture/{index-4fafd0a0.js → index-3156e3ef.js} +0 -0
- /package/_verture/{index-3cdaba96.js → index-466a3496.js} +0 -0
- /package/_verture/{index-e0f9064d.js → index-f518e244.js} +0 -0
- /package/_verture/{modalContext-8534f23d.js → modalContext-7b512b0c.js} +0 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
5
|
+
import { d as dist } from '../_verture/index-d6093d1c.js';
|
|
6
|
+
import { Button } from '../Button/index.js';
|
|
7
|
+
import { Checkbox } from '../Checkbox/index.js';
|
|
8
|
+
import { TextField } from '../TextField/index.js';
|
|
9
|
+
import { PopConfirm } from '../PopConfirm/index.js';
|
|
10
|
+
import Empty from '../Empty/index.js';
|
|
11
|
+
import AutoTips from '../AutoTips/index.js';
|
|
12
|
+
import Plus from '@para-ui/icons/Plus';
|
|
13
|
+
import Drag from '@para-ui/icons/Drag';
|
|
14
|
+
import Delete from '@para-ui/icons/Delete';
|
|
15
|
+
import EditOutline from '@para-ui/icons/EditOutline';
|
|
16
|
+
import { UUID } from '@paraview/lib';
|
|
17
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
18
|
+
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
19
|
+
import { Popover } from '../Popover/index.js';
|
|
20
|
+
import Message from '@para-ui/icons/Message';
|
|
21
|
+
import Set from '@para-ui/icons/Set';
|
|
22
|
+
import '../_verture/sortable.esm-49896035.js';
|
|
23
|
+
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
24
|
+
import '@para-ui/icons/LoadingF';
|
|
25
|
+
import '../Tooltip/index.js';
|
|
26
|
+
import 'rc-tooltip';
|
|
27
|
+
import 'rc-tooltip/lib/placements';
|
|
28
|
+
import '@para-ui/icons/Forbid';
|
|
29
|
+
import '@para-ui/icons/Down';
|
|
30
|
+
import '../_verture/index-da9097d3.js';
|
|
31
|
+
import 'rc-dropdown';
|
|
32
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
33
|
+
import 'dayjs';
|
|
34
|
+
import '@para-ui/core/GlobalContext';
|
|
35
|
+
import '../Label/index.js';
|
|
36
|
+
import '../Help/index.js';
|
|
37
|
+
import '@para-ui/icons/Help';
|
|
38
|
+
import '@para-ui/icons/PreviewClose';
|
|
39
|
+
import '@para-ui/icons/PreviewOpen';
|
|
40
|
+
import '@para-ui/icons/CloseCircleF';
|
|
41
|
+
import '../Loading/index.js';
|
|
42
|
+
import '../HelperText/index.js';
|
|
43
|
+
import '../_verture/useGlobalProps-1e416658.js';
|
|
44
|
+
import '@para-ui/icons/CheckCircleF';
|
|
45
|
+
import '@para-ui/icons/WarningCircle';
|
|
46
|
+
import '@para-ui/icons/WarningCircleF';
|
|
47
|
+
|
|
48
|
+
var en = {
|
|
49
|
+
back: 'Back',
|
|
50
|
+
add: 'Add',
|
|
51
|
+
edit: 'Edit',
|
|
52
|
+
sort: 'Sort',
|
|
53
|
+
del: 'Delete',
|
|
54
|
+
delTip: 'After deletion, this reply will no longer be usable. Are you sure you want to delete it?',
|
|
55
|
+
batchDel: 'Batch Delete',
|
|
56
|
+
quickReply: 'Quick reply',
|
|
57
|
+
confirm: 'Confirm',
|
|
58
|
+
cancel: 'Cancel',
|
|
59
|
+
pleaseEnter: 'Please enter'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var zh = {
|
|
63
|
+
back: '返回',
|
|
64
|
+
add: '添加',
|
|
65
|
+
edit: '编辑',
|
|
66
|
+
sort: '排序',
|
|
67
|
+
del: '删除',
|
|
68
|
+
delTip: '删除后此回复将无法使用,确认要删除吗?',
|
|
69
|
+
batchDel: '批量删除',
|
|
70
|
+
quickReply: '快捷回复',
|
|
71
|
+
confirm: '确 认',
|
|
72
|
+
cancel: '取 消',
|
|
73
|
+
pleaseEnter: '请输入'
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var localeJson = {
|
|
77
|
+
zh,
|
|
78
|
+
en
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-quick-reply-code {\n box-shadow: 1px 1px 10px 2px rgba(212, 218, 227, 0.4);\n border-radius: 4px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n position: relative;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-top {\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 34px;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom {\n display: flex;\n flex: 1;\n overflow: hidden;\n padding: 4px 0;\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll {\n overflow: auto;\n width: 100%;\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .list-empty {\n text-align: center;\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .info-item {\n display: flex;\n height: 30px;\n align-items: center;\n padding: 0 10px;\n cursor: pointer;\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .info-item:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .info-item > .info-item-checkbox {\n margin-right: 10px;\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .info-item > .label-box {\n flex: 1;\n overflow: hidden;\n margin-right: 10px;\n line-height: 30px;\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .info-item > svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-quick-reply-code > .quick-reply-code-bottom > .quick-reply-code-bottom-scroll > .info-item > svg:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-quick-reply-code > .edit-box {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(255, 255, 255);\n display: flex;\n flex-direction: column;\n padding: 20px;\n}\n.paraui-v4-quick-reply-code > .edit-box > .text-input {\n flex: 1;\n}\n.paraui-v4-quick-reply-code > .edit-box > .text-input > .text-field-content {\n height: 100%;\n}\n.paraui-v4-quick-reply-code > .edit-box > .text-input > .text-field-content textarea {\n height: 100%;\n}\n.paraui-v4-quick-reply-code > .edit-box > .edit-footer {\n margin-top: 20px;\n display: flex;\n justify-content: flex-end;\n}\n.paraui-v4-quick-reply-code > .edit-box > .edit-footer > button:first-child {\n margin-right: 12px;\n}\n.paraui-v4-quick-reply-code.paraui-v4-quick-reply-code-line > .quick-reply-code-top > .sort-del-box > .del-btn {\n position: relative;\n}\n.paraui-v4-quick-reply-code.paraui-v4-quick-reply-code-line > .quick-reply-code-top > .sort-del-box > .del-btn:after {\n content: \"\";\n position: absolute;\n left: -10px;\n top: 10px;\n width: 1px;\n height: 12px;\n background-color: rgb(213, 224, 250);\n}";
|
|
82
|
+
styleInject(css_248z$1);
|
|
83
|
+
|
|
84
|
+
const QuickReplyCode = props => {
|
|
85
|
+
const {
|
|
86
|
+
rowKey = 'id',
|
|
87
|
+
labelKey = 'label',
|
|
88
|
+
valueKey = 'label',
|
|
89
|
+
limitLength,
|
|
90
|
+
className,
|
|
91
|
+
style,
|
|
92
|
+
list,
|
|
93
|
+
add = true,
|
|
94
|
+
edit = true,
|
|
95
|
+
del = true,
|
|
96
|
+
sort = true,
|
|
97
|
+
width = 440,
|
|
98
|
+
minHeight = 200,
|
|
99
|
+
maxHeight = 320,
|
|
100
|
+
placeholder,
|
|
101
|
+
onChange,
|
|
102
|
+
onSelect,
|
|
103
|
+
onShowDelete
|
|
104
|
+
} = props;
|
|
105
|
+
const intl = useFormatMessage('QuickReply', localeJson);
|
|
106
|
+
const [editText, setEditText] = useState({});
|
|
107
|
+
const [status, setStatus] = useState(); // 输入 排序 删除
|
|
108
|
+
const [selectKey, setSelectKey] = useState({}); // 选中的值
|
|
109
|
+
const [openDel, setOpenDel] = useState(); // 打开删除
|
|
110
|
+
const constData = useRef({
|
|
111
|
+
uuid: UUID()
|
|
112
|
+
});
|
|
113
|
+
const addClick = () => {
|
|
114
|
+
setEditText({
|
|
115
|
+
[rowKey]: UUID(),
|
|
116
|
+
[labelKey]: '',
|
|
117
|
+
[valueKey]: ''
|
|
118
|
+
});
|
|
119
|
+
setStatus('add');
|
|
120
|
+
};
|
|
121
|
+
const editClick = item => () => {
|
|
122
|
+
setEditText(Object.assign({}, item));
|
|
123
|
+
setStatus('edit');
|
|
124
|
+
};
|
|
125
|
+
const backClick = () => {
|
|
126
|
+
setStatus(undefined);
|
|
127
|
+
setSelectKey({});
|
|
128
|
+
setEditText({});
|
|
129
|
+
};
|
|
130
|
+
const sortClick = () => {
|
|
131
|
+
setStatus('sort');
|
|
132
|
+
};
|
|
133
|
+
const delStatus = () => {
|
|
134
|
+
if (status === 'del') {
|
|
135
|
+
onShowDelete && onShowDelete(true);
|
|
136
|
+
setOpenDel(constData.current.uuid);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
setStatus('del');
|
|
140
|
+
};
|
|
141
|
+
const clickItem = item => {
|
|
142
|
+
if (!status) {
|
|
143
|
+
onSelect && onSelect(item);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (status !== 'del' || openDel) return;
|
|
147
|
+
if (selectKey[item[rowKey]]) delete selectKey[item[rowKey]];else selectKey[item[rowKey]] = true;
|
|
148
|
+
setSelectKey(Object.assign({}, selectKey));
|
|
149
|
+
};
|
|
150
|
+
const delClick = item => event => {
|
|
151
|
+
event.stopPropagation();
|
|
152
|
+
onShowDelete && onShowDelete(true);
|
|
153
|
+
setOpenDel(item[rowKey]);
|
|
154
|
+
};
|
|
155
|
+
const onOkDel = item => {
|
|
156
|
+
let json = {};
|
|
157
|
+
if (item) {
|
|
158
|
+
json[item[rowKey]] = true;
|
|
159
|
+
}
|
|
160
|
+
if (constData.current.uuid === openDel) {
|
|
161
|
+
// 批量删除
|
|
162
|
+
json = Object.assign({}, selectKey);
|
|
163
|
+
}
|
|
164
|
+
const handleArr = [];
|
|
165
|
+
list === null || list === void 0 ? void 0 : list.forEach(listItem => {
|
|
166
|
+
const id = listItem[rowKey];
|
|
167
|
+
delete selectKey[id];
|
|
168
|
+
if (!json[id]) {
|
|
169
|
+
handleArr.push(listItem);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
onChange && onChange(handleArr);
|
|
173
|
+
onShowDelete && onShowDelete(false);
|
|
174
|
+
setOpenDel(undefined);
|
|
175
|
+
setSelectKey(Object.assign({}, selectKey));
|
|
176
|
+
};
|
|
177
|
+
const onCancelDel = () => {
|
|
178
|
+
onShowDelete && onShowDelete(false);
|
|
179
|
+
setOpenDel(undefined);
|
|
180
|
+
};
|
|
181
|
+
const changeInput = event => {
|
|
182
|
+
editText[labelKey] = event.target.value;
|
|
183
|
+
editText[valueKey] = event.target.value;
|
|
184
|
+
setEditText(Object.assign({}, editText));
|
|
185
|
+
};
|
|
186
|
+
// 确认输入
|
|
187
|
+
const clickInput = () => {
|
|
188
|
+
if (status === 'add') onChange && onChange([editText, ...(list || [])]);else {
|
|
189
|
+
const arr = [];
|
|
190
|
+
list === null || list === void 0 ? void 0 : list.forEach(item => {
|
|
191
|
+
if (item[rowKey] === editText[rowKey]) arr.push(editText);else arr.push(item);
|
|
192
|
+
});
|
|
193
|
+
onChange && onChange(arr);
|
|
194
|
+
}
|
|
195
|
+
backClick();
|
|
196
|
+
};
|
|
197
|
+
// 处理头部
|
|
198
|
+
const handleHeader = () => {
|
|
199
|
+
if (!add && !sort && !del) return null;
|
|
200
|
+
return jsxs("div", Object.assign({
|
|
201
|
+
className: 'quick-reply-code-top'
|
|
202
|
+
}, {
|
|
203
|
+
children: [add && jsx("div", Object.assign({
|
|
204
|
+
className: 'add-box'
|
|
205
|
+
}, {
|
|
206
|
+
children: jsx(Button, Object.assign({
|
|
207
|
+
variant: "text",
|
|
208
|
+
startIcon: jsx(Plus, {}),
|
|
209
|
+
onClick: addClick
|
|
210
|
+
}, {
|
|
211
|
+
children: intl('add')
|
|
212
|
+
}))
|
|
213
|
+
})), jsxs("div", Object.assign({
|
|
214
|
+
className: 'sort-del-box'
|
|
215
|
+
}, {
|
|
216
|
+
children: [(status === 'del' || status === 'sort') && jsx(Button, Object.assign({
|
|
217
|
+
variant: "text",
|
|
218
|
+
className: 'back-btn',
|
|
219
|
+
onClick: backClick
|
|
220
|
+
}, {
|
|
221
|
+
children: intl('back')
|
|
222
|
+
})), sort && status !== 'sort' && status !== 'del' && jsx(Button, Object.assign({
|
|
223
|
+
variant: "text",
|
|
224
|
+
className: 'sort-btn',
|
|
225
|
+
onClick: sortClick,
|
|
226
|
+
disabled: !list || (list === null || list === void 0 ? void 0 : list.length) === 0
|
|
227
|
+
}, {
|
|
228
|
+
children: intl('sort')
|
|
229
|
+
})), del && status !== 'sort' && jsx(Fragment, {
|
|
230
|
+
children: status === 'del' ? jsx(PopConfirm, Object.assign({
|
|
231
|
+
title: intl('del'),
|
|
232
|
+
content: intl('delTip'),
|
|
233
|
+
controllable: true,
|
|
234
|
+
open: constData.current.uuid === openDel,
|
|
235
|
+
getPopupContainer: () => document.body,
|
|
236
|
+
placement: 'bottom-end',
|
|
237
|
+
onOk: onOkDel,
|
|
238
|
+
onCancel: onCancelDel
|
|
239
|
+
}, {
|
|
240
|
+
children: jsx(Button, Object.assign({
|
|
241
|
+
disabled: JSON.stringify(selectKey) === '{}',
|
|
242
|
+
variant: "text",
|
|
243
|
+
className: 'del-btn',
|
|
244
|
+
onClick: delStatus
|
|
245
|
+
}, {
|
|
246
|
+
children: intl('batchDel')
|
|
247
|
+
}))
|
|
248
|
+
})) : jsx(Button, Object.assign({
|
|
249
|
+
variant: "text",
|
|
250
|
+
className: 'del-btn',
|
|
251
|
+
disabled: !list || (list === null || list === void 0 ? void 0 : list.length) === 0,
|
|
252
|
+
onClick: delStatus
|
|
253
|
+
}, {
|
|
254
|
+
children: intl('del')
|
|
255
|
+
}))
|
|
256
|
+
})]
|
|
257
|
+
}))]
|
|
258
|
+
}));
|
|
259
|
+
};
|
|
260
|
+
// 处理图标
|
|
261
|
+
const handleIcon = item => {
|
|
262
|
+
if (status === 'del') {
|
|
263
|
+
return jsx(PopConfirm, Object.assign({
|
|
264
|
+
title: intl('del'),
|
|
265
|
+
content: intl('delTip'),
|
|
266
|
+
controllable: true,
|
|
267
|
+
open: item[rowKey] === openDel,
|
|
268
|
+
placement: 'bottom-end',
|
|
269
|
+
onOk: () => onOkDel(item),
|
|
270
|
+
onCancel: onCancelDel,
|
|
271
|
+
getPopupContainer: () => document.body
|
|
272
|
+
}, {
|
|
273
|
+
children: jsx(Delete, {
|
|
274
|
+
onClick: delClick(item)
|
|
275
|
+
})
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
if (status === 'sort') return jsx(Drag, {
|
|
279
|
+
className: 'sort-icon'
|
|
280
|
+
});
|
|
281
|
+
if (edit) return jsx(EditOutline, {
|
|
282
|
+
onClick: editClick(item)
|
|
283
|
+
});
|
|
284
|
+
return null;
|
|
285
|
+
};
|
|
286
|
+
// 处理内容
|
|
287
|
+
const handleContent = () => {
|
|
288
|
+
if (!list || (list === null || list === void 0 ? void 0 : list.length) === 0) {
|
|
289
|
+
return jsx("div", Object.assign({
|
|
290
|
+
className: 'list-empty'
|
|
291
|
+
}, {
|
|
292
|
+
children: jsx(Empty, {
|
|
293
|
+
size: 'small'
|
|
294
|
+
})
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
return jsx(Fragment, {
|
|
298
|
+
children: list === null || list === void 0 ? void 0 : list.map(item => {
|
|
299
|
+
return jsxs("div", Object.assign({
|
|
300
|
+
className: 'info-item',
|
|
301
|
+
onClick: () => clickItem(item)
|
|
302
|
+
}, {
|
|
303
|
+
children: [status === 'del' && jsx(Checkbox, {
|
|
304
|
+
className: 'info-item-checkbox',
|
|
305
|
+
checked: selectKey[item[rowKey]] || false
|
|
306
|
+
}), jsx("div", Object.assign({
|
|
307
|
+
className: 'label-box'
|
|
308
|
+
}, {
|
|
309
|
+
children: jsx(AutoTips, Object.assign({
|
|
310
|
+
placement: 'top-start'
|
|
311
|
+
}, {
|
|
312
|
+
children: item[labelKey]
|
|
313
|
+
}))
|
|
314
|
+
})), handleIcon(item)]
|
|
315
|
+
}), item[rowKey]);
|
|
316
|
+
})
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
const onDragSort = newValueList => {
|
|
320
|
+
const arr = [];
|
|
321
|
+
for (let i = 0, l = newValueList.length; i < l; i++) {
|
|
322
|
+
const item = newValueList[i];
|
|
323
|
+
delete item.chosen;
|
|
324
|
+
delete item.selected;
|
|
325
|
+
arr.push(item);
|
|
326
|
+
}
|
|
327
|
+
onChange && onChange(arr);
|
|
328
|
+
};
|
|
329
|
+
const handleContentRender = () => {
|
|
330
|
+
if (sort) {
|
|
331
|
+
return jsx(dist.exports.ReactSortable, Object.assign({
|
|
332
|
+
id: rowKey,
|
|
333
|
+
list: list || [],
|
|
334
|
+
handle: '.sort-icon',
|
|
335
|
+
animation: 150,
|
|
336
|
+
setList: onDragSort,
|
|
337
|
+
className: "quick-reply-code-bottom-scroll ".concat($prefixCls, "-scrollbar-small")
|
|
338
|
+
}, {
|
|
339
|
+
children: handleContent()
|
|
340
|
+
}));
|
|
341
|
+
}
|
|
342
|
+
return jsx("div", Object.assign({
|
|
343
|
+
className: "quick-reply-code-bottom-scroll"
|
|
344
|
+
}, {
|
|
345
|
+
children: handleContent()
|
|
346
|
+
}));
|
|
347
|
+
};
|
|
348
|
+
const handleTextField = () => {
|
|
349
|
+
if (status !== 'add' && status !== 'edit') return;
|
|
350
|
+
return jsxs("div", Object.assign({
|
|
351
|
+
className: 'edit-box'
|
|
352
|
+
}, {
|
|
353
|
+
children: [jsx(TextField, {
|
|
354
|
+
multiline: true,
|
|
355
|
+
className: 'text-input',
|
|
356
|
+
placeholder: placeholder || intl('pleaseEnter'),
|
|
357
|
+
resize: false,
|
|
358
|
+
hideErrorDom: true,
|
|
359
|
+
limitLength: limitLength,
|
|
360
|
+
value: editText[valueKey],
|
|
361
|
+
onChange: changeInput
|
|
362
|
+
}), jsxs("div", Object.assign({
|
|
363
|
+
className: 'edit-footer'
|
|
364
|
+
}, {
|
|
365
|
+
children: [jsx(Button, Object.assign({
|
|
366
|
+
variant: "outlined",
|
|
367
|
+
size: "small",
|
|
368
|
+
onClick: backClick
|
|
369
|
+
}, {
|
|
370
|
+
children: intl('cancel')
|
|
371
|
+
})), jsx(Button, Object.assign({
|
|
372
|
+
size: "small",
|
|
373
|
+
onClick: clickInput
|
|
374
|
+
}, {
|
|
375
|
+
children: intl('confirm')
|
|
376
|
+
}))]
|
|
377
|
+
}))]
|
|
378
|
+
}));
|
|
379
|
+
};
|
|
380
|
+
// 处理样式
|
|
381
|
+
const handleStyle = () => {
|
|
382
|
+
const styleCom = Object.assign({}, style);
|
|
383
|
+
if (width) styleCom.width = typeof width === "number" ? width + 'px' : width;
|
|
384
|
+
if (minHeight) styleCom.minHeight = typeof minHeight === "number" ? minHeight + 'px' : minHeight;
|
|
385
|
+
if (maxHeight) styleCom.maxHeight = typeof maxHeight === "number" ? maxHeight + 'px' : maxHeight;
|
|
386
|
+
return styleCom;
|
|
387
|
+
};
|
|
388
|
+
const handleLine = () => {
|
|
389
|
+
if (del && sort) return true;
|
|
390
|
+
if (del && status === 'del') return true;
|
|
391
|
+
return false;
|
|
392
|
+
};
|
|
393
|
+
return jsxs("div", Object.assign({
|
|
394
|
+
className: clsx("".concat($prefixCls, "-quick-reply-code"), "".concat($prefixCls, "-scrollbar-small"), className, {
|
|
395
|
+
["".concat($prefixCls, "-quick-reply-code-add")]: add,
|
|
396
|
+
["".concat($prefixCls, "-quick-reply-code-edit")]: edit,
|
|
397
|
+
["".concat($prefixCls, "-quick-reply-code-del")]: del,
|
|
398
|
+
["".concat($prefixCls, "-quick-reply-code-sort")]: sort,
|
|
399
|
+
["".concat($prefixCls, "-quick-reply-code-line")]: handleLine()
|
|
400
|
+
}),
|
|
401
|
+
style: handleStyle()
|
|
402
|
+
}, {
|
|
403
|
+
children: [handleHeader(), jsx("div", Object.assign({
|
|
404
|
+
className: 'quick-reply-code-bottom'
|
|
405
|
+
}, {
|
|
406
|
+
children: handleContentRender()
|
|
407
|
+
})), handleTextField()]
|
|
408
|
+
}));
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-quick-reply {\n box-shadow: 1px 1px 10px 2px rgba(212, 218, 227, 0.4);\n border-radius: 4px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n position: relative;\n background-color: rgb(255, 255, 255);\n border: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-quick-reply > .quick-reply-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 10px;\n height: 34px;\n}\n.paraui-v4-quick-reply > .quick-reply-header > button {\n margin: 0;\n}\n.paraui-v4-quick-reply > .quick-reply-header > .set svg {\n font-size: 16px;\n}\n.paraui-v4-quick-reply > .quick-reply-content {\n border-top: 1px solid rgb(212, 218, 227);\n flex: 1;\n display: flex;\n}\n.paraui-v4-quick-reply > .quick-reply-content > .input-box {\n height: 100%;\n}\n.paraui-v4-quick-reply > .quick-reply-content > .input-box .text-field-content {\n border: none;\n height: 100%;\n}\n.paraui-v4-quick-reply > .quick-reply-content > .input-box .text-field-content textarea {\n height: 100%;\n min-height: 103px;\n}";
|
|
412
|
+
styleInject(css_248z);
|
|
413
|
+
|
|
414
|
+
const QuickReply = props => {
|
|
415
|
+
const {
|
|
416
|
+
className,
|
|
417
|
+
style,
|
|
418
|
+
rowKey = 'id',
|
|
419
|
+
labelKey = 'label',
|
|
420
|
+
valueKey = 'label',
|
|
421
|
+
placeholder,
|
|
422
|
+
list,
|
|
423
|
+
rows,
|
|
424
|
+
value,
|
|
425
|
+
defaultValue,
|
|
426
|
+
quickReplyCodeProps,
|
|
427
|
+
renderQuickReplyBtn,
|
|
428
|
+
onChange,
|
|
429
|
+
onChangeList
|
|
430
|
+
} = props;
|
|
431
|
+
const intl = useFormatMessage('QuickReply', localeJson);
|
|
432
|
+
const [valueCom, setValueCom] = useState(defaultValue);
|
|
433
|
+
const [open, setOpen] = useState(false); // 打开快捷回复
|
|
434
|
+
const [openSetting, setOpenSetting] = useState(false); // 打开快捷回复
|
|
435
|
+
const constData = useRef({
|
|
436
|
+
delOpen: false
|
|
437
|
+
});
|
|
438
|
+
const handleValue = () => {
|
|
439
|
+
if (value !== undefined) return value;
|
|
440
|
+
return valueCom;
|
|
441
|
+
};
|
|
442
|
+
const changeInput = event => {
|
|
443
|
+
const val = event.target.value;
|
|
444
|
+
if (value === undefined) setValueCom(val);
|
|
445
|
+
onChange && onChange(val);
|
|
446
|
+
};
|
|
447
|
+
const onSelect = item => {
|
|
448
|
+
const val = item[valueKey];
|
|
449
|
+
if (value === undefined) setValueCom(val);
|
|
450
|
+
onChange && onChange(val);
|
|
451
|
+
setOpen(false);
|
|
452
|
+
};
|
|
453
|
+
const onChangeSetting = arr => {
|
|
454
|
+
onChangeList && onChangeList(arr);
|
|
455
|
+
};
|
|
456
|
+
const onVisibleChange = bol => {
|
|
457
|
+
if (openSetting) return;
|
|
458
|
+
setOpen(bol);
|
|
459
|
+
};
|
|
460
|
+
const onVisibleChangeSetting = bol => {
|
|
461
|
+
if (constData.current.delOpen) return;
|
|
462
|
+
setOpenSetting(bol);
|
|
463
|
+
};
|
|
464
|
+
// 快捷回复按钮
|
|
465
|
+
const handleQuickReplyBtn = () => {
|
|
466
|
+
return jsx(Popover, Object.assign({
|
|
467
|
+
open: open,
|
|
468
|
+
content: jsx(QuickReplyCode, Object.assign({
|
|
469
|
+
rowKey: rowKey,
|
|
470
|
+
labelKey: labelKey,
|
|
471
|
+
valueKey: valueKey,
|
|
472
|
+
add: false,
|
|
473
|
+
edit: false,
|
|
474
|
+
sort: false,
|
|
475
|
+
del: false,
|
|
476
|
+
list: list,
|
|
477
|
+
onSelect: onSelect
|
|
478
|
+
}, quickReplyCodeProps && quickReplyCodeProps('select'))),
|
|
479
|
+
trigger: 'click',
|
|
480
|
+
placement: 'bottom-start',
|
|
481
|
+
onVisibleChange: onVisibleChange
|
|
482
|
+
}, {
|
|
483
|
+
children: renderQuickReplyBtn || jsx(Button, Object.assign({
|
|
484
|
+
variant: "text",
|
|
485
|
+
startIcon: jsx(Message, {})
|
|
486
|
+
}, {
|
|
487
|
+
children: intl('quickReply')
|
|
488
|
+
}))
|
|
489
|
+
}));
|
|
490
|
+
};
|
|
491
|
+
// 处理设置按钮
|
|
492
|
+
const handleSetting = () => {
|
|
493
|
+
return jsx(Popover, Object.assign({
|
|
494
|
+
open: openSetting,
|
|
495
|
+
content: jsx(QuickReplyCode, Object.assign({
|
|
496
|
+
rowKey: rowKey,
|
|
497
|
+
labelKey: labelKey,
|
|
498
|
+
valueKey: valueKey,
|
|
499
|
+
list: list,
|
|
500
|
+
placeholder: placeholder,
|
|
501
|
+
onChange: onChangeSetting
|
|
502
|
+
}, quickReplyCodeProps && quickReplyCodeProps('setting'), {
|
|
503
|
+
onShowDelete: bol => {
|
|
504
|
+
constData.current.delOpen = bol;
|
|
505
|
+
}
|
|
506
|
+
})),
|
|
507
|
+
trigger: 'click',
|
|
508
|
+
placement: 'bottom-end',
|
|
509
|
+
onVisibleChange: onVisibleChangeSetting
|
|
510
|
+
}, {
|
|
511
|
+
children: jsx(Button.IconButton, Object.assign({
|
|
512
|
+
variant: "text",
|
|
513
|
+
className: 'set',
|
|
514
|
+
toolTipTitle: intl('edit')
|
|
515
|
+
}, {
|
|
516
|
+
children: jsx(Set, {})
|
|
517
|
+
}))
|
|
518
|
+
}));
|
|
519
|
+
};
|
|
520
|
+
const handleHeader = () => {
|
|
521
|
+
return jsxs("div", Object.assign({
|
|
522
|
+
className: 'quick-reply-header'
|
|
523
|
+
}, {
|
|
524
|
+
children: [handleQuickReplyBtn(), handleSetting()]
|
|
525
|
+
}));
|
|
526
|
+
};
|
|
527
|
+
const handleContent = () => {
|
|
528
|
+
return jsx("div", Object.assign({
|
|
529
|
+
className: 'quick-reply-content'
|
|
530
|
+
}, {
|
|
531
|
+
children: jsx(TextField, {
|
|
532
|
+
className: 'input-box',
|
|
533
|
+
multiline: true,
|
|
534
|
+
hideErrorDom: true,
|
|
535
|
+
rows: rows,
|
|
536
|
+
placeholder: placeholder || intl('pleaseEnter'),
|
|
537
|
+
value: handleValue(),
|
|
538
|
+
onChange: changeInput
|
|
539
|
+
})
|
|
540
|
+
}));
|
|
541
|
+
};
|
|
542
|
+
return jsxs("div", Object.assign({
|
|
543
|
+
className: clsx("".concat($prefixCls, "-quick-reply"), className),
|
|
544
|
+
style: style
|
|
545
|
+
}, {
|
|
546
|
+
children: [handleHeader(), handleContent()]
|
|
547
|
+
}));
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
export { QuickReply, QuickReplyCode, QuickReply as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
back: string;
|
|
3
|
+
add: string;
|
|
4
|
+
edit: string;
|
|
5
|
+
sort: string;
|
|
6
|
+
del: string;
|
|
7
|
+
delTip: string;
|
|
8
|
+
batchDel: string;
|
|
9
|
+
quickReply: string;
|
|
10
|
+
confirm: string;
|
|
11
|
+
cancel: string;
|
|
12
|
+
pleaseEnter: string;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
zh: {
|
|
3
|
+
back: string;
|
|
4
|
+
add: string;
|
|
5
|
+
edit: string;
|
|
6
|
+
sort: string;
|
|
7
|
+
del: string;
|
|
8
|
+
delTip: string;
|
|
9
|
+
batchDel: string;
|
|
10
|
+
quickReply: string;
|
|
11
|
+
confirm: string;
|
|
12
|
+
cancel: string;
|
|
13
|
+
pleaseEnter: string;
|
|
14
|
+
};
|
|
15
|
+
en: {
|
|
16
|
+
back: string;
|
|
17
|
+
add: string;
|
|
18
|
+
edit: string;
|
|
19
|
+
sort: string;
|
|
20
|
+
del: string;
|
|
21
|
+
delTip: string;
|
|
22
|
+
batchDel: string;
|
|
23
|
+
quickReply: string;
|
|
24
|
+
confirm: string;
|
|
25
|
+
cancel: string;
|
|
26
|
+
pleaseEnter: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
back: string;
|
|
3
|
+
add: string;
|
|
4
|
+
edit: string;
|
|
5
|
+
sort: string;
|
|
6
|
+
del: string;
|
|
7
|
+
delTip: string;
|
|
8
|
+
batchDel: string;
|
|
9
|
+
quickReply: string;
|
|
10
|
+
confirm: string;
|
|
11
|
+
cancel: string;
|
|
12
|
+
pleaseEnter: string;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|