@teamix/pro 1.2.26 → 1.2.27
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/212.js +129 -129
- package/dist/pro.css +1 -1
- package/dist/pro.js +18371 -16873
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -0
- package/es/form/Filter/AdvancedFilter.js +1 -1
- package/es/form/Filter/Layout.d.ts +5 -0
- package/es/form/Filter/Layout.js +82 -0
- package/es/form/Filter/SimpleFilter.js +30 -6
- package/es/form/Filter/index2.d.ts +2 -1
- package/es/form/Filter/index2.js +97 -116
- package/es/form/Filter/index2.scss +16 -45
- package/es/form/Filter/layout.scss +36 -0
- package/es/form/Filter/useSpecialProps.d.ts +6 -0
- package/es/form/Filter/useSpecialProps.js +37 -0
- package/es/form/ProForm/customComponent.d.ts +3 -0
- package/es/form/ProForm/customComponent.js +20 -0
- package/es/form/ProForm/index.scss +5 -6
- package/es/form/ProForm/useFormDisplayValues.js +14 -24
- package/es/form/SchemaForm/adapterType.js +1 -0
- package/es/form/fieldTypeMap.js +2 -1
- package/es/form/index.d.ts +4 -2
- package/es/form/index.js +4 -2
- package/es/form/typing.d.ts +25 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/index.scss +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/table/components/Layout/index.js +63 -167
- package/es/table/components/Layout/index.scss +4 -3
- package/es/table/components/Pagination/index.js +1 -0
- package/es/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/es/table/components/ToolBar/Fullscreen.js +21 -11
- package/es/table/index.js +64 -95
- package/es/table/typing.d.ts +12 -10
- package/es/table/utils/columnRender.js +21 -3
- package/lib/form/Filter/AdvancedFilter.js +1 -1
- package/lib/form/Filter/Layout.d.ts +5 -0
- package/lib/form/Filter/Layout.js +102 -0
- package/lib/form/Filter/SimpleFilter.js +29 -4
- package/lib/form/Filter/index2.d.ts +2 -1
- package/lib/form/Filter/index2.js +101 -114
- package/lib/form/Filter/index2.scss +16 -45
- package/lib/form/Filter/layout.scss +36 -0
- package/lib/form/Filter/useSpecialProps.d.ts +6 -0
- package/lib/form/Filter/useSpecialProps.js +46 -0
- package/lib/form/ProForm/customComponent.d.ts +3 -0
- package/lib/form/ProForm/customComponent.js +28 -0
- package/lib/form/ProForm/index.scss +5 -6
- package/lib/form/ProForm/useFormDisplayValues.js +17 -24
- package/lib/form/SchemaForm/adapterType.js +1 -0
- package/lib/form/fieldTypeMap.js +2 -1
- package/lib/form/index.d.ts +4 -2
- package/lib/form/index.js +19 -1
- package/lib/form/typing.d.ts +25 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/index.scss +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/table/components/Layout/index.js +61 -167
- package/lib/table/components/Layout/index.scss +4 -3
- package/lib/table/components/Pagination/index.js +1 -0
- package/lib/table/components/ToolBar/FullScreenIcon.js +4 -9
- package/lib/table/components/ToolBar/Fullscreen.js +22 -11
- package/lib/table/index.js +61 -93
- package/lib/table/typing.d.ts +12 -10
- package/lib/table/utils/columnRender.js +21 -3
- package/package.json +4 -4
@@ -0,0 +1,37 @@
|
|
1
|
+
import { isSignificative, isStr, isPlainObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
|
2
|
+
|
3
|
+
var useSpecialProps = function useSpecialProps(props) {
|
4
|
+
var initialValues = props.initialValues,
|
5
|
+
initialRequest = props.initialRequest;
|
6
|
+
var hasDefault = !!initialValues;
|
7
|
+
var hasAsyncDefault = !!initialRequest;
|
8
|
+
var hasRequired = false;
|
9
|
+
|
10
|
+
var hasDefaultOrRule = function hasDefaultOrRule(schema) {
|
11
|
+
schema.forEach(function (item) {
|
12
|
+
var value = item.default,
|
13
|
+
required = item.required,
|
14
|
+
rules = item.rules,
|
15
|
+
request = item.request,
|
16
|
+
dataSource = item.dataSource,
|
17
|
+
children = item.children;
|
18
|
+
hasDefault = hasDefault || isSignificative(value);
|
19
|
+
hasRequired = hasRequired || required || !!rules;
|
20
|
+
hasAsyncDefault = hasAsyncDefault || !!request || // 如果dataSource是异步且default取自dataSource
|
21
|
+
!!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
|
22
|
+
|
23
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
24
|
+
hasDefaultOrRule(children);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
};
|
28
|
+
|
29
|
+
hasDefaultOrRule(props.schema);
|
30
|
+
return {
|
31
|
+
hasDefault: hasDefault,
|
32
|
+
hasAsyncDefault: hasAsyncDefault,
|
33
|
+
hasRequired: hasRequired
|
34
|
+
};
|
35
|
+
};
|
36
|
+
|
37
|
+
export default useSpecialProps;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
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; }
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
+
|
7
|
+
import { connect, mapProps } from '@formily/react';
|
8
|
+
import { toJS } from '@formily/reactive';
|
9
|
+
|
10
|
+
var customComponent = function customComponent(component) {
|
11
|
+
return connect(component, mapProps(function (props, field) {
|
12
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
13
|
+
field: field,
|
14
|
+
form: field.form,
|
15
|
+
values: toJS(field.form.values)
|
16
|
+
});
|
17
|
+
}));
|
18
|
+
};
|
19
|
+
|
20
|
+
export { customComponent };
|
@@ -186,18 +186,17 @@
|
|
186
186
|
}
|
187
187
|
|
188
188
|
// 数组类组件添加按钮
|
189
|
-
.#{$form-array}-base-addition {
|
189
|
+
.#{$css-prefix}btn.#{$form-array}-base-addition {
|
190
|
+
border-style: dashed;
|
190
191
|
.#{$css-prefix}formily-icon {
|
191
192
|
margin-right: 4px;
|
192
193
|
}
|
193
194
|
}
|
194
195
|
// 数组类ArrayItem Icon 居中
|
195
196
|
.#{$form-array}-items-item-inner {
|
196
|
-
|
197
|
-
> .#{$css-prefix}
|
198
|
-
|
199
|
-
margin-top: 9px;
|
200
|
-
}
|
197
|
+
.#{$css-prefix}space-item {
|
198
|
+
> .#{$css-prefix}formily-icon {
|
199
|
+
margin-top: 9px;
|
201
200
|
}
|
202
201
|
}
|
203
202
|
}
|
@@ -13,6 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import { useForm } from '@formily/react';
|
14
14
|
import { toJS } from '@formily/reactive';
|
15
15
|
import { isArr, isPlainObj, isSignificative, getValueByValue } from '@teamix/utils';
|
16
|
+
import fieldTypeMap from '../fieldTypeMap';
|
16
17
|
/**
|
17
18
|
* 获取表单值的可显示值
|
18
19
|
* @returns 如果某字段有dataSource,则返回value对应label
|
@@ -36,30 +37,17 @@ var getDisplayValues = function getDisplayValues(form, values) {
|
|
36
37
|
|
37
38
|
var getAddress = function getAddress(path) {
|
38
39
|
return form.indexes[path];
|
39
|
-
}; //
|
40
|
+
}; // 当前field
|
40
41
|
|
41
42
|
|
42
|
-
var
|
43
|
-
return !isPlainObj(value) && !isArr(value) && !getAddress(connectPath(path));
|
44
|
-
};
|
45
|
-
|
46
|
-
var isLayoutValue = function isLayoutValue(object) {
|
47
|
-
var _Object$entries$ = _slicedToArray(Object.entries(object)[0], 2),
|
48
|
-
key = _Object$entries$[0],
|
49
|
-
value = _Object$entries$[1];
|
50
|
-
|
51
|
-
return !isFieldValue(value, key);
|
52
|
-
};
|
53
|
-
|
54
|
-
var isArrayValue = function isArrayValue(array) {
|
55
|
-
return !isFieldValue(array[0], 0);
|
56
|
-
}; // 判断值的类型,递归获取每个值在该结构中的完整路径
|
43
|
+
var field = form.query(getAddress(prefix)).take(); // 是否真实字段值(自定义组件、布局组件、自增数组组件为非真实字段)
|
57
44
|
|
45
|
+
var isFieldValue = Object.keys(fieldTypeMap).includes(field === null || field === void 0 ? void 0 : field.component[0]); // 判断值的类型,递归获取每个值在该结构中的完整路径
|
58
46
|
|
59
47
|
if (!isSignificative(values)) {
|
60
48
|
displayValues = {};
|
61
|
-
} else if (isPlainObj(values) &&
|
62
|
-
//
|
49
|
+
} else if (isPlainObj(values) && !isFieldValue) {
|
50
|
+
// 如果值是布局对象的值
|
63
51
|
displayValues = {};
|
64
52
|
Object.entries(values).forEach(function (_ref) {
|
65
53
|
var _ref2 = _slicedToArray(_ref, 2),
|
@@ -68,8 +56,10 @@ var getDisplayValues = function getDisplayValues(form, values) {
|
|
68
56
|
|
69
57
|
displayValues[key] = getDisplayValues(form, value, connectPath(key));
|
70
58
|
});
|
71
|
-
} else if (isArr(values) &&
|
72
|
-
//
|
59
|
+
} else if (isArr(values) && !isFieldValue) {
|
60
|
+
// 如果值是自增数组的值
|
61
|
+
// ArrayItems为字符串数组时,由于form.indexes中对应address为最后一个组件,无法正常获取displayName
|
62
|
+
// 例如:arrayItemsString.0: "arrayItemsString.0.ArrayItemsRemove"
|
73
63
|
displayValues = [];
|
74
64
|
values.map(function (value, index) {
|
75
65
|
displayValues[index] = getDisplayValues(form, value, connectPath(index));
|
@@ -78,14 +68,14 @@ var getDisplayValues = function getDisplayValues(form, values) {
|
|
78
68
|
var _values$value;
|
79
69
|
|
80
70
|
// 通过值的完整路径获取字段address(从form实例的indexes中),然后获取该字段的value在该字段dataSource中对应的label
|
81
|
-
var
|
82
|
-
var realValue = (_values$value = values === null || values === void 0 ? void 0 : values.value) !== null && _values$value !== void 0 ? _values$value : values; // 针对单个字段的值是对象
|
71
|
+
var realValue = (_values$value = values === null || values === void 0 ? void 0 : values.value) !== null && _values$value !== void 0 ? _values$value : values; // 针对单个字段的值是对象,例如Select的useDetailValue
|
83
72
|
|
73
|
+
var displayValue = getValueByValue(field === null || field === void 0 ? void 0 : field.dataSource, realValue);
|
84
74
|
displayValues = {
|
85
75
|
title: field === null || field === void 0 ? void 0 : field.title,
|
86
76
|
component: field === null || field === void 0 ? void 0 : field.component[0],
|
87
|
-
value:
|
88
|
-
displayValue:
|
77
|
+
value: values,
|
78
|
+
displayValue: displayValue
|
89
79
|
};
|
90
80
|
}
|
91
81
|
|
package/es/form/fieldTypeMap.js
CHANGED
package/es/form/index.d.ts
CHANGED
@@ -97,7 +97,8 @@ declare const formilyReact: {
|
|
97
97
|
useFieldSchema: () => originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>;
|
98
98
|
useFormEffects: (effects?: ((form: import("@formily/core").Form<any>) => void) | undefined) => void;
|
99
99
|
};
|
100
|
-
|
100
|
+
import { customComponent } from './ProForm/customComponent';
|
101
|
+
export { formilyReact, customComponent };
|
101
102
|
/**
|
102
103
|
* 导出常用formily内容
|
103
104
|
*/
|
@@ -110,7 +111,8 @@ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, Fo
|
|
110
111
|
*/
|
111
112
|
import { AdvancedFilter, SimpleFilter } from './Filter';
|
112
113
|
import { QueryFilter } from './Filter/index2';
|
113
|
-
|
114
|
+
import { QueryFilterLayout } from './Filter/Layout';
|
115
|
+
export { AdvancedFilter, SimpleFilter, QueryFilter, QueryFilterLayout };
|
114
116
|
/**
|
115
117
|
* 导出 ProForm 组件,支持快速搭建表单
|
116
118
|
*/
|
package/es/form/index.js
CHANGED
@@ -27,7 +27,8 @@ var formilyReact = _objectSpread(_objectSpread({}, originalFormilyReact), {}, {
|
|
27
27
|
useFormDisplayValues: useFormDisplayValues
|
28
28
|
});
|
29
29
|
|
30
|
-
|
30
|
+
import { customComponent } from './ProForm/customComponent';
|
31
|
+
export { formilyReact, customComponent };
|
31
32
|
/**
|
32
33
|
* 导出常用formily内容
|
33
34
|
*/
|
@@ -42,7 +43,8 @@ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, Fo
|
|
42
43
|
|
43
44
|
import { AdvancedFilter, SimpleFilter } from './Filter';
|
44
45
|
import { QueryFilter } from './Filter/index2';
|
45
|
-
|
46
|
+
import { QueryFilterLayout } from './Filter/Layout';
|
47
|
+
export { AdvancedFilter, SimpleFilter, QueryFilter, QueryFilterLayout };
|
46
48
|
/**
|
47
49
|
* 导出 ProForm 组件,支持快速搭建表单
|
48
50
|
*/
|
package/es/form/typing.d.ts
CHANGED
@@ -10,7 +10,7 @@ declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
|
|
10
10
|
export interface ProFormInitializeItem {
|
11
11
|
(item: ProFormSchemaItem, props?: any): ProFormSchemaItem;
|
12
12
|
}
|
13
|
-
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';
|
13
|
+
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';
|
14
14
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
15
15
|
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
16
|
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';
|
@@ -70,20 +70,44 @@ export interface FilterProps extends ProFormProps {
|
|
70
70
|
onReset?: (payload?: any) => void;
|
71
71
|
onResetClick?: () => void;
|
72
72
|
}
|
73
|
+
export interface QueryFilterLayoutProps {
|
74
|
+
prefixCls?: string;
|
75
|
+
className?: string;
|
76
|
+
addonBefore?: ReactNode;
|
77
|
+
addonAfter?: ReactNode;
|
78
|
+
inlineContent?: ReactNode;
|
79
|
+
panelContent?: ReactNode;
|
80
|
+
count?: number;
|
81
|
+
expand?: boolean;
|
82
|
+
onExpand?: (expand: boolean) => void;
|
83
|
+
}
|
73
84
|
export interface QueryFilterProps extends ProFormProps {
|
74
85
|
/**
|
75
86
|
* @deprecated triggerType已弃用
|
76
87
|
*/
|
77
88
|
triggerType?: 'keydown' | 'change' | 'submit';
|
89
|
+
/** 表单展示形式 */
|
78
90
|
mode?: 'inline' | 'panel';
|
91
|
+
/** 面板是否默认展开,仅在 mode='panel' 时生效 */
|
79
92
|
expand?: boolean;
|
93
|
+
/** 顶部筛选区前缀 */
|
80
94
|
addonBefore?: ReactNode;
|
95
|
+
/** 顶部筛选区后缀 */
|
81
96
|
addonAfter?: ReactNode;
|
97
|
+
/** 顶部筛选区默认筛选项 */
|
82
98
|
defaultFilterValue?: string;
|
99
|
+
/** 透出内部表单实例 */
|
83
100
|
formRef?: React.MutableRefObject<any>;
|
101
|
+
/** onChange事件的防抖时间 */
|
102
|
+
filterDebounce?: number;
|
103
|
+
/** 表单初始化(含异步默认值)后回调函数 */
|
84
104
|
onInit?: (values: any) => boolean;
|
105
|
+
/** 表单筛选回调函数 */
|
85
106
|
onFilter?: (values: any) => void;
|
107
|
+
/** 表单重置回调函数 */
|
86
108
|
onReset?: (payload?: any) => void;
|
109
|
+
/** 高级筛选按钮切换 */
|
110
|
+
onExpand?: (expand: boolean) => void;
|
87
111
|
}
|
88
112
|
/**
|
89
113
|
* 兼容性导出
|
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 './step';
|
27
|
-
declare const version = "1.2.
|
27
|
+
declare const version = "1.2.27";
|
28
28
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProStep, 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 './step';
|
33
|
-
var version = '1.2.
|
33
|
+
var version = '1.2.27';
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
35
35
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
36
36
|
ProStep, hooks, nocode, templates, utils };
|
package/es/info/index.scss
CHANGED
@@ -12,7 +12,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
12
12
|
|
13
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
14
14
|
|
15
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); }
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
16
16
|
|
17
17
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
18
18
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "
|
1
|
+
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "rowSelection"];
|
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
|
|
@@ -8,35 +8,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
8
8
|
|
9
9
|
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); }
|
10
10
|
|
11
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
12
|
-
|
13
|
-
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."); }
|
14
|
-
|
15
|
-
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); }
|
16
|
-
|
17
|
-
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; }
|
18
|
-
|
19
|
-
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; }
|
20
|
-
|
21
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
22
|
-
|
23
11
|
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; }
|
24
12
|
|
25
13
|
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; }
|
26
14
|
|
27
|
-
import React, {
|
15
|
+
import React, { isValidElement } from 'react';
|
28
16
|
import { Header, baseClass } from '@teamix/utils';
|
29
|
-
import { Button, Badge } from '@alicloudfe/components';
|
30
|
-
import TeamixIcon from '@teamix/icon';
|
31
17
|
import { ProActionGroup } from '../../../actions';
|
32
|
-
import {
|
33
|
-
import { getMessage } from '@teamix/utils';
|
18
|
+
import { QueryFilter, QueryFilterLayout } from '../../../form';
|
34
19
|
import ToolBar from '../ToolBar';
|
35
20
|
import QuickAction from '../QuickAction';
|
36
|
-
import isEmpty from 'lodash.isempty';
|
37
21
|
import './index.scss';
|
38
22
|
var cls = baseClass('teamix-pro-table-layout');
|
39
|
-
var toJS = formilyReactive.toJS;
|
40
23
|
|
41
24
|
var Layout = function Layout(props) {
|
42
25
|
var header = props.header,
|
@@ -44,27 +27,10 @@ var Layout = function Layout(props) {
|
|
44
27
|
extra = props.extra,
|
45
28
|
actionRef = props.actionRef,
|
46
29
|
dataFilter = props.dataFilter,
|
47
|
-
|
30
|
+
dataFilterFormRef = props.dataFilterFormRef,
|
48
31
|
rowSelection = props.rowSelection,
|
49
|
-
otherProps = _objectWithoutProperties(props, _excluded);
|
50
|
-
|
51
|
-
var mode = dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.mode;
|
32
|
+
otherProps = _objectWithoutProperties(props, _excluded); // 渲染主操作区
|
52
33
|
|
53
|
-
var _useState = useState((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.expand) || false),
|
54
|
-
_useState2 = _slicedToArray(_useState, 2),
|
55
|
-
expand = _useState2[0],
|
56
|
-
setExpand = _useState2[1];
|
57
|
-
|
58
|
-
var _useState3 = useState(false),
|
59
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
60
|
-
hasDot = _useState4[0],
|
61
|
-
setHasDot = _useState4[1];
|
62
|
-
|
63
|
-
useEffect(function () {
|
64
|
-
if (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.expand) {
|
65
|
-
setExpand(dataFilter.expand);
|
66
|
-
}
|
67
|
-
}, [dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.expand]); // 渲染主操作区
|
68
34
|
|
69
35
|
var renderMainAction = function renderMainAction() {
|
70
36
|
var _mainAction$actions;
|
@@ -90,96 +56,66 @@ var Layout = function Layout(props) {
|
|
90
56
|
context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context)
|
91
57
|
})));
|
92
58
|
} else return mainAction;
|
93
|
-
}; //
|
94
|
-
|
95
|
-
|
96
|
-
var renderInlineFilter = function renderInlineFilter() {
|
97
|
-
var _dataFilter$schema;
|
98
|
-
|
99
|
-
if (dataFilter && (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) > 0) {
|
100
|
-
return /*#__PURE__*/React.createElement("div", {
|
101
|
-
className: cls('inline-filter')
|
102
|
-
}, /*#__PURE__*/React.createElement(SimpleFilter, _objectSpread({
|
103
|
-
form: dataFilterForm
|
104
|
-
}, dataFilter)));
|
105
|
-
}
|
106
|
-
}; // 渲染 mode='panel' 数据过滤区
|
59
|
+
}; // 渲染新版 QueryFilter
|
107
60
|
|
108
61
|
|
109
|
-
var
|
62
|
+
var renderQueryFilter = function renderQueryFilter() {
|
110
63
|
if (dataFilter) {
|
111
|
-
var _dataFilter$
|
64
|
+
var _dataFilter$schema;
|
112
65
|
|
113
66
|
if ( /*#__PURE__*/isValidElement(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
|
114
|
-
//
|
115
|
-
return /*#__PURE__*/React.createElement(
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
67
|
+
// 自定义渲染内容
|
68
|
+
return /*#__PURE__*/React.createElement(QueryFilterLayout, _objectSpread({
|
69
|
+
onExpand: function onExpand(expand) {
|
70
|
+
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
71
|
+
setTimeout(function () {
|
72
|
+
var _actionRef$current, _actionRef$current$ge;
|
73
|
+
|
74
|
+
if ((_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge = _actionRef$current.getState) === null || _actionRef$current$ge === void 0 ? void 0 : _actionRef$current$ge.call(_actionRef$current).fullScreenState) {
|
75
|
+
var _actionRef$current2, _actionRef$current2$r;
|
76
|
+
|
77
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
78
|
+
}
|
79
|
+
});
|
80
|
+
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
81
|
+
},
|
82
|
+
panelContent: dataFilter.content,
|
83
|
+
addonBefore: renderMainAction(),
|
84
|
+
addonAfter: /*#__PURE__*/React.createElement(React.Fragment, null, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
|
85
|
+
actionRef: actionRef,
|
86
|
+
quickAction: extra,
|
87
|
+
rowSelection: rowSelection
|
88
|
+
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
89
|
+
actionRef: actionRef
|
90
|
+
}, otherProps)))
|
91
|
+
}, dataFilter));
|
92
|
+
} else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) >= 0) {
|
93
|
+
return /*#__PURE__*/React.createElement(QueryFilter, _objectSpread({
|
94
|
+
formRef: dataFilterFormRef,
|
95
|
+
onExpand: function onExpand(expand) {
|
96
|
+
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
97
|
+
setTimeout(function () {
|
98
|
+
var _actionRef$current3, _actionRef$current3$g;
|
99
|
+
|
100
|
+
if ((_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : _actionRef$current3$g.call(_actionRef$current3).fullScreenState) {
|
101
|
+
var _actionRef$current4, _actionRef$current4$r;
|
102
|
+
|
103
|
+
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$r = _actionRef$current4.resetTableMaxBodyHeight) === null || _actionRef$current4$r === void 0 ? void 0 : _actionRef$current4$r.call(_actionRef$current4);
|
104
|
+
}
|
105
|
+
});
|
106
|
+
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
107
|
+
},
|
108
|
+
addonBefore: renderMainAction(),
|
109
|
+
addonAfter: /*#__PURE__*/React.createElement(React.Fragment, null, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
|
110
|
+
actionRef: actionRef,
|
111
|
+
quickAction: extra,
|
112
|
+
rowSelection: rowSelection
|
113
|
+
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
114
|
+
actionRef: actionRef
|
115
|
+
}, otherProps)))
|
116
|
+
}, dataFilter));
|
130
117
|
}
|
131
118
|
}
|
132
|
-
}; // 渲染过滤器按钮
|
133
|
-
|
134
|
-
|
135
|
-
var renderFilterBtn = function renderFilterBtn() {
|
136
|
-
var handleBtnClick = function handleBtnClick() {
|
137
|
-
setExpand(!expand);
|
138
|
-
var filterValues = Object.values(toJS(dataFilterForm === null || dataFilterForm === void 0 ? void 0 : dataFilterForm.values)).filter(function (v) {
|
139
|
-
return !isEmpty(v);
|
140
|
-
}); // console.log('filterValues', filterValues);
|
141
|
-
|
142
|
-
if (filterValues && (filterValues === null || filterValues === void 0 ? void 0 : filterValues.length) > 0) {
|
143
|
-
setHasDot(true);
|
144
|
-
} else {
|
145
|
-
setHasDot(false);
|
146
|
-
} // 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
147
|
-
|
148
|
-
|
149
|
-
setTimeout(function () {
|
150
|
-
var _actionRef$current, _actionRef$current$ge;
|
151
|
-
|
152
|
-
if ((_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge = _actionRef$current.getState) === null || _actionRef$current$ge === void 0 ? void 0 : _actionRef$current$ge.call(_actionRef$current).fullScreenState) {
|
153
|
-
var _actionRef$current2, _actionRef$current2$r;
|
154
|
-
|
155
|
-
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
156
|
-
}
|
157
|
-
});
|
158
|
-
};
|
159
|
-
|
160
|
-
if (mode === 'panel') {
|
161
|
-
if (expand === false && hasDot) {
|
162
|
-
return /*#__PURE__*/React.createElement(Badge, {
|
163
|
-
dot: true,
|
164
|
-
className: cls('filter-btn')
|
165
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
166
|
-
onClick: handleBtnClick,
|
167
|
-
style: {
|
168
|
-
minWidth: 'unset'
|
169
|
-
}
|
170
|
-
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
171
|
-
type: expand ? 'up-line' : 'filter-line'
|
172
|
-
}), getMessage('filter')));
|
173
|
-
} else return /*#__PURE__*/React.createElement(Button, {
|
174
|
-
onClick: handleBtnClick,
|
175
|
-
className: cls('filter-btn'),
|
176
|
-
style: {
|
177
|
-
minWidth: 'unset'
|
178
|
-
}
|
179
|
-
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
180
|
-
type: expand ? 'up-line' : 'filter-line'
|
181
|
-
}), getMessage('filter'));
|
182
|
-
}
|
183
119
|
}; // 区域组合渲染
|
184
120
|
|
185
121
|
|
@@ -195,61 +131,21 @@ var Layout = function Layout(props) {
|
|
195
131
|
actionRef: actionRef,
|
196
132
|
quickAction: extra,
|
197
133
|
rowSelection: rowSelection
|
198
|
-
}))),
|
199
|
-
className: cls('wrapper')
|
200
|
-
}, /*#__PURE__*/React.createElement("div", {
|
201
|
-
className: cls('left')
|
202
|
-
}, mainAction && renderMainAction(), mode === 'panel' && renderFilterBtn(), mode === 'inline' && renderInlineFilter()), /*#__PURE__*/React.createElement("div", {
|
203
|
-
className: cls('right')
|
204
|
-
}, /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
205
|
-
actionRef: actionRef
|
206
|
-
}, otherProps)))), mode === 'panel' && renderPanelFilter());
|
134
|
+
}))), renderQueryFilter());
|
207
135
|
} else if (header && !mainAction) {
|
208
136
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
209
137
|
className: cls('wrapper')
|
210
138
|
}, /*#__PURE__*/React.createElement("div", {
|
211
139
|
className: cls('left')
|
212
|
-
}, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)),
|
213
|
-
className: cls('right')
|
214
|
-
}, extra && /*#__PURE__*/React.createElement(QuickAction, {
|
215
|
-
actionRef: actionRef,
|
216
|
-
quickAction: extra,
|
217
|
-
rowSelection: rowSelection
|
218
|
-
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
219
|
-
actionRef: actionRef
|
220
|
-
}, otherProps)))), mode === 'panel' && renderPanelFilter());
|
140
|
+
}, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)), renderQueryFilter())));
|
221
141
|
} else if (!header && mainAction) {
|
222
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
223
|
-
className: cls('wrapper')
|
224
|
-
}, /*#__PURE__*/React.createElement("div", {
|
225
|
-
className: cls('left')
|
226
|
-
}, mainAction && renderMainAction(), mode === 'panel' && renderFilterBtn(), mode === 'inline' && renderInlineFilter()), /*#__PURE__*/React.createElement("div", {
|
227
|
-
className: cls('right')
|
228
|
-
}, extra && /*#__PURE__*/React.createElement(QuickAction, {
|
229
|
-
actionRef: actionRef,
|
230
|
-
quickAction: extra,
|
231
|
-
rowSelection: rowSelection
|
232
|
-
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
233
|
-
actionRef: actionRef
|
234
|
-
}, otherProps)))), mode === 'panel' && renderPanelFilter());
|
142
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
|
235
143
|
} else if (!header && !mainAction) {
|
236
|
-
if (!
|
144
|
+
if (!dataFilterFormRef && !extra) {
|
237
145
|
return null;
|
238
146
|
}
|
239
147
|
|
240
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
241
|
-
className: cls('wrapper')
|
242
|
-
}, /*#__PURE__*/React.createElement("div", {
|
243
|
-
className: cls('left')
|
244
|
-
}, mode === 'panel' && renderFilterBtn(), mode === 'inline' && renderInlineFilter()), /*#__PURE__*/React.createElement("div", {
|
245
|
-
className: cls('right')
|
246
|
-
}, extra && /*#__PURE__*/React.createElement(QuickAction, {
|
247
|
-
actionRef: actionRef,
|
248
|
-
quickAction: extra,
|
249
|
-
rowSelection: rowSelection
|
250
|
-
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
251
|
-
actionRef: actionRef
|
252
|
-
}, otherProps)))), mode === 'panel' && renderPanelFilter());
|
148
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
|
253
149
|
}
|
254
150
|
};
|
255
151
|
|
@@ -9,9 +9,10 @@ $prefix: 'teamix-pro-table-layout';
|
|
9
9
|
display: flex;
|
10
10
|
justify-content: space-between;
|
11
11
|
margin-bottom: 8px;
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
// margin-bottom: 8px;
|
13
|
+
// &:not(:first-child) {
|
14
|
+
// margin-top: 8px;
|
15
|
+
// }
|
15
16
|
}
|
16
17
|
&-left {
|
17
18
|
display: flex;
|