@teamix/pro 1.3.13 → 1.3.16
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 +5531 -720
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.js +40 -4
- package/es/actions/index.scss +13 -0
- package/es/form/Filter/LightFilter.js +7 -5
- package/es/form/Filter/index.js +171 -55
- package/es/form/Filter/layout.scss +4 -0
- package/es/form/Filter/useBindUrl.d.ts +2 -0
- package/es/form/Filter/useBindUrl.js +118 -0
- package/es/form/ProForm/index.d.ts +2 -3
- package/es/form/ProForm/index.js +51 -10
- package/es/form/ProForm/index.scss +7 -0
- package/es/form/ProForm/useFieldSchema.d.ts +7 -0
- package/es/form/ProForm/useFieldSchema.js +109 -0
- package/es/form/SchemaForm/index.js +2 -38
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -2
- package/es/form/SchemaForm/initializeDataSource.js +14 -19
- package/es/form/SchemaForm/initializeRequest.js +25 -26
- package/es/form/SchemaForm/initializeRules.d.ts +2 -2
- package/es/form/SchemaForm/initializeRules.js +30 -23
- package/es/form/SchemaForm/initializeSelectTable.js +80 -6
- package/es/form/SchemaForm/reactions.d.ts +4 -4
- package/es/form/SchemaForm/reactions.js +30 -23
- package/es/form/typing.d.ts +16 -6
- package/es/form/utils.d.ts +16 -1
- package/es/form/utils.js +21 -2
- package/es/global.scss +45 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -2
- package/es/page-header/index.d.ts +2 -0
- package/es/page-header/index.js +13 -3
- package/es/page-header/index.scss +8 -0
- package/es/table/components/Layout/index.scss +5 -5
- package/es/table/components/ToolBar/Fullscreen.d.ts +1 -1
- package/es/table/utils/pureColumnRender.d.ts +9 -0
- package/es/table/utils/pureColumnRender.js +201 -0
- package/es/table/utils/pureGenProColumnToColumn.d.ts +7 -0
- package/es/table/utils/pureGenProColumnToColumn.js +36 -0
- package/es/timeline/ProTimeLineItem/index.js +8 -5
- package/es/timeline/typing.d.ts +5 -0
- package/lib/actions/index.js +40 -4
- package/lib/actions/index.scss +13 -0
- package/lib/form/Filter/LightFilter.js +7 -6
- package/lib/form/Filter/index.js +172 -55
- package/lib/form/Filter/layout.scss +4 -0
- package/lib/form/Filter/useBindUrl.d.ts +2 -0
- package/lib/form/Filter/useBindUrl.js +129 -0
- package/lib/form/ProForm/index.d.ts +2 -3
- package/lib/form/ProForm/index.js +57 -9
- package/lib/form/ProForm/index.scss +7 -0
- package/lib/form/ProForm/useFieldSchema.d.ts +7 -0
- package/lib/form/ProForm/useFieldSchema.js +118 -0
- package/lib/form/SchemaForm/index.js +2 -45
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -2
- package/lib/form/SchemaForm/initializeDataSource.js +14 -19
- package/lib/form/SchemaForm/initializeRequest.js +26 -26
- package/lib/form/SchemaForm/initializeRules.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRules.js +30 -22
- package/lib/form/SchemaForm/initializeSelectTable.js +85 -6
- package/lib/form/SchemaForm/reactions.d.ts +4 -4
- package/lib/form/SchemaForm/reactions.js +30 -23
- package/lib/form/typing.d.ts +16 -6
- package/lib/form/utils.d.ts +16 -1
- package/lib/form/utils.js +23 -2
- package/lib/global.scss +45 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/lib/page-header/index.d.ts +2 -0
- package/lib/page-header/index.js +12 -2
- package/lib/page-header/index.scss +8 -0
- package/lib/table/components/Layout/index.scss +5 -5
- package/lib/table/components/ToolBar/Fullscreen.d.ts +1 -1
- package/lib/table/utils/pureColumnRender.d.ts +9 -0
- package/lib/table/utils/pureColumnRender.js +215 -0
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +7 -0
- package/lib/table/utils/pureGenProColumnToColumn.js +43 -0
- package/lib/timeline/ProTimeLineItem/index.js +8 -5
- package/lib/timeline/typing.d.ts +5 -0
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["extraConfig"];
|
1
|
+
var _excluded = ["extraConfig", "onComplete"];
|
2
2
|
|
3
3
|
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; }
|
4
4
|
|
@@ -12,26 +12,28 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
12
12
|
|
13
13
|
import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
|
14
14
|
|
15
|
-
var $request = function $request(field,
|
15
|
+
var $request = function $request(field, context, _ref, type) {
|
16
16
|
var _field$data;
|
17
17
|
|
18
18
|
var extraConfig = _ref.extraConfig,
|
19
|
-
|
19
|
+
onComplete = _ref.onComplete,
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
20
21
|
|
22
|
+
var requestConfig = rest;
|
21
23
|
var params = requestConfig.params,
|
22
24
|
beforeRequest = requestConfig.beforeRequest,
|
23
25
|
formatResult = requestConfig.formatResult,
|
24
26
|
onSuccess = requestConfig.onSuccess;
|
25
|
-
var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field, context) : {};
|
26
|
-
/**
|
27
|
-
* 主动触发的请求刷新
|
28
|
-
*/
|
29
|
-
// 触发所有配置的请求
|
27
|
+
var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field, context) : {}; // 通过字段 data 的 refresh 主动触发的请求刷新
|
30
28
|
|
31
29
|
var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
32
|
-
var refreshResult = isPlainObj(refresh) ? refresh : {};
|
30
|
+
var refreshResult = isPlainObj(refresh) ? refresh : {}; // 合并请求参数
|
31
|
+
|
32
|
+
var mergedParams = _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult); // 执行通用数据请求
|
33
|
+
|
34
|
+
|
33
35
|
return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
34
|
-
params:
|
36
|
+
params: mergedParams,
|
35
37
|
beforeRequest: function beforeRequest() {
|
36
38
|
return beforeRequestResult;
|
37
39
|
},
|
@@ -41,40 +43,45 @@ var $request = function $request(field, _ref, context, type) {
|
|
41
43
|
onSuccess: isFn(onSuccess) ? function (res) {
|
42
44
|
return onSuccess(res, field, context);
|
43
45
|
} : onSuccess
|
44
|
-
}), context)
|
46
|
+
}), _objectSpread(_objectSpread({}, context), {}, {
|
47
|
+
field: field,
|
48
|
+
params: mergedParams
|
49
|
+
}));
|
45
50
|
}; // 通用请求配置上下文
|
46
51
|
|
47
52
|
|
48
|
-
var $common = function $common(services,
|
53
|
+
var $common = function $common(services, context, requestConfig) {
|
49
54
|
return function (field) {
|
50
|
-
return services(field,
|
55
|
+
return services(field, context, requestConfig, 'request').then(function (res) {
|
51
56
|
var _requestConfig$onComp;
|
52
57
|
|
53
|
-
return (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
58
|
+
return requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
54
59
|
});
|
55
60
|
};
|
56
61
|
}; // 配置校验
|
57
62
|
|
58
63
|
|
59
|
-
var $validator = function $validator(services,
|
64
|
+
var $validator = function $validator(services, context, requestConfig) {
|
60
65
|
return function (value, rules, _ref2) {
|
61
66
|
var field = _ref2.field;
|
62
|
-
return services(field,
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
return services(field, context, requestConfig, 'validator').then(function (res) {
|
68
|
+
if (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.onComplete) {
|
69
|
+
return requestConfig.onComplete(res, field, context);
|
70
|
+
} else {
|
71
|
+
return res;
|
72
|
+
}
|
66
73
|
});
|
67
74
|
};
|
68
75
|
}; // 配置DataSource
|
69
76
|
|
70
77
|
|
71
|
-
var $dataSource = function $dataSource(services,
|
78
|
+
var $dataSource = function $dataSource(services, context, requestConfig) {
|
72
79
|
return function (field) {
|
73
80
|
field.setState({
|
74
81
|
loading: true
|
75
82
|
});
|
76
|
-
return services(field,
|
77
|
-
var _requestConfig$extraC, _requestConfig$
|
83
|
+
return services(field, context, requestConfig, 'dataSource').then(function (res) {
|
84
|
+
var _requestConfig$extraC, _requestConfig$onComp2;
|
78
85
|
|
79
86
|
var isValueInDataSource = getValueByValue(res, field.value);
|
80
87
|
var clearResult = !isValueInDataSource && (requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$extraC = requestConfig.extraConfig) === null || _requestConfig$extraC === void 0 ? void 0 : _requestConfig$extraC.clearInvalidValue) !== false ? {
|
@@ -84,7 +91,7 @@ var $dataSource = function $dataSource(services, requestConfig, context) {
|
|
84
91
|
dataSource: res,
|
85
92
|
loading: false
|
86
93
|
}, clearResult));
|
87
|
-
return (_requestConfig$
|
94
|
+
return requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$onComp2 = requestConfig.onComplete) === null || _requestConfig$onComp2 === void 0 ? void 0 : _requestConfig$onComp2.call(requestConfig, res, field, context);
|
88
95
|
}).catch(function () {
|
89
96
|
field.setState({
|
90
97
|
loading: false
|
package/es/form/typing.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { ReactNode } from 'react';
|
2
2
|
import type { IFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
|
3
3
|
import type { IFormLayoutProps } from '@teamix/formily';
|
4
|
-
import { CommonRequestConfig } from '@teamix/utils';
|
4
|
+
import type { CommonRequestConfig } from '@teamix/utils';
|
5
|
+
import type { UrlStateOptions } from '@teamix/hooks';
|
5
6
|
import React from 'react';
|
6
7
|
interface AnyObject {
|
7
8
|
[propName: string]: any;
|
@@ -18,12 +19,16 @@ declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker'
|
|
18
19
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
19
20
|
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';
|
20
21
|
declare type ILayoutComponent = 'FormFlex' | 'FormGrid' | 'FormGroup' | 'FormGroup.GroupPanel' | 'Search' | 'Search.SearchPanel' | 'FormTab' | 'FormTab.TabPane' | 'FormStep' | 'FormStep.StepPane' | 'FormCollapse' | 'FormCollapse.CollapsePanel' | 'FormButtonGroup' | 'FormDialog' | 'FormDrawer' | 'FormDialog.Footer' | 'FormDrawer.Footer';
|
21
|
-
export interface
|
22
|
+
export interface ProFormCommonRequestConfig extends CommonRequestConfig {
|
22
23
|
beforeRequest?: (field?: any, context?: any) => any;
|
23
24
|
formatResult?: (res?: any, field?: any, context?: any) => any;
|
24
25
|
onSuccess?: (res?: any, field?: any, context?: any) => any;
|
25
|
-
|
26
|
+
}
|
27
|
+
export interface ProFormRequestConfig extends Omit<ProFormCommonRequestConfig, 'url'> {
|
28
|
+
url?: string;
|
29
|
+
customRequest?: (field?: any, context?: any) => Promise<any>;
|
26
30
|
extraConfig?: AnyObject;
|
31
|
+
onComplete?: (res?: any, field?: any, context?: any) => any;
|
27
32
|
}
|
28
33
|
export interface ProFormSchemaItem {
|
29
34
|
type?: string;
|
@@ -56,7 +61,7 @@ export interface ProFormSchemaItem {
|
|
56
61
|
export declare type ProFormSchema = ProFormSchemaItem[];
|
57
62
|
export interface ProFormProps extends IFormLayoutProps {
|
58
63
|
form?: FormType | false;
|
59
|
-
schema
|
64
|
+
schema?: ProFormSchema;
|
60
65
|
scope?: any;
|
61
66
|
context?: any;
|
62
67
|
components?: {
|
@@ -64,7 +69,7 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
64
69
|
};
|
65
70
|
children?: React.ReactNode;
|
66
71
|
initialValues?: AnyObject;
|
67
|
-
initialRequest?:
|
72
|
+
initialRequest?: ProFormCommonRequestConfig;
|
68
73
|
previewTextPlaceholder?: ReactNode;
|
69
74
|
validateFirst?: boolean;
|
70
75
|
onChangeType?: 'form';
|
@@ -73,6 +78,9 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
73
78
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
74
79
|
onInitialComplete?: (form: FormType) => void;
|
75
80
|
}
|
81
|
+
export declare type ComposedProForm = React.FC<ProFormProps> & {
|
82
|
+
Field?: React.FC<any>;
|
83
|
+
};
|
76
84
|
export interface FilterProps extends ProFormProps {
|
77
85
|
form: FormType;
|
78
86
|
defaultFilterValue?: string;
|
@@ -117,8 +125,10 @@ export interface QueryFilterProps extends ProFormProps {
|
|
117
125
|
formRef?: React.MutableRefObject<any>;
|
118
126
|
/** onChange事件的防抖时间 */
|
119
127
|
filterDebounce?: number;
|
128
|
+
/** 绑定URL参数 */
|
129
|
+
bindUrl?: boolean | UrlStateOptions;
|
120
130
|
/** 表单初始化(含异步默认值)后回调函数 */
|
121
|
-
onInit?: (values: any) =>
|
131
|
+
onInit?: (values: any) => void;
|
122
132
|
/** 表单筛选回调函数 */
|
123
133
|
onFilter?: (values: any) => void;
|
124
134
|
/** 表单重置回调函数 */
|
package/es/form/utils.d.ts
CHANGED
@@ -37,4 +37,19 @@ declare const mapSchemaName: (obj: any) => any;
|
|
37
37
|
* @returns 合并数组或合并其他值
|
38
38
|
*/
|
39
39
|
declare const mergeArrayValue: (arr: any[], v?: any) => any[];
|
40
|
-
|
40
|
+
/**
|
41
|
+
* 初始化请求配置为表达式
|
42
|
+
* @param config 请求配置
|
43
|
+
* @param suffix scope名称后缀
|
44
|
+
* @returns 表达式和scope上下文
|
45
|
+
*/
|
46
|
+
declare const initializeRequestExpression: (config?: any, mode?: string | undefined, suffix?: string | undefined) => {
|
47
|
+
expression: string;
|
48
|
+
scope: {
|
49
|
+
[x: string]: object;
|
50
|
+
};
|
51
|
+
} | {
|
52
|
+
expression?: undefined;
|
53
|
+
scope?: undefined;
|
54
|
+
};
|
55
|
+
export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName, initializeRequestExpression, };
|
package/es/form/utils.js
CHANGED
@@ -26,7 +26,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
26
26
|
|
27
27
|
import { isVoidField } from '@formily/core';
|
28
28
|
import { useFormLayout, useFormShallowLayout } from '@teamix/formily';
|
29
|
-
import { isArr, isObj, getValueByValue } from '@teamix/utils';
|
29
|
+
import { isArr, isObj, getValueByValue, isPlainObj } from '@teamix/utils';
|
30
30
|
import schemaNameMap from './schemaNameMap';
|
31
31
|
/**
|
32
32
|
* 映射字段size,主要是default转medium
|
@@ -177,5 +177,24 @@ var mergeArrayValue = function mergeArrayValue(arr, v) {
|
|
177
177
|
|
178
178
|
return [].concat(_toConsumableArray(arr), [v]);
|
179
179
|
};
|
180
|
+
/**
|
181
|
+
* 初始化请求配置为表达式
|
182
|
+
* @param config 请求配置
|
183
|
+
* @param suffix scope名称后缀
|
184
|
+
* @returns 表达式和scope上下文
|
185
|
+
*/
|
186
|
+
|
187
|
+
|
188
|
+
var initializeRequestExpression = function initializeRequestExpression(config, mode, suffix) {
|
189
|
+
if (isPlainObj(config)) {
|
190
|
+
var requestConfigName = "$requestConfig_".concat(suffix);
|
191
|
+
return {
|
192
|
+
expression: "{{".concat(mode, "($request,context,").concat(requestConfigName, ")}}"),
|
193
|
+
scope: _defineProperty({}, requestConfigName, config)
|
194
|
+
};
|
195
|
+
}
|
196
|
+
|
197
|
+
return {};
|
198
|
+
};
|
180
199
|
|
181
|
-
export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName };
|
200
|
+
export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName, initializeRequestExpression };
|
package/es/global.scss
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
// transition 切换主题优化,暂时先写到 pro 里,后面加到基础组件里
|
2
|
+
|
3
|
+
// table 行背景色
|
4
|
+
tr.next-table-row{
|
5
|
+
transition: color 0s;
|
6
|
+
}
|
7
|
+
|
8
|
+
// normal 按钮
|
9
|
+
button.next-btn.next-medium.next-btn-normal {
|
10
|
+
transition: color 0s;
|
11
|
+
}
|
12
|
+
|
13
|
+
// input 背景色
|
14
|
+
.next-input.next-medium {
|
15
|
+
transition: color 0s;
|
16
|
+
}
|
17
|
+
|
18
|
+
// radio 背景色
|
19
|
+
.next-radio-wrapper.checked .next-radio-inner:after {
|
20
|
+
transition: color 0s;
|
21
|
+
}
|
22
|
+
|
23
|
+
.next-radio-wrapper .next-radio-inner {
|
24
|
+
transition: color 0s;
|
25
|
+
}
|
26
|
+
|
27
|
+
// checkbox 背景色
|
28
|
+
.next-checkbox-wrapper .next-checkbox-inner {
|
29
|
+
transition: color 0s;
|
30
|
+
}
|
31
|
+
|
32
|
+
// 侧导背景色
|
33
|
+
.next-menu-item.next-nav-item {
|
34
|
+
transition: color 0s;
|
35
|
+
}
|
36
|
+
|
37
|
+
// 标签背景色
|
38
|
+
.next-tag {
|
39
|
+
transition: color 0s;
|
40
|
+
}
|
41
|
+
|
42
|
+
// 可关闭tag
|
43
|
+
.next-tag.next-tag.next-tag.next-tag-closable.next-tag-level-normal.next-tag-closable {
|
44
|
+
transition: color 0s;
|
45
|
+
}
|
package/es/index.d.ts
CHANGED
@@ -13,6 +13,7 @@ import ProSidebar from './sidebar';
|
|
13
13
|
import { ProTimeline } from './timeline';
|
14
14
|
import * as nocode from './nocode';
|
15
15
|
import * as templates from './templates';
|
16
|
+
import './global.scss';
|
16
17
|
export * from './actions';
|
17
18
|
export * from './card';
|
18
19
|
export * from './field';
|
@@ -26,5 +27,5 @@ export * from './table';
|
|
26
27
|
export * from './sidebar';
|
27
28
|
export * from './utils';
|
28
29
|
export * from './timeline';
|
29
|
-
declare const version = "1.3.
|
30
|
+
declare const version = "1.3.16";
|
30
31
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -14,7 +14,8 @@ import ProSidebar from './sidebar';
|
|
14
14
|
import { ProTimeline } from './timeline';
|
15
15
|
import * as nocode from './nocode';
|
16
16
|
import * as templates from './templates';
|
17
|
-
import TeamixIcon from '@teamix/icon';
|
17
|
+
import TeamixIcon from '@teamix/icon';
|
18
|
+
import './global.scss'; // 设置图标源
|
18
19
|
|
19
20
|
TeamixIcon.setConfig(utils.getTeamixIconConfig());
|
20
21
|
export * from './actions';
|
@@ -31,6 +32,6 @@ export * from './sidebar';
|
|
31
32
|
export * from './utils'; // export * from './sidebar';
|
32
33
|
|
33
34
|
export * from './timeline';
|
34
|
-
var version = '1.3.
|
35
|
+
var version = '1.3.16';
|
35
36
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
36
37
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
|
package/es/page-header/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
var _excluded = ["text", "children"],
|
2
2
|
_excluded2 = ["color", "title", "num", "className"],
|
3
|
-
_excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
|
3
|
+
_excluded3 = ["title", "titleTooltip", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
|
4
4
|
|
5
5
|
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; }
|
6
6
|
|
@@ -16,13 +16,14 @@ import React from 'react';
|
|
16
16
|
import { useHistory } from 'react-router-dom';
|
17
17
|
import classnames from 'classnames';
|
18
18
|
import TeamixIcon from '@teamix/icon';
|
19
|
-
import { Breadcrumb } from '@alicloudfe/components';
|
19
|
+
import { Breadcrumb, Balloon } from '@alicloudfe/components';
|
20
20
|
import { baseClass, goToLink, renderTags, isPresetColor, getColor, getColorClassName, getBackgroundColorClassName, CapsuleTab } from '@teamix/utils';
|
21
21
|
import { ProActionGroup } from '../actions';
|
22
22
|
import { ProSkeletonRaw } from '../skeleton';
|
23
23
|
import ProInfo from '../info';
|
24
24
|
import './index.scss';
|
25
25
|
var cls = baseClass('teamix-pro-page-header');
|
26
|
+
var Tooltip = Balloon.Tooltip;
|
26
27
|
|
27
28
|
var renderNav = function renderNav(breadcrumbs) {
|
28
29
|
if (breadcrumbs && breadcrumbs.length) {
|
@@ -133,6 +134,7 @@ var renderTabs = function renderTabs(tabs) {
|
|
133
134
|
|
134
135
|
var ProPageHeader = function ProPageHeader(props) {
|
135
136
|
var title = props.title,
|
137
|
+
titleTooltip = props.titleTooltip,
|
136
138
|
description = props.description,
|
137
139
|
icon = props.icon,
|
138
140
|
iconColor = props.iconColor,
|
@@ -200,7 +202,15 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
200
202
|
size: "large"
|
201
203
|
}) : /*#__PURE__*/React.createElement(React.Fragment, null, icon)), /*#__PURE__*/React.createElement("span", {
|
202
204
|
className: cls('title-name')
|
203
|
-
}, title
|
205
|
+
}, title, titleTooltip && /*#__PURE__*/React.createElement(Tooltip, {
|
206
|
+
trigger: /*#__PURE__*/React.createElement("span", {
|
207
|
+
className: cls('title-tooltip-icon')
|
208
|
+
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
209
|
+
type: "info-circle-line",
|
210
|
+
size: "xs"
|
211
|
+
})),
|
212
|
+
align: "t"
|
213
|
+
}, titleTooltip)), renderTags(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
|
204
214
|
};
|
205
215
|
|
206
216
|
return /*#__PURE__*/React.createElement("header", _objectSpread({
|
@@ -43,6 +43,7 @@ $prefix: 'teamix-pro-page-header';
|
|
43
43
|
font-weight: 500;
|
44
44
|
align-items: center;
|
45
45
|
word-break: break-all;
|
46
|
+
color: var(--color-text1-4);
|
46
47
|
|
47
48
|
&-name {
|
48
49
|
white-space: nowrap;
|
@@ -50,6 +51,13 @@ $prefix: 'teamix-pro-page-header';
|
|
50
51
|
text-overflow: ellipsis;
|
51
52
|
}
|
52
53
|
|
54
|
+
&-tooltip-icon {
|
55
|
+
position: relative;
|
56
|
+
margin-left: 2px;
|
57
|
+
display: inline-flex;
|
58
|
+
top: -7px;
|
59
|
+
}
|
60
|
+
|
53
61
|
&-icon {
|
54
62
|
padding: var(--s-1, 4px);
|
55
63
|
}
|
@@ -32,11 +32,11 @@ $prefix: 'teamix-pro-table-layout';
|
|
32
32
|
&-filter-btn:not(:first-child) {
|
33
33
|
margin-left: 8px;
|
34
34
|
}
|
35
|
-
&-panel-filter {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
35
|
+
// &-panel-filter {
|
36
|
+
// margin: 8px 0;
|
37
|
+
// padding: 16px;
|
38
|
+
// background: var(--panel-filter-bg, var(--color-fill1-2));
|
39
|
+
// }
|
40
40
|
&-main-action {
|
41
41
|
margin-bottom: 8px;
|
42
42
|
}
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import './index.scss';
|
3
3
|
import { ProTableActionType } from '../../typing';
|
4
4
|
declare type ProTableFullScreenProps = {
|
5
|
-
children: React.ReactNode;
|
5
|
+
children: (isFullScreen: boolean) => React.ReactNode | React.ReactNode;
|
6
6
|
visible: boolean;
|
7
7
|
actionRef: React.MutableRefObject<ProTableActionType | undefined>;
|
8
8
|
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ProTableColumnProps } from '../typing';
|
2
|
+
/**
|
3
|
+
* 增加了 icon 的功能 render title
|
4
|
+
*/
|
5
|
+
export declare const renderColumnsTitle: (item: ProTableColumnProps) => JSX.Element;
|
6
|
+
/**
|
7
|
+
* 负责单元格的具体渲染
|
8
|
+
*/
|
9
|
+
export declare const renderCell: (value: any, item: ProTableColumnProps, index: number, record: any) => JSX.Element;
|
@@ -0,0 +1,201 @@
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
3
|
+
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."); }
|
4
|
+
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
+
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
12
|
+
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
14
|
+
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
16
|
+
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
18
|
+
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
24
|
+
|
25
|
+
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; }
|
26
|
+
|
27
|
+
/**
|
28
|
+
* 渲染列的逻辑函数,用于非 ProTable 比如 selectTable
|
29
|
+
*/
|
30
|
+
import React from 'react';
|
31
|
+
import { getTargetValue, LabelIconTip } from '@teamix/utils';
|
32
|
+
import ProField from '../../field';
|
33
|
+
/**
|
34
|
+
* 增加了 icon 的功能 render title
|
35
|
+
*/
|
36
|
+
|
37
|
+
export var renderColumnsTitle = function renderColumnsTitle(item) {
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
|
39
|
+
label: item.title,
|
40
|
+
tooltip: item.tooltip,
|
41
|
+
icon: item.tooltipIcon
|
42
|
+
}));
|
43
|
+
};
|
44
|
+
/**
|
45
|
+
* 负责单元格的具体渲染
|
46
|
+
*/
|
47
|
+
|
48
|
+
export var renderCell = function renderCell(value, item, index, record) {
|
49
|
+
var _item$valueType = item.valueType,
|
50
|
+
valueType = _item$valueType === void 0 ? 'text' : _item$valueType,
|
51
|
+
render = item.render,
|
52
|
+
dataIndex = item.dataIndex,
|
53
|
+
format = item.format; // 如果没传 dataIndex,返回 null
|
54
|
+
|
55
|
+
if (!dataIndex) {
|
56
|
+
value = null;
|
57
|
+
} // 处理 dataIndex 为数组的情况
|
58
|
+
|
59
|
+
|
60
|
+
if (Array.isArray(dataIndex)) {
|
61
|
+
value = dataIndex.map(function (item) {
|
62
|
+
return getTargetValue("{{".concat(item, "}}"), _objectSpread(_objectSpread({}, record), {}, {
|
63
|
+
record: record
|
64
|
+
}));
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
var newRender = null;
|
69
|
+
var newDataSource = null;
|
70
|
+
var props = item.props; // 如果 render 直接传函数
|
71
|
+
|
72
|
+
if (typeof render === 'function') {
|
73
|
+
newRender = function newRender() {
|
74
|
+
return render === null || render === void 0 ? void 0 : render(value, index, record);
|
75
|
+
};
|
76
|
+
} else {
|
77
|
+
newRender = processBuriedPoint(processRenderFunction(render, value, index, record), record, value, index);
|
78
|
+
|
79
|
+
if (valueType === 'selectGroup') {
|
80
|
+
newRender = _objectSpread(_objectSpread({
|
81
|
+
maxShowNumber: 'auto',
|
82
|
+
foldText: 'more',
|
83
|
+
editOnClick: function editOnClick() {},
|
84
|
+
edit: true
|
85
|
+
}, newRender), {}, {
|
86
|
+
ellipsis: false
|
87
|
+
});
|
88
|
+
props = _objectSpread({
|
89
|
+
valueAlias: {
|
90
|
+
value: 'TagValue',
|
91
|
+
key: 'TagKey'
|
92
|
+
}
|
93
|
+
}, props);
|
94
|
+
}
|
95
|
+
|
96
|
+
if ((render === null || render === void 0 ? void 0 : render.type) === 'step') {
|
97
|
+
newRender = _objectSpread(_objectSpread({}, newRender), {}, {
|
98
|
+
ellipsis: false
|
99
|
+
});
|
100
|
+
}
|
101
|
+
} // dataSource可传函数
|
102
|
+
|
103
|
+
|
104
|
+
if (typeof item.dataSource === 'function') {
|
105
|
+
var _item$dataSource;
|
106
|
+
|
107
|
+
newDataSource = (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.call(item, value, index, record);
|
108
|
+
} else {
|
109
|
+
var _item$dataSource2;
|
110
|
+
|
111
|
+
newDataSource = ((_item$dataSource2 = item.dataSource) !== null && _item$dataSource2 !== void 0 ? _item$dataSource2 : []).map(function (item) {
|
112
|
+
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
113
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
114
|
+
k = _ref2[0],
|
115
|
+
v = _ref2[1];
|
116
|
+
|
117
|
+
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
118
|
+
record: record,
|
119
|
+
value: value,
|
120
|
+
index: index
|
121
|
+
}))];
|
122
|
+
}));
|
123
|
+
});
|
124
|
+
} // 渲染 ProField
|
125
|
+
|
126
|
+
|
127
|
+
return /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
128
|
+
type: valueType || 'text',
|
129
|
+
value: value,
|
130
|
+
render: newRender,
|
131
|
+
dataSource: newDataSource,
|
132
|
+
format: format
|
133
|
+
}, props));
|
134
|
+
};
|
135
|
+
/**
|
136
|
+
* 处理 render 配置项是函数的情况
|
137
|
+
* @param render ProFieldRender
|
138
|
+
* @param value table cell value
|
139
|
+
* @param index table cell index
|
140
|
+
* @param record table cell record
|
141
|
+
* @returns
|
142
|
+
*/
|
143
|
+
|
144
|
+
var processRenderFunction = function processRenderFunction() {
|
145
|
+
var render = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
146
|
+
var value = arguments.length > 1 ? arguments[1] : undefined;
|
147
|
+
var index = arguments.length > 2 ? arguments[2] : undefined;
|
148
|
+
var record = arguments.length > 3 ? arguments[3] : undefined;
|
149
|
+
// 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
|
150
|
+
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
|
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, index, record].concat(others));
|
166
|
+
}];
|
167
|
+
}
|
168
|
+
|
169
|
+
return [k, (_v = v === null || v === void 0 ? void 0 : v(value, index, 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() {
|
184
|
+
var render = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
185
|
+
var record = arguments.length > 1 ? arguments[1] : undefined;
|
186
|
+
var value = arguments.length > 2 ? arguments[2] : undefined;
|
187
|
+
var index = arguments.length > 3 ? arguments[3] : undefined;
|
188
|
+
return Object.fromEntries([// 默认 ellipsis、descriptionEllipsis 为 true
|
189
|
+
// emptyText 默认为 '-'
|
190
|
+
['ellipsis', true], ['descriptionEllipsis', true], ['emptyText', '-']].concat(_toConsumableArray(Object.entries(render).map(function (_ref5) {
|
191
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
192
|
+
k = _ref6[0],
|
193
|
+
v = _ref6[1];
|
194
|
+
|
195
|
+
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
196
|
+
record: record,
|
197
|
+
value: value,
|
198
|
+
index: index
|
199
|
+
}))];
|
200
|
+
}))));
|
201
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { ProTableColumnProps } from '../typing';
|
2
|
+
import { ColumnProps } from '@alicloudfe/components/types/table';
|
3
|
+
/**
|
4
|
+
* ProColumn => Column,去掉操作列,过滤器相关逻辑
|
5
|
+
* 用于非 ProTable 比如 selectTable
|
6
|
+
*/
|
7
|
+
export default function genProColumnToColumn(columns: ProTableColumnProps[]): ColumnProps[];
|