@teamix/pro 1.4.16 → 1.4.19
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 +316 -118
- 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 +2 -2
- package/es/actions/dialog.js +10 -29
- package/es/actions/drawer.js +0 -7
- package/es/card/index.js +52 -7
- package/es/card/index.scss +8 -0
- package/es/form/ProForm/index.js +0 -2
- package/es/form/typing.d.ts +5 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/baseInfo/index.js +18 -9
- 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/components/Layout/index.js +1 -1
- 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 +2 -2
- package/lib/actions/dialog.js +10 -30
- package/lib/actions/drawer.js +0 -8
- package/lib/card/index.js +61 -7
- package/lib/card/index.scss +8 -0
- package/lib/form/ProForm/index.js +0 -2
- package/lib/form/typing.d.ts +5 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/baseInfo/index.js +17 -8
- 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/components/Layout/index.js +1 -1
- 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,8 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
29
29
|
onOk?: any;
|
30
30
|
/** 点击取消自定义回调函数 */
|
31
31
|
onCancel?: any;
|
32
|
-
/**
|
33
|
-
|
32
|
+
/** 隐藏footer区域 */
|
33
|
+
hideFooter?: boolean;
|
34
34
|
}
|
35
35
|
export declare function useDialogAction(action: DialogAction, actionContext?: any, hasForm?: boolean): {
|
36
36
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
package/es/actions/dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
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"
|
1
|
+
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError", "onOk", "onCancel", "hideFooter"],
|
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
|
|
@@ -105,6 +99,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
105
99
|
onError = action.onError,
|
106
100
|
propsOnOk = action.onOk,
|
107
101
|
propsOnCancel = action.onCancel,
|
102
|
+
hideFooter = action.hideFooter,
|
108
103
|
others = _objectWithoutProperties(action, _excluded);
|
109
104
|
|
110
105
|
var _getTargetValue = getTargetValue(others, context),
|
@@ -127,18 +122,7 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
127
122
|
footerDescription = _getTargetValue.footerDescription,
|
128
123
|
footerAlign = _getTargetValue.footerAlign,
|
129
124
|
className = _getTargetValue.className,
|
130
|
-
openIdentifier = _getTargetValue.openIdentifier,
|
131
125
|
containerOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
132
|
-
/**
|
133
|
-
* 判断是否含有 openIdentifierIdentifiy参数 ,更改对应 url
|
134
|
-
*/
|
135
|
-
|
136
|
-
|
137
|
-
if (openIdentifier) {
|
138
|
-
setUrlState({
|
139
|
-
openIdentifier: openIdentifier
|
140
|
-
});
|
141
|
-
}
|
142
126
|
|
143
127
|
var isDrawer = dialogType === 'drawer';
|
144
128
|
var isPop = dialogType === 'pop';
|
@@ -246,16 +230,8 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
246
230
|
});
|
247
231
|
var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({}, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
248
232
|
|
249
|
-
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "onCancel", function
|
250
|
-
setUrlState({
|
251
|
-
openIdentifier: undefined
|
252
|
-
});
|
233
|
+
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), hideFooter && !isPop && isDrawer ? false : onOk), _defineProperty(_objectSpread2, "onCancel", hideFooter && !isPop && isDrawer ? false : function () {
|
253
234
|
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
235
|
}), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
|
260
236
|
className: "teamix-pro-dialog-before-content"
|
261
237
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
|
@@ -268,7 +244,12 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
268
244
|
className: classnames('teamix-pro-dialog-footer-description', getFooterAlignClass(isDrawer, footerAlign))
|
269
245
|
}, renderDialogFooterDescription(footerDescription)))), _defineProperty(_objectSpread2, "footerAlign", footerAlign), _defineProperty(_objectSpread2, "className", classnames('teamix-pro-action-dialog', {
|
270
246
|
'has-footer-description': !!footerDescription
|
271
|
-
})), _objectSpread2), containerProps), containerOtherProps);
|
247
|
+
})), _objectSpread2), containerProps), containerOtherProps); // TODO Drawer 基础组件未支持此配置,日后支持,并修改onOk、onCancel写法
|
248
|
+
|
249
|
+
|
250
|
+
if ((!dialogType || dialogType === 'dialog') && hideFooter) {
|
251
|
+
quickShowProps['footer'] = !hideFooter;
|
252
|
+
}
|
272
253
|
|
273
254
|
var ret = container.show(quickShowProps);
|
274
255
|
store.hide = ret ? ret.hide || ret.close : function () {};
|
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
@@ -23,7 +23,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
23
23
|
|
24
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
25
25
|
|
26
|
-
import React from 'react';
|
26
|
+
import React, { useEffect } from 'react';
|
27
27
|
import classnames from 'classnames';
|
28
28
|
import Result from '@teamix/result';
|
29
29
|
import { Card as BasicCard, Balloon } from '@alicloudfe/components';
|
@@ -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,10 +116,20 @@ 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
128
|
vertical = _formatSpacing.vertical;
|
121
129
|
|
130
|
+
useEffect(function () {
|
131
|
+
calculateHeaderWidth();
|
132
|
+
}, []);
|
122
133
|
var hasDivider = (divider || !!split) && (title || extra);
|
123
134
|
var hasCollapse = collapsible === true || defaultCollapsed !== undefined || collapsed !== undefined;
|
124
135
|
var collapseState = collapsed !== undefined ? collapsed : innerCollapseState;
|
@@ -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",
|
@@ -235,7 +278,9 @@ export var ProCard = function ProCard(props) {
|
|
235
278
|
free: true,
|
236
279
|
className: cardClassName,
|
237
280
|
style: style,
|
238
|
-
actions: renderActionGroup(actions, context)
|
281
|
+
actions: renderActionGroup(actions, context),
|
282
|
+
// @ts-ignore
|
283
|
+
ref: cardRef
|
239
284
|
}, others), !loading && image && /*#__PURE__*/React.createElement(BasicCard.Media, {
|
240
285
|
component: "img",
|
241
286
|
src: image
|
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/form/typing.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ReactNode } from 'react';
|
2
|
-
import type { IFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
|
2
|
+
import type { IFormFeedback as InnerFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
|
3
3
|
import type { IFormLayoutProps } from '@teamix/formily';
|
4
4
|
import type { CommonRequestConfig } from '@teamix/utils';
|
5
5
|
import type { UrlStateOptions } from '@teamix/hooks';
|
@@ -15,6 +15,10 @@ export interface ProFormInitializeItem {
|
|
15
15
|
* ProForm 实例类型
|
16
16
|
*/
|
17
17
|
export declare type ProFormType = FormType;
|
18
|
+
/**
|
19
|
+
* ProForm 反馈类型
|
20
|
+
*/
|
21
|
+
export declare type IFormFeedback = InnerFormFeedback;
|
18
22
|
declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker' | 'Percent' | 'Money' | 'Select' | 'MultipleSelect' | 'TreeSelect' | 'Cascader' | 'MultipleCascader' | 'ArbitraryCascader' | 'Radio' | 'Checkbox' | 'Switch' | 'DatePicker' | 'TimePicker' | 'DateTimePicker' | 'WeekPicker' | 'MonthPicker' | 'YearPicker' | 'QuarterPicker' | 'DateRangePicker' | 'TimeRangePicker' | 'DateTimeRangePicker' | 'WeekRangePicker' | 'MonthRangePicker' | 'YearRangePicker' | 'QuarterRangePicker' | 'Transfer' | 'Upload' | 'ColorPicker' | 'ColorRadio' | 'IconPicker' | 'JsonInput' | 'TagPicker' | 'MultipleTagPicker' | 'Range' | 'Search' | 'SelectGroup' | 'SelectTable' | 'SelectTable.Column';
|
19
23
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
20
24
|
declare type IComboComponent = 'ArrayCards' | 'ArrayCards.Addition' | 'ArrayCards.Remove' | 'ArrayCards.MoveUp' | 'ArrayCards.MoveDown' | 'ArrayCards.Index' | 'ArrayCollapse' | 'ArrayCollapse.CollapsePanel' | 'ArrayCollapse.Addition' | 'ArrayCollapse.Remove' | 'ArrayCollapse.MoveUp' | 'ArrayCollapse.MoveDown' | 'ArrayCollapse.Index' | 'ArrayTable' | 'ArrayTable.Column' | 'ArrayTable.SortHandle' | 'ArrayTable.Addition' | 'ArrayTable.Remove' | 'ArrayTable.MoveDown' | 'ArrayTable.MoveUp' | 'ArrayTable.Index' | 'ArrayItems' | 'ArrayItems.Item' | 'ArrayItems.SortHandle' | 'ArrayItems.Addition' | 'ArrayItems.Remove' | 'ArrayItems.MoveDown' | 'ArrayItems.MoveUp' | 'ArrayItems.Index' | 'Editable' | 'Editable.Popover' | 'Editable.Dialog' | 'Editable.Drawer';
|
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.19";
|
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.19';
|
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
|
|
@@ -38,16 +38,19 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
38
38
|
var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
|
39
39
|
|
40
40
|
if (colspan) {
|
41
|
-
|
41
|
+
var _layout$span, _layout$span2;
|
42
|
+
|
43
|
+
var realColspan = ((_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : 24 / defaultLayout.span > colspan) ? colspan : (_layout$span2 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span2 !== void 0 ? _layout$span2 : 24 / defaultLayout.span;
|
44
|
+
newLabelSpan = newLabelSpan / realColspan;
|
42
45
|
newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
|
43
46
|
}
|
44
47
|
|
45
48
|
var newFormItemLayout = {
|
46
49
|
labelCol: {
|
47
|
-
span: newLabelSpan
|
50
|
+
span: newLabelSpan.toFixed()
|
48
51
|
},
|
49
52
|
wrapperCol: {
|
50
|
-
span: newWrapperSpan
|
53
|
+
span: newWrapperSpan.toFixed()
|
51
54
|
}
|
52
55
|
};
|
53
56
|
return Object.assign(formItemLayout, newFormItemLayout);
|
@@ -55,19 +58,25 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
55
58
|
|
56
59
|
var renderContent = function renderContent() {
|
57
60
|
return columns.map(function (item, index) {
|
58
|
-
var _layout$
|
61
|
+
var _ref, _ref2, _layout$span3, _layout$span4, _item$title, _item$valueType, _ref3, _item$colSpan;
|
62
|
+
|
63
|
+
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);
|
64
|
+
|
65
|
+
if (hidden) {
|
66
|
+
return;
|
67
|
+
}
|
59
68
|
|
60
|
-
var span = item.colSpan ? defaultLayout.span
|
61
|
-
var layoutSpan = item.colSpan ? ((_layout$
|
69
|
+
var span = item.colSpan ? defaultLayout.span : defaultLayout.span;
|
70
|
+
var layoutSpan = item.colSpan ? ((_layout$span3 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span3 !== void 0 ? _layout$span3 : span) * item.colSpan : (_layout$span4 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span4 !== void 0 ? _layout$span4 : span;
|
62
71
|
return /*#__PURE__*/React.createElement(Col, {
|
63
|
-
span: layoutSpan,
|
72
|
+
span: layoutSpan > 24 ? 24 : layoutSpan,
|
64
73
|
key: index
|
65
74
|
}, /*#__PURE__*/React.createElement(ProInfoItem, {
|
66
75
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
67
76
|
loading: loading,
|
68
77
|
value: /*#__PURE__*/React.createElement(InfoValueItem, {
|
69
78
|
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, (
|
79
|
+
value: getDataIndexValue(item.dataIndex, (_ref3 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref3 !== void 0 ? _ref3 : {}),
|
71
80
|
render: item.render,
|
72
81
|
dataSource: item.dataSource,
|
73
82
|
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
|
+
|