@bchr/bchr-front-lib 0.4.5 → 0.5.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.
@@ -0,0 +1,705 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SubInnerLineActionButton = exports.InnerLineActionButton = exports.SubActionButton = exports.ActionButton = exports.ActionButtonTypes = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _antd = require("antd");
11
+
12
+ var _icons = require("@ant-design/icons");
13
+
14
+ var _http = _interopRequireDefault(require("../../services/http"));
15
+
16
+ var _lodash = _interopRequireDefault(require("lodash"));
17
+
18
+ var _utils = require("../utils");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _extends() { _extends = Object.assign || 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); }
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
+
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
+
28
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
+
30
+ var ActionButtonTypes = {
31
+ NewAdd: "newAdd",
32
+ Browse: "browse",
33
+ Modify: "modify",
34
+ Save: "save",
35
+ Select: "select",
36
+ ModalSelect: "modalSelect",
37
+ Attachment: "attachment",
38
+ Delete: "delete",
39
+ Query: "query",
40
+ Refresh: "refresh",
41
+ Search: "search",
42
+ ReturnBack: "returnBack",
43
+ OK: "ok",
44
+ Copy: "copy",
45
+ Cancel: "cancel",
46
+ Close: "close",
47
+ Setting: "setting",
48
+ Submit: "submit",
49
+ CallBack: "callBack",
50
+ Approve: "approve",
51
+ Reject: "reject",
52
+ Export: "export",
53
+ Import: "import",
54
+ Upload: "upload",
55
+ Download: "download",
56
+ Invalid: "invalid",
57
+ Effect: "effect",
58
+ Enable: "enable",
59
+ Disable: "disable",
60
+ More: "more",
61
+ AddLine: "addLine",
62
+ Clear: "clear",
63
+ Stop: "stop",
64
+ Issue: "issue",
65
+ CancelIssue: "cancelIssue",
66
+ Up: "up",
67
+ Down: "down",
68
+ TimeConfig: "timeConfig"
69
+ };
70
+ exports.ActionButtonTypes = ActionButtonTypes;
71
+
72
+ var buildActionButton = function buildActionButton(props, subActionButton, innerLine) {
73
+ var loading = props.loading != null ? props.loading : false;
74
+ var icon = props.icon;
75
+ var btnLabel = props.btnText;
76
+ var type = "tertiary";
77
+ var theme = "light";
78
+ var confirmMsg = null;
79
+ var confirmType = null;
80
+ var checkField = null;
81
+ var checkData = null;
82
+ var hasBtnLabel = props.btnText !== null && props.btnText !== undefined;
83
+
84
+ switch (props.actionType) {
85
+ case ActionButtonTypes.NewAdd:
86
+ {
87
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.PlusOutlined, null);
88
+ btnLabel = hasBtnLabel ? props.btnText : "新增";
89
+ type = "primary";
90
+ theme = "solid";
91
+ break;
92
+ }
93
+
94
+ case ActionButtonTypes.Browse:
95
+ {
96
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.BarsOutlined, null);
97
+ btnLabel = hasBtnLabel ? props.btnText : "浏览";
98
+ type = "primary";
99
+ theme = "solid";
100
+ break;
101
+ }
102
+
103
+ case ActionButtonTypes.Modify:
104
+ {
105
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.EditOutlined, null);
106
+ btnLabel = hasBtnLabel ? props.btnText : "修改";
107
+ break;
108
+ }
109
+
110
+ case ActionButtonTypes.Save:
111
+ {
112
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SaveOutlined, null);
113
+ btnLabel = hasBtnLabel ? props.btnText : "保存";
114
+ type = "primary";
115
+ theme = "solid";
116
+ break;
117
+ }
118
+
119
+ case ActionButtonTypes.Select:
120
+ {
121
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.UnorderedListOutlined, null);
122
+ btnLabel = hasBtnLabel ? props.btnText : "选择";
123
+ type = "primary";
124
+ theme = "solid";
125
+ break;
126
+ }
127
+
128
+ case ActionButtonTypes.ModalSelect:
129
+ {
130
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.UnorderedListOutlined, null);
131
+ break;
132
+ }
133
+
134
+ case ActionButtonTypes.Attachment:
135
+ {
136
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SnippetsTwoTone, null);
137
+ btnLabel = hasBtnLabel ? props.btnText : "附件";
138
+ break;
139
+ }
140
+
141
+ case ActionButtonTypes.Delete:
142
+ {
143
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.DeleteOutlined, null);
144
+ btnLabel = hasBtnLabel ? props.btnText : "删除";
145
+ type = "danger";
146
+ theme = "solid";
147
+ confirmMsg = "确定要删除[options]记录吗?";
148
+ break;
149
+ }
150
+
151
+ case ActionButtonTypes.Stop:
152
+ {
153
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.StopOutlined, null);
154
+ btnLabel = hasBtnLabel ? props.btnText : "终止";
155
+ type = "danger";
156
+ theme = "solid";
157
+ confirmMsg = "确定要终止[options]记录吗?";
158
+ break;
159
+ }
160
+
161
+ case ActionButtonTypes.Copy:
162
+ {
163
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CopyOutlined, null);
164
+ btnLabel = hasBtnLabel ? props.btnText : "复制";
165
+ break;
166
+ }
167
+
168
+ case ActionButtonTypes.Query:
169
+ {
170
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.FilterOutlined, null);
171
+ btnLabel = hasBtnLabel ? props.btnText : "查询";
172
+ break;
173
+ }
174
+
175
+ case ActionButtonTypes.Refresh:
176
+ {
177
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SyncOutlined, null);
178
+ btnLabel = hasBtnLabel ? props.btnText : "刷新";
179
+ break;
180
+ }
181
+
182
+ case ActionButtonTypes.Search:
183
+ {
184
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SearchOutlined, null);
185
+ btnLabel = hasBtnLabel ? props.btnText : "检索";
186
+ break;
187
+ }
188
+
189
+ case ActionButtonTypes.ReturnBack:
190
+ {
191
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.UndoOutlined, null);
192
+ btnLabel = hasBtnLabel ? props.btnText : "返回";
193
+ break;
194
+ }
195
+
196
+ case ActionButtonTypes.OK:
197
+ {
198
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CheckSquareOutlined, null);
199
+ btnLabel = hasBtnLabel ? props.btnText : "确定";
200
+ type = "primary";
201
+ theme = "solid";
202
+ break;
203
+ }
204
+
205
+ case ActionButtonTypes.Cancel:
206
+ {
207
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SwapLeftOutlined, null);
208
+ btnLabel = hasBtnLabel ? props.btnText : "取消";
209
+ type = "warning";
210
+ confirmMsg = "确定要取消[options]吗?";
211
+ theme = "solid";
212
+ break;
213
+ }
214
+
215
+ case ActionButtonTypes.Close:
216
+ {
217
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CloseOutlined, null);
218
+ btnLabel = hasBtnLabel ? props.btnText : "关闭";
219
+ break;
220
+ }
221
+
222
+ case ActionButtonTypes.Setting:
223
+ {
224
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SettingOutlined, null);
225
+ btnLabel = hasBtnLabel ? props.btnText : "设置";
226
+ break;
227
+ }
228
+
229
+ case ActionButtonTypes.Submit:
230
+ {
231
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SendOutlined, null);
232
+ btnLabel = hasBtnLabel ? props.btnText : "提交";
233
+ type = "primary";
234
+ theme = "solid";
235
+ break;
236
+ }
237
+
238
+ case ActionButtonTypes.CallBack:
239
+ {
240
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.SwapLeftOutlined, null);
241
+ type = hasBtnLabel ? props.btnText : "warning";
242
+ btnLabel = hasBtnLabel ? props.btnText : "收回";
243
+ confirmMsg = "确定要收回[options]吗?";
244
+ theme = "solid";
245
+ type = "primary";
246
+ break;
247
+ }
248
+
249
+ case ActionButtonTypes.Approve:
250
+ {
251
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CheckCircleOutlined, null);
252
+ btnLabel = hasBtnLabel ? props.btnText : "审批";
253
+ type = "warning";
254
+ break;
255
+ }
256
+
257
+ case ActionButtonTypes.Reject:
258
+ {
259
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.ClearOutlined, null);
260
+ type = "warning";
261
+ btnLabel = hasBtnLabel ? props.btnText : "驳回";
262
+ theme = "solid";
263
+ break;
264
+ }
265
+
266
+ case ActionButtonTypes.Export:
267
+ {
268
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.ExportOutlined, null);
269
+ btnLabel = hasBtnLabel ? props.btnText : "导出";
270
+ break;
271
+ }
272
+
273
+ case ActionButtonTypes.Import:
274
+ {
275
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.ImportOutlined, null);
276
+ btnLabel = hasBtnLabel ? props.btnText : "导入";
277
+ break;
278
+ }
279
+
280
+ case ActionButtonTypes.Download:
281
+ {
282
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.DownloadOutlined, null);
283
+ btnLabel = hasBtnLabel ? props.btnText : "下载";
284
+ break;
285
+ }
286
+
287
+ case ActionButtonTypes.Upload:
288
+ {
289
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.UploadOutlined, null);
290
+ btnLabel = hasBtnLabel ? props.btnText : "上传";
291
+ break;
292
+ }
293
+
294
+ case ActionButtonTypes.Invalid:
295
+ {
296
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CheckCircleOutlined, null);
297
+ type = hasBtnLabel ? props.btnText : "warning";
298
+ btnLabel = "撤销生效";
299
+ confirmMsg = "确定要撤销生效[options]吗?";
300
+ theme = "solid";
301
+ break;
302
+ }
303
+
304
+ case ActionButtonTypes.Effect:
305
+ {
306
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CheckCircleOutlined, null);
307
+ type = "primary";
308
+ btnLabel = hasBtnLabel ? props.btnText : "生效";
309
+ theme = "solid";
310
+ break;
311
+ }
312
+
313
+ case ActionButtonTypes.Issue:
314
+ {
315
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement("span", {
316
+ className: "iconfont icon-personal-issue"
317
+ });
318
+ btnLabel = hasBtnLabel ? props.btnText : "下发";
319
+ break;
320
+ }
321
+
322
+ case ActionButtonTypes.CancelIssue:
323
+ {
324
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement("span", {
325
+ className: "iconfont icon-personal-cancel-issue"
326
+ });
327
+ btnLabel = hasBtnLabel ? props.btnText : "取消下发";
328
+ break;
329
+ }
330
+
331
+ case ActionButtonTypes.Up:
332
+ {
333
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement("span", {
334
+ className: "iconfont icon-personal-arrow-line-left"
335
+ });
336
+ btnLabel = hasBtnLabel ? props.btnText : "上一条";
337
+ break;
338
+ }
339
+
340
+ case ActionButtonTypes.Down:
341
+ {
342
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement("span", {
343
+ className: "iconfont icon-personal-arrow-line-right"
344
+ });
345
+ btnLabel = hasBtnLabel ? props.btnText : "下一条";
346
+ break;
347
+ }
348
+
349
+ case ActionButtonTypes.TimeConfig:
350
+ {
351
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement("span", {
352
+ className: "iconfont icon-personal-overtime-ledger"
353
+ });
354
+ btnLabel = hasBtnLabel ? props.btnText : "任务设定";
355
+ break;
356
+ }
357
+
358
+ case ActionButtonTypes.Enable:
359
+ {
360
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.UnlockOutlined, null);
361
+ type = "primary";
362
+ btnLabel = hasBtnLabel ? props.btnText : "启用";
363
+ theme = "solid";
364
+ break;
365
+ }
366
+
367
+ case ActionButtonTypes.Disable:
368
+ {
369
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.LockOutlined, null);
370
+ type = "warning";
371
+ btnLabel = hasBtnLabel ? props.btnText : "禁用";
372
+ theme = "solid";
373
+ confirmMsg = "确定要禁用[options]记录吗?";
374
+ break;
375
+ }
376
+
377
+ case ActionButtonTypes.More:
378
+ {
379
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CaretDownOutlined, null);
380
+ btnLabel = hasBtnLabel ? props.btnText : "更多";
381
+ break;
382
+ }
383
+
384
+ case ActionButtonTypes.AddLine:
385
+ {
386
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.CopyOutlined, null);
387
+ btnLabel = hasBtnLabel ? props.btnText : "增行";
388
+ break;
389
+ }
390
+
391
+ case ActionButtonTypes.Clear:
392
+ {
393
+ icon = icon ? icon : /*#__PURE__*/_react["default"].createElement(_icons.ClearOutlined, null);
394
+ btnLabel = hasBtnLabel ? props.btnText : "清除";
395
+ type = "warning";
396
+ theme = "solid";
397
+ break;
398
+ }
399
+ }
400
+
401
+ if (!icon) {
402
+ icon = /*#__PURE__*/_react["default"].createElement(_icons.ThunderboltOutlined, null);
403
+ }
404
+
405
+ var buttonProps = _objectSpread({}, props);
406
+
407
+ if (buttonProps.moreProps) {
408
+ delete buttonProps.moreProps;
409
+ }
410
+
411
+ if (buttonProps.actionType) {
412
+ delete buttonProps.actionType;
413
+ }
414
+
415
+ if (hasBtnLabel) {
416
+ delete buttonProps.btnText;
417
+ }
418
+
419
+ if (buttonProps.confirmmsg) {
420
+ if (_utils.Values.isEmpty(buttonProps.checkField) || _utils.Values.isEmpty(buttonProps.checkData)) {
421
+ throw new Error("Please enter the check field and table data before transmitting the check field and table data");
422
+ }
423
+
424
+ checkField = buttonProps.checkField;
425
+ checkData = buttonProps.checkData;
426
+ confirmMsg = buttonProps.confirmmsg;
427
+ delete buttonProps.checkField;
428
+ delete buttonProps.checkData;
429
+ delete buttonProps.confirmmsg;
430
+ }
431
+
432
+ if (buttonProps.confirmtype) {
433
+ confirmType = buttonProps.confirmtype;
434
+ delete buttonProps.confirmtype;
435
+ }
436
+
437
+ if (buttonProps.children) delete buttonProps.children;
438
+ if (!buttonProps.icon) buttonProps.icon = icon;
439
+ if (!buttonProps.type) buttonProps.type = type;
440
+ if (!buttonProps.theme) buttonProps.theme = theme;
441
+
442
+ if (innerLine) {
443
+ if (!buttonProps.size) {
444
+ buttonProps.size = "small";
445
+ }
446
+ }
447
+
448
+ if (confirmMsg && confirmMsg.trim().length > 0 && typeof buttonProps.onClick === "function") {
449
+ var onClickHandler = buttonProps.onClick;
450
+ var onCancelHandler = buttonProps.onCancel;
451
+ var modalOptions = {
452
+ title: '提示',
453
+ content: confirmMsg,
454
+ onOk: onClickHandler,
455
+ onCancel: onCancelHandler,
456
+ cancelButtonProps: {
457
+ icon: /*#__PURE__*/_react["default"].createElement(_icons.UndoOutlined, null)
458
+ },
459
+ okButtonProps: {
460
+ type: buttonProps.type,
461
+ theme: "solid",
462
+ icon: /*#__PURE__*/_react["default"].createElement(_icons.CheckOutlined, null)
463
+ }
464
+ };
465
+
466
+ buttonProps.onClick = function () {
467
+ if (_utils.Values.isEmpty(checkField) || _utils.Values.isEmpty(checkData)) {
468
+ throw new Error("Please enter the check field and table data before transmitting the check field and table data");
469
+ }
470
+
471
+ var checkedNames = [];
472
+
473
+ if (_utils.Values.isNotEmpty(checkField) && _utils.Values.isNotEmpty(checkData)) {
474
+ if (Array.isArray(checkData)) {
475
+ var selectedData = checkData.filter(function (item) {
476
+ return item.selected;
477
+ });
478
+
479
+ if (_utils.Values.isNotEmptyArray(selectedData)) {
480
+ selectedData.forEach(function (check) {
481
+ checkedNames.push(check[checkField]);
482
+ });
483
+ } else {
484
+ _antd.message.warning('未找到选中的记录,请检查选中状态');
485
+
486
+ return;
487
+ }
488
+ } else if (_lodash["default"].isPlainObject(checkData)) {
489
+ checkedNames.push(checkData[checkField]);
490
+ }
491
+ }
492
+
493
+ modalOptions.content.replace('[options]', checkedNames.join(','));
494
+
495
+ if (confirmType) {
496
+ if (confirmType === 'danger') {
497
+ modalOptions.title = '错误';
498
+
499
+ _antd.Modal.error(modalOptions);
500
+ } else if (confirmType === 'warning') {
501
+ modalOptions.title = '警告';
502
+
503
+ _antd.Modal.warning(modalOptions);
504
+ } else {
505
+ _antd.Modal.confirm(modalOptions);
506
+ }
507
+ } else {
508
+ if (buttonProps.type === "danger") {
509
+ modalOptions.title = '错误';
510
+
511
+ _antd.Modal.error(modalOptions);
512
+ } else if (buttonProps.type === "warning") {
513
+ modalOptions.title = '警告';
514
+
515
+ _antd.Modal.warning(modalOptions);
516
+ } else {
517
+ _antd.Modal.confirm(modalOptions);
518
+ }
519
+ }
520
+ };
521
+ }
522
+
523
+ if (!props.onClick && (props.actionType === ActionButtonTypes.Upload || props.actionType === ActionButtonTypes.Import)) {
524
+ var fileLimit = props.fileLimit;
525
+ var dragSubText = "支持任意类型文件";
526
+
527
+ if (fileLimit && fileLimit != "*" && fileLimit.length > 1) {
528
+ dragSubText = "支持文件类型:" + fileLimit.replaceAll(".", "").replaceAll(",", "、");
529
+ }
530
+
531
+ if (buttonProps.action) delete buttonProps.action;
532
+ if (buttonProps.data) delete buttonProps.data;
533
+ if (buttonProps.onFileChange) delete buttonProps.onFileChange;
534
+ if (buttonProps.fileList) delete buttonProps.fileList;
535
+ if (buttonProps.fileLimit) delete buttonProps.fileLimit;
536
+ if ("showUploadList" in buttonProps) delete buttonProps.showUploadList;
537
+ if ("simpleUploadMode" in buttonProps) delete buttonProps.simpleUploadMode;
538
+ var actionPath = '';
539
+
540
+ if (props.action) {
541
+ if (props.action.indexOf('/') !== -1) {
542
+ actionPath = props.action;
543
+ } else {
544
+ actionPath = _http["default"].getRequestPath(props.action);
545
+ }
546
+ } else {
547
+ actionPath = _http["default"].getRequestPath('uploadFile');
548
+ }
549
+
550
+ var uploadProps = {};
551
+
552
+ if (props.fileList) {
553
+ uploadProps.fileList = props.fileList;
554
+ }
555
+
556
+ if (props.simpleUploadMode) {
557
+ var data = props.data;
558
+ var lastProvidedData = data;
559
+
560
+ if (_lodash["default"].isFunction(data)) {
561
+ lastProvidedData = data();
562
+ }
563
+
564
+ return /*#__PURE__*/_react["default"].createElement(_antd.Upload, _extends({
565
+ action: actionPath,
566
+ defaultFileList: props.defaultFileList,
567
+ data: lastProvidedData,
568
+ uploadTrigger: props.action ? 'auto' : "custom",
569
+ beforeRemove: props.beforeRemove,
570
+ onFileChange: props.onFileChange,
571
+ onSuccess: function onSuccess(event, file) {
572
+ _antd.message.success("".concat(file.name, "\u6587\u4EF6\u5BFC\u5165\u6210\u529F\uFF01"));
573
+
574
+ props.onFileChange(event, 'success');
575
+ },
576
+ onError: function onError(e, file, fileList, xhr) {
577
+ _http["default"].dealAjaxException(xhr);
578
+ },
579
+ showUploadList: props.showUploadList
580
+ }, uploadProps, {
581
+ fileLimit: fileLimit,
582
+ accept: props.accept,
583
+ showClear: props.showClear,
584
+ draggable: true,
585
+ dragMainText: props.dragMainText || "点击上传文件或拖拽文件到这里",
586
+ dragSubText: props.dragSubText || dragSubText
587
+ }), /*#__PURE__*/_react["default"].createElement(_antd.Button, buttonProps, props.children ? props.children : btnLabel));
588
+ } else {
589
+ buttonProps.onClick = function () {
590
+ if (buttonProps.validate === undefined || buttonProps.validate) {
591
+ var _actionPath = '';
592
+
593
+ if (props.action) {
594
+ if (props.action.indexOf('/') !== -1) {
595
+ _actionPath = props.action;
596
+ } else {
597
+ _actionPath = _http["default"].getRequestPath(props.action);
598
+ }
599
+ } else {
600
+ _actionPath = _http["default"].getRequestPath('uploadFile');
601
+ }
602
+
603
+ var uploadModal = _antd.Modal.info({
604
+ 'icon': null,
605
+ 'title': props.uploadTitle || ' ',
606
+ 'okButtonProps': {
607
+ icon: /*#__PURE__*/_react["default"].createElement(_icons.CheckOutlined, null)
608
+ },
609
+ 'cancelButtonProps': {
610
+ icon: /*#__PURE__*/_react["default"].createElement(_icons.UndoOutlined, null)
611
+ },
612
+ 'footer': '',
613
+ 'content': /*#__PURE__*/_react["default"].createElement(_antd.Upload, _extends({
614
+ action: _actionPath,
615
+ data: props.data ? props.data : null,
616
+ uploadTrigger: props.action ? 'auto' : "custom",
617
+ onError: function onError(e, file, fileList, xhr) {
618
+ _http["default"].dealAjaxException(xhr);
619
+ },
620
+ onFileChange: props.onFileChange,
621
+ onSuccess: function onSuccess(event, file) {
622
+ _antd.message.success("".concat(file.name, "\u6587\u4EF6\u5BFC\u5165\u6210\u529F\uFF01"));
623
+
624
+ props.onFileChange(event, 'success');
625
+ uploadModal.destroy();
626
+ },
627
+ showUploadList: props.showUploadList
628
+ }, uploadProps, {
629
+ fileLimit: fileLimit,
630
+ draggable: true,
631
+ dragMainText: props.dragMainText || "点击上传文件或拖拽文件到这里",
632
+ dragSubText: props.dragSubText || dragSubText
633
+ }))
634
+ });
635
+ } else {
636
+ if (_lodash["default"].isFunction(buttonProps.validateChange)) {
637
+ buttonProps.validateChange();
638
+ }
639
+ }
640
+ };
641
+ }
642
+ }
643
+
644
+ if (props.actionType === ActionButtonTypes.ReturnBack && typeof buttonProps.onClick !== "function") {
645
+ buttonProps.onClick = function () {
646
+ _http["default"].goBack();
647
+ };
648
+ }
649
+
650
+ if (subActionButton) {
651
+ return /*#__PURE__*/_react["default"].createElement(_antd.Dropdown.Item, buttonProps, props.children ? props.children : btnLabel);
652
+ } else {
653
+ if (props.actionType === ActionButtonTypes.More) {
654
+ return /*#__PURE__*/_react["default"].createElement(_antd.Button, buttonProps, btnLabel);
655
+ } else if (props.actionType === ActionButtonTypes.Down) {
656
+ delete buttonProps.icon;
657
+ return /*#__PURE__*/_react["default"].createElement(_antd.Button, buttonProps, btnLabel, " ", icon);
658
+ } else {
659
+ return /*#__PURE__*/_react["default"].createElement(_antd.Button, buttonProps, props.children ? props.children : btnLabel);
660
+ }
661
+ }
662
+ };
663
+
664
+ var ActionButton = function ActionButton(props) {
665
+ if (props.actionType === ActionButtonTypes.More) {
666
+ var _props$moreProps, _props$moreProps2, _props$moreProps3, _props$moreProps4;
667
+
668
+ return /*#__PURE__*/_react["default"].createElement(_antd.Dropdown, _extends({}, props.moreProps, {
669
+ zIndex: 1000,
670
+ trigger: ((_props$moreProps = props.moreProps) === null || _props$moreProps === void 0 ? void 0 : _props$moreProps.trigger) ? (_props$moreProps2 = props.moreProps) === null || _props$moreProps2 === void 0 ? void 0 : _props$moreProps2.trigger : 'hover',
671
+ position: ((_props$moreProps3 = props.moreProps) === null || _props$moreProps3 === void 0 ? void 0 : _props$moreProps3.position) ? (_props$moreProps4 = props.moreProps) === null || _props$moreProps4 === void 0 ? void 0 : _props$moreProps4.position : 'bottomLeft',
672
+ render: /*#__PURE__*/_react["default"].createElement(_antd.Dropdown.Menu, null, props.children)
673
+ }), buildActionButton(props, false, false));
674
+ } else {
675
+ return buildActionButton(props, false, false);
676
+ }
677
+ };
678
+
679
+ exports.ActionButton = ActionButton;
680
+
681
+ var SubActionButton = function SubActionButton(props) {
682
+ return buildActionButton(props, true, false);
683
+ };
684
+
685
+ exports.SubActionButton = SubActionButton;
686
+
687
+ var InnerLineActionButton = function InnerLineActionButton(props) {
688
+ if (props.actionType === ActionButtonTypes.More) {
689
+ return /*#__PURE__*/_react["default"].createElement(_antd.Dropdown, {
690
+ trigger: props.trigger ? props.trigger : 'hover',
691
+ position: props.position ? props.position : 'bottomLeft',
692
+ render: /*#__PURE__*/_react["default"].createElement(_antd.Dropdown.Menu, null, props.children)
693
+ }, buildActionButton(props, false, true));
694
+ } else {
695
+ return buildActionButton(props, false, true);
696
+ }
697
+ };
698
+
699
+ exports.InnerLineActionButton = InnerLineActionButton;
700
+
701
+ var SubInnerLineActionButton = function SubInnerLineActionButton(props) {
702
+ return buildActionButton(props, true, true);
703
+ };
704
+
705
+ exports.SubInnerLineActionButton = SubInnerLineActionButton;