@teamix/pro 1.3.0 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.css +1 -1
- package/dist/pro.js +1207 -266
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +9 -4
- package/es/actions/dialog-form.js +16 -9
- package/es/form/Components/LightFilter/index.d.ts +1 -0
- package/es/form/Components/LightFilter/index.js +9 -6
- package/es/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/es/form/Components/ProField/mapDateFormat.js +113 -0
- package/es/form/Filter/LightFilter.js +13 -3
- package/es/form/Filter/SimpleFilter.js +1 -1
- package/es/form/Filter/index.js +44 -10
- package/es/form/ProForm/customComponent.js +2 -1
- package/es/form/SchemaForm/adapterDecorator.js +1 -1
- package/es/form/SchemaForm/adapterType.js +2 -5
- package/es/form/SchemaForm/index.js +26 -12
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeSelectTable.d.ts +3 -0
- package/es/form/SchemaForm/initializeSelectTable.js +38 -0
- package/es/form/SchemaForm/reactions.d.ts +1 -1
- package/es/form/SchemaForm/reactions.js +28 -33
- package/es/form/fieldTypeMap.d.ts +3 -0
- package/es/form/fieldTypeMap.js +3 -0
- package/es/form/typing.d.ts +9 -1
- package/es/form/utils.js +11 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/baseInfo/index.scss +3 -0
- package/es/page-header/index.d.ts +3 -1
- package/es/page-header/index.js +17 -4
- package/es/table/components/ToolBar/DensityIcon.js +5 -3
- package/es/table/components/ToolBar/FilterColumnIcon.js +12 -3
- package/es/table/components/ToolBar/index.scss +3 -3
- package/es/table/index.js +27 -12
- package/es/table/index.scss +16 -0
- package/es/table/typing.d.ts +12 -7
- package/es/table/utils/columnRender.js +6 -0
- package/lib/actions/dialog-form.d.ts +9 -4
- package/lib/actions/dialog-form.js +16 -9
- package/lib/form/Components/LightFilter/index.d.ts +1 -0
- package/lib/form/Components/LightFilter/index.js +9 -6
- package/lib/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/lib/form/Components/ProField/mapDateFormat.js +125 -0
- package/lib/form/Filter/LightFilter.js +13 -3
- package/lib/form/Filter/SimpleFilter.js +1 -1
- package/lib/form/Filter/index.js +44 -10
- package/lib/form/ProForm/customComponent.js +3 -1
- package/lib/form/SchemaForm/adapterDecorator.js +1 -1
- package/lib/form/SchemaForm/adapterType.js +2 -5
- package/lib/form/SchemaForm/index.js +27 -11
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeSelectTable.d.ts +3 -0
- package/lib/form/SchemaForm/initializeSelectTable.js +45 -0
- package/lib/form/SchemaForm/reactions.d.ts +1 -1
- package/lib/form/SchemaForm/reactions.js +28 -33
- package/lib/form/fieldTypeMap.d.ts +3 -0
- package/lib/form/fieldTypeMap.js +5 -1
- package/lib/form/typing.d.ts +9 -1
- package/lib/form/utils.js +11 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/baseInfo/index.scss +3 -0
- package/lib/page-header/index.d.ts +3 -1
- package/lib/page-header/index.js +16 -3
- package/lib/table/components/ToolBar/DensityIcon.js +5 -3
- package/lib/table/components/ToolBar/FilterColumnIcon.js +11 -2
- package/lib/table/components/ToolBar/index.scss +3 -3
- package/lib/table/index.js +27 -12
- package/lib/table/index.scss +16 -0
- package/lib/table/typing.d.ts +12 -7
- package/lib/table/utils/columnRender.js +6 -0
- package/package.json +4 -4
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _excluded = ["name", "title", "children"];
|
8
|
+
|
9
|
+
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; }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
13
|
+
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; }
|
14
|
+
|
15
|
+
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; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
var initializeTableColumn = function initializeTableColumn(item) {
|
20
|
+
var name = item.name,
|
21
|
+
title = item.title,
|
22
|
+
children = item.children,
|
23
|
+
otherProps = _objectWithoutProperties(item, _excluded);
|
24
|
+
|
25
|
+
return {
|
26
|
+
name: name,
|
27
|
+
title: title,
|
28
|
+
component: 'SelectTable.Column',
|
29
|
+
children: children,
|
30
|
+
props: _objectSpread({}, otherProps)
|
31
|
+
};
|
32
|
+
};
|
33
|
+
|
34
|
+
var initialize = function initialize(item) {
|
35
|
+
var _item$children = item.children,
|
36
|
+
children = _item$children === void 0 ? [] : _item$children;
|
37
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
38
|
+
children: children.map(function (item) {
|
39
|
+
return initializeTableColumn(item);
|
40
|
+
})
|
41
|
+
});
|
42
|
+
};
|
43
|
+
|
44
|
+
var _default = initialize;
|
45
|
+
exports.default = _default;
|
@@ -2,5 +2,5 @@ import type { ProFormRequestConfig } from '../typing';
|
|
2
2
|
declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any, type: 'request' | 'validator' | 'dataSource') => Promise<unknown>;
|
3
3
|
declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
|
4
4
|
declare const $validator: (services: any, requestConfig: ProFormRequestConfig, context: any) => (value: any, rules: any, { field }: any) => any;
|
5
|
-
declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any
|
5
|
+
declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
|
6
6
|
export { $request, $common, $dataSource, $validator };
|
@@ -17,21 +17,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
17
17
|
var $request = function $request(field, requestConfig, context, type) {
|
18
18
|
var _field$data;
|
19
19
|
|
20
|
-
var
|
20
|
+
var params = requestConfig.params,
|
21
|
+
beforeRequest = requestConfig.beforeRequest,
|
22
|
+
formatResult = requestConfig.formatResult,
|
21
23
|
onSuccess = requestConfig.onSuccess;
|
22
24
|
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {};
|
23
25
|
/**
|
24
|
-
*
|
26
|
+
* 主动触发的请求刷新
|
25
27
|
*/
|
26
28
|
// 触发所有配置的请求
|
27
29
|
|
28
30
|
var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
29
31
|
var refreshResult = (0, _utils.isPureObj)(refresh) ? refresh : {};
|
30
32
|
return (0, _utils.doCommonRequest)(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
31
|
-
params: _objectSpread(_objectSpread(_objectSpread({},
|
33
|
+
params: _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult),
|
32
34
|
beforeRequest: function beforeRequest() {
|
33
35
|
return beforeRequestResult;
|
34
36
|
},
|
37
|
+
formatResult: (0, _utils.isFn)(formatResult) ? function (res) {
|
38
|
+
return formatResult(res, field, context);
|
39
|
+
} : formatResult,
|
35
40
|
onSuccess: (0, _utils.isFn)(onSuccess) ? function (res) {
|
36
41
|
return onSuccess(res, field, context);
|
37
42
|
} : onSuccess
|
@@ -44,7 +49,9 @@ exports.$request = $request;
|
|
44
49
|
var $common = function $common(services, requestConfig, context) {
|
45
50
|
return function (field) {
|
46
51
|
return services(field, requestConfig, context, 'request').then(function (res) {
|
47
|
-
|
52
|
+
var _requestConfig$onComp;
|
53
|
+
|
54
|
+
return (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
48
55
|
});
|
49
56
|
};
|
50
57
|
}; // 配置校验
|
@@ -56,7 +63,9 @@ var $validator = function $validator(services, requestConfig, context) {
|
|
56
63
|
return function (value, rules, _ref) {
|
57
64
|
var field = _ref.field;
|
58
65
|
return services(field, requestConfig, context, 'validator').then(function (res) {
|
59
|
-
|
66
|
+
var _requestConfig$onComp2;
|
67
|
+
|
68
|
+
return (_requestConfig$onComp2 = requestConfig.onComplete) === null || _requestConfig$onComp2 === void 0 ? void 0 : _requestConfig$onComp2.call(requestConfig, res, field, context);
|
60
69
|
});
|
61
70
|
};
|
62
71
|
}; // 配置DataSource
|
@@ -64,41 +73,27 @@ var $validator = function $validator(services, requestConfig, context) {
|
|
64
73
|
|
65
74
|
exports.$validator = $validator;
|
66
75
|
|
67
|
-
var $dataSource = function $dataSource(services, requestConfig, context
|
76
|
+
var $dataSource = function $dataSource(services, requestConfig, context) {
|
68
77
|
return function (field) {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
readOnly: true
|
73
|
-
});
|
74
|
-
}
|
75
|
-
|
78
|
+
field.setState({
|
79
|
+
loading: true
|
80
|
+
});
|
76
81
|
return services(field, requestConfig, context, 'dataSource').then(function (res) {
|
82
|
+
var _requestConfig$onComp3;
|
83
|
+
|
77
84
|
var isValueInDataSource = (0, _utils.getValueByValue)(res, field.value);
|
78
85
|
var clearValue = isValueInDataSource ? {} : {
|
79
86
|
value: undefined
|
80
87
|
};
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
readOnly: false
|
87
|
-
}, clearValue));
|
88
|
-
} else {
|
89
|
-
field.setState({
|
90
|
-
dataSource: res
|
91
|
-
});
|
92
|
-
}
|
93
|
-
|
94
|
-
return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
|
88
|
+
field.setState(_objectSpread({
|
89
|
+
dataSource: res,
|
90
|
+
loading: false
|
91
|
+
}, clearValue));
|
92
|
+
return (_requestConfig$onComp3 = requestConfig.onComplete) === null || _requestConfig$onComp3 === void 0 ? void 0 : _requestConfig$onComp3.call(requestConfig, res, field, context);
|
95
93
|
}).catch(function () {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
readOnly: false
|
100
|
-
});
|
101
|
-
}
|
94
|
+
field.setState({
|
95
|
+
loading: false
|
96
|
+
});
|
102
97
|
});
|
103
98
|
};
|
104
99
|
};
|
package/lib/form/fieldTypeMap.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default = void 0;
|
6
|
+
exports.timePicker2TypeArray = exports.default = exports.datePicker2TypeArray = void 0;
|
7
7
|
var fieldTypeMap = {
|
8
8
|
Input: 'text',
|
9
9
|
Password: 'password',
|
@@ -46,5 +46,9 @@ var fieldTypeMap = {
|
|
46
46
|
Search: 'search',
|
47
47
|
SelectGroup: 'selectGroup'
|
48
48
|
};
|
49
|
+
var datePicker2TypeArray = ['DatePicker', 'DateTimePicker', 'WeekPicker', 'MonthPicker', 'YearPicker', 'QuarterPicker', 'DateRangePicker', 'DateTimeRangePicker', 'WeekRangePicker', 'MonthRangePicker', 'YearRangePicker', 'QuarterRangePicker'];
|
50
|
+
exports.datePicker2TypeArray = datePicker2TypeArray;
|
51
|
+
var timePicker2TypeArray = ['TimePicker', 'TimeRangePicker'];
|
52
|
+
exports.timePicker2TypeArray = timePicker2TypeArray;
|
49
53
|
var _default = fieldTypeMap;
|
50
54
|
exports.default = _default;
|
package/lib/form/typing.d.ts
CHANGED
@@ -10,12 +10,17 @@ declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
|
|
10
10
|
export interface ProFormInitializeItem {
|
11
11
|
(item: ProFormSchemaItem, props?: any): ProFormSchemaItem;
|
12
12
|
}
|
13
|
-
|
13
|
+
/**
|
14
|
+
* ProForm 实例类型
|
15
|
+
*/
|
16
|
+
export declare type ProFormType = FormType;
|
17
|
+
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';
|
14
18
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
15
19
|
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';
|
16
20
|
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';
|
17
21
|
export interface ProFormRequestConfig extends CommonRequestConfig {
|
18
22
|
beforeRequest?: (field?: any, context?: any) => any;
|
23
|
+
formatResult?: (res?: any, field?: any, context?: any) => any;
|
19
24
|
onSuccess?: (res?: any, field?: any, context?: any) => any;
|
20
25
|
onComplete?: (res?: any, field?: any, context?: any) => any;
|
21
26
|
}
|
@@ -68,6 +73,7 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
68
73
|
export interface FilterProps extends ProFormProps {
|
69
74
|
form: FormType;
|
70
75
|
defaultFilterValue?: string;
|
76
|
+
filterValues?: string[];
|
71
77
|
activeFilterValueRef?: React.MutableRefObject<any>;
|
72
78
|
forceClear?: boolean;
|
73
79
|
onReset?: (payload?: any) => void;
|
@@ -102,6 +108,8 @@ export interface QueryFilterProps extends ProFormProps {
|
|
102
108
|
addonAfter?: ReactNode;
|
103
109
|
/** 顶部筛选区默认筛选项 */
|
104
110
|
defaultFilterValue?: string;
|
111
|
+
/** 顶部筛选区筛选项配置 */
|
112
|
+
filterValues?: string[];
|
105
113
|
/** 透出内部表单实例 */
|
106
114
|
formRef?: React.MutableRefObject<any>;
|
107
115
|
/** onChange事件的防抖时间 */
|
package/lib/form/utils.js
CHANGED
@@ -86,9 +86,16 @@ var mapStatus = function mapStatus(props, field) {
|
|
86
86
|
return state;
|
87
87
|
};
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
var state = takeState(props.state) || takeStatus();
|
90
|
+
var result = {
|
91
|
+
state: state
|
92
|
+
}; // 当组件处于loading状态时,仅可读不可写。
|
93
|
+
|
94
|
+
if (state === 'loading') {
|
95
|
+
result.readOnly = true;
|
96
|
+
}
|
97
|
+
|
98
|
+
return _objectSpread(_objectSpread({}, props), result);
|
92
99
|
};
|
93
100
|
|
94
101
|
exports.mapStatus = mapStatus;
|
@@ -108,7 +115,7 @@ var patchDataSource = function patchDataSource() {
|
|
108
115
|
return result;
|
109
116
|
};
|
110
117
|
|
111
|
-
return dataSource.map(removeEmptyChildren);
|
118
|
+
return (0, _utils.isArr)(dataSource) ? dataSource.map(removeEmptyChildren) : [];
|
112
119
|
};
|
113
120
|
|
114
121
|
var mapDataSource = function mapDataSource(props, field) {
|
package/lib/index.d.ts
CHANGED
@@ -24,5 +24,5 @@ export * from './skeleton';
|
|
24
24
|
export * from './table';
|
25
25
|
export * from './utils';
|
26
26
|
export * from './timeline';
|
27
|
-
declare const version = "1.3.
|
27
|
+
declare const version = "1.3.3";
|
28
28
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ItemProps } from '@alicloudfe/components/types/breadcrumb';
|
3
|
-
import { LinkPath, ProTagItem } from '@teamix/utils';
|
3
|
+
import { LinkPath, ProTagItem, CapsuleTabType } from '@teamix/utils';
|
4
4
|
import { ProActionGroupProps } from '../actions';
|
5
5
|
import { ProInfoProps } from '../info';
|
6
6
|
import './index.scss';
|
@@ -48,6 +48,8 @@ export declare type ProPageHeaderProps = {
|
|
48
48
|
data?: ProPageHeaderDataItem[];
|
49
49
|
/** 底部详情 */
|
50
50
|
info?: ProInfoProps | React.ReactNode;
|
51
|
+
/** 切换 tabs */
|
52
|
+
tabs?: CapsuleTabType;
|
51
53
|
} & Omit<React.HTMLAttributes<HTMLElement>, 'title'>;
|
52
54
|
declare const ProPageHeader: React.FC<ProPageHeaderProps>;
|
53
55
|
export default ProPageHeader;
|
package/lib/page-header/index.js
CHANGED
@@ -27,7 +27,7 @@ require("./index.scss");
|
|
27
27
|
|
28
28
|
var _excluded = ["text", "children"],
|
29
29
|
_excluded2 = ["color", "title", "num", "className"],
|
30
|
-
_excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
|
30
|
+
_excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
|
31
31
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
33
|
|
@@ -89,7 +89,11 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
89
89
|
var isBgColorPresetColor = (0, _utils.isPresetColor)(backgroundColor);
|
90
90
|
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat((0, _utils.getColorClassName)(color)), isColorPresetColor), _defineProperty(_classnames, "".concat((0, _utils.getBackgroundColorClassName)(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
91
91
|
var styleColor = isColorPresetColor ? (0, _utils.getColor)(color) : color;
|
92
|
-
var styleBgColor = isBgColorPresetColor ? (0, _utils.getColor)(
|
92
|
+
var styleBgColor = isBgColorPresetColor ? (0, _utils.getColor)(backgroundColor) : backgroundColor; // debugger;
|
93
|
+
// console.log('color', color);
|
94
|
+
// console.log('backgroundColor', backgroundColor);
|
95
|
+
// console.log('styleBgColor', styleBgColor);
|
96
|
+
|
93
97
|
var style = {
|
94
98
|
color: styleColor,
|
95
99
|
backgroundColor: styleBgColor
|
@@ -138,6 +142,14 @@ var renderInfo = function renderInfo(info) {
|
|
138
142
|
return info;
|
139
143
|
};
|
140
144
|
|
145
|
+
var renderTabs = function renderTabs(tabs) {
|
146
|
+
if (tabs) {
|
147
|
+
return /*#__PURE__*/_react.default.createElement(_utils.CapsuleTab, _objectSpread({}, tabs));
|
148
|
+
}
|
149
|
+
|
150
|
+
return null;
|
151
|
+
};
|
152
|
+
|
141
153
|
var ProPageHeader = function ProPageHeader(props) {
|
142
154
|
var title = props.title,
|
143
155
|
description = props.description,
|
@@ -158,6 +170,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
158
170
|
children = props.children,
|
159
171
|
className = props.className,
|
160
172
|
style = props.style,
|
173
|
+
tabs = props.tabs,
|
161
174
|
others = _objectWithoutProperties(props, _excluded3);
|
162
175
|
|
163
176
|
var history = (0, _reactRouterDom.useHistory)();
|
@@ -206,7 +219,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
206
219
|
size: "large"
|
207
220
|
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon)), /*#__PURE__*/_react.default.createElement("span", {
|
208
221
|
className: cls('title-name')
|
209
|
-
}, title), (0, _utils.renderTags)(tags, 'large'));
|
222
|
+
}, title), (0, _utils.renderTags)(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
|
210
223
|
};
|
211
224
|
|
212
225
|
return /*#__PURE__*/_react.default.createElement("header", _objectSpread({
|
@@ -39,9 +39,11 @@ var RadioItem = _components.Menu.RadioItem;
|
|
39
39
|
var cls = (0, _utils.baseClass)('teamix-pro-table-toolbar-icon');
|
40
40
|
|
41
41
|
var DensityIcon = function DensityIcon(props) {
|
42
|
+
var _actionRef$current;
|
43
|
+
|
42
44
|
var actionRef = props.actionRef;
|
43
45
|
|
44
|
-
var _useState = (0, _react.useState)('medium'),
|
46
|
+
var _useState = (0, _react.useState)(((_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : _actionRef$current.size) || 'medium'),
|
45
47
|
_useState2 = _slicedToArray(_useState, 2),
|
46
48
|
size = _useState2[0],
|
47
49
|
setSize = _useState2[1]; // const [fullscreen, setFullscreen] = useState<boolean>(false);
|
@@ -61,10 +63,10 @@ var DensityIcon = function DensityIcon(props) {
|
|
61
63
|
|
62
64
|
|
63
65
|
var radioOnchange = function radioOnchange(mode) {
|
64
|
-
var _actionRef$
|
66
|
+
var _actionRef$current2, _actionRef$current2$s;
|
65
67
|
|
66
68
|
setSize(mode);
|
67
|
-
(_actionRef$
|
69
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setSize) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, mode);
|
68
70
|
}; // // 销毁监听函数
|
69
71
|
// useEffect(() => {
|
70
72
|
// return () => {
|
@@ -54,9 +54,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
54
54
|
var CheckboxItem = _components.Menu.CheckboxItem;
|
55
55
|
var Row = _components.Grid.Row,
|
56
56
|
Col = _components.Grid.Col;
|
57
|
-
var cls = (0, _utils.baseClass)('teamix-pro-table-toolbar-filter-column');
|
57
|
+
var cls = (0, _utils.baseClass)('teamix-pro-table-toolbar-filter-column'); // 判断是否是 root 组织
|
58
|
+
|
59
|
+
var isRoot = (0, _utils.getCookie)('organizationId') === '1';
|
58
60
|
|
59
61
|
var processColumns = function processColumns(columns) {
|
62
|
+
if (isRoot) {
|
63
|
+
// root 组织下不显示标签管理
|
64
|
+
columns = columns.filter(function (item) {
|
65
|
+
return item.valueType !== 'selectGroup';
|
66
|
+
});
|
67
|
+
}
|
68
|
+
|
60
69
|
return columns.map(function (item) {
|
61
70
|
if (item.columnFilters === false) {
|
62
71
|
return item;
|
@@ -313,7 +322,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
313
322
|
return onChangeColumns(check, dataIndex);
|
314
323
|
},
|
315
324
|
disabled: columnFiltersDisabled
|
316
|
-
}, title, !lock && /*#__PURE__*/_react.default.createElement("div", {
|
325
|
+
}, title, !lock && !columnFiltersDisabled && /*#__PURE__*/_react.default.createElement("div", {
|
317
326
|
className: cls({
|
318
327
|
sort: true
|
319
328
|
})
|
@@ -27,9 +27,9 @@
|
|
27
27
|
line-height: var(--checkbox-size,16px);
|
28
28
|
}
|
29
29
|
}
|
30
|
-
&-reset {
|
30
|
+
&-reset.next-btn {
|
31
31
|
position: absolute;
|
32
|
-
right:
|
32
|
+
right: 0px;
|
33
33
|
top: 6px;
|
34
34
|
}
|
35
35
|
// .next-menu {
|
@@ -59,7 +59,7 @@
|
|
59
59
|
.teamix-pro-table-toolbar-filter-column-sort {
|
60
60
|
visibility: hidden;
|
61
61
|
position: absolute;
|
62
|
-
right:
|
62
|
+
right: 0px;
|
63
63
|
top: 0;
|
64
64
|
color: var(--color-text1-7);
|
65
65
|
i {
|
package/lib/table/index.js
CHANGED
@@ -55,7 +55,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
55
55
|
}
|
56
56
|
});
|
57
57
|
});
|
58
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
|
58
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll"];
|
59
59
|
|
60
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
61
61
|
|
@@ -220,6 +220,11 @@ var ProTable = function ProTable(props) {
|
|
220
220
|
_props$filterColumnTy = props.filterColumnType,
|
221
221
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
222
222
|
defaultFilterParams = props.defaultFilterParams,
|
223
|
+
_props$reserveSelecte = props.reserveSelectedRecords,
|
224
|
+
reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
|
225
|
+
_props$size = props.size,
|
226
|
+
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
227
|
+
disableSelectAll = props.disableSelectAll,
|
223
228
|
otherProps = _objectWithoutProperties(props, _excluded);
|
224
229
|
|
225
230
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -273,7 +278,7 @@ var ProTable = function ProTable(props) {
|
|
273
278
|
filteredColumns = _useState16[0],
|
274
279
|
setFilteredColumns = _useState16[1];
|
275
280
|
|
276
|
-
var _useState17 = (0, _react.useState)(
|
281
|
+
var _useState17 = (0, _react.useState)(propsSize),
|
277
282
|
_useState18 = _slicedToArray(_useState17, 2),
|
278
283
|
size = _useState18[0],
|
279
284
|
_setSize = _useState18[1];
|
@@ -383,7 +388,7 @@ var ProTable = function ProTable(props) {
|
|
383
388
|
result = propsRowSelection.getProps(record, index);
|
384
389
|
}
|
385
390
|
|
386
|
-
if (showSkeleton) {
|
391
|
+
if (showSkeleton && result) {
|
387
392
|
result.disabled = true;
|
388
393
|
}
|
389
394
|
|
@@ -396,7 +401,7 @@ var ProTable = function ProTable(props) {
|
|
396
401
|
result = propsRowSelection.titleProps();
|
397
402
|
}
|
398
403
|
|
399
|
-
if (showSkeleton) {
|
404
|
+
if (showSkeleton || disableSelectAll) {
|
400
405
|
result.disabled = true;
|
401
406
|
}
|
402
407
|
|
@@ -431,7 +436,7 @@ var ProTable = function ProTable(props) {
|
|
431
436
|
return selectedRowKeys.includes(k);
|
432
437
|
});
|
433
438
|
return {
|
434
|
-
disabled: showLoading && !showSkeleton && (getData.loading || props.loading),
|
439
|
+
disabled: disableSelectAll || showLoading && !showSkeleton && (getData.loading || props.loading),
|
435
440
|
onChange: function onChange(check) {
|
436
441
|
if (check) {
|
437
442
|
var result = selectedRowKeys.concat([]);
|
@@ -535,6 +540,7 @@ var ProTable = function ProTable(props) {
|
|
535
540
|
(0, _utils2.emit)('refreshFilterState', newColumns);
|
536
541
|
}
|
537
542
|
},
|
543
|
+
size: size,
|
538
544
|
setSize: function setSize(mode) {
|
539
545
|
_setSize(mode);
|
540
546
|
},
|
@@ -904,21 +910,30 @@ var ProTable = function ProTable(props) {
|
|
904
910
|
|
905
911
|
var renderFooter = function renderFooter() {
|
906
912
|
function onChangePagination(currentPage) {
|
907
|
-
var _actionRef$current7, _actionRef$current7$c;
|
908
|
-
|
909
913
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
910
|
-
|
911
|
-
|
914
|
+
|
915
|
+
// 翻页默认清空选择
|
916
|
+
if (!reserveSelectedRecords) {
|
917
|
+
var _actionRef$current7, _actionRef$current7$c;
|
918
|
+
|
919
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
920
|
+
}
|
921
|
+
|
912
922
|
setCurrentPage(currentPage);
|
913
923
|
|
914
924
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
915
925
|
}
|
916
926
|
|
917
927
|
function onChangePaginationSize(currentPageSize) {
|
918
|
-
var
|
928
|
+
var _request5;
|
929
|
+
|
930
|
+
// 翻页默认清空选择
|
931
|
+
if (!reserveSelectedRecords) {
|
932
|
+
var _actionRef$current8, _actionRef$current8$c;
|
933
|
+
|
934
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
935
|
+
}
|
919
936
|
|
920
|
-
// 翻页暂时先清空选择
|
921
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
922
937
|
setPageSize(currentPageSize);
|
923
938
|
setCurrentPage(1);
|
924
939
|
|
package/lib/table/index.scss
CHANGED
@@ -118,4 +118,20 @@ $fullscreenPadding: 24px;
|
|
118
118
|
|
119
119
|
.mb8 {
|
120
120
|
margin-bottom: 8px;
|
121
|
+
}
|
122
|
+
|
123
|
+
.next-table {
|
124
|
+
.next-form-preview.next-form-preview {
|
125
|
+
line-height: unset;
|
126
|
+
}
|
127
|
+
&-row {
|
128
|
+
.teamix-pro-field.teamix-pro-field-text .next-form-preview {
|
129
|
+
color: var(--table-row-color);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
&-row.hovered {
|
133
|
+
.teamix-pro-field.teamix-pro-field-text .next-form-preview {
|
134
|
+
color: var(--table-row-hover-color);
|
135
|
+
}
|
136
|
+
}
|
121
137
|
}
|
package/lib/table/typing.d.ts
CHANGED
@@ -3,13 +3,12 @@
|
|
3
3
|
*/
|
4
4
|
import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
|
5
5
|
import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
|
6
|
-
import { QueryFilterProps } from '../form';
|
6
|
+
import { QueryFilterProps, ProFormType } from '../form';
|
7
7
|
import { ProActionGroupProps, ProActionButtonProps } from '../actions';
|
8
8
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
9
9
|
import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
|
10
10
|
import { Method } from 'axios';
|
11
11
|
import React from 'react';
|
12
|
-
import type { Form as FormType } from '@formily/core';
|
13
12
|
declare type IFieldRenderProps = keyof ProFieldRenderProps;
|
14
13
|
/** 列record函数 */
|
15
14
|
declare type ProTableCellFunProp = (value: any, index: number, record: any, ...others: any) => any;
|
@@ -102,7 +101,7 @@ export declare type ProTableProps = {
|
|
102
101
|
/** 内置 rowSelection 变化时的回调 */
|
103
102
|
onChangeRowSelection?: (selectedRowKeys: string[]) => void;
|
104
103
|
/** 获取内置 rowSelection */
|
105
|
-
getRowSelection?: (rowSelection:
|
104
|
+
getRowSelection?: (rowSelection: innerRowSelectionType) => void;
|
106
105
|
/** 表格底部(左侧)配置 */
|
107
106
|
footerAction?: ProActionGroupProps | React.ReactNode;
|
108
107
|
/** 表格底部(右层)配置 */
|
@@ -130,10 +129,14 @@ export declare type ProTableProps = {
|
|
130
129
|
data: any[];
|
131
130
|
total?: number;
|
132
131
|
}>;
|
132
|
+
/** 翻页时是否保留之前批量选择数据 */
|
133
|
+
reserveSelectedRecords?: boolean;
|
133
134
|
/** 默认漏斗过滤条件 */
|
134
135
|
defaultFilterParams?: {
|
135
136
|
[key: string]: any[] | any;
|
136
137
|
};
|
138
|
+
/** 禁用掉批量选择中的全选 */
|
139
|
+
disableSelectAll?: boolean;
|
137
140
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
138
141
|
export declare type rowSelectionType = {
|
139
142
|
getProps?: (record: any, index: number) => any;
|
@@ -159,6 +162,8 @@ export declare type ProTableActionType = {
|
|
159
162
|
fullScreen?: () => boolean;
|
160
163
|
/** 设置显示列 */
|
161
164
|
setColumn?: (newColumns: ProColumnProps[], update?: boolean) => void;
|
165
|
+
/** 表格尺寸 */
|
166
|
+
size?: 'small' | 'medium';
|
162
167
|
/** 设置表格大小 */
|
163
168
|
setSize?: (mode: 'small' | 'medium') => void;
|
164
169
|
/** 刷新表格 */
|
@@ -189,11 +194,11 @@ export declare type ProTableActionType = {
|
|
189
194
|
/** 重置翻页器为1,不发送请求 */
|
190
195
|
resetPage?: () => void;
|
191
196
|
/** 获取数据过滤区表单实例 */
|
192
|
-
dataFilterForm?:
|
197
|
+
dataFilterForm?: ProFormType;
|
193
198
|
/** 用于在 mount 的时候获取到表单 ref */
|
194
|
-
dataFilterFormRef?: React.MutableRefObject<
|
195
|
-
normalDataFilterForm?:
|
196
|
-
fullscreenDataFilterForm?:
|
199
|
+
dataFilterFormRef?: React.MutableRefObject<ProFormType>;
|
200
|
+
normalDataFilterForm?: ProFormType;
|
201
|
+
fullscreenDataFilterForm?: ProFormType;
|
197
202
|
filterEnableRef?: any;
|
198
203
|
/** 表格当前的数据 */
|
199
204
|
data?: any[];
|
@@ -171,6 +171,12 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
171
171
|
}
|
172
172
|
}, props);
|
173
173
|
}
|
174
|
+
|
175
|
+
if ((render === null || render === void 0 ? void 0 : render.type) === 'step') {
|
176
|
+
newRender = _objectSpread(_objectSpread({}, newRender), {}, {
|
177
|
+
ellipsis: false
|
178
|
+
});
|
179
|
+
}
|
174
180
|
} // 渲染操作组
|
175
181
|
|
176
182
|
|