fan-standard-comp 4.0.2 → 4.0.3
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/fan-standard-comp.min.js +1 -1
- package/es/ButtonGroup/index.js +6 -16
- package/es/ButtonGroup/styles/index.js +12 -12
- package/es/StandardModal/index.js +16 -15
- package/es/StandardTable/index.js +3 -3
- package/es/StandardTable/style/index.js +11 -13
- package/es/utils/filterPermission.d.ts +1 -1
- package/es/utils/filterPermission.js +4 -1
- package/lib/ButtonGroup/index.js +5 -15
- package/lib/ButtonGroup/styles/index.js +12 -12
- package/lib/StandardModal/index.js +16 -15
- package/lib/StandardTable/index.js +3 -3
- package/lib/StandardTable/style/index.js +11 -13
- package/lib/utils/filterPermission.d.ts +1 -1
- package/lib/utils/filterPermission.js +4 -1
- package/package.json +3 -4
package/es/ButtonGroup/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
20
20
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
-
import React, { useState, useEffect, useContext } from "react";
|
|
23
|
+
import React, { useState, useEffect, useContext, useMemo } from "react";
|
|
24
24
|
import { IconNode } from "../components";
|
|
25
25
|
import SpecIcon from "../SpecIcon";
|
|
26
26
|
import PopConfirmTitle from "./PopConfirmTitle";
|
|
@@ -29,8 +29,6 @@ import { DownOutlined, QuestionCircleOutlined } from "@ant-design/icons";
|
|
|
29
29
|
import { removeNoPermission, btnIsDisabled } from "../utils/filterPermission";
|
|
30
30
|
import useStyle from "./styles";
|
|
31
31
|
import classNames from "classnames";
|
|
32
|
-
import _ from "lodash";
|
|
33
|
-
import { funcCode } from "../data/index";
|
|
34
32
|
import { FanContext } from "../ConfigContext";
|
|
35
33
|
|
|
36
34
|
// 参数API
|
|
@@ -67,19 +65,11 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
67
65
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
66
|
popRow = _useState4[0],
|
|
69
67
|
setPopRow = _useState4[1];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// codes在方法内,再合并默认的权限配置
|
|
76
|
-
// 合并本地的codes
|
|
77
|
-
var codesConcat = _.unionBy(codes || [], funcCode.btnFuncCodes, 'code');
|
|
78
|
-
// 重组选项options集合数据,排除:无权限(有配置code,并且不包含permissionCodes内)的数据及,isHide 为true的数据
|
|
79
|
-
setResetList(_toConsumableArray(removeNoPermission(options, permissionCodes, codesConcat, rowParams)) || []);
|
|
80
|
-
return function () {
|
|
81
|
-
setResetList([]);
|
|
82
|
-
};
|
|
68
|
+
// const [resetList, setResetList] = useState<any[]>([])
|
|
69
|
+
var resetList = useMemo(function () {
|
|
70
|
+
// // codes在方法内,再合并默认的权限配置
|
|
71
|
+
// // 重组选项options集合数据,排除:无权限(有配置code,并且不包含permissionCodes内)的数据及,isHide 为true的数据
|
|
72
|
+
return _toConsumableArray(removeNoPermission(options, permissionCodes, codes, rowParams)) || [];
|
|
83
73
|
}, [options, codes, permissionCodes]);
|
|
84
74
|
useEffect(function () {
|
|
85
75
|
setPopVisibleIndex(-1);
|
|
@@ -23,18 +23,18 @@ var SpecButtonGroupTextStyle = function SpecButtonGroupTextStyle(prefixCls, toke
|
|
|
23
23
|
}
|
|
24
24
|
}, "& + ".concat(prefixCls, "-text"), {
|
|
25
25
|
position: 'relative',
|
|
26
|
-
marginLeft: token.paddingSM
|
|
27
|
-
'&:before': {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
26
|
+
marginLeft: token.paddingSM
|
|
27
|
+
// '&:before': {
|
|
28
|
+
// position: 'absolute',
|
|
29
|
+
// content: '""',
|
|
30
|
+
// top: '50%',
|
|
31
|
+
// left:` calc(-${token.paddingSM}px / 2)`,
|
|
32
|
+
// transform: 'translate(0, -50%)',
|
|
33
|
+
// display: 'inline-block',
|
|
34
|
+
// height: '.9em',
|
|
35
|
+
// verticalAlign: 'middle',
|
|
36
|
+
// borderLeft: `1px solid ${token.colorBorder}`
|
|
37
|
+
// }
|
|
38
38
|
}));
|
|
39
39
|
};
|
|
40
40
|
var SpecButtonGroupStyleFunc = function SpecButtonGroupStyleFunc(prefix) {
|
|
@@ -74,20 +74,17 @@ var StandardModal = function StandardModal(props) {
|
|
|
74
74
|
var _Form$useForm = Form.useForm(),
|
|
75
75
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
76
76
|
modalForm = _Form$useForm2[0];
|
|
77
|
-
|
|
77
|
+
// const [modalFormRef, setModalFormRef] = useState<any>(); // <---- set the ref when Form Rendered(使用此方法会出现溢出事件)
|
|
78
|
+
var _useState = useState(0),
|
|
78
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _useState3 = useState(0),
|
|
82
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
83
|
-
bodyMaxHeight = _useState4[0],
|
|
84
|
-
setBodyMaxHeight = _useState4[1];
|
|
80
|
+
bodyMaxHeight = _useState2[0],
|
|
81
|
+
setBodyMaxHeight = _useState2[1];
|
|
85
82
|
|
|
86
83
|
// setTabFormChild
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
formChild =
|
|
90
|
-
setFormChild =
|
|
84
|
+
var _useState3 = useState(),
|
|
85
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
86
|
+
formChild = _useState4[0],
|
|
87
|
+
setFormChild = _useState4[1]; // <---- set the ref when Form Rendered
|
|
91
88
|
|
|
92
89
|
// 按钮栏是否有显示(默认显示)
|
|
93
90
|
var hasFooterBar = useMemo(function () {
|
|
@@ -163,7 +160,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
163
160
|
};
|
|
164
161
|
// fill Form when modal open 此处可解决获取 Form.useForm warning
|
|
165
162
|
useEffect(function () {
|
|
166
|
-
if (visible &&
|
|
163
|
+
if (visible && modalForm) {
|
|
167
164
|
// <---- check ref before use the form instance
|
|
168
165
|
if (initialValues && _typeof(initialValues) === 'object') {
|
|
169
166
|
initialValues && modalForm.setFieldsValue(_objectSpread({}, initialValues));
|
|
@@ -173,7 +170,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
173
170
|
// if (!visible && modalFormRef) {
|
|
174
171
|
// clearAllFieldsValue() // 清空表单传参数
|
|
175
172
|
// }
|
|
176
|
-
}, [
|
|
173
|
+
}, [modalForm, visible]);
|
|
177
174
|
useEffect(function () {
|
|
178
175
|
if (visible) {
|
|
179
176
|
initBodyMaxHeight();
|
|
@@ -419,8 +416,12 @@ var StandardModal = function StandardModal(props) {
|
|
|
419
416
|
// 内容渲染
|
|
420
417
|
var renderChildrenNodes = function renderChildrenNodes() {
|
|
421
418
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children, (type === 'form' || type === 'gridForm') && /*#__PURE__*/React.createElement(Form, {
|
|
422
|
-
layout: formLayout
|
|
423
|
-
ref
|
|
419
|
+
layout: formLayout
|
|
420
|
+
// ref={(formInstance)=> {
|
|
421
|
+
// // console.log('formInstance', formInstance)
|
|
422
|
+
// // setModalFormRef(formInstance)
|
|
423
|
+
// }}
|
|
424
|
+
,
|
|
424
425
|
form: modalForm,
|
|
425
426
|
onFinish: handleSubmit,
|
|
426
427
|
hideRequiredMark: fieldStatus === 'viewOnly' || hideRequiredMark
|
|
@@ -55,7 +55,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
55
55
|
rest = _objectWithoutProperties(_providerConfig$props, _excluded);
|
|
56
56
|
// 加上类型修复 TS:2322 报警
|
|
57
57
|
var resetColumns = [_objectSpread(_objectSpread({
|
|
58
|
-
width:
|
|
58
|
+
width: 76,
|
|
59
59
|
align: 'center',
|
|
60
60
|
title: '序号',
|
|
61
61
|
key: 'orderNum',
|
|
@@ -83,7 +83,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
83
83
|
otherColumn = columnsConfig.otherColumn;
|
|
84
84
|
if (colItem.type === 'action') {
|
|
85
85
|
var _colItem, _colItem2, _colItem3;
|
|
86
|
-
colItem.width = ((_colItem = colItem) === null || _colItem === void 0 ? void 0 : _colItem.width) || (action === null || action === void 0 ? void 0 : action.width) || (colItem.buttonGroup.length > 1 ?
|
|
86
|
+
colItem.width = ((_colItem = colItem) === null || _colItem === void 0 ? void 0 : _colItem.width) || (action === null || action === void 0 ? void 0 : action.width) || (colItem.buttonGroup.length > 1 ? 130 : 80);
|
|
87
87
|
colItem.align = ((_colItem2 = colItem) === null || _colItem2 === void 0 ? void 0 : _colItem2.align) || (action === null || action === void 0 ? void 0 : action.align) || 'center';
|
|
88
88
|
colItem.title = ((_colItem3 = colItem) === null || _colItem3 === void 0 ? void 0 : _colItem3.title) || (action === null || action === void 0 ? void 0 : action.title) || '操作';
|
|
89
89
|
colItem.key = 'control';
|
|
@@ -167,7 +167,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
167
167
|
}, /*#__PURE__*/React.createElement(Table, _extends({
|
|
168
168
|
rowKey: rowKey || 'id',
|
|
169
169
|
rowSelection: rowSelection ? _objectSpread({
|
|
170
|
-
columnWidth:
|
|
170
|
+
columnWidth: 56
|
|
171
171
|
}, rowSelection) : rowSelection,
|
|
172
172
|
dataSource: list,
|
|
173
173
|
pagination: !pagination ? false : paginationProps,
|
|
@@ -6,7 +6,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { createStyleHook } from "../../theme/utils/genStyleHook";
|
|
8
8
|
import { scrollBar } from "../../theme/index";
|
|
9
|
-
import { TinyColor } from "@ctrl/tinycolor";
|
|
10
9
|
var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
11
10
|
var prepareComponentToken = function prepareComponentToken(token) {
|
|
12
11
|
return {
|
|
@@ -17,11 +16,10 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
17
16
|
var prefixCls = ".".concat(prefix);
|
|
18
17
|
var rowTd = {
|
|
19
18
|
'> td': {
|
|
20
|
-
borderColor: new TinyColor(token.colorPrimary).setAlpha(0.5).toRgbString(),
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
19
|
+
// borderColor: new TinyColor(token.colorPrimary).setAlpha(0.5).toRgbString(), // fade(@primary-color, 50%),
|
|
20
|
+
// '&::before': {
|
|
21
|
+
// borderTop: `1px solid ${new TinyColor(token.colorPrimary).setAlpha(0.5).toRgbString()}`,
|
|
22
|
+
// }
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
25
|
return [_defineProperty(_defineProperty(_defineProperty({}, prefixCls, {
|
|
@@ -40,22 +38,22 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
40
38
|
// 固定右侧列的样式
|
|
41
39
|
'.ant-table-fixed-left table.ant-table-fixed': {
|
|
42
40
|
'.ant-table-thead > tr > th, .ant-table-tbody > tr > td': {
|
|
43
|
-
paddingRight: token.paddingMD
|
|
41
|
+
paddingRight: token.paddingMD,
|
|
44
42
|
'&:first-child': {
|
|
45
43
|
paddingLeft: token.paddingMD,
|
|
46
|
-
paddingRight: token.paddingMD
|
|
44
|
+
paddingRight: token.paddingMD
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
48
|
// 固定右侧列的样式
|
|
51
49
|
'.ant-table-fixed-right': {
|
|
52
50
|
'.ant-table-thead > tr > th, .ant-table-tbody > tr > td': {
|
|
53
|
-
paddingRight: token.paddingMD
|
|
51
|
+
paddingRight: token.paddingMD,
|
|
54
52
|
'&:first-child': {
|
|
55
|
-
paddingLeft: token.paddingMD
|
|
53
|
+
paddingLeft: token.paddingMD
|
|
56
54
|
},
|
|
57
55
|
'&:nth-last-child(1)': {
|
|
58
|
-
paddingLeft: token.paddingMD
|
|
56
|
+
paddingLeft: token.paddingMD,
|
|
59
57
|
paddingRight: token.paddingMD
|
|
60
58
|
}
|
|
61
59
|
}
|
|
@@ -83,7 +81,7 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
83
81
|
fontSize: token.fontSizeLG
|
|
84
82
|
},
|
|
85
83
|
'.ant-table-thead > tr > th': {
|
|
86
|
-
padding: "12px ".concat(token.paddingMD
|
|
84
|
+
padding: "12px ".concat(token.paddingMD, "px"),
|
|
87
85
|
'&:first-child': {
|
|
88
86
|
paddingLeft: token.paddingMD
|
|
89
87
|
},
|
|
@@ -92,7 +90,7 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
92
90
|
}
|
|
93
91
|
},
|
|
94
92
|
'.ant-table-tbody > tr > td ': {
|
|
95
|
-
padding: "12px ".concat(token.paddingMD
|
|
93
|
+
padding: "12px ".concat(token.paddingMD, "px"),
|
|
96
94
|
'&:first-child': {
|
|
97
95
|
paddingLeft: token.paddingMD
|
|
98
96
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const btnClickFunc: (fn: any, params?: {}) => any;
|
|
2
2
|
declare const btnIsDisabled: (isDisabled: any, params?: {}) => any;
|
|
3
3
|
declare const btnIsHide: (isHide: any, params?: {}) => any;
|
|
4
|
-
declare const removeNoPermission: (array: any, permissionCodes: any,
|
|
4
|
+
declare const removeNoPermission: (array: any, permissionCodes: any, codesList: any, params: any) => any[];
|
|
5
5
|
export { removeNoPermission, btnIsHide, btnIsDisabled, btnClickFunc };
|
|
@@ -6,6 +6,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
6
6
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
7
|
// @ts-nocheck
|
|
8
8
|
import _ from "lodash";
|
|
9
|
+
import { funcCode } from "../data/index";
|
|
9
10
|
// 按钮方法
|
|
10
11
|
var btnClickFunc = function btnClickFunc(fn) {
|
|
11
12
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -52,7 +53,9 @@ var btnIsHide = function btnIsHide(isHide) {
|
|
|
52
53
|
return isHide;
|
|
53
54
|
};
|
|
54
55
|
// 重新组合数据(排除不包含在permissionCodes内及isHide数据
|
|
55
|
-
var removeNoPermission = function removeNoPermission(array, permissionCodes,
|
|
56
|
+
var removeNoPermission = function removeNoPermission(array, permissionCodes, codesList, params) {
|
|
57
|
+
// 合并本地的codes
|
|
58
|
+
var codes = _.unionBy(codesList || [], funcCode.btnFuncCodes, 'code');
|
|
56
59
|
return Array.isArray(array) && array.filter(function (item) {
|
|
57
60
|
if (item.children) {
|
|
58
61
|
item.children = removeNoPermission(item.children, permissionCodes, codes, params);
|
package/lib/ButtonGroup/index.js
CHANGED
|
@@ -13,8 +13,6 @@ var _icons = require("@ant-design/icons");
|
|
|
13
13
|
var _filterPermission = require("../utils/filterPermission");
|
|
14
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
17
|
-
var _index = require("../data/index");
|
|
18
16
|
var _ConfigContext = require("../ConfigContext");
|
|
19
17
|
var _excluded = ["code", "fn", "exName", "name", "children", "icon"],
|
|
20
18
|
_excluded2 = ["exName", "name", "type", "icon", "ghost", "danger", "disabled", "loading", "fn", "code", "rowParams", "isHide"],
|
|
@@ -75,19 +73,11 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
75
73
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
76
74
|
popRow = _useState4[0],
|
|
77
75
|
setPopRow = _useState4[1];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// codes在方法内,再合并默认的权限配置
|
|
84
|
-
// 合并本地的codes
|
|
85
|
-
var codesConcat = _lodash.default.unionBy(codes || [], _index.funcCode.btnFuncCodes, 'code');
|
|
86
|
-
// 重组选项options集合数据,排除:无权限(有配置code,并且不包含permissionCodes内)的数据及,isHide 为true的数据
|
|
87
|
-
setResetList(_toConsumableArray((0, _filterPermission.removeNoPermission)(options, permissionCodes, codesConcat, rowParams)) || []);
|
|
88
|
-
return function () {
|
|
89
|
-
setResetList([]);
|
|
90
|
-
};
|
|
76
|
+
// const [resetList, setResetList] = useState<any[]>([])
|
|
77
|
+
var resetList = (0, _react.useMemo)(function () {
|
|
78
|
+
// // codes在方法内,再合并默认的权限配置
|
|
79
|
+
// // 重组选项options集合数据,排除:无权限(有配置code,并且不包含permissionCodes内)的数据及,isHide 为true的数据
|
|
80
|
+
return _toConsumableArray((0, _filterPermission.removeNoPermission)(options, permissionCodes, codes, rowParams)) || [];
|
|
91
81
|
}, [options, codes, permissionCodes]);
|
|
92
82
|
(0, _react.useEffect)(function () {
|
|
93
83
|
setPopVisibleIndex(-1);
|
|
@@ -30,18 +30,18 @@ var SpecButtonGroupTextStyle = function SpecButtonGroupTextStyle(prefixCls, toke
|
|
|
30
30
|
}
|
|
31
31
|
}, "& + ".concat(prefixCls, "-text"), {
|
|
32
32
|
position: 'relative',
|
|
33
|
-
marginLeft: token.paddingSM
|
|
34
|
-
'&:before': {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
33
|
+
marginLeft: token.paddingSM
|
|
34
|
+
// '&:before': {
|
|
35
|
+
// position: 'absolute',
|
|
36
|
+
// content: '""',
|
|
37
|
+
// top: '50%',
|
|
38
|
+
// left:` calc(-${token.paddingSM}px / 2)`,
|
|
39
|
+
// transform: 'translate(0, -50%)',
|
|
40
|
+
// display: 'inline-block',
|
|
41
|
+
// height: '.9em',
|
|
42
|
+
// verticalAlign: 'middle',
|
|
43
|
+
// borderLeft: `1px solid ${token.colorBorder}`
|
|
44
|
+
// }
|
|
45
45
|
}));
|
|
46
46
|
};
|
|
47
47
|
var SpecButtonGroupStyleFunc = function SpecButtonGroupStyleFunc(prefix) {
|
|
@@ -82,20 +82,17 @@ var StandardModal = function StandardModal(props) {
|
|
|
82
82
|
var _Form$useForm = _antd.Form.useForm(),
|
|
83
83
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
84
84
|
modalForm = _Form$useForm2[0];
|
|
85
|
-
|
|
85
|
+
// const [modalFormRef, setModalFormRef] = useState<any>(); // <---- set the ref when Form Rendered(使用此方法会出现溢出事件)
|
|
86
|
+
var _useState = (0, _react.useState)(0),
|
|
86
87
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var _useState3 = (0, _react.useState)(0),
|
|
90
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
91
|
-
bodyMaxHeight = _useState4[0],
|
|
92
|
-
setBodyMaxHeight = _useState4[1];
|
|
88
|
+
bodyMaxHeight = _useState2[0],
|
|
89
|
+
setBodyMaxHeight = _useState2[1];
|
|
93
90
|
|
|
94
91
|
// setTabFormChild
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
formChild =
|
|
98
|
-
setFormChild =
|
|
92
|
+
var _useState3 = (0, _react.useState)(),
|
|
93
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
|
+
formChild = _useState4[0],
|
|
95
|
+
setFormChild = _useState4[1]; // <---- set the ref when Form Rendered
|
|
99
96
|
|
|
100
97
|
// 按钮栏是否有显示(默认显示)
|
|
101
98
|
var hasFooterBar = (0, _react.useMemo)(function () {
|
|
@@ -171,7 +168,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
171
168
|
};
|
|
172
169
|
// fill Form when modal open 此处可解决获取 Form.useForm warning
|
|
173
170
|
(0, _react.useEffect)(function () {
|
|
174
|
-
if (visible &&
|
|
171
|
+
if (visible && modalForm) {
|
|
175
172
|
// <---- check ref before use the form instance
|
|
176
173
|
if (initialValues && _typeof(initialValues) === 'object') {
|
|
177
174
|
initialValues && modalForm.setFieldsValue(_objectSpread({}, initialValues));
|
|
@@ -181,7 +178,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
181
178
|
// if (!visible && modalFormRef) {
|
|
182
179
|
// clearAllFieldsValue() // 清空表单传参数
|
|
183
180
|
// }
|
|
184
|
-
}, [
|
|
181
|
+
}, [modalForm, visible]);
|
|
185
182
|
(0, _react.useEffect)(function () {
|
|
186
183
|
if (visible) {
|
|
187
184
|
initBodyMaxHeight();
|
|
@@ -427,8 +424,12 @@ var StandardModal = function StandardModal(props) {
|
|
|
427
424
|
// 内容渲染
|
|
428
425
|
var renderChildrenNodes = function renderChildrenNodes() {
|
|
429
426
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, (type === 'form' || type === 'gridForm') && /*#__PURE__*/_react.default.createElement(_antd.Form, {
|
|
430
|
-
layout: formLayout
|
|
431
|
-
ref
|
|
427
|
+
layout: formLayout
|
|
428
|
+
// ref={(formInstance)=> {
|
|
429
|
+
// // console.log('formInstance', formInstance)
|
|
430
|
+
// // setModalFormRef(formInstance)
|
|
431
|
+
// }}
|
|
432
|
+
,
|
|
432
433
|
form: modalForm,
|
|
433
434
|
onFinish: handleSubmit,
|
|
434
435
|
hideRequiredMark: fieldStatus === 'viewOnly' || hideRequiredMark
|
|
@@ -64,7 +64,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
64
64
|
rest = _objectWithoutProperties(_providerConfig$props, _excluded);
|
|
65
65
|
// 加上类型修复 TS:2322 报警
|
|
66
66
|
var resetColumns = [_objectSpread(_objectSpread({
|
|
67
|
-
width:
|
|
67
|
+
width: 76,
|
|
68
68
|
align: 'center',
|
|
69
69
|
title: '序号',
|
|
70
70
|
key: 'orderNum',
|
|
@@ -92,7 +92,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
92
92
|
otherColumn = columnsConfig.otherColumn;
|
|
93
93
|
if (colItem.type === 'action') {
|
|
94
94
|
var _colItem, _colItem2, _colItem3;
|
|
95
|
-
colItem.width = ((_colItem = colItem) === null || _colItem === void 0 ? void 0 : _colItem.width) || (action === null || action === void 0 ? void 0 : action.width) || (colItem.buttonGroup.length > 1 ?
|
|
95
|
+
colItem.width = ((_colItem = colItem) === null || _colItem === void 0 ? void 0 : _colItem.width) || (action === null || action === void 0 ? void 0 : action.width) || (colItem.buttonGroup.length > 1 ? 130 : 80);
|
|
96
96
|
colItem.align = ((_colItem2 = colItem) === null || _colItem2 === void 0 ? void 0 : _colItem2.align) || (action === null || action === void 0 ? void 0 : action.align) || 'center';
|
|
97
97
|
colItem.title = ((_colItem3 = colItem) === null || _colItem3 === void 0 ? void 0 : _colItem3.title) || (action === null || action === void 0 ? void 0 : action.title) || '操作';
|
|
98
98
|
colItem.key = 'control';
|
|
@@ -176,7 +176,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
176
176
|
}, /*#__PURE__*/_react.default.createElement(_antd.Table, _extends({
|
|
177
177
|
rowKey: rowKey || 'id',
|
|
178
178
|
rowSelection: rowSelection ? _objectSpread({
|
|
179
|
-
columnWidth:
|
|
179
|
+
columnWidth: 56
|
|
180
180
|
}, rowSelection) : rowSelection,
|
|
181
181
|
dataSource: list,
|
|
182
182
|
pagination: !pagination ? false : paginationProps,
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _genStyleHook = require("../../theme/utils/genStyleHook");
|
|
8
8
|
var _index = require("../../theme/index");
|
|
9
|
-
var _tinycolor = require("@ctrl/tinycolor");
|
|
10
9
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -23,11 +22,10 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
23
22
|
var prefixCls = ".".concat(prefix);
|
|
24
23
|
var rowTd = {
|
|
25
24
|
'> td': {
|
|
26
|
-
borderColor: new
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
25
|
+
// borderColor: new TinyColor(token.colorPrimary).setAlpha(0.5).toRgbString(), // fade(@primary-color, 50%),
|
|
26
|
+
// '&::before': {
|
|
27
|
+
// borderTop: `1px solid ${new TinyColor(token.colorPrimary).setAlpha(0.5).toRgbString()}`,
|
|
28
|
+
// }
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
31
|
return [_defineProperty(_defineProperty(_defineProperty({}, prefixCls, {
|
|
@@ -46,22 +44,22 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
46
44
|
// 固定右侧列的样式
|
|
47
45
|
'.ant-table-fixed-left table.ant-table-fixed': {
|
|
48
46
|
'.ant-table-thead > tr > th, .ant-table-tbody > tr > td': {
|
|
49
|
-
paddingRight: token.paddingMD
|
|
47
|
+
paddingRight: token.paddingMD,
|
|
50
48
|
'&:first-child': {
|
|
51
49
|
paddingLeft: token.paddingMD,
|
|
52
|
-
paddingRight: token.paddingMD
|
|
50
|
+
paddingRight: token.paddingMD
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
},
|
|
56
54
|
// 固定右侧列的样式
|
|
57
55
|
'.ant-table-fixed-right': {
|
|
58
56
|
'.ant-table-thead > tr > th, .ant-table-tbody > tr > td': {
|
|
59
|
-
paddingRight: token.paddingMD
|
|
57
|
+
paddingRight: token.paddingMD,
|
|
60
58
|
'&:first-child': {
|
|
61
|
-
paddingLeft: token.paddingMD
|
|
59
|
+
paddingLeft: token.paddingMD
|
|
62
60
|
},
|
|
63
61
|
'&:nth-last-child(1)': {
|
|
64
|
-
paddingLeft: token.paddingMD
|
|
62
|
+
paddingLeft: token.paddingMD,
|
|
65
63
|
paddingRight: token.paddingMD
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -89,7 +87,7 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
89
87
|
fontSize: token.fontSizeLG
|
|
90
88
|
},
|
|
91
89
|
'.ant-table-thead > tr > th': {
|
|
92
|
-
padding: "12px ".concat(token.paddingMD
|
|
90
|
+
padding: "12px ".concat(token.paddingMD, "px"),
|
|
93
91
|
'&:first-child': {
|
|
94
92
|
paddingLeft: token.paddingMD
|
|
95
93
|
},
|
|
@@ -98,7 +96,7 @@ var StandardTableStyleFunc = function StandardTableStyleFunc(prefix) {
|
|
|
98
96
|
}
|
|
99
97
|
},
|
|
100
98
|
'.ant-table-tbody > tr > td ': {
|
|
101
|
-
padding: "12px ".concat(token.paddingMD
|
|
99
|
+
padding: "12px ".concat(token.paddingMD, "px"),
|
|
102
100
|
'&:first-child': {
|
|
103
101
|
paddingLeft: token.paddingMD
|
|
104
102
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const btnClickFunc: (fn: any, params?: {}) => any;
|
|
2
2
|
declare const btnIsDisabled: (isDisabled: any, params?: {}) => any;
|
|
3
3
|
declare const btnIsHide: (isHide: any, params?: {}) => any;
|
|
4
|
-
declare const removeNoPermission: (array: any, permissionCodes: any,
|
|
4
|
+
declare const removeNoPermission: (array: any, permissionCodes: any, codesList: any, params: any) => any[];
|
|
5
5
|
export { removeNoPermission, btnIsHide, btnIsDisabled, btnClickFunc };
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.removeNoPermission = exports.btnIsHide = exports.btnIsDisabled = exports.btnClickFunc = void 0;
|
|
7
7
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
+
var _index = require("../data/index");
|
|
8
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -58,7 +59,9 @@ var btnIsHide = exports.btnIsHide = function btnIsHide(isHide) {
|
|
|
58
59
|
return isHide;
|
|
59
60
|
};
|
|
60
61
|
// 重新组合数据(排除不包含在permissionCodes内及isHide数据
|
|
61
|
-
var removeNoPermission = exports.removeNoPermission = function removeNoPermission(array, permissionCodes,
|
|
62
|
+
var removeNoPermission = exports.removeNoPermission = function removeNoPermission(array, permissionCodes, codesList, params) {
|
|
63
|
+
// 合并本地的codes
|
|
64
|
+
var codes = _lodash.default.unionBy(codesList || [], _index.funcCode.btnFuncCodes, 'code');
|
|
62
65
|
return Array.isArray(array) && array.filter(function (item) {
|
|
63
66
|
if (item.children) {
|
|
64
67
|
item.children = removeNoPermission(item.children, permissionCodes, codes, params);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fan-standard-comp",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "FZ standard-comp,basic of antd5.0 and custom component.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -77,14 +77,13 @@
|
|
|
77
77
|
"prettier": "^2.7.1",
|
|
78
78
|
"prettier-plugin-organize-imports": "^3.0.0",
|
|
79
79
|
"prettier-plugin-packagejson": "^2.2.18",
|
|
80
|
-
"react": "
|
|
81
|
-
"react-dom": "
|
|
80
|
+
"react": "18.2.0",
|
|
81
|
+
"react-dom": "18.2.0",
|
|
82
82
|
"stylelint": "^14.9.1"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@babel/preset-react": "^7.24.1",
|
|
86
86
|
"@types/lodash": "^4.17.0",
|
|
87
|
-
"ant-design-draggable-modal": "^1.0.0",
|
|
88
87
|
"antd": "5.18.1",
|
|
89
88
|
"antd-style": "^3.6.1",
|
|
90
89
|
"babel": "^6.23.0",
|