@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,38 @@
|
|
1
|
+
var _excluded = ["name", "title", "children"];
|
2
|
+
|
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
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
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; }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
13
|
+
var initializeTableColumn = function initializeTableColumn(item) {
|
14
|
+
var name = item.name,
|
15
|
+
title = item.title,
|
16
|
+
children = item.children,
|
17
|
+
otherProps = _objectWithoutProperties(item, _excluded);
|
18
|
+
|
19
|
+
return {
|
20
|
+
name: name,
|
21
|
+
title: title,
|
22
|
+
component: 'SelectTable.Column',
|
23
|
+
children: children,
|
24
|
+
props: _objectSpread({}, otherProps)
|
25
|
+
};
|
26
|
+
};
|
27
|
+
|
28
|
+
var initialize = function initialize(item) {
|
29
|
+
var _item$children = item.children,
|
30
|
+
children = _item$children === void 0 ? [] : _item$children;
|
31
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
32
|
+
children: children.map(function (item) {
|
33
|
+
return initializeTableColumn(item);
|
34
|
+
})
|
35
|
+
});
|
36
|
+
};
|
37
|
+
|
38
|
+
export default initialize;
|
@@ -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 };
|
@@ -9,21 +9,26 @@ import { isFn, isPureObj, doCommonRequest, getValueByValue } from '@teamix/utils
|
|
9
9
|
var $request = function $request(field, requestConfig, context, type) {
|
10
10
|
var _field$data;
|
11
11
|
|
12
|
-
var
|
12
|
+
var params = requestConfig.params,
|
13
|
+
beforeRequest = requestConfig.beforeRequest,
|
14
|
+
formatResult = requestConfig.formatResult,
|
13
15
|
onSuccess = requestConfig.onSuccess;
|
14
16
|
var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field, context) : {};
|
15
17
|
/**
|
16
|
-
*
|
18
|
+
* 主动触发的请求刷新
|
17
19
|
*/
|
18
20
|
// 触发所有配置的请求
|
19
21
|
|
20
22
|
var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
21
23
|
var refreshResult = isPureObj(refresh) ? refresh : {};
|
22
24
|
return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
23
|
-
params: _objectSpread(_objectSpread(_objectSpread({},
|
25
|
+
params: _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult),
|
24
26
|
beforeRequest: function beforeRequest() {
|
25
27
|
return beforeRequestResult;
|
26
28
|
},
|
29
|
+
formatResult: isFn(formatResult) ? function (res) {
|
30
|
+
return formatResult(res, field, context);
|
31
|
+
} : formatResult,
|
27
32
|
onSuccess: isFn(onSuccess) ? function (res) {
|
28
33
|
return onSuccess(res, field, context);
|
29
34
|
} : onSuccess
|
@@ -34,7 +39,9 @@ var $request = function $request(field, requestConfig, context, type) {
|
|
34
39
|
var $common = function $common(services, requestConfig, context) {
|
35
40
|
return function (field) {
|
36
41
|
return services(field, requestConfig, context, 'request').then(function (res) {
|
37
|
-
|
42
|
+
var _requestConfig$onComp;
|
43
|
+
|
44
|
+
return (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
38
45
|
});
|
39
46
|
};
|
40
47
|
}; // 配置校验
|
@@ -44,47 +51,35 @@ var $validator = function $validator(services, requestConfig, context) {
|
|
44
51
|
return function (value, rules, _ref) {
|
45
52
|
var field = _ref.field;
|
46
53
|
return services(field, requestConfig, context, 'validator').then(function (res) {
|
47
|
-
|
54
|
+
var _requestConfig$onComp2;
|
55
|
+
|
56
|
+
return (_requestConfig$onComp2 = requestConfig.onComplete) === null || _requestConfig$onComp2 === void 0 ? void 0 : _requestConfig$onComp2.call(requestConfig, res, field, context);
|
48
57
|
});
|
49
58
|
};
|
50
59
|
}; // 配置DataSource
|
51
60
|
|
52
61
|
|
53
|
-
var $dataSource = function $dataSource(services, requestConfig, context
|
62
|
+
var $dataSource = function $dataSource(services, requestConfig, context) {
|
54
63
|
return function (field) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
readOnly: true
|
59
|
-
});
|
60
|
-
}
|
61
|
-
|
64
|
+
field.setState({
|
65
|
+
loading: true
|
66
|
+
});
|
62
67
|
return services(field, requestConfig, context, 'dataSource').then(function (res) {
|
68
|
+
var _requestConfig$onComp3;
|
69
|
+
|
63
70
|
var isValueInDataSource = getValueByValue(res, field.value);
|
64
71
|
var clearValue = isValueInDataSource ? {} : {
|
65
72
|
value: undefined
|
66
73
|
};
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
readOnly: false
|
73
|
-
}, clearValue));
|
74
|
-
} else {
|
75
|
-
field.setState({
|
76
|
-
dataSource: res
|
77
|
-
});
|
78
|
-
}
|
79
|
-
|
80
|
-
return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
|
74
|
+
field.setState(_objectSpread({
|
75
|
+
dataSource: res,
|
76
|
+
loading: false
|
77
|
+
}, clearValue));
|
78
|
+
return (_requestConfig$onComp3 = requestConfig.onComplete) === null || _requestConfig$onComp3 === void 0 ? void 0 : _requestConfig$onComp3.call(requestConfig, res, field, context);
|
81
79
|
}).catch(function () {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
readOnly: false
|
86
|
-
});
|
87
|
-
}
|
80
|
+
field.setState({
|
81
|
+
loading: false
|
82
|
+
});
|
88
83
|
});
|
89
84
|
};
|
90
85
|
};
|
package/es/form/fieldTypeMap.js
CHANGED
@@ -40,4 +40,7 @@ var fieldTypeMap = {
|
|
40
40
|
Search: 'search',
|
41
41
|
SelectGroup: 'selectGroup'
|
42
42
|
};
|
43
|
+
var datePicker2TypeArray = ['DatePicker', 'DateTimePicker', 'WeekPicker', 'MonthPicker', 'YearPicker', 'QuarterPicker', 'DateRangePicker', 'DateTimeRangePicker', 'WeekRangePicker', 'MonthRangePicker', 'YearRangePicker', 'QuarterRangePicker'];
|
44
|
+
var timePicker2TypeArray = ['TimePicker', 'TimeRangePicker'];
|
45
|
+
export { datePicker2TypeArray, timePicker2TypeArray };
|
43
46
|
export default fieldTypeMap;
|
package/es/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/es/form/utils.js
CHANGED
@@ -72,9 +72,16 @@ var mapStatus = function mapStatus(props, field) {
|
|
72
72
|
return state;
|
73
73
|
};
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
var state = takeState(props.state) || takeStatus();
|
76
|
+
var result = {
|
77
|
+
state: state
|
78
|
+
}; // 当组件处于loading状态时,仅可读不可写。
|
79
|
+
|
80
|
+
if (state === 'loading') {
|
81
|
+
result.readOnly = true;
|
82
|
+
}
|
83
|
+
|
84
|
+
return _objectSpread(_objectSpread({}, props), result);
|
78
85
|
};
|
79
86
|
|
80
87
|
var patchDataSource = function patchDataSource() {
|
@@ -92,7 +99,7 @@ var patchDataSource = function patchDataSource() {
|
|
92
99
|
return result;
|
93
100
|
};
|
94
101
|
|
95
|
-
return dataSource.map(removeEmptyChildren);
|
102
|
+
return isArr(dataSource) ? dataSource.map(removeEmptyChildren) : [];
|
96
103
|
};
|
97
104
|
|
98
105
|
var mapDataSource = function mapDataSource(props, field) {
|
package/es/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/es/index.js
CHANGED
@@ -30,7 +30,7 @@ export * from './table';
|
|
30
30
|
export * from './utils'; // export * from './sidebar';
|
31
31
|
|
32
32
|
export * from './timeline';
|
33
|
-
var version = '1.3.
|
33
|
+
var version = '1.3.3';
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
35
35
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
36
36
|
ProTimeline, hooks, nocode, templates, utils };
|
@@ -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/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"];
|
3
|
+
_excluded3 = ["title", "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
|
|
@@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom';
|
|
17
17
|
import classnames from 'classnames';
|
18
18
|
import TeamixIcon from '@teamix/icon';
|
19
19
|
import { Breadcrumb } from '@alicloudfe/components';
|
20
|
-
import { baseClass, goToLink, renderTags, isPresetColor, getColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
|
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';
|
@@ -70,7 +70,11 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
70
70
|
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
71
71
|
var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(getColorClassName(color)), isColorPresetColor), _defineProperty(_classnames, "".concat(getBackgroundColorClassName(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
72
72
|
var styleColor = isColorPresetColor ? getColor(color) : color;
|
73
|
-
var styleBgColor = isBgColorPresetColor ? getColor(
|
73
|
+
var styleBgColor = isBgColorPresetColor ? getColor(backgroundColor) : backgroundColor; // debugger;
|
74
|
+
// console.log('color', color);
|
75
|
+
// console.log('backgroundColor', backgroundColor);
|
76
|
+
// console.log('styleBgColor', styleBgColor);
|
77
|
+
|
74
78
|
var style = {
|
75
79
|
color: styleColor,
|
76
80
|
backgroundColor: styleBgColor
|
@@ -119,6 +123,14 @@ var renderInfo = function renderInfo(info) {
|
|
119
123
|
return info;
|
120
124
|
};
|
121
125
|
|
126
|
+
var renderTabs = function renderTabs(tabs) {
|
127
|
+
if (tabs) {
|
128
|
+
return /*#__PURE__*/React.createElement(CapsuleTab, _objectSpread({}, tabs));
|
129
|
+
}
|
130
|
+
|
131
|
+
return null;
|
132
|
+
};
|
133
|
+
|
122
134
|
var ProPageHeader = function ProPageHeader(props) {
|
123
135
|
var title = props.title,
|
124
136
|
description = props.description,
|
@@ -139,6 +151,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
139
151
|
children = props.children,
|
140
152
|
className = props.className,
|
141
153
|
style = props.style,
|
154
|
+
tabs = props.tabs,
|
142
155
|
others = _objectWithoutProperties(props, _excluded3);
|
143
156
|
|
144
157
|
var history = useHistory();
|
@@ -187,7 +200,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
187
200
|
size: "large"
|
188
201
|
}) : /*#__PURE__*/React.createElement(React.Fragment, null, icon)), /*#__PURE__*/React.createElement("span", {
|
189
202
|
className: cls('title-name')
|
190
|
-
}, title), renderTags(tags, 'large'));
|
203
|
+
}, title), renderTags(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
|
191
204
|
};
|
192
205
|
|
193
206
|
return /*#__PURE__*/React.createElement("header", _objectSpread({
|
@@ -22,9 +22,11 @@ var RadioItem = Menu.RadioItem;
|
|
22
22
|
var cls = baseClass('teamix-pro-table-toolbar-icon');
|
23
23
|
|
24
24
|
var DensityIcon = function DensityIcon(props) {
|
25
|
+
var _actionRef$current;
|
26
|
+
|
25
27
|
var actionRef = props.actionRef;
|
26
28
|
|
27
|
-
var _useState = useState('medium'),
|
29
|
+
var _useState = useState(((_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : _actionRef$current.size) || 'medium'),
|
28
30
|
_useState2 = _slicedToArray(_useState, 2),
|
29
31
|
size = _useState2[0],
|
30
32
|
setSize = _useState2[1]; // const [fullscreen, setFullscreen] = useState<boolean>(false);
|
@@ -44,10 +46,10 @@ var DensityIcon = function DensityIcon(props) {
|
|
44
46
|
|
45
47
|
|
46
48
|
var radioOnchange = function radioOnchange(mode) {
|
47
|
-
var _actionRef$
|
49
|
+
var _actionRef$current2, _actionRef$current2$s;
|
48
50
|
|
49
51
|
setSize(mode);
|
50
|
-
(_actionRef$
|
52
|
+
(_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);
|
51
53
|
}; // // 销毁监听函数
|
52
54
|
// useEffect(() => {
|
53
55
|
// return () => {
|
@@ -33,13 +33,22 @@ import { baseClass, getMessage } from '@teamix/utils';
|
|
33
33
|
import React, { useState, useEffect } from 'react';
|
34
34
|
import { cloneDeep, off, on } from '../../utils';
|
35
35
|
import './index.scss';
|
36
|
-
import { Ellipsis } from '@teamix/utils';
|
36
|
+
import { Ellipsis, getCookie } from '@teamix/utils';
|
37
37
|
var CheckboxItem = Menu.CheckboxItem;
|
38
38
|
var Row = Grid.Row,
|
39
39
|
Col = Grid.Col;
|
40
|
-
var cls = baseClass('teamix-pro-table-toolbar-filter-column');
|
40
|
+
var cls = baseClass('teamix-pro-table-toolbar-filter-column'); // 判断是否是 root 组织
|
41
|
+
|
42
|
+
var isRoot = getCookie('organizationId') === '1';
|
41
43
|
|
42
44
|
var processColumns = function processColumns(columns) {
|
45
|
+
if (isRoot) {
|
46
|
+
// root 组织下不显示标签管理
|
47
|
+
columns = columns.filter(function (item) {
|
48
|
+
return item.valueType !== 'selectGroup';
|
49
|
+
});
|
50
|
+
}
|
51
|
+
|
43
52
|
return columns.map(function (item) {
|
44
53
|
if (item.columnFilters === false) {
|
45
54
|
return item;
|
@@ -296,7 +305,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
296
305
|
return onChangeColumns(check, dataIndex);
|
297
306
|
},
|
298
307
|
disabled: columnFiltersDisabled
|
299
|
-
}, title, !lock && /*#__PURE__*/React.createElement("div", {
|
308
|
+
}, title, !lock && !columnFiltersDisabled && /*#__PURE__*/React.createElement("div", {
|
300
309
|
className: cls({
|
301
310
|
sort: true
|
302
311
|
})
|
@@ -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/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
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"];
|
1
|
+
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"];
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
4
|
|
@@ -176,6 +176,11 @@ var ProTable = function ProTable(props) {
|
|
176
176
|
_props$filterColumnTy = props.filterColumnType,
|
177
177
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
178
178
|
defaultFilterParams = props.defaultFilterParams,
|
179
|
+
_props$reserveSelecte = props.reserveSelectedRecords,
|
180
|
+
reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
|
181
|
+
_props$size = props.size,
|
182
|
+
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
183
|
+
disableSelectAll = props.disableSelectAll,
|
179
184
|
otherProps = _objectWithoutProperties(props, _excluded);
|
180
185
|
|
181
186
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -229,7 +234,7 @@ var ProTable = function ProTable(props) {
|
|
229
234
|
filteredColumns = _useState16[0],
|
230
235
|
setFilteredColumns = _useState16[1];
|
231
236
|
|
232
|
-
var _useState17 = useState(
|
237
|
+
var _useState17 = useState(propsSize),
|
233
238
|
_useState18 = _slicedToArray(_useState17, 2),
|
234
239
|
size = _useState18[0],
|
235
240
|
_setSize = _useState18[1];
|
@@ -339,7 +344,7 @@ var ProTable = function ProTable(props) {
|
|
339
344
|
result = propsRowSelection.getProps(record, index);
|
340
345
|
}
|
341
346
|
|
342
|
-
if (showSkeleton) {
|
347
|
+
if (showSkeleton && result) {
|
343
348
|
result.disabled = true;
|
344
349
|
}
|
345
350
|
|
@@ -352,7 +357,7 @@ var ProTable = function ProTable(props) {
|
|
352
357
|
result = propsRowSelection.titleProps();
|
353
358
|
}
|
354
359
|
|
355
|
-
if (showSkeleton) {
|
360
|
+
if (showSkeleton || disableSelectAll) {
|
356
361
|
result.disabled = true;
|
357
362
|
}
|
358
363
|
|
@@ -387,7 +392,7 @@ var ProTable = function ProTable(props) {
|
|
387
392
|
return selectedRowKeys.includes(k);
|
388
393
|
});
|
389
394
|
return {
|
390
|
-
disabled: showLoading && !showSkeleton && (getData.loading || props.loading),
|
395
|
+
disabled: disableSelectAll || showLoading && !showSkeleton && (getData.loading || props.loading),
|
391
396
|
onChange: function onChange(check) {
|
392
397
|
if (check) {
|
393
398
|
var result = selectedRowKeys.concat([]);
|
@@ -491,6 +496,7 @@ var ProTable = function ProTable(props) {
|
|
491
496
|
emit('refreshFilterState', newColumns);
|
492
497
|
}
|
493
498
|
},
|
499
|
+
size: size,
|
494
500
|
setSize: function setSize(mode) {
|
495
501
|
_setSize(mode);
|
496
502
|
},
|
@@ -860,21 +866,30 @@ var ProTable = function ProTable(props) {
|
|
860
866
|
|
861
867
|
var renderFooter = function renderFooter() {
|
862
868
|
function onChangePagination(currentPage) {
|
863
|
-
var _actionRef$current7, _actionRef$current7$c;
|
864
|
-
|
865
869
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
866
|
-
|
867
|
-
|
870
|
+
|
871
|
+
// 翻页默认清空选择
|
872
|
+
if (!reserveSelectedRecords) {
|
873
|
+
var _actionRef$current7, _actionRef$current7$c;
|
874
|
+
|
875
|
+
(_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);
|
876
|
+
}
|
877
|
+
|
868
878
|
setCurrentPage(currentPage);
|
869
879
|
|
870
880
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
871
881
|
}
|
872
882
|
|
873
883
|
function onChangePaginationSize(currentPageSize) {
|
874
|
-
var
|
884
|
+
var _request5;
|
885
|
+
|
886
|
+
// 翻页默认清空选择
|
887
|
+
if (!reserveSelectedRecords) {
|
888
|
+
var _actionRef$current8, _actionRef$current8$c;
|
889
|
+
|
890
|
+
(_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);
|
891
|
+
}
|
875
892
|
|
876
|
-
// 翻页暂时先清空选择
|
877
|
-
(_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);
|
878
893
|
setPageSize(currentPageSize);
|
879
894
|
setCurrentPage(1);
|
880
895
|
|
package/es/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/es/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[];
|
@@ -158,6 +158,12 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
|
|
158
158
|
}
|
159
159
|
}, props);
|
160
160
|
}
|
161
|
+
|
162
|
+
if ((render === null || render === void 0 ? void 0 : render.type) === 'step') {
|
163
|
+
newRender = _objectSpread(_objectSpread({}, newRender), {}, {
|
164
|
+
ellipsis: false
|
165
|
+
});
|
166
|
+
}
|
161
167
|
} // 渲染操作组
|
162
168
|
|
163
169
|
|