@teamix/pro 1.4.16 → 1.4.17
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/pro.css +1 -1
- package/dist/pro.js +192 -94
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +1 -2
- package/es/actions/base.js +1 -11
- package/es/actions/dialog.d.ts +0 -2
- package/es/actions/dialog.js +1 -26
- package/es/actions/drawer.js +0 -7
- package/es/card/index.js +49 -6
- package/es/card/index.scss +8 -0
- package/es/form/ProForm/index.js +0 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/baseInfo/index.js +9 -3
- package/es/info/components/headerInfo/index.js +11 -3
- package/es/info/components/tableInfo/index.js +6 -3
- package/es/info/typing.d.ts +2 -0
- package/es/info/utils/index.d.ts +8 -0
- package/es/info/utils/index.js +28 -1
- package/es/sidebar/components/tree-node/index.js +15 -6
- package/es/sidebar/components/tree-node/index.scss +9 -5
- package/es/sidebar/index.js +2 -2
- package/es/sidebar/index.scss +13 -1
- package/es/sidebar/typing.d.ts +4 -2
- package/es/sidebar/utils/index.d.ts +278 -0
- package/es/sidebar/utils/index.js +55 -14
- package/es/table/index.js +6 -3
- package/es/table/index.scss +8 -0
- package/lib/actions/base.d.ts +1 -2
- package/lib/actions/base.js +1 -11
- package/lib/actions/dialog.d.ts +0 -2
- package/lib/actions/dialog.js +1 -27
- package/lib/actions/drawer.js +0 -8
- package/lib/card/index.js +58 -6
- package/lib/card/index.scss +8 -0
- package/lib/form/ProForm/index.js +0 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/baseInfo/index.js +8 -2
- package/lib/info/components/headerInfo/index.js +10 -2
- package/lib/info/components/tableInfo/index.js +5 -2
- package/lib/info/typing.d.ts +2 -0
- package/lib/info/utils/index.d.ts +8 -0
- package/lib/info/utils/index.js +29 -0
- package/lib/sidebar/components/tree-node/index.js +16 -6
- package/lib/sidebar/components/tree-node/index.scss +9 -5
- package/lib/sidebar/index.js +2 -2
- package/lib/sidebar/index.scss +13 -1
- package/lib/sidebar/typing.d.ts +4 -2
- package/lib/sidebar/utils/index.d.ts +278 -0
- package/lib/sidebar/utils/index.js +56 -14
- package/lib/table/index.js +6 -3
- package/lib/table/index.scss +8 -0
- package/package.json +1 -1
package/es/actions/base.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { MaybePromise } from '@teamix/utils';
|
3
|
-
import { DialogAction } from './dialog';
|
4
3
|
export interface BaseAction {
|
5
4
|
/** 事件触发方式,默认是 onClick */
|
6
5
|
trigger?: string;
|
@@ -19,7 +18,7 @@ export interface BaseAction {
|
|
19
18
|
/** 事件开始执行完毕的回调函数 */
|
20
19
|
onFinish?: (params?: any) => any;
|
21
20
|
}
|
22
|
-
export declare function eventHandler(action: BaseAction
|
21
|
+
export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any, e: React.MouseEvent<HTMLElement>) => void): {
|
23
22
|
[x: string]: (e: React.MouseEvent<HTMLElement>) => Promise<void>;
|
24
23
|
};
|
25
24
|
export default eventHandler;
|
package/es/actions/base.js
CHANGED
@@ -11,9 +11,7 @@ export function eventHandler(action, actionContext, onTrigger) {
|
|
11
11
|
preventDefault = action.preventDefault,
|
12
12
|
stopPropagation = action.stopPropagation,
|
13
13
|
beforeAction = action.beforeAction;
|
14
|
-
|
15
|
-
|
16
|
-
var baseProps = _defineProperty({}, "".concat(trigger), function () {
|
14
|
+
return _defineProperty({}, "".concat(trigger), function () {
|
17
15
|
var _2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
|
18
16
|
var _action$onTrigger;
|
19
17
|
|
@@ -75,13 +73,5 @@ export function eventHandler(action, actionContext, onTrigger) {
|
|
75
73
|
|
76
74
|
return _;
|
77
75
|
}());
|
78
|
-
|
79
|
-
if (openIdentifier) {
|
80
|
-
baseProps = Object.assign({}, baseProps, {
|
81
|
-
id: openIdentifier
|
82
|
-
});
|
83
|
-
}
|
84
|
-
|
85
|
-
return baseProps;
|
86
76
|
}
|
87
77
|
export default eventHandler;
|
package/es/actions/dialog.d.ts
CHANGED
@@ -29,8 +29,6 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
29
29
|
onOk?: any;
|
30
30
|
/** 点击取消自定义回调函数 */
|
31
31
|
onCancel?: any;
|
32
|
-
/** 打开工作区 id */
|
33
|
-
openIdentifier?: string | number;
|
34
32
|
}
|
35
33
|
export declare function useDialogAction(action: DialogAction, actionContext?: any, hasForm?: boolean): {
|
36
34
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
package/es/actions/dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError", "onOk", "onCancel"],
|
2
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"
|
2
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
3
3
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
5
|
|
@@ -38,7 +38,6 @@ import { renderProMessage } from '../utils/message';
|
|
38
38
|
import { eventHandler } from './base';
|
39
39
|
import { doRequest } from './request';
|
40
40
|
import { addContext } from './utils';
|
41
|
-
import { useUrlState } from '@teamix/hooks';
|
42
41
|
|
43
42
|
function addContextForReactNode(content, context) {
|
44
43
|
if (typeof content === 'function' && context) {
|
@@ -82,11 +81,6 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
82
81
|
var footerDescriptionRef = useRef();
|
83
82
|
var history = useHistory();
|
84
83
|
|
85
|
-
var _useUrlState = useUrlState(),
|
86
|
-
_useUrlState2 = _slicedToArray(_useUrlState, 2),
|
87
|
-
urlState = _useUrlState2[0],
|
88
|
-
setUrlState = _useUrlState2[1];
|
89
|
-
|
90
84
|
var onActionStart = function onActionStart(context, e) {
|
91
85
|
var _objectSpread2;
|
92
86
|
|
@@ -127,18 +121,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
127
121
|
footerDescription = _getTargetValue.footerDescription,
|
128
122
|
footerAlign = _getTargetValue.footerAlign,
|
129
123
|
className = _getTargetValue.className,
|
130
|
-
openIdentifier = _getTargetValue.openIdentifier,
|
131
124
|
containerOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
132
|
-
/**
|
133
|
-
* 判断是否含有 openIdentifierIdentifiy参数 ,更改对应 url
|
134
|
-
*/
|
135
|
-
|
136
|
-
|
137
|
-
if (openIdentifier) {
|
138
|
-
setUrlState({
|
139
|
-
openIdentifier: openIdentifier
|
140
|
-
});
|
141
|
-
}
|
142
125
|
|
143
126
|
var isDrawer = dialogType === 'drawer';
|
144
127
|
var isPop = dialogType === 'pop';
|
@@ -247,15 +230,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
247
230
|
var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({}, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
248
231
|
|
249
232
|
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "onCancel", function onCancel() {
|
250
|
-
setUrlState({
|
251
|
-
openIdentifier: undefined
|
252
|
-
});
|
253
233
|
propsOnCancel && propsOnCancel(context);
|
254
|
-
}), _defineProperty(_objectSpread2, "onClose", function onClose() {
|
255
|
-
setUrlState({
|
256
|
-
openIdentifier: undefined
|
257
|
-
});
|
258
|
-
hide === null || hide === void 0 ? void 0 : hide();
|
259
234
|
}), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
|
260
235
|
className: "teamix-pro-dialog-before-content"
|
261
236
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
|
package/es/actions/drawer.js
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
import { useEffect } from 'react';
|
2
1
|
import useDialogAction from './dialog';
|
3
2
|
export function useDrawerAction(action, context) {
|
4
|
-
useEffect(function () {
|
5
|
-
var _action$openIdentifie, _action$openIdentifie2;
|
6
|
-
|
7
|
-
var dom = document.getElementById((_action$openIdentifie = (_action$openIdentifie2 = action.openIdentifier) === null || _action$openIdentifie2 === void 0 ? void 0 : _action$openIdentifie2.toString()) !== null && _action$openIdentifie !== void 0 ? _action$openIdentifie : '');
|
8
|
-
dom === null || dom === void 0 ? void 0 : dom.click();
|
9
|
-
}, []);
|
10
3
|
return useDialogAction(Object.assign({
|
11
4
|
dialogType: 'drawer'
|
12
5
|
}, action), context);
|
package/es/card/index.js
CHANGED
@@ -38,7 +38,8 @@ import ProCardDivider from './divider';
|
|
38
38
|
import ProCardSelectable from './selectable';
|
39
39
|
import ProCardTab from './tab';
|
40
40
|
import './index.scss';
|
41
|
-
import ProField from '@teamix/pro-field';
|
41
|
+
import ProField, { Ellipsis } from '@teamix/pro-field';
|
42
|
+
import ReactDOM from 'react-dom';
|
42
43
|
export * from './card-container';
|
43
44
|
var cls = usePrefixCls('teamix-pro-card');
|
44
45
|
|
@@ -115,9 +116,19 @@ export var ProCard = function ProCard(props) {
|
|
115
116
|
innerCollapseState = _React$useState2[0],
|
116
117
|
setInnerCollapseState = _React$useState2[1];
|
117
118
|
|
119
|
+
var cardRef = React.useRef(); // 表头 tooltip tags description 宽度
|
120
|
+
|
121
|
+
var _React$useState3 = React.useState(0),
|
122
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
123
|
+
headerWithoutTitleWidth = _React$useState4[0],
|
124
|
+
setHeaderWithoutTitleWidth = _React$useState4[1];
|
125
|
+
|
118
126
|
var _formatSpacing = formatSpacing(spacing),
|
119
127
|
horizonal = _formatSpacing.horizonal,
|
120
|
-
vertical = _formatSpacing.vertical;
|
128
|
+
vertical = _formatSpacing.vertical; // useEffect(() => {
|
129
|
+
// calculateHeaderWidth();
|
130
|
+
// }, []);
|
131
|
+
|
121
132
|
|
122
133
|
var hasDivider = (divider || !!split) && (title || extra);
|
123
134
|
var hasCollapse = collapsible === true || defaultCollapsed !== undefined || collapsed !== undefined;
|
@@ -193,7 +204,28 @@ export var ProCard = function ProCard(props) {
|
|
193
204
|
marginBottom: -vertical
|
194
205
|
} : {};
|
195
206
|
|
196
|
-
var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle);
|
207
|
+
var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle); // 计算宽度
|
208
|
+
|
209
|
+
|
210
|
+
var calculateHeaderWidth = function calculateHeaderWidth() {
|
211
|
+
if (cardRef === null || cardRef === void 0 ? void 0 : cardRef.current) {
|
212
|
+
var _tooltipDom$clientWid, _tagsDom$clientWidth, _descriptionDom$clien;
|
213
|
+
|
214
|
+
var cardDom = ReactDOM.findDOMNode(cardRef.current);
|
215
|
+
var headerDom = cardDom === null || cardDom === void 0 ? void 0 : cardDom.querySelector('.teamix-pro-card-title');
|
216
|
+
var tooltipDom = headerDom === null || headerDom === void 0 ? void 0 : headerDom.querySelector('.teamix-pro-card-title-tooltip');
|
217
|
+
var tagsDom = headerDom === null || headerDom === void 0 ? void 0 : headerDom.querySelector('.teamix-pro-tags');
|
218
|
+
var descriptionDom = headerDom === null || headerDom === void 0 ? void 0 : headerDom.querySelector('.teamix-pro-card-title-description');
|
219
|
+
var widthList = [(_tooltipDom$clientWid = tooltipDom === null || tooltipDom === void 0 ? void 0 : tooltipDom.clientWidth) !== null && _tooltipDom$clientWid !== void 0 ? _tooltipDom$clientWid : 0, (_tagsDom$clientWidth = tagsDom === null || tagsDom === void 0 ? void 0 : tagsDom.clientWidth) !== null && _tagsDom$clientWidth !== void 0 ? _tagsDom$clientWidth : 0, (_descriptionDom$clien = descriptionDom === null || descriptionDom === void 0 ? void 0 : descriptionDom.clientWidth) !== null && _descriptionDom$clien !== void 0 ? _descriptionDom$clien : 0].filter(function (item) {
|
220
|
+
return item;
|
221
|
+
});
|
222
|
+
var width = widthList.reduce(function (acc, cur) {
|
223
|
+
return acc + cur;
|
224
|
+
}, 0) + widthList.length * 8; // 无法取出精准宽度,减去1作为阈值
|
225
|
+
|
226
|
+
setHeaderWithoutTitleWidth(width - 1);
|
227
|
+
}
|
228
|
+
};
|
197
229
|
|
198
230
|
var renderTitle = function renderTitle() {
|
199
231
|
var icon = tooltipIcon || 'info-circle-line';
|
@@ -213,9 +245,20 @@ export var ProCard = function ProCard(props) {
|
|
213
245
|
type: "down-fill"
|
214
246
|
}), /*#__PURE__*/React.createElement("div", {
|
215
247
|
className: cls('title-name')
|
216
|
-
},
|
217
|
-
|
218
|
-
|
248
|
+
}, /*#__PURE__*/React.createElement(ProField, {
|
249
|
+
value: title,
|
250
|
+
type: "text",
|
251
|
+
render: {
|
252
|
+
ellipsis: true
|
253
|
+
}
|
254
|
+
}))), !hasCollapse && /*#__PURE__*/React.createElement("div", {
|
255
|
+
className: cls('title-name'),
|
256
|
+
style: {
|
257
|
+
maxWidth: "calc(100% - ".concat(headerWithoutTitleWidth, "px)")
|
258
|
+
}
|
259
|
+
}, /*#__PURE__*/React.createElement(Ellipsis, {
|
260
|
+
tooltip: title
|
261
|
+
}, title)), tooltip && /*#__PURE__*/React.createElement("div", {
|
219
262
|
className: cls('title-tooltip')
|
220
263
|
}, /*#__PURE__*/React.createElement(Balloon.Tooltip, {
|
221
264
|
align: "t",
|
package/es/card/index.scss
CHANGED
@@ -40,6 +40,13 @@
|
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
43
|
+
.next-card-header-titles {
|
44
|
+
padding-right: 8px;
|
45
|
+
}
|
46
|
+
.next-card-header-extra {
|
47
|
+
margin-top: 2px;
|
48
|
+
}
|
49
|
+
|
43
50
|
&-title {
|
44
51
|
display: flex;
|
45
52
|
align-items: center;
|
@@ -80,6 +87,7 @@
|
|
80
87
|
|
81
88
|
&-description {
|
82
89
|
font-size: 12px;
|
90
|
+
min-width: 40px;
|
83
91
|
}
|
84
92
|
}
|
85
93
|
|
package/es/form/ProForm/index.js
CHANGED
@@ -94,11 +94,9 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
94
94
|
var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), ProFieldComponents);
|
95
95
|
|
96
96
|
var onAutoSubmit = useAutoSubmit(onSubmit, context);
|
97
|
-
console.log(otherProps);
|
98
97
|
var autoTeamixLayout = useAutoLayout(_objectSpread(_objectSpread({}, otherProps), {}, {
|
99
98
|
schema: schema
|
100
99
|
}), formRef);
|
101
|
-
console.log(autoTeamixLayout);
|
102
100
|
useMemo(function () {
|
103
101
|
// 配置表单默认值
|
104
102
|
if (initialValues) {
|
package/es/index.d.ts
CHANGED
@@ -28,5 +28,5 @@ export * from './table';
|
|
28
28
|
export * from './sidebar';
|
29
29
|
export * from './utils';
|
30
30
|
export * from './timeline';
|
31
|
-
declare const version = "1.4.
|
31
|
+
declare const version = "1.4.17";
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -36,6 +36,6 @@ export * from './table';
|
|
36
36
|
export * from './sidebar';
|
37
37
|
export * from './utils';
|
38
38
|
export * from './timeline';
|
39
|
-
var version = '1.4.
|
39
|
+
var version = '1.4.17';
|
40
40
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
41
41
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
@@ -5,7 +5,7 @@ import './index.scss';
|
|
5
5
|
import { getLayout } from '../../utils/utils';
|
6
6
|
import defaultLayoutMap from '../../utils/layout';
|
7
7
|
import InfoValueItem from '../InfoValueItem';
|
8
|
-
import { getDataIndexValue } from '../../utils';
|
8
|
+
import { getDataIndexValue, isHidden } from '../../utils';
|
9
9
|
var Row = Grid.Row,
|
10
10
|
Col = Grid.Col;
|
11
11
|
|
@@ -55,7 +55,13 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
55
55
|
|
56
56
|
var renderContent = function renderContent() {
|
57
57
|
return columns.map(function (item, index) {
|
58
|
-
var _layout$span, _layout$span2, _item$title, _item$valueType,
|
58
|
+
var _ref, _ref2, _layout$span, _layout$span2, _item$title, _item$valueType, _ref3, _item$colSpan;
|
59
|
+
|
60
|
+
var hidden = isHidden(item === null || item === void 0 ? void 0 : item.hidden, getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}), (_ref2 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref2 !== void 0 ? _ref2 : {}, context);
|
61
|
+
|
62
|
+
if (hidden) {
|
63
|
+
return;
|
64
|
+
}
|
59
65
|
|
60
66
|
var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
|
61
67
|
var layoutSpan = item.colSpan ? ((_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span) * item.colSpan : (_layout$span2 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span2 !== void 0 ? _layout$span2 : span;
|
@@ -67,7 +73,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
67
73
|
loading: loading,
|
68
74
|
value: /*#__PURE__*/React.createElement(InfoValueItem, {
|
69
75
|
type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
|
70
|
-
value: getDataIndexValue(item.dataIndex, (
|
76
|
+
value: getDataIndexValue(item.dataIndex, (_ref3 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref3 !== void 0 ? _ref3 : {}),
|
71
77
|
render: item.render,
|
72
78
|
dataSource: item.dataSource,
|
73
79
|
infoItem: item,
|
@@ -5,7 +5,7 @@ import './index.scss';
|
|
5
5
|
import defaultLayoutMap from '../../utils/layout';
|
6
6
|
import { getLayout } from '../../utils/utils';
|
7
7
|
import InfoValueItem from '../InfoValueItem';
|
8
|
-
import { getDataIndexValue } from '../../utils';
|
8
|
+
import { getDataIndexValue, isHidden } from '../../utils';
|
9
9
|
var Row = Grid.Row,
|
10
10
|
Col = Grid.Col;
|
11
11
|
|
@@ -18,12 +18,19 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
|
|
18
18
|
loading = props.loading,
|
19
19
|
result = props.result,
|
20
20
|
actionRef = props.actionRef,
|
21
|
-
size = props.size
|
21
|
+
size = props.size,
|
22
|
+
context = props.context;
|
22
23
|
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
23
24
|
|
24
25
|
var renderContent = function renderContent() {
|
25
26
|
return columns.map(function (item, index) {
|
26
|
-
var _item$title, _item$valueType;
|
27
|
+
var _ref, _ref2, _item$title, _item$valueType;
|
28
|
+
|
29
|
+
var hidden = isHidden(item === null || item === void 0 ? void 0 : item.hidden, getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}), (_ref2 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref2 !== void 0 ? _ref2 : {}, context);
|
30
|
+
|
31
|
+
if (hidden) {
|
32
|
+
return;
|
33
|
+
}
|
27
34
|
|
28
35
|
var span = 24;
|
29
36
|
|
@@ -51,6 +58,7 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
|
|
51
58
|
infoItem: item,
|
52
59
|
record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
|
53
60
|
actionRef: actionRef,
|
61
|
+
context: context,
|
54
62
|
props: item.props
|
55
63
|
}),
|
56
64
|
headerInfoLayout: layout !== null && layout !== void 0 ? layout : defaultLayout,
|
@@ -23,7 +23,7 @@ import './index.scss';
|
|
23
23
|
import { LabelIconTip } from '../../../field';
|
24
24
|
import InfoValueItem from '../InfoValueItem';
|
25
25
|
import { ProSkeletonRaw } from '../../..';
|
26
|
-
import { getDataIndexValue } from '../../utils';
|
26
|
+
import { getDataIndexValue, isHidden } from '../../utils';
|
27
27
|
import cloneDeep from 'lodash.clonedeep';
|
28
28
|
|
29
29
|
var ProTableInfo = function ProTableInfo(props) {
|
@@ -33,7 +33,8 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
33
33
|
layout = _props$layout === void 0 ? {} : _props$layout,
|
34
34
|
loading = props.loading,
|
35
35
|
result = props.result,
|
36
|
-
actionRef = props.actionRef
|
36
|
+
actionRef = props.actionRef,
|
37
|
+
context = props.context;
|
37
38
|
var _layout$colNum = layout.colNum,
|
38
39
|
colNum = _layout$colNum === void 0 ? 2 : _layout$colNum,
|
39
40
|
_layout$labelGutter = layout.labelGutter,
|
@@ -73,7 +74,9 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
73
74
|
|
74
75
|
var newDataSource = useMemo(function () {
|
75
76
|
var nResult = [];
|
76
|
-
var columnsCopy = cloneDeep(columns)
|
77
|
+
var columnsCopy = cloneDeep(columns).filter(function (item) {
|
78
|
+
return !isHidden(item.hidden, getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result), dataSource !== null && dataSource !== void 0 ? dataSource : result, context);
|
79
|
+
}); // 取当前行的数据。直到取完
|
77
80
|
|
78
81
|
while (columnsCopy.length > 0) {
|
79
82
|
var filterColumns = [];
|
package/es/info/typing.d.ts
CHANGED
@@ -98,6 +98,8 @@ export interface ProInfoColumnsProps {
|
|
98
98
|
props?: any;
|
99
99
|
/** 对齐方式 **/
|
100
100
|
alignItems?: 'center' | 'flex-start' | 'flex-end' | string;
|
101
|
+
/** 是否隐藏 **/
|
102
|
+
hidden?: boolean | ProInfoCellFunProp | string;
|
101
103
|
}
|
102
104
|
export declare type ProInfoActionType = {
|
103
105
|
/** 刷新Info */
|
package/es/info/utils/index.d.ts
CHANGED
@@ -10,3 +10,11 @@ export declare const ProInfoGroupContext: React.Context<ProInfoGroupContextProps
|
|
10
10
|
* @returns
|
11
11
|
*/
|
12
12
|
export declare function getDataIndexValue(dataIndex: ProInfoColumnsProps['dataIndex'], dataSource: object): any;
|
13
|
+
/**
|
14
|
+
* 判断是否隐藏
|
15
|
+
* @param hidden
|
16
|
+
* @param value
|
17
|
+
* @param record
|
18
|
+
* @param context
|
19
|
+
*/
|
20
|
+
export declare function isHidden(hidden: ProInfoColumnsProps['hidden'], value: any, record: any, context: any): any;
|
package/es/info/utils/index.js
CHANGED
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
4
4
|
|
5
5
|
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; }
|
6
6
|
|
7
|
-
import { getDeepValue } from '@teamix/utils';
|
7
|
+
import { getDeepValue, getTargetValue } from '@teamix/utils';
|
8
8
|
import React from 'react';
|
9
9
|
export function useActionType(ref, action) {
|
10
10
|
// 合并自定义事件
|
@@ -30,4 +30,31 @@ export function getDataIndexValue(dataIndex, dataSource) {
|
|
30
30
|
}
|
31
31
|
|
32
32
|
return getDeepValue(dataIndex !== null && dataIndex !== void 0 ? dataIndex : '', dataSource);
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* 判断是否隐藏
|
36
|
+
* @param hidden
|
37
|
+
* @param value
|
38
|
+
* @param record
|
39
|
+
* @param context
|
40
|
+
*/
|
41
|
+
|
42
|
+
export function isHidden(hidden, value, record, context) {
|
43
|
+
if (typeof hidden === 'string') {
|
44
|
+
return getTargetValue(hidden, _objectSpread(_objectSpread({}, record), {}, {
|
45
|
+
record: record,
|
46
|
+
value: value,
|
47
|
+
context: context
|
48
|
+
}));
|
49
|
+
}
|
50
|
+
|
51
|
+
if (typeof hidden === 'boolean') {
|
52
|
+
return hidden;
|
53
|
+
}
|
54
|
+
|
55
|
+
if (typeof hidden === 'function') {
|
56
|
+
return hidden === null || hidden === void 0 ? void 0 : hidden(value, record);
|
57
|
+
}
|
58
|
+
|
59
|
+
return false;
|
33
60
|
}
|
@@ -29,6 +29,7 @@ import { ProActionGroup } from '../../../actions';
|
|
29
29
|
import { usePrefixCls } from '@teamix/utils';
|
30
30
|
import React, { isValidElement, useState } from 'react';
|
31
31
|
import ProField, { renderTags } from '@teamix/pro-field';
|
32
|
+
import { getTreeNodeProps } from '../..';
|
32
33
|
import ProIconAction from './components/IconAction';
|
33
34
|
import ProIconSwitch from './components/IconSwitch';
|
34
35
|
import ProHoverTooltip from './components/HoverTooltip';
|
@@ -201,10 +202,14 @@ var ProSideBarTreeNode = function ProSideBarTreeNode(props) {
|
|
201
202
|
|
202
203
|
export function renderTreeNode(data) {
|
203
204
|
return data.map(function (item) {
|
204
|
-
|
205
|
+
var _getTreeNodeProps = getTreeNodeProps(item),
|
206
|
+
nodeProps = _getTreeNodeProps.nodeProps,
|
207
|
+
labelProps = _getTreeNodeProps.labelProps;
|
208
|
+
|
209
|
+
return /*#__PURE__*/React.createElement(Tree.Node, _objectSpread({
|
205
210
|
key: item.value,
|
206
|
-
label: /*#__PURE__*/React.createElement(ProSideBarTreeNode, _objectSpread({},
|
207
|
-
}, item.children && item.children.length > 0 && renderTreeNode(item.children));
|
211
|
+
label: /*#__PURE__*/React.createElement(ProSideBarTreeNode, _objectSpread({}, labelProps))
|
212
|
+
}, nodeProps), item.children && item.children.length > 0 && renderTreeNode(item.children));
|
208
213
|
});
|
209
214
|
} // 渲染树节点 依赖 value
|
210
215
|
|
@@ -216,10 +221,14 @@ export function renderTreeNodeDependenceValue(data, onBeforeRenderNodeEvent, che
|
|
216
221
|
newProps = onBeforeRenderNodeEvent(item, checkedKeys, selectedKeys, allData !== null && allData !== void 0 ? allData : data);
|
217
222
|
}
|
218
223
|
|
219
|
-
|
224
|
+
var _getTreeNodeProps2 = getTreeNodeProps(item),
|
225
|
+
nodeProps = _getTreeNodeProps2.nodeProps,
|
226
|
+
labelProps = _getTreeNodeProps2.labelProps;
|
227
|
+
|
228
|
+
return /*#__PURE__*/React.createElement(Tree.Node, _objectSpread({
|
220
229
|
key: item.value,
|
221
|
-
label: /*#__PURE__*/React.createElement(ProSideBarTreeNode, _objectSpread({},
|
222
|
-
}, item.children && item.children.length > 0 && renderTreeNodeDependenceValue(item.children, onBeforeRenderNodeEvent, checkedKeys, selectedKeys, allData !== null && allData !== void 0 ? allData : data));
|
230
|
+
label: /*#__PURE__*/React.createElement(ProSideBarTreeNode, _objectSpread({}, labelProps))
|
231
|
+
}, nodeProps), item.children && item.children.length > 0 && renderTreeNodeDependenceValue(item.children, onBeforeRenderNodeEvent, checkedKeys, selectedKeys, allData !== null && allData !== void 0 ? allData : data));
|
223
232
|
});
|
224
233
|
}
|
225
234
|
export default ProSideBarTreeNode;
|
@@ -50,9 +50,13 @@
|
|
50
50
|
font-weight: unset;
|
51
51
|
}
|
52
52
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
}
|
54
|
+
.teamix-pro-sidebar-deep-1 {
|
55
|
+
.teamix-pro-sidebar-tree {
|
56
|
+
.next-tree.next-node-block .next-tree-node-inner{
|
57
|
+
padding: 6px 0px 6px 4px !important;
|
58
|
+
margin: 0 0 4px 0px;
|
59
|
+
border-radius: 2px;
|
60
|
+
}
|
57
61
|
}
|
58
|
-
}
|
62
|
+
}
|
package/es/sidebar/index.js
CHANGED
@@ -169,10 +169,10 @@ var ProSidebar = function ProSidebar(props) {
|
|
169
169
|
};
|
170
170
|
|
171
171
|
return /*#__PURE__*/React.createElement("div", {
|
172
|
-
className: "".concat(cls({
|
172
|
+
className: "".concat(cls(_defineProperty({
|
173
173
|
'': true,
|
174
174
|
'scroll-tree': scrollArea === 'tree'
|
175
|
-
}), " ").concat(className),
|
175
|
+
}, "deep-".concat(expandLevel), true)), " ").concat(className),
|
176
176
|
style: style
|
177
177
|
}, /*#__PURE__*/React.createElement(ProSidebarContainer, _objectSpread(_objectSpread({
|
178
178
|
searchOnChange: debounce(function (value) {
|
package/es/sidebar/index.scss
CHANGED
@@ -11,7 +11,8 @@
|
|
11
11
|
.teamix-pro-sidebar-container,
|
12
12
|
.teamix-pro-card,
|
13
13
|
.next-card-content-container,
|
14
|
-
.teamix-pro-card-content
|
14
|
+
.teamix-pro-card-content,
|
15
|
+
.teamix-pro-card-box{
|
15
16
|
height: 100%;
|
16
17
|
}
|
17
18
|
.teamix-pro-sidebar-container-context {
|
@@ -24,3 +25,14 @@
|
|
24
25
|
color: unset;
|
25
26
|
}
|
26
27
|
}
|
28
|
+
.teamix-pro-page-container-sidebar {
|
29
|
+
.teamix-pro-sidebar {
|
30
|
+
.teamix-pro-sidebar-container {
|
31
|
+
.next-card-header.next-card-header {
|
32
|
+
padding-top: 0;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
|
package/es/sidebar/typing.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { MessageProps } from '@alifd/next/types/message';
|
3
|
-
import { TreeProps } from '@alifd/next/types/tree';
|
3
|
+
import { NodeProps, TreeProps } from '@alifd/next/types/tree';
|
4
4
|
import { CommonRequestConfig } from '@teamix/utils';
|
5
5
|
import { ProTagItem } from '../field';
|
6
6
|
import { ProActionConfig, ProCardProps, ProFieldProps, ProFieldRenderProps, ProFieldType } from '..';
|
@@ -48,7 +48,9 @@ export declare type ProSidebarDataSourceItem = {
|
|
48
48
|
render?: ProFieldRenderProps;
|
49
49
|
/** ProField 的其他配置项 */
|
50
50
|
fieldProps?: ProFieldProps;
|
51
|
-
|
51
|
+
/** TreeNode 的其他配置项 */
|
52
|
+
treeNodeProps?: ProFieldProps;
|
53
|
+
} & NodeProps;
|
52
54
|
/** 单项 extra 配置项 */
|
53
55
|
export declare type ProSidebarExtraProps = React.ReactNode | (ProSidebarExtraPropsItem | React.ReactNode)[];
|
54
56
|
export declare type ProSidebarExtraPropsItem = {
|