wargerm 0.3.17 → 0.3.20
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/dist/components/Modal/dialog.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +132 -105
- package/dist/index.js +130 -103
- package/package.json +1 -1
package/dist/index.css
CHANGED
package/dist/index.esm.css
CHANGED
package/dist/index.esm.js
CHANGED
@@ -5,7 +5,7 @@ import _Dropdown from 'antd/es/dropdown';
|
|
5
5
|
import 'antd/es/menu/style';
|
6
6
|
import _Menu from 'antd/es/menu';
|
7
7
|
import React, { useState, useEffect, useMemo, useImperativeHandle, useRef } from 'react';
|
8
|
-
import { createFromIconfontCN, SearchOutlined, ReloadOutlined, CloseCircleOutlined, PlusOutlined,
|
8
|
+
import { createFromIconfontCN, SearchOutlined, ReloadOutlined, CloseCircleOutlined, PlusOutlined, EllipsisOutlined, ExclamationCircleOutlined, EyeOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
9
9
|
import 'antd/es/input/style';
|
10
10
|
import _Input from 'antd/es/input';
|
11
11
|
import 'antd/es/input-number/style';
|
@@ -46,7 +46,7 @@ import _Breadcrumb from 'antd/es/breadcrumb';
|
|
46
46
|
import ReactDOM from 'react-dom';
|
47
47
|
import 'antd/es/modal/style';
|
48
48
|
import _Modal from 'antd/es/modal';
|
49
|
-
import ProTable
|
49
|
+
import ProTable from '@ant-design/pro-table';
|
50
50
|
|
51
51
|
function ownKeys(object, enumerableOnly) {
|
52
52
|
var keys = Object.keys(object);
|
@@ -9506,6 +9506,7 @@ var controlShow = function controlShow(f1, f2, value, timer) {
|
|
9506
9506
|
function DialogModel(props) {
|
9507
9507
|
var width = props.width,
|
9508
9508
|
visible = props.visible,
|
9509
|
+
destroyOnClose = props.destroyOnClose,
|
9509
9510
|
closeCb = props.closeCb,
|
9510
9511
|
onClose = props.onClose,
|
9511
9512
|
_props$className = props.className,
|
@@ -9527,6 +9528,16 @@ function DialogModel(props) {
|
|
9527
9528
|
flag = _useState6[0],
|
9528
9529
|
setFlag = _useState6[1];
|
9529
9530
|
|
9531
|
+
var _useState7 = useState(false),
|
9532
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
9533
|
+
hasVisit = _useState8[0],
|
9534
|
+
setHasVisit = _useState8[1];
|
9535
|
+
|
9536
|
+
var _useState9 = useState(false),
|
9537
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
9538
|
+
isDesChild = _useState10[0],
|
9539
|
+
setIsDesChild = _useState10[1];
|
9540
|
+
|
9530
9541
|
var renderChildren = useMemo(function () {
|
9531
9542
|
var _classNames;
|
9532
9543
|
|
@@ -9552,16 +9563,16 @@ function DialogModel(props) {
|
|
9552
9563
|
height: '100%',
|
9553
9564
|
position: 'relative'
|
9554
9565
|
}
|
9555
|
-
}, props.children))), /*#__PURE__*/React.createElement("div", {
|
9566
|
+
}, isDesChild ? null : props.children))), /*#__PURE__*/React.createElement("div", {
|
9556
9567
|
className: 'mask',
|
9557
9568
|
onClick: function onClick() {
|
9558
|
-
|
9569
|
+
onClose && onClose();
|
9559
9570
|
},
|
9560
9571
|
style: {
|
9561
9572
|
opacity: modelShowAync ? 0.6 : 0
|
9562
9573
|
}
|
9563
9574
|
})), document.body);
|
9564
|
-
}, [modelShowAync, modelShow, props]);
|
9575
|
+
}, [modelShowAync, modelShow, props, isDesChild]);
|
9565
9576
|
useEffect(function () {
|
9566
9577
|
var timer;
|
9567
9578
|
setFlag(visible);
|
@@ -9577,12 +9588,25 @@ function DialogModel(props) {
|
|
9577
9588
|
};
|
9578
9589
|
}, [visible]);
|
9579
9590
|
useEffect(function () {
|
9591
|
+
if (modelShow) {
|
9592
|
+
setHasVisit(true);
|
9593
|
+
}
|
9594
|
+
|
9595
|
+
if (destroyOnClose && hasVisit) {
|
9596
|
+
if (!modelShow) {
|
9597
|
+
setIsDesChild(true);
|
9598
|
+
} else {
|
9599
|
+
setIsDesChild(false);
|
9600
|
+
}
|
9601
|
+
}
|
9602
|
+
|
9580
9603
|
!modelShow && typeof closeCb === 'function' && closeCb();
|
9581
|
-
}, [modelShow]);
|
9604
|
+
}, [modelShow, hasVisit, destroyOnClose]);
|
9582
9605
|
return renderChildren;
|
9583
9606
|
}
|
9584
9607
|
|
9585
|
-
var _excluded$e = ["visible"]
|
9608
|
+
var _excluded$e = ["visible", "width", "closeCb", "onClose", "className", "style"],
|
9609
|
+
_excluded2$3 = ["visible"];
|
9586
9610
|
|
9587
9611
|
var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
9588
9612
|
_inherits(Modal, _React$PureComponent);
|
@@ -9661,15 +9685,17 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
|
9661
9685
|
closeCb = _this$props4.closeCb,
|
9662
9686
|
onClose = _this$props4.onClose,
|
9663
9687
|
className = _this$props4.className,
|
9664
|
-
style = _this$props4.style
|
9665
|
-
|
9688
|
+
style = _this$props4.style,
|
9689
|
+
other = _objectWithoutProperties(_this$props4, _excluded$e);
|
9690
|
+
|
9691
|
+
return /*#__PURE__*/React.createElement(DialogModel, _objectSpread2({
|
9666
9692
|
closeCb: closeCb,
|
9667
9693
|
onClose: onClose,
|
9668
9694
|
visible: visible,
|
9669
9695
|
width: width,
|
9670
9696
|
className: className,
|
9671
9697
|
style: style
|
9672
|
-
}, this.renderTop(), /*#__PURE__*/React.createElement("div", {
|
9698
|
+
}, other), this.renderTop(), /*#__PURE__*/React.createElement("div", {
|
9673
9699
|
className: "model-content"
|
9674
9700
|
}, /*#__PURE__*/React.createElement("div", {
|
9675
9701
|
className: "model-content-in"
|
@@ -9716,7 +9742,7 @@ Modal.show = function (config) {
|
|
9716
9742
|
manager.setShow = setShow;
|
9717
9743
|
|
9718
9744
|
var visible = props.visible,
|
9719
|
-
trueProps = _objectWithoutProperties(props,
|
9745
|
+
trueProps = _objectWithoutProperties(props, _excluded2$3);
|
9720
9746
|
|
9721
9747
|
useEffect(function () {
|
9722
9748
|
manager.mounted = true;
|
@@ -10039,7 +10065,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10039
10065
|
|
10040
10066
|
useImperativeHandle(ref, function () {
|
10041
10067
|
return {
|
10042
|
-
formRef: formRef,
|
10068
|
+
formRef: formRef.current,
|
10043
10069
|
onSubmit: onSubmit
|
10044
10070
|
};
|
10045
10071
|
});
|
@@ -10135,8 +10161,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10135
10161
|
|
10136
10162
|
var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
|
10137
10163
|
|
10138
|
-
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination"]
|
10139
|
-
_excluded2$3 = ["actionMethod"];
|
10164
|
+
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination"];
|
10140
10165
|
|
10141
10166
|
var TabelCard = function TabelCard(props, ref) {
|
10142
10167
|
var columns = props.columns,
|
@@ -10155,7 +10180,8 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10155
10180
|
extraProps = _objectWithoutProperties(props, _excluded$h);
|
10156
10181
|
|
10157
10182
|
var actionRef = useRef();
|
10158
|
-
var
|
10183
|
+
var modalFormRef = useRef(null);
|
10184
|
+
var searchFormRef = useRef(null);
|
10159
10185
|
|
10160
10186
|
var _useState = useState(false),
|
10161
10187
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -10175,7 +10201,8 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10175
10201
|
useImperativeHandle(ref, function () {
|
10176
10202
|
return {
|
10177
10203
|
actionRef: actionRef.current,
|
10178
|
-
|
10204
|
+
modalFormRef: modalFormRef.current,
|
10205
|
+
searchFormRef: searchFormRef.current
|
10179
10206
|
};
|
10180
10207
|
});
|
10181
10208
|
|
@@ -10319,67 +10346,6 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10319
10346
|
}
|
10320
10347
|
}, _callee4);
|
10321
10348
|
})), index);
|
10322
|
-
},
|
10323
|
-
more: function more(item, record, index) {
|
10324
|
-
var menus = !item.subMenus ? [] : item.subMenus.map(function (b) {
|
10325
|
-
var btn = actionConfig[b.key];
|
10326
|
-
|
10327
|
-
if (btn) {
|
10328
|
-
b.name = btn.title;
|
10329
|
-
b.icon = btn.icon;
|
10330
|
-
}
|
10331
|
-
|
10332
|
-
return b;
|
10333
|
-
});
|
10334
|
-
|
10335
|
-
var selectHandler = function selectHandler(key, item, record, index) {
|
10336
|
-
var _item$actionMethod;
|
10337
|
-
|
10338
|
-
if (key == 'more') {
|
10339
|
-
// No more recursion
|
10340
|
-
return;
|
10341
|
-
}
|
10342
|
-
|
10343
|
-
var customMenu = menus.find(function (m) {
|
10344
|
-
return m.key === key;
|
10345
|
-
});
|
10346
|
-
|
10347
|
-
var _item = _objectSpread2(_objectSpread2({}, customMenu), {}, {
|
10348
|
-
type: key
|
10349
|
-
});
|
10350
|
-
|
10351
|
-
var handler = actionHandler[key];
|
10352
|
-
|
10353
|
-
if (handler) {
|
10354
|
-
return handler(_item, record, index);
|
10355
|
-
}
|
10356
|
-
|
10357
|
-
return (_item$actionMethod = _item.actionMethod) === null || _item$actionMethod === void 0 ? void 0 : _item$actionMethod.call(_item, record, function () {
|
10358
|
-
var _actionRef$current4;
|
10359
|
-
|
10360
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.reload();
|
10361
|
-
});
|
10362
|
-
};
|
10363
|
-
|
10364
|
-
var m = _toConsumableArray(menus).map(function (e) {
|
10365
|
-
if (!('actionMethod' in e)) {
|
10366
|
-
return e;
|
10367
|
-
}
|
10368
|
-
|
10369
|
-
var actionMethod = e.actionMethod,
|
10370
|
-
b = _objectWithoutProperties(e, _excluded2$3);
|
10371
|
-
|
10372
|
-
return _objectSpread2({}, b);
|
10373
|
-
});
|
10374
|
-
|
10375
|
-
return /*#__PURE__*/React.createElement(TableDropdown, {
|
10376
|
-
key: "actionGroup",
|
10377
|
-
children: /*#__PURE__*/React.createElement(MoreOutlined, null),
|
10378
|
-
menus: m,
|
10379
|
-
onSelect: function onSelect(key) {
|
10380
|
-
return selectHandler(key, item, record, index);
|
10381
|
-
}
|
10382
|
-
});
|
10383
10349
|
}
|
10384
10350
|
};
|
10385
10351
|
var actionConfig = {
|
@@ -10401,27 +10367,86 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10401
10367
|
};
|
10402
10368
|
|
10403
10369
|
var tableActionDom = function tableActionDom(record, index) {
|
10404
|
-
|
10405
|
-
var _actionHandler$item$t2;
|
10370
|
+
var showMoreNum = (optionColumnConfig === null || optionColumnConfig === void 0 ? void 0 : optionColumnConfig.showMoreNum) || 0;
|
10406
10371
|
|
10407
|
-
|
10372
|
+
if (tableAction && showMoreNum > 0 && showMoreNum < tableAction.length) {
|
10373
|
+
var tableAction1 = tableAction.slice(0, showMoreNum);
|
10374
|
+
var tableAction2 = tableAction.slice(showMoreNum);
|
10375
|
+
var menu = /*#__PURE__*/React.createElement(_Menu, null, tableAction2.map(function (item, i) {
|
10376
|
+
var _actionHandler$item$t2;
|
10408
10377
|
|
10409
|
-
|
10410
|
-
return /*#__PURE__*/React.createElement(_Tooltip, {
|
10411
|
-
title: btn.title,
|
10412
|
-
key: btn.key
|
10413
|
-
}, /*#__PURE__*/React.createElement("a", {
|
10414
|
-
key: btn.key,
|
10415
|
-
onClick: function onClick() {
|
10416
|
-
var _actionHandler$item$t;
|
10378
|
+
var btn = actionConfig[item.type];
|
10417
10379
|
|
10418
|
-
|
10419
|
-
|
10420
|
-
|
10421
|
-
|
10380
|
+
if (btn) {
|
10381
|
+
return /*#__PURE__*/React.createElement(_Menu.Item, {
|
10382
|
+
key: i
|
10383
|
+
}, /*#__PURE__*/React.createElement("a", {
|
10384
|
+
key: btn.key,
|
10385
|
+
onClick: function onClick() {
|
10386
|
+
var _actionHandler$item$t;
|
10387
|
+
|
10388
|
+
return (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, record, index);
|
10389
|
+
}
|
10390
|
+
}, btn.icon, " ", btn.title));
|
10391
|
+
}
|
10422
10392
|
|
10423
|
-
|
10424
|
-
|
10393
|
+
return /*#__PURE__*/React.createElement(_Menu.Item, {
|
10394
|
+
key: i
|
10395
|
+
}, (_actionHandler$item$t2 = actionHandler[item.type]) === null || _actionHandler$item$t2 === void 0 ? void 0 : _actionHandler$item$t2.call(actionHandler, item, record, index));
|
10396
|
+
}));
|
10397
|
+
return [].concat(_toConsumableArray(tableAction1.map(function (item, i) {
|
10398
|
+
var _actionHandler$item$t4;
|
10399
|
+
|
10400
|
+
var btn = actionConfig[item.type];
|
10401
|
+
|
10402
|
+
if (btn) {
|
10403
|
+
return /*#__PURE__*/React.createElement(_Tooltip, {
|
10404
|
+
title: btn.title,
|
10405
|
+
key: i
|
10406
|
+
}, /*#__PURE__*/React.createElement("a", {
|
10407
|
+
key: btn.key,
|
10408
|
+
onClick: function onClick() {
|
10409
|
+
var _actionHandler$item$t3;
|
10410
|
+
|
10411
|
+
return (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, record, index);
|
10412
|
+
}
|
10413
|
+
}, btn.icon, " ", btn.title));
|
10414
|
+
}
|
10415
|
+
|
10416
|
+
return /*#__PURE__*/React.createElement("span", {
|
10417
|
+
key: i
|
10418
|
+
}, (_actionHandler$item$t4 = actionHandler[item.type]) === null || _actionHandler$item$t4 === void 0 ? void 0 : _actionHandler$item$t4.call(actionHandler, item, record, index));
|
10419
|
+
})), [/*#__PURE__*/React.createElement(_Dropdown, {
|
10420
|
+
overlay: menu,
|
10421
|
+
key: 'more'
|
10422
|
+
}, /*#__PURE__*/React.createElement("a", {
|
10423
|
+
key: "more"
|
10424
|
+
}, /*#__PURE__*/React.createElement(EllipsisOutlined, null)))]);
|
10425
|
+
} else {
|
10426
|
+
return tableAction === null || tableAction === void 0 ? void 0 : tableAction.map(function (item, i) {
|
10427
|
+
var _actionHandler$item$t6;
|
10428
|
+
|
10429
|
+
var btn = actionConfig[item.type];
|
10430
|
+
|
10431
|
+
if (btn) {
|
10432
|
+
return /*#__PURE__*/React.createElement(_Tooltip, {
|
10433
|
+
title: btn.title,
|
10434
|
+
key: i
|
10435
|
+
}, /*#__PURE__*/React.createElement("a", {
|
10436
|
+
key: btn.key,
|
10437
|
+
onClick: function onClick() {
|
10438
|
+
var _actionHandler$item$t5;
|
10439
|
+
|
10440
|
+
return (_actionHandler$item$t5 = actionHandler[item.type]) === null || _actionHandler$item$t5 === void 0 ? void 0 : _actionHandler$item$t5.call(actionHandler, item, record, index);
|
10441
|
+
}
|
10442
|
+
}, btn.icon, " ", btn.title));
|
10443
|
+
}
|
10444
|
+
|
10445
|
+
return /*#__PURE__*/React.createElement("span", {
|
10446
|
+
key: i
|
10447
|
+
}, (_actionHandler$item$t6 = actionHandler[item.type]) === null || _actionHandler$item$t6 === void 0 ? void 0 : _actionHandler$item$t6.call(actionHandler, item, record, index));
|
10448
|
+
});
|
10449
|
+
}
|
10425
10450
|
};
|
10426
10451
|
|
10427
10452
|
var tableBarDom = useMemo(function () {
|
@@ -10450,10 +10475,10 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10450
10475
|
|
10451
10476
|
_context5.next = 3;
|
10452
10477
|
return item.actionMethod(values, function () {
|
10453
|
-
var _actionRef$
|
10478
|
+
var _actionRef$current4;
|
10454
10479
|
|
10455
10480
|
loading();
|
10456
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10481
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.reload();
|
10457
10482
|
});
|
10458
10483
|
|
10459
10484
|
case 3:
|
@@ -10478,9 +10503,9 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10478
10503
|
|
10479
10504
|
return (_item$actionRender2 = item.actionRender) === null || _item$actionRender2 === void 0 ? void 0 : _item$actionRender2.call(item, actionRef, function () {
|
10480
10505
|
item.actionMethod && item.actionMethod(actionRef, function () {
|
10481
|
-
var _actionRef$
|
10506
|
+
var _actionRef$current5;
|
10482
10507
|
|
10483
|
-
return actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10508
|
+
return actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.reload();
|
10484
10509
|
});
|
10485
10510
|
});
|
10486
10511
|
}
|
@@ -10488,22 +10513,22 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10488
10513
|
}, [actionRef]);
|
10489
10514
|
|
10490
10515
|
var onSubmit = function onSubmit(values) {
|
10491
|
-
var _actionRef$
|
10516
|
+
var _actionRef$current6;
|
10492
10517
|
|
10493
10518
|
setFormSearch(values);
|
10494
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10519
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload();
|
10495
10520
|
};
|
10496
10521
|
|
10497
10522
|
var onReset = function onReset() {
|
10498
|
-
var _actionRef$
|
10523
|
+
var _actionRef$current7;
|
10499
10524
|
|
10500
10525
|
setFormSearch({});
|
10501
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10526
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload();
|
10502
10527
|
};
|
10503
10528
|
|
10504
10529
|
var formSearchColumn = columns || [];
|
10505
10530
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalForm$1, _objectSpread2(_objectSpread2({
|
10506
|
-
ref:
|
10531
|
+
ref: modalFormRef,
|
10507
10532
|
title: modalFormConfig.type || '新增',
|
10508
10533
|
visible: visible,
|
10509
10534
|
record: modalFormConfig.record,
|
@@ -10557,8 +10582,10 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10557
10582
|
return true;
|
10558
10583
|
})
|
10559
10584
|
})), /*#__PURE__*/React.createElement(WForm$1, {
|
10560
|
-
ref:
|
10561
|
-
search:
|
10585
|
+
ref: searchFormRef,
|
10586
|
+
search: search == false ? {
|
10587
|
+
hideSubmit: true
|
10588
|
+
} : _objectSpread2(_objectSpread2({
|
10562
10589
|
labelWidth: 'auto',
|
10563
10590
|
searchText: '查询',
|
10564
10591
|
span: 6
|
package/dist/index.js
CHANGED
@@ -9540,6 +9540,7 @@ var controlShow = function controlShow(f1, f2, value, timer) {
|
|
9540
9540
|
function DialogModel(props) {
|
9541
9541
|
var width = props.width,
|
9542
9542
|
visible = props.visible,
|
9543
|
+
destroyOnClose = props.destroyOnClose,
|
9543
9544
|
closeCb = props.closeCb,
|
9544
9545
|
onClose = props.onClose,
|
9545
9546
|
_props$className = props.className,
|
@@ -9561,6 +9562,16 @@ function DialogModel(props) {
|
|
9561
9562
|
flag = _useState6[0],
|
9562
9563
|
setFlag = _useState6[1];
|
9563
9564
|
|
9565
|
+
var _useState7 = React.useState(false),
|
9566
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
9567
|
+
hasVisit = _useState8[0],
|
9568
|
+
setHasVisit = _useState8[1];
|
9569
|
+
|
9570
|
+
var _useState9 = React.useState(false),
|
9571
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
9572
|
+
isDesChild = _useState10[0],
|
9573
|
+
setIsDesChild = _useState10[1];
|
9574
|
+
|
9564
9575
|
var renderChildren = React.useMemo(function () {
|
9565
9576
|
var _classNames;
|
9566
9577
|
|
@@ -9586,16 +9597,16 @@ function DialogModel(props) {
|
|
9586
9597
|
height: '100%',
|
9587
9598
|
position: 'relative'
|
9588
9599
|
}
|
9589
|
-
}, props.children))), /*#__PURE__*/React__default['default'].createElement("div", {
|
9600
|
+
}, isDesChild ? null : props.children))), /*#__PURE__*/React__default['default'].createElement("div", {
|
9590
9601
|
className: 'mask',
|
9591
9602
|
onClick: function onClick() {
|
9592
|
-
|
9603
|
+
onClose && onClose();
|
9593
9604
|
},
|
9594
9605
|
style: {
|
9595
9606
|
opacity: modelShowAync ? 0.6 : 0
|
9596
9607
|
}
|
9597
9608
|
})), document.body);
|
9598
|
-
}, [modelShowAync, modelShow, props]);
|
9609
|
+
}, [modelShowAync, modelShow, props, isDesChild]);
|
9599
9610
|
React.useEffect(function () {
|
9600
9611
|
var timer;
|
9601
9612
|
setFlag(visible);
|
@@ -9611,12 +9622,25 @@ function DialogModel(props) {
|
|
9611
9622
|
};
|
9612
9623
|
}, [visible]);
|
9613
9624
|
React.useEffect(function () {
|
9625
|
+
if (modelShow) {
|
9626
|
+
setHasVisit(true);
|
9627
|
+
}
|
9628
|
+
|
9629
|
+
if (destroyOnClose && hasVisit) {
|
9630
|
+
if (!modelShow) {
|
9631
|
+
setIsDesChild(true);
|
9632
|
+
} else {
|
9633
|
+
setIsDesChild(false);
|
9634
|
+
}
|
9635
|
+
}
|
9636
|
+
|
9614
9637
|
!modelShow && typeof closeCb === 'function' && closeCb();
|
9615
|
-
}, [modelShow]);
|
9638
|
+
}, [modelShow, hasVisit, destroyOnClose]);
|
9616
9639
|
return renderChildren;
|
9617
9640
|
}
|
9618
9641
|
|
9619
|
-
var _excluded$e = ["visible"]
|
9642
|
+
var _excluded$e = ["visible", "width", "closeCb", "onClose", "className", "style"],
|
9643
|
+
_excluded2$3 = ["visible"];
|
9620
9644
|
|
9621
9645
|
var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
9622
9646
|
_inherits(Modal, _React$PureComponent);
|
@@ -9695,15 +9719,17 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
|
9695
9719
|
closeCb = _this$props4.closeCb,
|
9696
9720
|
onClose = _this$props4.onClose,
|
9697
9721
|
className = _this$props4.className,
|
9698
|
-
style = _this$props4.style
|
9699
|
-
|
9722
|
+
style = _this$props4.style,
|
9723
|
+
other = _objectWithoutProperties(_this$props4, _excluded$e);
|
9724
|
+
|
9725
|
+
return /*#__PURE__*/React__default['default'].createElement(DialogModel, _objectSpread2({
|
9700
9726
|
closeCb: closeCb,
|
9701
9727
|
onClose: onClose,
|
9702
9728
|
visible: visible,
|
9703
9729
|
width: width,
|
9704
9730
|
className: className,
|
9705
9731
|
style: style
|
9706
|
-
}, this.renderTop(), /*#__PURE__*/React__default['default'].createElement("div", {
|
9732
|
+
}, other), this.renderTop(), /*#__PURE__*/React__default['default'].createElement("div", {
|
9707
9733
|
className: "model-content"
|
9708
9734
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
9709
9735
|
className: "model-content-in"
|
@@ -9750,7 +9776,7 @@ Modal.show = function (config) {
|
|
9750
9776
|
manager.setShow = setShow;
|
9751
9777
|
|
9752
9778
|
var visible = props.visible,
|
9753
|
-
trueProps = _objectWithoutProperties(props,
|
9779
|
+
trueProps = _objectWithoutProperties(props, _excluded2$3);
|
9754
9780
|
|
9755
9781
|
React.useEffect(function () {
|
9756
9782
|
manager.mounted = true;
|
@@ -10073,7 +10099,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10073
10099
|
|
10074
10100
|
React.useImperativeHandle(ref, function () {
|
10075
10101
|
return {
|
10076
|
-
formRef: formRef,
|
10102
|
+
formRef: formRef.current,
|
10077
10103
|
onSubmit: onSubmit
|
10078
10104
|
};
|
10079
10105
|
});
|
@@ -10169,8 +10195,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10169
10195
|
|
10170
10196
|
var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
|
10171
10197
|
|
10172
|
-
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination"]
|
10173
|
-
_excluded2$3 = ["actionMethod"];
|
10198
|
+
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination"];
|
10174
10199
|
|
10175
10200
|
var TabelCard = function TabelCard(props, ref) {
|
10176
10201
|
var columns = props.columns,
|
@@ -10189,7 +10214,8 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10189
10214
|
extraProps = _objectWithoutProperties(props, _excluded$h);
|
10190
10215
|
|
10191
10216
|
var actionRef = React.useRef();
|
10192
|
-
var
|
10217
|
+
var modalFormRef = React.useRef(null);
|
10218
|
+
var searchFormRef = React.useRef(null);
|
10193
10219
|
|
10194
10220
|
var _useState = React.useState(false),
|
10195
10221
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -10209,7 +10235,8 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10209
10235
|
React.useImperativeHandle(ref, function () {
|
10210
10236
|
return {
|
10211
10237
|
actionRef: actionRef.current,
|
10212
|
-
|
10238
|
+
modalFormRef: modalFormRef.current,
|
10239
|
+
searchFormRef: searchFormRef.current
|
10213
10240
|
};
|
10214
10241
|
});
|
10215
10242
|
|
@@ -10353,67 +10380,6 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10353
10380
|
}
|
10354
10381
|
}, _callee4);
|
10355
10382
|
})), index);
|
10356
|
-
},
|
10357
|
-
more: function more(item, record, index) {
|
10358
|
-
var menus = !item.subMenus ? [] : item.subMenus.map(function (b) {
|
10359
|
-
var btn = actionConfig[b.key];
|
10360
|
-
|
10361
|
-
if (btn) {
|
10362
|
-
b.name = btn.title;
|
10363
|
-
b.icon = btn.icon;
|
10364
|
-
}
|
10365
|
-
|
10366
|
-
return b;
|
10367
|
-
});
|
10368
|
-
|
10369
|
-
var selectHandler = function selectHandler(key, item, record, index) {
|
10370
|
-
var _item$actionMethod;
|
10371
|
-
|
10372
|
-
if (key == 'more') {
|
10373
|
-
// No more recursion
|
10374
|
-
return;
|
10375
|
-
}
|
10376
|
-
|
10377
|
-
var customMenu = menus.find(function (m) {
|
10378
|
-
return m.key === key;
|
10379
|
-
});
|
10380
|
-
|
10381
|
-
var _item = _objectSpread2(_objectSpread2({}, customMenu), {}, {
|
10382
|
-
type: key
|
10383
|
-
});
|
10384
|
-
|
10385
|
-
var handler = actionHandler[key];
|
10386
|
-
|
10387
|
-
if (handler) {
|
10388
|
-
return handler(_item, record, index);
|
10389
|
-
}
|
10390
|
-
|
10391
|
-
return (_item$actionMethod = _item.actionMethod) === null || _item$actionMethod === void 0 ? void 0 : _item$actionMethod.call(_item, record, function () {
|
10392
|
-
var _actionRef$current4;
|
10393
|
-
|
10394
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.reload();
|
10395
|
-
});
|
10396
|
-
};
|
10397
|
-
|
10398
|
-
var m = _toConsumableArray(menus).map(function (e) {
|
10399
|
-
if (!('actionMethod' in e)) {
|
10400
|
-
return e;
|
10401
|
-
}
|
10402
|
-
|
10403
|
-
var actionMethod = e.actionMethod,
|
10404
|
-
b = _objectWithoutProperties(e, _excluded2$3);
|
10405
|
-
|
10406
|
-
return _objectSpread2({}, b);
|
10407
|
-
});
|
10408
|
-
|
10409
|
-
return /*#__PURE__*/React__default['default'].createElement(ProTable.TableDropdown, {
|
10410
|
-
key: "actionGroup",
|
10411
|
-
children: /*#__PURE__*/React__default['default'].createElement(icons.MoreOutlined, null),
|
10412
|
-
menus: m,
|
10413
|
-
onSelect: function onSelect(key) {
|
10414
|
-
return selectHandler(key, item, record, index);
|
10415
|
-
}
|
10416
|
-
});
|
10417
10383
|
}
|
10418
10384
|
};
|
10419
10385
|
var actionConfig = {
|
@@ -10435,27 +10401,86 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10435
10401
|
};
|
10436
10402
|
|
10437
10403
|
var tableActionDom = function tableActionDom(record, index) {
|
10438
|
-
|
10439
|
-
var _actionHandler$item$t2;
|
10404
|
+
var showMoreNum = (optionColumnConfig === null || optionColumnConfig === void 0 ? void 0 : optionColumnConfig.showMoreNum) || 0;
|
10440
10405
|
|
10441
|
-
|
10406
|
+
if (tableAction && showMoreNum > 0 && showMoreNum < tableAction.length) {
|
10407
|
+
var tableAction1 = tableAction.slice(0, showMoreNum);
|
10408
|
+
var tableAction2 = tableAction.slice(showMoreNum);
|
10409
|
+
var menu = /*#__PURE__*/React__default['default'].createElement(_Menu__default['default'], null, tableAction2.map(function (item, i) {
|
10410
|
+
var _actionHandler$item$t2;
|
10442
10411
|
|
10443
|
-
|
10444
|
-
return /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
|
10445
|
-
title: btn.title,
|
10446
|
-
key: btn.key
|
10447
|
-
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
10448
|
-
key: btn.key,
|
10449
|
-
onClick: function onClick() {
|
10450
|
-
var _actionHandler$item$t;
|
10412
|
+
var btn = actionConfig[item.type];
|
10451
10413
|
|
10452
|
-
|
10453
|
-
|
10454
|
-
|
10455
|
-
|
10414
|
+
if (btn) {
|
10415
|
+
return /*#__PURE__*/React__default['default'].createElement(_Menu__default['default'].Item, {
|
10416
|
+
key: i
|
10417
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
10418
|
+
key: btn.key,
|
10419
|
+
onClick: function onClick() {
|
10420
|
+
var _actionHandler$item$t;
|
10421
|
+
|
10422
|
+
return (_actionHandler$item$t = actionHandler[item.type]) === null || _actionHandler$item$t === void 0 ? void 0 : _actionHandler$item$t.call(actionHandler, item, record, index);
|
10423
|
+
}
|
10424
|
+
}, btn.icon, " ", btn.title));
|
10425
|
+
}
|
10456
10426
|
|
10457
|
-
|
10458
|
-
|
10427
|
+
return /*#__PURE__*/React__default['default'].createElement(_Menu__default['default'].Item, {
|
10428
|
+
key: i
|
10429
|
+
}, (_actionHandler$item$t2 = actionHandler[item.type]) === null || _actionHandler$item$t2 === void 0 ? void 0 : _actionHandler$item$t2.call(actionHandler, item, record, index));
|
10430
|
+
}));
|
10431
|
+
return [].concat(_toConsumableArray(tableAction1.map(function (item, i) {
|
10432
|
+
var _actionHandler$item$t4;
|
10433
|
+
|
10434
|
+
var btn = actionConfig[item.type];
|
10435
|
+
|
10436
|
+
if (btn) {
|
10437
|
+
return /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
|
10438
|
+
title: btn.title,
|
10439
|
+
key: i
|
10440
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
10441
|
+
key: btn.key,
|
10442
|
+
onClick: function onClick() {
|
10443
|
+
var _actionHandler$item$t3;
|
10444
|
+
|
10445
|
+
return (_actionHandler$item$t3 = actionHandler[item.type]) === null || _actionHandler$item$t3 === void 0 ? void 0 : _actionHandler$item$t3.call(actionHandler, item, record, index);
|
10446
|
+
}
|
10447
|
+
}, btn.icon, " ", btn.title));
|
10448
|
+
}
|
10449
|
+
|
10450
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
10451
|
+
key: i
|
10452
|
+
}, (_actionHandler$item$t4 = actionHandler[item.type]) === null || _actionHandler$item$t4 === void 0 ? void 0 : _actionHandler$item$t4.call(actionHandler, item, record, index));
|
10453
|
+
})), [/*#__PURE__*/React__default['default'].createElement(_Dropdown__default['default'], {
|
10454
|
+
overlay: menu,
|
10455
|
+
key: 'more'
|
10456
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
10457
|
+
key: "more"
|
10458
|
+
}, /*#__PURE__*/React__default['default'].createElement(icons.EllipsisOutlined, null)))]);
|
10459
|
+
} else {
|
10460
|
+
return tableAction === null || tableAction === void 0 ? void 0 : tableAction.map(function (item, i) {
|
10461
|
+
var _actionHandler$item$t6;
|
10462
|
+
|
10463
|
+
var btn = actionConfig[item.type];
|
10464
|
+
|
10465
|
+
if (btn) {
|
10466
|
+
return /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
|
10467
|
+
title: btn.title,
|
10468
|
+
key: i
|
10469
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
10470
|
+
key: btn.key,
|
10471
|
+
onClick: function onClick() {
|
10472
|
+
var _actionHandler$item$t5;
|
10473
|
+
|
10474
|
+
return (_actionHandler$item$t5 = actionHandler[item.type]) === null || _actionHandler$item$t5 === void 0 ? void 0 : _actionHandler$item$t5.call(actionHandler, item, record, index);
|
10475
|
+
}
|
10476
|
+
}, btn.icon, " ", btn.title));
|
10477
|
+
}
|
10478
|
+
|
10479
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
10480
|
+
key: i
|
10481
|
+
}, (_actionHandler$item$t6 = actionHandler[item.type]) === null || _actionHandler$item$t6 === void 0 ? void 0 : _actionHandler$item$t6.call(actionHandler, item, record, index));
|
10482
|
+
});
|
10483
|
+
}
|
10459
10484
|
};
|
10460
10485
|
|
10461
10486
|
var tableBarDom = React.useMemo(function () {
|
@@ -10484,10 +10509,10 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10484
10509
|
|
10485
10510
|
_context5.next = 3;
|
10486
10511
|
return item.actionMethod(values, function () {
|
10487
|
-
var _actionRef$
|
10512
|
+
var _actionRef$current4;
|
10488
10513
|
|
10489
10514
|
loading();
|
10490
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10515
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : _actionRef$current4.reload();
|
10491
10516
|
});
|
10492
10517
|
|
10493
10518
|
case 3:
|
@@ -10512,9 +10537,9 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10512
10537
|
|
10513
10538
|
return (_item$actionRender2 = item.actionRender) === null || _item$actionRender2 === void 0 ? void 0 : _item$actionRender2.call(item, actionRef, function () {
|
10514
10539
|
item.actionMethod && item.actionMethod(actionRef, function () {
|
10515
|
-
var _actionRef$
|
10540
|
+
var _actionRef$current5;
|
10516
10541
|
|
10517
|
-
return actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10542
|
+
return actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.reload();
|
10518
10543
|
});
|
10519
10544
|
});
|
10520
10545
|
}
|
@@ -10522,22 +10547,22 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10522
10547
|
}, [actionRef]);
|
10523
10548
|
|
10524
10549
|
var onSubmit = function onSubmit(values) {
|
10525
|
-
var _actionRef$
|
10550
|
+
var _actionRef$current6;
|
10526
10551
|
|
10527
10552
|
setFormSearch(values);
|
10528
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10553
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload();
|
10529
10554
|
};
|
10530
10555
|
|
10531
10556
|
var onReset = function onReset() {
|
10532
|
-
var _actionRef$
|
10557
|
+
var _actionRef$current7;
|
10533
10558
|
|
10534
10559
|
setFormSearch({});
|
10535
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
10560
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload();
|
10536
10561
|
};
|
10537
10562
|
|
10538
10563
|
var formSearchColumn = columns || [];
|
10539
10564
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
|
10540
|
-
ref:
|
10565
|
+
ref: modalFormRef,
|
10541
10566
|
title: modalFormConfig.type || '新增',
|
10542
10567
|
visible: visible,
|
10543
10568
|
record: modalFormConfig.record,
|
@@ -10591,8 +10616,10 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10591
10616
|
return true;
|
10592
10617
|
})
|
10593
10618
|
})), /*#__PURE__*/React__default['default'].createElement(WForm$1, {
|
10594
|
-
ref:
|
10595
|
-
search:
|
10619
|
+
ref: searchFormRef,
|
10620
|
+
search: search == false ? {
|
10621
|
+
hideSubmit: true
|
10622
|
+
} : _objectSpread2(_objectSpread2({
|
10596
10623
|
labelWidth: 'auto',
|
10597
10624
|
searchText: '查询',
|
10598
10625
|
span: 6
|