@teamix/pro 1.1.33 → 1.1.37
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 +435 -271
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +8 -1
- package/es/actions/dialog-form.js +32 -15
- package/es/actions/dialog-info.d.ts +9 -0
- package/es/actions/dialog-info.js +23 -0
- package/es/actions/dialog.d.ts +2 -0
- package/es/actions/dialog.js +11 -4
- package/es/actions/drawer-info.d.ts +6 -0
- package/es/actions/drawer-info.js +7 -0
- package/es/actions/index.d.ts +11 -5
- package/es/actions/index.js +28 -12
- package/es/actions/index.scss +8 -0
- package/es/actions/link.js +4 -12
- package/es/form/SchemaForm/reactions.js +4 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoValueItem/index.js +108 -26
- package/es/info/components/baseInfo/index.d.ts +3 -1
- package/es/info/components/baseInfo/index.js +6 -33
- package/es/info/components/headerInfo/index.d.ts +3 -1
- package/es/info/components/headerInfo/index.js +8 -39
- package/es/info/components/tableInfo/index.js +4 -21
- package/es/info/index.js +47 -25
- package/es/info/index.scss +0 -4
- package/es/info/typing.d.ts +14 -5
- package/es/page-header/index.d.ts +9 -5
- package/es/page-header/index.js +22 -7
- package/es/table/index.js +3 -1
- package/lib/actions/dialog-form.d.ts +8 -1
- package/lib/actions/dialog-form.js +32 -15
- package/lib/actions/dialog-info.d.ts +9 -0
- package/lib/actions/dialog-info.js +37 -0
- package/lib/actions/dialog.d.ts +2 -0
- package/lib/actions/dialog.js +11 -4
- package/lib/actions/drawer-info.d.ts +6 -0
- package/lib/actions/drawer-info.js +18 -0
- package/lib/actions/index.d.ts +11 -5
- package/lib/actions/index.js +30 -12
- package/lib/actions/index.scss +8 -0
- package/lib/actions/link.js +5 -12
- package/lib/form/SchemaForm/reactions.js +4 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoValueItem/index.js +107 -25
- package/lib/info/components/baseInfo/index.d.ts +3 -1
- package/lib/info/components/baseInfo/index.js +5 -40
- package/lib/info/components/headerInfo/index.d.ts +3 -1
- package/lib/info/components/headerInfo/index.js +7 -46
- package/lib/info/components/tableInfo/index.js +4 -22
- package/lib/info/index.js +49 -25
- package/lib/info/index.scss +0 -4
- package/lib/info/typing.d.ts +14 -5
- package/lib/page-header/index.d.ts +9 -5
- package/lib/page-header/index.js +22 -7
- package/lib/table/index.js +3 -1
- package/package.json +1 -1
@@ -3,11 +3,18 @@ import { IFormProps, IFormSchema } from '../form';
|
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
6
|
+
/** 表单初始值 */
|
6
7
|
initialValues?: any;
|
8
|
+
/** 表单初始化数据请求 */
|
7
9
|
initialRequest?: RequestAction;
|
10
|
+
/** 表单提交发送数据请求时,是否携带全部表单数据。默认携带 */
|
8
11
|
useFieldValuesForRequest?: boolean;
|
12
|
+
/**
|
13
|
+
* @deprecated 建议使用 schema 配置 IFormProps 代替
|
14
|
+
*/
|
9
15
|
formProps?: Omit<IFormProps, 'schema'>;
|
10
|
-
|
16
|
+
/** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 IFormProps,否则可以只配置 IFormSchema */
|
17
|
+
schema: IFormSchema | IFormProps;
|
11
18
|
}
|
12
19
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
13
20
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
@@ -1,14 +1,5 @@
|
|
1
|
-
var _excluded = ["schema",
|
2
|
-
|
3
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
-
|
5
|
-
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; }
|
6
|
-
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
8
|
-
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
10
|
-
|
11
|
-
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; }
|
1
|
+
var _excluded = ["schema"],
|
2
|
+
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
|
12
3
|
|
13
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
14
5
|
|
@@ -22,6 +13,16 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
22
13
|
|
23
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
24
15
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
17
|
+
|
18
|
+
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; }
|
19
|
+
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
21
|
+
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
23
|
+
|
24
|
+
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; }
|
25
|
+
|
25
26
|
import React, { useState, useRef, useEffect } from 'react';
|
26
27
|
import { useHistory } from 'react-router-dom';
|
27
28
|
import { Loading } from '@alicloudfe/components';
|
@@ -62,15 +63,31 @@ function getDefaultFormPropsByDialogSize(size) {
|
|
62
63
|
};
|
63
64
|
}
|
64
65
|
|
66
|
+
function getSchemaAndFormProps(schema, formProps) {
|
67
|
+
if (schema instanceof Array) {
|
68
|
+
return _objectSpread({
|
69
|
+
schema: schema
|
70
|
+
}, formProps);
|
71
|
+
}
|
72
|
+
|
73
|
+
var formSchema = schema;
|
74
|
+
return formSchema;
|
75
|
+
}
|
76
|
+
|
65
77
|
var DialogForm = function DialogForm(props) {
|
66
78
|
var initialValues = props.initialValues,
|
67
79
|
initialRequest = props.initialRequest,
|
68
|
-
schema = props.schema,
|
69
80
|
_props$size = props.size,
|
70
81
|
size = _props$size === void 0 ? 'small' : _props$size,
|
82
|
+
schema = props.schema,
|
71
83
|
formProps = props.formProps,
|
72
84
|
context = props.context,
|
73
85
|
formRef = props.formRef;
|
86
|
+
|
87
|
+
var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
|
88
|
+
formSchema = _getSchemaAndFormProp.schema,
|
89
|
+
others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
|
90
|
+
|
74
91
|
var form = createForm({
|
75
92
|
initialValues: getTargetValue(initialValues, context)
|
76
93
|
});
|
@@ -101,8 +118,8 @@ var DialogForm = function DialogForm(props) {
|
|
101
118
|
}
|
102
119
|
}, /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({
|
103
120
|
form: form,
|
104
|
-
schema: getTargetValue(
|
105
|
-
}, getDefaultFormPropsByDialogSize(size)), getTargetValue(
|
121
|
+
schema: getTargetValue(formSchema, context)
|
122
|
+
}, getDefaultFormPropsByDialogSize(size)), getTargetValue(others, context))));
|
106
123
|
};
|
107
124
|
|
108
125
|
export function useDialogFormAction(action, context) {
|
@@ -117,7 +134,7 @@ export function useDialogFormAction(action, context) {
|
|
117
134
|
size = _action$size === void 0 ? 'small' : _action$size,
|
118
135
|
_onFinish = action.onFinish,
|
119
136
|
_onCancel = action.onCancel,
|
120
|
-
others = _objectWithoutProperties(action,
|
137
|
+
others = _objectWithoutProperties(action, _excluded2);
|
121
138
|
|
122
139
|
var formRef = useRef();
|
123
140
|
return useDialogAction(Object.assign({
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { DialogAction } from './dialog';
|
2
|
+
import { ProInfoProps } from '..';
|
3
|
+
export interface DialogInfoAction extends DialogAction {
|
4
|
+
schema: ProInfoProps;
|
5
|
+
}
|
6
|
+
export declare function useDialogInfoAction(action: DialogInfoAction, context?: any): {
|
7
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
8
|
+
};
|
9
|
+
export default useDialogInfoAction;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
var _excluded = ["schema"];
|
2
|
+
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
import useDialogAction from './dialog';
|
8
|
+
import { ProInfo } from '..';
|
9
|
+
export function useDialogInfoAction(action, context) {
|
10
|
+
var schema = action.schema,
|
11
|
+
others = _objectWithoutProperties(action, _excluded);
|
12
|
+
|
13
|
+
return useDialogAction(Object.assign({
|
14
|
+
component: ProInfo,
|
15
|
+
closeable: true,
|
16
|
+
size: 'mini',
|
17
|
+
schema: Object.assign({
|
18
|
+
backgroundColor: 'grey',
|
19
|
+
compacted: false
|
20
|
+
}, schema)
|
21
|
+
}, others), context);
|
22
|
+
}
|
23
|
+
export default useDialogInfoAction;
|
package/es/actions/dialog.d.ts
CHANGED
@@ -7,6 +7,8 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
7
7
|
dialogType?: 'dialog' | 'drawer';
|
8
8
|
dialogQuickShowType?: 'alert' | 'confirm';
|
9
9
|
messageType?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading';
|
10
|
+
beforeContent?: React.ReactNode;
|
11
|
+
afterContent?: React.ReactNode;
|
10
12
|
}
|
11
13
|
export declare function useDialogAction(action: DialogAction, context?: any): {
|
12
14
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
package/es/actions/dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
2
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link"];
|
2
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent"];
|
3
3
|
|
4
4
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
5
5
|
|
@@ -77,6 +77,8 @@ export function useDialogAction(action, context) {
|
|
77
77
|
beforeRequest = _getTargetValue.beforeRequest,
|
78
78
|
onTrigger = _getTargetValue.onTrigger,
|
79
79
|
link = _getTargetValue.link,
|
80
|
+
beforeContent = _getTargetValue.beforeContent,
|
81
|
+
afterContent = _getTargetValue.afterContent,
|
80
82
|
dialogOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
81
83
|
|
82
84
|
var dialogMethod = dialogType === 'drawer' ? Drawer : Dialog;
|
@@ -152,13 +154,18 @@ export function useDialogAction(action, context) {
|
|
152
154
|
var dialogContext = Object.assign({}, context, {
|
153
155
|
hide: hide
|
154
156
|
});
|
157
|
+
var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({
|
158
|
+
key: uuid()
|
159
|
+
}, componentProps)) : addContextForReactNode(content, dialogContext);
|
155
160
|
var ret = dialogMethod.show(_objectSpread(_objectSpread({
|
156
161
|
// @ts-ignore
|
157
162
|
onOk: onOk,
|
158
163
|
title: addContextForReactNode(title, dialogContext),
|
159
|
-
content:
|
160
|
-
|
161
|
-
},
|
164
|
+
content: /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
|
165
|
+
className: "teamix-pro-dialog-before-content"
|
166
|
+
}, beforeContent), dialogContent, afterContent && /*#__PURE__*/React.createElement("div", {
|
167
|
+
className: "teamix-pro-dialog-after-content"
|
168
|
+
}, afterContent)),
|
162
169
|
closeable: !loading
|
163
170
|
}, dialogProps), dialogOtherProps));
|
164
171
|
store.hide = ret.hide;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { DialogInfoAction } from './dialog-info';
|
2
|
+
export declare type DrawerInfoAction = DialogInfoAction;
|
3
|
+
export declare function useDrawerInfoAction(action: DrawerInfoAction, context?: any): {
|
4
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
5
|
+
};
|
6
|
+
export default useDrawerInfoAction;
|
package/es/actions/index.d.ts
CHANGED
@@ -10,17 +10,17 @@ import { NoticeAction } from './notice';
|
|
10
10
|
import { ErrorAction } from './error';
|
11
11
|
import { DialogFormAction } from './dialog-form';
|
12
12
|
import { DialogTableAction } from './dialog-table';
|
13
|
+
import { DialogInfoAction } from './dialog-info';
|
13
14
|
import { DrawerAction } from './drawer';
|
14
15
|
import { DrawerFormAction } from './drawer-form';
|
15
16
|
import { DrawerTableAction } from './drawer-table';
|
17
|
+
import { DrawerInfoAction } from './drawer-info';
|
16
18
|
import './index.scss';
|
17
19
|
export declare type ActionConfig = ({
|
18
20
|
type: 'link';
|
19
21
|
} & LinkAction) | ({
|
20
22
|
type: 'request';
|
21
23
|
} & RequestAction) | ({
|
22
|
-
type: 'dialog';
|
23
|
-
} & DialogAction) | ({
|
24
24
|
type: 'confirm';
|
25
25
|
} & ConfirmAction) | ({
|
26
26
|
type: 'danger-confirm';
|
@@ -29,16 +29,22 @@ export declare type ActionConfig = ({
|
|
29
29
|
} & NoticeAction) | ({
|
30
30
|
type: 'error';
|
31
31
|
} & ErrorAction) | ({
|
32
|
+
type: 'dialog';
|
33
|
+
} & DialogAction) | ({
|
32
34
|
type: 'dialog-form';
|
33
35
|
} & DialogFormAction) | ({
|
36
|
+
type: 'dialog-table';
|
37
|
+
} & DialogTableAction) | ({
|
38
|
+
type: 'dialog-info';
|
39
|
+
} & DialogInfoAction) | ({
|
34
40
|
type: 'drawer';
|
35
41
|
} & DrawerAction) | ({
|
36
42
|
type: 'drawer-form';
|
37
43
|
} & DrawerFormAction) | ({
|
38
|
-
type: 'dialog-table';
|
39
|
-
} & DialogTableAction) | ({
|
40
44
|
type: 'drawer-table';
|
41
|
-
} & DrawerTableAction)
|
45
|
+
} & DrawerTableAction) | ({
|
46
|
+
type: 'drawer-info';
|
47
|
+
} & DrawerInfoAction);
|
42
48
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
43
49
|
export declare const useAction: any;
|
44
50
|
export interface IActionButton extends ButtonProps {
|
package/es/actions/index.js
CHANGED
@@ -43,9 +43,11 @@ import { useNoticeAction } from './notice';
|
|
43
43
|
import { useErrorAction } from './error';
|
44
44
|
import { useDialogFormAction } from './dialog-form';
|
45
45
|
import { useDialogTableAction } from './dialog-table';
|
46
|
+
import { useDialogInfoAction } from './dialog-info';
|
46
47
|
import { useDrawerAction } from './drawer';
|
47
48
|
import { useDrawerFormAction } from './drawer-form';
|
48
49
|
import { useDrawerTableAction } from './drawer-table';
|
50
|
+
import { useDrawerInfoAction } from './drawer-info';
|
49
51
|
import './index.scss';
|
50
52
|
var RegistedActions = new Map();
|
51
53
|
export function registerActionHandler(id, extendActionId, defaultConfig) {
|
@@ -98,6 +100,10 @@ export var useAction = function useAction(config, context) {
|
|
98
100
|
return useDialogTableAction(others, context);
|
99
101
|
}
|
100
102
|
|
103
|
+
if (type === 'dialog-info') {
|
104
|
+
return useDialogInfoAction(others, context);
|
105
|
+
}
|
106
|
+
|
101
107
|
if (type === 'drawer') {
|
102
108
|
return useDrawerAction(others, context);
|
103
109
|
}
|
@@ -110,6 +116,10 @@ export var useAction = function useAction(config, context) {
|
|
110
116
|
return useDrawerTableAction(others, context);
|
111
117
|
}
|
112
118
|
|
119
|
+
if (type === 'drawer-info') {
|
120
|
+
return useDrawerInfoAction(others, context);
|
121
|
+
}
|
122
|
+
|
113
123
|
var registedAction = RegistedActions.get(type);
|
114
124
|
|
115
125
|
if (!registedAction) {
|
@@ -160,33 +170,39 @@ export var ActionButton = function ActionButton(props) {
|
|
160
170
|
};
|
161
171
|
|
162
172
|
function renderMenuButtonItem(item, key, context) {
|
163
|
-
var
|
173
|
+
var config = item.config,
|
174
|
+
btnContext = item.context,
|
175
|
+
_onClick2 = item.onClick,
|
176
|
+
children = item.children,
|
177
|
+
icon = item.icon,
|
178
|
+
disabled = item.disabled;
|
179
|
+
var menuItemActionConfig = Object.assign({}, config, {
|
164
180
|
trigger: 'onClick'
|
165
181
|
});
|
166
182
|
|
167
|
-
var _useAction = useAction(menuItemActionConfig,
|
183
|
+
var _useAction = useAction(menuItemActionConfig, btnContext || context),
|
168
184
|
loading = _useAction.loading,
|
169
185
|
menuItemProps = _objectWithoutProperties(_useAction, _excluded3);
|
170
186
|
|
171
|
-
var buttonProps =
|
187
|
+
var buttonProps = _onClick2 ? _objectSpread(_objectSpread({}, menuItemProps), {}, {
|
172
188
|
onClick: function onClick(e) {
|
173
|
-
return
|
189
|
+
return _onClick2(e, context);
|
174
190
|
}
|
175
191
|
}) : _objectSpread({}, menuItemProps);
|
176
192
|
return /*#__PURE__*/React.createElement(MenuButton.Item, _objectSpread({
|
177
|
-
key: key
|
178
|
-
|
193
|
+
key: key,
|
194
|
+
disabled: disabled
|
195
|
+
}, buttonProps), buttonContent(children, icon, undefined, context));
|
179
196
|
}
|
180
197
|
|
181
198
|
function renderCommonActionButtonMenuItem(action, key, context) {
|
182
|
-
|
183
|
-
|
199
|
+
var menuBtn = action;
|
200
|
+
|
201
|
+
if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
|
184
202
|
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
185
203
|
key: key,
|
186
|
-
label:
|
187
|
-
|
188
|
-
}, //@ts-ignore
|
189
|
-
action.actions.map(function (a, j) {
|
204
|
+
label: menuBtn.label || menuBtn.children
|
205
|
+
}, menuBtn.actions.map(function (a, j) {
|
190
206
|
return renderCommonActionButtonMenuItem(a, j, context);
|
191
207
|
}));
|
192
208
|
}
|
package/es/actions/index.scss
CHANGED
package/es/actions/link.js
CHANGED
@@ -5,21 +5,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
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
7
|
import { getTargetValue, goToLink } from '@teamix/utils';
|
8
|
+
import { useHistory } from 'react-router-dom';
|
8
9
|
import { eventHandler } from './base';
|
9
10
|
export function useLinkAction(action, context) {
|
10
|
-
var
|
11
|
-
to = _getTargetValue.to,
|
12
|
-
search = _getTargetValue.search,
|
13
|
-
hash = _getTargetValue.hash,
|
14
|
-
blank = _getTargetValue.blank;
|
15
|
-
|
11
|
+
var history = useHistory();
|
16
12
|
return _objectSpread({}, eventHandler(action, function () {
|
17
|
-
|
18
|
-
|
19
|
-
search: search,
|
20
|
-
hash: hash,
|
21
|
-
blank: blank
|
22
|
-
});
|
13
|
+
var linkAction = getTargetValue(action, context);
|
14
|
+
goToLink(linkAction, history);
|
23
15
|
}));
|
24
16
|
}
|
25
17
|
export default useLinkAction;
|
@@ -8,6 +8,8 @@ import { isFn, doCommonRequest } from '@teamix/utils'; // 配置请求
|
|
8
8
|
|
9
9
|
var useRequest = function useRequest(requestConfig) {
|
10
10
|
return function (field) {
|
11
|
+
var _field$form;
|
12
|
+
|
11
13
|
var beforeRequest = requestConfig.beforeRequest,
|
12
14
|
onSuccess = requestConfig.onSuccess;
|
13
15
|
var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field) : {};
|
@@ -21,8 +23,8 @@ var useRequest = function useRequest(requestConfig) {
|
|
21
23
|
} : onSuccess
|
22
24
|
}), {
|
23
25
|
$self: field,
|
24
|
-
$form: field.form,
|
25
|
-
$values: field.form.values
|
26
|
+
$form: field === null || field === void 0 ? void 0 : field.form,
|
27
|
+
$values: field === null || field === void 0 ? void 0 : (_field$form = field.form) === null || _field$form === void 0 ? void 0 : _field$form.values
|
26
28
|
});
|
27
29
|
};
|
28
30
|
}; // 配置校验
|
package/es/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.1.
|
24
|
+
declare const version = "1.1.35";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -25,6 +25,6 @@ export * from './page-container';
|
|
25
25
|
export * from './page-header';
|
26
26
|
export * from './skeleton';
|
27
27
|
export * from './table';
|
28
|
-
var version = '1.1.
|
28
|
+
var version = '1.1.35';
|
29
29
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
30
30
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils };
|
@@ -1,4 +1,18 @@
|
|
1
|
-
var _excluded = ["type", "value", "render", "infoItem", "record", "actionRef"];
|
1
|
+
var _excluded = ["type", "value", "render", "infoItem", "record", "actionRef", "dataSource"];
|
2
|
+
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
4
|
+
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
+
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
8
|
+
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
10
|
+
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
12
|
+
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
14
|
+
|
15
|
+
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; }
|
2
16
|
|
3
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
18
|
|
@@ -12,19 +26,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
12
26
|
|
13
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
14
28
|
|
15
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
16
|
-
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
18
|
-
|
19
|
-
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; }
|
20
|
-
|
21
29
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
22
30
|
|
23
31
|
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; }
|
24
32
|
|
25
33
|
import TeamixIcon from '@teamix/icon';
|
26
34
|
import ProField from '../../../field';
|
27
|
-
import { baseClass, request } from '@teamix/utils';
|
35
|
+
import { baseClass, getTargetValue, request } from '@teamix/utils';
|
28
36
|
import PopConfirm from '@teamix/pop-confirm';
|
29
37
|
import React, { useMemo, useState } from 'react';
|
30
38
|
import './index.scss';
|
@@ -42,6 +50,7 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
42
50
|
infoItem = props.infoItem,
|
43
51
|
record = props.record,
|
44
52
|
actionRef = props.actionRef,
|
53
|
+
dataSource = props.dataSource,
|
45
54
|
others = _objectWithoutProperties(props, _excluded);
|
46
55
|
|
47
56
|
var dataIndex = infoItem.dataIndex,
|
@@ -55,28 +64,41 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
55
64
|
_infoItem$successMess = infoItem.successMessage,
|
56
65
|
successMessage = _infoItem$successMess === void 0 ? 'success' : _infoItem$successMess,
|
57
66
|
actions = infoItem.actions,
|
58
|
-
extra = infoItem.extra; //
|
59
|
-
// let fieldRender = render;
|
60
|
-
// let newValue = value;
|
61
|
-
// if (render && typeof render !== 'function') {
|
62
|
-
// const { value, ...others } = render;
|
63
|
-
// fieldRender = others;
|
64
|
-
// if (value) {
|
65
|
-
// newValue = getTargetValue(`${value}`, { ...record, record });
|
66
|
-
// console.log("newValue", newValue);
|
67
|
-
// }
|
68
|
-
// }
|
69
|
-
// 获取render
|
67
|
+
extra = infoItem.extra; // 获取处理过的 render
|
70
68
|
|
71
69
|
var getRender = function getRender() {
|
70
|
+
var _processRenderFunctio;
|
71
|
+
|
72
72
|
if (typeof render === 'function') {
|
73
73
|
return render;
|
74
74
|
}
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
var newRender = processBuriedPoint((_processRenderFunctio = processRenderFunction(render !== null && render !== void 0 ? render : {}, value, record)) !== null && _processRenderFunctio !== void 0 ? _processRenderFunctio : {}, value, record);
|
77
|
+
return newRender;
|
78
|
+
}; // 获取处理过的 dataSource
|
79
|
+
|
80
|
+
|
81
|
+
var getDataSource = function getDataSource() {
|
82
|
+
var newDataSource = null;
|
83
|
+
|
84
|
+
if (typeof dataSource === 'function') {
|
85
|
+
newDataSource = dataSource === null || dataSource === void 0 ? void 0 : dataSource(value, record);
|
86
|
+
} else {
|
87
|
+
newDataSource = (dataSource !== null && dataSource !== void 0 ? dataSource : []).map(function (item) {
|
88
|
+
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
89
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
90
|
+
k = _ref2[0],
|
91
|
+
v = _ref2[1];
|
92
|
+
|
93
|
+
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
94
|
+
record: record,
|
95
|
+
value: value
|
96
|
+
}))];
|
97
|
+
}));
|
98
|
+
});
|
99
|
+
}
|
100
|
+
|
101
|
+
return newDataSource;
|
80
102
|
}; // 浮层的显隐状态
|
81
103
|
|
82
104
|
|
@@ -115,6 +137,64 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
115
137
|
|
116
138
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
117
139
|
};
|
140
|
+
/**
|
141
|
+
* 处理 render 配置项是函数的情况
|
142
|
+
* @param render ProFieldRender
|
143
|
+
* @param value table cell value
|
144
|
+
* @param record table cell record
|
145
|
+
* @returns
|
146
|
+
*/
|
147
|
+
|
148
|
+
|
149
|
+
var processRenderFunction = function processRenderFunction(render, value, record) {
|
150
|
+
var external = ['linkOnClick', 'link', 'value'];
|
151
|
+
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
152
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
153
|
+
k = _ref4[0],
|
154
|
+
v = _ref4[1];
|
155
|
+
|
156
|
+
if (typeof v === 'function') {
|
157
|
+
var _v;
|
158
|
+
|
159
|
+
if (external.includes(k)) {
|
160
|
+
return [k, function () {
|
161
|
+
for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
|
162
|
+
others[_key] = arguments[_key];
|
163
|
+
}
|
164
|
+
|
165
|
+
return v === null || v === void 0 ? void 0 : v.apply(void 0, [value, record].concat(others));
|
166
|
+
}];
|
167
|
+
}
|
168
|
+
|
169
|
+
return [k, (_v = v === null || v === void 0 ? void 0 : v(value, record)) !== null && _v !== void 0 ? _v : ''];
|
170
|
+
}
|
171
|
+
|
172
|
+
return [k, v];
|
173
|
+
}));
|
174
|
+
};
|
175
|
+
/**
|
176
|
+
* 处理 render 数据,取出 {{xxx}} 匹配值
|
177
|
+
* @param render ProFieldRender
|
178
|
+
* @param record table cell record
|
179
|
+
* @returns
|
180
|
+
*/
|
181
|
+
|
182
|
+
|
183
|
+
var processBuriedPoint = function processBuriedPoint(render, value, record) {
|
184
|
+
return Object.fromEntries([// 默认 ellipsis、descriptionEllipsis 为 true
|
185
|
+
// emptyText 默认为 '-'
|
186
|
+
['ellipsis', true], ['descriptionEllipsis', true], ['emptyText', '-']].concat(_toConsumableArray(Object.entries(render).map(function (_ref5) {
|
187
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
188
|
+
k = _ref6[0],
|
189
|
+
v = _ref6[1];
|
190
|
+
|
191
|
+
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
192
|
+
record: record,
|
193
|
+
value: value
|
194
|
+
}))];
|
195
|
+
}))));
|
196
|
+
}; // 重写编辑逻辑替代field原有逻辑
|
197
|
+
|
118
198
|
|
119
199
|
if (isEdit) {
|
120
200
|
// 渲染表单
|
@@ -195,7 +275,8 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
195
275
|
}, /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
196
276
|
type: type,
|
197
277
|
value: value,
|
198
|
-
render: getRender()
|
278
|
+
render: getRender(),
|
279
|
+
dataSource: getDataSource()
|
199
280
|
}, others)), /*#__PURE__*/React.createElement(PopConfirm, {
|
200
281
|
visible: popConfirmVisible,
|
201
282
|
content: renderContent(),
|
@@ -226,7 +307,8 @@ var InfoValueItem = function InfoValueItem(props) {
|
|
226
307
|
}, /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
227
308
|
type: type,
|
228
309
|
value: value,
|
229
|
-
render: getRender()
|
310
|
+
render: getRender(),
|
311
|
+
dataSource: getDataSource()
|
230
312
|
}, others)), renderAction(), extra && extra);
|
231
313
|
};
|
232
314
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
2
2
|
import { ProInfoBaseProps, ProInfoTransparentBase } from '../../typing';
|
3
3
|
import './index.scss';
|
4
4
|
import { IUseInfoRequestResult } from '../../utils/useInfoRequest';
|
5
|
-
declare type ProBaseInfoProps = ProInfoBaseProps & IUseInfoRequestResult & ProInfoTransparentBase
|
5
|
+
declare type ProBaseInfoProps = ProInfoBaseProps & IUseInfoRequestResult & ProInfoTransparentBase & {
|
6
|
+
size?: any;
|
7
|
+
};
|
6
8
|
declare const ProBaseInfo: React.FC<ProBaseInfoProps>;
|
7
9
|
export default ProBaseInfo;
|